summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/calypso/uart.c
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2013-01-03 22:44:00 +0100
committerSylvain Munaut <tnt@246tNt.com>2013-01-05 18:38:42 +0100
commit21bc3b8db014b5579eb9dd960feb87f24ea1e857 (patch)
tree63e1cbff820cacc4c5efd1f1640f00557a2f5ca7 /src/target/firmware/calypso/uart.c
parente340681c5bbcb9f904b0058d7f69f80ab2d32cc5 (diff)
fw: introduce per-board uart mapping
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Diffstat (limited to 'src/target/firmware/calypso/uart.c')
-rw-r--r--src/target/firmware/calypso/uart.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/target/firmware/calypso/uart.c b/src/target/firmware/calypso/uart.c
index bcb56bd0..ec587de5 100644
--- a/src/target/firmware/calypso/uart.c
+++ b/src/target/firmware/calypso/uart.c
@@ -193,7 +193,7 @@ static uint8_t uart_reg_read(int uart, enum uart_reg reg)
static void uart_irq_handler_cons(__unused enum irq_nr irqnr)
{
- const uint8_t uart = CONS_UART_NR;
+ const uint8_t uart = cons_get_uart();
uint8_t iir;
//uart_putchar_nb(uart, 'U');
@@ -226,7 +226,7 @@ static void uart_irq_handler_cons(__unused enum irq_nr irqnr)
static void uart_irq_handler_sercomm(__unused enum irq_nr irqnr)
{
- const uint8_t uart = SERCOMM_UART_NR;
+ const uint8_t uart = sercomm_get_uart();
uint8_t iir, ch;
//uart_putchar_nb(uart, 'U');
@@ -281,14 +281,14 @@ void uart_init(uint8_t uart, uint8_t interrupts)
uint8_t irq = uart2irq[uart];
uart_reg_write(uart, IER, 0x00);
- if (uart == CONS_UART_NR) {
+ if (uart == cons_get_uart()) {
cons_init();
if(interrupts) {
irq_register_handler(irq, &uart_irq_handler_cons);
irq_config(irq, 0, 0, 0xff);
irq_enable(irq);
}
- } else {
+ } else if (uart == sercomm_get_uart()) {
sercomm_init();
if(interrupts) {
irq_register_handler(irq, &uart_irq_handler_sercomm);
@@ -296,6 +296,8 @@ void uart_init(uint8_t uart, uint8_t interrupts)
irq_enable(irq);
}
uart_irq_enable(uart, UART_IRQ_RX_CHAR, 1);
+ } else {
+ return;
}
#if 0
if (uart == 1) {
@@ -331,7 +333,7 @@ void uart_init(uint8_t uart, uint8_t interrupts)
}
void uart_poll(uint8_t uart) {
- if(uart == CONS_UART_NR) {
+ if(uart == cons_get_uart()) {
uart_irq_handler_cons(0);
} else {
uart_irq_handler_sercomm(0);