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

Changeset a5c2eb5 in mainline


Ignore:
Timestamp:
2013-02-08T22:30:45Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
c91db2a
Parents:
86a01cc
Message:

uhci: Move function definition to avoid separate declaration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/uhci_rh.c

    r86a01cc ra5c2eb5  
    100100        }};
    101101        batch->error = virthub_base_request(&instance->base, target,
    102             usb_transfer_batch_direction(batch),
    103             (void*)batch->setup_buffer, batch->buffer,
    104             batch->buffer_size, &batch->transfered_size);
     102            usb_transfer_batch_direction(batch), (void*)batch->setup_buffer,
     103            batch->buffer, batch->buffer_size, &batch->transfered_size);
    105104        usb_transfer_batch_finish(batch, NULL);
    106105        usb_transfer_batch_destroy(batch);
     
    375374}
    376375
    377 /** UHCI root hub request handlers */
    378 static const usbvirt_control_request_handler_t control_transfer_handlers[] = {
    379         {
    380                 STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
    381                 .name = "GetDescriptor",
    382                 .callback = virthub_base_get_hub_descriptor,
    383         },
    384         {
    385                 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
    386                 .name = "GetDescriptor",
    387                 .callback = virthub_base_get_hub_descriptor,
    388         },
    389         {
    390                 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),
    391                 .name = "GetHubDescriptor",
    392                 .callback = virthub_base_get_hub_descriptor,
    393         },
    394         {
    395                 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATE),
    396                 .name = "GetBusState",
    397                 .callback = req_get_port_state,
    398         },
    399         {
    400                 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),
    401                 .name = "GetPortStatus",
    402                 .callback = req_get_port_status
    403         },
    404         {
    405                 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),
    406                 .name = "ClearHubFeature",
    407                 /* Hub features are overcurrent and supply good,
    408                  * this request may only clear changes that we never report*/
    409                 .callback = req_nop,
    410         },
    411         {
    412                 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),
    413                 .name = "ClearPortFeature",
    414                 .callback = req_clear_port_feature
    415         },
    416         {
    417                 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_STATUS),
    418                 .name = "GetHubStatus",
    419                 /* UHCI can't report OC condition or,
    420                  * lose power source */
    421                 .callback = virthub_base_get_null_status,
    422         },
    423         {
    424                 CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),
    425                 .name = "GetPortStatus",
    426                 .callback = req_get_port_status
    427         },
    428         {
    429                 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_SET_FEATURE),
    430                 .name = "SetHubFeature",
    431                 /* Hub features are overcurrent and supply good,
    432                  * this request may only set changes that we never report*/
    433                 .callback = req_nop,
    434         },
    435         {
    436                 CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_SET_FEATURE),
    437                 .name = "SetPortFeature",
    438                 .callback = req_set_port_feature
    439         },
    440         {
    441                 .callback = NULL
    442         }
    443 };
    444 
    445 static int req_status_change_handler(usbvirt_device_t *dev,
    446     usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
    447     void *buffer, size_t buffer_size, size_t *actual_size);
    448 
    449 static usbvirt_device_ops_t ops = {
    450         .control = control_transfer_handlers,
    451         .data_in[HUB_STATUS_CHANGE_PIPE] = req_status_change_handler,
    452 };
    453 
    454376/** Status change handler.
    455377 * @param device Virtual hub device
    456  * @param endpoint Enpoint number
     378 * @param endpoint Endpoint number
    457379 * @param tr_type Transfer type
    458380 * @param buffer Response destination
    459  * @param buffer_size BYtes available in buffer
     381 * @param buffer_size Bytes available in buffer
    460382 * @param actual_size Size us the used part of the dest buffer.
    461383 *
    462384 * Produces status mask. Bit 0 indicates hub status change the other bits
    463  * represnet port status change. Endian does not matter as UHCI root hubs
     385 * represent port status change. Endian does not matter as UHCI root hubs
    464386 * only need 1 byte.
    465387 */
     
    470392        uhci_rh_t *hub = virthub_get_data(device);
    471393        assert(hub);
    472        
     394
    473395        if (buffer_size < 1)
    474396                return ESTALL;
     
    491413        return EOK;
    492414}
     415
     416/** UHCI root hub request handlers */
     417static const usbvirt_control_request_handler_t control_transfer_handlers[] = {
     418        {
     419                STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
     420                .name = "GetDescriptor",
     421                .callback = virthub_base_get_hub_descriptor,
     422        },
     423        {
     424                CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
     425                .name = "GetDescriptor",
     426                .callback = virthub_base_get_hub_descriptor,
     427        },
     428        {
     429                CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),
     430                .name = "GetHubDescriptor",
     431                .callback = virthub_base_get_hub_descriptor,
     432        },
     433        {
     434                CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATE),
     435                .name = "GetBusState",
     436                .callback = req_get_port_state,
     437        },
     438        {
     439                CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),
     440                .name = "GetPortStatus",
     441                .callback = req_get_port_status
     442        },
     443        {
     444                CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),
     445                .name = "ClearHubFeature",
     446                /* Hub features are overcurrent and supply good,
     447                 * this request may only clear changes that we never report*/
     448                .callback = req_nop,
     449        },
     450        {
     451                CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),
     452                .name = "ClearPortFeature",
     453                .callback = req_clear_port_feature
     454        },
     455        {
     456                CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_STATUS),
     457                .name = "GetHubStatus",
     458                /* UHCI can't report OC condition or,
     459                 * lose power source */
     460                .callback = virthub_base_get_null_status,
     461        },
     462        {
     463                CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),
     464                .name = "GetPortStatus",
     465                .callback = req_get_port_status
     466        },
     467        {
     468                CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_SET_FEATURE),
     469                .name = "SetHubFeature",
     470                /* Hub features are overcurrent and supply good,
     471                 * this request may only set changes that we never report*/
     472                .callback = req_nop,
     473        },
     474        {
     475                CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_SET_FEATURE),
     476                .name = "SetPortFeature",
     477                .callback = req_set_port_feature
     478        },
     479        {
     480                .callback = NULL
     481        }
     482};
     483
     484static usbvirt_device_ops_t ops = {
     485        .control = control_transfer_handlers,
     486        .data_in[HUB_STATUS_CHANGE_PIPE] = req_status_change_handler,
     487};
Note: See TracChangeset for help on using the changeset viewer.