1 /* 2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef _PICO_LOCK_CORE_H 8 #define _PICO_LOCK_CORE_H 9 10 #include "pico.h" 11 #include "hardware/sync.h" 12 13 /** \file lock_core.h 14 * \ingroup pico_sync 15 * 16 * Base implementation for locking primitives protected by a spin lock 17 */ 18 typedef struct lock_core { 19 // spin lock protecting this lock's state 20 spin_lock_t *spin_lock; 21 22 // note any lock members in containing structures need not be volatile; 23 // they are protected by memory/compiler barriers when gaining and release spin locks 24 } lock_core_t; 25 26 void lock_init(lock_core_t *core, uint lock_num); 27 28 #endif