RIOT-OS/RIOT — pull request #613 by haukepetersen (2014-02-03 19:12:21+00:00)
Title: Initial import of low-level UART driver interface

Proposal for a low-level UART driver interface. For now this interface is based on callback routines for sending and receiving, which are run in interrupt context.

The driver does not rely on any buffering mechanisms, these should be part of higher level drivers, as a chardev or similar. This way this layer is reduced to the pure minimal functionality.

The typical implementation of a buffered driver on top of this uart interface would look like the following (pseudocode...):
```c
ringbuffer_t tx_buf;
ringbuffer_t rx_buf;

void rx_cb(char data)
{
ringbuf_insert(&rx_buf, data);
// wake up driver thread to notify the arrival of new data...
msg_send(driver_pid, ....);
}

void tx_cb(void)
{
if (tx_buf.size > 0) {
uart_write(ringbuf_get(&tx_buf));
} else {
uart_tx_end();
}
}

// during the initialization of the higher-level driver
uart_init(UART_x, 115200, &rx_cb, &tx_cb);

// when sending data on the uart
ringbuf_write(&tx_buf, someData);
uart_tx_begin(); // will send all bytes until tx_buf is empty
```