NAME | SYNOPSIS | FEATURES | DESCRIPTION | EXTENDED DESCRIPTION | ALLOWED CALLING CONTEXTS | ATTRIBUTES | SEE ALSO
#include <dki/f_dki.h>KnError svIntrAttach(CpuIntr intr, CpuIntrHandler intrHandler, void * intrCookie, CpuIntrOps ** intrOps, CpuIntrId * intrId);
typedef struct { void (*unmask) (CpuIntrId intrId); void (*mask) (CpuIntrId intrId); } CpuIntrOps;
DKI
Provides access to PowerPC DKI interrupts services.
For PowerPC family processors, interrupts are defined as all asynchronous exceptions. These interrupts are identified using unsigned integer numbers which correspond to the exception number. The microkernel provides services to allow device drivers to manage PowerPC interrupts, mainly to attach/detach handlers to these interrupts.
svIntrAttach attaches a handler to a given CPU interrupt. The intr argument specifies the interrupt to attach to. The intrHandler argument specifies the handler to call back when the specified interrupt occurs. The intrCookie argument specifies a parameter to pass back to the handler when called. It is opaque to the microkernel.
On success, K_OK is returned and the services defined on the attached interrupt are returned in the intrOps parameter. An identifier for the attached interrupt is also returned in intrId . This identifier must be used as the first parameter to further calls to intrOps services.
Services available on an attached interrupt are defined by the CpuIntrOps structure as follows:
The CpuIntrOps.unmask routine enables the interrupt at CPU level identified by intrId .
The CpuIntrOps.mask routine disables the interrupt at CPU level identified by intrId .
Note that SYSTEM_RESET_INTR and MACHINE_CHECK_INTR are non-maskable interrupts. Thus unmask/mask have no effect on these interrupts.
Note also, that all other interrupts are masked using the same bit in the PowerPC processor MSR register. Thus there is no way to unmask/mask only one of these interrupts separately from the others. When an interrupt occurs, the attached CpuIntrHandler is invoked with interrupts masked at processor level. This behaves in the same way as if imsIntrMask_f() was just called prior to invoking the handler ( imsIntrMaskCount_f is positive). It is up to the interrupt handler called to use unmask to allow the interrupt to be nested or not. Typically, a host bus driver handler should handle PowerPC external interrupts as follows:
Identify the interrupt source (through a PIC or special cycle).
Unmask interrupts at processor level ( unmask ).
Call handlers attached to the identified source.
Optionally mask interrupts to do critical tasks, such as notifying the end of the interrupt to a PIC.
Return to the DKI.
On failure, an error code is returned as follows:
The interrupt specified in intr is invalid (not in the list above).
The interrupt specified in intr is valid, but a handler is already attached to it.
The system is out of physical memory.
svIntrDetach detaches an interrupt handler previously connected by svIntrAttach . The intrId argument identifies the attached interrupt handler, and was previously returned by svIntrAttach .
svIntrCtxGet retrieves the current level interrupt context. It is mainly to be used for profiling purposes. On success, K_OK is returned and a pointer to the current level interrupt saved context is returned in the intrCtx argument. The CPU context saved on interrupt contains the volatile general purpose and floating point registers, condition register, Machine Status Register, instruction pointer, link register and the interrupt number itself. On failure, an error code is returned as follows:
The interrupt level is zero (not called from an interrupt handler.
There is no context available for the currently handled interrupt.
The following table specifies the contexts in which a caller is allowed to invoke each service.
Services | Base level | DKI thread | Interrupt | Blocking |
svIntrAttach | + | + | - | + |
CpuIntrOps.unmask | + | + | + | - |
CpuIntrOps.mask | + | + | + | - |
svIntrDetach | + | + | - | + |
svIntrCtxGet | - | - | + | - |
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | FEATURES | DESCRIPTION | EXTENDED DESCRIPTION | ALLOWED CALLING CONTEXTS | ATTRIBUTES | SEE ALSO