From b1e329c74e94930ed03568d478f46e6ec9fc86d9 Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Wed, 26 Aug 2015 00:52:25 +0200 Subject: [PATCH] Fix some bit definitions for serial registers. Set callback to NULL when uart is turned OFF. --- drivers/serial.c | 5 +++-- include/core/lpc_regs_12xx.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/serial.c b/drivers/serial.c index b38bca9..7dc5d83 100644 --- a/drivers/serial.c +++ b/drivers/serial.c @@ -65,7 +65,7 @@ static struct uart_device uarts[NUM_UARTS] = { .out_buff = {0}, .sending = 0, .out_lock = 0, - .rx_callback = 0, + .rx_callback = NULL, .capabilities = (SERIAL_CAP_UART | SERIAL_CAP_RS485), .current_mode = SERIAL_MODE_UART, }, @@ -77,7 +77,7 @@ static struct uart_device uarts[NUM_UARTS] = { .out_buff = {0}, .sending = 0, .out_lock = 0, - .rx_callback = 0, + .rx_callback = NULL, .capabilities = (SERIAL_CAP_UART | SERIAL_CAP_IRDA), .current_mode = SERIAL_MODE_UART, }, @@ -429,6 +429,7 @@ void uart_off(uint32_t uart_num) uart_clk_off(uart_num); /* Turn Off power */ subsystem_power(uart->power_offset, 0); + uarts[uart_num].rx_callback = NULL; } diff --git a/include/core/lpc_regs_12xx.h b/include/core/lpc_regs_12xx.h index 90e7cf9..e8b80c6 100644 --- a/include/core/lpc_regs_12xx.h +++ b/include/core/lpc_regs_12xx.h @@ -563,8 +563,9 @@ struct lpc_uart #define LPC_UART_ENABLE_DLAB (0x01 << 7) /* FIFO Control Register */ #define LPC_UART_FIFO_EN (0x01 << 0) -#define LPC_UART_TX_CLR (0x01 << 1) -#define LPC_UART_RX_CLR (0x01 << 2) +#define LPC_UART_RX_CLR (0x01 << 1) +#define LPC_UART_TX_CLR (0x01 << 2) +#define LPC_UART_DMA_MODE_EN (0x01 << 3) #define LPC_UART_FIFO_TRIG(x) ((x & 0x03) << 6) /* 1 / 4 / 8 / 14 chars */ /* Interrupt Enable Register */ #define LPC_UART_RX_INT_EN (0x01 << 0) -- 2.43.0