Software Drivers

uartps v2_2

This driver supports the following features:

Initialization & Configuration

The XUartPs_Config structure is used by the driver to configure itself. Fields inside this structure are properties of XUartPs based on its hardware build.

To support multiple runtime loading and initialization strategies employed by various operating systems, the driver instance can be initialized in the following way:

Baud Rate

The UART has an internal baud rate generator, which furnishes the baud rate clock for both the receiver and the transmitter. Ther input clock frequency can be either the master clock or the master clock divided by 8, configured through the mode register.

Accompanied with the baud rate divider register, the baud rate is determined by:

	baud_rate = input_clock / (bgen * (bdiv + 1)
 

where bgen is the value of the baud rate generator, and bdiv is the value of baud rate divider.

Interrupts

The FIFOs are not flushed when the driver is initialized, but a function is provided to allow the user to reset the FIFOs if desired.

The driver defaults to no interrupts at initialization such that interrupts must be enabled if desired. An interrupt is generated for one of the following conditions.

The application can control which interrupts are enabled using the XUartPs_SetInterruptMask() function.

In order to use interrupts, it is necessary for the user to connect the driver interrupt handler, XUartPs_InterruptHandler(), to the interrupt system of the application. A separate handler should be provided by the application to communicate with the interrupt system, and conduct application specific interrupt handling. An application registers its own handler through the XUartPs_SetHandler() function.

Data Transfer

The functions, XUartPs_Send() and XUartPs_Recv(), are provided in the driver to allow data to be sent and received. They can be used in either polled or interrupt mode.

Note:

The default configuration for the UART after initialization is:

 MODIFICATION HISTORY:
 Ver   Who    Date	Changes
 ----- ------ -------- ----------------------------------------------
 1.00a	drg/jz 01/12/10 First Release
 1.00a sdm    09/27/11 Fixed compiler warnings and also a bug
		        in XUartPs_SetFlowDelay where the value was not
			being written to the register.
 1.01a sdm    12/20/11 Removed the InputClockHz parameter from the XUartPs
			instance structure and the driver is updated to use
			InputClockHz parameter from the XUartPs_Config config
			structure.
			Added a parameter to XUartPs_Config structure which
			specifies whether the user has selected Modem pins
			to be connected to MIO or FMIO.
			Added the tcl file to generate the xparameters.h
 1.02a sg     05/16/12	Changed XUARTPS_RXWM_MASK to 0x3F for CR 652540 fix.
 1.03a sg     07/16/12 Updated XUARTPS_FORMAT_7_BITS and XUARTPS_FORMAT_6_BITS
			with the correct values for CR 666724
 			Added defines for XUARTPS_IXR_TOVR,  XUARTPS_IXR_TNFUL
			and XUARTPS_IXR_TTRIG.
			Modified the name of these defines
			XUARTPS_MEDEMSR_DCDX to XUARTPS_MODEMSR_DDCD
			XUARTPS_MEDEMSR_RIX to XUARTPS_MODEMSR_TERI
			XUARTPS_MEDEMSR_DSRX to XUARTPS_MODEMSR_DDSR
			XUARTPS_MEDEMSR_CTSX to XUARTPS_MODEMSR_DCTS
 1.05a hk     08/22/13 Added API for uart reset and related
			constant definitions.
 2.0   hk      03/07/14 Version number revised.
 2.1   hk     04/16/14 Change XUARTPS_MAX_RATE to 921600. CR# 780625.
 2.2   hk     06/23/14 SW reset of RX and TX should be done when changing
                       baud rate. CR# 804281.