| intc Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Data Structures | Macros | Functions | Variables
Overview

## Data Structures
struct | XIntc_Config
| This typedef contains configuration information for the device. More...
struct | XIntc
| The XIntc driver instance data. More...

## Macros
#define | XIntc_MasterEnable(BaseAddress)
| Enable all interrupts in the Master Enable register of the interrupt controller. More...
#define | XIntc_MasterDisable(BaseAddress) XIntc_Out32((BaseAddress) + XIN_MER_OFFSET, 0)
| Disable all interrupts in the Master Enable register of the interrupt controller. More...
#define | XIntc_EnableIntr(BaseAddress, EnableMask) XIntc_Out32((BaseAddress) + XIN_IER_OFFSET, (EnableMask))
| Enable specific interrupt(s) in the interrupt controller. More...
#define | XIntc_DisableIntr(BaseAddress, DisableMask) XIntc_Out32((BaseAddress) + XIN_IER_OFFSET, ~(DisableMask))
| Disable specific interrupt(s) in the interrupt controller. More...
#define | XIntc_AckIntr(BaseAddress, AckMask) XIntc_Out32((BaseAddress) + XIN_IAR_OFFSET, (AckMask))
| Acknowledge specific interrupt(s) in the interrupt controller. More...
#define | XIntc_GetIntrStatus(BaseAddress)
| Get the interrupt status from the interrupt controller which indicates which interrupts are active and enabled. More...

## Functions
int | XIntc_Initialize (XIntc *InstancePtr, u16 DeviceId)
| Initialize a specific interrupt controller instance/driver. More...
int | XIntc_Start (XIntc *InstancePtr, u8 Mode)
| Starts the interrupt controller by enabling the output from the controller to the processor. More...
void | XIntc_Stop (XIntc *InstancePtr)
| Stops the interrupt controller by disabling the output from the controller so that no interrupts will be caused by the interrupt controller. More...
int | XIntc_Connect (XIntc *InstancePtr, u8 Id, XInterruptHandler Handler, void *CallBackRef)
| Makes the connection between the Id of the interrupt source and the associated handler that is to run when the interrupt is recognized. More...
void | XIntc_Disconnect (XIntc *InstancePtr, u8 Id)
| Updates the interrupt table with the Null Handler and NULL arguments at the location pointed at by the Id. More...
void | XIntc_Enable (XIntc *InstancePtr, u8 Id)
| Enables the interrupt source provided as the argument Id. More...
void | XIntc_Disable (XIntc *InstancePtr, u8 Id)
| Disables the interrupt source provided as the argument Id such that the interrupt controller will not cause interrupts for the specified Id. More...
void | XIntc_Acknowledge (XIntc *InstancePtr, u8 Id)
| Acknowledges the interrupt source provided as the argument Id. More...
XIntc_Config * | XIntc_LookupConfig (u16 DeviceId)
| Looks up the device configuration based on the unique device ID. More...
int | XIntc_ConnectFastHandler (XIntc *InstancePtr, u8 Id, XFastInterruptHandler Handler)
| Makes the connection between the Id of the interrupt source and the associated handler that is to run when the interrupt is recognized.In Cascade mode, connects handler to corresponding Slave controller IVAR/IVEAR register depending on the Id and sets all interrupt sources of the Slave controller as fast interrupts. More...
void | XIntc_SetNormalIntrMode (XIntc *InstancePtr, u8 Id)
| Sets the normal interrupt mode for the specified interrupt in the Interrupt Mode Register. More...
int | XIntc_TriggerSwIntr (XIntc *InstancePtr, u8 Id)
| Allows software to trigger software interrupt. More...
void | XIntc_InterruptHandler (XIntc *InstancePtr)
| Interrupt handler for the driver used when there can be no argument passed to the handler. More...
int | XIntc_SetOptions (XIntc *InstancePtr, u32 Options)
| Set the options for the interrupt controller driver. More...
u32 | XIntc_GetOptions (XIntc *InstancePtr)
| Return the currently set options. More...
int | XIntc_SelfTest (XIntc *InstancePtr)
| Run a self-test on the driver/device. More...
int | XIntc_SimulateIntr (XIntc *InstancePtr, u8 Id)
| Allows software to simulate an interrupt in the interrupt controller. More...
XIntc_Config * | LookupConfigByBaseAddress (UINTPTR BaseAddress)
| Looks up the device configuration based on the base address of the device. More...
void | XIntc_DeviceInterruptHandler (void *DeviceId)
| This function is the primary interrupt handler for the driver. More...
void | XIntc_SetIntrSvcOption (UINTPTR BaseAddress, int Option)
| Set the interrupt service option, which can configure the driver so that it services only a single interrupt at a time when an interrupt occurs, or services all pending interrupts when an interrupt occurs. More...
void | XIntc_RegisterHandler (UINTPTR BaseAddress, int InterruptId, XInterruptHandler Handler, void *CallBackRef)
| Register a handler function for a specific interrupt ID. More...
void | XIntc_RegisterFastHandler (UINTPTR BaseAddress, u8 Id, XFastInterruptHandler FastHandler)
| Register a fast handler function for a specific interrupt ID. More...

