uartlite: Removed received data updation outside critical region.

This patch modifies the XUartLite_ReceiveBuffer function to
update the received data in critical region. Earlier the data
updation is outside the critical region.

Signed-off-by: Naga Sureshkumar Relli <nagasure@xilinx.com>
Reviewed-by: Anirudha Sarangi   <anirudh@xilinx.com>
This commit is contained in:
Naga Sureshkumar Relli 2015-07-21 14:10:21 +05:30 committed by Nava kishore Manne
parent f40ca1f4d4
commit e8f23f0aa5
3 changed files with 18 additions and 11 deletions

View file

@ -54,7 +54,7 @@ BEGIN driver uartlite
OPTION supported_peripherals = (mdm axi_uartlite);
OPTION driver_state = ACTIVE;
OPTION copyfiles = all;
OPTION VERSION = 3.0;
OPTION VERSION = 3.1;
OPTION NAME = uartlite;
BEGIN INTERFACE stdin

View file

@ -69,6 +69,10 @@
* 2.01a adk 18/04/13 Updated the code to avoid unused variable
* warnings when compiling with the -Wextra -Wall flags
* In the file xuartlite.c. CR:704999.
* 3.1 nsk 21/07/15 Updated XUartLite_ReceiveBuffer function to update the
* receive data into user buffer in critical region.
* CR#865787.
*
* </pre>
*
*****************************************************************************/
@ -576,8 +580,16 @@ unsigned int XUartLite_SendBuffer(XUartLite *InstancePtr)
unsigned int XUartLite_ReceiveBuffer(XUartLite *InstancePtr)
{
u8 StatusRegister;
u8 StatusRegisterVal;
unsigned int ReceivedCount = 0;
/*
* Enter a critical region by disabling all the UART interrupts to allow
* this call to stop a previous operation that may be interrupt driven
*/
StatusRegisterVal = XUartLite_GetStatusReg(InstancePtr->RegBaseAddress);
XUartLite_WriteReg(InstancePtr->RegBaseAddress,
XUL_CONTROL_REG_OFFSET, 0);
/*
* Loop until there is not more data buffered by the UART or the
* specified number of bytes is received
@ -613,14 +625,6 @@ unsigned int XUartLite_ReceiveBuffer(XUartLite *InstancePtr)
}
}
/*
* Enter a critical region by disabling all the UART interrupts to allow
* this call to stop a previous operation that may be interrupt driven
*/
StatusRegister = XUartLite_GetStatusReg(InstancePtr->RegBaseAddress);
XUartLite_WriteReg(InstancePtr->RegBaseAddress,
XUL_CONTROL_REG_OFFSET, 0);
/*
* Update the receive buffer to reflect the number of bytes that was
* received
@ -637,9 +641,9 @@ unsigned int XUartLite_ReceiveBuffer(XUartLite *InstancePtr)
* Restore the interrupt enable register to it's previous value such
* that the critical region is exited
*/
StatusRegister &= XUL_CR_ENABLE_INTR;
StatusRegisterVal &= XUL_CR_ENABLE_INTR;
XUartLite_WriteReg(InstancePtr->RegBaseAddress,
XUL_CONTROL_REG_OFFSET, StatusRegister);
XUL_CONTROL_REG_OFFSET, StatusRegisterVal);
return ReceivedCount;
}

View file

@ -134,6 +134,9 @@
* 3.0 adk 17/12/13 Fixed CR:741186,761863 Changes are made in the file
* xuartlite_selftest.c
* 3.0 adk 19/12/13 Update the driver as per new TCL API's
* 3.1 nsk 21/07/15 Updated XUartLite_ReceiveBuffer function in xuartlite.c
* to update the receive data into user buffer in critical
* region.CR#865787.
*
* </pre>
*