1 /* 2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 ** Distributed under the terms of the OpenBeOS License. 4 */ 5 6 7 #include "keyboard.h" 8 #include "toscalls.h" 9 10 #include <boot/platform.h> 11 12 13 static uint32 14 check_for_key(void) 15 { 16 union key k; 17 if (Bconstat(DEV_CON) == 0) 18 return 0; 19 20 k.d0 = Bconin(DEV_CON); 21 return k.d0; 22 } 23 24 25 extern "C" void 26 clear_key_buffer(void) 27 { 28 while (check_for_key() != 0) 29 ; 30 } 31 32 33 extern "C" union key 34 wait_for_key(void) 35 { 36 union key key; 37 key.d0 = Bconin(DEV_CON); 38 39 return key; 40 } 41 42 43 extern "C" uint32 44 check_for_boot_keys(void) 45 { 46 union key key; 47 uint32 options = 0; 48 49 while ((key.d0 = check_for_key()) != 0) { 50 switch (key.code.ascii) { 51 case ' ': 52 options |= BOOT_OPTION_MENU; 53 break; 54 case 0x1b: // escape 55 options |= BOOT_OPTION_DEBUG_OUTPUT; 56 break; 57 case 0: 58 // evaluate BIOS scan codes 59 // ... 60 break; 61 } 62 } 63 64 dprintf("options = %ld\n", options); 65 return options; 66 } 67 68