Changeset ece7f78 in mainline for uspace/drv/bus/usb/ohci/root_hub.c
- Timestamp:
- 2011-07-11T09:52:15Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c85804f
- Parents:
- aa81adc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/root_hub.c
raa81adc rece7f78 224 224 * @return Error code. 225 225 */ 226 int rh_init(rh_t *instance, ohci_regs_t *regs) { 227 assert(instance); 226 int rh_init(rh_t *instance, ohci_regs_t *regs) 227 { 228 assert(instance); 229 228 230 instance->registers = regs; 229 231 instance->port_count = 230 232 (instance->registers->rh_desc_a >> RHDA_NDS_SHIFT) & RHDA_NDS_MASK; 231 int opResult = rh_init_descriptors(instance); 232 if (opResult != EOK) { 233 return opResult; 234 } 235 // set port power mode to no-power-switching 233 if (port_count > 15) { 234 usb_log_error("OHCI specification does not allow more than 15" 235 " ports. Max 15 ports will be used"); 236 instance->port_count = 15; 237 } 238 239 int ret = rh_init_descriptors(instance); 240 if (ret != EOK) { 241 return ret; 242 } 243 /* Set port power mode to no-power-switching. */ 236 244 instance->registers->rh_desc_a |= RHDA_NPS_FLAG; 237 245 instance->unfinished_interrupt_transfer = NULL; 238 instance->interrupt_mask_size = (instance->port_count + 8) / 8;239 instance->interrupt_ buffer = malloc(instance->interrupt_mask_size);240 i f (!instance->interrupt_buffer)241 return ENOMEM;246 /* Don't forget the hub status bit and round up */ 247 instance->interrupt_mask_size = (instance->port_count + 1 + 8) / 8; 248 instance->interrupt_buffer[0] = 0; 249 instance->interrupt_buffer[1] = 0; 242 250 243 251 usb_log_info("Root hub (%zu ports) initialized.\n",
Note:
See TracChangeset
for help on using the changeset viewer.