diff options
| author | hathach <[email protected]> | 2013-07-03 12:06:07 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-07-03 12:06:07 +0700 |
| commit | b0f45b3651432c4d4c3072b2a900efbbbf6944a3 (patch) | |
| tree | 749660553183a861dcce4a9537ef097d73e87bdb /tinyusb/class | |
| parent | 294ddd0acc0169cce3f03ba085151a3115172a1b (diff) | |
temporarily check cdc mounted by pipe_in & pipe_out
add tests for tusbh_cdc_xfer_isr
Diffstat (limited to 'tinyusb/class')
| -rw-r--r-- | tinyusb/class/cdc_host.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tinyusb/class/cdc_host.c b/tinyusb/class/cdc_host.c index 023c69a19..e349f3b9f 100644 --- a/tinyusb/class/cdc_host.c +++ b/tinyusb/class/cdc_host.c @@ -60,7 +60,13 @@ STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr) { - return (tusbh_device_get_mounted_class_flag(dev_addr) & BIT_(TUSB_CLASS_CDC)) != 0; +// FIXME cannot use mounted class flag as at the point _open_sublass is called, the flag is not set yet +#ifdef _TEST_ + return (tusbh_device_get_mounted_class_flag(dev_addr) & BIT_(TUSB_CLASS_CDC)) != 0; +#else + return pipehandle_is_valid(cdch_data[dev_addr-1].pipe_in) && + pipehandle_is_valid(cdch_data[dev_addr-1].pipe_out); +#endif } static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl) ATTR_PURE ATTR_ALWAYS_INLINE; @@ -86,7 +92,7 @@ bool tusbh_cdc_serial_is_mounted(uint8_t dev_addr) tusb_error_t tusbh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t length, bool is_notify) { -// FIXME disable temp ASSERT( tusbh_cdc_is_mounted(dev_addr), TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED); + ASSERT( tusbh_cdc_is_mounted(dev_addr), TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED); ASSERT( p_data != NULL && length, TUSB_ERROR_INVALID_PARA); pipe_handle_t pipe_out = cdch_data[dev_addr-1].pipe_out; @@ -100,7 +106,7 @@ tusb_error_t tusbh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t leng tusb_error_t tusbh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, bool is_notify) { -// FIXME disable temp ASSERT( tusbh_cdc_is_mounted(dev_addr), TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED); + ASSERT( tusbh_cdc_is_mounted(dev_addr), TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED); ASSERT( p_buffer != NULL && length, TUSB_ERROR_INVALID_PARA); pipe_handle_t pipe_in = cdch_data[dev_addr-1].pipe_in; |
