Changeset 48ae3ef in mainline for uspace/lib/usbhost/src/iface.c
- Timestamp:
- 2011-10-28T21:52:15Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 57e06ef
- Parents:
- 7265558
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/iface.c
r7265558 r48ae3ef 49 49 assert(hcd); 50 50 51 endpoint_t *ep = usb_endpoint_manager_ get_ep(&hcd->ep_manager,51 endpoint_t *ep = usb_endpoint_manager_find_ep(&hcd->ep_manager, 52 52 target.address, target.endpoint, direction); 53 53 if (ep == NULL) { … … 165 165 } 166 166 /*----------------------------------------------------------------------------*/ 167 static int register_helper(endpoint_t *ep, void *arg) 168 { 169 hcd_t *hcd = arg; 170 assert(ep); 171 assert(hcd); 172 if (hcd->ep_add_hook) 173 return hcd->ep_add_hook(hcd, ep); 174 return EOK; 175 } 176 /*----------------------------------------------------------------------------*/ 177 static void unregister_helper(endpoint_t *ep, void *arg) 178 { 179 hcd_t *hcd = arg; 180 assert(ep); 181 assert(hcd); 182 if (hcd->ep_remove_hook) 183 hcd->ep_remove_hook(hcd, ep); 184 } 185 /*----------------------------------------------------------------------------*/ 167 186 static int register_endpoint( 168 187 ddf_fun_t *fun, usb_address_t address, usb_speed_t ep_speed, … … 188 207 max_packet_size, interval); 189 208 190 endpoint_t *ep = 191 endpoint_create(address, endpoint, direction, transfer_type, 192 speed, max_packet_size, 0); 193 if (!ep) 194 return ENOMEM; 195 196 if (hcd->ep_add_hook) { 197 const int ret = hcd->ep_add_hook(hcd, ep); 198 if (ret != EOK) { 199 endpoint_destroy(ep); 200 return ret; 201 } 202 } 203 204 const int ret = 205 usb_endpoint_manager_register_ep(&hcd->ep_manager, ep, size); 206 if (ret != EOK) { 207 endpoint_destroy(ep); 208 } 209 return ret; 209 return usb_endpoint_manager_add_ep(&hcd->ep_manager, address, endpoint, 210 direction, transfer_type, speed, max_packet_size, size, 211 register_helper, hcd); 210 212 } 211 213 /*----------------------------------------------------------------------------*/ … … 219 221 usb_log_debug("Unregister endpoint %d:%d %s.\n", 220 222 address, endpoint, usb_str_direction(direction)); 221 return usb_endpoint_manager_ unregister_ep(&hcd->ep_manager, address,222 endpoint, direction );223 return usb_endpoint_manager_remove_ep(&hcd->ep_manager, address, 224 endpoint, direction, unregister_helper, hcd); 223 225 } 224 226 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.