/* Configure RS485 function. This function configure uart rs485.  */
void UARTRS485Cfg(unsigned long ulBase, unsigned long ulCfg)
/* Configure RS485 function. This function configure uart rs485.  */
void UARTRS485Cfg(unsigned long ulBase, unsigned long ulCfg)
{
    unsigned long ulTmpReg = 0;
    xASSERT(ulBase == UART1_BASE);
    xASSERT( (ulCfg & ~(
                            RS485_NMM_DIS         | RS485_NMM_EN          |
                            RS485_RX_EN           | RS485_RX_DIS          |
                            RS485_AUTO_ADDR_EN    | RS485_AUTO_ADDR_DIS   |
                            RS485_AUTO_DIR_DIS    |
                            RS485_AUTO_DIR_RTS    |
                            RS485_AUTO_DIR_DTR    |
                            RS485_AUTO_DIR_INV_EN | RS485_AUTO_DIR_INV_DIS
                       )
             ) == 0);
    ulTmpReg = xHWREG(ulBase + RS485CTRL);
    ulTmpReg &= ((~ulCfg) >> 16);
    ulTmpReg |= (ulCfg & 0xFFFF);
    xHWREG(ulBase + RS485CTRL) = ulTmpReg;
}