1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/msba2/drivers/msba2-uart0_thread.c

26 lines
579 B
C
Raw Normal View History

2010-09-30 15:10:39 +02:00
#include <chardev_thread.h>
2010-09-24 16:28:34 +02:00
#include <ringbuffer.h>
#include <stdio.h>
2010-09-30 15:10:39 +02:00
#include <thread.h>
#include <board_uart0.h>
#define UART0_BUFSIZE 32
2010-09-24 16:28:34 +02:00
2010-09-30 15:10:39 +02:00
extern ringbuffer uart0_ringbuffer;
extern int uart0_handler_pid;
2010-09-24 16:28:34 +02:00
static char buffer[UART0_BUFSIZE];
2010-09-30 15:10:39 +02:00
static void uart0_loop() {
chardev_loop(&uart0_ringbuffer);
}
2010-09-24 16:28:34 +02:00
2010-09-30 15:10:39 +02:00
void board_uart0_init() {
2010-09-24 16:28:34 +02:00
ringbuffer_init(&uart0_ringbuffer, buffer, UART0_BUFSIZE);
int pid = thread_create(KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN-1, CREATE_STACKTEST, uart0_loop, "uart0");
uart0_handler_pid = pid;
puts("uart0_init() [OK]");
}