## Variables
XIntc_Config | XIntc_ConfigTable []
| This table contains configuration information for each intc device in the system. More...
XIntc_Config | XIntc_ConfigTable [XPAR_XINTC_NUM_INSTANCES]
| This table contains configuration information for each intc device in the system. More...
XIntc_Config | XIntc_ConfigTable []
| This table contains configuration information for each intc device in the system. More...

## Configuration options
These options are used in XIntc_SetOptions() to configure the device.
#define | XIN_SVC_SGL_ISR_OPTION 1UL
#define | XIN_SVC_ALL_ISRS_OPTION 2UL

## Start modes
One of these values is passed to XIntc_Start() to start the device.
#define | XIN_SIMULATION_MODE 0
| Simulation only mode, no hardware interrupts recognized. More...
#define | XIN_REAL_MODE 1
| Real mode, no simulation allowed, hardware interrupts recognized. More...

## Masks to specify Interrupt Controller Mode
#define | XIN_INTC_NOCASCADE 0 /* Normal - No Cascade Mode */
#define | XIN_INTC_PRIMARY 1 /* Master/Primary controller */
#define | XIN_INTC_SECONDARY 2 /* Secondary Slave Controllers */
#define | XIN_INTC_LAST 3 /* Last Slave Controller */

## Mask to specify maximum number of interrupt sources per controller
#define | XIN_CONTROLLER_MAX_INTRS
#define | XINTC_STANDARD_VECTOR_ADDRESS_WIDTH 32U

## Macro Definition Documentation

#define XIN_REAL_MODE 1

Real mode, no simulation allowed, hardware interrupts recognized.

Referenced by IntcInterruptSetup(), and XIntc_Start().

#define XIN_SIMULATION_MODE 0

Simulation only mode, no hardware interrupts recognized.

Referenced by SetUpInterruptSystem(), and XIntc_Start().

#define XIN_SVC_SGL_ISR_OPTION 1UL

    XIN_SVC_SGL_ISR_OPTION  Service the highest priority pending interrupt
                            and then return.
    XIN_SVC_ALL_ISRS_OPTION Service all of the pending interrupts and then
                            return.

Referenced by XIntc_DeviceInterruptHandler(), XIntc_Initialize(), and XIntc_SetOptions().

#define XIntc_AckIntr | ( |  | BaseAddress,
|  |  | AckMask
| ) |  | XIntc_Out32((BaseAddress) + XIN_IAR_OFFSET, (AckMask))

Acknowledge specific interrupt(s) in the interrupt controller.

Parameters

  BaseAddress | is the base address of the device
  AckMask | is the 32-bit value to write to the acknowledge register. Each bit of the mask corresponds to an interrupt input signal that is connected to the interrupt controller (INT0 = LSB). Only the bits which are set in the mask will acknowledge interrupts.

Returns
  None.

Note
  C-style signature: void XIntc_AckIntr(u32 BaseAddress, u32 AckMask);

Referenced by XIntc_DeviceInterruptHandler().

#define XIntc_DisableIntr | ( |  | BaseAddress,
|  |  | DisableMask
| ) |  | XIntc_Out32((BaseAddress) + XIN_IER_OFFSET, ~(DisableMask))

Disable specific interrupt(s) in the interrupt controller.

