[riot-notifications] [RIOT] sys: factor stdio uart functions out of newlib's syscalls (#3161)

Kaspar Schleiser notifications at github.com
Thu Jun 4 18:08:57 CEST 2015

Well, I look at it this way:
The system calls, e.g., ```_read_r```, take a "file descriptor" as argument. Right know, they only support one file descriptor: 0 (STDIO). Right now, that file descriptor is hard-coded to uart.

In the feature, we will have files, and maybe different simultaneous UARTs, and maybe sockets. They all can use read, write, flush, close.

So we need an interface, e.g.,

``` struct stdio_fd_interface {
 fd_read_func_t *read;
fd_write_func_t *write;
}stdio_fd_interface_t; ```

An uart implementation:

``` const stdio_fd_interface_t uart_fd_interface = {
.read = uart_stdio_read;
.write = uart_stdio_write;

and in syscalls.c an array with one stdio_interface_t pointer per file descriptor.

Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20150604/d7675758/attachment.html>

More information about the notifications mailing list