diff options
| author | hathach <[email protected]> | 2013-02-04 17:13:26 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-02-04 17:13:26 +0700 |
| commit | dd9da7846a0ef74d240af22f508fe7a32a99085c (patch) | |
| tree | 7356ef64c8edc883a0d72f3e23e9cc914d76bb38 /tinyusb | |
| parent | d71e244dffc15cd3fbabbe6e710a7a20ea09c413 (diff) | |
port osal_FreeRTOS, add some include to be able to mock & link
change osal_none's queue_t member from uint16_t to uint8_t
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/osal/osal_freeRTOS.h | 26 | ||||
| -rw-r--r-- | tinyusb/osal/osal_none.h | 8 |
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; |