Parameters

  BaseAddress | is the base address of the device
  DisableMask | is the 32-bit value to write to the enable register. Each bit of the mask corresponds to an interrupt input signal that is connected to the interrupt controller (INT0 = LSB). Only the bits which are set in the mask will disable interrupts.

Returns
  None.

Note
  C-style signature: void XIntc_DisableIntr(u32 BaseAddress, u32 DisableMask);

#define XIntc_EnableIntr | ( |  | BaseAddress,
|  |  | EnableMask
| ) |  | XIntc_Out32((BaseAddress) + XIN_IER_OFFSET, (EnableMask))

Enable specific interrupt(s) in the interrupt controller.

Parameters

  BaseAddress | is the base address of the device
  EnableMask | is the 32-bit value to write to the enable register. Each bit of the mask corresponds to an interrupt input signal that is connected to the interrupt controller (INT0 = LSB). Only the bits which are set in the mask will enable interrupts.

Returns
  None.

Note
  C-style signature: void XIntc_EnableIntr(u32 BaseAddress, u32 EnableMask);

Referenced by IntcLowLevelExample().

#define XIntc_GetIntrStatus | ( |  | BaseAddress | ) |

Value:
(XIntc_In32((BaseAddress) + XIN_ISR_OFFSET) & \
XIntc_In32((BaseAddress) + XIN_IER_OFFSET))

Get the interrupt status from the interrupt controller which indicates which interrupts are active and enabled.

Parameters

  BaseAddress | is the base address of the device

Returns
  The 32-bit contents of the interrupt status register. Each bit corresponds to an interrupt input signal that is connected to the interrupt controller (INT0 = LSB). Bits which are set indicate an active interrupt which is also enabled.

Note
  C-style signature: u32 XIntc_GetIntrStatus(u32 BaseAddress);

Referenced by XIntc_DeviceInterruptHandler().

#define XIntc_MasterDisable | ( |  | BaseAddress | ) | XIntc_Out32((BaseAddress) + XIN_MER_OFFSET, 0)

Disable all interrupts in the Master Enable register of the interrupt controller.

Parameters

  BaseAddress | is the base address of the device.

Returns
  None.

Note
  C-style signature: void XIntc_MasterDisable(u32 BaseAddress);

#define XIntc_MasterEnable | ( |  | BaseAddress | ) |

Value:
XIntc_Out32((BaseAddress) + XIN_MER_OFFSET, \
XIN_INT_MASTER_ENABLE_MASK | XIN_INT_HARDWARE_ENABLE_MASK)

Enable all interrupts in the Master Enable register of the interrupt controller.

The interrupt controller defaults to all interrupts disabled from reset such that this macro must be used to enable interrupts.

Parameters

  BaseAddress | is the base address of the device.

Returns
  None.

Note
  C-style signature: void XIntc_MasterEnable(u32 BaseAddress);

## Function Documentation

XIntc_Config * LookupConfigByBaseAddress | ( | UINTPTR | BaseAddress | ) |

Looks up the device configuration based on the base address of the device.

A table contains the configuration info for each device in the system.

Parameters

  BaseAddress | is the unique identifier for a device.

Returns

A pointer to the configuration structure for the specified device, or NULL if the device was not found.

Note
  None.

References XIntc_ConfigTable.

Referenced by IntcLowLevelExample(), XIntc_DeviceInterruptHandler(), XIntc_RegisterHandler(), and XIntc_SetIntrSvcOption().

void XIntc_Acknowledge | ( | XIntc * | InstancePtr,
|  | u8 | Id
| ) |  |

Acknowledges the interrupt source provided as the argument Id.

When the interrupt is acknowledged, it causes the interrupt controller to clear its interrupt condition.In Cascade mode, acknowledges corresponding interrupt source of Slave controllers depending on the Id.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_INTC_MAX_NUM_INTR_INPUTS - 1 with 0 being the highest priority interrupt.

Returns
  None.

Note
  None.

References XIntc_Config::BaseAddress, XIntc::BaseAddress, XIntc::IsReady, and XIntc_LookupConfig().

int XIntc_Connect | ( | XIntc * | InstancePtr,
|  | u8 | Id,
|  | XInterruptHandler | Handler,
|  | void * | CallBackRef
| ) |  |

Makes the connection between the Id of the interrupt source and the associated handler that is to run when the interrupt is recognized.

