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

📄 sysmotfccend.c

📁 WINDRIVER ADS8260 BSP
💻 C
字号:
/* sysMotFccEnd.c - system configuration module for motFccEnd driver */ /* Copyright 1984-2002 Wind River Systems, Inc. */#include "copyright_wrs.h" /*modification history--------------------01e,07mar02,kab  SPR 70817: *EndLoad returns NULL on failure01d,17oct01,jrs  Upgrade to veloce		 changed INCLUDE_MOT_FCC to INCLUDE_MOTFCCEND - SPR #3391401c,16sep99,ms_  get miiLib.h from h/drv instead of locally01b,15jul99,ms_  make compliant with our coding standards01a,05apr99, cn  created from ads860/sysMotCpmEnd.c*/ /*DESCRIPTIONThis is the WRS-supplied configuration module for the VxWorksmotFccEnd END driver.It performs the dynamic parameterization of the motFccEnd 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 "miiLib.h" /* defines */#ifdef INCLUDE_MOTFCCEND#define MOT_FCC_NUM		0x2	/* FCC being used */#define MOT_FCC_TBD_NUM		0x40	/* transmit buffer descriptors (TBD)*/#define MOT_FCC_RBD_NUM		0x20	/* receive buffer descriptors (RBD)*/#define MOT_FCC_PHY_ADDR	0x0	/* PHY address */#define MOT_FCC_DEF_PHY_MODE	0x2	/* PHY's default operating mode */#define MOT_FCC_FLAGS		0x4	/* user flags *//* imports */ IMPORT END_OBJ *	motFccEndLoad (char *);/* locals *//* * this table may be customized by the user to force a * particular order how different technology abilities may be * negotiated by the PHY. Entries in this table may be freely combined * and even OR'd together. */ LOCAL INT16 motFccAnOrderTbl [] = {                                MII_TECH_100BASE_TX,    /* 100Base-T */                                MII_TECH_100BASE_T4,    /* 10Base-T */                                MII_TECH_10BASE_T,      /* 100Base-T4 */                                MII_TECH_10BASE_FD,     /* 100Base-T FD*/                                MII_TECH_100BASE_TX_FD, /* 10Base-T FD */                                -1                      /* end of table */                               };/******************************************************************************** sysMotFccEndLoad - load an istance of the motFccEnd driver** This routine loads the motFccEnd 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.* <immrVal>:<fccNum>:<bdBase>:<bdSize>:<bufBase>:<bufSize>:<fifoTxBase>* :<fifoRxBase>:<tbdNum>:<rbdNum>:<phyAddr>:<phyDefMode>:<pAnOrderTbl>:* <userFlags>** .IP <immrVal>* Internal memory address* .IP <fccNum>* FCC number being used* .IP <bdBase>* buffer descriptors base address* .IP <bdSize>* buffer descriptors space size* .IP <bufBase>* data buffers base address* .IP <bufSize>* data buffers space size* .IP <fifoTxBase>* tx buffer in internal memory* .IP <fifoRxBase>* rx buffer in internal memory* .IP <tbdNum>* number of TBDs or NONE* .IP <rbdNum>* number of RBDs or NONE* .IP <phyAddr>* address of a MII-compliant PHY device* .IP <phyDefMode>* default operating mode of a MII-compliant PHY device* .IP <pAnOrderTbl>* auto-negotiation order table for a MII-compliant PHY device or NONE** This routine only loads and initializes one instance of the device.* If the user wishes to use more than one motFccEnd devices, this routine* should be changed.** RETURNS: pointer to END object or NULL.** SEE ALSO: motFccEndLoad ()*/ END_OBJ * sysMotFccEndLoad    (    char * pParamStr,   /* ptr to initialization parameter string */    void * unused       /* unused optional argument */    )    {    /*     * The motFccEnd driver END_LOAD_STRING should be:     * <immrVal>:<fccNum>:<bdBase>:<bdSize>:<bufBase>:<bufSize>:<fifoTxBase>     * :<fifoRxBase>:<tbdNum>:<rbdNum>:<phyAddr>:<phyDefMode>:<userFlags>:     * <pAnOrderTbl>     * Note that unit string is prepended by the mux, so we     * don't put it here.     */     char * pStr = NULL;    char paramStr [300];    LOCAL char motFccEndParamTemplate [] = 		    "0x%x:0x%x:-1:-1:-1:-1:-1:-1:0x%x:0x%x:0x%x:0x%x:0x%x:0x%x";    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 *) motFccEndLoad  (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);         /* finish off the initialization parameter string */        sprintf (pStr, motFccEndParamTemplate,		 (UINT) vxImmrGet (),		 MOT_FCC_NUM,		 MOT_FCC_TBD_NUM,  			 MOT_FCC_RBD_NUM,  			 MOT_FCC_PHY_ADDR,  			 MOT_FCC_DEF_PHY_MODE,  			 &motFccAnOrderTbl,		 MOT_FCC_FLAGS  			 );         if ((pEnd = (END_OBJ *) motFccEndLoad  (paramStr)) == (END_OBJ *)NULL)            {            logMsg ("Error: motFccEndLoad  failed to load driver\n",		    0, 0, 0, 0, 0, 0);            }        }     return (pEnd);    }#endif /* INCLUDE_MOTFCCEND */

⌨️ 快捷键说明

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