summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-04-12 17:55:15 +0700
committerhathach <[email protected]>2018-04-12 17:55:15 +0700
commit752a9f45d70959e36cf8c0cf3a5cd0c24731635e (patch)
tree518c66e1efc12a0cf74ff256a96ccedecb9ef4ef
parent6d8f4bca47d31ba4d114aa216042913031c56f1a (diff)
rename ASSERT_ERR to TU_ASSERT_ERR to prevent conflict with user code
-rw-r--r--tinyusb/class/custom_class_host.c4
-rw-r--r--tinyusb/class/hid/hid_host.c2
-rw-r--r--tinyusb/class/msc/msc_host.c24
-rw-r--r--tinyusb/common/tusb_verify.h8
-rw-r--r--tinyusb/device/usbd.c2
-rw-r--r--tinyusb/host/ehci/ehci.c12
-rw-r--r--tinyusb/host/ohci/ohci.c4
-rw-r--r--tinyusb/host/usbh.c6
-rw-r--r--tinyusb/osal/osal.h4
-rw-r--r--tinyusb/osal/osal_none.h8
-rw-r--r--tinyusb/portable/nxp/lpc17xx/dcd_lpc175x_6x.c4
-rw-r--r--tinyusb/tusb.c4
12 files changed, 43 insertions, 39 deletions
diff --git a/tinyusb/class/custom_class_host.c b/tinyusb/class/custom_class_host.c
index 6aca2bfb3..20b06d184 100644
--- a/tinyusb/class/custom_class_host.c
+++ b/tinyusb/class/custom_class_host.c
@@ -73,7 +73,7 @@ static tusb_error_t cush_validate_paras(uint8_t dev_addr, uint16_t vendor_id, ui
//--------------------------------------------------------------------+
tusb_error_t tusbh_custom_read(uint8_t dev_addr, uint16_t vendor_id, uint16_t product_id, void * p_buffer, uint16_t length)
{
- ASSERT_ERR( cush_validate_paras(dev_addr, vendor_id, product_id, p_buffer, length) );
+ TU_ASSERT_ERR( cush_validate_paras(dev_addr, vendor_id, product_id, p_buffer, length) );
if ( !hcd_pipe_is_idle(custom_interface[dev_addr-1].pipe_in) )
{
@@ -87,7 +87,7 @@ tusb_error_t tusbh_custom_read(uint8_t dev_addr, uint16_t vendor_id, uint16_t pr
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)
{
- ASSERT_ERR( cush_validate_paras(dev_addr, vendor_id, product_id, p_data, length) );
+ TU_ASSERT_ERR( cush_validate_paras(dev_addr, vendor_id, product_id, p_data, length) );
if ( !hcd_pipe_is_idle(custom_interface[dev_addr-1].pipe_out) )
{
diff --git a/tinyusb/class/hid/hid_host.c b/tinyusb/class/hid/hid_host.c
index 65bb36b15..69f86ee0b 100644
--- a/tinyusb/class/hid/hid_host.c
+++ b/tinyusb/class/hid/hid_host.c
@@ -80,7 +80,7 @@ tusb_error_t hidh_interface_get_report(uint8_t dev_addr, void * report, hidh_int
VERIFY (report, TUSB_ERROR_INVALID_PARA);
TU_ASSSERT (!hcd_pipe_is_busy(p_hid->pipe_hdl), TUSB_ERROR_INTERFACE_IS_BUSY);
- ASSERT_ERR( hcd_pipe_xfer(p_hid->pipe_hdl, report, p_hid->report_size, true) ) ;
+ TU_ASSERT_ERR( hcd_pipe_xfer(p_hid->pipe_hdl, report, p_hid->report_size, true) ) ;
return TUSB_ERROR_NONE;
}
diff --git a/tinyusb/class/msc/msc_host.c b/tinyusb/class/msc/msc_host.c
index dcdfa4d53..afe7032a6 100644
--- a/tinyusb/class/msc/msc_host.c
+++ b/tinyusb/class/msc/msc_host.c
@@ -116,16 +116,16 @@ static tusb_error_t msch_command_xfer(msch_interface_t * p_msch, void* p_buffer)
{ // there is data phase
if (p_msch->cbw.dir & TUSB_DIR_IN_MASK)
{
- ASSERT_ERR( hcd_pipe_xfer(p_msch->bulk_out, (uint8_t*) &p_msch->cbw, sizeof(msc_cbw_t), false) );
- ASSERT_ERR( hcd_pipe_queue_xfer(p_msch->bulk_in , p_buffer, p_msch->cbw.xfer_bytes) );
+ TU_ASSERT_ERR( hcd_pipe_xfer(p_msch->bulk_out, (uint8_t*) &p_msch->cbw, sizeof(msc_cbw_t), false) );
+ TU_ASSERT_ERR( hcd_pipe_queue_xfer(p_msch->bulk_in , p_buffer, p_msch->cbw.xfer_bytes) );
}else
{
- ASSERT_ERR( hcd_pipe_queue_xfer(p_msch->bulk_out, (uint8_t*) &p_msch->cbw, sizeof(msc_cbw_t)) );
- ASSERT_ERR( hcd_pipe_xfer(p_msch->bulk_out , p_buffer, p_msch->cbw.xfer_bytes, false) );
+ TU_ASSERT_ERR( hcd_pipe_queue_xfer(p_msch->bulk_out, (uint8_t*) &p_msch->cbw, sizeof(msc_cbw_t)) );
+ TU_ASSERT_ERR( hcd_pipe_xfer(p_msch->bulk_out , p_buffer, p_msch->cbw.xfer_bytes, false) );
}
}
- ASSERT_ERR( hcd_pipe_xfer(p_msch->bulk_in , (uint8_t*) &p_msch->csw, sizeof(msc_csw_t), true) );
+ TU_ASSERT_ERR( hcd_pipe_xfer(p_msch->bulk_in , (uint8_t*) &p_msch->csw, sizeof(msc_csw_t), true) );
return TUSB_ERROR_NONE;
}
@@ -149,7 +149,7 @@ tusb_error_t tusbh_msc_inquiry(uint8_t dev_addr, uint8_t lun, uint8_t *p_data)
memcpy(p_msch->cbw.command, &cmd_inquiry, p_msch->cbw.cmd_len);
- ASSERT_ERR ( msch_command_xfer(p_msch, p_data) );
+ TU_ASSERT_ERR ( msch_command_xfer(p_msch, p_data) );
return TUSB_ERROR_NONE;
}
@@ -174,7 +174,7 @@ tusb_error_t tusbh_msc_read_capacity10(uint8_t dev_addr, uint8_t lun, uint8_t *p
memcpy(p_msch->cbw.command, &cmd_read_capacity10, p_msch->cbw.cmd_len);
- ASSERT_ERR ( msch_command_xfer(p_msch, p_data) );
+ TU_ASSERT_ERR ( msch_command_xfer(p_msch, p_data) );
return TUSB_ERROR_NONE;
}
@@ -199,7 +199,7 @@ tusb_error_t tuh_msc_request_sense(uint8_t dev_addr, uint8_t lun, uint8_t *p_dat
memcpy(p_msch->cbw.command, &cmd_request_sense, p_msch->cbw.cmd_len);
- ASSERT_ERR ( msch_command_xfer(p_msch, p_data) );
+ TU_ASSERT_ERR ( msch_command_xfer(p_msch, p_data) );
return TUSB_ERROR_NONE;
}
@@ -225,8 +225,8 @@ tusb_error_t tuh_msc_test_unit_ready(uint8_t dev_addr, uint8_t lun, msc_csw_t *
memcpy(p_msch->cbw.command, &cmd_test_unit_ready, p_msch->cbw.cmd_len);
// TODO MSCH refractor test uinit ready
- ASSERT_ERR( hcd_pipe_xfer(p_msch->bulk_out, (uint8_t*) &p_msch->cbw, sizeof(msc_cbw_t), false) );
- ASSERT_ERR( hcd_pipe_xfer(p_msch->bulk_in , (uint8_t*) p_csw, sizeof(msc_csw_t), true) );
+ TU_ASSERT_ERR( hcd_pipe_xfer(p_msch->bulk_out, (uint8_t*) &p_msch->cbw, sizeof(msc_cbw_t), false) );
+ TU_ASSERT_ERR( hcd_pipe_xfer(p_msch->bulk_in , (uint8_t*) p_csw, sizeof(msc_csw_t), true) );
return TUSB_ERROR_NONE;
}
@@ -252,7 +252,7 @@ tusb_error_t tuh_msc_read10(uint8_t dev_addr, uint8_t lun, void * p_buffer, uin
memcpy(p_msch->cbw.command, &cmd_read10, p_msch->cbw.cmd_len);
- ASSERT_ERR ( msch_command_xfer(p_msch, p_buffer));
+ TU_ASSERT_ERR ( msch_command_xfer(p_msch, p_buffer));
return TUSB_ERROR_NONE;
}
@@ -278,7 +278,7 @@ tusb_error_t tuh_msc_write10(uint8_t dev_addr, uint8_t lun, void const * p_buffe
memcpy(p_msch->cbw.command, &cmd_write10, p_msch->cbw.cmd_len);
- ASSERT_ERR ( msch_command_xfer(p_msch, (void*) p_buffer));
+ TU_ASSERT_ERR ( msch_command_xfer(p_msch, (void*) p_buffer));
return TUSB_ERROR_NONE;
}
diff --git a/tinyusb/common/tusb_verify.h b/tinyusb/common/tusb_verify.h
index 4a9ac2d36..13b8d39f7 100644
--- a/tinyusb/common/tusb_verify.h
+++ b/tinyusb/common/tusb_verify.h
@@ -164,7 +164,7 @@ static inline void verify_breakpoint(void)
#define ASSERT_1ARGS(_cond) VERIFY_DEFINE(_cond, _MESS_FAILED(); verify_breakpoint(), false)
#define ASSERT_2ARGS(_cond, _ret) VERIFY_DEFINE(_cond, _MESS_FAILED(); verify_breakpoint(), _ret)
-#define TU_ASSERT(...) GET_3RD_ARG(__VA_ARGS__, ASSERT_2ARGS, ASSERT_1ARGS)(__VA_ARGS__)
+#define TU_ASSERT(...) GET_3RD_ARG(__VA_ARGS__, ASSERT_2ARGS, ASSERT_1ARGS)(__VA_ARGS__)
/*------------------------------------------------------------------*/
/* ASSERT Error
@@ -173,7 +173,11 @@ static inline void verify_breakpoint(void)
#define ASERT_ERR_1ARGS(_error) VERIFY_ERR_DEF2(_error, verify_breakpoint())
#define ASERT_ERR_2ARGS(_error, _ret) VERIFY_ERR_DEF3(_error, verify_breakpoint(), _ret)
-#define ASSERT_ERR(...) GET_3RD_ARG(__VA_ARGS__, ASERT_ERR_2ARGS, ASERT_ERR_1ARGS)(__VA_ARGS__)
+#define TU_ASSERT_ERR(...) GET_3RD_ARG(__VA_ARGS__, ASERT_ERR_2ARGS, ASERT_ERR_1ARGS)(__VA_ARGS__)
+
+/*------------------------------------------------------------------*/
+/* ASSERT HDLR
+ *------------------------------------------------------------------*/
#ifdef __cplusplus
}
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index 4a13f471a..cb2b1916a 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -435,7 +435,7 @@ static tusb_error_t proc_set_config_req(uint8_t rhport, uint8_t config_number)
usbd_devices[rhport].interface2class[p_desc_interface->bInterfaceNumber] = class_index;
uint16_t length=0;
- ASSERT_ERR( usbd_class_drivers[class_index].open( rhport, p_desc_interface, &length ) );
+ TU_ASSERT_ERR( usbd_class_drivers[class_index].open( rhport, p_desc_interface, &length ) );
TU_ASSERT( length >= sizeof(tusb_desc_interface_t), TUSB_ERROR_FAILED );
p_desc += length;
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c
index 6ca89b837..d710d048b 100644
--- a/tinyusb/host/ehci/ehci.c
+++ b/tinyusb/host/ehci/ehci.c
@@ -134,11 +134,11 @@ tusb_error_t hcd_init(void)
memclr_(&ehci_data, sizeof(ehci_data_t));
#if (CFG_TUSB_CONTROLLER_0_MODE & OPT_MODE_HOST)
- ASSERT_ERR (hcd_controller_init(0));
+ TU_ASSERT_ERR (hcd_controller_init(0));
#endif
#if (CFG_TUSB_CONTROLLER_1_MODE & OPT_MODE_HOST)
- ASSERT_ERR (hcd_controller_init(1));
+ TU_ASSERT_ERR (hcd_controller_init(1));
#endif
return TUSB_ERROR_NONE;
@@ -347,7 +347,7 @@ tusb_error_t hcd_pipe_control_close(uint8_t dev_addr)
if (dev_addr != 0)
{
- ASSERT_ERR( list_remove_qhd( (ehci_link_t*) get_async_head( usbh_devices[dev_addr].core_id ),
+ TU_ASSERT_ERR( list_remove_qhd( (ehci_link_t*) get_async_head( usbh_devices[dev_addr].core_id ),
(ehci_link_t*) p_qhd) );
}
@@ -416,7 +416,7 @@ tusb_error_t hcd_pipe_queue_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint
tusb_error_t hcd_pipe_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete)
{
- ASSERT_ERR ( hcd_pipe_queue_xfer(pipe_hdl, buffer, total_bytes) );
+ TU_ASSERT_ERR ( hcd_pipe_queue_xfer(pipe_hdl, buffer, total_bytes) );
ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle(pipe_hdl);
@@ -445,14 +445,14 @@ tusb_error_t hcd_pipe_close(pipe_handle_t pipe_hdl)
if ( pipe_hdl.xfer_type == TUSB_XFER_BULK )
{
- ASSERT_ERR( list_remove_qhd(
+ TU_ASSERT_ERR( list_remove_qhd(
(ehci_link_t*) get_async_head( usbh_devices[pipe_hdl.dev_addr].core_id ),
(ehci_link_t*) p_qhd) );
}
#if EHCI_PERIODIC_LIST // TODO refractor/group this together
else
{
- ASSERT_ERR( list_remove_qhd(
+ TU_ASSERT_ERR( list_remove_qhd(
get_period_head( usbh_devices[pipe_hdl.dev_addr].core_id, p_qhd->interval_ms ),
(ehci_link_t*) p_qhd) );
}
diff --git a/tinyusb/host/ohci/ohci.c b/tinyusb/host/ohci/ohci.c
index e8fa264eb..5788aac94 100644
--- a/tinyusb/host/ohci/ohci.c
+++ b/tinyusb/host/ohci/ohci.c
@@ -484,7 +484,7 @@ static tusb_error_t pipe_queue_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], u
td_insert_to_ed(p_ed, p_gtd);
}else
{
- ASSERT_ERR(TUSB_ERROR_NOT_SUPPORTED_YET);
+ TU_ASSERT_ERR(TUSB_ERROR_NOT_SUPPORTED_YET);
}
return TUSB_ERROR_NONE;
@@ -497,7 +497,7 @@ tusb_error_t hcd_pipe_queue_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint
tusb_error_t hcd_pipe_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete)
{
- ASSERT_ERR( pipe_queue_xfer(pipe_hdl, buffer, total_bytes, true) );
+ TU_ASSERT_ERR( pipe_queue_xfer(pipe_hdl, buffer, total_bytes, true) );
tusb_xfer_type_t xfer_type = ed_get_xfer_type( ed_from_pipe_handle(pipe_hdl) );
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 6e94ccd4e..73e6835ec 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -144,7 +144,7 @@ tusb_error_t usbh_init(void)
{
memclr_(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
- ASSERT_ERR( hcd_init() );
+ TU_ASSERT_ERR( hcd_init() );
//------------- Enumeration & Reporter Task init -------------//
enum_queue_hdl = osal_queue_create( ENUM_QUEUE_DEPTH, sizeof(uint32_t) );
@@ -223,7 +223,7 @@ tusb_error_t usbh_pipe_control_open(uint8_t dev_addr, uint8_t max_packet_size)
osal_semaphore_reset( usbh_devices[dev_addr].control.sem_hdl );
osal_mutex_reset( usbh_devices[dev_addr].control.mutex_hdl );
- ASSERT_ERR( hcd_pipe_control_open(dev_addr, max_packet_size) );
+ TU_ASSERT_ERR( hcd_pipe_control_open(dev_addr, max_packet_size) );
return TUSB_ERROR_NONE;
}
@@ -231,7 +231,7 @@ tusb_error_t usbh_pipe_control_open(uint8_t dev_addr, uint8_t max_packet_size)
static inline tusb_error_t usbh_pipe_control_close(uint8_t dev_addr) ATTR_ALWAYS_INLINE;
static inline tusb_error_t usbh_pipe_control_close(uint8_t dev_addr)
{
- ASSERT_ERR( hcd_pipe_control_close(dev_addr) );
+ TU_ASSERT_ERR( hcd_pipe_control_close(dev_addr) );
return TUSB_ERROR_NONE;
}
diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h
index 93d50699d..7fc747ab9 100644
--- a/tinyusb/osal/osal.h
+++ b/tinyusb/osal/osal.h
@@ -51,8 +51,8 @@
enum
{
- OSAL_TIMEOUT_NOTIMEOUT = 0, // return immediately
- OSAL_TIMEOUT_NORMAL = 10*5, // default is 10 msec, FIXME [CMSIS-RTX] easily timeout with 10 msec
+ OSAL_TIMEOUT_NOTIMEOUT = 0, // return immediately
+ OSAL_TIMEOUT_NORMAL = 100, // default timeout
OSAL_TIMEOUT_WAIT_FOREVER = 0xFFFFFFFFUL
};
diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h
index f8a0ace19..b79816130 100644
--- a/tinyusb/osal/osal_none.h
+++ b/tinyusb/osal/osal_none.h
@@ -119,11 +119,11 @@ static inline osal_task_t osal_task_create(osal_func_t code, const char* name, u
//------------- Sub Task Assert -------------//
#define STASK_RETURN(error) do { TASK_RESTART; return error; } while(0)
-#define STASK_ASSERT_ERR(_err) VERIFY_ERR_HDLR(_err, TASK_RESTART)
-#define STASK_ASSERT_ERR_HDLR(_err, _func) VERIFY_ERR_HDLR(_err, _func; TASK_RESTART )
+#define STASK_ASSERT_ERR(_err) VERIFY_ERR_HDLR(_err, verify_breakpoint(); TASK_RESTART)
+#define STASK_ASSERT_ERR_HDLR(_err, _func) VERIFY_ERR_HDLR(_err, verify_breakpoint(); _func; TASK_RESTART )
-#define STASK_ASSERT(_cond) VERIFY_HDLR(_cond, TASK_RESTART)
-#define STASK_ASSERT_HDLR(_cond, _func) VERIFY_HDLR(_cond, _func; TASK_RESTART)
+#define STASK_ASSERT(_cond) VERIFY_HDLR(_cond, verify_breakpoint(); TASK_RESTART)
+#define STASK_ASSERT_HDLR(_cond, _func) VERIFY_HDLR(_cond, verify_breakpoint(); _func; TASK_RESTART)
//--------------------------------------------------------------------+
// QUEUE API
diff --git a/tinyusb/portable/nxp/lpc17xx/dcd_lpc175x_6x.c b/tinyusb/portable/nxp/lpc17xx/dcd_lpc175x_6x.c
index 09325ab88..18947997f 100644
--- a/tinyusb/portable/nxp/lpc17xx/dcd_lpc175x_6x.c
+++ b/tinyusb/portable/nxp/lpc17xx/dcd_lpc175x_6x.c
@@ -316,10 +316,10 @@ static tusb_error_t pipe_control_xfer(uint8_t ep_id, uint8_t* p_buffer, uint16_t
if (ep_id)
{
- ASSERT_ERR ( pipe_control_write(p_buffer, packet_len) );
+ TU_ASSERT_ERR ( pipe_control_write(p_buffer, packet_len) );
}else
{
- ASSERT_ERR ( pipe_control_read(p_buffer, packet_len) );
+ TU_ASSERT_ERR ( pipe_control_read(p_buffer, packet_len) );
}
dcd_data.control_dma.remaining_bytes -= packet_len;
diff --git a/tinyusb/tusb.c b/tinyusb/tusb.c
index b739ebe2e..dd3be72e4 100644
--- a/tinyusb/tusb.c
+++ b/tinyusb/tusb.c
@@ -46,11 +46,11 @@ tusb_error_t tusb_init(void)
VERIFY( tusb_hal_init(), TUSB_ERROR_FAILED ) ; // hardware init
#if MODE_HOST_SUPPORTED
- ASSERT_ERR( usbh_init() ); // host stack init
+ TU_ASSERT_ERR( usbh_init() ); // host stack init
#endif
#if MODE_DEVICE_SUPPORTED
- ASSERT_ERR ( usbd_init() ); // device stack init
+ TU_ASSERT_ERR ( usbd_init() ); // device stack init
#endif
return TUSB_ERROR_NONE;