ReactOS 0.4.15-dev-7958-gcd0bb1a
hwkmi.c File Reference
#include "precomp.h"
Include dependency graph for hwkmi.c:

Go to the source code of this file.

Macros

#define KMICR_TYPE   (1 << 5)
 
#define KMICR_RXINTREN   (1 << 4)
 
#define KMICR_TXINTREN   (1 << 3)
 
#define KMICR_EN   (1 << 2)
 
#define KMICR_FD   (1 << 1)
 
#define KMICR_FC   (1 << 0)
 
#define KMISTAT_TXEMPTY   (1 << 6)
 
#define KMISTAT_TXBUSY   (1 << 5)
 
#define KMISTAT_RXFULL   (1 << 4)
 
#define KMISTAT_RXBUSY   (1 << 3)
 
#define KMISTAT_RXPARITY   (1 << 2)
 
#define KMISTAT_IC   (1 << 1)
 
#define KMISTAT_ID   (1 << 0)
 
#define PL050_KMICR   (LlbHwVersaKmiBase + 0x00)
 
#define PL050_KMISTAT   (LlbHwVersaKmiBase + 0x04)
 
#define PL050_KMIDATA   (LlbHwVersaKmiBase + 0x08)
 
#define PL050_KMICLKDIV   (LlbHwVersaKmiBase + 0x0c)
 
#define PS2_O_RESET   0xff
 
#define PS2_O_RESEND   0xfe
 
#define PS2_O_DISABLE   0xf5
 
#define PS2_O_ENABLE   0xf4
 
#define PS2_O_ECHO   0xee
 
#define PS2_O_SET_DEFAULT   0xf6
 
#define PS2_O_SET_RATE_DELAY   0xf3
 
#define PS2_O_SET_SCANSET   0xf0
 
#define PS2_O_INDICATORS   0xed
 
#define PS2_I_RESEND   0xfe
 
#define PS2_I_DIAGFAIL   0xfd
 
#define PS2_I_ACK   0xfa
 
#define PS2_I_BREAK   0xf0
 
#define PS2_I_ECHO   0xee
 
#define PS2_I_BAT_OK   0xaa
 

Functions

VOID NTAPI LlbHwVersaKmiSendAndWait (IN ULONG Value)
 
VOID NTAPI LlbHwVersaKmiInitialize (VOID)
 
VOID NTAPI LlbHwKbdSend (IN ULONG Value)
 
BOOLEAN NTAPI LlbHwKbdReady (VOID)
 
INT NTAPI LlbHwKbdRead (VOID)
 

Variables

static const ULONG LlbHwVersaKmiBase = 0x10006000
 

Macro Definition Documentation

◆ KMICR_EN

#define KMICR_EN   (1 << 2)

Definition at line 17 of file hwkmi.c.

◆ KMICR_FC

#define KMICR_FC   (1 << 0)

Definition at line 19 of file hwkmi.c.

◆ KMICR_FD

#define KMICR_FD   (1 << 1)

Definition at line 18 of file hwkmi.c.

◆ KMICR_RXINTREN

#define KMICR_RXINTREN   (1 << 4)

Definition at line 15 of file hwkmi.c.

◆ KMICR_TXINTREN

#define KMICR_TXINTREN   (1 << 3)

Definition at line 16 of file hwkmi.c.

◆ KMICR_TYPE

#define KMICR_TYPE   (1 << 5)

Definition at line 14 of file hwkmi.c.

◆ KMISTAT_IC

#define KMISTAT_IC   (1 << 1)

Definition at line 29 of file hwkmi.c.

◆ KMISTAT_ID

#define KMISTAT_ID   (1 << 0)

Definition at line 30 of file hwkmi.c.

◆ KMISTAT_RXBUSY

#define KMISTAT_RXBUSY   (1 << 3)

Definition at line 27 of file hwkmi.c.

◆ KMISTAT_RXFULL

#define KMISTAT_RXFULL   (1 << 4)

Definition at line 26 of file hwkmi.c.

◆ KMISTAT_RXPARITY

#define KMISTAT_RXPARITY   (1 << 2)

Definition at line 28 of file hwkmi.c.

◆ KMISTAT_TXBUSY

#define KMISTAT_TXBUSY   (1 << 5)

Definition at line 25 of file hwkmi.c.

◆ KMISTAT_TXEMPTY

#define KMISTAT_TXEMPTY   (1 << 6)

Definition at line 24 of file hwkmi.c.

◆ PL050_KMICLKDIV

#define PL050_KMICLKDIV   (LlbHwVersaKmiBase + 0x0c)

Definition at line 38 of file hwkmi.c.

◆ PL050_KMICR

#define PL050_KMICR   (LlbHwVersaKmiBase + 0x00)

Definition at line 35 of file hwkmi.c.

◆ PL050_KMIDATA

#define PL050_KMIDATA   (LlbHwVersaKmiBase + 0x08)

Definition at line 37 of file hwkmi.c.

◆ PL050_KMISTAT

#define PL050_KMISTAT   (LlbHwVersaKmiBase + 0x04)

Definition at line 36 of file hwkmi.c.

◆ PS2_I_ACK

#define PS2_I_ACK   0xfa

Definition at line 55 of file hwkmi.c.

◆ PS2_I_BAT_OK

#define PS2_I_BAT_OK   0xaa

Definition at line 58 of file hwkmi.c.

◆ PS2_I_BREAK

#define PS2_I_BREAK   0xf0

Definition at line 56 of file hwkmi.c.

