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
This commit is contained in:
hathach
2013-02-04 17:13:26 +07:00
parent d71e244dff
commit dd9da7846a
8 changed files with 45 additions and 689 deletions

View File

@@ -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
}

View File

@@ -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;