diff options
| author | hathach <[email protected]> | 2013-06-21 14:20:08 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-06-21 14:20:08 +0700 |
| commit | 5c564df8c172af0da3badabfa8e813fdd33949ff (patch) | |
| tree | c0dcc52362aa02e8eb4eb6f45f4354c1bdf2d286 /tinyusb/class/custom_class_host.c | |
| parent | 3924764dff9d90ccff09e1d657c6f40ed8def8d9 (diff) | |
add api for hcd: hcd_pipe_is_idle
add api for usbh: tusbh_device_get_mounted_class_flag
implement api for custom class
- is mounted
- read
Diffstat (limited to 'tinyusb/class/custom_class_host.c')
| -rw-r--r-- | tinyusb/class/custom_class_host.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tinyusb/class/custom_class_host.c b/tinyusb/class/custom_class_host.c index 723cb06ff..568c20f3f 100644 --- a/tinyusb/class/custom_class_host.c +++ b/tinyusb/class/custom_class_host.c @@ -56,8 +56,35 @@ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ custom_interface_info_t custom_interface[TUSB_CFG_HOST_DEVICE_MAX]; + +//--------------------------------------------------------------------+ +// APPLICATION API +//--------------------------------------------------------------------+ +tusb_error_t tusbh_custom_read(uint8_t dev_addr, uint16_t vendor_id, uint16_t product_id, void * p_buffer, uint16_t length) +{ + if ( !tusbh_custom_is_mounted(dev_addr, vendor_id, product_id) ) + { + return TUSB_ERROR_DEVICE_NOT_READY; + } + + ASSERT( p_buffer != NULL && length != 0, TUSB_ERROR_INVALID_PARA); + if ( hcd_pipe_is_idle(custom_interface[dev_addr-1].pipe_in) ) + { + return TUSB_ERROR_INTERFACE_IS_BUSY; + } + + (void) hcd_pipe_xfer( custom_interface[dev_addr-1].pipe_in, p_buffer, length, false); + + return TUSB_ERROR_NONE; +} + +tusb_error_t tusbh_custom_write(uint8_t dev_addr, uint16_t vendor_id, uint16_t product_id, void const * p_data, uint16_t length) +{ + return TUSB_ERROR_NONE; +} + //--------------------------------------------------------------------+ -// IMPLEMENTATION +// USBH-CLASS API //--------------------------------------------------------------------+ void cush_init(void) { |