The argument provided in this call as the Callbackref is used as the argument for the handler when it is called. In Cascade mode, connects handler to Slave controller handler table depending on the interrupt Id.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_INTC_MAX_NUM_INTR_INPUTS - 1 with 0 being the highest priority interrupt.
  Handler | to the handler for that interrupt.
  CallBackRef | is the callback reference, usually the instance pointer of the connecting driver.

Returns

                  - XST_SUCCESS if the handler was connected correctly.

Note

WARNING: The handler provided as an argument will overwrite any handler that was previously connected.

References XIntc::CfgPtr, XIntc_Config::HandlerTable, XIntc::IsReady, and XIntc_LookupConfig().

Referenced by SetUpInterruptSystem().

int XIntc_ConnectFastHandler | ( | XIntc * | InstancePtr,
|  | u8 | Id,
|  | XFastInterruptHandler | Handler
| ) |  |

Makes the connection between the Id of the interrupt source and the associated handler that is to run when the interrupt is recognized.In Cascade mode, connects handler to corresponding Slave controller IVAR/IVEAR register depending on the Id and sets all interrupt sources of the Slave controller as fast interrupts.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_INTC_MAX_NUM_INTR_INPUTS - 1 with 0 being the highest priority interrupt.
  Handler | for specified interrupt id. It must be declared with "fast_interrupt" attribute. e.g. static void MyHandler(void) attribute ((fast_interrupt));

Returns
  - XST_SUCCESS

Note
  Slave controllers in Cascade Mode should have all as Fast interrupts or Normal interrupts, mixed interrupts are not supported

WARNING: The handler provided as an argument will overwrite any handler that was previously connected.

References XIntc_Config::BaseAddress, XIntc::BaseAddress, XIntc::CfgPtr, XIntc_Config::FastIntr, XIntc::IsReady, XIntc_Config::VectorAddrWidth, XIntc_Disable(), XIntc_Enable(), and XIntc_LookupConfig().

void XIntc_DeviceInterruptHandler | ( | void * | DeviceId | ) |

This function is the primary interrupt handler for the driver.

It must be connected to the interrupt source such that is called when an interrupt of the interrupt controller is active. It will resolve which interrupts are active and enabled and call the appropriate interrupt handler. It uses the AckBeforeService flag in the configuration data to determine when to acknowledge the interrupt. Highest priority interrupts are serviced first. This function assumes that an interrupt vector table has been previously initialized.It does not verify that entries in the table are valid before calling an interrupt handler. In Cascade mode this function calls XIntc_CascadeHandler to handle interrupts of Master and Slave controllers. This functions also handles interrupts nesting by saving and restoring link register of Microblaze and Interrupt Level register of interrupt controller properly.

Parameters

  DeviceId | is the zero-based device ID defined in xparameters.h of the interrupting interrupt controller. It is used as a direct index into the configuration data, which contains the vector table for the interrupt controller. Note that even though the argument is a void pointer, the value is not a pointer but the actual device ID. The void pointer type is necessary to meet the XInterruptHandler typedef for interrupt handlers.

Returns
  None.

Note
  For nested interrupts, this function saves microblaze r14 register on entry and restores on exit. This is required since compiler does not support nesting. This function enables Microblaze interrupts after blocking further interrupts from the current interrupt number and interrupts below current interrupt priority by writing to Interrupt Level Register of INTC on entry. On exit, it disables microblaze interrupts and restores ILR register default value(0xFFFFFFFF)back. It is recommended to increase STACK_SIZE in linker script for nested interrupts.

References XIntc_Config::AckBeforeService, XIntc_Config::BaseAddress, XIntc_Config::FastIntr, XIntc_Config::HandlerTable, XIntc_Config::IntcType, LookupConfigByBaseAddress(), XIntc_Config::NumberofIntrs, XIntc_Config::NumberofSwIntrs, XIntc_Config::Options, XIN_SVC_SGL_ISR_OPTION, XIntc_AckIntr, XIntc_ConfigTable, and XIntc_GetIntrStatus.

Referenced by IntcInterruptSetup(), SetupInterruptSystem(), and XIntc_InterruptHandler().

void XIntc_Disable | ( | XIntc * | InstancePtr,
|  | u8 | Id
| ) |  |

Disables the interrupt source provided as the argument Id such that the interrupt controller will not cause interrupts for the specified Id.

