Changeset ece7f78 in mainline
- 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
- Location:
- uspace/drv/bus/usb/ohci
- Files:
-
- 2 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", -
uspace/drv/bus/usb/ohci/root_hub.h
raa81adc rece7f78 57 57 /** pre-allocated interrupt mask 58 58 * 59 * This is allocated when initializing instance, so that memory 60 * allocation is not needed when processing request. Buffer is used for 61 * interrupt bitmask. 59 * OHCI support max 15 ports (specs page 124) + one global bit, it 60 * gives max 2 bytes. 62 61 */ 63 uint8_t * interrupt_buffer;62 uint8_t interrupt_buffer[2]; 64 63 /** size of interrupt buffer */ 65 64 size_t interrupt_mask_size;
Note:
See TracChangeset
for help on using the changeset viewer.