Rev 1508 | Rev 1645 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1508 | Rev 1569 | ||
---|---|---|---|
Line 28... | Line 28... | ||
28 | 28 | ||
29 | #include <arch/kbd.h> |
29 | #include <arch/kbd.h> |
30 | #include <ipc/ipc.h> |
30 | #include <ipc/ipc.h> |
31 | #include <sysinfo.h> |
31 | #include <sysinfo.h> |
32 | 32 | ||
- | 33 | #define KEY_F1 0x504f1b |
|
- | 34 | #define KEY_F2 0x514f1b |
|
- | 35 | #define KEY_F3 0x524f1b |
|
- | 36 | #define KEY_F4 0x534f1b |
|
- | 37 | #define KEY_F5 0x7e35315b1b |
|
- | 38 | #define KEY_F6 0x7e37315b1b |
|
- | 39 | #define KEY_F7 0x7e38315b1b |
|
- | 40 | #define KEY_F8 0x7e39315b1b |
|
- | 41 | #define KEY_F9 0x7e30325b1b |
|
- | 42 | #define KEY_F10 0x7e31325b1b |
|
- | 43 | #define KEY_F11 0x7e33325b1b |
|
- | 44 | #define KEY_F12 0x7e34325b1b |
|
- | 45 | ||
- | 46 | ||
- | 47 | #define FUNCTION_KEYS 0x100 |
|
- | 48 | ||
33 | irq_cmd_t ski_cmds[1] = { |
49 | irq_cmd_t ski_cmds[1] = { |
34 | { CMD_IA64_GETCHAR, 0, 0 } |
50 | { CMD_IA64_GETCHAR, 0, 0 } |
35 | }; |
51 | }; |
36 | 52 | ||
37 | irq_code_t ski_kbd = { |
53 | irq_code_t ski_kbd = { |
Line 39... | Line 55... | ||
39 | ski_cmds |
55 | ski_cmds |
40 | }; |
56 | }; |
41 | 57 | ||
42 | int kbd_arch_init(void) |
58 | int kbd_arch_init(void) |
43 | { |
59 | { |
44 | if(sysinfo_value("kbd")) |
60 | if(sysinfo_value("kbd")) { |
45 | { |
- | |
46 | ipc_register_irq(sysinfo_value("kbd.irq"), &ski_kbd); |
61 | ipc_register_irq(sysinfo_value("kbd.irq"), &ski_kbd); |
47 | return 1; |
62 | return 1; |
48 | } |
63 | } |
49 | 64 | ||
50 | } |
65 | } |
51 | 66 | ||
- | 67 | /* |
|
52 | int kbd_arch_process(keybuffer_t *keybuffer, int scan_code) |
68 | * Please preserve this code (it can be used to determine scancodes) |
- | 69 | * |
|
- | 70 | int to_hex(int v) |
|
53 | { |
71 | { |
- | 72 | return "0123456789ABCDEF"[v]; |
|
- | 73 | } |
|
- | 74 | */ |
|
- | 75 | ||
- | 76 | int kbd_arch_process(keybuffer_t *keybuffer, int scan_code) |
|
- | 77 | { |
|
- | 78 | static unsigned long long buf=0; |
|
- | 79 | static int count=0; |
|
- | 80 | ||
- | 81 | ||
- | 82 | /* |
|
- | 83 | * Please preserve this code (it can be used to determine scancodes) |
|
- | 84 | * |
|
- | 85 | keybuffer_push(keybuffer, to_hex((scan_code>>4)&0xf)); |
|
- | 86 | keybuffer_push(keybuffer, to_hex(scan_code&0xf)); |
|
- | 87 | keybuffer_push(keybuffer, ' '); |
|
54 | keybuffer_push(keybuffer, scan_code); |
88 | keybuffer_push(keybuffer, ' '); |
- | 89 | */ |
|
- | 90 | ||
55 | 91 | ||
56 | /* __SYSCALL3(SYS_IO,1,&scan_code,1); |
92 | if (scan_code){ |
57 | __SYSCALL3(SYS_IO,1,&scan_code,1); |
93 | buf|=(unsigned long long) scan_code<<(8*(count++)); |
- | 94 | } else { |
|
58 | */ |
95 | |
- | 96 | if ( ! ( buf & 0xff00 )) |
|
- | 97 | keybuffer_push(keybuffer, buf); |
|
- | 98 | else { |
|
- | 99 | switch (buf){ |
|
- | 100 | case KEY_F1: |
|
- | 101 | keybuffer_push(keybuffer,FUNCTION_KEYS | 1 ); |
|
- | 102 | break; |
|
- | 103 | case KEY_F2: |
|
- | 104 | keybuffer_push(keybuffer,FUNCTION_KEYS | 2 ); |
|
- | 105 | break; |
|
- | 106 | case KEY_F3: |
|
- | 107 | keybuffer_push(keybuffer,FUNCTION_KEYS | 3 ); |
|
- | 108 | break; |
|
- | 109 | case KEY_F4: |
|
- | 110 | keybuffer_push(keybuffer,FUNCTION_KEYS | 4 ); |
|
- | 111 | break; |
|
- | 112 | case KEY_F5: |
|
- | 113 | keybuffer_push(keybuffer,FUNCTION_KEYS | 5 ); |
|
- | 114 | break; |
|
- | 115 | case KEY_F6: |
|
- | 116 | keybuffer_push(keybuffer,FUNCTION_KEYS | 6 ); |
|
- | 117 | break; |
|
- | 118 | case KEY_F7: |
|
- | 119 | keybuffer_push(keybuffer,FUNCTION_KEYS | 7 ); |
|
- | 120 | break; |
|
- | 121 | case KEY_F8: |
|
- | 122 | keybuffer_push(keybuffer,FUNCTION_KEYS | 8 ); |
|
- | 123 | break; |
|
- | 124 | ||
- | 125 | case KEY_F9: |
|
- | 126 | keybuffer_push(keybuffer,FUNCTION_KEYS | 9 ); |
|
- | 127 | break; |
|
- | 128 | case KEY_F10: |
|
- | 129 | keybuffer_push(keybuffer,FUNCTION_KEYS | 10 ); |
|
- | 130 | break; |
|
- | 131 | ||
- | 132 | case KEY_F11: |
|
- | 133 | keybuffer_push(keybuffer,FUNCTION_KEYS | 11 ); |
|
- | 134 | break; |
|
- | 135 | case KEY_F12: |
|
- | 136 | keybuffer_push(keybuffer,FUNCTION_KEYS | 12 ); |
|
- | 137 | break; |
|
- | 138 | ||
- | 139 | ||
- | 140 | } |
|
- | 141 | } |
|
- | 142 | buf=count=0; |
|
- | 143 | } |
|
- | 144 | ||
59 | return 1; |
145 | return 1; |
60 | } |
146 | } |