Lazuli
Macros | Typedefs | Functions
spinlock.h File Reference

Spinlocks interface. More...

#include <stdint.h>
#include <Lazuli/common.h>

Go to the source code of this file.

Macros

#define LZ_SPINLOCK_INIT   ((uint8_t)0)
 Define the initialization value for the type Lz_Spinlock. More...
 

Typedefs

typedef volatile uint8_t Lz_Spinlock
 Type used to represent a spinlock.
 

Functions

void Lz_Spinlock_Lock (Lz_Spinlock *const spinlock)
 Set the lock and enter region, or active wait if the lock is already set. More...
 
void Lz_Spinlock_Unlock (Lz_Spinlock *const spinlock)
 Unset the lock and leave region. More...
 

Detailed Description

Spinlocks interface.

This file describes the interface for spinlocks.

Definition in file spinlock.h.

Macro Definition Documentation

◆ LZ_SPINLOCK_INIT

#define LZ_SPINLOCK_INIT   ((uint8_t)0)

Define the initialization value for the type Lz_Spinlock.

This macro constant must be used to statically initialize a declared spinlock.

Definition at line 34 of file spinlock.h.

Function Documentation

◆ Lz_Spinlock_Lock()

void Lz_Spinlock_Lock ( Lz_Spinlock *const  spinlock)

Set the lock and enter region, or active wait if the lock is already set.

Parameters
spinlockA pointer to a Lz_Spinlock used to hold the lock.
Note
The calling task will abort if configuration macro LZ_CONFIG_CHECK_NULL_PARAMETERS_IN_SPINLOCKS is set to 1 and the parameter spinlock is NULL.

◆ Lz_Spinlock_Unlock()

void Lz_Spinlock_Unlock ( Lz_Spinlock *const  spinlock)

Unset the lock and leave region.

Parameters
spinlockA pointer to a Lz_Spinlock used to hold the lock.
Note
The calling task will abort if configuration macro LZ_CONFIG_CHECK_NULL_PARAMETERS_IN_SPINLOCKS is set to 1 and the parameter spinlock is NULL.

Definition at line 20 of file spinlock.c.