Software Drivers

xscugic.c File Reference


Detailed Description

Contains required functions for the XScuGic driver for the Interrupt Controller. See xscugic.h for a detailed description of the driver.

 MODIFICATION HISTORY:

 Ver   Who  Date     Changes
 ----- ---- -------- --------------------------------------------------------
 1.00a drg  01/19/10 First release
 1.01a sdm  11/09/11 Changes are made in function XScuGic_CfgInitialize. Since
		      "Config" entry is now made as pointer in the XScuGic
		      structure, necessary changes are made.
		      The HandlerTable can now be populated through the low
		      level routine XScuGic_RegisterHandler added in this
		      release. Hence necessary checks are added not to
		      overwrite the HandlerTable entriesin function
		      XScuGic_CfgInitialize.
 1.03a srt  02/27/13 Added APIs

 1.04a hk   05/04/13 Assigned EffectiveAddr to CpuBaseAddress in
			  XScuGic_CfgInitialize. Fix for CR#704400 to remove warnings.
			  Moved functions XScuGic_SetPriTrigTypeByDistAddr and
             XScuGic_GetPriTrigTypeByDistAddr to xscugic_hw.c.
			  This is fix for CR#705621.
 1.06a asa  16/11/13 Fix for CR#749178. Assignment for EffectiveAddr
			  in function XScuGic_CfgInitialize is removed as it was
		      a bug.

 

#include "xparameters.h"
#include "xil_types.h"
#include "xil_assert.h"
#include "xscugic.h"

Functions

int XScuGic_CfgInitialize (XScuGic *InstancePtr, XScuGic_Config *ConfigPtr, u32 EffectiveAddr)
int XScuGic_Connect (XScuGic *InstancePtr, u32 Int_Id, Xil_InterruptHandler Handler, void *CallBackRef)
void XScuGic_Disconnect (XScuGic *InstancePtr, u32 Int_Id)
void XScuGic_Enable (XScuGic *InstancePtr, u32 Int_Id)
void XScuGic_Disable (XScuGic *InstancePtr, u32 Int_Id)
int XScuGic_SoftwareIntr (XScuGic *InstancePtr, u32 Int_Id, u32 Cpu_Id)
void XScuGic_SetPriorityTriggerType (XScuGic *InstancePtr, u32 Int_Id, u8 Priority, u8 Trigger)
void XScuGic_GetPriorityTriggerType (XScuGic *InstancePtr, u32 Int_Id, u8 *Priority, u8 *Trigger)


Function Documentation

int XScuGic_CfgInitialize XScuGic InstancePtr,
XScuGic_Config ConfigPtr,
u32  EffectiveAddr
 

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

  • Initialize fields of the XScuGic structure
  • Initial vector table with stub function calls
  • All interrupt sources are disabled

Parameters:
InstancePtr is a pointer to the XScuGic instance.
ConfigPtr is a pointer to a config table for the particular device this driver is associated with.
EffectiveAddr is the device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the device physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called. If address translation is not used, use Config->BaseAddress for this parameters, passing the physical address instead.
Returns:
  • XST_SUCCESS if initialization was successful
Note:
None.

int XScuGic_Connect XScuGic InstancePtr,
u32  Int_Id,
Xil_InterruptHandler  Handler,
void *  CallBackRef
 

Makes the connection between the Int_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.

Parameters:
InstancePtr is a pointer to the XScuGic instance.
Int_Id contains the ID of the interrupt source and should be in the range of 0 to XSCUGIC_MAX_NUM_INTR_INPUTS - 1
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.

void XScuGic_Disable XScuGic InstancePtr,
u32  Int_Id
 

Disables the interrupt source provided as the argument Int_Id such that the interrupt controller will not cause interrupts for the specified Int_Id. The interrupt controller will continue to hold an interrupt condition for the Int_Id, but will not cause an interrupt.

Parameters:
InstancePtr is a pointer to the XScuGic instance.
Int_Id contains the ID of the interrupt source and should be in the range of 0 to XSCUGIC_MAX_NUM_INTR_INPUTS - 1
Returns:
None.
Note:
None.

void XScuGic_Disconnect XScuGic InstancePtr,
u32  Int_Id
 

Updates the interrupt table with the Null Handler and NULL arguments at the location pointed at by the Int_Id. This effectively disconnects that interrupt source from any handler. The interrupt is disabled also.

Parameters:
InstancePtr is a pointer to the XScuGic instance to be worked on.
Int_Id contains the ID of the interrupt source and should be in the range of 0 to XSCUGIC_MAX_NUM_INTR_INPUTS - 1
Returns:
None.
Note:
None.

void XScuGic_Enable XScuGic InstancePtr,
u32  Int_Id
 

Enables the interrupt source provided as the argument Int_Id. Any pending interrupt condition for the specified Int_Id will occur after this function is called.

Parameters:
InstancePtr is a pointer to the XScuGic instance.
Int_Id contains the ID of the interrupt source and should be in the range of 0 to XSCUGIC_MAX_NUM_INTR_INPUTS - 1
Returns:
None.
Note:
None.

void XScuGic_GetPriorityTriggerType XScuGic InstancePtr,
u32  Int_Id,
u8 *  Priority,
u8 *  Trigger
 

Gets the interrupt priority and trigger type for the specificd IRQ source.

Parameters:
InstancePtr is a pointer to the instance to be worked on.
Int_Id is the IRQ source number to modify
Priority is a pointer to the value of the priority of the IRQ source. This is a return value.
Trigger is pointer to the value of the trigger of the IRQ source. This is a return value.
Returns:
None.
Note:
None

void XScuGic_SetPriorityTriggerType XScuGic InstancePtr,
u32  Int_Id,
u8  Priority,
u8  Trigger
 

Sets the interrupt priority and trigger type for the specificd IRQ source.

Parameters:
InstancePtr is a pointer to the instance to be worked on.
Int_Id is the IRQ source number to modify
Priority is the new priority for the IRQ source. 0 is highest priority, 0xF8 (248) is lowest. There are 32 priority levels supported with a step of 8. Hence the supported priorities are 0, 8, 16, 32, 40 ..., 248.
Trigger is the new trigger type for the IRQ source. Each bit pair describes the configuration for an INT_ID. SFI Read Only b10 always PPI Read Only depending on how the PPIs are configured. b01 Active HIGH level sensitive b11 Rising edge sensitive SPI LSB is read only. b01 Active HIGH level sensitive b11 Rising edge sensitive/
Returns:
None.
Note:
None.

int XScuGic_SoftwareIntr XScuGic InstancePtr,
u32  Int_Id,
u32  Cpu_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. A simulated interrupt allows the interrupt controller to be tested without any device to drive an interrupt input signal into it.

Parameters:
InstancePtr is a pointer to the XScuGic instance.
Int_Id is the software interrupt ID to simulate an interrupt.
Cpu_Id is the list of CPUs to send the interrupt.
Returns:
XST_SUCCESS if successful, or XST_FAILURE if the interrupt could not be simulated

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