From 80408dd5fd87161a9b8cd96da196ded925303f0b Mon Sep 17 00:00:00 2001 From: Venkata Naga Sai Krishna Kolapalli Date: Mon, 20 Apr 2015 16:39:08 +0530 Subject: [PATCH] uartps_v3_1 : Modified interrupt example to support ZynqMP. This patch adds support to Zynq Ultrascale+ MP for interrupt example. Signed-off-by: Venkata Naga Sai Krishna Kolapalli --- .../uartps/examples/xuartps_intr_example.c | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/XilinxProcessorIPLib/drivers/uartps/examples/xuartps_intr_example.c b/XilinxProcessorIPLib/drivers/uartps/examples/xuartps_intr_example.c index 131b1b5e..54d93fb8 100644 --- a/XilinxProcessorIPLib/drivers/uartps/examples/xuartps_intr_example.c +++ b/XilinxProcessorIPLib/drivers/uartps/examples/xuartps_intr_example.c @@ -55,7 +55,7 @@ * and increased the receive timeout to 8 * Removed the printf at the start of the main * Put the device normal mode at the end of the example -* +* 3.1 kvn 04/10/15 Added code to support Zynq Ultrascale+ MP. * * ****************************************************************************/ @@ -63,6 +63,7 @@ /***************************** Include Files *******************************/ #include "xparameters.h" +#include "xplatform_info.h" #include "xuartps.h" #include "xscugic.h" #include "xil_exception.h" @@ -191,6 +192,12 @@ int UartPsIntrExample(XScuGic *IntcInstPtr, XUartPs *UartInstPtr, u32 IntrMask; int BadByteCount = 0; + if (XGetPlatform_Info() == XPLAT_ZYNQ_ULTRA_MP) { +#ifdef XPAR_XUARTPS_1_DEVICE_ID + DeviceId = XPAR_XUARTPS_1_DEVICE_ID; +#endif + } + /* * Initialize the UART driver so that it's ready to use * Look up the configuration in the config table, then initialize it. @@ -238,6 +245,11 @@ int UartPsIntrExample(XScuGic *IntcInstPtr, XUartPs *UartInstPtr, XUARTPS_IXR_TOUT | XUARTPS_IXR_PARITY | XUARTPS_IXR_FRAMING | XUARTPS_IXR_OVER | XUARTPS_IXR_TXEMPTY | XUARTPS_IXR_RXFULL | XUARTPS_IXR_RXOVR; + + if (UartInstPtr->Platform == XPLAT_ZYNQ_ULTRA_MP) { + IntrMask |= XUARTPS_IXR_RBRK; + } + XUartPs_SetInterruptMask(UartInstPtr, IntrMask); XUartPs_SetOperMode(UartInstPtr, XUARTPS_OPER_MODE_LOCAL_LOOP); @@ -371,6 +383,25 @@ void Handler(void *CallBackRef, u32 Event, unsigned int EventData) TotalReceivedCount = EventData; TotalErrorCount++; } + + /* + * Data was received with an parity or frame or break error, keep the data + * but determine what kind of errors occurred. Specific to Zynq Ultrascale+ + * MP. + */ + if (Event == XUARTPS_EVENT_PARE_FRAME_BRKE) { + TotalReceivedCount = EventData; + TotalErrorCount++; + } + + /* + * Data was received with an overrun error, keep the data but determine + * what kind of errors occurred. Specific to Zynq Ultrascale+ MP. + */ + if (Event == XUARTPS_EVENT_RECV_ORERR) { + TotalReceivedCount = EventData; + TotalErrorCount++; + } }