summaryrefslogtreecommitdiff
path: root/tinyusb/host
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-04-24 13:45:42 +0700
committerhathach <[email protected]>2013-04-24 13:45:42 +0700
commit574710dde57a466d0fee6d8b3ccb0366eb64deba (patch)
tree0f17789e987e2681d64ebc0c8525e185f2be8ce5 /tinyusb/host
parentd312be700636258060765b63a5ea4f73aaa5500a (diff)
move main work in usbh_enumeration_task to its body subtask for task_assert style
Diffstat (limited to 'tinyusb/host')
-rw-r--r--tinyusb/host/usbh.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index f366c9adc..8e525cdf5 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -249,8 +249,22 @@ void usbh_device_unplugged_isr(uint8_t hostid)
//--------------------------------------------------------------------+
// ENUMERATION TASK
//--------------------------------------------------------------------+
+tusb_error_t enumeration_body_subtask(void);
+
+// To enable the TASK_ASSERT style (quick return on false condition) in a real RTOS, a task must act as a wrapper
+// and is used mainly to call subtasks. Within a subtask return statement can be called freely, the task with
+// forever loop cannot have any return at all.
OSAL_TASK_FUNCTION(usbh_enumeration_task)
{
+ OSAL_TASK_LOOP_BEGIN
+
+ enumeration_body_subtask();
+
+ OSAL_TASK_LOOP_END
+}
+
+tusb_error_t enumeration_body_subtask(void)
+{
tusb_error_t error;
usbh_enumerate_t enum_entry;
@@ -259,7 +273,7 @@ OSAL_TASK_FUNCTION(usbh_enumeration_task)
static uint8_t configure_selected = 1; // TODO move
static uint8_t *p_desc = NULL; // TODO move
- OSAL_TASK_LOOP_BEGIN
+ OSAL_SUBTASK_BEGIN
osal_queue_receive(enum_queue_hdl, &enum_entry, OSAL_TIMEOUT_WAIT_FOREVER, &error);
@@ -444,7 +458,7 @@ OSAL_TASK_FUNCTION(usbh_enumeration_task)
tusbh_device_mount_succeed_cb(new_addr);
- OSAL_TASK_LOOP_END
+ OSAL_SUBTASK_END
}
//--------------------------------------------------------------------+