#include <htc.h>
-extern bit isr_gie;
-extern unsigned char isr_di;
+extern bit _isr_gie;
+extern unsigned char _isr_di;
-/* Nested disable interrupts inline function, for use outside ISR */
-#define ndi() \
- do { \
- if (isr_di++ == 0) \
- isr_gie = GIE; \
- if (isr_gie) \
- di(); \
- } while (0)
+/* Nested disable interrupts inline function. Should be OK even in ISR. */
+void ndi();
-/* Nested enable interrupts inline function, for use outside ISR */
-#define nei() \
- do { \
- if (--isr_di == 0) \
- if (isr_gie) { \
- isr_gie = 0; \
- ei(); \
- } \
- } while (0)
+/* Nested enable interrupts inline function. Should be OK even in ISR. */
+void nei();
void interrupt isr();