gpio
Vitis Drivers API Documentation
xgpio_tapp_example.c File Reference

Overview

This file contains a example for using AXI GPIO hardware and driver.

This example assumes that there is a UART Device or STDIO Device in the hardware system.

Note

None

MODIFICATION HISTORY:
Ver     Who  Date         Changes


1.00a sv 04/15/05 Initial release for TestApp integration. 3.00a sv 11/21/09 Updated to use HAL Processor APIs. 3.01a bss 04/18/13 Removed incorrect Documentation lines.(CR #701641) 4.1 lks 11/18/15 Updated to use canonical xparameters and clean up of the comments and code for CR 900381 4.3 ms 01/23/17 Added xil_printf statement in main function to ensure that "Successfully ran" and "Failed" strings are available in all examples. This is a fix for CR-965028. 4.10 gm 07/11/23 Added SDT support. 4.10 gm 08/28/23 Update example to support peripheral tests.

 

Functions

int GpioOutputExample (u16 DeviceId, u32 GpioWidth)
 This function does a minimal test on the GPIO device configured as OUTPUT and driver as a example. More...
 
int GpioInputExample (u16 DeviceId, u32 *DataRead)
 This function performs a test on the GPIO driver/device with the GPIO configured as INPUT. More...
 
int main (void)
 Main function to call the example. More...
 

Function Documentation

int GpioInputExample ( u16  DeviceId,
u32 *  DataRead 
)

This function performs a test on the GPIO driver/device with the GPIO configured as INPUT.

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 Test is successful
  • XST_FAILURE if the test is not successful
Note
None.

References XGpio_DiscreteRead(), XGpio_Initialize(), and XGpio_SetDataDirection().

Referenced by main().

int GpioOutputExample ( u16  DeviceId,
u32  GpioWidth 
)

This function does a minimal test on the GPIO device configured as OUTPUT and driver as a example.

Parameters
DeviceIdis the XPAR_<GPIO_instance>_DEVICE_ID value from xparameters.h
GpioWidthis the width of the GPIO
Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if unsuccessful
Note
None

References XGpio_DiscreteClear(), XGpio_DiscreteWrite(), XGpio_Initialize(), XGpio_LookupConfig(), and XGpio_SetDataDirection().

Referenced by main().

int main ( void  )

Main function to call the example.

This function is not included if the example is generated from the Peripheral Tests in SDK.

Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if unsuccessful
Note
None

References GpioInputExample(), and GpioOutputExample().