Changes in uspace/drv/char/i8042/i8042.c [7de1988c:1ae74c6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/i8042/i8042.c
r7de1988c r1ae74c6 64 64 #define i8042_KBD_TRANSLATE 0x40 /* Use this to switch to XT scancodes */ 65 65 66 #define CHECK_RET_DESTROY(ret, msg...) \ 67 do { \ 68 if (ret != EOK) { \ 69 ddf_msg(LVL_ERROR, msg); \ 70 if (dev->kbd_fun) { \ 71 dev->kbd_fun->driver_data = NULL; \ 72 ddf_fun_destroy(dev->kbd_fun); \ 73 } \ 74 if (dev->aux_fun) { \ 75 dev->aux_fun->driver_data = NULL; \ 76 ddf_fun_destroy(dev->aux_fun); \ 77 } \ 78 } \ 79 } while (0) 80 81 #define CHECK_RET_UNBIND_DESTROY(ret, msg...) \ 82 do { \ 83 if (ret != EOK) { \ 84 ddf_msg(LVL_ERROR, msg); \ 85 if (dev->kbd_fun) { \ 86 ddf_fun_unbind(dev->kbd_fun); \ 87 dev->kbd_fun->driver_data = NULL; \ 88 ddf_fun_destroy(dev->kbd_fun); \ 89 } \ 90 if (dev->aux_fun) { \ 91 ddf_fun_unbind(dev->aux_fun); \ 92 dev->aux_fun->driver_data = NULL; \ 93 ddf_fun_destroy(dev->aux_fun); \ 94 } \ 95 } \ 96 } while (0) 97 66 98 void default_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *); 67 99 … … 145 177 * 146 178 * @param dev Driver structure to initialize. 147 * @param regs I/O range of registers. 179 * @param regs I/O address of registers. 180 * @param reg_size size of the reserved I/O address space. 148 181 * @param irq_kbd IRQ for primary port. 149 182 * @param irq_mouse IRQ for aux port. … … 153 186 * 154 187 */ 155 int i8042_init(i8042_t *dev, addr_range_t *regs, int irq_kbd,188 int i8042_init(i8042_t *dev, void *regs, size_t reg_size, int irq_kbd, 156 189 int irq_mouse, ddf_dev_t *ddf_dev) 157 190 { … … 161 194 const size_t cmd_count = sizeof(i8042_cmds) / sizeof(irq_cmd_t); 162 195 irq_cmd_t cmds[cmd_count]; 163 i8042_regs_t *ar;164 196 165 197 int rc; … … 170 202 dev->aux_fun = NULL; 171 203 172 if (reg s->size < sizeof(i8042_regs_t)) {204 if (reg_size < sizeof(i8042_regs_t)) { 173 205 rc = EINVAL; 174 206 goto error; 175 207 } 176 208 177 if (pio_enable _range(regs, (void **) &dev->regs) != 0) {209 if (pio_enable(regs, sizeof(i8042_regs_t), (void **) &dev->regs) != 0) { 178 210 rc = EIO; 179 211 goto error; … … 234 266 235 267 memcpy(ranges, i8042_ranges, sizeof(i8042_ranges)); 236 ranges[0].base = RNGABS(*regs); 237 238 239 ar = RNGABSPTR(*regs); 268 ranges[0].base = (uintptr_t) regs; 269 240 270 memcpy(cmds, i8042_cmds, sizeof(i8042_cmds)); 241 cmds[0].addr = (void *) & ar->status;242 cmds[3].addr = (void *) & ar->data;271 cmds[0].addr = (void *) &(((i8042_regs_t *) regs)->status); 272 cmds[3].addr = (void *) &(((i8042_regs_t *) regs)->data); 243 273 244 274 irq_code_t irq_code = {
Note:
See TracChangeset
for help on using the changeset viewer.