summaryrefslogtreecommitdiff
path: root/src/osal
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-11-14 16:31:28 +0700
committerhathach <[email protected]>2018-11-14 16:31:28 +0700
commit10bf41f718ea867a3621e11b4c49e72605bbcc89 (patch)
tree788f3613c3a2c0ec500dda16fcb7ae5ed2062513 /src/osal
parent5732be224c69c35efdc44f250e83e42cf52e2526 (diff)
change osal_queue_receive() signature
- fix build issue with freertos
Diffstat (limited to 'src/osal')
-rw-r--r--src/osal/osal.h7
-rw-r--r--src/osal/osal_freertos.h5
-rw-r--r--src/osal/osal_none.h11
3 files changed, 9 insertions, 14 deletions
diff --git a/src/osal/osal.h b/src/osal/osal.h
index 2ca06f66e..6846b5757 100644
--- a/src/osal/osal.h
+++ b/src/osal/osal.h
@@ -62,10 +62,6 @@ typedef void (*osal_task_func_t)( void * );
#if CFG_TUSB_OS == OPT_OS_NONE
#include "osal_none.h"
-
- #define OSAL_TASK_BEGIN
- #define OSAL_TASK_END
-
#else
/* RTOS Porting API
*
@@ -105,8 +101,7 @@ typedef void (*osal_task_func_t)( void * );
#error CFG_TUSB_OS is not defined or OS is not supported yet
#endif
- #define OSAL_TASK_BEGIN while(1) {
- #define OSAL_TASK_END }
+ // TODO remove subtask related macros later
//------------- Sub Task -------------//
#define OSAL_SUBTASK_BEGIN
diff --git a/src/osal/osal_freertos.h b/src/osal/osal_freertos.h
index f29759225..52cadd798 100644
--- a/src/osal/osal_freertos.h
+++ b/src/osal/osal_freertos.h
@@ -159,10 +159,9 @@ static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef)
return xQueueCreateStatic(qdef->depth, qdef->item_sz, (uint8_t*) qdef->buf, &qdef->sq);
}
-static inline void osal_queue_receive (osal_queue_t const queue_hdl, void *p_data, uint32_t msec, uint32_t *err)
+static inline bool osal_queue_receive(osal_queue_t const queue_hdl, void* data)
{
- uint32_t const ticks = (msec == OSAL_TIMEOUT_WAIT_FOREVER) ? portMAX_DELAY : pdMS_TO_TICKS(msec);
- (*err) = ( xQueueReceive(queue_hdl, p_data, ticks) ? TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TIMEOUT);
+ return xQueueReceive(queue_hdl, data, portMAX_DELAY);
}
static inline bool osal_queue_send(osal_queue_t const queue_hdl, void const * data, bool in_isr)
diff --git a/src/osal/osal_none.h b/src/osal/osal_none.h
index 383809180..5ba246d5f 100644
--- a/src/osal/osal_none.h
+++ b/src/osal/osal_none.h
@@ -89,6 +89,7 @@ static inline osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t* semde
static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr)
{
+ (void) in_isr;
sem_hdl->count++;
return true;
}
@@ -157,11 +158,11 @@ static inline void osal_queue_reset(osal_queue_t const queue_hdl)
queue_hdl->count = queue_hdl->rd_idx = queue_hdl->wr_idx = 0;
}
-static inline tusb_error_t osal_queue_receive(osal_queue_t const queue_hdl, void* data) {
- if (!tu_fifo_read(queue_hdl, data)) {
- return TUSB_ERROR_OSAL_WAITING;
- }
- return TUSB_ERROR_NONE;
+
+static inline bool osal_queue_receive(osal_queue_t const queue_hdl, void* data)
+{
+ // osal none return immediately without blocking
+ return tu_fifo_read(queue_hdl, data);
}