Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hwspinlock.h File Reference

Main header file for hardware spinlock driver API. More...

#include <zephyr/types.h>
#include <zephyr/sys/util.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/device.h>
#include <zephyr/spinlock.h>
#include <zephyr/devicetree.h>

Go to the source code of this file.

Data Structures

struct  hwspinlock_context
 HW spinlock controller runtime context. More...
struct  hwspinlock_dt_spec
 Complete hardware spinlock DT information. More...

Macros

#define HWSPINLOCK_CTX_INITIALIZER
 Initializer for a hwspinlock_ctx_t.
#define HWSPINLOCK_DT_SPEC_GET_BY_IDX(node_id, idx)
 Structure initializer for struct hwspinlock_dt_spec from devicetree by index.
#define HWSPINLOCK_DT_SPEC_GET_BY_NAME(node_id, name)
 Structure initializer for struct hwspinlock_dt_spec from devicetree by name.
#define HWSPINLOCK_DT_SPEC_GET(node_id)
 Structure initializer for struct hwspinlock_dt_spec from devicetree.
#define HWSPINLOCK_DT_SPEC_INST_GET_BY_IDX(inst, idx)
 Instance version of HWSPINLOCK_DT_SPEC_GET_BY_IDX()
#define HWSPINLOCK_DT_SPEC_INST_GET_BY_NAME(inst, name)
 Instance version of HWSPINLOCK_DT_SPEC_GET_BY_NAME()
#define HWSPINLOCK_DT_SPEC_INST_GET(inst)
 Instance version of HWSPINLOCK_DT_SPEC_GET()

Typedefs

typedef struct hwspinlock_context hwspinlock_ctx_t
 Opaque type to represent a hwspinlock runtime context.

Functions

static int hw_spin_trylock (const struct device *dev, hwspinlock_ctx_t *ctx, uint32_t id, k_spinlock_key_t *key)
 Try to lock HW spinlock.
static k_spinlock_key_t hw_spin_lock (const struct device *dev, hwspinlock_ctx_t *ctx, uint32_t id)
 Lock HW spinlock.
static void hw_spin_unlock (const struct device *dev, hwspinlock_ctx_t *ctx, uint32_t id, k_spinlock_key_t key)
 Unlock HW spinlock.
static uint32_t hw_spinlock_get_max_id (const struct device *dev)
 Get HW spinlock max ID.
static int hw_spin_trylock_dt (struct hwspinlock_dt_spec *spec, k_spinlock_key_t *key)
 Try to lock HW spinlock from a struct hwspinlock_dt_spec.
static k_spinlock_key_t hw_spin_lock_dt (struct hwspinlock_dt_spec *spec)
 Lock HW spinlock from a struct hwspinlock_dt_spec.
static void hw_spin_unlock_dt (struct hwspinlock_dt_spec *spec, k_spinlock_key_t key)
 Unlock HW spinlock from a struct hwspinlock_dt_spec.
static uint32_t hw_spinlock_get_max_id_dt (struct hwspinlock_dt_spec *spec)
 Get HW spinlock max ID from a struct hwspinlock_dt_spec.

Detailed Description

Main header file for hardware spinlock driver API.