change OSAL_TASK_FUNCTION to adapt with cmsis rtx
This commit is contained in:
@@ -225,7 +225,7 @@ tusb_error_t usbd_control_request_subtask(uint8_t coreid, tusb_control_request_t
|
||||
// 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(usbd_task) (void* p_task_para)
|
||||
OSAL_TASK_FUNCTION(usbd_task, p_task_para)
|
||||
{
|
||||
OSAL_TASK_LOOP_BEGIN
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ bool tusbd_is_configured(uint8_t coreid) ATTR_WARN_UNUSED_RESULT;
|
||||
extern osal_semaphore_handle_t usbd_control_xfer_sem_hdl;
|
||||
|
||||
tusb_error_t usbd_init(void);
|
||||
OSAL_TASK_FUNCTION (usbd_task) (void* p_task_para);
|
||||
OSAL_TASK_FUNCTION (usbd_task, p_task_para);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ static 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) (void* p_task_para)
|
||||
OSAL_TASK_FUNCTION(usbh_enumeration_task, p_task_para)
|
||||
{
|
||||
(void) p_task_para; // suppress compiler warnings
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ ATTR_WEAK void tusbh_device_mount_failed_cb(tusb_error_t error, tusb_descript
|
||||
#ifdef _TINY_USB_SOURCE_FILE_
|
||||
|
||||
|
||||
OSAL_TASK_FUNCTION (usbh_enumeration_task) (void* p_task_para);
|
||||
OSAL_TASK_FUNCTION (usbh_enumeration_task, p_task_para);
|
||||
tusb_error_t usbh_init(void);
|
||||
|
||||
tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType, uint8_t bRequest,
|
||||
|
||||
@@ -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 -------------//
|
||||
|
||||
@@ -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) \
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -64,6 +64,8 @@ extern "C" {
|
||||
//--------------------------------------------------------------------+
|
||||
// TASK API
|
||||
//--------------------------------------------------------------------+
|
||||
#define OSAL_TASK_FUNCTION portTASK_FUNCTION
|
||||
|
||||
typedef struct {
|
||||
char const * name;
|
||||
pdTASK_CODE code;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user