The interrupt controller will continue to hold an interrupt condition for the Id, but will not cause an interrupt.In Cascade mode, disables corresponding interrupt of Slave controllers depending on the Id.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_INTC_MAX_NUM_INTR_INPUTS - 1 with 0 being the highest priority interrupt.

Returns
  None.

Note
  None.

References XIntc_Config::BaseAddress, XIntc::BaseAddress, XIntc::IsReady, and XIntc_LookupConfig().

Referenced by XIntc_ConnectFastHandler(), and XIntc_SetNormalIntrMode().

void XIntc_Disconnect | ( | XIntc * | InstancePtr,
|  | u8 | Id
| ) |  |

Updates the interrupt table with the Null Handler and NULL arguments at the location pointed at by the Id.

This effectively disconnects that interrupt source from any handler. The interrupt is disabled also. In Cascade mode, disconnects handler from Slave controller handler table depending on the interrupt Id.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_INTC_MAX_NUM_INTR_INPUTS - 1 with 0 being the highest priority interrupt.

Returns
  None.

Note
  None.

References XIntc_Config::BaseAddress, XIntc::BaseAddress, XIntc::CfgPtr, XIntc_Config::HandlerTable, XIntc::IsReady, and XIntc_LookupConfig().

void XIntc_Enable | ( | XIntc * | InstancePtr,
|  | u8 | Id
| ) |  |

Enables the interrupt source provided as the argument Id.

Any pending interrupt condition for the specified Id will occur after this function is called. In Cascade mode, enables corresponding interrupt of Slave controllers depending on the Id.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_INTC_MAX_NUM_INTR_INPUTS - 1 with 0 being the highest priority interrupt.

Returns
  None.

Note
  None.

References XIntc_Config::BaseAddress, XIntc::BaseAddress, XIntc::IsReady, and XIntc_LookupConfig().

Referenced by SetUpInterruptSystem(), XIntc_ConnectFastHandler(), and XIntc_SetNormalIntrMode().

u32 XIntc_GetOptions | ( | XIntc * | InstancePtr | ) |

Return the currently set options.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.

Returns
  The currently set options. The options are described in xintc.h.

Note
  None.

References XIntc::CfgPtr, XIntc::IsReady, and XIntc_Config::Options.

int XIntc_Initialize | ( | XIntc * | InstancePtr,
|  | u16 | DeviceId
| ) |  |

Initialize a specific interrupt controller instance/driver.

The initialization entails:

      - Initialize fields of the XIntc structure
      - Initial vector table with stub function calls
      - All interrupt sources are disabled
      - Interrupt output is disabled

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  DeviceId | is the unique id of the device controlled by this XIntc instance. Passing in a device id associates the generic XIntc instance to a specific device, as chosen by the caller or application developer.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_DEVICE_IS_STARTED if the device has already been started
  - XST_DEVICE_NOT_FOUND if device configuration information was not found for a device with the supplied device ID.

Note
  In Cascade mode this function calls XIntc_InitializeSlaves to initialize Slave Interrupt controllers.

References XIntc_Config::BaseAddress, XIntc::BaseAddress, XIntc::CfgPtr, XIntc_Config::FastIntr, XIntc_Config::HandlerTable, XIntc_Config::IntcType, XIntc::IsReady, XIntc::IsStarted, XIntc_Config::NumberofIntrs, XIntc_Config::NumberofSwIntrs, XIntc_Config::Options, XIntc_Config::VectorAddrWidth, XIN_SVC_SGL_ISR_OPTION, and XIntc_LookupConfig().

Referenced by IntcExample(), IntcInterruptSetup(), and IntcSelfTestExample().

void XIntc_InterruptHandler | ( | XIntc * | InstancePtr | ) |

Interrupt handler for the driver used when there can be no argument passed to the handler.

This function is provided mostly for backward compatibility. The user should use XIntc_DeviceInterruptHandler(), defined in xintc_l.c, if possible.

The user must connect this function to the interrupt system such that it is called whenever the devices which are connected to it cause an interrupt.

Returns
  None.

Note

The constant XPAR_INTC_SINGLE_DEVICE_ID must be defined for this handler to be included in the driver compilation.

