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

📄 s2410intctrl.c

📁 2410 BSP vxworks xia下
💻 C
字号:
/* usbPciStub.c - System-specific PCI Functions *//* Copyright 2000 Wind River Systems, Inc. *//*Modification history--------------------01a,22nov00,wef  First, created from 01h of the mcp750 bsp stub*//*DESCRIPTIONThis file defines a skeleton of functions to be used for accessing the PCI bus capabilities.  These functions allow PCI device drivers to be written independent of the underlying O/S's PCI access mechanisms.The name of each function in this group begins with "usb" to represent"Device Driver Services."*//* Includes */#include "vxWorks.h"#include "config.h"#include "intLib.h"#include "integrator.h"#define S2410_REG(reg)	(*(volatile UINT32 *)reg)	#define S3410_REG_READ(reg,result)   \	(result) = (S2410_REG(reg))#define S3410_REG_WRITE(reg,result)  \	(S2410_REG(reg)) = (result)  	    /********************************************************************************* sngks32cIntLvlVecChk - check for and return any pending interrupts** This routine interrogates the hardware to determine the highest priority* interrupt pending.  It returns the vector associated with that interrupt, and* also the interrupt priority level prior to the interrupt (not the* level of the interrupt).  The current interrupt priority level is then* raised to the level of the current interrupt so that only higher priority* interrupts will be accepted until this interrupt is finished.** The return value ERROR indicates that no pending interrupt was found and* that the level and vector values were not returned.** RETURNS: OK or ERROR if no interrupt is pending.*//* * A mask word.  Bits are set in this word when a specific level * is enabled. It is used to mask off individual levels that have * not been explicitly enabled. */ int	sc2410LvlChg (int);STATUS  sc2410LvlVecAck (int, int);int	sc2410LvlChg (	int level	/* new interrupt level */    	){	int oldlevel;		oldlevel  = rINTMSK;	rINTMSK  |= (1<<level);			return oldlevel;			}STATUS  sc2410LvlVecAck    (    int level,	/* old interrupt level to be restored */    int vector	/* current interrupt vector, if needed */    ){			rINTMSK &= (~(1<<vector));		return OK;}    	STATUS  sc2410IntLvlVecChk    (    int* pLevel,  /* ptr to receive old interrupt level */    int* pVector  /* ptr to receive current interrupt vector */    )    {    UINT32 newLevel;    UINT32 intPendMask = 0x1;    int count;    UINT32 isr;    newLevel = rINTPND;    for (count = 0, isr = 0; count < AMBA_INT_NUM_LEVELS; count++)        {        if (intPendMask & newLevel)            break;        isr++;        intPendMask <<= 1;        }     	         *pLevel  = sc2410LvlChg (isr);    *pVector = isr;        if( isr == INT_LVL_TIMER_0)    {    	rGPFDAT ^= 0X10;    }           ClearPending((1 << isr));        return OK;    }    /********************************************************************************* sngks32cIntLvlEnable - enable a single interrupt level** Enable a specific interrupt level.  The enabled level will be allowed to* generate an interrupt, when the overall interrupt level is set below the* specified level.  Without being enabled, the interrupt is blocked regardless* of the overall interrupt level setting.** RETURNS: OK or ERROR if the specified level cannot be enabled.*/STATUS  sc2410IntLvlEnable    (    int level  /* level to be enabled */    )    {     rINTMSK &=  ~((1 << level));    return OK;    }/********************************************************************************* sngks32cIntLvlDisable - disable a single interrupt level** Disable a specific interrupt level.  The disabled level is prevented* from generating an interrupt even if the overall interrupt level is set* below the specified level.** RETURNS: OK or ERROR, if the specified interrupt level cannot be disabled.*/STATUS  sc2410IntLvlDisable    (    int level  /* level to be disabled */    )    {       /* set bit in mask register */        rINTMSK |= (1 << level);    return OK;    }void sc2410IntDevInit (void)    {    	sysIntLvlVecChkRtn     	= sc2410IntLvlVecChk;	sysIntLvlVecAckRtn	= sc2410LvlVecAck;	sysIntLvlChgRtn		= sc2410LvlChg;    	sysIntLvlEnableRtn     	= sc2410IntLvlEnable;    	sysIntLvlDisableRtn    	= sc2410IntLvlDisable;    	/*according to the templateIntrCtl.c,all the interrupt enable,i don't know why,    	but enable the required interrupt level*/    	rINTMSK &= ~(BIT_TIMER4|BIT_UART0|BIT_UART1);    	rINTSUBMSK &= ~(BIT_SUB_RXD0|BIT_SUB_ERR0|BIT_SUB_RXD1|BIT_SUB_ERR1);    	    }/* End of file. */

⌨️ 快捷键说明

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