1 #pragma once 2 3 #include_next <sys/lock.h> 4 5 #ifdef _RETARGETABLE_LOCKING 6 7 /* Actual platfrom-specific definition of struct __lock. 8 * The size here should be sufficient for a FreeRTOS mutex. 9 * This is checked by a static assertion in locks.c 10 * 11 * Note 1: this might need to be made dependent on whether FreeRTOS 12 * is included in the build. 13 * 14 * Note 2: the size is made sufficient for the case when 15 * configUSE_TRACE_FACILITY is enabled. If it is disabled, 16 * this definition wastes 8 bytes. 17 */ 18 struct __lock { 19 int reserved[23]; 20 }; 21 22 /* Compatibility definitions for the legacy ESP-specific locking implementation. 23 * These used to be provided by libc/sys/xtensa/sys/lock.h in newlib. 24 * Newer versions of newlib don't have this ESP-specific lock.h header, and are 25 * built with _RETARGETABLE_LOCKING enabled, instead. 26 */ 27 28 typedef _LOCK_T _lock_t; 29 30 void _lock_init(_lock_t *plock); 31 void _lock_init_recursive(_lock_t *plock); 32 void _lock_close(_lock_t *plock); 33 void _lock_close_recursive(_lock_t *plock); 34 void _lock_acquire(_lock_t *plock); 35 void _lock_acquire_recursive(_lock_t *plock); 36 int _lock_try_acquire(_lock_t *plock); 37 int _lock_try_acquire_recursive(_lock_t *plock); 38 void _lock_release(_lock_t *plock); 39 void _lock_release_recursive(_lock_t *plock); 40 41 #endif // _RETARGETABLE_LOCKING 42