⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intarchlib.c

📁 VxWorks BSP框架源代码包含头文件和驱动
💻 C
📖 第 1 页 / 共 2 页
字号:
/********************************************************************************* intIntRtnNonPreempt - non-pre-emptive interrupt exception handler** This handler does not provide pre-emptive interrupts.  If a high* priority interrupt occurs while a low priority interrupt is being* handled, the high priority interrupt must wait for the low priority* interrupt handler to finish.  As soon as the low-priority handler is* done, the high priority handler will be invoked.  This model has less* exception handling overhead of the fully pre-emptive model, but has a* greater worst case latency for high priority interrupts.** RETURNS:** ARGSUSED*/void intIntRtnNonPreempt (void)    {    UINT32 level;    UINT32 vector;    VOIDFUNCPTR pRoutine;    /* Get vector number, previous interrupt level */    if ((*sysIntLvlVecChkRtn) (&level, &vector) == ERROR)	{	++intDemuxErrorCount;	/* update error count */	return;	}    do	{	/* Loop until no more interrupts are found */#ifdef WV_INSTRUMENTATION	/*	 * In the ARM architechture, exceptions cannot be locked out	 * with intLock() which makes a two-stage logging approach (i.e.	 * timestamp saved in intEnt and then used here) dangerous...it	 * can lead to out-of sequence events in the event log, thus	 * confusing the parser. So we just use a single stage logging	 * here.	 */	WV_EVT_INT_ENT(vector)#endif	/* WV_INSTRUMENTATION */	/*	 * Use the vector number to locate and invoke the appropriate	 * vector routine	 */	pRoutine = intVecTable[vector].routine;	(*pRoutine)(intVecTable[vector].arg);	/* acknowledge the interrupt and restore interrupt level */	(*sysIntLvlVecAckRtn) (level, vector);	}    while ((*sysIntLvlVecChkRtn) (&level, &vector) != ERROR);    }/********************************************************************************* intLevelSet - change current interrupt level** Set the current interrupt level to the specified level.** RETURNS:* Previous interrupt level.*/int	intLevelSet    (    int level	/* new interrupt level value */    )    {    return (*sysIntLvlChgRtn) (level);    }/********************************************************************************* intEnable - enable a specific interrupt level** Enable a specific interrupt level.  For each interrupt level to be used,* there must be a call to this routine before it will be* allowed to interrupt.** RETURNS:* OK or ERROR for invalid arguments.*/STATUS	intEnable    (    int level	/* level to be enabled */    )    {    return (*sysIntLvlEnableRtn) (level);    }/********************************************************************************* intDisable - disable a particular interrupt level** This call disables a particular interrupt level, regardless of the current* interrupt mask level.** RETURNS:* OK or ERROR for invalid arguments.*/STATUS	intDisable    (    int level	/* level to be disabled */    )    {    return (*sysIntLvlDisableRtn) (level);    }/********************************************************************************* intConnect - connect user routine to an interrupt vector** The user specified interrupt handling routine is connected to the specified* vector.** RETURNS: OK or ERROR for invalid arguments.*/STATUS	intConnect    (    VOIDFUNCPTR* vector,	/* vector id */    VOIDFUNCPTR routine,	/* interrupt service routine */    int argument		/* argument for isr */    )    {    int vecNum;    VEC_ENTRY *pVec;    if (intVecTable == NULL)	return ERROR;		/* library not initialized */    vecNum = IVEC_TO_INUM (vector);    /* check vector specified is in range allocated */    if (vecNum < 0 || vecNum >= intNumVectors)	return ERROR;    pVec = &intVecTable[vecNum];    if (routine == NULL)	{	routine = intUninitVec;	argument = vecNum;	}    pVec->routine = routine;    pVec->arg = argument;    return OK;    }/********************************************************************************* intLockLevelSet - set the interrupt lock level** This call establishes the interrupt level to be set when* intLock() is called.** RETURNS: N/A.*/void	intLockLevelSet    (    int newLevel	/* new lock level value */    )    {    intLockLevel = newLevel;    return;    }/********************************************************************************* intLockLevelGet - return current interrupt lock level** The interrupt lock level is the interrupt level that is set by the* intLock() command.  It is changeable by the intLockLevelSet() command.** RETURNS:* Returns the current interrupt lock level value. Returns ERROR if* lockLevel is implemented in hardware and not in software.*/int	intLockLevelGet (void)    {#ifdef INT_HDWE_LOCK_LEVEL    return ERROR;#else    return intLockLevel;#endif    }/********************************************************************************* intVecTableWriteProtect - write protect the vector table** This command is only supported with the VxVMI optional product.  Depending* upon the architecture capabilities, this function may not be supported at* all.** RETURNS: OK or ERROR if function is not supported.*/STATUS	intVecTableWriteProtect (void)    {    INT_VEC_TBL_PROTECT;    return OK;    }/********************************************************************************* intUninitVec - uninitialized vector handler** This routine handles the uninitialized vectors.  It calls the user* handler for uninitialized vectors, if one has been provided.** RETURNS: N/A.*/LOCAL void intUninitVec    (    int vector		/* vector number */    )    {    if (intUserUninitRtn != NULL)	(*intUserUninitRtn) (vector);    else	{	/* default uninitialized vector action */	UNINITIALIZED_VECTOR_RCVD (vector);	}    }/********************************************************************************* intUninitVecSet - set the uninitialized vector handler** This routine installs a handler for the uninitialized vectors to be* called when any uninitialized vector is entered.** RETURNS: N/A.*/void intUninitVecSet    (    VOIDFUNCPTR routine	/* ptr to user routine */    )    {    if (routine != NULL)	intUserUninitRtn = routine;    }/********************************************************************************* intVecBaseSet - set the interrupt vector base** RETURNS: N/A.*/void intVecBaseSet    (    FUNCPTR *base    )    {    return; /* DUMMY ROUTINE */    }/********************************************************************************* intVecBaseGet - return the interrupt vector base** RETURNS: pointer to beginning of vector table.*/FUNCPTR * intVecBaseGet (void)    {    return NULL; /* DUMMY ROUTINE */    }/******************************************************************************** intRegsLock - modify a REG_SET to have interrupts locked.** Note that this leaves the FIQ bit alone as FIQs are not handled by VxWorks.*/int intRegsLock    (    REG_SET *pRegs			/* register set to modify */    )    {    UINT32 oldSr = pRegs->cpsr;    pRegs->cpsr |= I_BIT;    return oldSr;    }/******************************************************************************** intRegsUnlock - restore a REG_SET's interrupt lockout level.** Note that this leaves the FIQ bit alone as FIQs are not handled by VxWorks.*/void intRegsUnlock    (    REG_SET *	pRegs,			/* register set to modify */    int		oldSr			/* sr with int lock level to restore */    )    {    pRegs->cpsr = (pRegs->cpsr & ~I_BIT) | (oldSr & I_BIT);    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -