Changeset 98807e16 in mainline


Ignore:
Timestamp:
2011-03-06T18:38:30Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5620bd4
Parents:
3e37964
Message:

Add setup data parsing and toggle reset

Location:
uspace/drv/uhci-hcd/utils
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/utils/device_keeper.c

    r3e37964 r98807e16  
    7676}
    7777/*----------------------------------------------------------------------------*/
     78void device_keeper_reset_if_need(
     79    device_keeper_t *instance, usb_target_t target, const unsigned char *data)
     80{
     81        assert(instance);
     82        fibril_mutex_lock(&instance->guard);
     83        if (target.endpoint > 15 || target.endpoint < 0
     84            || target.address >= USB_ADDRESS_COUNT || target.address < 0
     85            || !instance->devices[target.address].occupied) {
     86                goto the_end;
     87        }
     88
     89        switch (data[1])
     90        {
     91        case 0x01: /*clear feature*/
     92                /* recipient is enpoint, value is zero (ENDPOINT_STALL) */
     93                if (((data[0] & 0xf) == 1) && ((data[2] | data[3]) == 0)) {
     94                        /* enpoint number is < 16, thus first byte is enough */
     95                        instance->devices[target.address].toggle_status &= ~(1 << data[4]);
     96                }
     97        break;
     98
     99        case 0x9: /* set configuration */
     100        case 0x11: /* set interface */
     101                instance->devices[target.address].toggle_status = 0;
     102        break;
     103        }
     104the_end:
     105        fibril_mutex_unlock(&instance->guard);
     106}
     107/*----------------------------------------------------------------------------*/
    78108int device_keeper_get_toggle(device_keeper_t *instance, usb_target_t target)
    79109{
  • uspace/drv/uhci-hcd/utils/device_keeper.h

    r3e37964 r98807e16  
    6262void device_keeper_release_default(device_keeper_t *instance);
    6363
     64void device_keeper_reset_if_need(
     65    device_keeper_t *instance, usb_target_t target, const unsigned char *setup_data);
     66
    6467int device_keeper_get_toggle(device_keeper_t *instance, usb_target_t target);
    6568
    66 int device_keeper_set_toggle(device_keeper_t *instance, usb_target_t target, bool toggle);
     69int device_keeper_set_toggle(
     70    device_keeper_t *instance, usb_target_t target, bool toggle);
    6771
    6872usb_address_t device_keeper_request(
Note: See TracChangeset for help on using the changeset viewer.