Changes in uspace/drv/ohci/root_hub.c [7d521e24:b2387c2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/root_hub.c
r7d521e24 rb2387c2 57 57 .device_version = 0, 58 58 .length = sizeof (usb_standard_device_descriptor_t), 59 /// \TODO this value is guessed60 59 .max_packet_size = 8, 61 60 .vendor_id = 0x16db, 62 61 .product_id = 0x0001, 63 /// \TODO these values migt be different64 62 .str_serial_number = 0, 65 63 .usb_spec_version = 0x110, … … 118 116 */ 119 117 static const uint32_t hub_clear_feature_by_writing_one_mask = 120 RHS_CLEAR_PORT_POWER; 121 // 1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER; 118 RHS_CLEAR_PORT_POWER; 122 119 123 120 /** … … 127 124 RHS_LPSC_FLAG | 128 125 RHS_OCIC_FLAG; 129 //(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT) |130 //(1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER);131 126 132 127 /** … … 135 130 static const uint32_t hub_set_feature_direct_mask = 136 131 RHS_SET_PORT_POWER; 137 //(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT);138 132 139 133 /** … … 160 154 RHPS_PRSC_FLAG; 161 155 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 156 //note that USB_HUB_FEATURE_PORT_POWER bit is translated into 175 157 //USB_HUB_FEATURE_PORT_LOW_SPEED for port set feature request … … 179 161 */ 180 162 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 163 188 164 static int create_serialized_hub_descriptor(rh_t *instance); … … 420 396 * create answer to port status_request 421 397 * 422 * Copy content of corresponding port status register to answer buffer. 398 * Copy content of corresponding port status register to answer buffer. The 399 * format of the port status register and port status data is the same ( 400 * see OHCI root hub and USB hub documentation). 423 401 * 424 402 * @param instance root hub instance … … 431 409 if (port < 1 || port > instance->port_count) 432 410 return EINVAL; 433 uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;434 411 request->transfered_size = 4; 435 uint32_buffer[0] = instance->registers->rh_port_status[port - 1]; 412 uint32_t data = instance->registers->rh_port_status[port - 1]; 413 memcpy(request->data_buffer, &data, 4); 436 414 #if 0 437 415 int i; … … 450 428 * create answer to port status_request 451 429 * 452 * Copy content of hub status register to answer buffer. 430 * This copies flags in hub status register into the buffer. The format of the 431 * status register and status message is the same, according to USB hub 432 * specification and OHCI root hub specification. 453 433 * 454 434 * @param instance root hub instance … … 458 438 static int process_get_hub_status_request(rh_t *instance, 459 439 usb_transfer_batch_t * request) { 460 uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;440 //uint32_t * uint32_buffer = (uint32_t*) request->data_buffer; 461 441 request->transfered_size = 4; 462 442 //bits, 0,1,16,17 463 443 uint32_t mask = 1 | (1 << 1) | (1 << 16) | (1 << 17); 464 uint32_buffer[0] = mask & instance->registers->rh_status; 444 uint32_t data = mask & instance->registers->rh_status; 445 //uint32_buffer[0] = mask & instance->registers->rh_status; 446 memcpy(request->data_buffer, &data, 4); 465 447 466 448 return EOK; … … 485 467 486 468 usb_hub_bm_request_type_t request_type = request_packet->request_type; 487 if (buffer_size < 4 /*request_packet->length*/) {///\TODO469 if (buffer_size < 4) { 488 470 usb_log_warning("requested more data than buffer size\n"); 489 471 return EINVAL; … … 516 498 | (1 << (USB_HUB_FEATURE_C_HUB_OVER_CURRENT + 16)); 517 499 bzero(bitmap, instance->interrupt_mask_size); 518 if ( instance->registers->rh_status & mask) {500 if ((instance->registers->rh_status & mask) != 0) { 519 501 bitmap[0] = 1; 520 502 } … … 522 504 mask = port_status_change_mask; 523 505 for (port = 1; port <= instance->port_count; ++port) { 524 if ( mask & instance->registers->rh_port_status[port - 1]) {506 if ((mask & instance->registers->rh_port_status[port - 1]) != 0) { 525 507 526 508 bitmap[(port) / 8] += 1 << (port % 8); … … 695 677 (instance->registers->rh_port_status[port - 1] | (1 << feature)) 696 678 & (~port_clear_feature_valid_mask); 697 /// \TODO any error?698 699 679 return EOK; 700 680 } … … 724 704 & (~port_clear_feature_valid_mask)) 725 705 | (1 << feature); 726 /// \TODO any error?727 706 728 707 return EOK; … … 942 921 * @return 943 922 */ 944 static int process_interrupt_mask_in_instance(rh_t *instance, usb_transfer_batch_t * request) { 923 static int process_interrupt_mask_in_instance(rh_t *instance, 924 usb_transfer_batch_t * request) { 945 925 memcpy(request->data_buffer, instance->interrupt_buffer, 946 926 instance->interrupt_mask_size); … … 962 942 * @return 963 943 */ 964 static bool is_zeros(void * 944 static bool is_zeros(void *buffer, size_t size) { 965 945 if (!buffer) return true; 966 946 if (!size) return true;
Note:
See TracChangeset
for help on using the changeset viewer.