Changeset 7de1988c in mainline for uspace/drv/char/i8042/main.c


Ignore:
Timestamp:
2013-09-12T20:53:09Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ddd0499d
Parents:
8049b79
Message:

Adapt drivers using parsed HW resources to use the new interface.

File:
1 edited

Legend:

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

    r8049b79 r7de1988c  
    4949 *
    5050 * @param[in]  dev            Device asking for the addresses.
    51  * @param[out] io_reg_address Base address of the memory range.
    52  * @param[out] io_reg_size    Size of the memory range.
     51 * @param[out] p_io_reg       Pointer to register range.
    5352 * @param[out] kbd_irq        Primary port IRQ.
    5453 * @param[out] mouse_irq      Auxiliary port IRQ.
     
    5756 *
    5857 */
    59 static int get_my_registers(ddf_dev_t *dev, uintptr_t *io_reg_address,
    60     size_t *io_reg_size, int *kbd_irq, int *mouse_irq)
     58static int get_my_registers(ddf_dev_t *dev, addr_range_t *p_io_reg,
     59    int *kbd_irq, int *mouse_irq)
    6160{
    6261        assert(dev);
     
    7978        }
    8079       
    81         if (io_reg_address)
    82                 *io_reg_address = hw_resources.io_ranges.ranges[0].address;
    83        
    84         if (io_reg_size)
    85                 *io_reg_size = hw_resources.io_ranges.ranges[0].size;
     80        if (p_io_reg)
     81                *p_io_reg = hw_resources.io_ranges.ranges[0];
    8682       
    8783        if (kbd_irq)
     
    104100static int i8042_dev_add(ddf_dev_t *device)
    105101{
    106         uintptr_t io_regs = 0;
    107         size_t io_size = 0;
     102        addr_range_t io_regs;
    108103        int kbd = 0;
    109104        int mouse = 0;
     
    113108                return EINVAL;
    114109       
    115         rc = get_my_registers(device, &io_regs, &io_size, &kbd, &mouse);
     110        rc = get_my_registers(device, &io_regs, &kbd, &mouse);
    116111        if (rc != EOK) {
    117112                ddf_msg(LVL_ERROR, "Failed to get registers: %s.",
     
    120115        }
    121116       
    122         ddf_msg(LVL_DEBUG, "I/O regs at %p (size %zuB), IRQ kbd %d, IRQ mouse %d.",
    123             (void *) io_regs, io_size, kbd, mouse);
     117        ddf_msg(LVL_DEBUG,
     118            "I/O regs at %p (size %zuB), IRQ kbd %d, IRQ mouse %d.",
     119            RNGABSPTR(io_regs), RNGSZ(io_regs), kbd, mouse);
    124120       
    125121        i8042_t *i8042 = ddf_dev_data_alloc(device, sizeof(i8042_t));
     
    129125        }
    130126       
    131         rc = i8042_init(i8042, (void *) io_regs, io_size, kbd, mouse, device);
     127        rc = i8042_init(i8042, &io_regs, kbd, mouse, device);
    132128        if (rc != EOK) {
    133129                ddf_msg(LVL_ERROR, "Failed to initialize i8042 driver: %s.",
Note: See TracChangeset for help on using the changeset viewer.