From b4f092ec74d85d4e5567ebb45e1bd0dec20f0e02 Mon Sep 17 00:00:00 2001 From: Wini-Buh Date: Sat, 29 May 2021 21:23:39 +0200 Subject: Adaptations for Renesas CCRX toolchain and Rx72N controller performed --- src/osal/osal_freertos.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/osal') diff --git a/src/osal/osal_freertos.h b/src/osal/osal_freertos.h index 66070c273..ec33b317d 100644 --- a/src/osal/osal_freertos.h +++ b/src/osal/osal_freertos.h @@ -51,6 +51,7 @@ static inline void osal_task_delay(uint32_t msec) typedef StaticSemaphore_t osal_semaphore_def_t; typedef SemaphoreHandle_t osal_semaphore_t; +#if (configSUPPORT_STATIC_ALLOCATION == 1) //FIXME Only static API supported static inline osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t* semdef) { return xSemaphoreCreateBinaryStatic(semdef); @@ -76,6 +77,7 @@ static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr) return res != 0; } } +#endif static inline bool osal_semaphore_wait (osal_semaphore_t sem_hdl, uint32_t msec) { @@ -96,7 +98,12 @@ typedef SemaphoreHandle_t osal_mutex_t; static inline osal_mutex_t osal_mutex_create(osal_mutex_def_t* mdef) { +#if (configSUPPORT_STATIC_ALLOCATION == 0) //FIXME Only static API supported + (void)mdef; + return xSemaphoreCreateMutex(); +#else return xSemaphoreCreateMutexStatic(mdef); +#endif } static inline bool osal_mutex_lock (osal_mutex_t mutex_hdl, uint32_t msec) @@ -131,7 +138,11 @@ typedef QueueHandle_t osal_queue_t; static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef) { +#if defined(__Tx36V5_Maincard__) + return xQueueCreate(qdef->depth, qdef->item_sz); +#else return xQueueCreateStatic(qdef->depth, qdef->item_sz, (uint8_t*) qdef->buf, &qdef->sq); +#endif } static inline bool osal_queue_receive(osal_queue_t qhdl, void* data) @@ -139,6 +150,19 @@ static inline bool osal_queue_receive(osal_queue_t qhdl, void* data) return xQueueReceive(qhdl, data, portMAX_DELAY); } +#if defined(__Tx36V5_Maincard__) +extern BaseType_t UsbTaskWoken; +static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr) +{ + if (!in_isr) { + return(xQueueSendToBack(qhdl, data, OSAL_TIMEOUT_WAIT_FOREVER)); + + } else { + BaseType_t res = xQueueSendToBackFromISR(qhdl, data, &UsbTaskWoken); + return(res != 0); + } +} +#else static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr) { if ( !in_isr ) @@ -159,6 +183,7 @@ static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in return res != 0; } } +#endif static inline bool osal_queue_empty(osal_queue_t qhdl) { -- cgit v1.3.1