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

Changeset dd28c1a in mainline


Ignore:
Timestamp:
2011-12-09T17:01:16Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
979c5729
Parents:
78aa0ab
Message:

i8042: Less function use global parameter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/i8042/i8042.c

    r78aa0ab rdd28c1a  
    102102static i8042_dev_t device;
    103103
    104 static void wait_ready(void)
    105 {
    106         while (pio_read_8(&device.regs->status) & i8042_INPUT_FULL);
     104static void wait_ready(i8042_dev_t *dev)
     105{
     106        assert(dev);
     107        while (pio_read_8(&dev->regs->status) & i8042_INPUT_FULL);
    107108}
    108109
     
    110111static void i8042_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg);
    111112static int i8042_init(i8042_dev_t *dev);
    112 static void i8042_port_write(int devid, uint8_t data);
     113static void i8042_port_write(i8042_dev_t *dev, int devid, uint8_t data);
    113114
    114115
     
    179180       
    180181        /* Disable kbd and aux */
    181         wait_ready();
     182        wait_ready(dev);
    182183        pio_write_8(&dev->regs->status, i8042_CMD_WRITE_CMDB);
    183         wait_ready();
     184        wait_ready(dev);
    184185        pio_write_8(&dev->regs->data, i8042_KBD_DISABLE | i8042_AUX_DISABLE);
    185186
     
    195196            NAME, inr_a, inr_b);
    196197
    197         wait_ready();
     198        wait_ready(dev);
    198199        pio_write_8(&dev->regs->status, i8042_CMD_WRITE_CMDB);
    199         wait_ready();
     200        wait_ready(dev);
    200201        pio_write_8(&dev->regs->data, i8042_KBD_IE | i8042_KBD_TRANSLATE |
    201202            i8042_AUX_IE);
     
    259260                                printf(NAME ": write %" PRIun " to devid %d\n",
    260261                                    IPC_GET_ARG1(call), dev_id);
    261                                 i8042_port_write(dev_id, IPC_GET_ARG1(call));
     262                                i8042_port_write(&device, dev_id, IPC_GET_ARG1(call));
    262263                                retval = 0;
    263264                                break;
     
    272273}
    273274
    274 void i8042_port_write(int devid, uint8_t data)
    275 {
     275void i8042_port_write(i8042_dev_t *dev, int devid, uint8_t data)
     276{
     277        assert(dev);
    276278        if (devid == DEVID_AUX) {
    277                 wait_ready();
    278                 pio_write_8(&device.regs->status, i8042_CMD_WRITE_AUX);
    279         }
    280         wait_ready();
    281         pio_write_8(&device.regs->data, data);
     279                wait_ready(dev);
     280                pio_write_8(&dev->regs->status, i8042_CMD_WRITE_AUX);
     281        }
     282        wait_ready(dev);
     283        pio_write_8(&dev->regs->data, data);
    282284}
    283285
Note: See TracChangeset for help on using the changeset viewer.