The interrupt handler for the driver. This function is provided mostly for backward compatibility. The user should use XIntc_DeviceInterruptHandler(), defined in xintc_l.c when possible and pass the device ID of the interrupt controller device as its argument.

The user must connect this function to the interrupt system such that it is called whenever the devices which are connected to it cause an interrupt.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.

Returns
  None.

Note
  None.

References XIntc_Config::BaseAddress, XIntc::CfgPtr, XIntc_Config::DeviceId, and XIntc_DeviceInterruptHandler().

Referenced by SetUpInterruptSystem().

XIntc_Config * XIntc_LookupConfig | ( | u16 | DeviceId | ) |

Looks up the device configuration based on the unique device ID.

A table contains the configuration info for each device in the system.

Parameters

  DeviceId | is the unique identifier for a device.

Returns
  A pointer to the XIntc configuration structure for the specified device, or NULL if the device was not found.

Note
  None.

References XIntc_ConfigTable.

Referenced by XIntc_Acknowledge(), XIntc_Connect(), XIntc_ConnectFastHandler(), XIntc_Disable(), XIntc_Disconnect(), XIntc_Enable(), XIntc_Initialize(), XIntc_RegisterFastHandler(), XIntc_RegisterHandler(), XIntc_SetIntrSvcOption(), XIntc_SetNormalIntrMode(), XIntc_SetOptions(), XIntc_SimulateIntr(), XIntc_Start(), and XIntc_TriggerSwIntr().

void XIntc_RegisterFastHandler | ( | UINTPTR | BaseAddress,
|  | u8 | Id,
|  | XFastInterruptHandler | FastHandler
| ) |  |

Register a fast handler function for a specific interrupt ID.

The handler function will be called when an interrupt occurs for the given interrupt ID. In Cascade mode Interrupt Id is used to set Handler for corresponding Slave Controller

Parameters

  BaseAddress | is the base address of the interrupt controller whose vector table will be modified.
  InterruptId | is the interrupt ID to be associated with the input handler.
  FastHandler | is the function pointer that will be called when interrupt occurs

Returns
  None.

Note

Note that this function has no effect if the input base address is invalid.

References XIntc_Config::BaseAddress, XIntc_Config::VectorAddrWidth, and XIntc_LookupConfig().

void XIntc_RegisterHandler | ( | UINTPTR | BaseAddress,
|  | int | InterruptId,
|  | XInterruptHandler | Handler,
|  | void * | CallBackRef
| ) |  |

Register a handler function for a specific interrupt ID.

The vector table of the interrupt controller is updated, overwriting any previous handler. The handler function will be called when an interrupt occurs for the given interrupt ID.

This function can also be used to remove a handler from the vector table by passing in the XIntc_DefaultHandler() as the handler and NULL as the callback reference. In Cascade mode Interrupt Id is used to set Handler for corresponding Slave Controller

Parameters

  BaseAddress | is the base address of the interrupt controller whose vector table will be modified.
  InterruptId | is the interrupt ID to be associated with the input handler.
  Handler | is the function pointer that will be added to the vector table for the given interrupt ID.
  CallBackRef | is the argument that will be passed to the new handler function when it is called. This is user-specific.

Returns
  None.

Note

This function has no effect if the input base address is invalid. Following fields in XIntc_Config impacts interrupt handling,

1. AckBeforeService: If 1, primary interrupt handler acks interrupt before servicing it, else it would ack interrupt after servicing it (after calling interrupt ID specific handler)
2. Options: XIN_SVC_SGL_ISR_OPTION - primary interrupt handler services the highest priority pending interrupt and return XIN_SVC_ALL_ISRS_OPTION - primary interrupt handler services all of the pending interrupts and then return

References XIntc_Config::HandlerTable, LookupConfigByBaseAddress(), and XIntc_LookupConfig().

Referenced by IntcLowLevelExample().

int XIntc_SelfTest | ( | XIntc * | InstancePtr | ) |

Run a self-test on the driver/device.

This is a destructive test.

This involves forcing interrupts into the controller and verifying that they are recognized and can be acknowledged. This test will not succeed if the interrupt controller has been started in real mode such that interrupts cannot be forced.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.

Returns
  - XST_SUCCESS if self-test is successful.
  - XST_INTC_FAIL_SELFTEST if the Interrupt controller fails the self-test. It will fail the self test if the device has previously been started in real mode.

