Changeset 1845003 in mainline
- Timestamp:
- 2013-08-02T14:57:55Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3969a42
- Parents:
- 64e1fb2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/ddf_helpers.c
r64e1fb2 r1845003 230 230 } 231 231 232 /** Inbound communication interface function. 233 * @param fun DDF function. 234 * @param target Communication target. 235 * @param setup_data Data to use in setup stage (control transfers). 236 * @param data Pointer to data buffer. 237 * @param size Size of the data buffer. 238 * @param callback Function to call on communication end. 239 * @param arg Argument passed to the callback function. 240 * @return Error code. 241 */ 242 static int dev_read(ddf_fun_t *fun, usb_endpoint_t endpoint, 243 uint64_t setup_data, uint8_t *data, size_t size, 244 usbhc_iface_transfer_in_callback_t callback, void *arg) 245 { 246 assert(fun); 247 usb_dev_t *usb_dev = ddf_fun_data_get(fun); 248 assert(usb_dev); 249 const usb_target_t target = {{ 250 .address = usb_dev->address, 251 .endpoint = endpoint, 252 }}; 253 return hcd_send_batch(dev_to_hcd(ddf_fun_get_dev(fun)), target, 254 USB_DIRECTION_IN, data, size, setup_data, callback, NULL, arg, 255 "READ"); 256 } 257 258 /** Outbound communication interface function. 259 * @param fun DDF function. 260 * @param target Communication target. 261 * @param setup_data Data to use in setup stage (control transfers). 262 * @param data Pointer to data buffer. 263 * @param size Size of the data buffer. 264 * @param callback Function to call on communication end. 265 * @param arg Argument passed to the callback function. 266 * @return Error code. 267 */ 268 static int dev_write(ddf_fun_t *fun, usb_endpoint_t endpoint, 269 uint64_t setup_data, const uint8_t *data, size_t size, 270 usbhc_iface_transfer_out_callback_t callback, void *arg) 271 { 272 assert(fun); 273 usb_dev_t *usb_dev = ddf_fun_data_get(fun); 274 assert(usb_dev); 275 const usb_target_t target = {{ 276 .address = usb_dev->address, 277 .endpoint = endpoint, 278 }}; 279 return hcd_send_batch(dev_to_hcd(ddf_fun_get_dev(fun)), 280 target, USB_DIRECTION_OUT, (uint8_t*)data, size, setup_data, NULL, 281 callback, arg, "WRITE"); 282 } 283 232 284 /** Root hub USB interface */ 233 285 static usb_iface_t usb_iface = { … … 243 295 .register_endpoint = register_endpoint, 244 296 .unregister_endpoint = unregister_endpoint, 297 .read = dev_read, 298 .write = dev_write, 245 299 }; 246 300
Note:
See TracChangeset
for help on using the changeset viewer.