mbed TLS v2.2.0
Macros | Typedefs | Functions
slpal_baremetal.h File Reference
#include <config-sl-crypto-all-acceleration.h>
#include "slpal_common.h"
#include "em_assert.h"
#include "em_core.h"
#include <stdbool.h>
Include dependency graph for slpal_baremetal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SLPAL_WAIT_FOREVER   (-1)
 
#define SLPAL_NON_BLOCKING   (0)
 
#define CORE_ATOMIC_BASE_PRIORITY_LEVEL   (3) /* Same as in emlib/em_core.c */
 
#define SLPAL_CRYPTO_IRQ_PRIORITY   (0x0)
 

Typedefs

typedef volatile bool SLPAL_Completion_t
 
typedef volatile unsigned int SLPAL_Mutex_t
 

Functions

__STATIC_INLINE SLPAL_irqState_t SLPAL_CriticalEnter (void)
 Enter a critical region. More...
 
__STATIC_INLINE void SLPAL_CriticalExit (SLPAL_irqState_t irqState)
 Exit a critical region. More...
 
__STATIC_INLINE void SLPAL_IsrEnter (void)
 Enter an ISR. More...
 
__STATIC_INLINE void SLPAL_IsrExit (void)
 Exit an ISR. More...
 
__STATIC_INLINE void * SLPAL_ThreadIdGet (void)
 Get thread identifier of calling thread. More...
 
__STATIC_INLINE unsigned long SLPAL_ThreadPriorityGet (void)
 Get thread priority of calling thread. More...
 
__STATIC_INLINE void SLPAL_ThreadResume (void *threadId)
 Resume a thread which may have been suspended. More...
 
__STATIC_INLINE void SLPAL_ThreadSuspend (void *threadId)
 Suspend a thread. More...
 
__STATIC_INLINE int SLPAL_InitCompletion (SLPAL_Completion_t *pComp)
 
__STATIC_INLINE int SLPAL_FreeCompletion (SLPAL_Completion_t *pComp)
 
__STATIC_INLINE int SLPAL_WaitForCompletion (SLPAL_Completion_t *pComp, int ticks)
 
__STATIC_INLINE int SLPAL_Complete (SLPAL_Completion_t *pComp)
 
__STATIC_INLINE int SLPAL_InitMutex (SLPAL_Mutex_t *pMutex)
 
__STATIC_INLINE int SLPAL_FreeMutex (SLPAL_Mutex_t *pMutex)
 
__STATIC_INLINE int SLPAL_TakeMutex (SLPAL_Mutex_t *pMutex, int ticks)
 
__STATIC_INLINE int SLPAL_GiveMutex (SLPAL_Mutex_t *pMutex)
 

Macro Definition Documentation

#define CORE_ATOMIC_BASE_PRIORITY_LEVEL   (3) /* Same as in emlib/em_core.c */

Definition at line 52 of file slpal_baremetal.h.

#define SLPAL_CRYPTO_IRQ_PRIORITY   (0x0)

Definition at line 59 of file slpal_baremetal.h.

#define SLPAL_NON_BLOCKING   (0)

Definition at line 49 of file slpal_baremetal.h.

#define SLPAL_WAIT_FOREVER   (-1)

Definition at line 46 of file slpal_baremetal.h.

Referenced by SLPAL_TakeMutex(), and SLPAL_WaitForCompletion().

Typedef Documentation

typedef volatile bool SLPAL_Completion_t

Definition at line 67 of file slpal_baremetal.h.

typedef volatile unsigned int SLPAL_Mutex_t

Definition at line 69 of file slpal_baremetal.h.

Function Documentation

__STATIC_INLINE int SLPAL_Complete ( SLPAL_Completion_t pComp)

Definition at line 305 of file slpal_baremetal.h.

__STATIC_INLINE SLPAL_irqState_t SLPAL_CriticalEnter ( void  )

Enter a critical region.

