Changes in uspace/drv/ohci/root_hub.c [7d521e24:e89bb50] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/root_hub.c
r7d521e24 re89bb50 61 61 .vendor_id = 0x16db, 62 62 .product_id = 0x0001, 63 /// \TODO these values migt be different64 63 .str_serial_number = 0, 65 64 .usb_spec_version = 0x110, … … 119 118 static const uint32_t hub_clear_feature_by_writing_one_mask = 120 119 RHS_CLEAR_PORT_POWER; 121 // 1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER;122 120 123 121 /** … … 127 125 RHS_LPSC_FLAG | 128 126 RHS_OCIC_FLAG; 129 //(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT) |130 //(1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER);131 127 132 128 /** … … 135 131 static const uint32_t hub_set_feature_direct_mask = 136 132 RHS_SET_PORT_POWER; 137 //(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT);138 133 139 134 /** … … 160 155 RHPS_PRSC_FLAG; 161 156 162 /*163 164 (1 << USB_HUB_FEATURE_PORT_CONNECTION) |165 (1 << USB_HUB_FEATURE_PORT_SUSPEND) |166 (1 << USB_HUB_FEATURE_PORT_OVER_CURRENT) |167 (1 << USB_HUB_FEATURE_PORT_POWER) |168 (1 << USB_HUB_FEATURE_C_PORT_CONNECTION) |169 (1 << USB_HUB_FEATURE_C_PORT_ENABLE) |170 (1 << USB_HUB_FEATURE_C_PORT_SUSPEND) |171 (1 << USB_HUB_FEATURE_C_PORT_OVER_CURRENT) |172 (1 << USB_HUB_FEATURE_C_PORT_RESET);173 */174 157 //note that USB_HUB_FEATURE_PORT_POWER bit is translated into 175 158 //USB_HUB_FEATURE_PORT_LOW_SPEED for port set feature request … … 179 162 */ 180 163 static const uint32_t port_status_change_mask = RHPS_CHANGE_WC_MASK; 181 /* (1 << USB_HUB_FEATURE_C_PORT_CONNECTION) |182 (1 << USB_HUB_FEATURE_C_PORT_ENABLE) |183 (1 << USB_HUB_FEATURE_C_PORT_OVER_CURRENT) |184 (1 << USB_HUB_FEATURE_C_PORT_RESET) |185 (1 << USB_HUB_FEATURE_C_PORT_SUSPEND);186 */187 164 188 165 static int create_serialized_hub_descriptor(rh_t *instance); … … 420 397 * create answer to port status_request 421 398 * 422 * Copy content of corresponding port status register to answer buffer. 399 * Copy content of corresponding port status register to answer buffer. The 400 * format of the port status register and port status data is the same ( 401 * see OHCI root hub and USB hub documentation). 423 402 * 424 403 * @param instance root hub instance … … 431 410 if (port < 1 || port > instance->port_count) 432 411 return EINVAL; 433 uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;434 412 request->transfered_size = 4; 435 uint32_buffer[0] = instance->registers->rh_port_status[port - 1]; 413 uint32_t data = instance->registers->rh_port_status[port - 1]; 414 memcpy(request->data_buffer,&data,4); 436 415 #if 0 437 416 int i; … … 450 429 * create answer to port status_request 451 430 * 452 * Copy content of hub status register to answer buffer. 431 * This copies flags in hub status register into the buffer. The format of the 432 * status register and status message is the same, according to USB hub 433 * specification and OHCI root hub specification. 453 434 * 454 435 * @param instance root hub instance … … 458 439 static int process_get_hub_status_request(rh_t *instance, 459 440 usb_transfer_batch_t * request) { 460 uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;441 //uint32_t * uint32_buffer = (uint32_t*) request->data_buffer; 461 442 request->transfered_size = 4; 462 443 //bits, 0,1,16,17 463 444 uint32_t mask = 1 | (1 << 1) | (1 << 16) | (1 << 17); 464 uint32_buffer[0] = mask & instance->registers->rh_status; 445 uint32_t data = mask & instance->registers->rh_status; 446 //uint32_buffer[0] = mask & instance->registers->rh_status; 447 memcpy(request->data_buffer,&data,4); 465 448 466 449 return EOK; … … 516 499 | (1 << (USB_HUB_FEATURE_C_HUB_OVER_CURRENT + 16)); 517 500 bzero(bitmap, instance->interrupt_mask_size); 518 if ( instance->registers->rh_status & mask) {501 if ((instance->registers->rh_status & mask) !=0 ) { 519 502 bitmap[0] = 1; 520 503 } … … 522 505 mask = port_status_change_mask; 523 506 for (port = 1; port <= instance->port_count; ++port) { 524 if ( mask & instance->registers->rh_port_status[port - 1]) {507 if ((mask & instance->registers->rh_port_status[port - 1]) != 0) { 525 508 526 509 bitmap[(port) / 8] += 1 << (port % 8);
Note:
See TracChangeset
for help on using the changeset viewer.