Loading...
Searching...
No Matches
lock_core.h File Reference
#include "pico.h"
#include "pico/time.h"
#include "hardware/sync.h"

Go to the source code of this file.

Data Structures

struct  lock_core
 Core state shared by all lock primitives. More...

Macros

#define PARAM_ASSERTIONS_ENABLED_LOCK_CORE   0
#define PICO_SYNC_EXCLUSIVE_ACCESS_EVENT_WORKAROUND   (PICO_USE_SW_SPIN_LOCKS && PICO_EXCLUSIVE_ACCESS_SETS_OWN_EVENT)
#define lock_owner_id_t   int8_t
 type to use to store the 'owner' of a lock.
#define LOCK_INVALID_OWNER_ID   ((lock_owner_id_t)-1)
 marker value to use for a lock_owner_id_t which does not refer to any valid owner
#define lock_get_caller_owner_id()
 return the owner id for the caller
#define lock_is_owner_id_valid(id)
#define lock_internal_spin_unlock_with_wait(lock, save)
 Atomically unlock the lock's spin lock, and wait for a notification.
#define lock_internal_spin_unlock_with_notify(lock, save)
 Atomically unlock the lock's spin lock, and send a notification.
#define lock_internal_spin_unlock_with_best_effort_wait_or_timeout(lock, save, until)
 Atomically unlock the lock's spin lock, and wait for a notification or a timeout.
#define LOCK_INTERNAL_SPIN_UNLOCK_WITH_NOTIFY_WAKES_ALL   1
 Whether a notify reaches all earlier waiters.
#define lock_internal_spin_unlock_maybe_notify(lock, save, others_may_proceed)
 Release a spin lock, notifying other waiters if the implementation does not guarantee that an earlier notification will have reached them.
#define sync_internal_yield_until_before(until)
 yield to other processing until some time before the requested time

Typedefs

typedef struct lock_core lock_core_t

Functions

void lock_init (lock_core_t *core, uint lock_num)
 Initialise a lock structure.

Detailed Description

Base implementation for locking primitives protected by a spin lock. The spin lock is only used to protect access to the remaining lock state (in primitives using lock_core); it is never left locked outside of the function implementations

Macro Definition Documentation

◆ lock_is_owner_id_valid

#define lock_is_owner_id_valid ( id)
Value:
((id)>=0)