3 /* $Id: xuartlite_selftest_example.c,v 1.1 2007/05/15 07:00:27 mta Exp $ */
\r
4 /*****************************************************************************
\r
6 * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
\r
7 * AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
\r
8 * SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
\r
9 * OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
\r
10 * APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
\r
11 * THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
\r
12 * AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
\r
13 * FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
\r
14 * WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
\r
15 * IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
\r
16 * REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
\r
17 * INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
\r
18 * FOR A PARTICULAR PURPOSE.
\r
20 * (c) Copyright 2005 Xilinx Inc.
\r
21 * All rights reserved.
\r
23 *****************************************************************************/
\r
24 /****************************************************************************/
\r
27 * @file xuartlite_selftest_example.c
\r
29 * This file contains a design example using the UartLite driver (XUartLite) and
\r
36 * MODIFICATION HISTORY:
\r
38 * Ver Who Date Changes
\r
39 * ----- ---- -------- -----------------------------------------------
\r
40 * 1.00a ecm 01/25/04 First Release.
\r
41 * 1.00a sv 06/13/05 Minor changes to comply to Doxygen and Coding guidelines
\r
43 ******************************************************************************/
\r
45 /***************************** Include Files *********************************/
\r
47 #include "xparameters.h"
\r
48 #include "xuartlite.h"
\r
50 /************************** Constant Definitions *****************************/
\r
53 * The following constants map to the XPAR parameters created in the
\r
54 * xparameters.h file. They are defined here such that a user can easily
\r
55 * change all the needed parameters in one place.
\r
57 #define UARTLITE_DEVICE_ID XPAR_RS232_UART_DEVICE_ID
\r
60 /**************************** Type Definitions *******************************/
\r
63 /***************** Macros (Inline Functions) Definitions *********************/
\r
66 /************************** Function Prototypes ******************************/
\r
68 XStatus UartLiteSelfTestExample(Xuint16 DeviceId);
\r
70 /************************** Variable Definitions *****************************/
\r
72 XUartLite UartLite; /* Instance of the UartLite device */
\r
74 /*****************************************************************************/
\r
77 * Main function to call the example. This function is not included if the
\r
78 * example is generated from the TestAppGen test tool.
\r
82 * @return XST_SUCCESS if succesful, otherwise XST_FAILURE.
\r
86 ******************************************************************************/
\r
93 * Run the UartLite self test example, specify the the Device ID that is
\r
94 * generated in xparameters.h
\r
96 Status = UartLiteSelfTestExample(UARTLITE_DEVICE_ID);
\r
97 if (Status != XST_SUCCESS)
\r
102 return XST_SUCCESS;
\r
107 /*****************************************************************************/
\r
110 * This function does a minimal test on the UartLite device and driver as a
\r
111 * design example. The purpose of this function is to illustrate
\r
112 * how to use the XUartLite component.
\r
115 * @param DeviceId is the XPAR_<uartlite_instance>_DEVICE_ID value from
\r
118 * @return XST_SUCCESS if succesful, otherwise XST_FAILURE.
\r
122 ****************************************************************************/
\r
123 XStatus UartLiteSelfTestExample(Xuint16 DeviceId)
\r
128 * Initialize the UartLite driver so that it is ready to use.
\r
130 Status = XUartLite_Initialize(&UartLite, DeviceId);
\r
131 if (Status != XST_SUCCESS)
\r
133 return XST_FAILURE;
\r
137 * Perform a self-test to ensure that the hardware was built correctly.
\r
139 Status = XUartLite_SelfTest(&UartLite);
\r
140 if (Status != XST_SUCCESS)
\r
142 return XST_FAILURE;
\r
145 return XST_SUCCESS;
\r