void UartInit(void) { // Allows access to the divisor latches of the baud generator during a // read or write operation (DLL and DLH) CSL_FINS (hUartRegs->LCR, UART_LCR_DLAB, CSL_UART_LCR_DLAB_ENABLE); // Break condition is disabled. CSL_FINS (hUartRegs->LCR, UART_LCR_BC, CSL_UART_LCR_BC_DISABLE); // Stick parity is disabled. CSL_FINS (hUartRegs->LCR, UART_LCR_SP, CSL_UART_LCR_SP_DISABLE); // Odd parity is selected CSL_FINS (hUartRegs->LCR, UART_LCR_EPS, CSL_UART_LCR_EPS_ODD); // No PARITY bit is transmitted or checked CSL_FINS (hUartRegs->LCR, UART_LCR_PEN, CSL_UART_LCR_PEN_DISABLE); // Set the baudrate,for accessing LCR[7] should be enable hUartRegs->DLL = DLL_VAL; hUartRegs->DLH = DLM_VAL; // Allows access to the receiver buffer register (RBR), // the transmitter holding register (THR), and the // interrupt enable register (IER) selected. CSL_FINS (hUartRegs->LCR, UART_LCR_DLAB, CSL_UART_LCR_DLAB_DISABLE); // Even Parity is selected CSL_FINS (hUartRegs->LCR, UART_LCR_EPS, CSL_UART_LCR_EPS_EVEN); // Parity Enable CSL_FINS (hUartRegs->LCR, UART_LCR_PEN, CSL_UART_LCR_PEN_ENABLE); // Disable THR, RHR, Receiver line status interrupts //CSL_FINS (hUartRegs->IER, UART_IER_ERBI, CSL_UART_IER_ERBI_DISABLE); CSL_FINS (hUartRegs->IER, UART_IER_ETBEI, CSL_UART_IER_ETBEI_DISABLE); CSL_FINS (hUartRegs->IER, UART_IER_ELSI, CSL_UART_IER_ELSI_DISABLE); CSL_FINS (hUartRegs->IER, UART_IER_EDSSI, CSL_UART_IER_EDSSI_DISABLE); CSL_FINS (hUartRegs->IER, UART_IER_ERBI, CSL_UART_IER_ERBI_ENABLE); /* If autoflow control is desired, * write appropriate values to the modem * control register (MCR). Note that all UARTs * do not support autoflow control, see * the device-specific data manual for supported features. * * MCR * ==================================================== * Bit Field Value Description * 5 AFE 0 Autoflow control is disabled * 4 LOOP 0 Loop back mode is disabled. * 1 RTS 0 RTS control (UARTn_RTS is disabled, * UARTn_CTS is only enabled.) * ===================================================== * * */ hUartRegs->MCR = 0; /* Choose the desired response to * emulation suspend events by configuring * the FREE bit and enable the UART by setting * the UTRST and URRST bits in the power and * emulation management register (PWREMU_MGMT). * * * PWREMU_MGMT * ================================================= * Bit Field Value Description * 14 UTRST 1 Transmitter is enabled * 13 URRST 1 Receiver is enabled * 0 FREE 1 Free-running mode is enabled * =================================================== * */ hUartRegs->PWREMU_MGMT = 0x6001; /* Cleanup previous data (rx trigger is also set to 0)*/ /* Set FCR = 0x07; */ CSL_FINS (hUartRegs->FCR, UART_FCR_FIFOEN, CSL_UART_FCR_FIFOEN_ENABLE); CSL_FINS (hUartRegs->FCR, UART_FCR_TXCLR, CSL_UART_FCR_TXCLR_CLR); CSL_FINS (hUartRegs->FCR, UART_FCR_RXCLR, CSL_UART_FCR_RXCLR_CLR); CSL_FINS (hUartRegs->FCR, UART_FCR_DMAMODE1, CSL_UART_FCR_DMAMODE1_DISABLE); CSL_FINS (hUartRegs->FCR, UART_FCR_RXFIFTL, CSL_UART_FCR_RXFIFTL_CHAR1); return; }