Changeset 56c6b88 in mainline
- Timestamp:
- 2011-07-11T15:39:59Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c3bc8a8
- Parents:
- bb58dc0b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/root_hub.c
rbb58dc0b r56c6b88 174 174 rh_t *instance, uint16_t feature, uint16_t port); 175 175 176 static int request_with_input(177 rh_t *instance, usb_transfer_batch_t *request);178 179 176 static int request_with_output( 180 177 rh_t *instance, usb_transfer_batch_t *request); … … 195 192 request->transfered_size = bytes; \ 196 193 return EOK; \ 197 while (0); 194 } while (0) 198 195 199 196 /** Root hub initialization … … 391 388 const uint32_t data = instance->registers->rh_port_status[port - 1]; 392 389 memcpy(request->data_buffer, &data, 4); 393 request->transfered_size = 4; 394 return EOK; 390 TRANSFER_OK(4); 395 391 } 396 392 /*----------------------------------------------------------------------------*/ … … 415 411 (RHS_LPS_FLAG | RHS_LPSC_FLAG | RHS_OCI_FLAG | RHS_OCIC_FLAG); 416 412 memcpy(request->data_buffer, &data, 4); 417 request->transfered_size = 4; 418 return EOK; 413 TRANSFER_OK(4); 419 414 } 420 415 /*----------------------------------------------------------------------------*/ … … 550 545 size = request->buffer_size; 551 546 } 547 552 548 memcpy(request->data_buffer, result_descriptor, size); 553 request->transfered_size = size; 554 555 return EOK; 549 TRANSFER_OK(size); 556 550 } 557 551 /*----------------------------------------------------------------------------*/ … … 565 559 * @return error code 566 560 */ 567 int port_feature_set_request( 568 rh_t *instance, uint16_t feature, uint16_t port) 561 int port_feature_set_request(rh_t *instance, uint16_t feature, uint16_t port) 569 562 { 570 563 assert(instance); … … 610 603 & (~port_clear_feature_valid_mask)) 611 604 | (1 << feature); 612 613 605 return EOK; 614 606 } 615 607 /*----------------------------------------------------------------------------*/ 616 608 /** 617 * process one of requests that requere output data609 * Process a request that requires output data. 618 610 * 619 611 * Request can be one of USB_DEVREQ_GET_STATUS, USB_DEVREQ_GET_DESCRIPTOR or … … 643 635 return EINVAL; 644 636 request->data_buffer[0] = 1; 645 request->transfered_size = 1; 646 return EOK; 647 } 648 return ENOTSUP; 649 } 650 /*----------------------------------------------------------------------------*/ 651 /** 652 * process one of requests that carry input data 653 * 654 * Request can be one of USB_DEVREQ_SET_DESCRIPTOR or 655 * USB_DEVREQ_SET_CONFIGURATION. 656 * @param instance root hub instance 657 * @param request structure containing both request and response information 658 * @return error code 659 */ 660 int request_with_input(rh_t *instance, usb_transfer_batch_t *request) 661 { 662 assert(instance); 663 assert(request); 664 665 const usb_device_request_setup_packet_t *setup_request = 666 (usb_device_request_setup_packet_t *) request->setup_buffer; 667 request->transfered_size = 0; 668 if (setup_request->request == USB_DEVREQ_SET_CONFIGURATION) { 669 //set and get configuration requests do not have any meaning, 670 //only dummy values are returned 671 return EOK; 672 } 673 /* USB_DEVREQ_SET_DESCRIPTOR is also not supported */ 637 TRANSFER_OK(1); 638 } 674 639 return ENOTSUP; 675 640 } … … 703 668 if (request_type == USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE) { 704 669 usb_log_debug("USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE\n"); 705 /*706 * Chapter 11.16.2 specifies that only C_HUB_LOCAL_POWER and707 * C_HUB_OVER_CURRENT are supported. C_HUB_OVER_CURRENT is represented708 * by OHCI RHS_OCIC_FLAG. C_HUB_LOCAL_POWER is not supported709 * as root hubs do not support local power status feature. (OHCI pg. 127) 710 */670 /* 671 * Chapter 11.16.2 specifies that only C_HUB_LOCAL_POWER and 672 * C_HUB_OVER_CURRENT are supported. C_HUB_OVER_CURRENT is represented 673 * by OHCI RHS_OCIC_FLAG. C_HUB_LOCAL_POWER is not supported 674 * as root hubs do not support local power status feature. 675 * (OHCI pg. 127) */ 711 676 if (setup_request->value == USB_HUB_FEATURE_C_HUB_OVER_CURRENT) { 712 677 instance->registers->rh_status = RHS_OCIC_FLAG; … … 797 762 "additional data\n"); 798 763 return request_without_data(instance, request); 799 case USB_DEVREQ_SET_DESCRIPTOR:800 764 case USB_DEVREQ_SET_CONFIGURATION: 801 765 usb_log_debug2("Processing request with input\n"); 802 return request_with_input(instance, request); 766 /* We don't need to do anything */ 767 TRANSFER_OK(0); 768 case USB_DEVREQ_SET_DESCRIPTOR: /* Not supported by OHCI RH */ 803 769 default: 804 770 usb_log_error("Received unsupported request: %d.\n",
Note:
See TracChangeset
for help on using the changeset viewer.