summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-08-30 15:21:15 +0700
committerhathach <[email protected]>2018-08-30 15:21:15 +0700
commit4ef01d721ad6b49775f067d89faa5545d918f32f (patch)
tree9146288783d363caec34eb064176a879674015a9 /src
parent61e4a8c3d34994f47ae7380217af4dbefef4aab9 (diff)
clean up osal task and subtask
Diffstat (limited to 'src')
-rw-r--r--src/device/usbd.c9
-rw-r--r--src/osal/osal.h4
-rw-r--r--src/osal/osal_none.h25
3 files changed, 18 insertions, 20 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 8f1f6be90..2f760808b 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -107,7 +107,7 @@ static usbd_class_driver_t const usbd_class_drivers[] =
.open = cdcd_open,
.control_req_st = cdcd_control_request_st,
.xfer_cb = cdcd_xfer_cb,
- .sof = cdcd_sof,
+ .sof = NULL,
.reset = cdcd_reset
},
#endif
@@ -250,6 +250,9 @@ tusb_error_t usbd_init (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.
+
+// Within tinyusb stack, all task's code must be placed in subtask to be able to support multiple RTOS
+// including none.
void usbd_task( void* param)
{
(void) param;
@@ -306,7 +309,7 @@ static tusb_error_t usbd_main_st(void)
}
else
{
- STASK_ASSERT(false);
+ verify_breakpoint();
}
}
@@ -577,7 +580,7 @@ void dcd_bus_event(uint8_t rhport, usbd_bus_event_type_t bus_event)
case USBD_BUS_EVENT_SOF:
{
- #if CFG_TUD_CDC_FLUSH_ON_SOF
+ #if 0
usbd_task_event_t task_event =
{
.rhport = rhport,
diff --git a/src/osal/osal.h b/src/osal/osal.h
index 3e0d9d5f1..16dc8da27 100644
--- a/src/osal/osal.h
+++ b/src/osal/osal.h
@@ -61,8 +61,10 @@ enum
typedef void (*osal_task_func_t)( void * );
#if CFG_TUSB_OS == OPT_OS_NONE
- #include "osal_none.h"
+ #define OSAL_TASK_BEGIN
+ #define OSAL_TASK_END
+ #include "osal_none.h"
#else
#if CFG_TUSB_OS == OPT_OS_FREERTOS
#include "osal_freeRTOS.h"
diff --git a/src/osal/osal_none.h b/src/osal/osal_none.h
index 3531686b4..012de9c78 100644
--- a/src/osal/osal_none.h
+++ b/src/osal/osal_none.h
@@ -79,18 +79,6 @@ static inline osal_task_t osal_task_create(osal_task_def_t* taskdef)
#define TASK_RESTART \
_state = 0
-#define OSAL_TASK_BEGIN \
- static uint16_t _state = 0; \
- ATTR_UNUSED static uint32_t _timeout = 0; \
- (void) _timeout; \
- switch(_state) { \
- case 0: {
-
-#define OSAL_TASK_END \
- default: TASK_RESTART; break; \
- }} \
- return;
-
#define osal_task_delay(msec) \
do { \
_timeout = tusb_hal_millis(); \
@@ -102,11 +90,16 @@ static inline osal_task_t osal_task_create(osal_task_def_t* taskdef)
//--------------------------------------------------------------------+
// SUBTASK (a sub function that uses OS blocking services & called by a task
//--------------------------------------------------------------------+
-#define OSAL_SUBTASK_BEGIN OSAL_TASK_BEGIN
+#define OSAL_SUBTASK_BEGIN \
+ static uint16_t _state = 0; \
+ ATTR_UNUSED static uint32_t _timeout = 0; \
+ (void) _timeout; \
+ switch(_state) { \
+ case 0: {
-#define OSAL_SUBTASK_END \
- default: TASK_RESTART; break; \
- }} \
+#define OSAL_SUBTASK_END \
+ default: TASK_RESTART; break; \
+ }} \
return TUSB_ERROR_NONE;
#define STASK_INVOKE(_subtask, _status) \