gpiops
Vitis Drivers API Documentation
xgpiops_polled_example.c File Reference

Overview

This file contains an example for using GPIO hardware and driver.

This example provides the usage of APIs for reading/writing to the individual pins. Please see xgpiops.h file for description of the pin numbering.

Note
This example assumes that there is a Uart device in the HW design. This example is to provide support only for zcu102 on ZynqMp Platform and only for zc702 on Zynq Platform. For ZynqMP Platform, Input pin is 22(sw19 on zcu102 board) and Output Pin is 23(DS50 on zcu102 board). For Zynq Platform, Input Pins are 12(sw14 on zc702 board), 14(sw13 on zc702 board) and Output Pin is 10(DS23 on zc702 board). This example supports the VCK190 and VMK180 for Versal, but requires a PL shim. See Answer Record AR# 75677 and Figure 61 in AM011 Versal TRM for more details. Driver supports both PS GPIO and PMC GPIO. For accessing PMC GPIOs application you need to set "GPIO.PmcGpio = 1" otherwise it accesses PS GPIO.
MODIFICATION HISTORY:
Ver   Who  Date     Changes


1.00a sv 01/18/10 First Release 1.01a sv 04/15/12 Removed the calling of some unnecessary APIs. Updated the examples for a ZC702 board . Updated the example to use only pin APIs. 3.3 ms 04/17/17 Added notes about input and output pin description for zcu102 and zc702 boards. 3.7 sne 12/04/19 Reverted versal example support. 3.8 sne 09/17/20 Added description for Versal PS and PMC GPIO pins. 3.9 sne 11/19/20 Added versal PmcGpio example support. 3.12 gm 07/11/23 Added SDT support.

 

Functions

int GpioPolledExample (u16 DeviceId, u32 *DataRead)
 The purpose of this function is to illustrate how to use the GPIO driver to turn on/off an LED and read the inputs using the pin APIs. More...
 
int main (void)
 Main function to call the example. More...
 

Function Documentation

int GpioPolledExample ( u16  DeviceId,
u32 *  DataRead 
)

The purpose of this function is to illustrate how to use the GPIO driver to turn on/off an LED and read the inputs using the pin APIs.

Parameters
DeviceIdis the XPAR_<GPIO_instance>_DEVICE_ID value from xparameters.h
DataReadis the pointer where the data read from GPIO Input is returned.
Returns
  • XST_SUCCESS if the example has completed successfully.
  • XST_FAILURE if the example has failed.
Note
This function will not return if the test is running.

References XGpioPs_Config::BaseAddr, XGpioPs::PmcGpio, XGpioPs_CfgInitialize(), and XGpioPs_LookupConfig().

Referenced by main().

int main ( void  )

Main function to call the example.

Returns
  • XST_SUCCESS if the example has completed successfully.
  • XST_FAILURE if the example has failed.
Note
None

References GpioPolledExample().