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>
#include "ao.h"
static char
#include "ao.h"
static char
+ao_packet_getchar(void) __critical
{
char c;
while ((c = ao_packet_pollchar()) == AO_READ_AGAIN)
{
char c;
while ((c = ao_packet_pollchar()) == AO_READ_AGAIN)
__xdata uint8_t ao_stdin_ready;
char
__xdata uint8_t ao_stdin_ready;
char
-getchar(void) __reentrant
+getchar(void) __reentrant __critical
{
char c;
int8_t stdio = ao_cur_stdio;
{
char c;
int8_t stdio = ao_cur_stdio;
for (;;) {
c = stdios[stdio].pollchar();
if (c != AO_READ_AGAIN)
for (;;) {
c = stdios[stdio].pollchar();
if (c != AO_READ_AGAIN)
if (stdio == ao_cur_stdio)
ao_sleep(&ao_stdin_ready);
}
if (stdio == ao_cur_stdio)
ao_sleep(&ao_stdin_ready);
}
ao_cur_stdio = stdio;
return c;
}
ao_cur_stdio = stdio;
return c;
}
+ao_usb_getchar(void) __critical