![]() |
gpio
Vitis Drivers API Documentation
|
This file contains a design example using the GPIO driver (XGpio) in an interrupt driven mode of operation.
This example does assume that there is an interrupt controller in the hardware system and the GPIO device is connected to the interrupt controller.
This file is used in the Peripheral Tests Application in SDK to include a simplified test for gpio interrupts.
The buttons and LEDs are on 2 separate channels of the GPIO so that interrupts are not caused when the LEDs are turned on and off.
MODIFICATION HISTORY:
Ver Who Date Changes
2.01a sn 05/09/06 Modified to be used by TestAppGen to include test for interrupts. 3.00a ktn 11/21/09 Updated to use HAL Processor APIs and minor changes as per coding guidelines. 3.00a sdm 02/16/11 Updated to support ARM Generic Interrupt Controller 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 Modified 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.11 gm 12/06/23 Added IER and GIER calls in SDT flow. 4.13 vlt 12/02/25 Added GlobalIntrMask initialization for SDT flow. 4.13 vlt 12/12/25 Update Doxygen comments to include SDT flow details.
Functions | |
| void | GpioHandler (void *CallbackRef) |
| This is the interrupt handler routine for the GPIO for this example. More... | |
| int | GpioIntrExample (XGpio *InstancePtr, UINTPTR BaseAddress, u16 IntrMask, u32 *DataRead) |
| This is the entry function from the TestAppGen tool generated application which tests the interrupts when enabled in the GPIO. More... | |
| int | main (void) |
| This function is the main function of the GPIO example. More... | |
| void GpioHandler | ( | void * | CallbackRef | ) |
This is the interrupt handler routine for the GPIO for this example.
| CallbackRef | is the Callback reference for the handler. |
References XGpio_InterruptClear().
Referenced by GpioIntrExample().
| int GpioIntrExample | ( | XGpio * | InstancePtr, |
| UINTPTR | BaseAddress, | ||
| u16 | IntrMask, | ||
| u32 * | DataRead | ||
| ) |
This is the entry function from the TestAppGen tool generated application which tests the interrupts when enabled in the GPIO.
| InstancePtr | is a reference to the GPIO driver Instance |
| BaseAddress | contains the base address of the device |
| IntrId | is XPAR_<INTC_instance>_<GPIO_instance>_IP2INTC_IRPT_INTR value from xparameters.h |
| IntrMask | is the GPIO channel mask |
| DataRead | is the pointer where the data read from GPIO Input is returned |
References GpioHandler(), XGpio_Config::IntrId, XGpio_Config::IntrParent, XGpio_Initialize(), XGpio_InterruptEnable(), XGpio_InterruptGlobalEnable(), and XGpio_LookupConfig().
Referenced by main().
| int main | ( | void | ) |
This function is the main function of the GPIO example.
It is responsible for initializing the GPIO device, setting up interrupts and providing a foreground loop such that interrupt can occur in the background.
References GpioIntrExample().