Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 89c09ae in mainline


Ignore:
Timestamp:
2010-03-16T21:35:37Z (12 years ago)
Author:
U-GONZALES\root <root@…>
Branches:
lfn, master
Children:
7b76744
Parents:
6e81d04
Message:

Improvements to i8042/char_mouse. This fixes ticket #208.

Location:
uspace/srv
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/char_mouse/chardev.c

    r6e81d04 r89c09ae  
    4848static int dev_phone;
    4949
    50 #define NAME "kbd"
     50#define NAME "char_mouse"
    5151
    5252int mouse_port_init(void)
  • uspace/srv/hid/char_mouse/proto/ps2.c

    r6e81d04 r89c09ae  
    3636
    3737#include <stdio.h>
     38#include <mouse_port.h>
     39#include <char_mouse.h>
    3840#include <mouse_proto.h>
    39 #include <char_mouse.h>
    4041
    4142#define BUFSIZE 3
     43
     44#define PS2_MOUSE_OUT_INIT  0xf4
     45#define PS2_MOUSE_ACK       0xfa
    4246
    4347typedef struct {
     
    6771int mouse_proto_init(void)
    6872{
     73        mouse_port_write(PS2_MOUSE_OUT_INIT);
    6974        return 0;
    7075}
  • uspace/srv/hw/char/i8042/i8042.c

    r6e81d04 r89c09ae  
    6868#define i8042_KBD_TRANSLATE     0x40
    6969
    70 /* Mouse constants */
    71 #define MOUSE_OUT_INIT  0xf4
    72 #define MOUSE_ACK       0xfa
    7370
    7471enum {
     
    177174        async_set_interrupt_received(i8042_irq_handler);
    178175
    179         /* Disable kbd, enable mouse */
     176        /* Disable kbd and aux */
     177        wait_ready();
    180178        pio_write_8(&i8042->status, i8042_CMD_WRITE_CMDB);
    181179        wait_ready();
    182         pio_write_8(&i8042->status, i8042_CMD_WRITE_CMDB);
    183         wait_ready();
    184         pio_write_8(&i8042->data, i8042_KBD_DISABLE);
    185         wait_ready();
     180        pio_write_8(&i8042->data, i8042_KBD_DISABLE | i8042_AUX_DISABLE);
    186181
    187182        /* Flush all current IO */
    188183        while (pio_read_8(&i8042->status) & i8042_OUTPUT_FULL)
    189184                (void) pio_read_8(&i8042->data);
    190 
    191         i8042_port_write(DEVID_AUX, MOUSE_OUT_INIT);
    192185
    193186        i8042_kbd.cmds[0].addr = (void *) &((i8042_t *) i8042_kernel)->status;
     
    195188        ipc_register_irq(sysinfo_value("i8042.inr_a"), device_assign_devno(), 0, &i8042_kbd);
    196189        ipc_register_irq(sysinfo_value("i8042.inr_b"), device_assign_devno(), 0, &i8042_kbd);
    197 
     190        printf("i8042: registered for interrupts %d and %d\n",
     191            sysinfo_value("i8042.inr_a"), sysinfo_value("i8042.inr_b"));
     192
     193        wait_ready();
    198194        pio_write_8(&i8042->status, i8042_CMD_WRITE_CMDB);
    199195        wait_ready();
    200196        pio_write_8(&i8042->data, i8042_KBD_IE | i8042_KBD_TRANSLATE |
    201197            i8042_AUX_IE);
    202         wait_ready();
    203198
    204199        return 0;
     
    271266{
    272267        if (devid == DEVID_AUX) {
     268                wait_ready();
    273269                pio_write_8(&i8042->status, i8042_CMD_WRITE_AUX);
    274                 wait_ready();
    275         }
     270        }
     271        wait_ready();
    276272        pio_write_8(&i8042->data, data);
    277         wait_ready();
    278273}
    279274
Note: See TracChangeset for help on using the changeset viewer.