mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-18 17:23:52 +08:00
* main * can_comms * main_declarations->main_definitions * rename this also * can_definitions * faults * power_saving * provision * gitversion * not included * no include for now
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(); \
|
|
}
|