summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2017-12-15 11:50:09 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2017-12-15 11:50:09 (GMT)
commit316df2f9fb89991e0a597fd1c8f20d0ce1160252 (patch)
tree8c3f48a06b3f0a9cbea8d849a78468ec892e538f
parent71a01c55fa73d9660f320fc41034f26f9d2fdae8 (diff)
downloadbspam335x-316df2f9fb89991e0a597fd1c8f20d0ce1160252.zip
bspam335x-316df2f9fb89991e0a597fd1c8f20d0ce1160252.tar.gz
bspam335x-316df2f9fb89991e0a597fd1c8f20d0ce1160252.tar.bz2
Fixed uart baud rate calc bug.
-rw-r--r--SylixOS/driver/sio/am335x_sio.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/SylixOS/driver/sio/am335x_sio.c b/SylixOS/driver/sio/am335x_sio.c
index c0684e4..15dd463 100644
--- a/SylixOS/driver/sio/am335x_sio.c
+++ b/SylixOS/driver/sio/am335x_sio.c
@@ -172,13 +172,17 @@ static VOID __am335xUartFIFOConfigure (__PAM335X_UART_SIOCHAN pUartSioChan)
static VOID __am335xUartBaudRateSet (__PAM335X_UART_SIOCHAN pUartSioChan, UINT uiBaudRate)
{
UINT uiDivisorValue;
+ UINT uiModeFlag = UART16x_OPER_MODE;
+ if (uiBaudRate > 230400) {
+ uiModeFlag = UART13x_OPER_MODE;
+ }
/*
* Computing the Divisor Value.
*/
uiDivisorValue = UARTDivisorValCompute(__UART_MODULE_INPUT_CLK,
uiBaudRate,
- UART16x_OPER_MODE,
+ uiModeFlag,
UART_MIR_OVERSAMPLING_RATE_42);
/*
@@ -221,6 +225,11 @@ static VOID __am335xUartConfigure (__PAM335X_UART_SIOCHAN pUartSioChan,
UINT uiBaudRate,
UINT uiLineCharConfig)
{
+ UINT uiModeFlag = UART16x_OPER_MODE;
+
+ if (uiBaudRate > 230400) {
+ uiModeFlag = UART13x_OPER_MODE;
+ }
__am335xUartBaudRateSet(pUartSioChan, uiBaudRate);
/*
@@ -243,7 +252,7 @@ static VOID __am335xUartConfigure (__PAM335X_UART_SIOCHAN pUartSioChan,
/*
* Switching to UART16x operating mode.
*/
- UARTOperatingModeSelect(pUartSioChan->SIOCHAN_ulVirtAddrBase, UART16x_OPER_MODE);
+ UARTOperatingModeSelect(pUartSioChan->SIOCHAN_ulVirtAddrBase, uiModeFlag);
}
/*********************************************************************************************************
** : __am335xUartHwInit