Changeset a4e18e1 in mainline for uspace/lib/usb/include/usb/host/usb_endpoint_manager.h
- Timestamp:
- 2011-04-07T15:04:16Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 36cd378
- Parents:
- 9d06563 (diff), a82889e (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 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/host/usb_endpoint_manager.h
r9d06563 ra4e18e1 37 37 * This structure shall simplify the management. 38 38 */ 39 #ifndef LIBUSB_HOST_ BANDWIDTH_H40 #define LIBUSB_HOST_ BANDWIDTH_H39 #ifndef LIBUSB_HOST_USB_ENDPOINT_MANAGER_H 40 #define LIBUSB_HOST_YSB_ENDPOINT_MANAGER_H 41 41 42 42 #include <adt/hash_table.h> 43 43 #include <fibril_synch.h> 44 44 #include <usb/usb.h> 45 #include <usb/host/endpoint.h> 45 46 46 47 #define BANDWIDTH_TOTAL_USB11 12000000 47 48 #define BANDWIDTH_AVAILABLE_USB11 ((BANDWIDTH_TOTAL_USB11 / 10) * 9) 48 49 49 typedef struct bandwidth{50 hash_table_t reserved;50 typedef struct usb_endpoint_manager { 51 hash_table_t ep_table; 51 52 fibril_mutex_t guard; 52 size_t free;53 size_t (*usage_fnc)(usb_speed_t, usb_transfer_type_t, size_t, size_t);54 } bandwidth_t;53 fibril_condvar_t change; 54 size_t free_bw; 55 } usb_endpoint_manager_t; 55 56 56 57 size_t bandwidth_count_usb11(usb_speed_t speed, usb_transfer_type_t type, 57 58 size_t size, size_t max_packet_size); 58 59 59 int bandwidth_init(bandwidth_t *instance, size_t bandwidth,60 size_t (*usage_fnc)(usb_speed_t, usb_transfer_type_t, size_t, size_t));60 int usb_endpoint_manager_init(usb_endpoint_manager_t *instance, 61 size_t available_bandwidth); 61 62 62 void bandwidth_destroy(bandwidth_t *instance);63 void usb_endpoint_manager_destroy(usb_endpoint_manager_t *instance); 63 64 64 int bandwidth_reserve(bandwidth_t *instance, usb_address_t address, 65 usb_endpoint_t endpoint, usb_direction_t direction, usb_speed_t speed, 66 usb_transfer_type_t transfer_type, size_t max_packet_size, size_t size, 67 unsigned interval); 65 int usb_endpoint_manager_register_ep(usb_endpoint_manager_t *instance, 66 endpoint_t *ep, size_t data_size); 68 67 69 int bandwidth_release(bandwidth_t *instance, usb_address_t address, 70 usb_endpoint_t endpoint, usb_direction_t direction); 68 int usb_endpoint_manager_register_ep_wait(usb_endpoint_manager_t *instance, 69 usb_address_t address, usb_endpoint_t ep, usb_direction_t direction, 70 void *data, void (*data_remove_callback)(void* data, void* arg), void *arg, 71 size_t bw); 71 72 72 int bandwidth_use(bandwidth_t *instance, usb_address_t address,73 usb_ endpoint_t endpoint, usb_direction_t direction);73 int usb_endpoint_manager_unregister_ep(usb_endpoint_manager_t *instance, 74 usb_address_t address, usb_endpoint_t ep, usb_direction_t direction); 74 75 75 int bandwidth_free(bandwidth_t *instance, usb_address_t address, 76 usb_endpoint_t endpoint, usb_direction_t direction); 76 endpoint_t * usb_endpoint_manager_get_ep(usb_endpoint_manager_t *instance, 77 usb_address_t address, usb_endpoint_t ep, usb_direction_t direction, 78 size_t *bw); 77 79 78 80 #endif … … 80 82 * @} 81 83 */ 84
Note:
See TracChangeset
for help on using the changeset viewer.