Add the disable_int({}) macro
This is similar to safe_irq_enable and disable
This commit is contained in:
parent
62400bd07f
commit
76563958fe
@ -130,6 +130,23 @@ enum interrupt_nums {
|
||||
|
||||
#endif /* REG_NO_COMPAT */
|
||||
|
||||
/* Macro to safely disable all interrupts for a block of code.
|
||||
Use it like this:
|
||||
disable_int({
|
||||
asdf = 1234;
|
||||
printf("hi\r\n");
|
||||
});
|
||||
*/
|
||||
#define __int_top() volatile uint32_t saved_intenable
|
||||
#define __int_disable() saved_intenable = ITC->INTENABLE; ITC->INTENABLE = 0
|
||||
#define __int_enable() ITC->INTENABLE = saved_intenable
|
||||
#define disable_int(x) do { \
|
||||
__int_top(); \
|
||||
__int_disable(); \
|
||||
x; \
|
||||
__int_enable(); } while(0)
|
||||
|
||||
|
||||
extern void tmr0_isr(void) __attribute__((weak));
|
||||
extern void tmr1_isr(void) __attribute__((weak));
|
||||
extern void tmr2_isr(void) __attribute__((weak));
|
||||
|
Loading…
Reference in New Issue
Block a user