Note
  None.

References XIntc::BaseAddress, and XIntc::IsReady.

Referenced by IntcExample(), IntcInterruptSetup(), and IntcSelfTestExample().

void XIntc_SetIntrSvcOption | ( | UINTPTR | BaseAddress,
|  | int | Option
| ) |  |

Set the interrupt service option, which can configure the driver so that it services only a single interrupt at a time when an interrupt occurs, or services all pending interrupts when an interrupt occurs.

The default behavior when using the driver interface given in xintc.h file is to service only a single interrupt, whereas the default behavior when using the driver interface given in this file is to service all outstanding interrupts when an interrupt occurs. In Cascade mode same Option is set to Slave controllers.

Parameters

  BaseAddress | is the unique identifier for a device.
  Option | is XIN_SVC_SGL_ISR_OPTION if you want only a single interrupt serviced when an interrupt occurs, or XIN_SVC_ALL_ISRS_OPTION if you want all pending interrupts serviced when an interrupt occurs.

Returns
  None.

Note

Note that this function has no effect if the input base address is invalid.

References XIntc_Config::IntcType, LookupConfigByBaseAddress(), XIntc_Config::Options, XIntc_ConfigTable, and XIntc_LookupConfig().

void XIntc_SetNormalIntrMode | ( | XIntc * | InstancePtr,
|  | u8 | Id
| ) |  |

Sets the normal interrupt mode for the specified interrupt in the Interrupt Mode Register.

In Cascade mode disconnects handler from corresponding Slave controller IVAR/IVEAR register depending on the Id and sets all interrupt sources of the Slave controller as normal interrupts.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Id | contains the ID of the interrupt source and should be in the range of 0 to XPAR_INTC_MAX_NUM_INTR_INPUTS - 1 with 0 being the highest priority interrupt.

Returns
  None.

Note
  Slave controllers in Cascade Mode should have all as Fast interrupts or Normal interrupts, mixed interrupts are not supported

References XIntc_Config::BaseAddress, XIntc::BaseAddress, XIntc::CfgPtr, XIntc_Config::FastIntr, XIntc::IsReady, XIntc_Config::VectorAddrWidth, XIntc_Disable(), XIntc_Enable(), and XIntc_LookupConfig().

int XIntc_SetOptions | ( | XIntc * | InstancePtr,
|  | u32 | Options
| ) |  |

Set the options for the interrupt controller driver.

In Cascade mode same Option is set to Slave controllers.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Options | to be set. The available options are described in xintc.h.

Returns
  - XST_SUCCESS if the options were set successfully
  - XST_INVALID_PARAM if the specified option was not valid

Note
  None.

References XIntc::CfgPtr, XIntc_Config::IntcType, XIntc::IsReady, XIntc_Config::Options, XIN_SVC_SGL_ISR_OPTION, XIntc_ConfigTable, and XIntc_LookupConfig().

int XIntc_SimulateIntr | ( | XIntc * | InstancePtr,
|  | u8 | Id
| ) |  |

Allows software to simulate an interrupt in the interrupt controller.

This function will only be successful when the interrupt controller has been started in simulation mode. Once it has been started in real mode, interrupts cannot be simulated. A simulated interrupt allows the interrupt controller to be tested without any device to drive an interrupt input signal into it. In Cascade mode writes to ISR of appropriate Slave controller depending on Id.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Id | is the interrupt ID for which to simulate an interrupt.

Returns
  - XST_SUCCESS if successful

- XST_FAILURE if the interrupt could not be simulated because the interrupt controller is or has previously been in real mode.

Note
  None.

References XIntc_Config::BaseAddress, XIntc::BaseAddress, XIntc::IsReady, and XIntc_LookupConfig().

Referenced by IntcExample().

int XIntc_Start | ( | XIntc * | InstancePtr,
|  | u8 | Mode
| ) |  |

Starts the interrupt controller by enabling the output from the controller to the processor.

Interrupts may be generated by the interrupt controller after this function is called.

It is necessary for the caller to connect the interrupt handler of this component to the proper interrupt source. This function also starts Slave controllers in Cascade mode.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Mode | determines if software is allowed to simulate interrupts or real interrupts are allowed to occur. Note that these modes are mutually exclusive. The interrupt controller hardware resets in a mode that allows software to simulate interrupts until this mode is exited. It cannot be reentered once it has been exited.

