mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-14 09:22:05 +08:00
dd778596b7
date: 2025-03-15T21:10:51 master commit: fb7b9c0f9420d228f03362970ebcfb7237095cf3
18 lines
607 B
C
18 lines
607 B
C
#pragma once
|
|
|
|
// ********************* Critical section helpers *********************
|
|
void enable_interrupts(void);
|
|
void disable_interrupts(void);
|
|
|
|
extern uint8_t global_critical_depth;
|
|
|
|
#define ENTER_CRITICAL() \
|
|
__disable_irq(); \
|
|
global_critical_depth += 1U;
|
|
|
|
#define EXIT_CRITICAL() \
|
|
global_critical_depth -= 1U; \
|
|
if ((global_critical_depth == 0U) && interrupts_enabled) { \
|
|
__enable_irq(); \
|
|
}
|