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