static int _uart_getchar(FILE *stream) { (void) stream; char c; uart_stdio_read(&c, 1); return (int)c; }
static ssize_t uart_stdio_vfs_read(vfs_file_t *filp, void *dest, size_t nbytes) { int fd = filp->private_data.value; if (fd != STDIN_FILENO) { return -EBADF; } return uart_stdio_read(dest, nbytes); }
/** * @brief Get one character from STDIO - used by the libc */ int getchar(void) { char c; uart_stdio_read(&c, 1); return c; }
/** * @brief Read from a file * * All input is read from UART_0. The function will block until a byte is actually read. * * Note: the read function does not buffer - data will be lost if the function is not * called fast enough. * * TODO: implement more sophisticated read call. * * @param r TODO * @param fd TODO * @param buffer TODO * @param int TODO * * @return TODO */ int _read_r(struct _reent *r, int fd, void *buffer, unsigned int count) { (void)r; (void)fd; return uart_stdio_read(buffer, count); }