Changeset fdec59b in mainline
- Timestamp:
- 2013-08-02T11:26:59Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7c10198
- Parents:
- 3cc55b47
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/iface.c
r3cc55b47 rfdec59b 42 42 #include "ddf_helpers.h" 43 43 44 /** Register endpoint interface function.45 * @param fun DDF function.46 * @param address USB address of the device.47 * @param endpoint USB endpoint number to be registered.48 * @param transfer_type Endpoint's transfer type.49 * @param direction USB communication direction the endpoint is capable of.50 * @param max_packet_size Maximu size of packets the endpoint accepts.51 * @param interval Preferred timeout between communication.52 * @return Error code.53 */54 static int register_endpoint(55 ddf_fun_t *fun, usb_address_t address, usb_endpoint_t endpoint,56 usb_transfer_type_t transfer_type, usb_direction_t direction,57 size_t max_packet_size, unsigned interval)58 {59 assert(fun);60 hcd_t *hcd = dev_to_hcd(ddf_fun_get_dev(fun));61 assert(hcd);62 const size_t size = max_packet_size;63 const usb_target_t target = {{.address = address, .endpoint = endpoint}};64 65 usb_log_debug("Register endpoint %d:%d %s-%s %zuB %ums.\n",66 address, endpoint, usb_str_transfer_type(transfer_type),67 usb_str_direction(direction), max_packet_size, interval);68 69 return hcd_add_ep(hcd, target, direction, transfer_type,70 max_packet_size, size);71 }72 73 /** Unregister endpoint interface function.74 * @param fun DDF function.75 * @param address USB address of the endpoint.76 * @param endpoint USB endpoint number.77 * @param direction Communication direction of the enpdoint to unregister.78 * @return Error code.79 */80 static int unregister_endpoint(81 ddf_fun_t *fun, usb_address_t address,82 usb_endpoint_t endpoint, usb_direction_t direction)83 {84 assert(fun);85 hcd_t *hcd = dev_to_hcd(ddf_fun_get_dev(fun));86 assert(hcd);87 const usb_target_t target = {{.address = address, .endpoint = endpoint}};88 usb_log_debug("Unregister endpoint %d:%d %s.\n",89 address, endpoint, usb_str_direction(direction));90 return hcd_remove_ep(hcd, target, direction);91 }92 93 44 /** Inbound communication interface function. 94 45 * @param fun DDF function. … … 131 82 /** usbhc Interface implementation using hcd_t from libusbhost library. */ 132 83 usbhc_iface_t hcd_iface = { 133 .register_endpoint = register_endpoint,134 .unregister_endpoint = unregister_endpoint,135 136 84 .read = usb_read, 137 85 .write = usb_write,
Note:
See TracChangeset
for help on using the changeset viewer.