--- /dev/null
+/*
+ * File: isr.h
+ *
+ * Interrupt handling routines
+ */
+
+#ifndef _ISR_H
+#define _ISR_H
+
+#include <htc.h>
+
+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 enable interrupts inline function, for use outside ISR */
+#define nei() \
+ do { \
+ if (--isr_di == 0) \
+ if (isr_gie) { \
+ isr_gie = 0; \
+ ei(); \
+ } \
+ } while (0)
+
+void interrupt isr();
+
+#endif