Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
HW spinlock Interface

HW spinlock Interface . More...

Functions

int hwspinlock_trylock (const struct device *dev, uint32_t id)
 Try to lock HW spinlock.
 
void hwspinlock_lock (const struct device *dev, uint32_t id)
 Lock HW spinlock.
 
void hwspinlock_unlock (const struct device *dev, uint32_t id)
 Try to unlock HW spinlock.
 
uint32_t hwspinlock_get_max_id (const struct device *dev)
 Get HW spinlock max ID.
 

Detailed Description

HW spinlock Interface .

Function Documentation

◆ hwspinlock_get_max_id()

uint32_t hwspinlock_get_max_id ( const struct device * dev)

#include <zephyr/drivers/hwspinlock.h>

Get HW spinlock max ID.

This function is used to get the HW spinlock maximum ID. It should be called before attempting to lock/unlock a specific HW spinlock.

Parameters
devHW spinlock device instance.
Return values
HWspinlock max ID.
0if the function is not implemented by the driver.

◆ hwspinlock_lock()

void hwspinlock_lock ( const struct device * dev,
uint32_t id )

#include <zephyr/drivers/hwspinlock.h>

Lock HW spinlock.

This function is used to lock specific HW spinlock. It should be called before a critical section that we want to protect.

Parameters
devHW spinlock device instance.
idSpinlock identifier.

◆ hwspinlock_trylock()

int hwspinlock_trylock ( const struct device * dev,
uint32_t id )

#include <zephyr/drivers/hwspinlock.h>

Try to lock HW spinlock.

This function is used for try to lock specific HW spinlock. It should be called before a critical section that we want to protect.

Parameters
devHW spinlock device instance.
idSpinlock identifier.
Return values
0If successful.
-errnoIn case of any failure.

◆ hwspinlock_unlock()

void hwspinlock_unlock ( const struct device * dev,
uint32_t id )

#include <zephyr/drivers/hwspinlock.h>

Try to unlock HW spinlock.

This function is used for try to unlock specific HW spinlock. It should be called after a critical section that we want to protect.

Parameters
devHW spinlock device instance.
idSpinlock identifier.