5.4.1 CPU Interrupt Control

These functions are for CPU external interrupt .ag control.

Generally they do not perform any operation on the interrupt controller.

DI are C language macros.

  • DI

intsts CPU interrupt status (details are implementation-dependent)

This is not a pointer.

Disables all external interrupts.

The status prior to disabling interrupts is stored in intsts.

  • EI

intsts CPU interrupt status (details are implementation-dependent)

Enables all external interrupts.

More precisely, this macro restores the status in intsts. That is, the interrupt status reverts to what it was before interrupts were disabled by DI was executed, those interrupts are not enabled by EI(). All interrupts can be enabled, however, by specifying 0 in intsts.

intsts must be either the values stored in it by DI() or 0. If any other value is specified, the behavior is not guaranteed.

  • BOOL isDI( UINT intsts )

intsts CPU interrupt status (details are implementation-dependent)

Return code:

TRUE (not 0): Interrupts disabled

FALSE: Interrupts enabled

Gets the status of external interrupt disabling stored in intsts.

Interrupts disabled status is the status in which T-Kernel/OS determines that interrupts are disabled.

intsts must by the value stored by DI(). If any other value is specified, the behavior is not guaranteed.

Sample usage:


	void foo()
	{
		UINT intsts;
		DI(intsts);
		if ( isDI(intsts) ) {
			/* Interrupts were already disabled at the time this function was called.	*/
		} else {
			/* Interrupts were enabled at the time this function was called.	*/
	}
	EI(intsts);
}

            

Comments