diff options
| author | hathach <[email protected]> | 2025-05-19 22:51:40 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2025-05-19 22:51:40 +0700 |
| commit | bb1d348eb3908543f7bc80fc462d91bba62edace (patch) | |
| tree | 73268b6ccd7a7d70ff4498698ce05e9b72516c14 /src/osal/osal_pico.h | |
| parent | bffe5d97cc2f4f5a9ba8b4f09d30be97ce70a3de (diff) | |
implement osal critical for none/freertos/pico-sdk
Diffstat (limited to 'src/osal/osal_pico.h')
| -rw-r--r-- | src/osal/osal_pico.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/osal/osal_pico.h b/src/osal/osal_pico.h index 315de0950..be631ed18 100644 --- a/src/osal/osal_pico.h +++ b/src/osal/osal_pico.h @@ -44,6 +44,27 @@ TU_ATTR_ALWAYS_INLINE static inline void osal_task_delay(uint32_t msec) { } //--------------------------------------------------------------------+ +// Critical API +//--------------------------------------------------------------------+ +typedef critical_section_t osal_critical_t; +#define OSAL_CRITIAL_DEF(_name, _int_set) \ + osal_critical_t _name + +TU_ATTR_ALWAYS_INLINE static inline void osal_critical_init(osal_critical_t *ctx) { + critical_section_init(ctx); +} + +TU_ATTR_ALWAYS_INLINE static inline void osal_critical_enter(osal_critical_t *ctx, bool in_isr) { + (void) in_isr; + critical_section_enter_blocking(ctx); +} + +TU_ATTR_ALWAYS_INLINE static inline void osal_critical_exit(osal_critical_t *ctx, bool in_isr) { + (void) in_isr; + critical_section_exit(ctx); +} + +//--------------------------------------------------------------------+ // Binary Semaphore API //--------------------------------------------------------------------+ typedef struct semaphore osal_semaphore_def_t, * osal_semaphore_t; |
