]> oss.titaniummirror.com Git - rgblamp.git/blobdiff - isr.c
These changes save 685 code words
[rgblamp.git] / isr.c
diff --git a/isr.c b/isr.c
index a1b9a491d3602259a8dc9396fcff7b793be95c10..8db018f3672723d06a24b8e2799d8cb0cdba7fc1 100644 (file)
--- a/isr.c
+++ b/isr.c
 bit _isr_gie; /* Used to store the state of GIE for nested ndi()/nei() */
 unsigned char _isr_di; /* Count of nested ndi() */
 
+void ndi()
+{
+  if (_isr_di++ == 0) {
+    _isr_gie = GIE;
+    di();
+  }
+}
+
+/* Nested enable interrupts inline function.  Should be OK even in ISR. */
+void nei()
+{
+  if (--_isr_di == 0 && _isr_gie)
+    ei();
+}
+
 void interrupt isr()
 {
   tmr_isr();