6 FILE *stdin
, *stdout
, *stderr
;
8 static console_write_hook write_hook
;
9 static console_read_hook read_hook
;
10 static console_read_nonblock_hook read_nonblock_hook
;
12 void console_set_write_hook(console_write_hook h
)
17 void console_set_read_hook(console_read_hook r
, console_read_nonblock_hook rn
)
20 read_nonblock_hook
= rn
;
26 if(write_hook
!= NULL
)
34 if(uart_read_nonblock())
36 if((read_nonblock_hook
!= NULL
) && read_nonblock_hook())
41 int readchar_nonblock(void)
43 return (uart_read_nonblock()
44 || ((read_nonblock_hook
!= NULL
) && read_nonblock_hook()));
47 int puts(const char *s
)
57 void putsnonl(const char *s
)
65 #define PRINTF_BUFFER_SIZE 256
67 int printf(const char *fmt
, ...)
71 char outbuf
[PRINTF_BUFFER_SIZE
];
74 len
= vscnprintf(outbuf
, sizeof(outbuf
), fmt
, args
);