From e6bb80975fde20928a830170f0821d59a8c72690 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 5 May 2010 01:31:57 -0700 Subject: [PATCH] Fix all stdio reading functions to be __critical 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 --- src/ao_packet_master.c | 2 +- src/ao_stdio.c | 4 +--- src/ao_usb.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ao_packet_master.c b/src/ao_packet_master.c index a499ce59..ef86fa28 100644 --- a/src/ao_packet_master.c +++ b/src/ao_packet_master.c @@ -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) diff --git a/src/ao_stdio.c b/src/ao_stdio.c index 045dff09..78bbd3c3 100644 --- a/src/ao_stdio.c +++ b/src/ao_stdio.c @@ -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; } diff --git a/src/ao_usb.c b/src/ao_usb.c index 527e9b30..e4af8e45 100644 --- a/src/ao_usb.c +++ b/src/ao_usb.c @@ -395,7 +395,7 @@ ao_usb_pollchar(void) __critical } char -ao_usb_getchar(void) +ao_usb_getchar(void) __critical { char c; -- 2.30.2