One of the following values should be used for the mode.

- XIN_SIMULATION_MODE enables simulation of interrupts only
- XIN_REAL_MODE enables hardware interrupts only

Returns
  - XST_SUCCESS if the device was started successfully
  - XST_FAILURE if simulation mode was specified and it could not be set because real mode has already been entered.

Note
  Must be called after XIntc initialization is completed.

References XIntc_Config::BaseAddress, XIntc::BaseAddress, XIntc::CfgPtr, XIntc_Config::IntcType, XIntc::IsReady, XIntc::IsStarted, XIN_REAL_MODE, XIN_SIMULATION_MODE, and XIntc_LookupConfig().

Referenced by IntcInterruptSetup(), and SetUpInterruptSystem().

void XIntc_Stop | ( | XIntc * | InstancePtr | ) |

Stops the interrupt controller by disabling the output from the controller so that no interrupts will be caused by the interrupt controller.

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.

Returns
  None.

Note
  None.

References XIntc::BaseAddress, XIntc::IsReady, and XIntc::IsStarted.

int XIntc_TriggerSwIntr | ( | XIntc * | InstancePtr,
|  | u8 | Id
| ) |  |

Allows software to trigger software interrupt.

This function will only be successful when the interrupt controller has been configured with software interrupt in HW design

Parameters

  InstancePtr | is a pointer to the XIntc instance to be worked on.
  Id | is the interrupt ID to be triggered

Returns
  - XST_SUCCESS if successful

- XST_FAILURE if the instance pointer is invalid if interrupt id does not belongs to software interrupt

Note
  HW design must have software interrupts and interrupt id passed should be of software interrupt type. Interrupt id's for software interrupts for specific HW design can be found in xparameters.h file.

References XIntc_Config::BaseAddress, XIntc::BaseAddress, XIntc::IsReady, XIntc_Config::NumberofIntrs, and XIntc_LookupConfig().

## Variable Documentation

XIntc_Config XIntc_ConfigTable[]

This table contains configuration information for each intc device in the system.

The XIntc driver must know when to acknowledge the interrupt. The entry which specifies this as a bit mask where each bit corresponds to a specific interrupt. A bit set indicates to ack it before servicing it. Generally, acknowledge before service is used when the interrupt signal is edge-sensitive, and after when the signal is level-sensitive.

Refer to the XIntc_Config data structure in xintc.h for details on how this table should be initialized.

XIntc_Config XIntc_ConfigTable[XPAR_XINTC_NUM_INSTANCES]

Initial value:
= {
{
XPAR_INTC_0_DEVICE_ID,
XPAR_INTC_0_BASEADDR,
XPAR_INTC_0_ACK_BEFORE,
0
}
,
{
XPAR_INTC_1_DEVICE_ID,
XPAR_INTC_1_BASEADDR,
XPAR_INTC_1_ACK_BEFORE,
0
}
}

This table contains configuration information for each intc device in the system.

The XIntc driver must know when to acknowledge the interrupt. The entry which specifies this as a bit mask where each bit corresponds to a specific interrupt. A bit set indicates to ack it before servicing it. Generally, acknowledge before service is used when the interrupt signal is edge-sensitive, and after when the signal is level-sensitive.

Refer to the XIntc_Config data structure in xintc.h for details on how this table should be initialized.

Referenced by LookupConfigByBaseAddress(), XIntc_DeviceInterruptHandler(), XIntc_LookupConfig(), XIntc_SetIntrSvcOption(), and XIntc_SetOptions().

XIntc_Config XIntc_ConfigTable[]

This table contains configuration information for each intc device in the system.

The XIntc driver must know when to acknowledge the interrupt. The entry which specifies this as a bit mask where each bit corresponds to a specific interrupt. A bit set indicates to ack it before servicing it. Generally, acknowledge before service is used when the interrupt signal is edge-sensitive, and after when the signal is level-sensitive.

Refer to the XIntc_Config data structure in xintc.h for details on how this table should be initialized.

Referenced by LookupConfigByBaseAddress(), XIntc_DeviceInterruptHandler(), XIntc_LookupConfig(), XIntc_SetIntrSvcOption(), and XIntc_SetOptions().