X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fkernel%2Fao_stdio.c;h=227499c81524ae4a3d521bf25ad4a460f7882cd5;hb=7c04888cf9809e0c73f0813c74e8dd972facde3a;hp=f0ee0a14e5070f3b0c61b800dec4eda9526b7edf;hpb=5dc5e2e238f8c1a8ca35d85ec046124afa9385ad;p=fw%2Faltos diff --git a/src/kernel/ao_stdio.c b/src/kernel/ao_stdio.c index f0ee0a14..227499c8 100644 --- a/src/kernel/ao_stdio.c +++ b/src/kernel/ao_stdio.c @@ -83,8 +83,8 @@ __pdata int8_t ao_cur_stdio; #define ao_num_stdios 0 #endif -void -putchar(char c) +int +ao_putchar(char c) { #if LOW_LEVEL_DEBUG if (!ao_cur_task) { @@ -92,12 +92,13 @@ putchar(char c) if (c == '\n') ao_debug_out('\r'); ao_debug_out(c); - return; + return 0; } #endif if (c == '\n') (*ao_stdios[ao_cur_stdio].putchar)('\r'); (*ao_stdios[ao_cur_stdio].putchar)(c); + return 0; } void @@ -110,7 +111,7 @@ flush(void) __xdata uint8_t ao_stdin_ready; char -getchar(void) __reentrant +ao_getchar(void) __reentrant { int c; int8_t stdio; @@ -158,3 +159,33 @@ ao_add_stdio(int (*_pollchar)(void), return 0; #endif } + +/* + * Basic I/O functions to support newlib tinystdio package + */ + +static int +ao_putc(char c, FILE *ignore) +{ + (void) ignore; + return ao_putchar(c); +} + +static int +ao_getc(FILE *ignore) +{ + (void) ignore; + return ao_getchar(); +} + +static int +ao_flushc(FILE *ignore) +{ + (void) ignore; + flush(); + return 0; +} + +static FILE __stdio = FDEV_SETUP_STREAM(ao_putc, ao_getc, ao_flushc, _FDEV_SETUP_RW); + +FILE *const __iob[3] = { &__stdio, &__stdio, &__stdio };