📄 ppc860intr.c
字号:
/* ppc860Intr.c - PowerPC 860 series interrupt driver *//* Copyright 1984-2000 Wind River Systems, Inc. *//* Copyright 1997-2000 Motorola, Inc., All Rights Reserved *//*modification history--------------------01o,05dec00,rhk WRS code standards cleanup.01n,31aug99,gls fixed SPR #21239, kernel locks on boot when instrumented.01m,16dec98,rhk modified ppc860IntEnable and ppc860IntDisable to support enabling/disabling SIU and CPM interrupts.01l,22oct98,rhk added interrupt chaining to support PCI interrupts.01k,30mar98,map initialize _func_int{Enable,Disable}Rtn [SPR# 20447]01j,26mar98,map added ppc860IntEnable, ppc860IntDisable, removed duplicate #ifdef'd code, reworked ppc860IntrInit(). [SPR# 20447]01i,11nov97,map redo clearing CISR bits [SPR# 8781], and default SCC interrupt priority01h,06mar97,tpr fixed properly SPR #8042.01g,21feb97,tpr fixed interrupt bit clearing in CISR (SPR #8042).01f,23jun97,map added default SCC interrupt priority [SPR# 8692]01e,19jun97,map added IV_SCC[34] definitions [SPR# 8450]01d,17jun97,map fixed clearing CISR bits [SPR# 8781]01c,16jun97,srr all interrupts in the CISR are being cleared because an OR is being done in ppc860CpmIntrDeMux instead of directly writing only the bit corresponding to the interrupt.01b,18sep96,pr added WindView instrumentation.01a,17feb96,tpr written.*//*DESCRIPTIONThe PowerPC 800 CPU series is divided in three units: PowerPC core, SystemInterface Unit (SIU) and Communication Processor Unit (CPM). The PowerPCcore accepts only one external interrupt exception (vector 0x500). The SIUprovides an interrupt controller which provides 32 levels but only 16 areused. The Interrupt controller is connected to the PowerPC core external interrupt. The CPM unit also provides an interrupt controller which canbe connected to one of the SIU interrupt controler entries. This libraryprovides the routines to manage these interrupt controllersppc860IntrInit() connects the default demultiplexers, ppc860IntrDeMux() andppc860CpmIntrDeMux(), to the external interrupt vector and initializes a tablecontaining a function pointer and an associated parameter for each interruptsource. ppc860IntrInit() is called by sysHwInit() from sysLib.c.The default demultimplexer, ppc860IntrDeMux() detects which peripheral or controller has raised an interrupt and calls the associated routine with its parameter. If the interrupt comes from the CPM interrupt contoller, theppc860CpmIntDeMux() function is called. As ppc860IntrDeMux(), this functiondetects which peripheral or controller has raised an interrupt and calls theassociated routine with its parameter.INCLUDE FILES: drv/intrCtl/ppc860Intr.h, drv/multi/ppc860Siu.h,drv/multi/ppc860Cpm.h*//* includes */#include "intLib.h"#include "iv.h"#include "ppc860Intr.h"#include "drv/multi/ppc860Siu.h"#include "drv/multi/ppc860Cpm.h"/* default SCC relative interrupt priority */#define CICR_SCCP_DEF (CICR_SCCDP_SCC4 | CICR_SCCCP_SCC3 | \ CICR_SCCBP_SCC2 | CICR_SCCAP_SCC1 )#ifdef INCLUDE_INSTRUMENTATION#include "private/funcBindP.h"IMPORT int evtTimeStamp;LOCAL int cpmIntNum;LOCAL int cpmVecNum;#endif /* INCLUDE_INSTRUMENTATION *//* local *//* globals */INT_HANDLER_DESC * sysIntTbl [256]; /* Intr vector table *//* forward declarations */LOCAL void ppc860IntrDeMux (void);LOCAL void ppc860CpmIntrDeMux (int);int ppc860IntEnable (int);int ppc860IntDisable (int);STATUS ppc860IntConnect ( VOIDFUNCPTR *, VOIDFUNCPTR, int);/********************************************************************************* ppc860IntrInit - initialize the interrupt manager for the PowerPC 860 series** This routine connects the default demultiplexer, ppc860IntrDeMux()* to the external interrupt vector and associates all * interrupt sources with the default interrupt handler. This routine is* called by sysHwInit() in sysLib.c.** NOTE: All interrupt from the SIU and CPM unit are enabled, CICR is setup so* that SCC1 has the highest relative interrupt priority, through SCC4 with the* lowest.** RETURN : OK or ERROR if the SUI interrupt level to connect the CPM * interrupt contoller is wrong.*/void ppc860IntrInit () { VOIDFUNCPTR defaultVec; /* INTR3 default vector */ UINT vector; /* get the default vector connected to the External Interrupt (0x500) */ defaultVec = (VOIDFUNCPTR) excVecGet ((FUNCPTR *) _EXC_OFF_INTR); /* connect the interrupt demultiplexer to External Interrupt (0x500) */ excIntConnect ((VOIDFUNCPTR *) _EXC_OFF_INTR, ppc860IntrDeMux); /* Install `system' intConnect routine */ if (_func_intConnectRtn == NULL) _func_intConnectRtn = ppc860IntConnect; if (_func_intEnableRtn == NULL) _func_intEnableRtn = ppc860IntEnable; if (_func_intDisableRtn == NULL) _func_intDisableRtn = ppc860IntDisable; /* set all vectors to NULL state */ for (vector = 0; vector < 256; vector++) sysIntTbl[vector] = NULL; }/********************************************************************************* ppc860IntrInit2 - initialize the interrupt manager for the PowerPC 860 series** This routine connects the ppc860CpmIntrDeMux demultiplexer to the * ppc860IntrDeMux(). This routine is called by sysHwInit2() in sysLib.c.** NOTE: All interrupts from the CPM unit are enabled.** RETURN : OK or ERROR if the SUI interrupt level to connect the CPM* interrupt contoller is wrong.*/STATUS ppc860IntrInit2 ( VOIDFUNCPTR * cpmIntrVec /* Intr level of the CPM Intr ctrl */ ) { UINT32 regBase; /* device register base address */ UINT32 cicrIntLevel; /* CICR interupt level */ UINT32 simaskIntLevel; /* get the CPM interrupt level */ switch (IVEC_TO_INUM(cpmIntrVec)) { case IVEC_TO_INUM(IV_LEVEL0): cicrIntLevel = CICR_IRL_LVL0; simaskIntLevel = SIMASK_LVM0; break; case IVEC_TO_INUM(IV_LEVEL1): cicrIntLevel = CICR_IRL_LVL1; simaskIntLevel = SIMASK_LVM1; break; case IVEC_TO_INUM(IV_LEVEL2): cicrIntLevel = CICR_IRL_LVL2; simaskIntLevel = SIMASK_LVM2; break; case IVEC_TO_INUM(IV_LEVEL3): cicrIntLevel = CICR_IRL_LVL3; simaskIntLevel = SIMASK_LVM3; break; case IVEC_TO_INUM(IV_LEVEL4): cicrIntLevel = CICR_IRL_LVL4; simaskIntLevel = SIMASK_LVM4; break; case IVEC_TO_INUM(IV_LEVEL5): cicrIntLevel = CICR_IRL_LVL5; simaskIntLevel = SIMASK_LVM5; break; case IVEC_TO_INUM(IV_LEVEL6): cicrIntLevel = CICR_IRL_LVL6; simaskIntLevel = SIMASK_LVM6; break; case IVEC_TO_INUM(IV_LEVEL7): cicrIntLevel = CICR_IRL_LVL7; simaskIntLevel = SIMASK_LVM7; break; default: return (ERROR); } /* * connect the CPM interrupt demultiplexer at the level specified by * the input parameter cpmIntrVec */#ifdef INCLUDE_INSTRUMENTATION cpmVecNum = IVEC_TO_INUM(cpmIntrVec);#endif /* INCLUDE_INSTRUMENTATION */ intConnect (cpmIntrVec, ppc860CpmIntrDeMux, simaskIntLevel); /* Get the register base address */ regBase = vxImmrGet(); /* * set the request interrupt level from the CPM and enable CPM interrupt * generation. */ * CICR(regBase) = (CICR_SCCP_DEF | cicrIntLevel | CICR_IEN | CICR_HP_MSK); /* enable the CPM interrupt into the SIU */ * SIMASK(regBase) = simaskIntLevel; return (OK); }/********************************************************************************* ppc860IntConnect - connect a routine to an interrupt ** This routine connects any C or assembly routine to one of the multiple * sources of interrupts.** The connected routine can be any normal C code, except that it must not * invoke certain operating system functions that may block or perform I/O* operations.** This board supports PCI interrupts, so interrupt chaining is implemented* by this routine.*** Standard <vector> types are defined in h/drv/intrClt/ppc860Intr.h, * additional interrupt vectors are defined in the "board".h file in the* BSP directory.** RETURNS: OK, or ERROR if <vector> is unknown.** SEE ALSO: ppc860Intr.h*/STATUS ppc860IntConnect ( VOIDFUNCPTR * vector, /* interrupt vector to attach to */ VOIDFUNCPTR routine, /* routine to be called */ int parameter /* parameter to be passed to routine */ ) { INT_HANDLER_DESC * newHandler; INT_HANDLER_DESC * currHandler; /* test the vector */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -