Changeset 4cf5b8e0 in mainline for uspace/lib/usbhost/src/usb_bus.c
- Timestamp:
- 2013-09-21T01:10:47Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ce33c10
- Parents:
- 9348862
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/usb_bus.c
r9348862 r4cf5b8e0 39 39 40 40 #include <usb/debug.h> 41 #include <usb/host/usb_ endpoint_manager.h>41 #include <usb/host/usb_bus.h> 42 42 43 43 /** Endpoint compare helper function. … … 64 64 65 65 /** Get list that holds endpoints for given address. 66 * @param instance usb_ endpoint_managerstructure, non-null.66 * @param instance usb_bus structure, non-null. 67 67 * @param addr USB address, must be >= 0. 68 68 * @return Pointer to the appropriate list. 69 69 */ 70 static list_t * get_list(usb_ endpoint_manager_t *instance, usb_address_t addr)70 static list_t * get_list(usb_bus_t *instance, usb_address_t addr) 71 71 { 72 72 assert(instance); … … 76 76 77 77 /** Internal search function, works on locked structure. 78 * @param instance usb_ endpoint_managerstructure, non-null.78 * @param instance usb_bus structure, non-null. 79 79 * @param address USB address, must be valid. 80 80 * @param endpoint USB endpoint number. … … 84 84 * @note Assumes that the internal mutex is locked. 85 85 */ 86 static endpoint_t * find_locked(usb_ endpoint_manager_t *instance,86 static endpoint_t * find_locked(usb_bus_t *instance, 87 87 usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction) 88 88 { … … 103 103 * @return Free address, or error code. 104 104 */ 105 static usb_address_t usb_endpoint_manager_get_free_address( 106 usb_endpoint_manager_t *instance) 105 static usb_address_t usb_bus_get_free_address(usb_bus_t *instance) 107 106 { 108 107 … … 174 173 * add_endpoint/remove_endpoint pair. 175 174 * 176 * @param instance usb_ endpoint_managerstructure, non-null.175 * @param instance usb_bus structure, non-null. 177 176 * @param available_bandwidth Size of the bandwidth pool. 178 177 * @param bw_count function to use to calculate endpoint bw requirements. 179 178 * @return Error code. 180 179 */ 181 int usb_ endpoint_manager_init(usb_endpoint_manager_t *instance,180 int usb_bus_init(usb_bus_t *instance, 182 181 size_t available_bandwidth, bw_count_func_t bw_count, usb_speed_t max_speed) 183 182 { … … 198 197 /** Register endpoint structure. 199 198 * Checks for duplicates. 200 * @param instance usb_ endpoint_manager, non-null.199 * @param instance usb_bus, non-null. 201 200 * @param ep endpoint_t to register. 202 201 * @param data_size Size of data to transfer. 203 202 * @return Error code. 204 203 */ 205 int usb_endpoint_manager_register_ep(usb_endpoint_manager_t *instance, 206 endpoint_t *ep, size_t data_size) 204 int usb_bus_register_ep(usb_bus_t *instance, endpoint_t *ep, size_t data_size) 207 205 { 208 206 assert(instance); … … 233 231 /** Unregister endpoint structure. 234 232 * Checks for duplicates. 235 * @param instance usb_ endpoint_manager, non-null.233 * @param instance usb_bus, non-null. 236 234 * @param ep endpoint_t to unregister. 237 235 * @return Error code. 238 236 */ 239 int usb_endpoint_manager_unregister_ep( 240 usb_endpoint_manager_t *instance, endpoint_t *ep) 237 int usb_bus_unregister_ep(usb_bus_t *instance, endpoint_t *ep) 241 238 { 242 239 assert(instance); … … 256 253 257 254 /** Find endpoint_t representing the given communication route. 258 * @param instance usb_ endpoint_manager, non-null.255 * @param instance usb_bus, non-null. 259 256 * @param address 260 257 */ 261 endpoint_t * usb_ endpoint_manager_find_ep(usb_endpoint_manager_t *instance,258 endpoint_t * usb_bus_find_ep(usb_bus_t *instance, 262 259 usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction) 263 260 { … … 271 268 272 269 /** Create and register new endpoint_t structure. 273 * @param instance usb_ endpoint_managerstructure, non-null.270 * @param instance usb_bus structure, non-null. 274 271 * @param address USB address. 275 272 * @param endpoint USB endpoint number. … … 283 280 * @return Error code. 284 281 */ 285 int usb_ endpoint_manager_add_ep(usb_endpoint_manager_t *instance,282 int usb_bus_add_ep(usb_bus_t *instance, 286 283 usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction, 287 284 usb_transfer_type_t type, size_t max_packet_size, size_t data_size, … … 343 340 344 341 /** Unregister and destroy endpoint_t structure representing given route. 345 * @param instance usb_ endpoint_managerstructure, non-null.342 * @param instance usb_bus structure, non-null. 346 343 * @param address USB address. 347 344 * @param endpoint USB endpoint number. … … 351 348 * @return Error code. 352 349 */ 353 int usb_ endpoint_manager_remove_ep(usb_endpoint_manager_t *instance,350 int usb_bus_remove_ep(usb_bus_t *instance, 354 351 usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction, 355 352 ep_remove_callback_t callback, void *arg) … … 373 370 } 374 371 375 int usb_endpoint_manager_reset_toggle(usb_endpoint_manager_t *instance, 376 usb_target_t target, bool all) 372 int usb_bus_reset_toggle(usb_bus_t *instance, usb_target_t target, bool all) 377 373 { 378 374 assert(instance); … … 395 391 396 392 /** Unregister and destroy all endpoints using given address. 397 * @param instance usb_ endpoint_managerstructure, non-null.393 * @param instance usb_bus structure, non-null. 398 394 * @param address USB address. 399 395 * @param endpoint USB endpoint number. … … 403 399 * @return Error code. 404 400 */ 405 int usb_ endpoint_manager_remove_address(usb_endpoint_manager_t *instance,401 int usb_bus_remove_address(usb_bus_t *instance, 406 402 usb_address_t address, ep_remove_callback_t callback, void *arg) 407 403 { … … 437 433 * @note Default address is only available in strict mode. 438 434 */ 439 int usb_ endpoint_manager_request_address(usb_endpoint_manager_t *instance,435 int usb_bus_request_address(usb_bus_t *instance, 440 436 usb_address_t *address, bool strict, usb_speed_t speed) 441 437 { … … 453 449 /* Only grant default address to strict requests */ 454 450 if ((addr == USB_ADDRESS_DEFAULT) && !strict) { 455 addr = usb_ endpoint_manager_get_free_address(instance);451 addr = usb_bus_get_free_address(instance); 456 452 } 457 453 … … 461 457 return ENOENT; 462 458 } 463 addr = usb_ endpoint_manager_get_free_address(instance);459 addr = usb_bus_get_free_address(instance); 464 460 } 465 461 if (usb_address_is_valid(addr)) { … … 484 480 * @return Error code. 485 481 */ 486 int usb_ endpoint_manager_get_speed(usb_endpoint_manager_t *instance,487 usb_ address_t address, usb_speed_t *speed)482 int usb_bus_get_speed(usb_bus_t *instance, usb_address_t address, 483 usb_speed_t *speed) 488 484 { 489 485 assert(instance);
Note:
See TracChangeset
for help on using the changeset viewer.