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.
Functions | |
void | GpioHandler (void *CallbackRef) |
This is the interrupt handler routine for the GPIO for this example. More... | |
int | GpioIntrExample (INTC *IntcInstancePtr, XGpio *InstancePtr, u16 DeviceId, u16 IntrId, 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 | GpioSetupIntrSystem (INTC *IntcInstancePtr, XGpio *InstancePtr, u16 DeviceId, u16 IntrId, u16 IntrMask) |
This function performs the GPIO set up for Interrupts. More... | |
void | GpioDisableIntr (INTC *IntcInstancePtr, XGpio *InstancePtr, u16 IntrId, u16 IntrMask) |
This function disables the interrupts for the GPIO. More... | |
int | main (void) |
This function is the main function of the GPIO example. More... | |
void GpioDisableIntr | ( | INTC * | IntcInstancePtr, |
XGpio * | InstancePtr, | ||
u16 | IntrId, | ||
u16 | IntrMask | ||
) |
This function disables the interrupts for the GPIO.
IntcInstancePtr | is a pointer to the Interrupt Controller driver Instance |
InstancePtr | is a pointer to the GPIO driver Instance |
IntrId | is XPAR_<INTC_instance>_<GPIO_instance>_VEC value from xparameters.h |
IntrMask | is the GPIO channel mask |
References XGpio_InterruptDisable().
Referenced by GpioIntrExample().
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(), and GpioSetupIntrSystem().
int GpioIntrExample | ( | INTC * | IntcInstancePtr, |
XGpio * | InstancePtr, | ||
u16 | DeviceId, | ||
u16 | IntrId, | ||
u16 | IntrMask, | ||
u32 * | DataRead | ||
) |
This is the entry function from the TestAppGen tool generated application which tests the interrupts when enabled in the GPIO.
IntcInstancePtr | is a reference to the Interrupt Controller driver Instance |
InstancePtr | is a reference to the GPIO driver Instance |
DeviceId | is the XPAR_<GPIO_instance>_DEVICE_ID value from xparameters.h |
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 GpioDisableIntr(), GpioHandler(), GpioSetupIntrSystem(), XGpio_Initialize(), and XGpio_LookupConfig().
Referenced by main().
int GpioSetupIntrSystem | ( | INTC * | IntcInstancePtr, |
XGpio * | InstancePtr, | ||
u16 | DeviceId, | ||
u16 | IntrId, | ||
u16 | IntrMask | ||
) |
This function performs the GPIO set up for Interrupts.
IntcInstancePtr | is a reference to the Interrupt Controller driver Instance |
InstancePtr | is a reference to the GPIO driver Instance |
DeviceId | is the XPAR_<GPIO_instance>_DEVICE_ID value from xparameters.h |
IntrId | is XPAR_<INTC_instance>_<GPIO_instance>_IP2INTC_IRPT_INTR value from xparameters.h |
IntrMask | is the GPIO channel mask |
References GpioHandler(), XGpio_InterruptEnable(), and XGpio_InterruptGlobalEnable().
Referenced by GpioIntrExample().
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().