diff options
Diffstat (limited to 'kernel/mouse.c')
| -rw-r--r-- | kernel/mouse.c | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/kernel/mouse.c b/kernel/mouse.c index 610baa8..910f0cf 100644 --- a/kernel/mouse.c +++ b/kernel/mouse.c @@ -19,6 +19,45 @@ static volatile uint8_t mouse_a; uint8_t mouse_read(); +void mouse_wait(uint8_t a_type) //unsigned char +{ + uint32_t _time_out=100000; //unsigned int + if(a_type==0) + { + while(_time_out--) //Data + { + if((x86_inb(0x64) & 1)==1) + { + return; + } + } + return; + } + else + { + while(_time_out--) //Signal + { + if((x86_inb(0x64) & 2)==0) + { + return; + } + } + return; + } +} + +void mouse_write(uint8_t a_write) +{ + //Wait to be able to send a command + mouse_wait(1); + //Tell the mouse we are sending a command + x86_outb(0x64, 0xD4); + //Wait for the final part + mouse_wait(1); + //Finally write + x86_outb(0x60, a_write); +} + int8_t mouse_get_x() { return mouse_x; @@ -97,7 +136,7 @@ void mouse_log() //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%d / %d / %02x ",mouse_x, mouse_y,mouse_byte[2]); - PutFont('X', mouse_x,600-mouse_y, 0xffffff); + //PutFont('X', mouse_x,600-mouse_y, 0xffffff); } //Mouse functions @@ -134,41 +173,3 @@ uint8_t mouse_read() return x86_inb(0x60); } -inline void mouse_write(uint8_t a_write) -{ - //Wait to be able to send a command - mouse_wait(1); - //Tell the mouse we are sending a command - x86_outb(0x64, 0xD4); - //Wait for the final part - mouse_wait(1); - //Finally write - x86_outb(0x60, a_write); -} - -inline void mouse_wait(uint8_t a_type) //unsigned char -{ - uint32_t _time_out=100000; //unsigned int - if(a_type==0) - { - while(_time_out--) //Data - { - if((x86_inb(0x64) & 1)==1) - { - return; - } - } - return; - } - else - { - while(_time_out--) //Signal - { - if((x86_inb(0x64) & 2)==0) - { - return; - } - } - return; - } -} |
