beautypg.com

Intel 386 User Manual

Page 238

background image

9-39

INTERRUPT CONTROL UNIT

supports INTERRUPT_ISR (parameter is ignored).

Protected mode supports both.

Returns:Error Code

E_INVALID_VECTOR -- An IRQ of greater than 15 was passed

E_BADVECTOR -- IRQ is used for cascading to a slave interrupt

controller

E_OK

-- Initialized OK, No error.

Assumptions:

Compiler supports far and interrupt keywords

ICU must be configured before this function is call for it to

operate properly

_IRQ_SlaveBase_,_IRQ_MstrBase_,_CascadeBits_ are set before function

is called. These are initialized in the InitICU functions supplied

in this source.

Syntax:

int error_code;

error_code = SetIRQVector(wdtISR,

15,

// Slave IR#’s are offset by 8 in

// Vector Table

INTERRUPT_ISR);

Real/Protected Mode

No changes required. Uses SetInterruptVector which is mode

dependant (separate source)

*****************************************************************************/

int SetIRQVector( void (far interrupt *IntrProc)(void), int IRQ, int IntrType)

{

int Vector;

if(IRQ > 15) return E_INVALID_VECTOR;

if(IRQ > 7)

// Get Vector from Slave

Vector = _IRQ_SlaveBase_ + IRQ - 8;

else

// From Master

{

if((1 << IRQ) & _CascadeBits_) return E_BADVECTOR;

Vector = _IRQ_MstrBase_ + IRQ;

}

SetInterruptVector(IntrProc, Vector, IntrType);