change OSAL_TASK_FUNCTION to adapt with cmsis rtx

This commit is contained in:
hathach
2014-03-19 16:50:49 +07:00
parent e8138df6a3
commit 61657f6751
35 changed files with 200 additions and 195 deletions

View File

@@ -66,8 +66,15 @@
#include "osal_none.h"
#else
#if TUSB_CFG_OS == TUSB_OS_FREERTOS
#include "osal_freeRTOS.h"
#elif TUSB_CFG_OS == TUSB_OS_CMSIS_RTX
#include "osal_cmsis_rtx.h"
#else
#error TUSB_CFG_OS is not defined or OS is not supported yet
#endif
#define OSAL_VAR
#define OSAL_TASK_FUNCTION(task_func) void task_func
#define OSAL_TASK_LOOP_BEGIN \
while(1) {
@@ -98,14 +105,6 @@
#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
#include "osal_cmsis_rtx.h"
#else
#error TUSB_CFG_OS is not defined or OS is not supported yet
#endif
#endif
//------------- OSAL API for cmock -------------//

View File

@@ -59,6 +59,8 @@
//--------------------------------------------------------------------+
// TASK API
//--------------------------------------------------------------------+
#define OSAL_TASK_FUNCTION(task_func, p_para) void task_func(void const * p_para)
typedef osThreadDef_t osal_task_t;
#define OSAL_TASK_DEF(task_code, task_stack_depth, task_prio) \

View File

@@ -52,6 +52,10 @@
#include "common/common.h"
#ifdef __CC_ARM
#pragma diag_suppress 66 // Suppress Keil warnings #66-D: enumeration value is out of "int" range
#endif
enum
{
OSAL_TIMEOUT_NOTIMEOUT = 0, // for use within ISR, return immediately
@@ -59,6 +63,10 @@ enum
OSAL_TIMEOUT_WAIT_FOREVER = 0xFFFFFFFF
};
#ifdef __CC_ARM
#pragma diag_default 66 // return Keil 66 to normal severity
#endif
static inline uint32_t osal_tick_from_msec(uint32_t msec) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint32_t osal_tick_from_msec(uint32_t msec)
{

View File

@@ -64,6 +64,8 @@ extern "C" {
//--------------------------------------------------------------------+
// TASK API
//--------------------------------------------------------------------+
#define OSAL_TASK_FUNCTION portTASK_FUNCTION
typedef struct {
char const * name;
pdTASK_CODE code;

View File

@@ -77,8 +77,7 @@ uint32_t tusb_tick_get(void);
#define OSAL_TASK_REF
#define osal_task_create(x) TUSB_ERROR_NONE
#define OSAL_TASK_FUNCTION(task_func) \
tusb_error_t task_func
#define OSAL_TASK_FUNCTION(task_func, p_para) tusb_error_t task_func(void * p_para)
#define TASK_RESTART \
state = 0