Changeset e28d228 in mainline for uspace/drv/vhc/addrmgm.c
- Timestamp:
- 2010-12-04T17:54:34Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 35537a7
- Parents:
- 54b141a (diff), 9ca0013 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/vhc/addrmgm.c
r54b141a re28d228 49 49 typedef struct { 50 50 usb_address_t address; 51 devman_handle_t devman_handle; 51 52 bool available; 52 53 } address_info_t; … … 69 70 dev_address[i].address = i + 1; 70 71 dev_address[i].available = true; 72 dev_address[i].devman_handle = 0; 71 73 } 72 74 … … 120 122 } 121 123 124 int bind_address(device_t *dev, usb_address_t address, devman_handle_t handle) 125 { 126 if (address == DEFAULT_ADDRESS) { 127 return EPERM; 128 } 129 130 int rc = EPERM; 131 132 fibril_mutex_lock(&address_guard); 133 usb_address_t i; 134 for (i = 0; i < ADDRESS_COUNT; i++) { 135 if (dev_address[i].address == address) { 136 if (dev_address[i].available) { 137 rc = ENOENT; 138 break; 139 } 140 141 dev_address[i].devman_handle = handle; 142 rc = EOK; 143 break; 144 } 145 } 146 fibril_mutex_unlock(&address_guard); 147 148 return rc; 149 } 150 151 int tell_address(device_t *dev, devman_handle_t handle, usb_address_t *address) 152 { 153 int rc = ENOENT; 154 155 fibril_mutex_lock(&address_guard); 156 usb_address_t i; 157 for (i = 0; i < ADDRESS_COUNT; i++) { 158 if (dev_address[i].devman_handle == handle) { 159 *address = dev_address[i].address; 160 rc = EOK; 161 break; 162 } 163 } 164 fibril_mutex_unlock(&address_guard); 165 166 return rc; 167 } 168 122 169 int release_address(device_t *dev, usb_address_t address) 123 170 { … … 138 185 139 186 dev_address[i].available = true; 187 dev_address[i].devman_handle = 0; 140 188 rc = EOK; 141 189 break;
Note:
See TracChangeset
for help on using the changeset viewer.