lpc176x: Add support for serial on UART3 P4.29/P4.28

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-05-25 12:58:26 -04:00
parent ce8fe615ed
commit b1f6a608c3
3 changed files with 23 additions and 9 deletions

View File

@ -70,8 +70,11 @@ choice
config LPC_USB
bool "USB"
select USBSERIAL
config LPC_SERIAL
bool "Serial"
config LPC_SERIAL_UART0_P03_P02
bool "Serial (on UART0 P0.3/P0.2)"
select SERIAL
config LPC_SERIAL_UART3_P429_P428
bool "Serial (on UART3 P4.29/P4.28)" if LOW_LEVEL_OPTIONS
select SERIAL
endchoice

View File

@ -16,6 +16,7 @@
#define PCLK_ADC 12
#define PCLK_I2C1 19
#define PCLK_SSP0 21
#define PCLK_UART3 25
#define PCLK_I2C2 26
#define PCLK_USB 31
int is_enabled_pclock(uint32_t pclk);

View File

@ -12,13 +12,23 @@
#include "internal.h" // gpio_peripheral
#include "sched.h" // DECL_INIT
DECL_CONSTANT_STR("RESERVE_PINS_serial", "P0.3,P0.2");
#define GPIO_Rx GPIO(0, 3)
#define GPIO_Tx GPIO(0, 2)
#define GPIO_FUNCTION_UARTx 1
#define LPC_UARTx LPC_UART0
#define UARTx_IRQn UART0_IRQn
#define PCLK_UARTx PCLK_UART0
#if CONFIG_LPC_SERIAL_UART0_P03_P02
DECL_CONSTANT_STR("RESERVE_PINS_serial", "P0.3,P0.2");
#define GPIO_Rx GPIO(0, 3)
#define GPIO_Tx GPIO(0, 2)
#define GPIO_FUNCTION_UARTx 1
#define LPC_UARTx LPC_UART0
#define UARTx_IRQn UART0_IRQn
#define PCLK_UARTx PCLK_UART0
#elif CONFIG_LPC_SERIAL_UART3_P429_P428
DECL_CONSTANT_STR("RESERVE_PINS_serial", "P4.29,P4.28");
#define GPIO_Rx GPIO(4, 29)
#define GPIO_Tx GPIO(4, 28)
#define GPIO_FUNCTION_UARTx 3
#define LPC_UARTx LPC_UART3
#define UARTx_IRQn UART3_IRQn
#define PCLK_UARTx PCLK_UART3
#endif
// Write tx bytes to the serial port
static void