summaryrefslogtreecommitdiffstats
path: root/uClinux-2.4.20-uc1/drivers/char/w90n745_ps2.h
blob: baab952e325339b21b59bcf914bdc7f56c060b51 (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/****************************************************************************
 *                                                                                                                           *
 * Copyright (c) 2004 - 2006 Winbond Electronics Corp. All rights reserved.                          *
 *                                                                                                                           *
 ***************************************************************************/
 
/****************************************************************************
 * 
 * FILENAME
 *     w90n745_ps2.h
 *
 * VERSION
 *     1.0
 *
 * DESCRIPTION
 *     This file is the head file for winbond ps2 driver
 *
 * HISTORY
 *     1/9/2005		 Ver 1.0 Created by PC34 MCLi <mcli2@winbond.com.tw>
 *
 * REMARK
 *     None
 **************************************************************************/
 
/*
 *	Configuration Switches
 */
 
#ifndef W90N745_PS2_H 
#define W90N745_PS2_H

#undef 	KBD_REPORT_ERR				/* Report keyboard errors */
#define KBD_REPORT_UNKN				/* Report unknown scan codes */
#define KBD_REPORT_TIMEOUTS		/* Report keyboard timeouts */
#undef 	KBD_IS_FOCUS_9000			/* We have the brain-damaged FOCUS-9000 keyboard */
#undef 	INITIALIZE_MOUSE			/* Define if your PS/2 mouse needs initialization. */


#define KBD_INIT_TIMEOUT 1000		/* Timeout in ms for initializing the keyboard */
#define KBC_TIMEOUT 		 250		/* Timeout in ms for sending to keyboard controller */
#define KBD_TIMEOUT 		 5000		/* Timeout in ms for keyboard command acknowledge */

/*
 *	Internal variables of the driver
 */
extern unsigned char pckbd_read_mask;
extern unsigned char aux_device_present;

/*
 *	Keyboard Controller Registers on normal PCs.
 */
#define KBD_STATUS_REG		0xFFF89004 	/* Status register (R) */
#define KBD_CNTL_REG			0xFFF89000  /* Controller command register (W) */
#define KBD_DATA_REG			0xFFF89008 	/* Keyboard data register (R/W) */
#define PS2_SCANCODE_REG 	0xFFF89008
#define PS2_ASCII_REG			0xFFF8900C

/*
 *	Keyboard Controller Commands
 */
#define KBD_CCMD_READ_MODE			0x20	/* Read mode bits */
#define KBD_CCMD_WRITE_MODE			0x60	/* Write mode bits */
#define KBD_CCMD_GET_VERSION		0xA1	/* Get controller version */
#define KBD_CCMD_MOUSE_DISABLE	0xA7	/* Disable mouse interface */
#define KBD_CCMD_MOUSE_ENABLE		0xA8	/* Enable mouse interface */
#define KBD_CCMD_TEST_MOUSE			0xA9	/* Mouse interface test */
#define KBD_CCMD_SELF_TEST			0xAA	/* Controller self test */
#define KBD_CCMD_KBD_TEST				0xAB	/* Keyboard interface test */
#define KBD_CCMD_KBD_DISABLE		0xAD	/* Keyboard interface disable */
#define KBD_CCMD_KBD_ENABLE			0xAE	/* Keyboard interface enable */
#define KBD_CCMD_WRITE_AUX_OBUF	0xD3 	/* Write to output buffer as if initiated by the auxiliary device */
#define KBD_CCMD_WRITE_MOUSE		0xD4	/* Write the following byte to the mouse */

/*
 *	Keyboard Commands
 */
#define KBD_CMD_SET_LEDS	0xED	/* Set keyboard leds */
#define KBD_CMD_SET_RATE	0xF3	/* Set typematic rate */
#define KBD_CMD_ENABLE		0xF4	/* Enable scanning */
#define KBD_CMD_DISABLE		0xF5	/* Disable scanning */
#define KBD_CMD_RESET			0xFF	/* Reset */

/*
 *	Keyboard Replies
 */
#define KBD_REPLY_POR			0xAA	/* Power on reset */
#define KBD_REPLY_ACK			0xFA	/* Command ACK */
#define KBD_REPLY_RESEND	0xFE	/* Command NACK, send the cmd again */

/*
 *	Status Register Bits
 */
#define KBD_STAT_OBF 				0x01	/* Keyboard output buffer full */
#define KBD_STAT_IBF 				0x02	/* Keyboard input buffer full */
#define KBD_STAT_SELFTEST		0x04	/* Self test successful */
#define KBD_STAT_CMD				0x08	/* Last write was a command write (0=data) */
#define KBD_STAT_UNLOCKED		0x10	/* Zero if keyboard locked */
#define KBD_STAT_MOUSE_OBF	0x20	/* Mouse output buffer full */
#define KBD_STAT_GTO 				0x40	/* General receive/xmit timeout */
#define KBD_STAT_PERR 			0x80	/* Parity error */

/*
 *	Controller Mode Register Bits
 */

#define KBD_MODE_KBD_INT				0x01	/* Keyboard data generate IRQ1 */
#define KBD_MODE_MOUSE_INT			0x02	/* Mouse data generate IRQ12 */
#define KBD_MODE_SYS 						0x04	/* The system flag (?) */
#define KBD_MODE_NO_KEYLOCK			0x08	/* The keylock doesn't affect the keyboard if set */
#define KBD_MODE_DISABLE_KBD		0x10	/* Disable keyboard interface */
#define KBD_MODE_DISABLE_MOUSE	0x20	/* Disable mouse interface */
#define KBD_MODE_KCC 						0x40	/* Scan code conversion to PC format */
#define KBD_MODE_RFU						0x80

#endif //W90N745_PS2_H