driver/ps2: remove irq_ from names
This commit is contained in:
parent
98f92a9958
commit
2d45a771e9
@ -9,52 +9,52 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
SYSV_ABI void irq_pic_ps2_IRQHandlerK(); // keyboard IRQ1
|
SYSV_ABI void pic_ps2_IRQHandlerK(); // keyboard IRQ1
|
||||||
SYSV_ABI void irq_pic_ps2_IRQHandlerM(); // mouse IRQ12
|
SYSV_ABI void pic_ps2_IRQHandlerM(); // mouse IRQ12
|
||||||
|
|
||||||
// waits until the Output Buffer Status (bit 0) of the Status Register is set
|
// waits until the Output Buffer Status (bit 0) of the Status Register is set
|
||||||
// and port 0x60 is ready for data read
|
// and port 0x60 is ready for data read
|
||||||
static inline void __ps2_PollWait_ReadReady() {
|
static inline void __ps2_PollWait_ReadReady() {
|
||||||
while ((inb(IRQ_PIC_PS2_STATUSPORT) & IRQ_PIC_PS2_STATUS_OUTPUT_BUFFER) == 0)
|
while ((inb(PIC_PS2_STATUSPORT) & IRQ_PIC_PS2_STATUS_OUTPUT_BUFFER) == 0)
|
||||||
asm("pause");
|
asm("pause");
|
||||||
}
|
}
|
||||||
|
|
||||||
// waits until the Input Buffer Status (bit 1) of the Status Register is clear
|
// waits until the Input Buffer Status (bit 1) of the Status Register is clear
|
||||||
// and ports 0x60/0x64 are ready for data write
|
// and ports 0x60/0x64 are ready for data write
|
||||||
static inline void __ps2_PollWait_WriteReady() {
|
static inline void __ps2_PollWait_WriteReady() {
|
||||||
while ((inb(IRQ_PIC_PS2_STATUSPORT) & IRQ_PIC_PS2_STATUS_INPUT_BUFFER) != 0)
|
while ((inb(PIC_PS2_STATUSPORT) & IRQ_PIC_PS2_STATUS_INPUT_BUFFER) != 0)
|
||||||
asm("pause");
|
asm("pause");
|
||||||
}
|
}
|
||||||
|
|
||||||
// waits until port 0x60 is ready and reads the byte in it
|
// waits until port 0x60 is ready and reads the byte in it
|
||||||
static inline uint8_t __ps2_ReadData() {
|
static inline uint8_t __ps2_ReadData() {
|
||||||
__ps2_PollWait_ReadReady();
|
__ps2_PollWait_ReadReady();
|
||||||
return inb(IRQ_PIC_PS2_IOPORT);
|
return inb(PIC_PS2_IOPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// waits until port 0x64 is ready for write, OUTB to it.
|
// waits until port 0x64 is ready for write, OUTB to it.
|
||||||
static inline void __ps2_WriteCommand(uint8_t cmd) {
|
static inline void __ps2_WriteCommand(uint8_t cmd) {
|
||||||
__ps2_PollWait_WriteReady();
|
__ps2_PollWait_WriteReady();
|
||||||
outb(IRQ_PIC_PS2_CMDPORT, cmd);
|
outb(PIC_PS2_CMDPORT, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// waits until port 0x64 is ready, OUTB to it, OUTB to 0x60 for data byte.
|
// waits until port 0x64 is ready, OUTB to it, OUTB to 0x60 for data byte.
|
||||||
static inline void __ps2_WriteCommandData(uint8_t cmd, uint8_t data) {
|
static inline void __ps2_WriteCommandData(uint8_t cmd, uint8_t data) {
|
||||||
__ps2_PollWait_WriteReady();
|
__ps2_PollWait_WriteReady();
|
||||||
outb(IRQ_PIC_PS2_CMDPORT, cmd);
|
outb(PIC_PS2_CMDPORT, cmd);
|
||||||
__ps2_PollWait_WriteReady();
|
__ps2_PollWait_WriteReady();
|
||||||
outb(IRQ_PIC_PS2_IOPORT, data);
|
outb(PIC_PS2_IOPORT, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void __ps2_ReadACK() {
|
static inline void __ps2_ReadACK() {
|
||||||
while (__ps2_ReadData() != IRQ_PIC_PS2_ACK) {}
|
while (__ps2_ReadData() != PIC_PS2_ACK) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets the sample rate of the mouse
|
// sets the sample rate of the mouse
|
||||||
static inline void __ps2_SetMouseRate(uint8_t rate) {
|
static inline void __ps2_SetMouseRate(uint8_t rate) {
|
||||||
__ps2_WriteCommandData(IRQ_PIC_PS2_CMD_SEND_MOUSE, 0xf3); // command to the mouse
|
__ps2_WriteCommandData(PIC_PS2_CMD_SEND_MOUSE, 0xf3); // command to the mouse
|
||||||
__ps2_ReadACK(); // read the ACK
|
__ps2_ReadACK(); // read the ACK
|
||||||
__ps2_WriteCommandData(IRQ_PIC_PS2_CMD_SEND_MOUSE, rate); // send the rate
|
__ps2_WriteCommandData(PIC_PS2_CMD_SEND_MOUSE, rate); // send the rate
|
||||||
__ps2_ReadACK(); // read the ACK
|
__ps2_ReadACK(); // read the ACK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,38 +10,38 @@
|
|||||||
#include "../../../../driver/input/source.h"
|
#include "../../../../driver/input/source.h"
|
||||||
|
|
||||||
|
|
||||||
bool irq_pic_ps2_HasMouse;
|
bool pic_ps2_HasMouse;
|
||||||
bool irq_pic_ps2_Mouse4Bytes; // the mouse has 4-byte data packages instead of 3
|
bool pic_ps2_Mouse4Bytes; // the mouse has 4-byte data packages instead of 3
|
||||||
|
|
||||||
queue irq_pic_ps2_QueueKeyboard, irq_pic_ps2_QueueMouse;
|
queue pic_ps2_QueueKeyboard, irq_pic_ps2_QueueMouse;
|
||||||
uint8_t __irq_pic_ps2_QueueBufferK[IRQ_PIC_PS2_QUEUESIZE_KEYBOARD], __irq_pic_ps2_QueueBufferM[IRQ_PIC_PS2_QUEUESIZE_MOUSE];
|
uint8_t __pic_ps2_QueueBufferK[PIC_PS2_QUEUESIZE_KEYBOARD], __irq_pic_ps2_QueueBufferM[IRQ_PIC_PS2_QUEUESIZE_MOUSE];
|
||||||
|
|
||||||
void irq_pic_ps2_Init() {
|
void pic_ps2_Init() {
|
||||||
assert(irq_pic_Enabled && "irq_pic_ps2_Init() requires PIC to be enabled");
|
assert(irq_pic_Enabled && "pic_ps2_Init() requires PIC to be enabled");
|
||||||
|
|
||||||
// init the Keyboard and Mouse queues
|
// init the Keyboard and Mouse queues
|
||||||
queue_InitBuffered(&irq_pic_ps2_QueueKeyboard, __irq_pic_ps2_QueueBufferK, IRQ_PIC_PS2_QUEUESIZE_KEYBOARD);
|
queue_InitBuffered(&pic_ps2_QueueKeyboard, __irq_pic_ps2_QueueBufferK, PIC_PS2_QUEUESIZE_KEYBOARD);
|
||||||
queue_InitBuffered(&irq_pic_ps2_QueueMouse, __irq_pic_ps2_QueueBufferM, IRQ_PIC_PS2_QUEUESIZE_MOUSE);
|
queue_InitBuffered(&pic_ps2_QueueMouse, __irq_pic_ps2_QueueBufferM, PIC_PS2_QUEUESIZE_MOUSE);
|
||||||
|
|
||||||
uint8_t data;
|
uint8_t data;
|
||||||
INTERRUPT_DISABLE;
|
INTERRUPT_DISABLE;
|
||||||
|
|
||||||
irq_pic_IRQHandler[IRQ_PIC_PS2_KEYBOARD] = irq_pic_ps2_IRQHandlerK;
|
irq_pic_IRQHandler[PIC_PS2_KEYBOARD] = pic_ps2_IRQHandlerK;
|
||||||
irq_pic_Mask(IRQ_PIC_PS2_KEYBOARD, false);
|
irq_pic_Mask(PIC_PS2_KEYBOARD, false);
|
||||||
|
|
||||||
// enable second PS/2 port
|
// enable second PS/2 port
|
||||||
io_WriteConsoleASCII("ENABLE_MOUSE... ");
|
io_WriteConsoleASCII("ENABLE_MOUSE... ");
|
||||||
__ps2_WriteCommand(IRQ_PIC_PS2_CMD_ENABLE_MOUSE);
|
__ps2_WriteCommand(PIC_PS2_CMD_ENABLE_MOUSE);
|
||||||
|
|
||||||
io_WriteConsoleASCII("CONTROLLER_READ_CONFIGBYTE... ");
|
io_WriteConsoleASCII("CONTROLLER_READ_CONFIGBYTE... ");
|
||||||
__ps2_WriteCommand(IRQ_PIC_PS2_CMD_READ_CONFIGBYTE);
|
__ps2_WriteCommand(PIC_PS2_CMD_READ_CONFIGBYTE);
|
||||||
uint8_t config = __ps2_ReadData();
|
uint8_t config = __ps2_ReadData();
|
||||||
// write controller mode (|= Port1Translation)
|
// write controller mode (|= Port1Translation)
|
||||||
io_WriteConsoleASCII("CONTROLLER_WRITE_CONFIGBYTE... ");
|
io_WriteConsoleASCII("CONTROLLER_WRITE_CONFIGBYTE... ");
|
||||||
__ps2_WriteCommandData(IRQ_PIC_PS2_CMD_WRITE_CONFIGBYTE, config | IRQ_PIC_PS2_CONFIG_PORT1_TRANSLATION);
|
__ps2_WriteCommandData(PIC_PS2_CMD_WRITE_CONFIGBYTE, config | IRQ_PIC_PS2_CONFIG_PORT1_TRANSLATION);
|
||||||
|
|
||||||
if (config & IRQ_PIC_PS2_CONFIG_PORT1_CLOCK) { // mouse not present
|
if (config & PIC_PS2_CONFIG_PORT1_CLOCK) { // mouse not present
|
||||||
irq_pic_ps2_HasMouse = false;
|
pic_ps2_HasMouse = false;
|
||||||
io_WriteConsoleASCII("PS/2 Controller has no mouse\n");
|
io_WriteConsoleASCII("PS/2 Controller has no mouse\n");
|
||||||
INTERRUPT_RESTORE;
|
INTERRUPT_RESTORE;
|
||||||
return; // early out
|
return; // early out
|
||||||
@ -50,62 +50,62 @@ void irq_pic_ps2_Init() {
|
|||||||
// initialize the mouse
|
// initialize the mouse
|
||||||
// reset mouse
|
// reset mouse
|
||||||
io_WriteConsoleASCII("DEVICE_RESET... ");
|
io_WriteConsoleASCII("DEVICE_RESET... ");
|
||||||
__ps2_WriteCommandData(IRQ_PIC_PS2_CMD_SEND_MOUSE, IRQ_PIC_PS2_CMD_DEVICE_RESET);
|
__ps2_WriteCommandData(PIC_PS2_CMD_SEND_MOUSE, IRQ_PIC_PS2_CMD_DEVICE_RESET);
|
||||||
while ((data = __ps2_ReadData()) != IRQ_PIC_PS2_RESET_OK) {
|
while ((data = __ps2_ReadData()) != PIC_PS2_RESET_OK) {
|
||||||
io_Printf("%X ", data);
|
io_Printf("%X ", data);
|
||||||
}
|
}
|
||||||
io_Printf("%X ", data);
|
io_Printf("%X ", data);
|
||||||
|
|
||||||
// enable 4-byte mode for mouse, pure magic!
|
// enable 4-byte mode for mouse, pure magic!
|
||||||
irq_pic_ps2_Mouse4Bytes = false;
|
pic_ps2_Mouse4Bytes = false;
|
||||||
__ps2_SetMouseRate(200);
|
__ps2_SetMouseRate(200);
|
||||||
__ps2_SetMouseRate(100);
|
__ps2_SetMouseRate(100);
|
||||||
__ps2_SetMouseRate(80);
|
__ps2_SetMouseRate(80);
|
||||||
|
|
||||||
io_WriteConsoleASCII("SEND_MOUSE(PS2_DEVICE_ID)");
|
io_WriteConsoleASCII("SEND_MOUSE(PS2_DEVICE_ID)");
|
||||||
__ps2_WriteCommandData(IRQ_PIC_PS2_CMD_SEND_MOUSE, 0xf2); // get device ID
|
__ps2_WriteCommandData(PIC_PS2_CMD_SEND_MOUSE, 0xf2); // get device ID
|
||||||
__ps2_ReadACK();
|
__ps2_ReadACK();
|
||||||
uint8_t id = __ps2_ReadData(); // receive device ID
|
uint8_t id = __ps2_ReadData(); // receive device ID
|
||||||
io_Printf(", MOUSE PS/2 ID=%d\n", id);
|
io_Printf(", MOUSE PS/2 ID=%d\n", id);
|
||||||
irq_pic_ps2_Mouse4Bytes = (id == 3); // Z-axis is enabled
|
pic_ps2_Mouse4Bytes = (id == 3); // Z-axis is enabled
|
||||||
|
|
||||||
irq_pic_IRQHandler[IRQ_PIC_PS2_MOUSE] = irq_pic_ps2_IRQHandlerM;
|
irq_pic_IRQHandler[PIC_PS2_MOUSE] = pic_ps2_IRQHandlerM;
|
||||||
irq_pic_Mask(IRQ_PIC_PS2_MOUSE, false);
|
irq_pic_Mask(PIC_PS2_MOUSE, false);
|
||||||
|
|
||||||
// set the actual mouse sample rate
|
// set the actual mouse sample rate
|
||||||
__ps2_SetMouseRate(IRQ_PIC_PS2_MOUSE_SAMPLERATE);
|
__ps2_SetMouseRate(PIC_PS2_MOUSE_SAMPLERATE);
|
||||||
|
|
||||||
// enable mouse reporting
|
// enable mouse reporting
|
||||||
io_WriteConsoleASCII("MOUSE_ENABLE_REPORTING... ");
|
io_WriteConsoleASCII("MOUSE_ENABLE_REPORTING... ");
|
||||||
__ps2_WriteCommandData(IRQ_PIC_PS2_CMD_SEND_MOUSE, IRQ_PIC_PS2_CMD_DEVICE_MOUSE_ENABLE_REPORTING);
|
__ps2_WriteCommandData(PIC_PS2_CMD_SEND_MOUSE, IRQ_PIC_PS2_CMD_DEVICE_MOUSE_ENABLE_REPORTING);
|
||||||
__ps2_ReadACK(); // receive ACK
|
__ps2_ReadACK(); // receive ACK
|
||||||
|
|
||||||
INTERRUPT_RESTORE;
|
INTERRUPT_RESTORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSV_ABI void irq_pic_ps2_IRQHandlerK() {
|
SYSV_ABI void pic_ps2_IRQHandlerK() {
|
||||||
queue_PushByte(&irq_pic_ps2_QueueKeyboard, inb(IRQ_PIC_PS2_IOPORT));
|
queue_PushByte(&pic_ps2_QueueKeyboard, inb(PIC_PS2_IOPORT));
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSV_ABI void irq_pic_ps2_IRQHandlerM() {
|
SYSV_ABI void pic_ps2_IRQHandlerM() {
|
||||||
queue_PushByte(&irq_pic_ps2_QueueMouse, inb(IRQ_PIC_PS2_IOPORT));
|
queue_PushByte(&pic_ps2_QueueMouse, inb(PIC_PS2_IOPORT));
|
||||||
|
|
||||||
while (queue_Size(&irq_pic_ps2_QueueMouse) && !(queue_FrontByte(&irq_pic_ps2_QueueMouse) & (1u << 3)))
|
while (queue_Size(&pic_ps2_QueueMouse) && !(queue_FrontByte(&irq_pic_ps2_QueueMouse) & (1u << 3)))
|
||||||
queue_PopByte(&irq_pic_ps2_QueueMouse);
|
queue_PopByte(&pic_ps2_QueueMouse);
|
||||||
|
|
||||||
while (queue_Size(&irq_pic_ps2_QueueMouse) >= (irq_pic_ps2_Mouse4Bytes ? 4 : 3)) {
|
while (queue_Size(&pic_ps2_QueueMouse) >= (irq_pic_ps2_Mouse4Bytes ? 4 : 3)) {
|
||||||
unsigned int moveX, moveY, state;
|
unsigned int moveX, moveY, state;
|
||||||
|
|
||||||
state = queue_PopByte(&irq_pic_ps2_QueueMouse);
|
state = queue_PopByte(&pic_ps2_QueueMouse);
|
||||||
|
|
||||||
unsigned int d = queue_PopByte(&irq_pic_ps2_QueueMouse);
|
unsigned int d = queue_PopByte(&pic_ps2_QueueMouse);
|
||||||
moveX = d - ((state << 4) & 0x100);
|
moveX = d - ((state << 4) & 0x100);
|
||||||
d = queue_PopByte(&irq_pic_ps2_QueueMouse);
|
d = queue_PopByte(&pic_ps2_QueueMouse);
|
||||||
moveY = d - ((state << 3) & 0x100);
|
moveY = d - ((state << 3) & 0x100);
|
||||||
|
|
||||||
input_source_MoveMouse(moveX, -moveY);
|
input_source_MoveMouse(moveX, -moveY);
|
||||||
|
|
||||||
if (irq_pic_ps2_Mouse4Bytes)
|
if (pic_ps2_Mouse4Bytes)
|
||||||
queue_PopByte(&irq_pic_ps2_QueueMouse);
|
queue_PopByte(&pic_ps2_QueueMouse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,59 +7,59 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define IRQ_PIC_PS2_MOUSE_SAMPLERATE 60 // the sample rate of the mouse
|
#define PIC_PS2_MOUSE_SAMPLERATE 60 // the sample rate of the mouse
|
||||||
|
|
||||||
|
|
||||||
#define IRQ_PIC_PS2_KEYBOARD 1 // Keyboard IRQ number
|
#define PIC_PS2_KEYBOARD 1 // Keyboard IRQ number
|
||||||
#define IRQ_PIC_PS2_MOUSE 12 // Mouse IRQ number
|
#define PIC_PS2_MOUSE 12 // Mouse IRQ number
|
||||||
|
|
||||||
#define IRQ_PIC_PS2_IOPORT 0x0060
|
#define PIC_PS2_IOPORT 0x0060
|
||||||
#define IRQ_PIC_PS2_STATUSPORT 0x0064
|
#define PIC_PS2_STATUSPORT 0x0064
|
||||||
#define IRQ_PIC_PS2_CMDPORT 0x0064
|
#define PIC_PS2_CMDPORT 0x0064
|
||||||
|
|
||||||
#define IRQ_PIC_PS2_STATUS_OUTPUT_BUFFER (1 << 0)
|
#define PIC_PS2_STATUS_OUTPUT_BUFFER (1 << 0)
|
||||||
#define IRQ_PIC_PS2_STATUS_INPUT_BUFFER (1 << 1)
|
#define PIC_PS2_STATUS_INPUT_BUFFER (1 << 1)
|
||||||
#define IRQ_PIC_PS2_STATUS_SYSTEM_FLAG (1 << 2)
|
#define PIC_PS2_STATUS_SYSTEM_FLAG (1 << 2)
|
||||||
#define IRQ_PIC_PS2_STATUS_INPUT_BUFFER_IS_COMMAND (1 << 3) // (0 = data written to input buffer is data for PS/2 device, 1 = data written to input buffer is data for PS/2 controller command)
|
#define PIC_PS2_STATUS_INPUT_BUFFER_IS_COMMAND (1 << 3) // (0 = data written to input buffer is data for PS/2 device, 1 = data written to input buffer is data for PS/2 controller command)
|
||||||
#define IRQ_PIC_PS2_STATUS_UNUSED_4 (1 << 4)
|
#define PIC_PS2_STATUS_UNUSED_4 (1 << 4)
|
||||||
#define IRQ_PIC_PS2_STATUS_UNUSED_5 (1 << 5)
|
#define PIC_PS2_STATUS_UNUSED_5 (1 << 5)
|
||||||
#define IRQ_PIC_PS2_STATUS_TIMEOUT_ERROR (1 << 6)
|
#define PIC_PS2_STATUS_TIMEOUT_ERROR (1 << 6)
|
||||||
#define IRQ_PIC_PS2_STATUS_PARITY_ERROR (1 << 7)
|
#define PIC_PS2_STATUS_PARITY_ERROR (1 << 7)
|
||||||
|
|
||||||
#define IRQ_PIC_PS2_CONFIG_PORT1_INTERRUPT (1 << 0) // PS/2 port interrupt (1=Enabled, 0=Disabled)
|
#define PIC_PS2_CONFIG_PORT1_INTERRUPT (1 << 0) // PS/2 port interrupt (1=Enabled, 0=Disabled)
|
||||||
#define IRQ_PIC_PS2_CONFIG_PORT2_INTERRUPT (1 << 1) // PS/2 port interrupt (1=Enabled, 0=Disabled)
|
#define PIC_PS2_CONFIG_PORT2_INTERRUPT (1 << 1) // PS/2 port interrupt (1=Enabled, 0=Disabled)
|
||||||
#define IRQ_PIC_PS2_CONFIG_SYSTEM_POST_OK (1 << 2) // If the system have passed POST
|
#define PIC_PS2_CONFIG_SYSTEM_POST_OK (1 << 2) // If the system have passed POST
|
||||||
#define IRQ_PIC_PS2_CONFIG_PORT1_CLOCK (1 << 4) // PS/2 port clock (1=Disabled, 0=Enabled)
|
#define PIC_PS2_CONFIG_PORT1_CLOCK (1 << 4) // PS/2 port clock (1=Disabled, 0=Enabled)
|
||||||
#define IRQ_PIC_PS2_CONFIG_PORT2_CLOCK (1 << 5) // PS/2 port clock (1=Disabled, 0=Enabled)
|
#define PIC_PS2_CONFIG_PORT2_CLOCK (1 << 5) // PS/2 port clock (1=Disabled, 0=Enabled)
|
||||||
#define IRQ_PIC_PS2_CONFIG_PORT1_TRANSLATION (1 << 6) // PS/2 keyboard scancode translation (from Set 2 to Set 1)
|
#define PIC_PS2_CONFIG_PORT1_TRANSLATION (1 << 6) // PS/2 keyboard scancode translation (from Set 2 to Set 1)
|
||||||
|
|
||||||
#define IRQ_PIC_PS2_ACK 0xfa // ACK code for keyboard and mouse (controller cmds have no ack)
|
#define PIC_PS2_ACK 0xfa // ACK code for keyboard and mouse (controller cmds have no ack)
|
||||||
#define IRQ_PIC_PS2_RESET_OK 0xaa // the last output byte when a PS/2 device is reset
|
#define PIC_PS2_RESET_OK 0xaa // the last output byte when a PS/2 device is reset
|
||||||
|
|
||||||
#define IRQ_PIC_PS2_CMD_READ_CONFIGBYTE 0x20 // Read byte 0 from controller RAM (configuration byte)
|
#define PIC_PS2_CMD_READ_CONFIGBYTE 0x20 // Read byte 0 from controller RAM (configuration byte)
|
||||||
#define IRQ_PIC_PS2_CMD_WRITE_CONFIGBYTE 0x60 // Write byte 0 to controller RAM (config byte)
|
#define PIC_PS2_CMD_WRITE_CONFIGBYTE 0x60 // Write byte 0 to controller RAM (config byte)
|
||||||
#define IRQ_PIC_PS2_CMD_DISABLE_MOUSE 0xa9 // Disable second PS/2 port (usually mouse)
|
#define PIC_PS2_CMD_DISABLE_MOUSE 0xa9 // Disable second PS/2 port (usually mouse)
|
||||||
#define IRQ_PIC_PS2_CMD_ENABLE_MOUSE 0xa8 // Enable second PS/2 port (usually mouse)
|
#define PIC_PS2_CMD_ENABLE_MOUSE 0xa8 // Enable second PS/2 port (usually mouse)
|
||||||
#define IRQ_PIC_PS2_CMD_SEND_MOUSE 0xd4 // Send a data byte to the second PS/2 port (usually mouse)
|
#define PIC_PS2_CMD_SEND_MOUSE 0xd4 // Send a data byte to the second PS/2 port (usually mouse)
|
||||||
|
|
||||||
#define IRQ_PIC_PS2_CMD_DEVICE_GETID 0xf2
|
#define PIC_PS2_CMD_DEVICE_GETID 0xf2
|
||||||
#define IRQ_PIC_PS2_CMD_DEVICE_RESET 0xff
|
#define PIC_PS2_CMD_DEVICE_RESET 0xff
|
||||||
#define IRQ_PIC_PS2_CMD_DEVICE_MOUSE_DISABLE_REPORTING 0xf5
|
#define PIC_PS2_CMD_DEVICE_MOUSE_DISABLE_REPORTING 0xf5
|
||||||
#define IRQ_PIC_PS2_CMD_DEVICE_MOUSE_ENABLE_REPORTING 0xf4
|
#define PIC_PS2_CMD_DEVICE_MOUSE_ENABLE_REPORTING 0xf4
|
||||||
#define IRQ_PIC_PS2_CMD_DEVICE_MOUSE_REQUEST_PACKET 0xeb
|
#define PIC_PS2_CMD_DEVICE_MOUSE_REQUEST_PACKET 0xeb
|
||||||
|
|
||||||
void irq_pic_ps2_Init();
|
void pic_ps2_Init();
|
||||||
|
|
||||||
extern bool irq_pic_ps2_HasMouse; // does the PS/2 controller have 2 channels?
|
extern bool pic_ps2_HasMouse; // does the PS/2 controller have 2 channels?
|
||||||
extern bool irq_pic_ps2_Mouse4Bytes; // the mouse has 4-byte data packages instead of 3; mouse wheel enabled
|
extern bool pic_ps2_Mouse4Bytes; // the mouse has 4-byte data packages instead of 3; mouse wheel enabled
|
||||||
|
|
||||||
|
|
||||||
// size in bytes of the Keyboard/Mouse FIFO buffers
|
// size in bytes of the Keyboard/Mouse FIFO buffers
|
||||||
#define IRQ_PIC_PS2_QUEUESIZE_KEYBOARD 64
|
#define PIC_PS2_QUEUESIZE_KEYBOARD 64
|
||||||
#define IRQ_PIC_PS2_QUEUESIZE_MOUSE 256
|
#define PIC_PS2_QUEUESIZE_MOUSE 256
|
||||||
|
|
||||||
// data queue in bytes for the Keyboard and Mouse IRQs
|
// data queue in bytes for the Keyboard and Mouse IRQs
|
||||||
extern queue irq_pic_ps2_QueueKeyboard, irq_pic_ps2_QueueMouse;
|
extern queue pic_ps2_QueueKeyboard, irq_pic_ps2_QueueMouse;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -53,7 +53,7 @@ SYSV_ABI void kMain() {
|
|||||||
|
|
||||||
irq_pic_Init();
|
irq_pic_Init();
|
||||||
io_WriteConsoleASCII("PIC IRQ OK\n");
|
io_WriteConsoleASCII("PIC IRQ OK\n");
|
||||||
irq_pic_ps2_Init();
|
pic_ps2_Init();
|
||||||
io_WriteConsoleASCII("PIC PS/2 OK\n");
|
io_WriteConsoleASCII("PIC PS/2 OK\n");
|
||||||
|
|
||||||
xcursor_Xcursor cursor;
|
xcursor_Xcursor cursor;
|
||||||
|
Loading…
Reference in New Issue
Block a user