Changeset 5f0b366 in mainline for uspace/lib/usbhost/src/usb2_bus.c
- Timestamp:
- 2018-01-25T02:05:57Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b357377
- Parents:
- e8277c0
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-24 19:34:07)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-25 02:05:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/usb2_bus.c
re8277c0 r5f0b366 210 210 211 211 /** 212 * Call the bus operation to count bandwidth. 213 * 214 * @param ep Endpoint on which the transfer will take place. 215 * @param size The payload size. 216 */ 217 static ssize_t endpoint_count_bw(endpoint_t *ep) 218 { 219 assert(ep); 220 221 bus_t *bus = ep->device->bus; 222 const bus_ops_t *ops = BUS_OPS_LOOKUP(bus->ops, endpoint_count_bw); 223 if (!ops) 224 return 0; 225 226 return ops->endpoint_count_bw(ep, ep->max_transfer_size); 227 } 228 229 /** 212 230 * Register an endpoint to the bus. Reserves bandwidth. 213 231 */ … … 218 236 assert(ep); 219 237 238 size_t bw = endpoint_count_bw(ep); 239 220 240 /* Check for available bandwidth */ 221 if ( ep->bandwidth> bus->free_bw)241 if (bw > bus->free_bw) 222 242 return ENOSPC; 223 243 224 bus->free_bw -= ep->bandwidth;244 bus->free_bw -= bw; 225 245 226 246 return EOK; … … 235 255 assert(ep); 236 256 237 bus->free_bw += e p->bandwidth;257 bus->free_bw += endpoint_count_bw(ep); 238 258 } 239 259
Note:
See TracChangeset
for help on using the changeset viewer.