merge common define in osal/osal_cmsis_rtx.h & osal/osal_freeRTOS.h
This commit is contained in:
@@ -70,6 +70,38 @@
|
||||
#include "osal_none.h"
|
||||
#else
|
||||
#define OSAL_VAR
|
||||
#define OSAL_TASK_FUNCTION(task_func) void task_func
|
||||
#define OSAL_TASK_LOOP_BEGIN \
|
||||
while(1) {
|
||||
|
||||
#define OSAL_TASK_LOOP_END \
|
||||
}
|
||||
|
||||
//------------- Sub Task -------------//
|
||||
#define OSAL_SUBTASK_BEGIN // TODO refractor move
|
||||
#define OSAL_SUBTASK_END \
|
||||
return TUSB_ERROR_NONE;
|
||||
|
||||
#define SUBTASK_EXIT(error) return error;
|
||||
|
||||
#define OSAL_SUBTASK_INVOKED_AND_WAIT(subtask, status) \
|
||||
status = subtask
|
||||
|
||||
//------------- Sub Task Assert -------------//
|
||||
#define SUBTASK_ASSERT_STATUS(sts) ASSERT_STATUS(sts)
|
||||
#define SUBTASK_ASSERT(condition) ASSERT(condition, TUSB_ERROR_OSAL_TASK_FAILED)
|
||||
|
||||
#define _SUBTASK_ASSERT_ERROR_HANDLER(error, func_call)\
|
||||
func_call; return error
|
||||
|
||||
#define SUBTASK_ASSERT_STATUS_WITH_HANDLER(sts, func_call) \
|
||||
ASSERT_DEFINE_WITH_HANDLER(_SUBTASK_ASSERT_ERROR_HANDLER, func_call, tusb_error_t status = (tusb_error_t)(sts),\
|
||||
TUSB_ERROR_NONE == status, status, "%s", TUSB_ErrorStr[status])
|
||||
|
||||
#define SUBTASK_ASSERT_WITH_HANDLER(condition, func_call) \
|
||||
ASSERT_DEFINE_WITH_HANDLER(_SUBTASK_ASSERT_ERROR_HANDLER, func_call, ,\
|
||||
condition, TUSB_ERROR_OSAL_TASK_FAILED, "%s", "evaluated to false")
|
||||
|
||||
#if TUSB_CFG_OS == TUSB_OS_FREERTOS
|
||||
#include "osal_freeRTOS.h"
|
||||
#elif TUSB_CFG_OS == TUSB_OS_CMSIS_RTX
|
||||
|
||||
Reference in New Issue
Block a user