Rev 1628 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1628 | Rev 1633 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | #include <arch/drivers/pic.h> |
33 | #include <arch/drivers/pic.h> |
34 | #include <sysinfo/sysinfo.h> |
34 | #include <sysinfo/sysinfo.h> |
35 | #include <interrupt.h> |
35 | #include <interrupt.h> |
36 | #include <stdarg.h> |
36 | #include <stdarg.h> |
37 | 37 | ||
- | 38 | #define SPECIAL '?' |
|
- | 39 | ||
38 | #define PACKET_ADB 0x00 |
40 | #define PACKET_ADB 0x00 |
39 | #define PACKET_CUDA 0x01 |
41 | #define PACKET_CUDA 0x01 |
40 | 42 | ||
41 | #define CUDA_POWERDOWN 0x0a |
43 | #define CUDA_POWERDOWN 0x0a |
42 | 44 | ||
Line 53... | Line 55... | ||
53 | 55 | ||
54 | static volatile __u8 *cuda = NULL; |
56 | static volatile __u8 *cuda = NULL; |
55 | 57 | ||
56 | 58 | ||
57 | static char lchars[0x80] = { |
59 | static char lchars[0x80] = { |
- | 60 | 'a', |
|
- | 61 | 's', |
|
- | 62 | 'd', |
|
- | 63 | 'f', |
|
- | 64 | 'h', |
|
- | 65 | 'g', |
|
- | 66 | 'z', |
|
- | 67 | 'x', |
|
- | 68 | 'c', |
|
- | 69 | 'v', |
|
- | 70 | SPECIAL, |
|
- | 71 | 'b', |
|
- | 72 | 'q', |
|
- | 73 | 'w', |
|
- | 74 | 'e', |
|
- | 75 | 'r', |
|
- | 76 | 'y', |
|
- | 77 | 't', |
|
- | 78 | '1', |
|
- | 79 | '2', |
|
- | 80 | '3', |
|
- | 81 | '4', |
|
- | 82 | '6', |
|
- | 83 | '5', |
|
- | 84 | '=', |
|
- | 85 | '9', |
|
- | 86 | '7', |
|
- | 87 | '-', |
|
- | 88 | '8', |
|
- | 89 | '0', |
|
- | 90 | ']', |
|
- | 91 | 'o', |
|
- | 92 | 'u', |
|
- | 93 | '[', |
|
- | 94 | 'i', |
|
- | 95 | 'p', |
|
- | 96 | '\n', /* Enter */ |
|
- | 97 | 'l', |
|
- | 98 | 'j', |
|
- | 99 | '\'', |
|
- | 100 | 'k', |
|
- | 101 | ';', |
|
- | 102 | '\\', |
|
- | 103 | ',', |
|
- | 104 | '/', |
|
- | 105 | 'n', |
|
- | 106 | 'm', |
|
- | 107 | '.', |
|
- | 108 | '\t', /* Tab */ |
|
- | 109 | ' ', |
|
- | 110 | '`', |
|
- | 111 | '\b', /* Backspace */ |
|
- | 112 | SPECIAL, |
|
- | 113 | SPECIAL, /* Escape */ |
|
- | 114 | SPECIAL, /* Ctrl */ |
|
- | 115 | SPECIAL, /* Alt */ |
|
- | 116 | SPECIAL, /* Shift */ |
|
- | 117 | SPECIAL, /* Caps-Lock */ |
|
- | 118 | SPECIAL, /* RAlt */ |
|
- | 119 | SPECIAL, /* Left */ |
|
- | 120 | SPECIAL, /* Right */ |
|
- | 121 | SPECIAL, /* Down */ |
|
- | 122 | SPECIAL, /* Up */ |
|
- | 123 | SPECIAL, |
|
- | 124 | SPECIAL, |
|
- | 125 | '.', /* Keypad . */ |
|
- | 126 | SPECIAL, |
|
- | 127 | '*', /* Keypad * */ |
|
- | 128 | SPECIAL, |
|
- | 129 | '+', /* Keypad + */ |
|
- | 130 | SPECIAL, |
|
- | 131 | SPECIAL, /* NumLock */ |
|
- | 132 | SPECIAL, |
|
- | 133 | SPECIAL, |
|
- | 134 | SPECIAL, |
|
- | 135 | '/', /* Keypad / */ |
|
58 | 'a', 's', 'd', 'f', 'h', 'g', 'z', 'x', 'c', 'v', 0, 'b', 'q', 'w', 'e', 'r', |
136 | '\n', /* Keypad Enter */ |
- | 137 | SPECIAL, |
|
- | 138 | '-', /* Keypad - */ |
|
- | 139 | SPECIAL, |
|
- | 140 | SPECIAL, |
|
- | 141 | SPECIAL, |
|
- | 142 | '0', /* Keypad 0 */ |
|
- | 143 | '1', /* Keypad 1 */ |
|
59 | 'y', 't', '1', '2', '3', '4', '6', '5', '=', '9', '7', '-', '8', '0', ']', 'o', |
144 | '2', /* Keypad 2 */ |
60 | 'u', '[', 'i', 'p', 13, 'l', 'j', '\'', 'k', ';', '\\', ',', '/', 'n', 'm', '.', |
145 | '3', /* Keypad 3 */ |
61 | 9, 32, '`', 8, 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
146 | '4', /* Keypad 4 */ |
- | 147 | '5', /* Keypad 5 */ |
|
62 | 0, '.', 0, '*', 0, '+', 0, 0, 0, 0, 0, '/', 13, 0, '-', 0, |
148 | '6', /* Keypad 6 */ |
63 | 0, 0, '0', '1', '2', '3', '4', '5', '6', '7', 0, '8', '9', 0, 0, 0, |
149 | '7', /* Keypad 7 */ |
- | 150 | SPECIAL, |
|
64 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
151 | '8', /* Keypad 8 */ |
65 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
152 | '9', /* Keypad 9 */ |
- | 153 | SPECIAL, |
|
- | 154 | SPECIAL, |
|
- | 155 | SPECIAL, |
|
- | 156 | SPECIAL, /* F5 */ |
|
- | 157 | SPECIAL, /* F6 */ |
|
- | 158 | SPECIAL, /* F7 */ |
|
- | 159 | SPECIAL, /* F3 */ |
|
- | 160 | SPECIAL, /* F8 */ |
|
- | 161 | SPECIAL, /* F9 */ |
|
- | 162 | SPECIAL, |
|
- | 163 | SPECIAL, /* F11 */ |
|
- | 164 | SPECIAL, |
|
- | 165 | SPECIAL, /* F13 */ |
|
- | 166 | SPECIAL, |
|
- | 167 | SPECIAL, /* ScrollLock */ |
|
- | 168 | SPECIAL, |
|
- | 169 | SPECIAL, /* F10 */ |
|
- | 170 | SPECIAL, |
|
- | 171 | SPECIAL, /* F12 */ |
|
- | 172 | SPECIAL, |
|
- | 173 | SPECIAL, /* Pause */ |
|
- | 174 | SPECIAL, /* Insert */ |
|
- | 175 | SPECIAL, /* Home */ |
|
- | 176 | SPECIAL, /* PageUp */ |
|
- | 177 | SPECIAL, /* Delete */ |
|
- | 178 | SPECIAL, /* F4 */ |
|
- | 179 | SPECIAL, /* End */ |
|
- | 180 | SPECIAL, /* F2 */ |
|
- | 181 | SPECIAL, /* PageDown */ |
|
- | 182 | SPECIAL /* F1 */ |
|
66 | }; |
183 | }; |
67 | 184 | ||
68 | 185 | ||
69 | void send_packet(const __u8 kind, index_t count, ...); |
186 | void send_packet(const __u8 kind, index_t count, ...); |
70 | 187 | ||
Line 109... | Line 226... | ||
109 | .resume = cuda_resume, |
226 | .resume = cuda_resume, |
110 | .read = key_read |
227 | .read = key_read |
111 | }; |
228 | }; |
112 | 229 | ||
113 | 230 | ||
114 | __u8 cuda_get_scancode(void) |
231 | int cuda_get_scancode(void) |
115 | { |
232 | { |
116 | __u8 kind; |
233 | __u8 kind; |
117 | __u8 data[4]; |
234 | __u8 data[4]; |
118 | 235 | ||
119 | receive_packet(&kind, 4, data); |
236 | receive_packet(&kind, 4, data); |
120 | 237 | ||
121 | if ((kind == PACKET_ADB) && (data[0] == 0x40) && (data[1] == 0x2c)) |
238 | if ((kind == PACKET_ADB) && (data[0] == 0x40) && (data[1] == 0x2c)) |
122 | return data[2]; |
239 | return data[2]; |
123 | 240 | ||
124 | return 0; |
241 | return -1; |
125 | } |
242 | } |
126 | 243 | ||
127 | - | ||
128 | static void cuda_irq(int n, istate_t *istate) |
244 | static void cuda_irq(int n, istate_t *istate) |
129 | { |
245 | { |
130 | __u8 scancode = cuda_get_scancode(); |
246 | int scan_code = cuda_get_scancode(); |
131 | 247 | ||
- | 248 | if (scan_code != -1) { |
|
- | 249 | __u8 scancode = (__u8) scan_code; |
|
132 | if ((scancode != 0) && ((scancode & 0x80) != 0x80)) |
250 | if ((scancode & 0x80) != 0x80) |
133 | chardev_push_character(&kbrd, lchars[scancode & 0x7f]); |
251 | chardev_push_character(&kbrd, lchars[scancode & 0x7f]); |
- | 252 | } |
|
134 | } |
253 | } |
135 | 254 | ||
136 | 255 | ||
137 | void cuda_init(__address base, size_t size) |
256 | void cuda_init(__address base, size_t size) |
138 | { |
257 | { |