summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
authorhathach <[email protected]>2014-03-19 16:50:49 +0700
committerhathach <[email protected]>2014-03-19 16:50:49 +0700
commit61657f6751ce96dd2b0c260729061ac0eb2adab4 (patch)
treeca36ec255a8e7a1e38393cca2e2151bf6112011f /tinyusb
parente8138df6a3ffab99fa75ced7d03534d65a2aadaf (diff)
change OSAL_TASK_FUNCTION to adapt with cmsis rtx
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/device/usbd.c2
-rw-r--r--tinyusb/device/usbd.h2
-rw-r--r--tinyusb/host/usbh.c2
-rw-r--r--tinyusb/host/usbh.h2
-rw-r--r--tinyusb/osal/osal.h17
-rw-r--r--tinyusb/osal/osal_cmsis_rtx.h2
-rw-r--r--tinyusb/osal/osal_common.h8
-rw-r--r--tinyusb/osal/osal_freeRTOS.h2
-rw-r--r--tinyusb/osal/osal_none.h3
9 files changed, 25 insertions, 15 deletions
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index a9ed82e2d..b64b25f4a 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -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
diff --git a/tinyusb/device/usbd.h b/tinyusb/device/usbd.h
index 684d2fbed..48574fddc 100644
--- a/tinyusb/device/usbd.h
+++ b/tinyusb/device/usbd.h
@@ -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
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 7653affba..1ff9d365e 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -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
diff --git a/tinyusb/host/usbh.h b/tinyusb/host/usbh.h
index 467ab6e95..efddfbeb9 100644
--- a/tinyusb/host/usbh.h
+++ b/tinyusb/host/usbh.h
@@ -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,
diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h
index 4bb28c1fb..d5faba68e 100644
--- a/tinyusb/osal/osal.h
+++ b/tinyusb/osal/osal.h
@@ -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 -------------//
diff --git a/tinyusb/osal/osal_cmsis_rtx.h b/tinyusb/osal/osal_cmsis_rtx.h
index c65dc911c..3e6297eeb 100644
--- a/tinyusb/osal/osal_cmsis_rtx.h
+++ b/tinyusb/osal/osal_cmsis_rtx.h
@@ -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) \
diff --git a/tinyusb/osal/osal_common.h b/tinyusb/osal/osal_common.h
index 3f1bfe08e..4c551126c 100644
--- a/tinyusb/osal/osal_common.h
+++ b/tinyusb/osal/osal_common.h
@@ -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)
{
diff --git a/tinyusb/osal/osal_freeRTOS.h b/tinyusb/osal/osal_freeRTOS.h
index 5a904736f..3a99589d0 100644
--- a/tinyusb/osal/osal_freeRTOS.h
+++ b/tinyusb/osal/osal_freeRTOS.h
@@ -64,6 +64,8 @@ extern "C" {
//--------------------------------------------------------------------+
// TASK API
//--------------------------------------------------------------------+
+#define OSAL_TASK_FUNCTION portTASK_FUNCTION
+
typedef struct {
char const * name;
pdTASK_CODE code;
diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h
index 0d4bee1b1..435493586 100644
--- a/tinyusb/osal/osal_none.h
+++ b/tinyusb/osal/osal_none.h
@@ -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