30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5.4. INTERRUPT MANAGEMENT FUNCTIONS 249<br />

void foo()<br />

{<br />

UINT<br />

intsts;<br />

DI(intsts);<br />

if ( isDI(intsts) ) {<br />

/* Interrupts were already disabled at the time this function was called.*/<br />

} else {<br />

/* Interrupts were enabled at the time this function was called. */<br />

}<br />

EI(intsts);<br />

}<br />

5.4.2 Control of Interrupt Controller<br />

These functions control the interrupt controller.<br />

Generally they do not perform any operation with respect to the CPU interrupt flag.<br />

typedef UINT INTVEC; /* interrupt vector */<br />

The specific details of the interrupt vectors (INTVEC) are implementation-dependent. Preferably, however,<br />

they should be the same numbers as the interrupt definition numbers designated with tk def int,<br />

or should allow for simple conversion to and from those numbers.<br />

• UINT DINTNO( INTVEC intvec )<br />

Converts an interrupt vector to the corresponding interrupt definition number.<br />

• void EnableInt( INTVEC intvec )<br />

• void EnableInt( INTVEC intvec, INT level )<br />

Enables the interrupt designated in intvec.<br />

In a system that allows interrupt priority level to be designated, the level parameter can be used to<br />

designate the interrupt priority level. The precise meaning of level is implementation-dependent.<br />

Both methods with and without the level designation must be provided.<br />

• void DisableInt( INTVEC intvec )<br />

Disables the interrupt designated in intvec.<br />

Generally, interrupts raised while interrupts are disabled are made pending, and are raised after<br />

interrupts are enabled by EnableInt(). ClearInt() must be used if it is desired to clear interrupts<br />

occurring in interrupts disabled state.<br />

• void ClearInt( INTVEC intvec )<br />

Clears any interrupts raised for intvec.<br />

• void EndOfInt( INTVEC intvec )<br />

Issues EOI (End Of Interrupt) to the interrupt controller intvec must be an interrupt for which<br />

EOI can be issued. Generally this must be executed at the end of an interrupt handler.<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!