This function enters a critical region using the CORE_EnterAtomic method implemented in emlib/em_core.c. SLPAL_CriticalEnter returns the current IRQ state which subsequently should be passed to SLPAL_CriticalExit in order to restore the IRQ state.

Returns
IRQ state.

Definition at line 96 of file slpal_baremetal.h.

__STATIC_INLINE void SLPAL_CriticalExit ( SLPAL_irqState_t  irqState)

Exit a critical region.

This function exits a critical section using the CORE_ExitAtomic method implemented in emlib/em_core.c. SLPAL_CriticalEnter returns the current IRQ state which subsequently should be passed to SLPAL_CriticalExit in order to restore the IRQ state.

Parameters
irqStateIRQ state.

Definition at line 114 of file slpal_baremetal.h.

__STATIC_INLINE int SLPAL_FreeCompletion ( SLPAL_Completion_t pComp)

Definition at line 234 of file slpal_baremetal.h.

__STATIC_INLINE int SLPAL_FreeMutex ( SLPAL_Mutex_t pMutex)

Definition at line 337 of file slpal_baremetal.h.

__STATIC_INLINE int SLPAL_GiveMutex ( SLPAL_Mutex_t pMutex)

Definition at line 408 of file slpal_baremetal.h.

__STATIC_INLINE int SLPAL_InitCompletion ( SLPAL_Completion_t pComp)

Definition at line 218 of file slpal_baremetal.h.

__STATIC_INLINE int SLPAL_InitMutex ( SLPAL_Mutex_t pMutex)

Definition at line 321 of file slpal_baremetal.h.

__STATIC_INLINE void SLPAL_IsrEnter ( void  )

Enter an ISR.

This function informs the OS that we have entered an ISR. This function should be called first thing in all ISRs.

Definition at line 127 of file slpal_baremetal.h.

__STATIC_INLINE void SLPAL_IsrExit ( void  )

Exit an ISR.

This function informs the OS that we are about to exit an ISR. This function should be called last in all ISRs.

Definition at line 139 of file slpal_baremetal.h.

__STATIC_INLINE int SLPAL_TakeMutex ( SLPAL_Mutex_t pMutex,
int  ticks 
)

Definition at line 360 of file slpal_baremetal.h.

References SLPAL_ERROR_TIMEOUT, and SLPAL_WAIT_FOREVER.

__STATIC_INLINE void* SLPAL_ThreadIdGet ( void  )

Get thread identifier of calling thread.

This function always returns 0 because there is only one single thread executing in the bare-metal environment.

Returns
Always 0.

Definition at line 154 of file slpal_baremetal.h.

__STATIC_INLINE unsigned long SLPAL_ThreadPriorityGet ( void  )

Get thread priority of calling thread.

This function returns the thread priority of the calling thread. For bare-metal we return 1 when running at interrupt level, and 0 when running at non-interrupt level.

Returns
1 for interrupt level or 0 for non-interrupt level.

Definition at line 171 of file slpal_baremetal.h.

References RUNNING_AT_INTERRUPT_LEVEL.

__STATIC_INLINE void SLPAL_ThreadResume ( void *  threadId)

Resume a thread which may have been suspended.

This function is empty because suspend/resume threads is not available when running bare-metal without a multi-thread library.

Parameters
threadIdThread identifier. Ignored.

Definition at line 187 of file slpal_baremetal.h.

__STATIC_INLINE void SLPAL_ThreadSuspend ( void *  threadId)

Suspend a thread.

This function is empty because suspend/resume threads is not available when running bare-metal without a multi-thread library.

Parameters
threadIdThread identifier.

Definition at line 203 of file slpal_baremetal.h.

__STATIC_INLINE int SLPAL_WaitForCompletion ( SLPAL_Completion_t pComp,
int  ticks 
)

Definition at line 257 of file slpal_baremetal.h.

References SLPAL_ERROR_TIMEOUT, and SLPAL_WAIT_FOREVER.