Interrupt::Enable() and Interrupt::Disable()

The functions Interrupt::Enable() and Interrupt::Disable() are used by device drivers to enable and disable the interrupt source in the interrupt controller hardware.

An Interrupt ID is passed to the functions to identify the interrupt source. All requests for enabling and disabling interrupts should go to these functions in the Interrupt class so that device drivers should never need to know where the interrupt is actually implemented. The general rule is that the interrupt ID is tagged in some way to allow these functions to decide whether the interrupt refers to the ASSP layer or to the Variant layer. These functions are implemented in the ASSP layer.

The implementation of these functions is completely dependent on the interrupt hardware. In the template port, Interrupt::Enable() is implemented in ...\template_assp\interrupts.cpp. The relevant part is:

EXPORT_C TInt Interrupt::Enable(TInt anId)
    {
     __KTRACE_OPT(KEXTENSION,Kern::Printf("Interrupt::Enable id=%d",anId));
     TInt r=KErrNone;
     // if ID indicates a chained interrupt, call variant...
     if (anId<0 && ((((TUint)anId)>>16)&0x7fff)<(TUint)KNumTemplateInts)
         r=TemplateAssp::Variant->InterruptEnable(anId);
     else if ((TUint)anId>=(TUint)KNumTemplateInts)
         r=KErrArgument;
     else if (TemplateInterrupt::Handlers[anId].iIsr==TemplateInterrupt::Spurious)
         r=KErrNotReady;
     else
         {
         //
         // TO DO: (mandatory)
         //
         // Enable the corresponding Hardware Interrupt source
         //
         }
     return r;
    }
          

Interrupts that 'belong' to the Variant Layer are passed to that layer through the call to:

r =TemplateAssp::Variant->InterruptEnable(anId);

Interrupt::Disable() follows the same general pattern.

The Variant layer equivalent of this function, Template::InterruptEnable(), in ...\template_variant\specific\variant.cpp, also follows the same pattern.