TianoCore EDK2 master
Loading...
Searching...
No Matches
CommPs2.h
Go to the documentation of this file.
1
9#ifndef _COMMPS2_H_
10#define _COMMPS2_H_
11
12#include "Ps2Mouse.h"
13
14#define PS2_PACKET_LENGTH 3
15#define PS2_SYNC_MASK 0xc
16#define PS2_SYNC_BYTE 0x8
17
18#define IS_PS2_SYNC_BYTE(byte) ((byte & PS2_SYNC_MASK) == PS2_SYNC_BYTE)
19
20#define PS2_READ_BYTE_ONE 0
21#define PS2_READ_DATA_BYTE 1
22#define PS2_PROCESS_PACKET 2
23
24#define TIMEOUT 50000
25#define BAT_TIMEOUT 500000
26
27//
28// 8042 I/O Port
29//
30#define KBC_DATA_PORT 0x60
31#define KBC_CMD_STS_PORT 0x64
32
33//
34// 8042 Command
35//
36#define READ_CMD_BYTE 0x20
37#define WRITE_CMD_BYTE 0x60
38#define DISABLE_AUX 0xa7
39#define ENABLE_AUX 0xa8
40#define SELF_TEST 0xaa
41#define DISABLE_KB 0xad
42#define ENABLE_KB 0xae
43#define WRITE_AUX_DEV 0xd4
44
45#define CMD_SYS_FLAG 0x04
46#define CMD_KB_STS 0x10
47#define CMD_KB_DIS 0x10
48#define CMD_KB_EN 0x0
49
50//
51// 8042 Auxiliary Device Command
52//
53#define SETSF1_CMD 0xe6
54#define SETSF2_CMD 0xe7
55#define SETRE_CMD 0xe8
56#define READ_CMD 0xeb
57#define SETRM_CMD 0xf0
58#define SETSR_CMD 0xf3
59#define ENABLE_CMD 0xf4
60#define DISABLE_CMD 0xf5
61#define RESET_CMD 0xff
62
63//
64// return code
65//
66#define PS2_ACK 0xfa
67#define PS2_RESEND 0xfe
68#define PS2MOUSE_BAT1 0xaa
69#define PS2MOUSE_BAT2 0x0
70
71//
72// Keyboard Controller Status
73//
77#define KBC_PARE 0x80
81#define KBC_TIM 0x40
87#define KBC_AUXB 0x20
93#define KBC_KEYL 0x10
99#define KBC_CD 0x08
105#define KBC_SYSF 0x04
111#define KBC_INPB 0x02
117#define KBC_OUTB 0x01
118
127 VOID
128 );
129
137 VOID
138 );
139
147 VOID
148 );
149
157 VOID
158 );
159
167 VOID
168 );
169
179 OUT BOOLEAN *KeyboardEnable
180 );
181
189 VOID
190 );
191
201 IN MOUSE_SR SampleRate
202 );
203
213 IN MOUSE_RE Resolution
214 );
215
225 IN MOUSE_SF Scaling
226 );
227
235 VOID
236 );
237
249 PS2_MOUSE_DEV *MouseDev
250 );
251
263 OUT UINT8 *Buffer,
264 IN OUT UINTN *BufSize,
265 IN UINTN State
266 );
267
268//
269// 8042 I/O function
270//
271
282 IN UINT8 Command
283 );
284
295 IN OUT UINT8 *Data
296 );
297
308 IN UINT8 Data
309 );
310
322 IN UINT8 Command,
323 IN BOOLEAN Resend
324 );
325
336 IN OUT UINT8 *Data
337 );
338
349 IN UINT8 Data
350 );
351
360 VOID
361 );
362
373 IN UINTN Timeout
374 );
375
386 IN UINTN Timeout
387 );
388
389#endif
UINT64 UINTN
EFI_STATUS PS2MouseReset(VOID)
Definition: CommPs2.c:191
EFI_STATUS In8042AuxData(IN OUT UINT8 *Data)
Definition: CommPs2.c:740
EFI_STATUS CheckKbStatus(OUT BOOLEAN *KeyboardEnable)
Definition: CommPs2.c:153
EFI_STATUS PS2MouseSetResolution(IN MOUSE_RE Resolution)
Definition: CommPs2.c:265
EFI_STATUS Out8042AuxCommand(IN UINT8 Command, IN BOOLEAN Resend)
Definition: CommPs2.c:621
EFI_STATUS Out8042Data(IN UINT8 Data)
Definition: CommPs2.c:555
EFI_STATUS Out8042AuxData(IN UINT8 Data)
Definition: CommPs2.c:697
EFI_STATUS PS2MouseRead(OUT UINT8 *Buffer, IN OUT UINTN *BufSize, IN UINTN State)
Definition: CommPs2.c:464
EFI_STATUS In8042Data(IN OUT UINT8 *Data)
Definition: CommPs2.c:582
EFI_STATUS KbcEnableAux(VOID)
Definition: CommPs2.c:83
EFI_STATUS CheckForInput(VOID)
Definition: CommPs2.c:766
EFI_STATUS PS2MouseSetSampleRate(IN MOUSE_SR SampleRate)
Definition: CommPs2.c:238
EFI_STATUS PS2MouseSetScaling(IN MOUSE_SF Scaling)
Definition: CommPs2.c:292
EFI_STATUS PS2MouseEnable(VOID)
Definition: CommPs2.c:308
EFI_STATUS PS2MouseGetPacket(PS2_MOUSE_DEV *MouseDev)
Definition: CommPs2.c:328
EFI_STATUS WaitInputEmpty(IN UINTN Timeout)
Definition: CommPs2.c:793
EFI_STATUS KbcDisableAux(VOID)
Definition: CommPs2.c:101
EFI_STATUS KbcSelfTest(VOID)
Definition: CommPs2.c:23
EFI_STATUS WaitOutputFull(IN UINTN Timeout)
Definition: CommPs2.c:832
EFI_STATUS KbcDisableKb(VOID)
Definition: CommPs2.c:135
EFI_STATUS KbcEnableKb(VOID)
Definition: CommPs2.c:119
EFI_STATUS Out8042Command(IN UINT8 Command)
Definition: CommPs2.c:519
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29