Changeset ca07cd3 in mainline for uspace/lib/usbvirt/stdreq.c


Ignore:
Timestamp:
2010-10-25T13:23:33Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
23cb44b
Parents:
355f7c2
Message:

Code cleanup, various bugfixes

The internal functions of virtual device framework always get
device structure as parameter, thus possible enabling more devices
within single task (that is not possible because currently there
is no way to pass extra argument into callback_connection()).

Also, added some missing comments and completely removed the device
id nonsense (devices can send their descriptors and the hub is able
to enable/disable its ports).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbvirt/stdreq.c

    r355f7c2 rca07cd3  
    4949 */
    5050 
    51 static int handle_get_descriptor(uint8_t type, uint8_t index, uint16_t language,
     51/** GET_DESCRIPTOR handler. */
     52static int handle_get_descriptor(usbvirt_device_t *device,
     53    uint8_t type, uint8_t index, uint16_t language,
    5254    uint16_t length)
    5355{
     
    106108}
    107109
    108 static int handle_set_address(uint16_t new_address,
     110/** SET_ADDRESS handler. */
     111static int handle_set_address(usbvirt_device_t *device,
     112    uint16_t new_address,
    109113    uint16_t zero1, uint16_t zero2)
    110114{
     
    117121        }
    118122       
    119         dev_new_address = new_address;
     123        device->new_address = new_address;
    120124       
    121125        return EOK;
    122126}
    123127
    124 static int handle_set_configuration(uint16_t configuration_value,
     128/** SET_CONFIGURATION handler. */
     129static int handle_set_configuration(usbvirt_device_t *device,
     130    uint16_t configuration_value,
    125131    uint16_t zero1, uint16_t zero2)
    126132{
     
    177183        } while (false)
    178184
    179 
    180 int handle_std_request(usb_device_request_setup_packet_t *request, uint8_t *data)
     185/** Handle standard device request. */
     186int handle_std_request(usbvirt_device_t *device,
     187    usb_device_request_setup_packet_t *request, uint8_t *data)
    181188{
    182189        HANDLE_REQUEST(request, data, USB_DEVREQ_GET_DESCRIPTOR,
    183190            device, on_get_descriptor,
    184             handle_get_descriptor(request->value_low, request->value_high,
     191            handle_get_descriptor(device, request->value_low, request->value_high,
    185192                request->index, request->length));
    186193       
    187194        HANDLE_REQUEST(request, data, USB_DEVREQ_SET_ADDRESS,
    188195            device, on_set_address,
    189             handle_set_address(request->value,
     196            handle_set_address(device, request->value,
    190197                request->index, request->length));
    191198       
    192199        HANDLE_REQUEST(request, data, USB_DEVREQ_SET_CONFIGURATION,
    193200            device, on_set_configuration,
    194             handle_set_configuration(request->value,
     201            handle_set_configuration(device, request->value,
    195202                request->index, request->length));
    196203       
Note: See TracChangeset for help on using the changeset viewer.