- Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
My code uses avr-gcc util\atomic.h. For code block should be executed with disabled irqs and restore irqs state(disable, enable) after code block ends.
Example:
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { // some long time executed code irqs free }Can you add correct support of this to core?
In my code I use this workaround(not tested):
#ifdef __ARM__ #ifndef ATOMIC_BLOCK #define ATOMIC_BLOCK(type) for ( type, __ToDo = __iCliRetVal(); \ __ToDo ; __ToDo = 0 ) #define ATOMIC_RESTORESTATE uint8_t __primask_save \ __attribute__((__cleanup__(__iRestore))) = __get_PRIMASK() static __inline__ uint8_t __iCliRetVal(void) { __disable_irq(); return 1; } static __inline__ void __iRestore(const uint8_t *__s) { __set_PRIMASK(*__s); __asm__ volatile ("" ::: "memory"); } #endif #endifMetadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request