scugic
Vitis Drivers API Documentation
xscugic_example.c File Reference

Overview

This file contains a design example using the Interrupt Controller driver (XScuGic) and hardware device.

Please reference other device driver examples to see more examples of how the intc and interrupts can be used by a software application.

Note

None

MODIFICATION HISTORY:
Ver   Who  Date     Changes


1.00a drg 01/18/10 First release 5.0 mus 04/04/22 Updated example to support it on any CPU instance, for which example is compiled. It fixes CR#1126331. 5.0 adk 04/18/22 Replace infinite while loop with Xil_WaitForEventSet() API. adk 30/05/22 Fix typecast of the variable InterruptProcessed. adk 20/07/22 Update the Xil_WaitForEventSet() API arguments as per latest API. 5.1 mus 02/13/23 Support example for each core of APU/RPU clusters in VERSAL_NET SoC. 5.2 mus 07/27/23 Removed dependency on XPAR_CPU_ID.

Functions

int ScuGicExample (u16 DeviceId)
 This function is an example of how to use the interrupt controller driver (XScuGic) and the hardware device. More...
 
int SetUpInterruptSystem (XScuGic *XScuGicInstancePtr)
 This function connects the interrupt handler of the interrupt controller to the processor. More...
 
void DeviceDriverHandler (void *CallbackRef)
 This function is designed to look like an interrupt handler in a device driver. More...
 
int main (void)
 This is the main function for the Interrupt Controller example. More...
 

Function Documentation

void DeviceDriverHandler ( void *  CallbackRef)

This function is designed to look like an interrupt handler in a device driver.

This is typically a 2nd level handler that is called from the interrupt controller interrupt handler. This handler would typically perform device specific processing such as reading and writing the registers of the device to clear the interrupt condition and pass any data to an application using the device driver. Many drivers already provide this handler and the user is not required to create it.

Parameters
CallbackRefis passed back to the device driver's interrupt handler by the XScuGic driver. It was given to the XScuGic driver in the XScuGic_Connect() function call. It is typically a pointer to the device driver instance variable. In this example, we do not care about the callback reference, so we passed it a 0 when connecting the handler to the XScuGic driver and we make no use of it here.
Returns
None.
Note
None.

Referenced by ScuGicExample().

int main ( void  )

This is the main function for the Interrupt Controller example.

Parameters
None.
Returns
XST_SUCCESS to indicate success, otherwise XST_FAILURE.
Note
None.

References ScuGicExample().

int ScuGicExample ( u16  DeviceId)

This function is an example of how to use the interrupt controller driver (XScuGic) and the hardware device.

This function is designed to work without any hardware devices to cause interrupts. It may not return if the interrupt controller is not properly connected to the processor in either software or hardware.

This function relies on the fact that the interrupt controller hardware has come out of the reset state such that it will allow interrupts to be simulated by the software.

Parameters
DeviceIdis Device ID of the Interrupt Controller Device, typically XPAR_<INTC_instance>_DEVICE_ID value from xparameters.h
Returns
XST_SUCCESS to indicate success, otherwise XST_FAILURE
Note
None.

References XScuGic_Config::CpuBaseAddress, DeviceDriverHandler(), SetUpInterruptSystem(), XScuGic_CfgInitialize(), XScuGic_Connect(), XScuGic_Enable(), XScuGic_LookupConfig(), XScuGic_SelfTest(), XScuGic_SoftwareIntr(), and XSCUGIC_SPI_CPU0_MASK.

Referenced by main().

int SetUpInterruptSystem ( XScuGic XScuGicInstancePtr)

This function connects the interrupt handler of the interrupt controller to the processor.

This function is separate to allow it to be customized for each application. Each processor or RTOS may require unique processing to connect the interrupt handler.

Parameters
XScuGicInstancePtris the instance of the interrupt controller that needs to be worked on.
Returns
None.
Note
None.

References XScuGic_InterruptHandler().

Referenced by ScuGicExample().