◆ PS2_I_DIAGFAIL

#define PS2_I_DIAGFAIL   0xfd

Definition at line 54 of file hwkmi.c.

◆ PS2_I_ECHO

#define PS2_I_ECHO   0xee

Definition at line 57 of file hwkmi.c.

◆ PS2_I_RESEND

#define PS2_I_RESEND   0xfe

Definition at line 53 of file hwkmi.c.

◆ PS2_O_DISABLE

#define PS2_O_DISABLE   0xf5

Definition at line 46 of file hwkmi.c.

◆ PS2_O_ECHO

#define PS2_O_ECHO   0xee

Definition at line 48 of file hwkmi.c.

◆ PS2_O_ENABLE

#define PS2_O_ENABLE   0xf4

Definition at line 47 of file hwkmi.c.

◆ PS2_O_INDICATORS

#define PS2_O_INDICATORS   0xed

Definition at line 52 of file hwkmi.c.

◆ PS2_O_RESEND

#define PS2_O_RESEND   0xfe

Definition at line 45 of file hwkmi.c.

◆ PS2_O_RESET

#define PS2_O_RESET   0xff

Definition at line 44 of file hwkmi.c.

◆ PS2_O_SET_DEFAULT

#define PS2_O_SET_DEFAULT   0xf6

Definition at line 49 of file hwkmi.c.

◆ PS2_O_SET_RATE_DELAY

#define PS2_O_SET_RATE_DELAY   0xf3

Definition at line 50 of file hwkmi.c.

◆ PS2_O_SET_SCANSET

#define PS2_O_SET_SCANSET   0xf0

Definition at line 51 of file hwkmi.c.

Function Documentation

◆ LlbHwKbdRead()

INT NTAPI LlbHwKbdRead ( VOID  )

Definition at line 127 of file hwkmi.c.

128{
129 /* Read current data on keyboard */
131}
#define PL050_KMIDATA
Definition: hwkmi.c:37
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)

Referenced by LlbHwVersaKmiInitialize(), and LlbHwVersaKmiSendAndWait().

◆ LlbHwKbdReady()

BOOLEAN NTAPI LlbHwKbdReady ( VOID  )

Definition at line 120 of file hwkmi.c.

121{
123}
#define PL050_KMISTAT
Definition: hwkmi.c:36
#define KMISTAT_RXFULL
Definition: hwkmi.c:26

◆ LlbHwKbdSend()

VOID NTAPI LlbHwKbdSend ( IN ULONG  Value)

Definition at line 103 of file hwkmi.c.

104{
106
107 /* Wait for ready signal */
108 do
109 {
110 /* Read TX buffer state */
112 } while (!(Status & KMISTAT_TXEMPTY));
113
114 /* Send value */
116}
Status
Definition: gdiplustypes.h:25
#define KMISTAT_TXEMPTY
Definition: hwkmi.c:24
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)

Referenced by LlbHwVersaKmiSendAndWait().

◆ LlbHwVersaKmiInitialize()

VOID NTAPI LlbHwVersaKmiInitialize ( VOID  )

Definition at line 80 of file hwkmi.c.

81{
83
84 /* Setup divisor and enable KMI */
85 Divisor = (LlbHwGetPClk() / 8000000) - 1;
88
89 /* Reset PS/2 controller */
91 if (LlbHwKbdRead() != PS2_I_BAT_OK) DbgPrint("PS/2 RESET FAILURE!\n");
92
93 /* Send PS/2 Initialization Stream */
99}
#define DbgPrint
Definition: hal.h:12
#define PS2_O_ENABLE
Definition: hwkmi.c:47
#define PS2_O_SET_SCANSET
Definition: hwkmi.c:51
#define PL050_KMICLKDIV
Definition: hwkmi.c:38
#define PS2_O_SET_DEFAULT
Definition: hwkmi.c:49
#define PS2_O_DISABLE
Definition: hwkmi.c:46
#define PL050_KMICR
Definition: hwkmi.c:35
#define PS2_O_RESET
Definition: hwkmi.c:44
INT NTAPI LlbHwKbdRead(VOID)
Definition: hwkmi.c:127
#define PS2_I_BAT_OK
Definition: hwkmi.c:58
VOID NTAPI LlbHwVersaKmiSendAndWait(IN ULONG Value)
Definition: hwkmi.c:64
#define KMICR_EN
Definition: hwkmi.c:17
ULONG NTAPI LlbHwGetPClk(VOID)
Definition: hwinfo.c:20
_In_ LARGE_INTEGER Divisor
Definition: rtlfuncs.h:3044
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by LlbHwInitialize().

◆ LlbHwVersaKmiSendAndWait()

VOID NTAPI LlbHwVersaKmiSendAndWait ( IN ULONG  Value)

Definition at line 64 of file hwkmi.c.

65{
66 volatile int i = 1000;
67
68 /* Send the value */
70
71 /* Wait a bit */
72 while (--i);
73
74 /* Now make sure we received an ACK */
75 if (LlbHwKbdRead() != PS2_I_ACK) DbgPrint("PS/2 FAILURE!\n");
76}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define PS2_I_ACK
Definition: hwkmi.c:55
VOID NTAPI LlbHwKbdSend(IN ULONG Value)
Definition: hwkmi.c:103

Referenced by LlbHwVersaKmiInitialize().

Variable Documentation

◆ LlbHwVersaKmiBase

const ULONG LlbHwVersaKmiBase = 0x10006000
static

Definition at line 39 of file hwkmi.c.