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

📄 sysmottsecend.c

📁 Freescale mpc834x 的VxWorks平台的BSP源代码。
💻 C
📖 第 1 页 / 共 2 页
字号:
/* sysMotTsecEnd.c - system configuration module for motTsecEnd driver *//* * Copyright (c) 2005-2006 Wind River Systems, Inc. * * The right to copy, distribute, modify or otherwise make use * of this software may be licensed only pursuant to the terms * of an applicable Wind River license agreement. *//*modification history--------------------01m,08mar06,kds  Set BD to 128/128.01l,21jun05,j_b  adapted from ads834x (rev 01k); add MAC address management*//*DESCRIPTIONThis is the WRS-supplied configuration module for the VxWorksmotTsecEnd END driver.*/#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 <cacheLib.h>#include <intLib.h>#include <lstLib.h>#include <miiLib.h>#include <drv/intrCtl/quiccIntrCtl.h>#include <drv/end/motTsecEnd.h>/* defines */#define MOT_TSEC_PHY_ADDRS_DEV_1    25#define MOT_TSEC_PHY_ADDRS_DEV_2    26/* PHY's default operating mode */#define MOT_TSEC_DEF_PHY_MODE      MII_PHY_TBL /* use auto-negotiation table *//* imports */IMPORT END_OBJ * motTsecEndLoad (char *);IMPORT STATUS    sysEnetAddrGet (UINT32, UCHAR *);IMPORT STATUS    sysL2ExtWriteBufferAlloc(char *adrs,UINT size,BOOL lock);/* globals *//* locals *//* forward declarations */LOCAL STATUS sysMiiPhyInit(PHY_INFO *);LOCAL STATUS sysMiiPhyStatusGet (PHY_INFO *,MOT_TSEC_PHY_STATUS *);LOCAL STATUS sysMotTsecEnetAddrGet (int, UCHAR *);LOCAL STATUS sysMotTsecEnetAddrSet (int, UCHAR *);LOCAL STATUS sysMotTsecEnetEnable (UINT32, UINT32);LOCAL STATUS sysMotTsecEnetDisable (UINT32, UINT32);/* * 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. */UINT32 sysMotTsecNumByUnit[MOT_TSEC_MAX_DEVS] = {MOT_TSEC_DEV_1, MOT_TSEC_DEV_2};LOCAL INT16 sysMotTsecAnOrderTbl [] =    {    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 */    };/* PhyParms table indexed by unit number */LOCAL MOT_TSEC_PHY_PARAMS sysMotTsecPhyParms[MOT_TSEC_MAX_DEVS] =    {        {        MOT_TSEC_PHY_ADDRS_DEV_1,        MOT_TSEC_DEF_PHY_MODE,        MII_PHY_DEF_DELAY,        1,        (MII_AN_ORDER_TBL *) sysMotTsecAnOrderTbl,        },        {        MOT_TSEC_PHY_ADDRS_DEV_2,        MOT_TSEC_DEF_PHY_MODE,        MII_PHY_DEF_DELAY,        1,        (MII_AN_ORDER_TBL *) sysMotTsecAnOrderTbl        }    };LOCAL MOT_TSEC_INT_CTRL sysMotIntCtrl[2] =    {    {    INUM_TSEC1_TX,    /* Transmit Interrupt */    INUM_TSEC1_RX,    /* Receive Interrupt */    INUM_TSEC1_ERR,    /* Error Interrupt */    NULL,     /* function to convert INUM to IVEC */    NULL      /* function to convert IVEC to INUM */    },    {    INUM_TSEC2_TX,    /* Transmit Interrupt */    INUM_TSEC2_RX,    /* Receive Interrupt */    INUM_TSEC2_ERR,    /* Error Interrupt */    NULL,     /* function to convert INUM to IVEC */    NULL      /* function to convert IVEC to INUM */    }    };LOCAL MOT_TSEC_FUNC_TABLE sysMotTsecFuncs =    {    sysMiiPhyInit,      /* bsp MiiPhy init function */    NULL,               /* Interrupt End Driver function called by BSP */    sysMiiPhyStatusGet, /* status call back */    NULL,               /* BSP BYTE Read funtion called by BSP */    NULL,               /* BSP BYTE Write function called by BSP */    sysMotTsecEnetAddrGet,    /* Driver call back to get the Ethernet address */    sysMotTsecEnetAddrSet,    /* Driver call back to set the Ethernet address */    sysMotTsecEnetEnable,     /* Driver call back to enable the ENET interface */    sysMotTsecEnetDisable,     /* Driver call back to disable the ENET interface */    NULL    };LOCAL MOT_TSEC_PARAMS sysMotTsecParms =    {    NULL,  /* Buffer pointer for allocated buffer space */    0,     /* Buffer pool size */    NULL,  /* Descripter Base Address */    0,     /* Descriptor Size */    128,    /* Number of Receive Buffer Descripters  */    128    /* Number of Transmit Buffer Descripters */    };#if 0/* TSEC hardware defaults */LOCAL MOT_TSEC_EXT_PARAMS sysMotTsecExtParms =    {    0, /* TSEC specific user bit flags */    0, /* TSEC specific user reg flags */    0, /* Ethernet Minimum Frame Length */    0, /* Ethernet Maximum Frame Length */       /* TSEC Specific Device Parameters */    0, /* ext + pause time value */    0, /* Ten Bit Interface physical address */        /* Tx FIFO Manipulation */    0,  /* UINT32 fifoTxTheshold; */    0,  /* UINT32 fifoTxStarve; */    0,  /* UINT32 fifoTxStarveShutOff; */        /* MAC specific Parameters */    {0,0,0,0,0,0,0,0}, /* initial individual addresses [8] */    {0,0,0,0,0,0,0,0}, /* initial group addresses [8] */    0,  /* UINT32 macPreambleLength; */    0,  /* UINT32 macIfMode; */    0,  /* UINT32 macIpgifgNbbipg1; */    0,  /* UINT32 macIpgifgNbbipg2; */    0,  /* UINT32 macIpgifgMifge; */    0,  /* UINT32 macIpgifgBbipg; */        /* MAC half duplex specific parameters */    0,  /* UINT32 macHalfDuplexAltBebTruncation; */    0,  /* UINT32 macHalfDuplexRetryMaximum; */    0,  /* UINT32 macHalfDuplexCollisionWindow; */    0,  /* UINT32 miiMgmtClockSelect; */    0,  /* UINT32 phyAddress; */        /* Misc */    0,  /* UINT32 extL2Cache; */    0,  /* UINT32 bdL2Cache;  */    0,  /* UINT32 dmaExtLength; */    0   /* UINT32 dmaExtIndex; */    };#endif/************************************************************************* sysMotTsecEndLoad - load an istance of the motTsecEnd driver** This routine loads the motTsecEnd driver with proper parameters. It also** The END device load string formed by this routine is in the following* format.* <unit>:<tsecAddrs>:<tsecNum>:<MAC Address>:<MOT_TSEC_FUNC_TABLE>:* <MOT_TSEC_PARAMS>:<MOT_TSEC_EXT_PARAMS>** .IP <unit>* The unit number passed by the Mux.* .IP <CCSBAR>* The MPC85xx Internal memory base address. eg.0xfe000000* .IP <tsecNum>* This Tsec's physical port, 0 or 1. Not the same as the unit number.* .IP <MAC ADDRESS>* This TSEC's MAC address eg. 00-0a-1e-12-34-56* .IP <usrFlags>* User Init Flags* .IP <MOT_TSEC_PHY_PARAMS>* PHY Init parameters* .IP <MOT_TSEC_FUNC_TABLE>* Stucture Address of external and driver functions* .IP <MOT_TSEC_PARAMS>* Stucture Address of Bufffer Allocation Parameters* .IP <MOT_TSEC_EXT_PARAMS>* Structure Address of TSEC specific parameters** This routine only loads and initializes one instance of the device.* If the user wishes to use more than one motTsecEnd devices, this routine* should be changed.** RETURNS: pointer to END object or NULL.** SEE ALSO: motTsecEndLoad ()*/END_OBJ * sysMotTsecEndLoad    (    char * pParamStr,   /* ptr to initialization parameter string */    void * unused       /* unused optional argument */    )    {    END_OBJ * pEnd;    char   paramStr [300];    UINT32 unit, usrFlags;    char *  tok;             /* an initString token */    char *  holder = NULL;   /* points to initString fragment beyond tok */    UCHAR   enetAddr[ETHER_ADDR_LEN]; /* ethernet address */    /*    * <CCSBAR>:    * <tsecNum>:    * <MAC Address>:    * <UsrFlags>:    * <MOT_TSEC_PHY_PARAMS>:    * <MOT_TSEC_FUNC_TABLE>:    * <MOT_TSEC_PARAMS>:    * <MOT_TSEC_EXT_PARAMS>    * Note that unit string is prepended by the mux, so we    * don't put it here.    */#ifdef INCLUDE_L2_CACHE    sysMotTsecFuncs.extWriteL2AllocFunc = sysL2ExtWriteBufferAlloc;#endif    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 *) motTsecEndLoad  (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.        */

⌨️ 快捷键说明

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