diff options
| author | hathach <[email protected]> | 2025-05-21 11:19:07 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2025-05-21 11:19:07 +0700 |
| commit | c1d23a0a92bef016e22be3ed8194230cfab1c358 (patch) | |
| tree | 3c3db1607a1762ab47062208d3ec5295489cc307 /src/osal/osal_rtthread.h | |
| parent | a4875fefead1a2b27f13a588dea44eaca737f553 (diff) | |
osal_spin skipping lock/unlock when executed in isr
Diffstat (limited to 'src/osal/osal_rtthread.h')
| -rw-r--r-- | src/osal/osal_rtthread.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/osal/osal_rtthread.h b/src/osal/osal_rtthread.h index 97f5dc69a..a778f5425 100644 --- a/src/osal/osal_rtthread.h +++ b/src/osal/osal_rtthread.h @@ -55,12 +55,16 @@ TU_ATTR_ALWAYS_INLINE static inline void osal_spin_init(osal_spinlock_t *ctx) { } TU_ATTR_ALWAYS_INLINE static inline void osal_spin_lock(osal_spinlock_t *ctx, bool in_isr) { - (void) in_isr; + if (!TUP_MCU_MULTIPLE_CORE && in_isr) { + return; // single core MCU does not need to lock in ISR + } rt_spin_lock(ctx); } TU_ATTR_ALWAYS_INLINE static inline void osal_spin_unlock(osal_spinlock_t *ctx, bool in_isr) { - (void) in_isr; + if (!TUP_MCU_MULTIPLE_CORE && in_isr) { + return; // single core MCU does not need to lock in ISR + } rt_spin_unlock(ctx); } |
