diff options
| author | hathach <[email protected]> | 2018-02-28 14:21:31 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-02-28 14:21:43 +0700 |
| commit | 9b7cd608aa4addf40cbe2135b38a78378e6f428f (patch) | |
| tree | 5233a0c8244bd1d477471ccd8cb69528c8b40660 /tinyusb/osal | |
| parent | 5efad7412ffef0bb7eb08beea29b3b06b04cfb6e (diff) | |
osal clean up
- task create, task def macros
Diffstat (limited to 'tinyusb/osal')
| -rw-r--r-- | tinyusb/osal/osal.h | 6 | ||||
| -rw-r--r-- | tinyusb/osal/osal_freeRTOS.h | 13 | ||||
| -rw-r--r-- | tinyusb/osal/osal_none.h | 11 |
3 files changed, 16 insertions, 14 deletions
diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h index fbc798213..9c136d4d9 100644 --- a/tinyusb/osal/osal.h +++ b/tinyusb/osal/osal.h @@ -56,9 +56,15 @@ /** @} */
#include "tusb_option.h"
+#include "common/common.h"
#ifndef _TEST_
+typedef void (*osal_func_t)(void *param);
+typedef void* osal_task_t;
+
+static inline bool osal_task_create(osal_func_t code, const char* name, uint32_t stack_size, void* param, uint32_t prio, osal_task_t* task_hdl);
+
#if TUSB_CFG_OS == TUSB_OS_NONE
#include "osal_none.h"
diff --git a/tinyusb/osal/osal_freeRTOS.h b/tinyusb/osal/osal_freeRTOS.h index 26e7743be..a8d6a9a46 100644 --- a/tinyusb/osal/osal_freeRTOS.h +++ b/tinyusb/osal/osal_freeRTOS.h @@ -66,13 +66,6 @@ extern "C" { //--------------------------------------------------------------------+ #define OSAL_TASK_FUNCTION portTASK_FUNCTION -typedef struct { - char const * name; - pdTASK_CODE code; - unsigned portSHORT stack_depth; - unsigned portBASE_TYPE prio; -} osal_task_t; - #define OSAL_TASK_DEF(task_code, task_stack_depth, task_prio) \ osal_task_t osal_task_def_##task_code = {\ .name = #task_code , \ @@ -83,11 +76,9 @@ typedef struct { #define OSAL_TASK_REF(name) (&osal_task_def_##name) -static inline tusb_error_t osal_task_create(osal_task_t *task) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; -static inline tusb_error_t osal_task_create(osal_task_t *task) +static inline bool osal_task_create(osal_func_t code, const char* name, uint32_t stack_size, void* param, uint32_t prio, osal_task_t* task_hdl) { - return pdPASS == xTaskCreate(task->code, (signed portCHAR const *) task->name, task->stack_depth, NULL, task->prio, NULL) ? - TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TASK_CREATE_FAILED; + return xTaskCreate(code, (const signed char*) name, stack_size, param, prio, task_hdl); } static inline void osal_task_delay(uint32_t msec) ATTR_ALWAYS_INLINE; diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index f927f1707..5701797cc 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -70,8 +70,13 @@ uint32_t tusb_tick_get(void); // }
//--------------------------------------------------------------------+
#define OSAL_TASK_DEF(code, stack_depth, prio)
-#define OSAL_TASK_REF
-#define osal_task_create(x) TUSB_ERROR_NONE
+
+
+static inline bool osal_task_create(osal_func_t code, const char* name, uint32_t stack_size, void* param, uint32_t prio, osal_task_t* task_hdl)
+{
+ (void) code; (void) name; (void) stack_size; (void) param; (void) prio; (void) task_hdl;
+ return true;
+}
#define OSAL_TASK_FUNCTION(task_func, p_para) tusb_error_t task_func(void * p_para)
@@ -89,7 +94,7 @@ uint32_t tusb_tick_get(void); default:\
TASK_RESTART;\
}}\
- return TUSB_ERROR_NONE;
+ return /*TUSB_ERROR_NONE*/;
#define osal_task_delay(msec) \
|
