Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Update HC32 CRITICAL_SECTION macros (MarlinFirmware#27283)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow578 authored Jul 18, 2024
1 parent 1aca038 commit 29a5006
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions Marlin/src/HAL/HC32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,19 @@
// Misc. Functions
//
#ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) pin_t(p)
#define analogInputToDigitalPin(p) pin_t(p)
#endif

#define CRITICAL_SECTION_START \
uint32_t primask = __get_PRIMASK(); \
(void)__iCliRetVal()
#define CRITICAL_SECTION_START() \
const bool irqon = !__get_PRIMASK(); \
__disable_irq(); \
__DSB();
#define CRITICAL_SECTION_END() \
__DSB(); \
if (irqon) __enable_irq();

#define CRITICAL_SECTION_END \
if (!primask) \
(void)__iSeiRetVal()

// Disable interrupts
#define cli() noInterrupts()

// Enable interrupts
#define sei() interrupts()
#define cli() __disable_irq()
#define sei() __enable_irq()

// bss_end alias
#define __bss_end __bss_end__
Expand Down

0 comments on commit 29a5006

Please sign in to comment.