ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
ps2kbd.h
Go to the documentation of this file.
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
16 #ifndef __PS2KBD_H__
17 #define __PS2KBD_H__
18 
19 #include <tamtypes.h>
20 
21 #define PS2KBD_FSNAME "usbkbd"
22 #define PS2KBD_KBDFILE "dev"
23 #define PS2KBD_DEVFILE (PS2KBD_FSNAME ":" PS2KBD_KBDFILE)
24 
25 #define PS2KBD_LED_NUMLOCK 1
26 #define PS2KBD_LED_CAPSLOCK 2
27 #define PS2KBD_LED_SCRLOCK 4
28 #define PS2KBD_LED_COMPOSE 8
29 #define PS2KBD_LED_KANA 16
30 
31 #define PS2KBD_LED_MASK 0x1F;
32 
33 #define PS2KBD_ESCAPE_KEY 0x1B
34 
35 #define PS2KBD_LEFT_CTRL (1 << 0)
36 #define PS2KBD_LEFT_SHIFT (1 << 1)
37 #define PS2KBD_LEFT_ALT (1 << 2)
38 #define PS2KBD_LEFT_GUI (1 << 3)
39 #define PS2KBD_RIGHT_CTRL (1 << 4)
40 #define PS2KBD_RIGHT_SHIFT (1 << 5)
41 #define PS2KBD_RIGHT_ALT (1 << 6)
42 #define PS2KBD_RIGHT_GUI (1 << 7)
43 
44 #define PS2KBD_CTRL (PS2KBD_LEFT_CTRL | PS2KBD_RIGHT_CTRL)
45 #define PS2KBD_SHIFT (PS2KBD_LEFT_SHIFT | PS2KBD_RIGHT_SHIFT)
46 #define PS2KBD_ALT (PS2KBD_LEFT_ALT | PS2KBD_RIGHT_ALT)
47 #define PS2KBD_GUI (PS2KBD_LEFT_GUI | PS2KBD_RIGHT_GUI)
48 
49 #define PS2KBD_RAWKEY_UP 0xF0
50 #define PS2KBD_RAWKEY_DOWN 0xF1
51 
52 typedef struct _kbd_rawkey
53 {
56 } kbd_rawkey;
57 
58 #define PS2KBD_READMODE_NORMAL 1
59 #define PS2KBD_READMODE_RAW 2
60 
61 /* Notes on read mode */
62 /* In normal readmode (default) read multiples of 1 character off the keyboard file. These are
63  processed by the keymaps so that you get back ASCII data */
64 /* In raw readmode must read multiples of 2. First byte indicates state (i.e. Up or Down)
65  Second byte is the USB key code for that key. This table is presented in the USB HID Usage Tables manaual
66  from usb.org */
67 
68 #define PS2KBD_BLOCKING 1
69 #define PS2KBD_NONBLOCKING 0
70 
71 #define PS2KBD_KEYMAP_SIZE 256
72 
73 typedef struct _kbd_keymap
74 {
76  u8 shiftkeymap[PS2KBD_KEYMAP_SIZE];
78 } kbd_keymap;
79 
80 /* IOCTLs for the keyboard file driver */
81 
83 #define PS2KBD_IOCTL_SETREADMODE 1
85 #define PS2KBD_IOCTL_SETLEDS 2
87 #define PS2KBD_IOCTL_SETREPEATRATE 3
89 #define PS2KBD_IOCTL_SETKEYMAP 4
91 #define PS2KBD_IOCTL_SETCTRLMAP 5
93 #define PS2KBD_IOCTL_SETALTMAP 6
95 #define PS2KBD_IOCTL_SETSPECIALMAP 7
97 #define PS2KBD_IOCTL_SETBLOCKMODE 8
99 #define PS2KBD_IOCTL_FLUSHBUFFER 9
101 #define PS2KBD_IOCTL_RESETKEYMAP 10
102 
103 /* Note on keymaps. In normal keymap a 0 would indicate no key */
104 /* Key maps are represented by 3 256*8bit tables. First table maps USB key to a char when not shifted */
105 /* Second table maps USB key to a char when shifted */
106 /* Third table contains boolean values. If 1 then the key is shifted/unshifted in capslock, else capslock is ignored */
107 
108 #endif /* __PS2KBD_H__ */
#define PS2KBD_KEYMAP_SIZE
Definition: ps2kbd.h:71
u8 key
Definition: ps2kbd.h:55
u8 state
Definition: ps2kbd.h:54
unsigned char u8
Definition: tamtypes.h:23