lock.h 1.3 KB

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