20 #ifndef MBEDTLS_SLPAL_FREERTOS_H
21 #define MBEDTLS_SLPAL_FREERTOS_H
23 #if !defined(MBEDTLS_CONFIG_FILE)
26 #include MBEDTLS_CONFIG_FILE
29 #if defined( MBEDTLS_FREERTOS )
32 #include "em_assert.h"
45 #define SLPAL_WAIT_FOREVER ((int)portMAX_DELAY)
48 #define SLPAL_NON_BLOCKING (0)
50 #if defined(MBEDTLS_CRYPTO_IRQ_PRIORITY)
51 #define SLPAL_CRYPTO_IRQ_PRIORITY MBEDTLS_CRYPTO_IRQ_PRIORITY
53 #define SLPAL_CRYPTO_IRQ_PRIORITY ( configMAX_SYSCALL_INTERRUPT_PRIORITY >> ( 8U - __NVIC_PRIO_BITS ) )
56 #if ( SLPAL_CRYPTO_IRQ_PRIORITY < ( configMAX_SYSCALL_INTERRUPT_PRIORITY >> ( 8U - __NVIC_PRIO_BITS ) ) )
57 #error CRYPTO IRQ priority should be numerically higher than or equal to the syscall interrupt.
61 #define SLPAL_MAX_PRIORITY (configMAX_PRIORITIES-1)
64 #define SEM_COUNT_MAX (65535)
99 irqState = taskENTER_CRITICAL_FROM_ISR();
103 irqState = __get_BASEPRI();
104 taskENTER_CRITICAL();
127 taskEXIT_CRITICAL_FROM_ISR(irqState);
172 return (
unsigned long)uxTaskPriorityGet(NULL);
188 EFM_ASSERT(*pComp != NULL);
241 xSemaphoreTake( (SemaphoreHandle_t) *pComp, (TickType_t) ticks );
242 if (status == pdTRUE)
269 BaseType_t HigherPriorityTaskWoken;
270 status = xSemaphoreGiveFromISR( (SemaphoreHandle_t) *pComp,
271 &HigherPriorityTaskWoken );
275 status = xSemaphoreGive( (SemaphoreHandle_t) *pComp );
277 EFM_ASSERT(status == pdTRUE);
294 EFM_ASSERT(*pMutex != NULL);
348 xSemaphoreTake( (SemaphoreHandle_t) *pMutex, (TickType_t) ticks );
349 if (status == pdTRUE)
376 BaseType_t HigherPriorityTaskWoken;
377 status = xSemaphoreGiveFromISR( (SemaphoreHandle_t) *pMutex,
378 &HigherPriorityTaskWoken );
382 status = xSemaphoreGive( (SemaphoreHandle_t) *pMutex );
384 EFM_ASSERT(status == pdTRUE);
#define RUNNING_AT_INTERRUPT_LEVEL
uint32_t SLPAL_irqState_t
Storage for PRIMASK or BASEPRI value used for SLPAL critical regions.
#define SLPAL_ERROR_OS_SPECIFIC
Compatibility names (set of defines)
#define SLPAL_ERROR_TIMEOUT