Change to the interrupt handler return values.
Also, the style police have visited ps2mouse.c git-svn-id: file:///srv/svn/repos/haiku/trunk/current@338 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -158,7 +158,7 @@ static void insert_in_buf(char c)
|
|||||||
static int handle_keyboard_interrupt(void* data)
|
static int handle_keyboard_interrupt(void* data)
|
||||||
{
|
{
|
||||||
unsigned char key;
|
unsigned char key;
|
||||||
int retval = INT_NO_RESCHEDULE;
|
int retval = B_UNHANDLED_INTERRUPT;
|
||||||
|
|
||||||
key = in8(0x60);
|
key = in8(0x60);
|
||||||
// dprintf("handle_keyboard_interrupt: key = 0x%x\n", key);
|
// dprintf("handle_keyboard_interrupt: key = 0x%x\n", key);
|
||||||
@@ -220,7 +220,7 @@ static int handle_keyboard_interrupt(void* data)
|
|||||||
// dprintf("ascii = 0x%x, '%c'\n", ascii, ascii);
|
// dprintf("ascii = 0x%x, '%c'\n", ascii, ascii);
|
||||||
if(ascii != 0) {
|
if(ascii != 0) {
|
||||||
insert_in_buf(ascii);
|
insert_in_buf(ascii);
|
||||||
retval = INT_RESCHEDULE;
|
retval = B_INVOKE_SCHEDULER;
|
||||||
} else {
|
} else {
|
||||||
// dprintf("keyboard: unknown scan-code 0x%x\n",key);
|
// dprintf("keyboard: unknown scan-code 0x%x\n",key);
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,7 @@ static int setup_keyboard(void)
|
|||||||
status_t init_hardware()
|
status_t init_hardware()
|
||||||
{
|
{
|
||||||
setup_keyboard();
|
setup_keyboard();
|
||||||
int_set_io_interrupt_handler(0x21,&handle_keyboard_interrupt, NULL);
|
install_io_interrupt_handler(0x21, &handle_keyboard_interrupt, NULL, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ static int handle_mouse_interrupt(void* data)
|
|||||||
break;
|
break;
|
||||||
} // switch
|
} // switch
|
||||||
|
|
||||||
next_input = (next_input + 1) % 3;
|
next_input = (next_input + 1) % 3;
|
||||||
return INT_NO_RESCHEDULE;
|
return B_HANDLED_INTERRUPT;
|
||||||
} // handle_mouse_interrupt
|
} // handle_mouse_interrupt
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
@@ -298,27 +298,27 @@ static unsigned char read_data_byte()
|
|||||||
*/
|
*/
|
||||||
status_t init_hardware()
|
status_t init_hardware()
|
||||||
{
|
{
|
||||||
dprintf("Initializing PS/2 mouse\n");
|
dprintf("Initializing PS/2 mouse\n");
|
||||||
|
|
||||||
// init device driver
|
// init device driver
|
||||||
memset(&md_int, 0, sizeof(mouse_data));
|
memset(&md_int, 0, sizeof(mouse_data));
|
||||||
|
|
||||||
// register interrupt handler
|
// register interrupt handler
|
||||||
int_set_io_interrupt_handler(INT_BASE + INT_PS2_MOUSE,
|
install_io_interrupt_handler(INT_BASE + INT_PS2_MOUSE,
|
||||||
&handle_mouse_interrupt, NULL);
|
&handle_mouse_interrupt, NULL, 0);
|
||||||
|
|
||||||
// must enable the cascade interrupt
|
// must enable the cascade interrupt
|
||||||
arch_int_enable_io_interrupt(INT_BASE + INT_CASCADE);
|
arch_int_enable_io_interrupt(INT_BASE + INT_CASCADE);
|
||||||
|
|
||||||
// enable auxilary device, IRQs and PS/2 mouse
|
// enable auxilary device, IRQs and PS/2 mouse
|
||||||
write_command_byte(PS2_CMD_DEV_INIT);
|
write_command_byte(PS2_CMD_DEV_INIT);
|
||||||
write_aux_byte(PS2_CMD_ENABLE_MOUSE);
|
write_aux_byte(PS2_CMD_ENABLE_MOUSE);
|
||||||
|
|
||||||
// controller should send ACK if mouse was detected
|
// controller should send ACK if mouse was detected
|
||||||
if(read_data_byte() != PS2_RES_ACK) {
|
if(read_data_byte() != PS2_RES_ACK) {
|
||||||
dprintf("No PS/2 mouse found\n");
|
dprintf("No PS/2 mouse found\n");
|
||||||
return -1;
|
return -1;
|
||||||
} // if
|
}
|
||||||
|
|
||||||
dprintf("A PS/2 mouse has been successfully detected\n");
|
dprintf("A PS/2 mouse has been successfully detected\n");
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ status_t init_hardware()
|
|||||||
// the interrupt handler and the read() operation
|
// the interrupt handler and the read() operation
|
||||||
mouse_sem = create_sem(0, "ps2_mouse_sem");
|
mouse_sem = create_sem(0, "ps2_mouse_sem");
|
||||||
if(mouse_sem < 0)
|
if(mouse_sem < 0)
|
||||||
panic("failed to create PS/2 mouse semaphore!\n");
|
panic("failed to create PS/2 mouse semaphore!\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} // mouse_dev_init
|
} // mouse_dev_init
|
||||||
|
|||||||
Reference in New Issue
Block a user