xref: /csrg-svn/sys/news3400/iop/keyboard.h (revision 63308)
153887Smckusick /*
2*63308Sbostic  * Copyright (c) 1992, 1993
3*63308Sbostic  *	The Regents of the University of California.  All rights reserved.
453887Smckusick  *
553887Smckusick  * This code is derived from software contributed to Berkeley by
653887Smckusick  * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc.
753887Smckusick  *
853887Smckusick  * %sccs.include.redist.c%
953887Smckusick  *
1053887Smckusick  * from: $Hdr: keyboard.h,v 4.300 91/06/09 06:42:48 root Rel41 $ SONY
1153887Smckusick  *
12*63308Sbostic  *	@(#)keyboard.h	8.1 (Berkeley) 06/11/93
1353887Smckusick  */
1453887Smckusick 
1553887Smckusick /*
1653887Smckusick  *	Key flag
1753887Smckusick  */
1853887Smckusick #define	NORMAL		0x003f
1953887Smckusick #define		N	0x0001
2053887Smckusick #define		S	0x0002
2153887Smckusick #define		C	0x0004
2253887Smckusick #define		A	0x0008
2353887Smckusick #define		K	0x0010
2453887Smckusick #define		G	0x0010
2553887Smckusick #define		J	0x0020
2653887Smckusick #define		L	0x0040
2753887Smckusick #define		R	0x0080
2853887Smckusick #define		O	(L|R)
2953887Smckusick 
3053887Smckusick #define	PRG_FUNC	0x0100
3153887Smckusick #define	ALT_FUNC	0x0200
3253887Smckusick #define	CAP_LOCK	0x0400
3353887Smckusick 
3453887Smckusick #define	PSH_SHFT	0x0800
3553887Smckusick #define	SW_SHFT		0x1000
3653887Smckusick #define	KEY_PRESS	0x4000
3753887Smckusick #define	NOT_REPT	0x8000
3853887Smckusick 
3953887Smckusick #define		S_CTRL	0
4053887Smckusick #define		S_LSHFT	1
4153887Smckusick #define		S_RSHFT	2
4253887Smckusick #define		S_ALT	3
4353887Smckusick #define		S_CAPS	4
4453887Smckusick #define		S_AN	5
4553887Smckusick #define		S_KANA	6
4653887Smckusick #define		S_OCAPS	7
4753887Smckusick #define		S_OKANA	8
4853887Smckusick #define		S_ALTGR	9
4953887Smckusick 
5053887Smckusick /*
5153887Smckusick  *	Keyboard status
5253887Smckusick  */
5353887Smckusick #define	KBD_SHIFT	0x0003		/* shift mode		*/
5453887Smckusick #define	KBD_RSHIFT	0x0001
5553887Smckusick #define	KBD_LSHIFT	0x0002
5653887Smckusick #define	KBD_CTRL	0x0004		/* control mode		*/
5753887Smckusick #define	KBD_ALT		0x0008		/* alternate mode	*/
5853887Smckusick #define	KBD_CAPS	0x0010		/* capital lock mode	*/
5953887Smckusick #define	KBD_KANA	0x0020		/* kana mode		*/
6053887Smckusick #define	KBD_NOTREPT	0x0080		/* do not auto repeat	*/
6153887Smckusick #define	KBD_ALTGR	0x0800		/* European keyboard AltGr mode	*/
6253887Smckusick 
6353887Smckusick /*
6453887Smckusick  *	Lock type
6553887Smckusick  */
6653887Smckusick #define	CAPSLOCK	1
6753887Smckusick #define	SHIFTLOCK	2
6853887Smckusick #define	SHIFTLOCK2	3
6953887Smckusick 
7053887Smckusick /*
7153887Smckusick  *	Country number
7253887Smckusick  */
7353887Smckusick #define	K_JAPANESE_J		0			/* JIS */
7453887Smckusick #define	K_JAPANESE_O		1			/* OYAYUBI */
7553887Smckusick #define	K_GERMAN		2
7653887Smckusick #define	K_FRENCH		3
7753887Smckusick #define	K_UKENGLISH		4
7853887Smckusick #define	K_ITALIAN		5
7953887Smckusick #define	K_SPANISH		6
8053887Smckusick #define	K_SWEDISH_FINNISH	7
8153887Smckusick #define	K_DANISH		8
8253887Smckusick #define	K_NORWEGIAN		9
8353887Smckusick #define	K_PORTUGUESE		10
8453887Smckusick #define	K_USENGLISH		11
8553887Smckusick 
8653887Smckusick /*
8753887Smckusick  *	Key shift code
8853887Smckusick  */
8953887Smckusick #define	PF_NORMAL	0
9053887Smckusick #define	PF_SHIFT	1
9153887Smckusick #define	PF_CONTROL	2
9253887Smckusick #define	PF_ALTERNATE	3
9353887Smckusick 
9453887Smckusick typedef	struct key_table {
9553887Smckusick 	short		key_flags;
9653887Smckusick 	char		normal_code;
9753887Smckusick 	char		shift_code;
9853887Smckusick 	char		ctrl_code;
9953887Smckusick 	char		alt_code;
10053887Smckusick 	char		kana_code;
10153887Smckusick 	char		kshft_code;
10253887Smckusick } Key_table;
10353887Smckusick 
10453887Smckusick typedef struct {
10553887Smckusick 	int		key_number;
10653887Smckusick 	Key_table	key_num_table;
10753887Smckusick } Key_tab_info;
10853887Smckusick 
10953887Smckusick /*
11053887Smckusick  *	IOCTL command
11153887Smckusick  */
11253887Smckusick #define	KBIOCBELL	_IOW('K', 1, int)		/* ring bell	*/
11353887Smckusick #define	KBIOCREPT	_IO('K', 3)			/* auto repeat on */
11453887Smckusick #define	KBIOCNRPT	_IO('K', 4)			/* auto repeat off */
11553887Smckusick #define	KBIOCSETLOCK	_IOW('K', 10, int)		/* set lock type */
11653887Smckusick #define	KBIOCSETTBL	_IOW('K', 11, Key_tab_info)	/* set key_table */
11753887Smckusick #define	KBIOCGETCNUM	_IOR('K', 12, int)		/* get country number */
11853887Smckusick #define	KBIOCSETCNUM	_IOW('K', 13, int)		/* set country number */
11953887Smckusick #define	KBIOCGETSTAT	_IOR('K', 17, int)		/* get status */
12053887Smckusick #define	KBIOCSETSTAT	_IOW('K', 18, int)		/* set status */
121