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

📄 sysmotcpmend.c

📁 (1)本人基于MPC860的vxworks bsp的程序 (2)实现了FEC 100M和 SCC 10M的网口功能 (3)实现了nor flash的TFFS文件系统 (4)实现了系统的自检 (
💻 C
字号:
/* sysMotCpmEnd.c - system configuration module for motCpmEnd driver */ /* Copyright 1984-1999 Wind River Systems, Inc. */#include "copyright_wrs.h" /*modification history--------------------01a,18mar99, cn  created from pc386/sysEl3c90xEnd.c (SPR# 25839).*/ /*DESCRIPTIONThis is the WRS-supplied configuration module for the VxWorksmotCpmEnd END driver.It performs the dynamic parameterization of the motCpmEnd driver.This technique of 'just-in-time' parameterization allows driverparameter values to be declared as any other defined constants ratherthan as static strings.*/#include "vxWorks.h"#include "config.h" #include "vmLib.h"#include "stdio.h"#include "sysLib.h"#include "logLib.h"#include "stdlib.h"#include "string.h"#include "end.h"#include "intLib.h" #include "drv/end/motCpmEnd.h"/* defines */#ifdef INCLUDE_CPM#define CPM_TBD_NUM	0x10	/* number of transmit buffer descriptors (TBD)*/#define CPM_RBD_NUM	0x10	/* number of receive buffer descriptors (RBD)*/#define CPM_TBD_BASE	0x2000	/* offset in DPRAM of TBD table */#define CPM_RBD_BASE	0x2100	/* offset in DPRAM of RBD table *//* imports */ IMPORT END_OBJ *	motCpmEndLoad (char *);/******************************************************************************** sysMotCpmEndLoad - load an istance of the motCpmEnd driver** This routine loads the motCpmEnd driver with proper parameters. It also* reads the BCSR3 to find out which type of processor is being used, and* sets up the load string accordingly.** The END device load string formed by this routine is in the following* format.* <motCpmAddr>:<ivec>:<sccNum>:<txBdNum>:<rxBdNum>:<txBdBase>:<rxBdBase>:* <bufBase>** .IP <motCpmAddr>* Internal memory address* .IP <ivec>* Interrupt vector * .IP <sccNum>* SCC number being used* .IP <txBdNum>* number of TBDs or NULL* .IP <rxBdNum>* number of RBDs or NULL* .IP <txBdBase>* base location of the TBDs* .IP <rxBdBase>* base location of the RBDs* .IP <bufBase>* address of the shared memory region** This routine only loads and initializes one instance of the device.* If the user wishes to use more than one motCpmEnd devices, this routine* should be changed.** RETURNS: pointer to END object or ERROR.** SEE ALSO: motCpmEndLoad ()*/ END_OBJ * sysMotCpmEndLoad    (    char * pParamStr,   /* ptr to initialization parameter string */    void * unused       /* unused optional argument */    )    {    /*     * The motCpmEnd driver END_LOAD_STRING should be:     * <motCpmAddr>:<ivec>:<sccNum>:<txBdNum>:<rxBdNum>:<txBdBase>:     * <rxBdBase>:<bufBase>     * Note that unit string is prepended by the mux, so we     * don't put it here.     */     char * pStr = NULL;    char paramStr [200];    UINT8 sccNum;    int intVec;    static char motCpmEndParamTemplate [] = 			"0x%x:0x%x:%d:0x%x:0x%x:0x%x:0x%x:-1";    END_OBJ * pEnd;     if (strlen (pParamStr) == 0)        {        /*         * muxDevLoad() calls us twice.  If the string is         * zero length, then this is the first time through         * this routine.         */         pEnd = (END_OBJ *) motCpmEndLoad  (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.         */         pStr = strcpy (paramStr, pParamStr);         /* Now, we get to the end of the string */         pStr += strlen (paramStr);#ifdef HHPPC	 intVec = (int) IV_SCC1;	 sccNum = 1;	 #else 	/* If running an 823 or an 850, use SCC2 */	if (((*BCSR3 & BCSR3_DBID_MASK) == BCSR3_823DB_MASK) ||	    ((*BCSR3 & BCSR3_DBID_MASK) == BCSR3_850DB_MASK))	    {	    intVec = (int) IV_SCC2;	    sccNum = 2;	    }	else	    {	    intVec = (int) IV_SCC1;	    sccNum = 1;	    } #endif        /* finish off the initialization parameter string */        sprintf (pStr, motCpmEndParamTemplate,		 (UINT) vxImmrGet (),		 intVec,		 sccNum,		 CPM_TBD_NUM,  			 CPM_RBD_NUM,  			 CPM_TBD_BASE,  			 CPM_RBD_BASE  			 );         if ((pEnd = (END_OBJ *) motCpmEndLoad  (paramStr)) == (END_OBJ *)ERROR)            {            logMsg ("Error: motCpmEndLoad  failed to load driver\n",		    0, 0, 0, 0, 0, 0);            }        }     return (pEnd);    }#endif /* INCLUDE_CPM */

⌨️ 快捷键说明

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