This source file includes following definitions.
- atakbd_interrupt
- atakbd_init
- atakbd_exit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include <linux/module.h>
28 #include <linux/init.h>
29 #include <linux/input.h>
30 #include <linux/delay.h>
31 #include <linux/interrupt.h>
32
33 #include <asm/atariints.h>
34 #include <asm/atarihw.h>
35 #include <asm/atarikb.h>
36 #include <asm/irq.h>
37
38 MODULE_AUTHOR("Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>");
39 MODULE_DESCRIPTION("Atari keyboard driver");
40 MODULE_LICENSE("GPL");
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66 static unsigned char atakbd_keycode[0x73] = {
67 [1] = KEY_ESC,
68 [2] = KEY_1,
69 [3] = KEY_2,
70 [4] = KEY_3,
71 [5] = KEY_4,
72 [6] = KEY_5,
73 [7] = KEY_6,
74 [8] = KEY_7,
75 [9] = KEY_8,
76 [10] = KEY_9,
77 [11] = KEY_0,
78 [12] = KEY_MINUS,
79 [13] = KEY_EQUAL,
80 [14] = KEY_BACKSPACE,
81 [15] = KEY_TAB,
82 [16] = KEY_Q,
83 [17] = KEY_W,
84 [18] = KEY_E,
85 [19] = KEY_R,
86 [20] = KEY_T,
87 [21] = KEY_Y,
88 [22] = KEY_U,
89 [23] = KEY_I,
90 [24] = KEY_O,
91 [25] = KEY_P,
92 [26] = KEY_LEFTBRACE,
93 [27] = KEY_RIGHTBRACE,
94 [28] = KEY_ENTER,
95 [29] = KEY_LEFTCTRL,
96 [30] = KEY_A,
97 [31] = KEY_S,
98 [32] = KEY_D,
99 [33] = KEY_F,
100 [34] = KEY_G,
101 [35] = KEY_H,
102 [36] = KEY_J,
103 [37] = KEY_K,
104 [38] = KEY_L,
105 [39] = KEY_SEMICOLON,
106 [40] = KEY_APOSTROPHE,
107 [41] = KEY_GRAVE,
108 [42] = KEY_LEFTSHIFT,
109 [43] = KEY_BACKSLASH,
110 [44] = KEY_Z,
111 [45] = KEY_X,
112 [46] = KEY_C,
113 [47] = KEY_V,
114 [48] = KEY_B,
115 [49] = KEY_N,
116 [50] = KEY_M,
117 [51] = KEY_COMMA,
118 [52] = KEY_DOT,
119 [53] = KEY_SLASH,
120 [54] = KEY_RIGHTSHIFT,
121 [55] = KEY_KPASTERISK,
122 [56] = KEY_LEFTALT,
123 [57] = KEY_SPACE,
124 [58] = KEY_CAPSLOCK,
125 [59] = KEY_F1,
126 [60] = KEY_F2,
127 [61] = KEY_F3,
128 [62] = KEY_F4,
129 [63] = KEY_F5,
130 [64] = KEY_F6,
131 [65] = KEY_F7,
132 [66] = KEY_F8,
133 [67] = KEY_F9,
134 [68] = KEY_F10,
135 [71] = KEY_HOME,
136 [72] = KEY_UP,
137 [74] = KEY_KPMINUS,
138 [75] = KEY_LEFT,
139 [77] = KEY_RIGHT,
140 [78] = KEY_KPPLUS,
141 [80] = KEY_DOWN,
142 [82] = KEY_INSERT,
143 [83] = KEY_DELETE,
144 [96] = KEY_102ND,
145 [97] = KEY_UNDO,
146 [98] = KEY_HELP,
147 [99] = KEY_KPLEFTPAREN,
148 [100] = KEY_KPRIGHTPAREN,
149 [101] = KEY_KPSLASH,
150 [102] = KEY_KPASTERISK,
151 [103] = KEY_KP7,
152 [104] = KEY_KP8,
153 [105] = KEY_KP9,
154 [106] = KEY_KP4,
155 [107] = KEY_KP5,
156 [108] = KEY_KP6,
157 [109] = KEY_KP1,
158 [110] = KEY_KP2,
159 [111] = KEY_KP3,
160 [112] = KEY_KP0,
161 [113] = KEY_KPDOT,
162 [114] = KEY_KPENTER,
163 };
164
165 static struct input_dev *atakbd_dev;
166
167 static void atakbd_interrupt(unsigned char scancode, char down)
168 {
169
170 if (scancode < 0x73) {
171
172
173
174 scancode = atakbd_keycode[scancode];
175
176 input_report_key(atakbd_dev, scancode, down);
177 input_sync(atakbd_dev);
178 } else
179 printk(KERN_INFO "atakbd: unhandled scancode %x\n", scancode);
180
181 return;
182 }
183
184 static int __init atakbd_init(void)
185 {
186 int i, error;
187
188 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP))
189 return -ENODEV;
190
191
192 error = atari_keyb_init();
193 if (error)
194 return error;
195
196 atakbd_dev = input_allocate_device();
197 if (!atakbd_dev)
198 return -ENOMEM;
199
200 atakbd_dev->name = "Atari Keyboard";
201 atakbd_dev->phys = "atakbd/input0";
202 atakbd_dev->id.bustype = BUS_HOST;
203 atakbd_dev->id.vendor = 0x0001;
204 atakbd_dev->id.product = 0x0001;
205 atakbd_dev->id.version = 0x0100;
206
207 atakbd_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
208 atakbd_dev->keycode = atakbd_keycode;
209 atakbd_dev->keycodesize = sizeof(unsigned char);
210 atakbd_dev->keycodemax = ARRAY_SIZE(atakbd_keycode);
211
212 for (i = 1; i < 0x72; i++) {
213 set_bit(atakbd_keycode[i], atakbd_dev->keybit);
214 }
215
216
217 error = input_register_device(atakbd_dev);
218 if (error) {
219 input_free_device(atakbd_dev);
220 return error;
221 }
222
223 atari_input_keyboard_interrupt_hook = atakbd_interrupt;
224
225 return 0;
226 }
227
228 static void __exit atakbd_exit(void)
229 {
230 atari_input_keyboard_interrupt_hook = NULL;
231 input_unregister_device(atakbd_dev);
232 }
233
234 module_init(atakbd_init);
235 module_exit(atakbd_exit);