Changeset 1ecc5de in mainline
- Timestamp:
- 2011-07-10T20:43:22Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2e8a01b
- Parents:
- 2bc7122
- Location:
- uspace/drv/bus/usb/ohci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.c
r2bc7122 r1ecc5de 46 46 #define OHCI_USED_INTERRUPTS \ 47 47 (I_SO | I_WDH | I_UE | I_RHSC) 48 49 static const irq_cmd_t ohci_irq_commands[] = 50 { 51 { .cmd = CMD_MEM_READ_32, .dstarg = 1, .addr = NULL /*filled later*/ }, 52 { .cmd = CMD_BTEST, .srcarg = 1, .dstarg = 2, .value = OHCI_USED_INTERRUPTS }, 53 { .cmd = CMD_PREDICATE, .srcarg = 2, .value = 2 }, 54 { .cmd = CMD_MEM_WRITE_A_32, .srcarg = 1, .addr = NULL /*filled later*/ }, 55 { .cmd = CMD_ACCEPT }, 56 }; 57 48 58 static int interrupt_emulator(hc_t *instance); 49 59 static void hc_gain_control(hc_t *instance); … … 150 160 } 151 161 /*----------------------------------------------------------------------------*/ 152 /** Create end register endpoint structures 162 size_t hc_irq_cmd_count(void) 163 { 164 return sizeof(ohci_irq_commands) / sizeof(irq_cmd_t); 165 } 166 /*----------------------------------------------------------------------------*/ 167 int hc_get_irq_commands( 168 irq_cmd_t cmds[], size_t cmd_size, uintptr_t regs, size_t reg_size) 169 { 170 if (cmd_size < sizeof(ohci_irq_commands) 171 || reg_size < sizeof(ohci_regs_t)) 172 return EOVERFLOW; 173 174 /* Create register mapping to use in IRQ handler 175 * this mapping should be present in kernel only. 176 * Remove it from here when kernel knows how to create mappings 177 * and accepts physical addresses in IRQ code. 178 * TODO: remove */ 179 void *registers; 180 const int ret = pio_enable((void*)regs, reg_size, ®isters); 181 182 if (ret != EOK) 183 return ret; 184 185 memcpy(cmds, ohci_irq_commands, sizeof(ohci_irq_commands)); 186 187 void *address = (void*)&(((ohci_regs_t*)registers)->interrupt_status); 188 cmds[0].addr = address; 189 cmds[3].addr = address; 190 return EOK; 191 } 192 /*----------------------------------------------------------------------------*/ 193 /** Create and register endpoint structures 153 194 * 154 195 * @param[in] instance OHCI driver structure. … … 621 662 return EOK; 622 663 } 664 623 665 /** 624 666 * @} -
uspace/drv/bus/usb/ohci/hc.h
r2bc7122 r1ecc5de 86 86 } hc_t; 87 87 88 int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun); 88 size_t hc_irq_cmd_count(void); 89 int hc_get_irq_commands( 90 irq_cmd_t cmds[], size_t cmd_size, uintptr_t regs, size_t reg_size); 89 91 int hc_init(hc_t *instance, uintptr_t regs, size_t reg_size, bool interrupts); 90 92 void hc_start_hw(hc_t *instance); 93 int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun); 91 94 92 95 /** Safely dispose host controller internal structures -
uspace/drv/bus/usb/ohci/ohci.c
r2bc7122 r1ecc5de 58 58 { 59 59 assert(dev); 60 assert(dev->driver_data);61 60 return dev->driver_data; 62 61 } 63 64 62 /** IRQ handling callback, identifies device 65 63 * … … 71 69 { 72 70 hc_t *hc = &dev_to_ohci(dev)->hc; 73 assert(hc); 71 if (!hc) { 72 usb_log_warning("IRQ on device that is not ready.\n"); 73 return; 74 } 74 75 const uint16_t status = IPC_GET_ARG1(*call); 75 76 hc_interrupt(hc, status);
Note:
See TracChangeset
for help on using the changeset viewer.