Software Drivers

xintc.h File Reference

#include "xil_types.h"
#include "xil_assert.h"
#include "xparameters.h"
#include "xstatus.h"
#include "xintc_l.h"

Classes

struct  XIntc_Config
struct  XIntc

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
#define XIN_REAL_MODE   1

Masks to specify Interrupt Controller Mode

#define XIN_INTC_NOCASCADE   0
#define XIN_INTC_PRIMARY   1
#define XIN_INTC_SECONDARY   2
#define XIN_INTC_LAST   3

Mask to specify maximum number of interrupt sources per controller

#define XIN_CONTROLLER_MAX_INTRS   32

Defines

#define XINTC_H

Functions

int XIntc_Initialize (XIntc *InstancePtr, u16 DeviceId)
int XIntc_Start (XIntc *InstancePtr, u8 Mode)
void XIntc_Stop (XIntc *InstancePtr)
int XIntc_Connect (XIntc *InstancePtr, u8 Id, XInterruptHandler Handler, void *CallBackRef)
void XIntc_Disconnect (XIntc *InstancePtr, u8 Id)
void XIntc_Enable (XIntc *InstancePtr, u8 Id)
void XIntc_Disable (XIntc *InstancePtr, u8 Id)
void XIntc_Acknowledge (XIntc *InstancePtr, u8 Id)
XIntc_ConfigXIntc_LookupConfig (u16 DeviceId)
int XIntc_ConnectFastHandler (XIntc *InstancePtr, u8 Id, XFastInterruptHandler Handler)
void XIntc_SetNormalIntrMode (XIntc *InstancePtr, u8 Id)
void XIntc_VoidInterruptHandler (void)
void XIntc_InterruptHandler (XIntc *InstancePtr)
int XIntc_SetOptions (XIntc *InstancePtr, u32 Options)
u32 XIntc_GetOptions (XIntc *InstancePtr)
int XIntc_SelfTest (XIntc *InstancePtr)
int XIntc_SimulateIntr (XIntc *InstancePtr, u8 Id)


Define Documentation

#define XIN_CONTROLLER_MAX_INTRS   32

#define XIN_INTC_LAST   3

#define XIN_INTC_NOCASCADE   0

#define XIN_INTC_PRIMARY   1

#define XIN_INTC_SECONDARY   2

#define XIN_REAL_MODE   1

Real mode, no simulation allowed, hardware interrupts recognized

#define XIN_SIMULATION_MODE   0

Simulation only mode, no hardware interrupts recognized

#define XIN_SVC_ALL_ISRS_OPTION   2UL

#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.
 

#define XINTC_H


Function Documentation

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.

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:

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

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 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 to the handler for that 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.

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.

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.

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.

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.

int XIntc_Initialize ( XIntc InstancePtr,
u16  DeviceId 
)

Initialize a specific interrupt controller instance/driver. The initialization entails:

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 initialiaze Slave Interrupt controllers.

void XIntc_InterruptHandler ( XIntc InstancePtr  ) 

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.

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.

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.

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 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

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.

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 appropraite 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.

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.

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.

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.

void XIntc_VoidInterruptHandler ( void   ) 

Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.