boards/msb-430h: switched to periph/uart driver
parent
ed71388532
commit
daa716aaf8
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 INRIA
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup boards
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief msb-430 common putchar implementation
|
||||
*
|
||||
* @author Oliver Hahm <oliver.hahm@inria.fr>
|
||||
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "board.h"
|
||||
#include "kernel.h"
|
||||
|
||||
#include "board_uart0.h"
|
||||
|
||||
#define UART1_TX TXBUF1
|
||||
#define UART1_WAIT_TXDONE() while( (UTCTL1 & TXEPT) == 0 ) { _NOP(); }
|
||||
|
||||
int getchar(void)
|
||||
{
|
||||
#ifdef MODULE_UART0
|
||||
return uart0_readc();
|
||||
#else
|
||||
return U1RXBUF;
|
||||
#endif
|
||||
}
|
||||
|
||||
int putchar(int c)
|
||||
{
|
||||
UART1_TX = c;
|
||||
UART1_WAIT_TXDONE();
|
||||
|
||||
if (c == 10) {
|
||||
UART1_WAIT_TXDONE();
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
void usart0irq(void);
|
||||
/**
|
||||
* \brief the interrupt function
|
||||
*/
|
||||
void __attribute__((interrupt(USART1RX_VECTOR))) usart0irq(void)
|
||||
{
|
||||
U1TCTL &= ~URXSE; /* Clear the URXS signal */
|
||||
U1TCTL |= URXSE; /* Re-enable URXS - needed here?*/
|
||||
/* Check status register for receive errors. */
|
||||
if(U1RCTL & RXERR) {
|
||||
if (U1RCTL & FE) {
|
||||
puts("rx framing error");
|
||||
}
|
||||
if (U1RCTL & OE) {
|
||||
puts("rx overrun error");
|
||||
}
|
||||
if (U1RCTL & PE) {
|
||||
puts("rx parity error");
|
||||
}
|
||||
if (U1RCTL & BRK) {
|
||||
puts("rx break error");
|
||||
}
|
||||
/* Clear error flags by forcing a dummy read. */
|
||||
volatile int c = U1RXBUF;
|
||||
(void) c;
|
||||
}
|
||||
#ifdef MODULE_UART0
|
||||
else if (uart0_handler_pid != KERNEL_PID_UNDEF) {
|
||||
volatile int c = U1RXBUF;
|
||||
uart0_handle_incoming(c);
|
||||
uart0_notify_thread();
|
||||
}
|
||||
#endif
|
||||
}
|
Loading…
Reference in New Issue