summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2014-04-24 23:57:21 +0700
committerhathach <[email protected]>2014-04-24 23:57:21 +0700
commitdbf276ad6f9852f8da7dd9bc8b9e1a74ee17b267 (patch)
tree0f83836c0d7fceb35b1b742856f9512e5b504db2
parent6804fee0fa571907f9311cce4f5e65aaa569dd1a (diff)
added all assert check to osal_queue_send and osal_semaphore_post
-rw-r--r--demos/device/src/cdc_device_app.c2
-rw-r--r--demos/host/src/cdc_serial_host_app.c2
-rw-r--r--demos/host/src/keyboard_host_app.c2
-rw-r--r--demos/host/src/mouse_host_app.c2
-rw-r--r--tinyusb/class/msc_host.c2
-rw-r--r--tinyusb/device/usbd.c2
-rw-r--r--tinyusb/host/usbh.c45
-rw-r--r--tinyusb/osal/osal_cmsis_rtx.h2
8 files changed, 32 insertions, 27 deletions
diff --git a/demos/device/src/cdc_device_app.c b/demos/device/src/cdc_device_app.c
index f7ef8e58c..3f23d51cd 100644
--- a/demos/device/src/cdc_device_app.c
+++ b/demos/device/src/cdc_device_app.c
@@ -91,7 +91,7 @@ void tusbd_cdc_xfer_cb(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id,
{
fifo_write(&fifo_serial, serial_rx_buffer+i);
}
- osal_semaphore_post(sem_hdl); // notify main task
+ (void) osal_semaphore_post(sem_hdl); // notify main task
break;
case TUSB_EVENT_XFER_ERROR:
diff --git a/demos/host/src/cdc_serial_host_app.c b/demos/host/src/cdc_serial_host_app.c
index 0176feb5f..eb000f65d 100644
--- a/demos/host/src/cdc_serial_host_app.c
+++ b/demos/host/src/cdc_serial_host_app.c
@@ -88,7 +88,7 @@ void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_
{
case TUSB_EVENT_XFER_COMPLETE:
received_bytes = xferred_bytes;
- osal_semaphore_post(sem_hdl); // notify main task
+ (void) osal_semaphore_post(sem_hdl); // notify main task
break;
case TUSB_EVENT_XFER_ERROR:
diff --git a/demos/host/src/keyboard_host_app.c b/demos/host/src/keyboard_host_app.c
index 2ba0296c0..3903e581c 100644
--- a/demos/host/src/keyboard_host_app.c
+++ b/demos/host/src/keyboard_host_app.c
@@ -85,7 +85,7 @@ void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event)
switch(event)
{
case TUSB_EVENT_XFER_COMPLETE:
- osal_queue_send(queue_kbd_hdl, &usb_keyboard_report);
+ (void) osal_queue_send(queue_kbd_hdl, &usb_keyboard_report);
tusbh_hid_keyboard_get_report(dev_addr, (uint8_t*) &usb_keyboard_report);
break;
diff --git a/demos/host/src/mouse_host_app.c b/demos/host/src/mouse_host_app.c
index 1c811b62c..5b809d70c 100644
--- a/demos/host/src/mouse_host_app.c
+++ b/demos/host/src/mouse_host_app.c
@@ -84,7 +84,7 @@ void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event)
switch(event)
{
case TUSB_EVENT_XFER_COMPLETE:
- osal_queue_send(queue_mouse_hdl, &usb_mouse_report);
+ (void) osal_queue_send(queue_mouse_hdl, &usb_mouse_report);
(void) tusbh_hid_mouse_get_report(dev_addr, (uint8_t*) &usb_mouse_report);
break;
diff --git a/tinyusb/class/msc_host.c b/tinyusb/class/msc_host.c
index e3eaf7993..9dc86e939 100644
--- a/tinyusb/class/msc_host.c
+++ b/tinyusb/class/msc_host.c
@@ -408,7 +408,7 @@ void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes
tusbh_msc_isr(pipe_hdl.dev_addr, event, xferred_bytes);
}else
{ // still initializing under open subtask
- osal_semaphore_post(msch_sem_hdl);
+ ASSERT( TUSB_ERROR_NONE == osal_semaphore_post(msch_sem_hdl), VOID_RETURN );
}
}
}
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index 6200113b6..61a9ab636 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -431,7 +431,7 @@ void usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xfer
{
if (edpt_hdl.class_code == 0 ) // Control Transfer
{
- osal_semaphore_post( usbd_control_xfer_sem_hdl );
+ ASSERT( TUSB_ERROR_NONE == osal_semaphore_post( usbd_control_xfer_sem_hdl ), VOID_RETURN);
}else
{
usbd_task_event_t task_event =
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index b36fa7cd1..5504e9602 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -253,7 +253,7 @@ void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t even
{
usbh_devices[ pipe_hdl.dev_addr ].control.pipe_status = event;
// usbh_devices[ pipe_hdl.dev_addr ].control.xferred_bytes = xferred_bytes; not yet neccessary
- osal_semaphore_post( usbh_devices[ pipe_hdl.dev_addr ].control.sem_hdl );
+ ASSERT( TUSB_ERROR_NONE == osal_semaphore_post( usbh_devices[ pipe_hdl.dev_addr ].control.sem_hdl ), VOID_RETURN);
}else if (usbh_class_drivers[class_index].isr)
{
usbh_class_drivers[class_index].isr(pipe_hdl, event, xferred_bytes);
@@ -265,22 +265,26 @@ void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t even
void usbh_hub_port_plugged_isr(uint8_t hub_addr, uint8_t hub_port)
{
- osal_queue_send(enum_queue_hdl,
- &(usbh_enumerate_t){
- .core_id = usbh_devices[hub_addr].core_id,
- .hub_addr = hub_addr,
- .hub_port = hub_port}
- );
+ usbh_enumerate_t enum_entry =
+ {
+ .core_id = usbh_devices[hub_addr].core_id,
+ .hub_addr = hub_addr,
+ .hub_port = hub_port
+ };
+
+ ASSERT( TUSB_ERROR_NONE == osal_queue_send(enum_queue_hdl, &enum_entry), VOID_RETURN );
}
void usbh_hcd_rhport_plugged_isr(uint8_t hostid)
{
- osal_queue_send(enum_queue_hdl,
- &(usbh_enumerate_t){
- .core_id = hostid,
- .hub_addr = 0,
- .hub_port = 0}
- );
+ usbh_enumerate_t enum_entry =
+ {
+ .core_id = hostid,
+ .hub_addr = 0,
+ .hub_port = 0
+ };
+
+ ASSERT( TUSB_ERROR_NONE == osal_queue_send(enum_queue_hdl, &enum_entry), VOID_RETURN );
}
// a device unplugged on hostid, hub_addr, hub_port
@@ -325,13 +329,14 @@ static void usbh_device_unplugged(uint8_t hostid, uint8_t hub_addr, uint8_t hub_
void usbh_hcd_rhport_unplugged_isr(uint8_t hostid)
{
- osal_queue_send(enum_queue_hdl,
- &(usbh_enumerate_t)
- {
- .core_id = hostid,
- .hub_addr = 0,
- .hub_port = 0
- } );
+ usbh_enumerate_t enum_entry =
+ {
+ .core_id = hostid,
+ .hub_addr = 0,
+ .hub_port = 0
+ };
+
+ ASSERT( TUSB_ERROR_NONE == osal_queue_send(enum_queue_hdl, &enum_entry), VOID_RETURN );
}
//--------------------------------------------------------------------+
diff --git a/tinyusb/osal/osal_cmsis_rtx.h b/tinyusb/osal/osal_cmsis_rtx.h
index 57f015d82..62a1ec4ff 100644
--- a/tinyusb/osal/osal_cmsis_rtx.h
+++ b/tinyusb/osal/osal_cmsis_rtx.h
@@ -182,7 +182,7 @@ static inline void osal_queue_receive (osal_queue_handle_t const queue_hdl, void
}
}
-static inline tusb_error_t osal_queue_send(osal_queue_handle_t const queue_hdl, void const * data) ATTR_ALWAYS_INLINE;
+static inline tusb_error_t osal_queue_send(osal_queue_handle_t const queue_hdl, void const * data) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline tusb_error_t osal_queue_send(osal_queue_handle_t const queue_hdl, void const * data)
{
void *p_buf = osMailAlloc(queue_hdl->pool, 0); // instantly return in case of sending within ISR (mostly used)