summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/osal/osal_freeRTOS.h26
-rw-r--r--tinyusb/osal/osal_none.h8
2 files changed, 30 insertions, 4 deletions
diff --git a/tinyusb/osal/osal_freeRTOS.h b/tinyusb/osal/osal_freeRTOS.h
index 180bff72e..4d89a1acc 100644
--- a/tinyusb/osal/osal_freeRTOS.h
+++ b/tinyusb/osal/osal_freeRTOS.h
@@ -56,7 +56,11 @@
#endif
#include "osal_common.h"
+
+//------------- FreeRTOS Headers -------------//
#include "FreeRTOS.h"
+#include "semphr.h"
+#include "queue.h"
//--------------------------------------------------------------------+
// TICK API
@@ -78,7 +82,29 @@
//--------------------------------------------------------------------+
// Semaphore API
//--------------------------------------------------------------------+
+#define OSAL_SEM_DEF(name)
+typedef xSemaphoreHandle osal_semaphore_handle_t;
+
+// create FreeRTOS binary semaphore with zero as init value
+#define osal_semaphore_create(x) \
+ xQueueGenericCreate( ( unsigned portBASE_TYPE ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
+
+//--------------------------------------------------------------------+
+// QUEUE API
+//--------------------------------------------------------------------+
+typedef struct{
+ uint8_t const depth ; ///< buffer size
+} osal_queue_t;
+
+typedef xQueueHandle osal_queue_handle_t;
+
+#define OSAL_QUEUE_DEF(name, queue_depth, type)\
+ osal_queue_t name = {\
+ .depth = queue_depth\
+ }
+#define osal_queue_create(p_queue) \
+ xQueueCreate((p_queue)->depth, sizeof(uint32_t))
#ifdef __cplusplus
}
diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h
index adcc22ed9..fafaadc3f 100644
--- a/tinyusb/osal/osal_none.h
+++ b/tinyusb/osal/osal_none.h
@@ -142,10 +142,10 @@ static inline tusb_error_t osal_semaphore_post(osal_semaphore_handle_t const se
//--------------------------------------------------------------------+
typedef struct{
uint32_t * const buffer ; ///< buffer pointer
- uint16_t const depth ; ///< buffer size
- volatile uint16_t count ; ///< bytes in fifo
- volatile uint16_t wr_idx ; ///< write pointer
- volatile uint16_t rd_idx ; ///< read pointer
+ uint8_t const depth ; ///< buffer size
+ volatile uint8_t count ; ///< bytes in fifo
+ volatile uint8_t wr_idx ; ///< write pointer
+ volatile uint8_t rd_idx ; ///< read pointer
} osal_queue_t;
typedef osal_queue_t * osal_queue_handle_t;