Changeset edb5f837 in mainline for uspace/drv/uhci-hcd/utils/device_keeper.c
- Timestamp:
- 2011-03-06T17:38:37Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3e37964
- Parents:
- 40a5d40
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/utils/device_keeper.c
r40a5d40 redb5f837 49 49 instance->devices[i].occupied = false; 50 50 instance->devices[i].handle = 0; 51 instance->devices[i].toggle_status = 0; 51 52 } 52 53 } … … 75 76 } 76 77 /*----------------------------------------------------------------------------*/ 78 int device_keeper_get_toggle(device_keeper_t *instance, usb_target_t target) 79 { 80 assert(instance); 81 int ret; 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 ret = EINVAL; 87 } else { 88 ret = (instance->devices[target.address].toggle_status >> target.endpoint) & 1; 89 } 90 fibril_mutex_unlock(&instance->guard); 91 return ret; 92 } 93 /*----------------------------------------------------------------------------*/ 94 int device_keeper_set_toggle( 95 device_keeper_t *instance, usb_target_t target, bool toggle) 96 { 97 assert(instance); 98 int ret; 99 fibril_mutex_lock(&instance->guard); 100 if (target.endpoint > 15 || target.endpoint < 0 101 || target.address >= USB_ADDRESS_COUNT || target.address < 0 102 || !instance->devices[target.address].occupied) { 103 ret = EINVAL; 104 } else { 105 if (toggle) { 106 instance->devices[target.address].toggle_status |= (1 << target.endpoint); 107 } else { 108 instance->devices[target.address].toggle_status &= ~(1 << target.endpoint); 109 } 110 ret = EOK; 111 } 112 fibril_mutex_unlock(&instance->guard); 113 return ret; 114 } 115 /*----------------------------------------------------------------------------*/ 77 116 usb_address_t device_keeper_request( 78 117 device_keeper_t *instance, usb_speed_t speed) … … 96 135 instance->devices[new_address].occupied = true; 97 136 instance->devices[new_address].speed = speed; 137 instance->devices[new_address].toggle_status = 0; 98 138 instance->last_address = new_address; 99 139 fibril_mutex_unlock(&instance->guard);
Note:
See TracChangeset
for help on using the changeset viewer.