driver/ps2: remove irq_ from names
This commit is contained in:
parent
98f92a9958
commit
1c4886153f
@ -9,8 +9,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
SYSV_ABI void irq_pic_ps2_IRQHandlerK(); // keyboard IRQ1
|
||||
SYSV_ABI void irq_pic_ps2_IRQHandlerM(); // mouse IRQ12
|
||||
SYSV_ABI void pic_ps2_IRQHandlerK(); // keyboard IRQ1
|
||||
SYSV_ABI void pic_ps2_IRQHandlerM(); // mouse IRQ12
|
||||
|
||||
// waits until the Output Buffer Status (bit 0) of the Status Register is set
|
||||
// and port 0x60 is ready for data read
|
||||
|
@ -10,23 +10,23 @@
|
||||
#include "../../../../driver/input/source.h"
|
||||
|
||||
|
||||
bool irq_pic_ps2_HasMouse;
|
||||
bool irq_pic_ps2_Mouse4Bytes; // the mouse has 4-byte data packages instead of 3
|
||||
bool pic_ps2_HasMouse;
|
||||
bool pic_ps2_Mouse4Bytes; // the mouse has 4-byte data packages instead of 3
|
||||
|
||||
queue irq_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];
|
||||
queue pic_ps2_QueueKeyboard, irq_pic_ps2_QueueMouse;
|
||||
uint8_t __pic_ps2_QueueBufferK[IRQ_PIC_PS2_QUEUESIZE_KEYBOARD], __irq_pic_ps2_QueueBufferM[IRQ_PIC_PS2_QUEUESIZE_MOUSE];
|
||||
|
||||
void irq_pic_ps2_Init() {
|
||||
assert(irq_pic_Enabled && "irq_pic_ps2_Init() requires PIC to be enabled");
|
||||
void pic_ps2_Init() {
|
||||
assert(irq_pic_Enabled && "pic_ps2_Init() requires PIC to be enabled");
|
||||
|
||||
// init the Keyboard and Mouse queues
|
||||
queue_InitBuffered(&irq_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_QueueKeyboard, __irq_pic_ps2_QueueBufferK, IRQ_PIC_PS2_QUEUESIZE_KEYBOARD);
|
||||
queue_InitBuffered(&pic_ps2_QueueMouse, __irq_pic_ps2_QueueBufferM, IRQ_PIC_PS2_QUEUESIZE_MOUSE);
|
||||
|
||||
uint8_t data;
|
||||
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);
|
||||
|
||||
// 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);
|
||||
|
||||
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");
|
||||
INTERRUPT_RESTORE;
|
||||
return; // early out
|
||||
@ -57,7 +57,7 @@ void irq_pic_ps2_Init() {
|
||||
io_Printf("%X ", data);
|
||||
|
||||
// enable 4-byte mode for mouse, pure magic!
|
||||
irq_pic_ps2_Mouse4Bytes = false;
|
||||
pic_ps2_Mouse4Bytes = false;
|
||||
__ps2_SetMouseRate(200);
|
||||
__ps2_SetMouseRate(100);
|
||||
__ps2_SetMouseRate(80);
|
||||
@ -67,9 +67,9 @@ void irq_pic_ps2_Init() {
|
||||
__ps2_ReadACK();
|
||||
uint8_t id = __ps2_ReadData(); // receive device 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);
|
||||
|
||||
// set the actual mouse sample rate
|
||||
@ -83,29 +83,29 @@ void irq_pic_ps2_Init() {
|
||||
INTERRUPT_RESTORE;
|
||||
}
|
||||
|
||||
SYSV_ABI void irq_pic_ps2_IRQHandlerK() {
|
||||
queue_PushByte(&irq_pic_ps2_QueueKeyboard, inb(IRQ_PIC_PS2_IOPORT));
|
||||
SYSV_ABI void pic_ps2_IRQHandlerK() {
|
||||
queue_PushByte(&pic_ps2_QueueKeyboard, inb(IRQ_PIC_PS2_IOPORT));
|
||||
}
|
||||
|
||||
SYSV_ABI void irq_pic_ps2_IRQHandlerM() {
|
||||
queue_PushByte(&irq_pic_ps2_QueueMouse, inb(IRQ_PIC_PS2_IOPORT));
|
||||
SYSV_ABI void pic_ps2_IRQHandlerM() {
|
||||
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)))
|
||||
queue_PopByte(&irq_pic_ps2_QueueMouse);
|
||||
while (queue_Size(&pic_ps2_QueueMouse) && !(queue_FrontByte(&irq_pic_ps2_QueueMouse) & (1u << 3)))
|
||||
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;
|
||||
|
||||
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);
|
||||
d = queue_PopByte(&irq_pic_ps2_QueueMouse);
|
||||
d = queue_PopByte(&pic_ps2_QueueMouse);
|
||||
moveY = d - ((state << 3) & 0x100);
|
||||
|
||||
input_source_MoveMouse(moveX, -moveY);
|
||||
|
||||
if (irq_pic_ps2_Mouse4Bytes)
|
||||
queue_PopByte(&irq_pic_ps2_QueueMouse);
|
||||
if (pic_ps2_Mouse4Bytes)
|
||||
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_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 irq_pic_ps2_Mouse4Bytes; // the mouse has 4-byte data packages instead of 3; mouse wheel enabled
|
||||
extern bool pic_ps2_HasMouse; // does the PS/2 controller have 2 channels?
|
||||
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
|
||||
@ -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
|
||||
|
||||
// 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
|
||||
|
@ -53,7 +53,7 @@ SYSV_ABI void kMain() {
|
||||
|
||||
irq_pic_Init();
|
||||
io_WriteConsoleASCII("PIC IRQ OK\n");
|
||||
irq_pic_ps2_Init();
|
||||
pic_ps2_Init();
|
||||
io_WriteConsoleASCII("PIC PS/2 OK\n");
|
||||
|
||||
xcursor_Xcursor cursor;
|
||||
|
Loading…
Reference in New Issue
Block a user