xref: /netbsd/sys/arch/next68k/dev/wskbdmap_next.c (revision 6550d01e)
1 /*	$NetBSD: wskbdmap_next.c,v 1.5 2008/04/28 20:23:30 martin Exp $	*/
2 
3 /*-
4  * Copyright (c) 1997 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Juergen Hannken-Illjes.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: wskbdmap_next.c,v 1.5 2008/04/28 20:23:30 martin Exp $");
34 
35 #include <sys/types.h>
36 #include <dev/wscons/wsksymdef.h>
37 #include <dev/wscons/wsksymvar.h>
38 #include <arch/next68k/dev/wskbdmap_next.h>
39 
40 #define KC(n)		(0xe000 | (n))  /* see wsksymvar.h */
41 
42 static const keysym_t nextkbd_keydesc_us[] = {
43 /*  pos      command		normal		shifted */
44     KC(3), 			KS_backslash,	KS_bar,
45     KC(4), 			KS_bracketright, KS_braceright,
46     KC(5), 			KS_bracketleft,	KS_braceleft,
47     KC(6),                      KS_i,
48     KC(7),                      KS_o,
49     KC(8),                      KS_p,
50     KC(9),			KS_Left,
51     KC(11), 			KS_KP_0,
52     KC(12), 			KS_KP_Decimal,
53     KC(13),			KS_KP_Enter,
54     KC(15),			KS_Down,
55     KC(16),			KS_Right,
56     KC(17), 			KS_KP_1,
57     KC(18), 			KS_KP_4,
58     KC(19), 			KS_KP_6,
59     KC(20), 			KS_KP_3,
60     KC(21), 			KS_KP_Add,
61     KC(22),			KS_Up,
62     KC(23), 			KS_KP_2,
63     KC(24), 			KS_KP_5,
64     KC(27), 			KS_Delete,
65     KC(28), 			KS_equal,	KS_plus,
66     KC(29), 			KS_minus,	KS_underscore,
67     KC(30),  			KS_8,		KS_asterisk,
68     KC(31), 			KS_9,		KS_parenleft,
69     KC(32), 			KS_0,		KS_parenright,
70     KC(33), 			KS_KP_7,
71     KC(34), 			KS_KP_8,
72     KC(35), 			KS_KP_9,
73     KC(36), 			KS_KP_Subtract,
74     KC(37), 			KS_KP_Multiply,
75     KC(38), 			KS_grave,	KS_asciitilde,
76     KC(39), 			KS_KP_Equal, KS_bar,
77     KC(40),			  KS_KP_Divide, KS_backslash,
78     KC(42), 			KS_Return,
79     KC(43), 			KS_apostrophe,	KS_quotedbl,
80     KC(44), 			KS_semicolon,	KS_colon,
81     KC(45), 			KS_l,
82     KC(46), 			KS_comma,	KS_less,
83     KC(47), 			KS_period,	KS_greater,
84     KC(48), 			KS_slash,	KS_question,
85     KC(49),                     KS_z,
86     KC(50),                     KS_x,
87     KC(51),                     KS_c,
88     KC(52),                     KS_v,
89     KC(53),                     KS_b,
90     KC(54),                     KS_m,
91     KC(55),                     KS_n,
92     KC(56), 			KS_space,
93     KC(57),                     KS_a,
94     KC(58),                     KS_s,
95     KC(59),                     KS_d,
96     KC(60),                     KS_f,
97     KC(61),                     KS_g,
98     KC(62),                     KS_k,
99     KC(63),                     KS_j,
100     KC(64),                     KS_h,
101     KC(65), 			KS_Tab,
102     KC(66),                     KS_q,
103     KC(67),                     KS_w,
104     KC(68),                     KS_e,
105     KC(69),                     KS_r,
106     KC(70),                     KS_u,
107     KC(71),                     KS_y,
108     KC(72),                     KS_t,
109     KC(73),   KS_Cmd_Debugger,	KS_Escape,
110     KC(74),  			KS_1,		KS_exclam,
111     KC(75),  			KS_2,		KS_at,
112     KC(76),  			KS_3,		KS_numbersign,
113     KC(77),  			KS_4,		KS_dollar,
114     KC(78),  			KS_7,		KS_ampersand,
115     KC(79),  			KS_6,		KS_asciicircum,
116     KC(80),  			KS_5,		KS_percent,
117 
118     KC(90), 			KS_Shift_L,
119     KC(91), 			KS_Shift_R,
120     KC(92),   			KS_Alt_L,
121     KC(93),  			KS_Alt_R,
122     KC(94),			KS_Control_L,
123     KC(95), 			KS_Cmd1,
124     KC(96), 			KS_Cmd2,
125 #if 0
126     //KC(58), 			KS_Caps_Lock,
127     //KC(59),  KS_Cmd_Screen0,	KS_f1,
128     //KC(60),  KS_Cmd_Screen1,	KS_f2,
129     //KC(61),  KS_Cmd_Screen2,	KS_f3,
130     //KC(62),  KS_Cmd_Screen3,	KS_f4,
131     //KC(63),  KS_Cmd_Screen4,	KS_f5,
132     //KC(64),  KS_Cmd_Screen5,	KS_f6,
133     //KC(65),  KS_Cmd_Screen6,	KS_f7,
134     //KC(66),  KS_Cmd_Screen7,	KS_f8,
135     //KC(67),  KS_Cmd_Screen8,	KS_f9,
136     //KC(68),  KS_Cmd_Screen9,	KS_f10,
137     //KC(69), 			KS_Num_Lock,
138     //KC(70), 			KS_Hold_Screen,
139     //KC(87), 			KS_f11,
140     //KC(88), 			KS_f12,
141     /*  127, break, */
142     /*  170, print screen, */
143     /*  183, print screen, */
144     //KC(184),			KS_Alt_R,	KS_Multi_key,
145     //KC(199),			KS_Home,
146     //KC(201),			KS_Prior,
147     //K/C(207),			KS_End,
148     //K/C(209),			KS_Next,
149     ///KC(210),			KS_Insert,
150     //KC(211),			KS_KP_Delete,
151     /*  219, left win, */
152     /*  220, right win, */
153     /*  221, menu, */
154 #endif
155 };
156 
157 #if 0
158 static const keysym_t nextkbd_keydesc_de[] = {
159 /*  pos      normal		shifted		altgr		shift-altgr */
160     KC(3),   KS_2,		KS_quotedbl,	KS_twosuperior,
161     KC(4),   KS_3,		KS_section,	KS_threesuperior,
162     KC(7),   KS_6,		KS_ampersand,
163     KC(8),   KS_7,		KS_slash,	KS_braceleft,
164     KC(9),   KS_8,		KS_parenleft,	KS_bracketleft,
165     KC(10),  KS_9,		KS_parenright,	KS_bracketright,
166     KC(11),  KS_0,		KS_equal,	KS_braceright,
167     KC(12),  KS_ssharp,		KS_question,	KS_backslash,
168     KC(13),  KS_dead_acute,	KS_dead_grave,
169     KC(16),  KS_q,		KS_Q,		KS_at,
170     KC(21),  KS_z,
171     KC(26),  KS_udiaeresis,
172     KC(27),  KS_plus,		KS_asterisk,	KS_dead_tilde,
173     KC(39),  KS_odiaeresis,
174     KC(40),  KS_adiaeresis,
175     KC(41),  KS_dead_circumflex,KS_dead_abovering,
176     KC(43),  KS_numbersign,	KS_apostrophe,
177     KC(44),  KS_y,
178     KC(50),  KS_m,		KS_M,		KS_mu,
179     KC(51),  KS_comma,		KS_semicolon,
180     KC(52),  KS_period,		KS_colon,
181     KC(53),  KS_minus,		KS_underscore,
182     KC(86),  KS_less,		KS_greater,	KS_bar,		KS_brokenbar,
183     KC(184), KS_Mode_switch,	KS_Multi_key,
184 };
185 
186 static const keysym_t nextkbd_keydesc_de_nodead[] = {
187 /*  pos      normal		shifted		altgr		shift-altgr */
188     KC(13),  KS_apostrophe,	KS_grave,
189     KC(27),  KS_plus,		KS_asterisk,	KS_asciitilde,
190     KC(41),  KS_asciicircum,	KS_degree,
191 };
192 
193 static const keysym_t nextkbd_keydesc_dk[] = {
194 /*  pos      normal		shifted		altgr		shift-altgr */
195     KC(3),   KS_2,		KS_quotedbl,	KS_at,
196     KC(4),   KS_3,		KS_numbersign,	KS_sterling,
197     KC(5),   KS_4,		KS_currency,	KS_dollar,
198     KC(7),   KS_6,		KS_ampersand,
199     KC(8),   KS_7,		KS_slash,	KS_braceleft,
200     KC(9),   KS_8,		KS_parenleft,	KS_bracketleft,
201     KC(10),  KS_9,		KS_parenright,	KS_bracketright,
202     KC(11),  KS_0,		KS_equal,	KS_braceright,
203     KC(12),  KS_plus,		KS_question,
204     KC(13),  KS_dead_acute,	KS_dead_grave,	KS_bar,
205     KC(26),  KS_aring,
206     KC(27),  KS_dead_diaeresis,	KS_dead_circumflex, KS_dead_tilde,
207     KC(39),  KS_ae,
208     KC(40),  KS_oslash,
209     KC(41),  KS_onehalf,	KS_paragraph,
210     KC(43),  KS_apostrophe,	KS_asterisk,
211     KC(51),  KS_comma,		KS_semicolon,
212     KC(52),  KS_period,		KS_colon,
213     KC(53),  KS_minus,		KS_underscore,
214     KC(86),  KS_less,		KS_greater,	KS_backslash,
215     KC(184), KS_Mode_switch,	KS_Multi_key,
216 };
217 
218 static const keysym_t nextkbd_keydesc_dk_nodead[] = {
219 /*  pos      normal		shifted		altgr		shift-altgr */
220     KC(13),  KS_apostrophe,	KS_grave,	KS_bar,
221     KC(27),  KS_diaeresis,	KS_asciicircum,	KS_asciitilde,
222 };
223 
224 static const keysym_t nextkbd_keydesc_fr[] = {
225 /*  pos	     normal		shifted		altgr		shift-altgr */
226     KC(2),   KS_ampersand,	KS_1,
227     KC(3),   KS_eacute,		KS_2,		KS_asciitilde,
228     KC(4),   KS_quotedbl,	KS_3,		KS_numbersign,
229     KC(5),   KS_apostrophe,	KS_4,		KS_braceleft,
230     KC(6),   KS_parenleft,	KS_5,		KS_bracketleft,
231     KC(7),   KS_minus,		KS_6,		KS_bar,
232     KC(8),   KS_egrave,		KS_7,		KS_grave,
233     KC(9),   KS_underscore,	KS_8,		KS_backslash,
234     KC(10),  KS_ccedilla,	KS_9,		KS_asciicircum,
235     KC(11),  KS_agrave,		KS_0,		KS_at,
236     KC(12),  KS_parenright,	KS_degree,	KS_bracketright,
237     KC(13),  KS_equal,		KS_plus,	KS_braceright,
238     KC(16),  KS_a,
239     KC(17),  KS_z,
240     KC(26),  KS_dead_circumflex, KS_dead_diaeresis,
241     KC(27),  KS_dollar,		KS_sterling,	KS_currency,
242     KC(30),  KS_q,
243     KC(39),  KS_m,
244     KC(40),  KS_ugrave,		KS_percent,
245     KC(41),  KS_twosuperior,
246     KC(43),  KS_asterisk,	KS_mu,
247     KC(44),  KS_w,
248     KC(50),  KS_comma,		KS_question,
249     KC(51),  KS_semicolon,	KS_period,
250     KC(52),  KS_colon,		KS_slash,
251     KC(53),  KS_exclam,		KS_section,
252     KC(86),  KS_less,		KS_greater,
253     KC(184), KS_Mode_switch,	KS_Multi_key,
254 };
255 
256 static const keysym_t nextkbd_keydesc_it[] = {
257 /*  pos      normal		shifted		altgr		shift-altgr */
258     KC(3),   KS_2,	    	KS_quotedbl,	KS_twosuperior,
259     KC(4),   KS_3,	    	KS_sterling,	KS_threesuperior,
260     KC(5),   KS_4,	    	KS_dollar,
261     KC(6),   KS_5,	    	KS_percent,
262     KC(7),   KS_6,	    	KS_ampersand,
263     KC(8),   KS_7,	    	KS_slash,
264     KC(9),   KS_8,	    	KS_parenleft,
265     KC(10),  KS_9,	    	KS_parenright,
266     KC(11),  KS_0,	    	KS_equal,
267     KC(12),  KS_apostrophe,	KS_question,
268     KC(13),  KS_igrave,	    	KS_asciicircum,
269     KC(26),  KS_egrave,		KS_eacute,	KS_braceleft,	KS_bracketleft,
270     KC(27),  KS_plus,		KS_asterisk,	KS_braceright,	KS_bracketright,
271     KC(39),  KS_ograve,		KS_Ccedilla,	KS_at,
272     KC(40),  KS_agrave,		KS_degree,	KS_numbersign,
273     KC(41),  KS_backslash,	KS_bar,
274     KC(43),  KS_ugrave,		KS_section,
275     KC(51),  KS_comma,		KS_semicolon,
276     KC(52),  KS_period,		KS_colon,
277     KC(53),  KS_minus,		KS_underscore,
278     KC(86),  KS_less,		KS_greater,
279     KC(184), KS_Mode_switch,	KS_Multi_key,
280 };
281 
282 static const keysym_t nextkbd_keydesc_us_declk[] = {
283 /*  pos      normal		shifted		altgr		shift-altgr */
284     KC(1),	KS_grave,	KS_asciitilde, /* replace escape */
285     KC(41),	KS_less,	KS_greater, /* replace grave/tilde */
286     KC(143),	KS_Multi_key, /* left compose */
287     KC(157),	KS_Multi_key, /* right compose, replace right control */
288     KC(87),	KS_Cmd_Debugger,	KS_Escape, /* replace F11 */
289     KC(189),	KS_f13,
290     KC(190),	KS_f14,
291     KC(191),	KS_Help,
292     KC(192),	KS_Execute,
293     KC(193),	KS_f17,
294     KC(183),	KS_f18,
295     KC(70),	KS_f19, /* replace scroll lock */
296     KC(127),	KS_f20, /* replace break */
297     KC(69),	KS_KP_F1, /* replace num lock */
298     KC(181),	KS_KP_F2, /* replace divide */
299     KC(55),	KS_KP_F3, /* replace multiply */
300     KC(74),	KS_KP_F4, /* replace subtract */
301 
302     /* keypad is numbers only - no num lock */
303     KC(71), 	KS_KP_7,
304     KC(72), 	KS_KP_8,
305     KC(73), 	KS_KP_9,
306     KC(75), 	KS_KP_4,
307     KC(76), 	KS_KP_5,
308     KC(77), 	KS_KP_6,
309     KC(79), 	KS_KP_1,
310     KC(80), 	KS_KP_2,
311     KC(81), 	KS_KP_3,
312     KC(82), 	KS_KP_0,
313     KC(83), 	KS_KP_Decimal,
314 
315     KC(206),	KS_KP_Subtract,
316     KC(78),	KS_KP_Separator, /* replace add */
317     KC(199),	KS_Find, /* replace home */
318     KC(207),	KS_Select, /* replace end */
319 };
320 #endif
321 
322 #define KBD_MAP(name, base, map) \
323 			{ name, base, sizeof(map)/sizeof(keysym_t), map }
324 
325 const struct wscons_keydesc nextkbd_keydesctab[] = {
326 	KBD_MAP(KB_US,			0,	nextkbd_keydesc_us),
327 #if 0
328 	KBD_MAP(KB_DE,			KB_US,	nextkbd_keydesc_de),
329 	KBD_MAP(KB_DE | KB_NODEAD,	KB_DE,	nextkbd_keydesc_de_nodead),
330 	KBD_MAP(KB_FR,                  KB_US,  nextkbd_keydesc_fr),
331 	KBD_MAP(KB_DK,			KB_US,	nextkbd_keydesc_dk),
332 	KBD_MAP(KB_DK | KB_NODEAD,	KB_DK,	nextkbd_keydesc_dk_nodead),
333 	KBD_MAP(KB_IT,			KB_US,	nextkbd_keydesc_it),
334 	KBD_MAP(KB_US | KB_DECLK,	KB_US,	nextkbd_keydesc_us_declk),
335 #endif
336 	{0, 0, 0, 0}
337 };
338 
339 #undef KBD_MAP
340 #undef KC
341