clean up osal task and subtask

This commit is contained in:
hathach
2018-08-30 15:21:15 +07:00
parent 61e4a8c3d3
commit 4ef01d721a
3 changed files with 18 additions and 20 deletions

View File

@@ -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) \