1 /* $Id: xgpio.h,v 1.1.1.1 2005/04/11 02:50:21 jack Exp $ */
2 /******************************************************************************
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
13 * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
14 * COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
15 * ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
16 * XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
17 * FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR
18 * OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
19 * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
20 * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
21 * WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
22 * CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
23 * FITNESS FOR A PARTICULAR PURPOSE.
26 * Xilinx products are not intended for use in life support appliances,
27 * devices, or systems. Use in such applications is expressly prohibited.
30 * (c) Copyright 2002 Xilinx Inc.
31 * All rights reserved.
34 * You should have received a copy of the GNU General Public License along
35 * with this program; if not, write to the Free Software Foundation, Inc.,
36 * 675 Mass Ave, Cambridge, MA 02139, USA.
38 ******************************************************************************/
39 /*****************************************************************************/
43 * This file contains the software API definition of the Xilinx General Purpose
44 * I/O (XGpio) component.
46 * The Xilinx GPIO controller is a soft IP core designed for Xilinx FPGAs and
47 * contains the following general features:
48 * - Support for 8, 16, or 32 I/O discretes
49 * - Each of the discretes can be configured for input or output.
53 * This API utilizes 32 bit I/O to the GPIO registers. With 16 and 8 bit GPIO
54 * components, the unused bits from registers are read as zero and written as
58 * MODIFICATION HISTORY:
60 * Ver Who Date Changes
61 * ----- ---- -------- -----------------------------------------------
62 * 1.00a rmm 03/13/02 First release
64 *****************************************************************************/
66 #ifndef XGPIO_H /* prevent circular inclusions */
67 #define XGPIO_H /* by using protection macros */
69 /***************************** Include Files ********************************/
71 #include "xbasic_types.h"
75 /************************** Constant Definitions ****************************/
77 /**************************** Type Definitions ******************************/
80 * This typedef contains configuration information for the device.
83 u16 DeviceId; /* Unique ID of device */
84 u32 BaseAddress; /* Device base address */
88 * The XGpio driver instance data. The user is required to allocate a
89 * variable of this type for every GPIO device in the system. A pointer
90 * to a variable of this type is then passed to the driver API functions.
93 u32 BaseAddress; /* Device base address */
94 u32 IsReady; /* Device is initialized and ready */
97 /***************** Macros (Inline Functions) Definitions ********************/
99 /************************** Function Prototypes *****************************/
102 * API Basic functions implemented in xgpio.c
104 XStatus XGpio_Initialize(XGpio * InstancePtr, u16 DeviceId);
105 void XGpio_SetDataDirection(XGpio * InstancePtr, u32 DirectionMask);
106 u32 XGpio_DiscreteRead(XGpio * InstancePtr);
107 void XGpio_DiscreteWrite(XGpio * InstancePtr, u32 Mask);
109 XGpio_Config *XGpio_LookupConfig(u16 DeviceId);
112 * API Functions implemented in xgpio_extra.c
114 void XGpio_DiscreteSet(XGpio * InstancePtr, u32 Mask);
115 void XGpio_DiscreteClear(XGpio * InstancePtr, u32 Mask);
118 * API Functions implemented in xgpio_selftest.c
120 XStatus XGpio_SelfTest(XGpio * InstancePtr);
121 #endif /* end of protection macro */