Changeset 00694c5 in mainline
- Timestamp:
- 2011-07-11T16:48:43Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b21dfba
- Parents:
- 5af769c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/root_hub.c
r5af769c r00694c5 58 58 .device_version = 0, 59 59 .length = sizeof (usb_standard_device_descriptor_t), 60 .max_packet_size = 8,60 .max_packet_size = 64, 61 61 .vendor_id = 0x16db, 62 62 .product_id = 0x0001, … … 101 101 .descriptor_type = USB_DESCTYPE_ENDPOINT, 102 102 .endpoint_address = 1 + (1 << 7), 103 .length = sizeof 104 .max_packet_size = 8,103 .length = sizeof(usb_standard_endpoint_descriptor_t), 104 .max_packet_size = 2, 105 105 .poll_interval = 255, 106 106 }; 107 108 /**109 * bitmask of hub features that are valid to be set110 */111 static const uint32_t hub_set_feature_valid_mask =112 RHS_LPSC_FLAG |113 RHS_OCIC_FLAG;114 115 /**116 * bitmask of hub features that are set by writing 1 and cleared by writing 0117 */118 static const uint32_t hub_set_feature_direct_mask =119 RHS_SET_PORT_POWER;120 107 121 108 /** … … 145 132 //USB_HUB_FEATURE_PORT_LOW_SPEED for port set feature request 146 133 147 /**148 * bitmask with port status changes149 */150 static const uint32_t port_status_change_mask = RHPS_CHANGE_WC_MASK;151 152 134 static void create_serialized_hub_descriptor(rh_t *instance); 153 154 135 static void rh_init_descriptors(rh_t *instance); 155 156 136 static void create_interrupt_mask_in_instance(rh_t *instance); 157 158 static int get_status_request( 159 rh_t *instance, usb_transfer_batch_t *request); 160 137 static int get_status_request(rh_t *instance, usb_transfer_batch_t *request); 161 138 static int get_descriptor_request( 162 139 rh_t *instance, usb_transfer_batch_t *request); 163 164 140 static int port_feature_set_request( 165 141 rh_t *instance, uint16_t feature, uint16_t port); 166 167 142 static int port_feature_clear_request( 168 143 rh_t *instance, uint16_t feature, uint16_t port); 169 170 static int request_with_output( 144 static int request_with_output(rh_t *instance, usb_transfer_batch_t *request); 145 static int request_without_data(rh_t *instance, usb_transfer_batch_t *request); 146 static int ctrl_request(rh_t *instance, usb_transfer_batch_t *request); 147 static void interrupt_mask_in_instance( 171 148 rh_t *instance, usb_transfer_batch_t *request); 172 173 static int request_without_data(174 rh_t *instance, usb_transfer_batch_t *request);175 176 static int ctrl_request(rh_t *instance, usb_transfer_batch_t *request);177 178 static int interrupt_mask_in_instance(179 rh_t *instance, usb_transfer_batch_t *request);180 181 149 static bool is_zeros(const void *buffer, size_t size); 182 150 … … 381 349 } 382 350 351 /* Hub status: just filter relevant info from rh_status reg */ 383 352 if (request_packet->request_type == USB_HUB_REQ_TYPE_GET_HUB_STATUS) { 384 353 const uint32_t data = instance->registers->rh_status & … … 388 357 } 389 358 359 /* Copy appropriate rh_port_status register, OHCI designers were 360 * kind enough to make those bit values match USB specification */ 390 361 if (request_packet->request_type == USB_HUB_REQ_TYPE_GET_PORT_STATUS) { 391 unsigned port = request_packet->index;362 const unsigned port = request_packet->index; 392 363 if (port < 1 || port > instance->port_count) 393 364 return EINVAL; … … 417 388 418 389 uint8_t * bitmap = instance->interrupt_buffer; 419 uint32_t mask = (1 << (USB_HUB_FEATURE_C_HUB_LOCAL_POWER + 16))420 | (1 << (USB_HUB_FEATURE_C_HUB_OVER_CURRENT + 16));421 390 bzero(bitmap, instance->interrupt_mask_size); 422 if ((instance->registers->rh_status & mask) != 0) { 391 /* Only local power source change and over-current change can happen */ 392 if (instance->registers->rh_status & (RHS_LPSC_FLAG | RHS_OCIC_FLAG)) { 423 393 bitmap[0] = 1; 424 394 } 425 mask = port_status_change_mask;426 395 size_t port = 1; 427 396 for (; port <= instance->port_count; ++port) { 428 if ((mask & instance->registers->rh_port_status[port - 1]) != 0) { 429 430 bitmap[(port) / 8] += 1 << (port % 8); 397 /* Write-clean bits are those that indicate change */ 398 if (RHPS_CHANGE_WC_MASK 399 & instance->registers->rh_port_status[port - 1]) { 400 401 bitmap[(port) / 8] |= 1 << (port % 8); 431 402 } 432 403 } … … 731 702 /*----------------------------------------------------------------------------*/ 732 703 /** 733 * process hanging interrupt request704 * Process waiting interrupt request 734 705 * 735 706 * If an interrupt transfer has been received and there was no change, … … 743 714 * @return 744 715 */ 745 int interrupt_mask_in_instance( 746 rh_t *instance, usb_transfer_batch_t *request) 716 void interrupt_mask_in_instance(rh_t *instance, usb_transfer_batch_t *request) 747 717 { 748 718 assert(instance); … … 754 724 instance->unfinished_interrupt_transfer = NULL; 755 725 usb_transfer_batch_finish_error(request, EOK); 756 757 return EOK;758 726 } 759 727 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.