17 #include <linux/module.h>
18 #include <linux/sched.h>
19 #include <linux/kernel.h>
21 #include <linux/errno.h>
22 #include <linux/keyboard.h>
26 #include <linux/random.h>
49 static volatile int ikbd_self_test;
51 static volatile unsigned long self_test_last_rcv;
53 static unsigned long broken_keys[128/(
sizeof(
unsigned long)*8)] = { 0, };
55 #define BREAK_MASK (0x80)
107 #define IS_SYNC_CODE(sc) ((sc) >= 0x04 && (sc) <= 0xfb)
144 acia_stat =
acia.key_ctrl;
153 scancode =
acia.key_data;
156 goto interpret_scancode;
161 goto interpret_scancode;
172 scancode =
acia.key_data;
175 switch (kb_state.
state) {
189 kb_state.
buf[0] = scancode;
201 kb_state.
buf[0] = scancode;
206 if (ikbd_self_test) {
215 scancode &= ~BREAK_MASK;
216 if (ikbd_self_test) {
225 set_bit(scancode, broken_keys);
229 keytyp =
KTYP(keyval) - 0xf0;
230 keyval =
KVAL(keyval);
235 printk(
"('^%c') ", keyval +
'@');
237 printk(
"('%c') ", keyval);
239 printk(
"is broken -- will be ignored.\n");
241 }
else if (
test_bit(scancode, broken_keys))
251 kb_state.
buf[kb_state.
len++] = scancode;
252 if (kb_state.
len == 5) {
260 kb_state.
buf[kb_state.
len++] = scancode;
261 if (kb_state.
len == 3) {
269 kb_state.
buf[1] = scancode;
271 #ifdef FIXED_ATARI_JOYSTICK
277 kb_state.
buf[kb_state.
len++] = scancode;
278 if (kb_state.
len == 6) {
290 goto interpret_scancode;
303 printk(
"Error in keyboard communication\n");
324 if ((len < 1) || (len > 7))
325 panic(
"ikbd: maximum string length exceeded");
327 acia_stat =
acia.key_ctrl;
329 acia.key_data = *str++;
338 static const char cmd[2] = { 0x80, 0x01 };
351 char cmd[2] = { 0x07, mode };
359 static const char cmd[1] = { 0x08 };
368 char cmd[5] = { 0x09, xmax>>8, xmax&0xFF, ymax>>8, ymax&0xFF };
376 char cmd[3] = { 0x0A, dx, dy };
384 char cmd[3] = { 0x0B,
x, y };
393 char cmd[3] = { 0x0C,
x, y };
401 static const char cmd[1] = { 0x0D };
411 char cmd[6] = { 0x0E, 0x00, x>>8, x&0xFF, y>>8, y&0xFF };
419 static const char cmd[1] = { 0x0F };
427 static const char cmd[1] = { 0x10 };
436 static const char cmd[1] = { 0x11 };
444 static const char cmd[1] = { 0x12 };
453 static const char cmd[1] = { 0x13 };
461 static const char cmd[1] = { 0x14 };
469 static const char cmd[1] = { 0x15 };
477 static const char cmd[1] = { 0x16 };
485 void ikbd_joystick_monitor(
int rate)
487 static const char cmd[2] = { 0x17, rate };
491 kb_state.
state = JOYSTICK_MONITOR;
500 static const char cmd[1] = { 0x1A };
516 static const char cmd[1] = { 0x1C };
524 panic(
"Attempt to write data into keyboard memory");
530 char cmd[3] = { 0x21, address>>8, address&0xFF };
540 char cmd[3] = { 0x22, address>>8, address&0xFF };
550 char cmd[6] = {32, 0, 4, 1, 254 + ((leds & 4) != 0), 0};
562 static int atari_keyb_done = 0;
576 atari_keyboard_interrupt);
609 }
while ((
st_mfp.par_dt_reg & 0x10) == 0);
612 st_mfp.active_edge &= ~0x10;
623 if (ikbd_self_test == 1)
630 #ifdef FIXED_ATARI_JOYSTICK