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

📄 sysrtlcpend.c

📁 MPC8241:本程序是freescale的824*系列的BSP源程序
💻 C
📖 第 1 页 / 共 2 页
字号:
			 		pRsrc[unit]->pciFunc,                    PCI_CFG_BASE_ADDRESS_1, &membaseCsr);        		pciConfigInByte (pRsrc[unit]->pciBus, 			 		pRsrc[unit]->pciDevice, 			 		pRsrc[unit]->pciFunc,                    PCI_CFG_DEV_INT_LINE, &irq);  								irq = PCI_8139_INT_VEC;				/***************kongfq2005.8.16**********************/				/*kongfq = irq ;*/				/*logMsg("sysRtl81x9PciInit and ok\n",1,2,3,4,5,6);*/  /*********kongfq2005.8.16********/				/*				logMsg("irq = %d\n", kongfq,2,3,4,5,6);				kongfq = iobaseCsr ;		        logMsg("iobaseCsr 1 =0x%x\n", kongfq,2,3,4,5,6);				kongfq = membaseCsr;	            logMsg("membaseCsr 1 =0x%x\n", kongfq,2,3,4,5,6);				*/				membaseCsr   &= PCI_MEMBASE_MASK;        		iobaseCsr    &= PCI_IOBASE_MASK;                							/* over write the resource table with values read */				pRsrc[unit]->membaseCsr   = membaseCsr;								pRsrc[unit]->iobaseCsr    = iobaseCsr;								pRsrc[unit]->irq          = irq;				        		pRsrc[unit]->irqvec  = irq;								/* enable mapped memory and IO addresses */        		pciConfigOutWord (	pRsrc[unit]->pciBus, 			  				pRsrc[unit]->pciDevice, 			  				pRsrc[unit]->pciFunc,                          	PCI_CFG_COMMAND, PCI_CMD_IO_ENABLE |                          	PCI_CMD_MEM_ENABLE | PCI_CMD_MASTER_ENABLE);        		/* disable sleep mode */         		pciConfigOutWord (pRsrc[unit]->pciBus, 			  		pRsrc[unit]->pciDevice, 			  		pRsrc[unit]->pciFunc, 			  		PCI_CFG_MODE,                     SLEEP_MODE_DIS);								netEndUnits++;   	/* number of units found */								/* Now initialize all the units we found */                UnitNum = netEndUnits;                /***************kongfq2005.8.16**********************/                /*logMsg("out of find device\n",1,2,3,4,5,6);*/				break;			}else			{				logMsg("can not find device!\n",1,2,3,4,5,6);			}		}	}    if (found != TRUE)    {		return (ERROR);    	}	else	{		return (OK);    	}}/********************************************************************************* sysRtl81x9IntEnable - enable interrupts** This routine enables interrupts.  This may involve operations on* interrupt control hardware.** RETURNS: OK or ERROR for invalid arguments.*/STATUS sysRtl81x9IntEnable(    int	level		/* level number */){    /*return (sysIntEnablePIC(level));*/	/*************kongfq2005.8.16*****************/	/*logMsg("intlevel = %x",level,2,3,4,5,6);*/	return (intEnable (level));/*modified by mashuyu*/}/********************************************************************************* sysLanIntDisable - disable interrupts** This routine disables interrupts.  This may involve operations on* interrupt control hardware.** RETURNS: OK or ERROR for invalid arguments.*/STATUS sysRtl81x9IntDisable( int	level		/* level number */ ){        /*return (sysIntDisablePIC(level));*/	return (intDisable (level));/*modified by mashuyu*/}/******************************************************************************** sysRtlcpEndLoad - load an istance of the rtl81x9 END driver** This routine loads the rtl81x9 driver with the parameters specified by* the resource table for the device, and some default values.** The END device load string formed by this routine is in the following* following format.* <devMemAddr>:<devIoAddr>:<pciMemBase>:<vecnum>:<intLvl>:<memAdrs>* :<memSize>:<memWidth>:<flags>:<buffMultiplier>** .IP <devMemAddr>* Device register base memory address* .IP <devIoAddr>* Device register base IO address* .IP <pciMemBase>* Base address of PCI memory space* .IP <vecNum>* Interrupt vector number.* .IP <intLvl>* Interrupt level.* .IP <memAdrs>* Memory pool address or NONE.* .IP <memSize>* Memory pool size or zero.* .IP <memWidth>* Memory system size, 1, 2, or 4 bytes (optional).* .IP <flags>* Device specific flags.* .IP <buffMultiplier>* Buffer Multiplier or NONE. If NONE is specified, it defaults to 2** This routine only loads and initializes instance zero of the device.* If the user wishes to use more than one rtl81x9 devices, this routine* should be changed.** RETURNS: pointer to END object or ERROR.** SEE ALSO: rtl81x9EndLoad()*/ END_OBJ * sysRtlcpEndLoad    (    char * pParamStr,   /* ptr to initialization parameter string */    void * unused       /* unused optional argument */    ){	/*	* The rtl81x9 driver END_LOAD_STRING should be:	* <devMemAddr>:<devIoAddr>:<pciMemBase>:<vecnum>:<intLvl>:<memAdrs>	* :<memSize>:<memWidth>:<flags>:<buffMultiplier>	* Note that unit string is prepended by the mux, so we	* don't put it here.	*/	    int unit_number;    char irq;	char * pStr = NULL;    char paramStr [200];    static char rtl81x9ParamTemplate [] = 		"0x%x:0x%x:0x%x:%d:%d:-1:-1:-1:0x%x:%d:0x%x";    END_OBJ * pEnd;		/*logMsg("sysRtlcpEndLoad :%d\n",pci8139initnum,2,3,4,5,6);*/ /********kongfq2005.8.16********/    if(0==pci8139initnum)    {		sysRtl81x9PciInit ();		pci8139initnum=1;    }	/* if(1==pci8139initnum)    {    pci8139initnum=0;	} */	    if (strlen (pParamStr) == 0)	{	/*	* muxDevLoad() calls us twice.  If the string is	* zero length, then this is the first time through	* this routine.	*/			/*logMsg("the paramstr1 is :%s",paramStr,2,3,4,5,6);*/        pEnd = (END_OBJ *) rtlcpEndLoad (pParamStr);               	}    else	{	/*	* On the second pass through here, we actually create	* the initialization parameter string on the fly.	* Note that we will be handed our unit number on the	* second pass and we need to preserve that information.	* So we use the unit number handed from the input string.	*/				/* Work out the Unit Number to initialise */				unit_number = atoi (pParamStr);		if ((unit_number < 0) || (unit_number > RTL81X9_MAX_DEV))		{			return NULL;		}		else		{		/*		* 动态加载时因为加第二个或更多的时候要改重新加中断,故加入以下代码。		*/						pciConfigInByte (pRsrc[unit_number]->pciBus, 				pRsrc[unit_number]->pciDevice, 				pRsrc[unit_number]->pciFunc,				PCI_CFG_DEV_INT_LINE, &irq);						            pRsrc[unit_number]->irqvec= pRsrc[unit_number]->irq=irq;              			pStr = strcpy (paramStr, pParamStr);									/* Now, we get to the end of the string */						pStr += strlen (paramStr);					/* finish off the initialization parameter string */			sprintf (pStr, rtl81x9ParamTemplate,				/* device memory IO base */				(UINT) pRsrc[unit_number]->membaseCsr + CPU_PCI_MEM_ADRS,				/* device Io base */				(UINT) pRsrc[unit_number]->iobaseCsr  + CPU_PCI_IO_ADRS,				PCI2DRAM_BASE_ADRS,					/* pciMemBase */				pRsrc[unit_number]->irqvec,       	/* interrupt IRQ vector */				pRsrc[unit_number]->irq,          	/* interrupt irq number */				0,                         			/* ?????? */				0,                         			/* offset */				RTL81X9_END_FLAGS          			/* flags */				);			if ((pEnd = (END_OBJ *) rtlcpEndLoad (paramStr)) == (END_OBJ *)ERROR)			{				logMsg ("Error: rtlcpEndLoad failed to load driver\n",					0, 0, 0, 0, 0, 0);			}		}	}	    return (pEnd);}#endif /* INCLUDE_RTL_CP_END */

⌨️ 快捷键说明

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