From dd29e5eaf2778b944cbdb2895533522804acf42d Mon Sep 17 00:00:00 2001 From: Peter Wittich Date: Fri, 7 Jun 2019 18:26:16 -0400 Subject: [PATCH] UART to Zynq support --- common/uart.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/common/uart.c b/common/uart.c index cffd4d9a..e9430b3a 100644 --- a/common/uart.c +++ b/common/uart.c @@ -19,9 +19,10 @@ #include "FreeRTOS.h" #endif // USE_FREERTOS -// Initialize the UART -// based on uart_echo demo project -// we use UART4 (front panel) +// Initialize the UART(s) +// It is hard to generalize these initialization functions as they use +// a bunch of #define's that are not iterable +// UART4 is the front panel void UART4Init(uint32_t ui32SysClock) { @@ -48,6 +49,34 @@ UART4Init(uint32_t ui32SysClock) return; } +// UART1 is the Zynq +void +UART1Init(uint32_t ui32SysClock) +{ + // Turn on the UART peripheral + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1); + + + // + // Configure the UART for 115,200, 8-N-1 operation. + // + MAP_UARTConfigSetExpClk(UART1_BASE, ui32SysClock, 115200, + (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | + UART_CONFIG_PAR_NONE)); + + // + // Enable the UART interrupt. + // +#ifdef USE_FREERTOS + IntPrioritySet( INT_UART1, configKERNEL_INTERRUPT_PRIORITY ); +#endif // USE_FREERTOS + MAP_IntEnable(INT_UART1); + MAP_UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT); + + return; +} + + //*****************************************************************************