External Interrupts

Top  Previous  Next

C6000 processors have four external interrupt lines, INT4–INT7, which can be used to control external devices. One or more of these interrupt lines (and DMA engines) may be permanently reserved by Diamond’s device drivers, and others may be dynamically assigned during program execution. If you need to use one of these external interrupt lines to handle an external device, your code must first explicitly claim it from a pool maintained by the kernel’s external interrupt manager module.  This module needs to be located first using SC6xKernel_LocateInterface.

 

Outline code to use INT4 is shown below:

 

#include <ext_int.h>

unsigned int got;

SC6xExt_Int *xint;

 

xint = SC6xKernel_LocateInterface(_kernel, SIID_SC6xExt_Int);

if (!xint) error();               // can't locate interface

 

got = SC6xExt_Int_Claim(xint, 4); // try to get INT4

if (!got) error();                // INT4 already in use

   //...do things that use INT4...

SC6xExt_Int_Release(xint, 4);     // return it to the kernel

 

 

SC6xExt_Int_Claim

#include <ext_int.h>

unsigned int SC6xExt_Int_Claim(SC6xExt_Int *Iface, unsigned int wanted);

 stand-alone

This function tries to allocate the requested interrupt line, wanted . If it succeeds, it returns a non-zero value; if it fails, it returns zero. Iface must be a pointer to the kernel’s external interrupt manager interface as returned by a call to SC6xKernel_LocateInterface with a second argument of SIID_SC6xExt_Int.

SC6xExt_Int_Claim_Any

#include <ext_int.h>

unsigned int SC6xExt_Int_Claim_Any(SC6xExt_Int *Iface);

 stand-alone

This function is similar to SC6xExt_Int_Claim, except that instead of being told which interrupt line to allocate, it finds any free interrupt line. If the allocation succeeds, the function returns the number of the interrupt line (4–7). If it fails, it returns zero. Iface must be a pointer to the kernel’s external interrupt manager interface as returned by a call to SC6xKernel_LocateInterface with a second argument of SIID_SC6xExt_Int.

[SC6xExt_Int_Release]

#include <ext_int.h>

void SC6xExt_Int_Release(SC6xExt_Int *Iface, unsigned int which);

 stand-alone

This function is used to return an interrupt line to the available pool.  The parameter which identifies an interrupt line that had previously been claimed using SC6xExt_Int_Claim or SC6xExt_Int_Claim_Any. Iface must be a pointer to the kernel’s external interrupt manager interface as returned by a call to SC6xKernel_LocateInterface with a second argument of SIID_SC6xExt_Int.