summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4fa472b)
raw | patch | inline | side by side (parent: 4fa472b)
author | Sandeep Paulraj <s-paulraj@ti.com> | |
Fri, 1 Jul 2011 18:35:13 +0000 (14:35 -0400) | ||
committer | Sandeep Paulraj <s-paulraj@ti.com> | |
Fri, 1 Jul 2011 18:35:13 +0000 (14:35 -0400) |
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
src/hw/uart/c66x_uart/evmc66x_uart.c | [new file with mode: 0644] | patch | blob |
src/hw/uart/c66x_uart/evmc66x_uart.h | [new file with mode: 0644] | patch | blob |
src/hw/uart/i2c_uart/i2c_uart.c | [new file with mode: 0755] | patch | blob |
src/hw/uart/i2c_uart/i2c_uart.h | [new file with mode: 0755] | patch | blob |
diff --git a/src/hw/uart/c66x_uart/evmc66x_uart.c b/src/hw/uart/c66x_uart/evmc66x_uart.c
--- /dev/null
@@ -0,0 +1,258 @@
+/******************************************************************************
+ * Copyright (c) 2011 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *****************************************************************************/
+
+#include "platform_internal.h"
+
+#if (PLATFORM_UART_IN)
+
+/******************************************************************************
+ *
+ * File Name: evmc66x_uart.c
+ *
+ * Description: This file contains APIs for UART.
+ *
+ *
+ ******************************************************************************/
+
+/************************
+ * Include Files
+ ************************/
+
+/******************************************************************************
+ *
+ * Function: UartInit
+ *
+ * Description: This function initializes the UART.
+ *
+ * Parameters: void
+ *
+ * Return Value: void
+ *
+ ******************************************************************************/
+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);
+
+ /* 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;
+}
+
+/******************************************************************************
+ *
+ * Function: UartSetBaudRate
+ *
+ * Description: This function sets the UART baudrate.
+ *
+ * Parameters: UINT16 uiBaudRate - baudrate to set
+ *
+ * Return Value: void
+ *
+ ******************************************************************************/
+void UartSetBaudRate(uint16_t uiBaudRate)
+{
+ uint8_t uiDLLVal = 0;
+ uint8_t uiDLHVal = 0;
+
+ hUartRegs->LCR = 0x80;
+ uiDLLVal = (uint8_t )(0x00FF & uiBaudRate);
+ uiDLHVal = (uint8_t )(0x00FF & (uiBaudRate >> 8));
+
+ // Set the baudrate,for accessing LCR[7] should be enable
+ hUartRegs->DLL = uiDLLVal;
+ hUartRegs->DLH = uiDLHVal;
+ hUartRegs->LCR = 0x03;
+}
+
+/******************************************************************************
+ *
+ * Function: UartReadBaudRate
+ *
+ * Description: This function reads the UART baudrate.
+ *
+ * Parameters: UART_device eUartDevice - Uart Device
+ *
+ * Return Value: UINT16 - 16 bit Baudrate read from UART
+ *
+ ******************************************************************************/
+uint16_t UartReadBaudRate(void)
+{
+ uint16_t ushBaudrate = 0;
+ uint16_t ushTemp = 0;
+
+ hUartRegs->LCR = 0x80;
+ // Read the baudrate
+ ushBaudrate = hUartRegs->DLL;
+ ushTemp = hUartRegs->DLH;
+ ushBaudrate = (ushBaudrate & 0xFF) | ((ushTemp & 0xFF) << 8);
+ hUartRegs->LCR = 0x03;
+ return ushBaudrate;
+}
+
+/******************************************************************************
+ *
+ * Function: UartReadData
+ *
+ * Description: This function reads a byte of data from I2C UART device
+ *
+ * Return Value: uint8_t - 8-bit value read from the RBR register
+ ******************************************************************************/
+uint8_t UartReadData(void)
+{
+ uint8_t uRcvChar = 0;
+
+ uRcvChar = CSL_FEXT(hUartRegs->RBR, UART_RBR_DATA);
+
+ return uRcvChar;
+}
+
+/******************************************************************************
+ *
+ * Function: UartWriteData
+ *
+ * Description: This function writes a byte of data to UART device
+ *
+ * Parameters: uint8_t uchAddress - Address of 8-bit register
+ * uint8_t uchByte - 8-bit data to write to THR
+ *
+ * Return Value: none
+ ******************************************************************************/
+void UartWriteData(uint8_t uchByte)
+
+{
+ while (!(CSL_FEXT(hUartRegs->LSR, UART_LSR_THRE))) {
+ platform_delaycycles(10000);
+ }
+ CSL_FINS(hUartRegs->THR, UART_THR_DATA, uchByte);
+ return;
+}
+
+
+
+/******************************************************************************
+ *
+ * Function: UartIsDataReady
+ *
+ * Description: This function gets the status of DR bit
+ *
+ * Parameters: none
+ *
+ * Return Value: Status of DR bit
+ *
+ ******************************************************************************/
+Bool UartIsDataReady(void)
+{
+ Bool DR_val = FALSE;
+
+ if (CSL_UART_LSR_DR_READY == (CSL_FEXT(hUartRegs->LSR, UART_LSR_DR))) {
+ DR_val = TRUE;
+ }
+
+ return (DR_val);
+}
+/* Nothing past this point */
+
+#endif
diff --git a/src/hw/uart/c66x_uart/evmc66x_uart.h b/src/hw/uart/c66x_uart/evmc66x_uart.h
--- /dev/null
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * Copyright (c) 2011 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * File Name: evmc66x_i2c_uart.h
+ *
+ * Description: This contains UART specific structure, typedefs, function
+ * prototypes.
+ *
+ ******************************************************************************/
+#ifndef _EVM66X_I2C_UART_H_
+#define _EVM66X_I2C_UART_H_
+
+/************************
+ * Defines and Macros
+ ************************/
+// Mask to enable DLL and DLM
+#define DLAB (0x80) // Way to swap mem banks
+
+// for 19200 baudrate for crystal clock 14.7456 MHz
+#define DLL_VAL (0x30)
+#define DLM_VAL (0x00)
+
+// Macros to be used for setting baudrate
+#define BAUD_RATE_9600 (0x0060)
+#define BAUD_RATE_19200 (0x0030)
+#define BAUD_RATE_56000 (0x0010)
+#define BAUD_RATE_115200 (0x0008)
+
+#define hUartRegs ((CSL_UartRegs*) CSL_UART_REGS)
+
+
+/************************
+ * Function declarations
+************************/
+void UartInit(void);
+void UartSetBaudRate(uint16_t uiBaudRate);
+uint16_t UartReadBaudRate(void);
+uint8_t UartReadData(void);
+void UartWriteData(uint8_t uchByte);
+Bool UartIsDataReady(void);
+#endif // _EVM66X_I2C_UART_H_
+
diff --git a/src/hw/uart/i2c_uart/i2c_uart.c b/src/hw/uart/i2c_uart/i2c_uart.c
--- /dev/null
@@ -0,0 +1,231 @@
+/******************************************************************************
+ * Copyright (c) 2010 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * File Name: evmc64x_i2c_uart.c
+ *
+ * Description: This file contains APIs for I2C UART.
+ *
+ * History:
+ * AUG/11/2009, Amit Solanki, Created the file
+ * SEP/01/2009, Amit Solanki, Updated the documentation
+ *
+ ******************************************************************************/
+
+/************************
+ * Include Files
+ ************************/
+#include "evmc64x.h"
+#include "evmc64x_i2c.h"
+#include "evmc64x_i2c_uart.h"
+
+/******************************************************************************
+ *
+ * Function: i2cUartInit
+ *
+ * Description: This function initializes the UART.
+ *
+ * Parameters: void
+ *
+ * Return Value: void
+ *
+ ******************************************************************************/
+void i2cUartInit(UART_device eUartDevice)
+{
+ // Enable the Divisor lathc bit in LCR for accessing special register(DLL,DLH)
+ i2cUartWrite (eUartDevice, LCR, 0x80);
+ // Set the baudrate,for accessing LCR[7] should be enable
+ i2cUartWrite (eUartDevice, DLL, DLL_VAL);
+ i2cUartWrite (eUartDevice, DLM, DLM_VAL);
+
+ // 8-bits
+ i2cUartWrite (eUartDevice, LCR, 0x03);
+
+ // Disable THR and RHR interrupt
+ i2cUartWrite (eUartDevice, IER, 0x00);
+
+ // set all GPIO as 1
+ i2cUartWrite (eUartDevice, IOSTATE, 0xFF);
+ // Set GPIO direction as ouput
+ i2cUartWrite (eUartDevice, IODIR, 0xFF);
+}
+
+/******************************************************************************
+ *
+ * Function: i2cUartSetBaudRate
+ *
+ * Description: This function sets the UART baudrate.
+ *
+ * Parameters: UINT16 uiBaudRate - baudrate to set
+ *
+ * Return Value: void
+ *
+ ******************************************************************************/
+void i2cUartSetBaudRate(UART_device eUartDevice, UINT16 uiBaudRate)
+{
+ UINT8 uiDLLVal = 0;
+ UINT8 uiDLHVal = 0;
+
+ // Enable the Divisor lathc bit in LCR for
+ // accessing special register(DLL,DLH)
+ i2cUartWrite (eUartDevice, LCR, 0x80);
+ uiDLLVal = (UINT8 )(0x00FF & uiBaudRate);
+ uiDLHVal = (UINT8 )(0xFF00 & uiBaudRate) >> 8;
+
+ // Set the baudrate,for accessing LCR[7] should be enable
+ i2cUartWrite (eUartDevice, DLL, uiDLLVal);
+ i2cUartWrite (eUartDevice, DLM, uiDLHVal);
+
+ // 8-bits
+ i2cUartWrite (eUartDevice, LCR, 0x03);
+}
+
+/******************************************************************************
+ *
+ * Function: i2cUartReadBaudRate
+ *
+ * Description: This function reads the UART baudrate.
+ *
+ * Parameters: UART_device eUartDevice - Uart Device
+ *
+ * Return Value: UINT16 - 16 bit Baudrate read from UART
+ *
+ ******************************************************************************/
+UINT16 i2cUartReadBaudRate(UART_device eUartDevice)
+{
+ UINT16 ushBaudrate = 0;
+ UINT16 ushTemp = 0;
+
+ // Enable the Divisor lathc bit in LCR for accessing special register(DLL,DLH)
+ i2cUartWrite (eUartDevice, LCR, 0x80);
+
+ // Read the baudrate
+ ushBaudrate = i2cUartRead(eUartDevice, DLL);
+ ushTemp = i2cUartRead(eUartDevice, DLM);
+ ushBaudrate = (ushBaudrate & 0xFF) | ((ushTemp & 0xFF) << 8);
+
+ // 8-bits
+ i2cUartWrite (eUartDevice, LCR, 0x03);
+
+ return ushBaudrate;
+}
+
+/******************************************************************************
+ *
+ * Function: i2cUartRead
+ *
+ * Description: This function reads a byte of data from I2C UART device
+ *
+ * Parameters: UART_device eUartDevice - Uart Device
+ * UINT8 uchAddress - Address of 8-bit register
+ *
+ * Return Value: UINT8 - 8-bit value read from the register
+ ******************************************************************************/
+UINT8 i2cUartRead(UART_device eUartDevice, UINT8 uchAddress)
+{
+ UINT8 uChAdd;
+ UINT8 uRcvChar = 0;
+
+ if(I2C_UART_A == eUartDevice)
+ uChAdd = (uchAddress | UARTA_SELECT);
+ else
+ uChAdd = (uchAddress | UARTB_SELECT);
+
+ uRcvChar = i2cReadByte(uChAdd, I2C_UART_ADDR);
+
+ return uRcvChar;
+}
+
+/******************************************************************************
+ *
+ * Function: i2cUartWrite
+ *
+ * Description: This function writes a byte of data to I2C UART device
+ *
+ * Parameters: UART_device eUartDevice - Uart Device
+ * UINT8 uchAddress - Address of 8-bit register
+ * UINT8 uchByte - 8-bit data to write
+ *
+ * Return Value: UINT8 - 8-bit value read from the register
+ ******************************************************************************/
+void i2cUartWrite(UART_device eUartDevice, UINT8 uchAddress,
+ UINT8 uchByte)
+{
+ UINT8 uChAdd;
+
+ if(I2C_UART_A == eUartDevice)
+ uChAdd = (uchAddress | UARTA_SELECT);
+ else
+ uChAdd = (uchAddress | UARTB_SELECT);
+
+ i2cWriteByte(uChAdd, uchByte, I2C_UART_ADDR);
+}
+
+/******************************************************************************
+ *
+ * Function: i2cUartLedSet
+ *
+ * Description: This function Sets ON a user LED.
+ *
+ * Parameters: UINT32 uiLedNum - Led number (0-7)
+ *
+ * Return Value: void
+ *
+ ******************************************************************************/
+void i2cUartLedSet(UINT32 uiLedNum)
+{
+ UINT8 uchTemp = 0;
+ uchTemp = i2cUartRead(I2C_UART_A, IOSTATE);
+ uchTemp &= ~( 1 << (uiLedNum & 0x07) );
+ i2cUartWrite (I2C_UART_A, IOSTATE, uchTemp);
+}
+
+/******************************************************************************
+ *
+ * Function: i2cUartLedClear
+ *
+ * Description: This function clears OFF a user LED.
+ *
+ * Parameters: UINT32 uiLedNum - Led number (0-7)
+ *
+ * Return Value: void
+ *
+ ******************************************************************************/
+void i2cUartLedClear(UINT32 uiLedNum)
+{
+ UINT8 uchTemp = 0;
+ uchTemp = i2cUartRead(I2C_UART_A, IOSTATE);
+ uchTemp |= (1 << (uiLedNum & 0x07));
+ i2cUartWrite (I2C_UART_A, IOSTATE, uchTemp);
+}
diff --git a/src/hw/uart/i2c_uart/i2c_uart.h b/src/hw/uart/i2c_uart/i2c_uart.h
--- /dev/null
@@ -0,0 +1,128 @@
+/******************************************************************************
+ * Copyright (c) 2010 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * File Name: evmc64x_i2c_uart.h
+ *
+ * Description: This contains UART specific structure, typedefs, function
+ * prototypes.
+ *
+ * History:
+ * AUG/11/2009, Amit Solanki, Created the file
+ * AUG/8/2010, Deepika Makhija, Modified for Dual UART
+ *
+ ******************************************************************************/
+#ifndef _EVM64X_I2C_UART_H_
+#define _EVM64X_I2C_UART_H_
+
+/************************
+ * Include Files
+ ************************/
+#include "types.h"
+
+/************************
+ * Defines and Macros
+ ************************/
+ // UART I2C Slave Address
+#define I2C_UART_ADDR (0x4D)
+
+#define UARTA_SELECT (0x0 << 1)
+#define UARTB_SELECT (0x1 << 1)
+
+// UART register addresses
+#define THR (0x00 << 3) // transmit FIFO, write only
+#define RHR (0x00 << 3) // receive FIFO, read oly
+#define IER (0x01 << 3) // interrup enable reg., R/W
+#define FCR (0x02 << 3) // FIFO control, write only
+#define IIR (0x02 << 3) // interrupt status, read only
+#define LCR (0x03 << 3) // line control, R/W
+#define MCR (0x04 << 3) // modem control, R/W
+#define LSR (0x05 << 3) // Line status, R/W
+#define MSR (0x06 << 3) // Modem status, R/W
+#define SPR (0x07 << 3) // scratch pad, R/W
+#define TXFIFO (0x08 << 3) // TX FIFO, R
+#define RXFIFO (0x09 << 3) // RX FIFO, R
+
+#define IODIR (0x0A << 3) // IO Direction Control R/W
+#define IOSTATE (0x0B << 3) // IO State R/W
+#define IOINTMSK (0x0C << 3) // IO Interrupt Mask R/W
+#define IOCTRL (0x0E << 3) // IO Control R/W
+#define EFCR (0x0F << 3) // Enhancede Function Reg R/W
+
+// Special registers, LCR.7 must be set
+// to 1 to R/W to these registers
+#define DLL (0x00 << 3) // Baud rate divisor, LSB, R/W
+#define DLM (0x01 << 3) // Baud rate divisor, MSB, R/W
+#define EFR (0x02 << 3) // Enhanced register, R/W
+#define XON1 (0x04 << 3) // Flow control
+#define XON2 (0x05 << 3) // Flow control
+#define XOFF1 (0x06 << 3) // Flow control
+#define XOFF2 (0x07 << 3) // Flow control
+
+// Mask to enable DLL and DLM
+#define DLAB (0x80) // Way to swap mem banks
+
+// for 19200 baudrate for crystal clock 14.7456 MHz
+#define DLL_VAL (0x30)
+#define DLM_VAL (0x00)
+
+// Macros to be used for setting baudrate
+#define BAUD_RATE_9600 (0x0060)
+#define BAUD_RATE_19200 (0x0030)
+#define BAUD_RATE_56000 (0x0010)
+#define BAUD_RATE_115200 (0x0008)
+
+/************************
+ * Structures and Enums
+ ************************/
+typedef enum _UART_device
+{
+ I2C_UART_A = 0,
+ I2C_UART_B
+}UART_device;
+
+/************************
+ * Function declarations
+************************/
+void i2cUartInit(UART_device eUartDevice);
+void i2cUartSetBaudRate(UART_device eUartDevice, UINT16 uiBaudRate);
+UINT16 i2cUartReadBaudRate(UART_device eUartDevice);
+UINT8 i2cUartRead(UART_device eUartDevice, UINT8 uchAddress);
+void i2cUartWrite(UART_device eUartDevice, UINT8 uchAddress,
+ UINT8 uchByte);
+void i2cUartLedSet(UINT32 uiLedNum);
+void i2cUartLedClear(UINT32 uiLedNum);
+
+#endif // _EVM64X_I2C_UART_H_
+