Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c3bc8a8 in mainline


Ignore:
Timestamp:
2011-07-11T15:47:14Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
5af769c
Parents:
56c6b88
Message:

OHCI: Root hub: Another two functions removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/root_hub.c

    r56c6b88 rc3bc8a8  
    155155
    156156static void create_interrupt_mask_in_instance(rh_t *instance);
    157 
    158 static int get_port_status_request(
    159     rh_t *instance, uint16_t port, usb_transfer_batch_t *request);
    160 
    161 static int get_hub_status_request(
    162     rh_t *instance, usb_transfer_batch_t *request);
    163157
    164158static int get_status_request(
     
    366360/*----------------------------------------------------------------------------*/
    367361/**
    368  * Create answer to port status_request
    369  *
    370  * Copy content of corresponding port status register to answer buffer. The
    371  * format of the port status register and port status data is the same (
    372  * see OHCI root hub and USB hub documentation).
    373  *
    374  * @param instance Root hub instance
    375  * @param port Port number, counted from 1
    376  * @param request Structure containing both request and response information
    377  * @return Error code
    378  */
    379 int get_port_status_request(
    380     rh_t *instance, uint16_t port, usb_transfer_batch_t * request)
    381 {
    382         assert(instance);
    383         assert(request);
    384 
    385         if (port < 1 || port > instance->port_count)
    386                 return EINVAL;
    387 
    388         const uint32_t data = instance->registers->rh_port_status[port - 1];
    389         memcpy(request->data_buffer, &data, 4);
    390         TRANSFER_OK(4);
    391 }
    392 /*----------------------------------------------------------------------------*/
    393 /**
    394  * Create answer to hub status_request.
    395  *
    396  * This copies flags in hub status register into the buffer. The format of the
    397  * status register and status message is the same, according to USB hub
    398  * specification and OHCI root hub specification.
    399  *
    400  * @param instance Root hub instance.
    401  * @param request Structure containing both request and response information.
    402  * @return Error code
    403  */
    404 int get_hub_status_request(
    405     rh_t *instance, usb_transfer_batch_t *request)
    406 {
    407         assert(instance);
    408         assert(request);
    409 
    410         const uint32_t data = instance->registers->rh_status &
    411             (RHS_LPS_FLAG | RHS_LPSC_FLAG | RHS_OCI_FLAG | RHS_OCIC_FLAG);
    412         memcpy(request->data_buffer, &data, 4);
    413         TRANSFER_OK(4);
    414 }
    415 /*----------------------------------------------------------------------------*/
    416 /**
    417362 * Create answer to status request.
    418363 *
     
    431376            (usb_device_request_setup_packet_t*)request->setup_buffer;
    432377
    433         const usb_hub_bm_request_type_t request_type =
    434             request_packet->request_type;
    435 
    436378        if (request->buffer_size < 4) {
    437379                usb_log_error("Buffer too small for get status request.\n");
     
    439381        }
    440382
    441         if (request_type == USB_HUB_REQ_TYPE_GET_HUB_STATUS)
    442                 return get_hub_status_request(instance, request);
    443         if (request_type == USB_HUB_REQ_TYPE_GET_PORT_STATUS)
    444                 return get_port_status_request(instance,
    445                     request_packet->index, request);
     383        if (request_packet->request_type == USB_HUB_REQ_TYPE_GET_HUB_STATUS) {
     384                const uint32_t data = instance->registers->rh_status &
     385                    (RHS_LPS_FLAG | RHS_LPSC_FLAG | RHS_OCI_FLAG | RHS_OCIC_FLAG);
     386                memcpy(request->data_buffer, &data, 4);
     387                TRANSFER_OK(4);
     388        }
     389
     390        if (request_packet->request_type == USB_HUB_REQ_TYPE_GET_PORT_STATUS) {
     391                unsigned port = request_packet->index;
     392                if (port < 1 || port > instance->port_count)
     393                        return EINVAL;
     394
     395                const uint32_t data =
     396                    instance->registers->rh_port_status[port - 1];
     397                memcpy(request->data_buffer, &data, 4);
     398                TRANSFER_OK(4);
     399        }
    446400
    447401        return ENOTSUP;
Note: See TracChangeset for help on using the changeset viewer.