Changeset f51587f5 in mainline
- Timestamp:
- 2012-12-16T17:17:37Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 395bb79
- Parents:
- 8de2cca
- Location:
- uspace/drv/bus/usb/ohci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.c
r8de2cca rf51587f5 88 88 static int hc_init_memory(hc_t *instance); 89 89 static int interrupt_emulator(hc_t *instance); 90 static int hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);91 90 92 91 /** Get number of PIO ranges used in IRQ code. … … 161 160 162 161 list_initialize(&instance->pending_batches); 163 164 hcd_init(&instance->generic, USB_SPEED_FULL,165 BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11);166 instance->generic.private_data = instance;167 instance->generic.schedule = hc_schedule;168 instance->generic.ep_add_hook = ohci_endpoint_init;169 instance->generic.ep_remove_hook = ohci_endpoint_fini;170 162 171 163 ret = hc_init_memory(instance); -
uspace/drv/bus/usb/ohci/hc.h
r8de2cca rf51587f5 89 89 void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep); 90 90 void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep); 91 int hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch); 91 92 92 93 void hc_interrupt(hc_t *instance, uint32_t status); -
uspace/drv/bus/usb/ohci/ohci.c
r8de2cca rf51587f5 56 56 } 57 57 58 static inline hcd_t *dev_to_hcd(ddf_dev_t *dev) 59 { 60 ohci_t *ohci = dev_to_ohci(dev); 61 if (!ohci || !ohci->hc_fun) { 62 usb_log_error("Invalid OHCI device.\n"); 63 return NULL; 64 } 65 return ddf_fun_data_get(ohci->hc_fun); 66 } 67 68 static inline hc_t * dev_to_hc(ddf_dev_t *dev) 69 { 70 hcd_t *hcd = dev_to_hcd(dev); 71 if (!hcd) { 72 usb_log_error("Invalid OHCI HCD"); 73 return NULL; 74 } 75 return hcd->private_data; 76 } 77 58 78 /** IRQ handling callback, identifies device 59 79 * … … 65 85 { 66 86 assert(dev); 67 68 ohci_t *ohci = dev_to_ohci(dev); 69 if (!ohci) { 87 hc_t *hc = dev_to_hc(dev); 88 if (!hc) { 70 89 usb_log_warning("Interrupt on device that is not ready.\n"); 71 90 return; 72 91 } 73 hc_t *hc = ddf_fun_data_get(ohci->hc_fun);74 assert(hc);75 92 76 93 const uint16_t status = IPC_GET_ARG1(*call); … … 89 106 90 107 if (address != NULL) { 91 hc_t *hc = 92 ddf_fun_data_get(dev_to_ohci(ddf_fun_get_dev(fun))->hc_fun); 108 hc_t *hc = dev_to_hc(ddf_fun_get_dev(fun)); 93 109 assert(hc); 94 110 *address = hc->rh.address; … … 176 192 "Failed to allocate HCD structure: %s.\n", str_error(ret)); 177 193 194 hcd_init(&hc->generic, USB_SPEED_FULL, 195 BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11); 196 178 197 instance->rh_fun = ddf_fun_create(device, fun_inner, "ohci_rh"); 179 198 ret = instance->rh_fun ? EOK : ENOMEM; … … 232 251 "Failed to init ohci_hcd: %s.\n", str_error(ret)); 233 252 253 hcd_set_implementation(&hc->generic, hc, hc_schedule, 254 ohci_endpoint_init, ohci_endpoint_fini); 255 234 256 #define CHECK_RET_FINI_RETURN(ret, message...) \ 235 257 if (ret != EOK) { \
Note:
See TracChangeset
for help on using the changeset viewer.