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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

248 CHAPTER 5. T-KERNEL/SM<br />

5.4 Interrupt Management Functions<br />

Interrupt handling is largely hardware-dependent, differing with each system, and therefore difficult to<br />

standardize. The following are given as standard specifications, but it may not be possible to follow<br />

these exactly on all systems. Implementors should strive to comply with these specifications to the<br />

extent possible; but where implementation is not feasible, full compliance is not mandatory. If functions<br />

not in the standard specifications are added, however, the function names must be different from those<br />

given here. In any case, DI(), EI(), and isDI() must be implemented in accord with the standard<br />

specifications.<br />

Interrupt management functions are provided as library functions or C language macros. These can be<br />

called from a task-independent portion and while dispatching and interrupts are disabled.<br />

5.4.1 CPU Interrupt Control<br />

These functions are for CPU external interrupt flag control.<br />

Generally they do not perform any operation on the interrupt controller.<br />

DI() and EI() are C language macros.<br />

• DI( UINT intsts )<br />

intsts<br />

CPU interrupt status (details are implementation-dependent)<br />

This is not a pointer.<br />

Disables all external interrupts.<br />

The status prior to disabling interrupts is stored in intsts.<br />

• EI( UINT intsts )<br />

intsts<br />

CPU interrupt status (details are implementation-dependent)<br />

Enables all external interrupts.<br />

More precisely, this macro restores the status in intsts. That is, the interrupt status reverts<br />

to what it was before interrupts were disabled by DI(). If there were interrupts disabled at the<br />

time DI() was executed, those interrupts are not enabled by EI(). All interrupts can be enabled,<br />

however, by designating 0 in intsts.<br />

intsts must be either the values stored in it by DI() or 0. If any other value is designated, the<br />

behavior is not guaranteed.<br />

• BOOL isDI( UINT intsts )<br />

intsts<br />

Return code:<br />

TRUE (not 0):<br />

FALSE:<br />

CPU interrupt status (details are implementation-dependent)<br />

Interrupts disabled<br />

Interrupts enabled<br />

Gets the status of external interrupt disabling stored in intsts.<br />

Interrupts disabled status is the status in which T-<strong>Kernel</strong>/OS determines that interrupts are<br />

disabled.<br />

intsts must by the value stored by DI(). If any other value is designated, the behavior is not<br />

guaranteed.<br />

Sample usage:<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!