- Notifications
You must be signed in to change notification settings - Fork1k
Open
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#defineATOMIC_BLOCK(type)for ( type, __ToDo = __iCliRetVal(); \__ToDo ; __ToDo =0 )#defineATOMIC_RESTORESTATEuint8_t __primask_save \__attribute__((__cleanup__(__iRestore))) = __get_PRIMASK()static __inline__ uint8_t __iCliRetVal(void){__disable_irq();return1;}static __inline__void__iRestore(constuint8_t *__s){__set_PRIMASK(*__s);__asm__volatile ("" :::"memory");}#endif#endif