summaryrefslogtreecommitdiff
path: root/tinyusb/osal
diff options
context:
space:
mode:
Diffstat (limited to 'tinyusb/osal')
-rw-r--r--tinyusb/osal/osal.h6
-rw-r--r--tinyusb/osal/osal_freeRTOS.h10
-rw-r--r--tinyusb/osal/osal_none.h4
3 files changed, 15 insertions, 5 deletions
diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h
index cc6b7f700..d2287b3a5 100644
--- a/tinyusb/osal/osal.h
+++ b/tinyusb/osal/osal.h
@@ -89,9 +89,11 @@ uint32_t osal_tick_get(void);
typedef uint32_t osal_task_t;
tusb_error_t osal_task_create(osal_task_t *task);
-#define OSAL_TASK_DEF(variable, name, code, stack_depth, prio) \
+#define OSAL_TASK_DEF(code, stack_depth, prio) \
osal_task_t variable
+#define OSAL_TASK_REF(name) (&name)
+
#define OSAL_TASK_FUNCTION(task_name) \
void task_name
@@ -176,6 +178,8 @@ typedef osal_queue_t * osal_queue_handle_t;
#define OSAL_QUEUE_DEF(name, queue_depth, type) \
osal_queue_t name
+#define OSAL_QUEUE_REF(name) (&name)
+
osal_queue_handle_t osal_queue_create (osal_queue_t *p_queue);
void osal_queue_receive (osal_queue_handle_t const queue_hdl, void *p_data, uint32_t msec, tusb_error_t *p_error);
tusb_error_t osal_queue_send (osal_queue_handle_t const queue_hdl, const void * data);
diff --git a/tinyusb/osal/osal_freeRTOS.h b/tinyusb/osal/osal_freeRTOS.h
index 8bdd58cd8..add9292f0 100644
--- a/tinyusb/osal/osal_freeRTOS.h
+++ b/tinyusb/osal/osal_freeRTOS.h
@@ -82,14 +82,16 @@ typedef struct {
unsigned portBASE_TYPE prio;
} osal_task_t;
-#define OSAL_TASK_DEF(task_variable, task_name, task_code, task_stack_depth, task_prio) \
- osal_task_t task_variable = {\
- .name = task_name , \
+#define OSAL_TASK_DEF(task_code, task_stack_depth, task_prio) \
+ osal_task_t osal_task_def_##task_code = {\
+ .name = #task_code , \
.code = task_code , \
.stack_depth = task_stack_depth , \
.prio = task_prio \
}
+#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)
{
@@ -208,6 +210,8 @@ typedef xQueueHandle osal_queue_handle_t;
.item_size = sizeof(type)\
}
+#define OSAL_QUEUE_REF(name) (&name)
+
#define osal_queue_create(p_queue) \
xQueueCreate((p_queue)->depth, (p_queue)->item_size)
diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h
index acc5bdb07..7a5b2ff78 100644
--- a/tinyusb/osal/osal_none.h
+++ b/tinyusb/osal/osal_none.h
@@ -88,7 +88,7 @@ static inline uint32_t osal_tick_get(void)
// OSAL_TASK_LOOP_ENG
// }
//--------------------------------------------------------------------+
-#define OSAL_TASK_DEF(variable, name, code, stack_depth, prio)
+#define OSAL_TASK_DEF(code, stack_depth, prio)
#define osal_task_create(x) TUSB_ERROR_NONE
#define OSAL_TASK_FUNCTION(task_func) \
@@ -267,6 +267,8 @@ typedef osal_queue_t * osal_queue_handle_t;
.item_size = sizeof(type)\
}
+#define OSAL_QUEUE_REF(name) (&name)
+
static inline osal_queue_handle_t osal_queue_create(osal_queue_t * const p_queue) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline osal_queue_handle_t osal_queue_create(osal_queue_t * const p_queue)
{