Changeset 8148ee3a in mainline
- Timestamp:
- 2011-04-12T10:52:05Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a81736d5
- Parents:
- f324635
- Location:
- uspace/drv/ohci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/hc.c
rf324635 r8148ee3a 55 55 assert(hub_fun); 56 56 57 int ret; 58 57 59 usb_address_t hub_address = 58 60 device_keeper_get_free_address(&instance->manager, USB_SPEED_FULL); 61 if (hub_address <= 0) { 62 usb_log_error("Failed to get OHCI root hub address.\n"); 63 return hub_address; 64 } 59 65 instance->rh.address = hub_address; 60 66 usb_device_keeper_bind( 61 67 &instance->manager, hub_address, hub_fun->handle); 62 68 63 endpoint_t *ep = malloc(sizeof(endpoint_t)); 64 assert(ep); 65 int ret = endpoint_init(ep, hub_address, 0, USB_DIRECTION_BOTH, 66 USB_TRANSFER_CONTROL, USB_SPEED_FULL, 64); 67 assert(ret == EOK); 68 ret = usb_endpoint_manager_register_ep(&instance->ep_manager, ep, 0); 69 assert(ret == EOK); 69 ret = usb_endpoint_manager_add_ep(&instance->ep_manager, 70 hub_address, 0, USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL, 71 USB_SPEED_FULL, 64, 0); 72 if (ret != EOK) { 73 usb_log_error("Failed to add OHCI rh endpoint 0.\n"); 74 usb_device_keeper_release(&instance->manager, hub_address); 75 return ret; 76 } 70 77 71 78 char *match_str = NULL; 79 /* DDF needs heap allocated string */ 72 80 ret = asprintf(&match_str, "usb&class=hub"); 73 // ret = (match_str == NULL) ? ret : EOK;74 81 if (ret < 0) { 75 82 usb_log_error( 76 83 "Failed(%d) to create root hub match-id string.\n", ret); 84 usb_device_keeper_release(&instance->manager, hub_address); 77 85 return ret; 78 86 } … … 80 88 ret = ddf_fun_add_match_id(hub_fun, match_str, 100); 81 89 if (ret != EOK) { 82 usb_log_error("Failed add createroot hub match-id.\n");90 usb_log_error("Failed add root hub match-id.\n"); 83 91 } 84 92 return ret; … … 115 123 fibril_mutex_initialize(&instance->guard); 116 124 117 rh_init(&instance->rh, dev,instance->registers);125 rh_init(&instance->rh, instance->registers); 118 126 119 127 if (!interrupts) { -
uspace/drv/ohci/root_hub.c
rf324635 r8148ee3a 205 205 * @return Error code. 206 206 */ 207 int rh_init(rh_t *instance, ddf_dev_t *dev,ohci_regs_t *regs) {207 int rh_init(rh_t *instance, ohci_regs_t *regs) { 208 208 assert(instance); 209 //instance->address = -1;210 209 instance->registers = regs; 211 instance->device = dev;212 210 instance->port_count = 213 211 (instance->registers->rh_desc_a >> RHDA_NDS_SHIFT) & RHDA_NDS_MASK; 214 212 rh_init_descriptors(instance); 215 213 // set port power mode to no-power-switching 216 instance->registers->rh_desc_a = 217 instance->registers->rh_desc_a | (1<<9); 214 instance->registers->rh_desc_a |= RHDA_NPS_FLAG; 218 215 219 216 usb_log_info("OHCI root hub with %d ports.\n", instance->port_count); 220 221 //start generic usb hub driver222 223 /* TODO: implement */224 217 return EOK; 225 218 } -
uspace/drv/ohci/root_hub.h
rf324635 r8148ee3a 50 50 /** usb address of the root hub */ 51 51 usb_address_t address; 52 /** ddf device information */53 ddf_dev_t *device;54 52 /** hub port count */ 55 53 int port_count; … … 58 56 } rh_t; 59 57 60 int rh_init(rh_t *instance, ddf_dev_t *dev,ohci_regs_t *regs);58 int rh_init(rh_t *instance, ohci_regs_t *regs); 61 59 62 60 int rh_request(rh_t *instance, usb_transfer_batch_t *request);
Note:
See TracChangeset
for help on using the changeset viewer.