Changes in uspace/drv/char/i8042/i8042.c [1ae74c6:7de1988c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/i8042/i8042.c
r1ae74c6 r7de1988c 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 98 66 void default_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *); 99 67 … … 177 145 * 178 146 * @param dev Driver structure to initialize. 179 * @param regs I/O address of registers. 180 * @param reg_size size of the reserved I/O address space. 147 * @param regs I/O range of registers. 181 148 * @param irq_kbd IRQ for primary port. 182 149 * @param irq_mouse IRQ for aux port. … … 186 153 * 187 154 */ 188 int i8042_init(i8042_t *dev, void *regs, size_t reg_size, int irq_kbd,155 int i8042_init(i8042_t *dev, addr_range_t *regs, int irq_kbd, 189 156 int irq_mouse, ddf_dev_t *ddf_dev) 190 157 { … … 194 161 const size_t cmd_count = sizeof(i8042_cmds) / sizeof(irq_cmd_t); 195 162 irq_cmd_t cmds[cmd_count]; 163 i8042_regs_t *ar; 196 164 197 165 int rc; … … 202 170 dev->aux_fun = NULL; 203 171 204 if (reg _size < sizeof(i8042_regs_t)) {172 if (regs->size < sizeof(i8042_regs_t)) { 205 173 rc = EINVAL; 206 174 goto error; 207 175 } 208 176 209 if (pio_enable (regs, sizeof(i8042_regs_t), (void **) &dev->regs) != 0) {177 if (pio_enable_range(regs, (void **) &dev->regs) != 0) { 210 178 rc = EIO; 211 179 goto error; … … 266 234 267 235 memcpy(ranges, i8042_ranges, sizeof(i8042_ranges)); 268 ranges[0].base = (uintptr_t) regs; 269 236 ranges[0].base = RNGABS(*regs); 237 238 239 ar = RNGABSPTR(*regs); 270 240 memcpy(cmds, i8042_cmds, sizeof(i8042_cmds)); 271 cmds[0].addr = (void *) & (((i8042_regs_t *) regs)->status);272 cmds[3].addr = (void *) & (((i8042_regs_t *) regs)->data);241 cmds[0].addr = (void *) &ar->status; 242 cmds[3].addr = (void *) &ar->data; 273 243 274 244 irq_code_t irq_code = {
Note:
See TracChangeset
for help on using the changeset viewer.