driver/ps2: remove irq_ from names
This commit is contained in:
parent
98f92a9958
commit
1c4886153f
@ -9,8 +9,8 @@ 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
|
||||||
|
@ -10,23 +10,23 @@
|
|||||||
#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[IRQ_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, IRQ_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, IRQ_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[IRQ_PIC_PS2_KEYBOARD] = pic_ps2_IRQHandlerK;
|
||||||
irq_pic_Mask(IRQ_PIC_PS2_KEYBOARD, false);
|
irq_pic_Mask(IRQ_PIC_PS2_KEYBOARD, false);
|
||||||
|
|
||||||
// enable second PS/2 port
|
// enable second PS/2 port
|
||||||
@ -41,7 +41,7 @@ void irq_pic_ps2_Init() {
|
|||||||
__ps2_WriteCommandData(IRQ_PIC_PS2_CMD_WRITE_CONFIGBYTE, config | IRQ_PIC_PS2_CONFIG_PORT1_TRANSLATION);
|
__ps2_WriteCommandData(IRQ_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 & IRQ_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
|
||||||
@ -57,7 +57,7 @@ void irq_pic_ps2_Init() {
|
|||||||
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);
|
||||||
@ -67,9 +67,9 @@ void irq_pic_ps2_Init() {
|
|||||||
__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[IRQ_PIC_PS2_MOUSE] = pic_ps2_IRQHandlerM;
|
||||||
irq_pic_Mask(IRQ_PIC_PS2_MOUSE, false);
|
irq_pic_Mask(IRQ_PIC_PS2_MOUSE, false);
|
||||||
|
|
||||||
// set the actual mouse sample rate
|
// set the actual mouse sample rate
|
||||||
@ -83,29 +83,29 @@ void irq_pic_ps2_Init() {
|
|||||||
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(IRQ_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(IRQ_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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,10 +48,10 @@ extern "C" {
|
|||||||
#define IRQ_PIC_PS2_CMD_DEVICE_MOUSE_ENABLE_REPORTING 0xf4
|
#define IRQ_PIC_PS2_CMD_DEVICE_MOUSE_ENABLE_REPORTING 0xf4
|
||||||
#define IRQ_PIC_PS2_CMD_DEVICE_MOUSE_REQUEST_PACKET 0xeb
|
#define IRQ_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
|
||||||
@ -59,7 +59,7 @@ extern bool irq_pic_ps2_Mouse4Bytes; // the mouse has 4-byte data packages inste
|
|||||||
#define IRQ_PIC_PS2_QUEUESIZE_MOUSE 256
|
#define IRQ_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