Changeset 933b0d7 in mainline
- Timestamp:
- 2011-09-07T11:38:57Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d394f1b8
- Parents:
- 7099861
- Location:
- uspace
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.c
r7099861 r933b0d7 188 188 list_initialize(&instance->pending_batches); 189 189 190 ret = hcd_init(&instance->generic, BANDWIDTH_AVAILABLE_USB11); 190 ret = hcd_init(&instance->generic, BANDWIDTH_AVAILABLE_USB11, 191 bandwidth_count_usb11); 191 192 CHECK_RET_RETURN(ret, "Failed to initialize generic driver: %s.\n", 192 193 str_error(ret)); -
uspace/drv/bus/usb/uhci/hc.c
r7099861 r933b0d7 192 192 "Device registers at %p (%zuB) accessible.\n", io, reg_size); 193 193 194 ret = hcd_init(&instance->generic, BANDWIDTH_AVAILABLE_USB11); 194 ret = hcd_init(&instance->generic, BANDWIDTH_AVAILABLE_USB11, 195 bandwidth_count_usb11); 195 196 CHECK_RET_RETURN(ret, "Failed to initialize HCD generic driver: %s.\n", 196 197 str_error(ret)); -
uspace/drv/bus/usb/vhc/main.c
r7099861 r933b0d7 73 73 } 74 74 data->magic = 0xDEADBEEF; 75 rc = usb_endpoint_manager_init(&data->ep_manager, (size_t) -1); 75 rc = usb_endpoint_manager_init(&data->ep_manager, (size_t) -1, 76 bandwidth_count_usb11); 76 77 if (rc != EOK) { 77 78 usb_log_fatal("Failed to initialize endpoint manager.\n"); -
uspace/lib/usbhost/include/usb/host/hcd.h
r7099861 r933b0d7 53 53 }; 54 54 /*----------------------------------------------------------------------------*/ 55 static inline int hcd_init(hcd_t *hcd, size_t bandwidth) 55 static inline int hcd_init(hcd_t *hcd, size_t bandwidth, 56 size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t)) 56 57 { 57 58 assert(hcd); 58 59 usb_device_keeper_init(&hcd->dev_manager); 59 return usb_endpoint_manager_init(&hcd->ep_manager, bandwidth );60 return usb_endpoint_manager_init(&hcd->ep_manager, bandwidth, bw_count); 60 61 } 61 62 /*----------------------------------------------------------------------------*/ -
uspace/lib/usbhost/include/usb/host/usb_endpoint_manager.h
r7099861 r933b0d7 53 53 fibril_mutex_t guard; 54 54 size_t free_bw; 55 size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t); 55 56 } usb_endpoint_manager_t; 56 57 … … 59 60 60 61 int usb_endpoint_manager_init(usb_endpoint_manager_t *instance, 61 size_t available_bandwidth); 62 size_t available_bandwidth, 63 size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t)); 62 64 63 65 void usb_endpoint_manager_destroy(usb_endpoint_manager_t *instance); -
uspace/lib/usbhost/src/usb_endpoint_manager.c
r7099861 r933b0d7 140 140 /*----------------------------------------------------------------------------*/ 141 141 int usb_endpoint_manager_init(usb_endpoint_manager_t *instance, 142 size_t available_bandwidth) 142 size_t available_bandwidth, 143 size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t)) 143 144 { 144 145 assert(instance); 145 146 fibril_mutex_initialize(&instance->guard); 146 147 instance->free_bw = available_bandwidth; 148 instance->bw_count = bw_count; 147 149 const bool ht = 148 150 hash_table_create(&instance->ep_table, BUCKET_COUNT, MAX_KEYS, &op); … … 158 160 endpoint_t *ep, size_t data_size) 159 161 { 162 assert(instance); 163 assert(instance->bw_count); 160 164 assert(ep); 161 const size_t bw = bandwidth_count_usb11(ep->speed, ep->transfer_type,165 const size_t bw = instance->bw_count(ep->speed, ep->transfer_type, 162 166 data_size, ep->max_packet_size); 163 assert(instance);164 167 165 168 fibril_mutex_lock(&instance->guard);
Note:
See TracChangeset
for help on using the changeset viewer.