Fix all stdio reading functions to be __critical
authorKeith Packard <keithp@keithp.com>
Wed, 5 May 2010 08:31:57 +0000 (01:31 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 5 May 2010 08:33:25 +0000 (01:33 -0700)
Oh, right SDCC has '__critical' to mark sections of code that need to
run with interrupts disabled; no need to use EA = 0 and EA = 1.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao_packet_master.c
src/ao_stdio.c
src/ao_usb.c

index a499ce59d055e672580dd08136cf5a513a8554b7..ef86fa281a7f809e2c0ce38bdd6d45c823eaf710 100644 (file)
@@ -18,7 +18,7 @@
 #include "ao.h"
 
 static char
-ao_packet_getchar(void)
+ao_packet_getchar(void) __critical
 {
        char c;
        while ((c = ao_packet_pollchar()) == AO_READ_AGAIN)
index 045dff09f340e92b7b32b62ba2ceb914cfc2724f..78bbd3c3dab3e3d52d0731be50827e983c642dcb 100644 (file)
@@ -45,12 +45,11 @@ flush(void)
 __xdata uint8_t ao_stdin_ready;
 
 char
-getchar(void) __reentrant
+getchar(void) __reentrant __critical
 {
        char c;
        int8_t stdio = ao_cur_stdio;
 
-       EA = 0;
        for (;;) {
                c = stdios[stdio].pollchar();
                if (c != AO_READ_AGAIN)
@@ -60,7 +59,6 @@ getchar(void) __reentrant
                if (stdio == ao_cur_stdio)
                        ao_sleep(&ao_stdin_ready);
        }
-       EA = 1;
        ao_cur_stdio = stdio;
        return c;
 }
index 527e9b302ec387355317b447c7cacad1ea926540..e4af8e454625c87e1457b44475a33608d4155acb 100644 (file)
@@ -395,7 +395,7 @@ ao_usb_pollchar(void) __critical
 }
 
 char
-ao_usb_getchar(void)
+ao_usb_getchar(void) __critical
 {
        char    c;