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

📄 sysend.c

📁 vxworks的BSP开发配置文件
💻 C
📖 第 1 页 / 共 3 页
字号:
/* sysEnd.c - System Enhanced network interface support library *//* Copyright 1997-2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01g,17jul02,scm  fix ref SPR 78869, dc driver load string changes...01f,30aug01,scm  adjust to reflect ixm1200...01e,15may01,jb  Fixing Big Endian bugs01d,04apr01,jb  Fix compiler warnings01c,03apr01,jb  Removing debug statements01b,02apr01,jb  Fix compile time warnings01a,29mar01,jb  adapted from ebsa285 version 01a.*//*DESCRIPTIONThis file contains the board-specific routines for Ethernet adapterinitialisation of Intel (formerly DEC) 21040, 21140 and 21143-basedadapters and Intel Pro 100+ based adapters.NOTEAt the time of writing, this module has only been tested with the followingEthernet cards:    21040 controller: Digital DE435.    21140 controller: D-Link DFE-500TX                      Kingston KNE-100TX    21143 controller: Intel (formerly DEC) EB143 evaluation card.                      Kingston KNE-100TX                      Longshine 8038 TXD    82559 controller: Intel PRO/100+ Management Adapter                      Intel InBusiness 10/100 PCI Network AdapterRefer to the BSP reference entry for any eventual limitations orproblems related to the BSP.SEE ALSO: ifLib,.I "Digital Semiconductor 21143 PCI/CardBus Fast Ethernet LAN Controller,".I "Digital Semiconductor 21143 10/100Base-TX Evaluation Board User's Guide,".I "Intel 10/100 MBit Ethernet Family Software technical Reference Manual."*/#include "vxWorks.h"#include "config.h"#include "cacheLib.h"#include "stdio.h"#ifdef INCLUDE_END#include "drv/end/dec21x40End.h"#include "drv/end/fei82557End.h"#include "ixm1200.h"#include "ixm1200Pci.h"#ifdef END_DEBUG#undef LOCAL#define LOCAL#endif/* defines */#define CSR_BASE_MSK	0x7f		/* Mask Base Address Register */#define	END_LD_STR_SIZE	80/* PCI memory base address register configuration mode */#define FORCE		0x00	/* overwrite membase address register */#define AUTO		0x01	/* read membase address register *//* * Need to use automatic configuration mode using the resource assigning in * pciAssignResources(). */#define PCI_REG_MOD	AUTO	/* define the register configuration mode */#define TYPE_ALLOC	1000/* * DEC cards in range 1 -> 1000 */#define DEC_START	1/* DEC 21X4X 10/100Base-TX Board type */#define	EB143		DEC_START + 1	/* DEC 21143 10/100Base-TX */#define	DC140		DEC_START + 2	/* DEC 21140 10/100Base-TX */#define	DC040		DEC_START + 3	/* DEC 21040 10/100Base-TX *//* Untested types are > 100 */#define LC82C168	DEC_START + 104	/* Lite-On PNIC */#define MX98713		DEC_START + 105	/* Macronix 98713 PMAC */#define MX98715		DEC_START + 106	/* Macronix 98715 PMAC */#define AX88140		DEC_START + 107	/* ASIX AX88140 */#define PNIC2		DEC_START + 108	/* Lite-On PNIC-II */#define COMET		DEC_START + 109	/* Comet family */#define COMPEX9881	DEC_START + 110	/* Compex 9881 */#define I21145		DEC_START + 111	/* Intel 21145 *//* * FEI cards in range 1001 -> 2000 */#define FEI_START	TYPE_ALLOC + 1#define PRO100B		FEI_START	/* Intel EtherExpress PRO-100B PCI */#define INBUSINESS	FEI_START    	/* Intel InBusiness 10/100 PCI */#define I82559ER  	FEI_START + 1  	/* Arbitrary card with 82559ER *//* * DEC driver user flags * * Use of the SF (Store and Forward) bit is necessary at the time of * writing on current boards to support 100 Mbits/s operation, though * it is not necessary for 10 Mbits/s. */#define DEC_USR_FLAGS_143 	(DEC_USR_21143 | DEC_USR_SF)#define DEC_USR_FLAGS_140 	(DEC_USR_BAR_RX	| \                                 DEC_USR_RML	| \                                 DEC_USR_CAL_08 | \                                 DEC_USR_PBL_04 | \                                 DEC_USR_21140  | \                                 DEC_USR_SF)#define DEC_USR_FLAGS_040 	(DEC_USR_BAR_RX | \                                 DEC_USR_CAL_08 | \                                 DEC_USR_PBL_04)/* These are untested */#define PNIC_USR_FLAGS	  	(DEC_USR_21143)#define PNIC2_USR_FLAGS	  	(DEC_USR_PNIC2)#define MX98713_USR_FLAGS	(0)#define MX98715_USR_FLAGS	(0)#define AX88140_USR_FLAGS	(0)#define COMET_USR_FLAGS		(0)#define COMET_USR_FLAGS		(0)#define COMET_USR_FLAGS		(0)#define COMPEX9881_USR_FLAGS	(0)#define I21145_USR_FLAGS	(0)/* END table information */#define DEC_BUFF_LOAN   1                       /* enable buffer loaning *//* DEC 21X4X PCI/CardBus specific definitions */#define DEC21X4X_PCI_VENDOR_ID		0x1011	/* PCI vendor ID */#define DEC21143_PCI_DEVICE_ID		0x0019	/* PCI device ID */#define DEC21140_PCI_DEVICE_ID		0x0009	/* PCI device ID */#define DEC21040_PCI_DEVICE_ID		0x0002	/* PCI device ID */#define PNIC_PCI_VENDOR_ID          0x11AD  /* PCI vendor ID */#define PNIC_PCI_DEVICE_ID          0x0002#define PNIC2_PCI_DEVICE_ID         0xc115#define MACRONIX_PCI_VENDOR_ID		0x10d9	/* PCI vendor ID */#define MX98713_PCI_DEVICE_ID		0x0512#define MX98715_PCI_DEVICE_ID		0x0531#define ASIX_PCI_VENDOR_ID          0x125B  /* PCI vendor ID */#define AX88140_PCI_DEVICE_ID		0x1400#define COMET_PCI_VENDOR_ID			0x1317	/* PCI vendor ID */#define COMET1_PCI_DEVICE_ID		0x0981#define COMET2_PCI_DEVICE_ID		0x0985#define COMET3_PCI_DEVICE_ID		0x1985#define COMPEX_PCI_VENDOR_ID		0x11F6	/* PCI vendor ID */#define COMPEX9881_PCI_DEVICE_ID	0x9881#define INTEL_PCI_VENDOR_ID         0x8086  /* PCI vendor ID */#define I21145_PCI_DEVICE_ID		0x0039#define DAVICOM_PCI_VENDOR_ID		0x1282	/* PCI vendor ID */#define DAVICOM9100_PCI_DEVICE_ID	0x9100#define DAVICOM9102_PCI_DEVICE_ID	0x9102#define ACCTON_PCI_VENDOR_ID		0x1113	/* PCI vendor ID */#define EN1217_PCI_DEVICE_ID		0x1217#define	BOARD_TYPE_NB			(NELEMENTS(boardResources))#ifdef INCLUDE_FEI82557END/* EEPROM control bits */#define EE_SK           0x01            /* shift clock */#define EE_CS           0x02            /* chip select */#define EE_DI           0x04            /* chip data in */#define EE_DO           0x08            /* chip data out *//* EEPROM opcode */#define EE_CMD_WRITE    0x05            /* WRITE opcode, 101 */#define EE_CMD_READ     0x06            /* READ  opcode, 110 */#define EE_CMD_ERASE    0x07            /* ERASE opcode, 111 *//* EEPROM misc. defines */#define EE_CMD_BITS     3               /* number of opcode bits */#define EE_ADDR_BITS    6               /* number of address bits */#define EE_DATA_BITS    16              /* number of data bits */#define EE_SIZE         0x40            /* 0x40 words */#define EE_CHECKSUM     0xbaba          /* checksum *//* PC compatibility macros */#define sysOutWord(addr,data)   PCI_OUT_WORD(addr,data)#define sysInWord(addr)         PCI_IN_WORD(addr)#define sysOutLong(addr,data)   PCI_OUT_LONG(addr,data)#define sysInLong(addr)         PCI_IN_LONG(addr)#define FEI_MEMSIZE0            0x00001000#define FEI_INIT_STATE_MASK   (VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE | VM_STATE_MASK_BUFFERABLE)#define FEI_INIT_STATE        (VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT | VM_STATE_BUFFERABLE_NOT)#define UNKNOWN                 (-1)/* 82557/9 PCI specific definitions *//* Intel PRO-100B PCI specific definitions */#ifndef PRO100B_PCI_VENDOR_ID#define PRO100B_PCI_VENDOR_ID   0x8086  /* PCI vendor ID */#define PRO100B_PCI_DEVICE_ID   0x1229  /* PCI device ID */#endif    /* PRO100B_PCI_VENDOR_ID *//* Intel InBusiness 10/100 PCI specific definitions */#ifndef INBUSINESS_PCI_VENDOR_ID#define INBUSINESS_PCI_VENDOR_ID   PRO100B_PCI_VENDOR_ID  /* PCI vendor ID */#define INBUSINESS_PCI_DEVICE_ID   0x1030                 /* PCI device ID */#endif    /* INBUSINESS_PCI_VENDOR_ID *//* Add Support for 82559ER Chip on motherboard */#ifndef I82559ER_PCI_VENDOR_ID#define I82559ER_PCI_VENDOR_ID PRO100B_PCI_VENDOR_ID#define I82559ER_PCI_DEVICE_ID 0x1209#endif    /* I82559ER_PCI_VENDOR_ID */#endif /* INCLUDE_FEI82557END *//* typedefs */typedef struct pciResource              /* PCI_RESOURCES */    {    UINT32      iobaseCsr;              /* Base Address Register 0 */    UINT32      membaseCsr;             /* Base Address Register 1 */    char        irq;                    /* Interrupt Request Level */    UINT32      irqvec;                 /* Interrupt Request vector */    UINT32      configType;             /* type of configuration */    void *      buf;                    /* any allocated buffer space */    UINT32      cpuToPciOffset;         /* Any offset from CPU to PCI address */    } PCI_RESOURCES;typedef struct boardResource		/* BOARD_RESOURCES */    {    UINT32  type;                   /* type of the board */    UINT32  vendorId;               /* Vendor ID */    UINT32  deviceId;               /* Device ID */    UINT32  decUsrFlags;            /* DEC driver user flags */    } BOARD_RESOURCES;#ifdef INCLUDE_FEI82557ENDtypedef struct feiResource              /* FEI_RESOURCE */    {    UINT32      membaseCsr;             /* Base Address Register 0 */    UINT32      iobaseCsr;              /* Base Address Register 1 */    UINT32      membaseFlash;           /* Base Address Register 2 */    char        irq;                    /* Interrupt Request Level */    UINT32      configType;             /* type of configuration */    UINT32      boardType;              /* type of LAN board this unit is */    UINT32      pciBus;                 /* PCI Bus number */    UINT32      pciDevice;              /* PCI Device number */    UINT32      pciFunc;                /* PCI Function number */    UINT16      eeprom[0x40];           /* Ethernet Address of this unit */    INT32       timeout;                /* timeout for the self-test */    INT32       str[6];                 /* storage for the self-test result */    volatile INT32 * pResults;          /* pointer to the self-test result */    UINT        memLength;              /* required memory size */    UINT        initialStateMask;       /* mask parameter to vmStateSet */    UINT        initialState;           /* state parameter to vmStateSet */    } FEI_RESOURCE;#endif/* locals *//* * This array defines the board-specific PCI resources, the base address * register configuration mode and the Ethernet adapter type. It's indexed * using the device number returned from pciFindDevice(). * * The mode is set as AUTO so this will be erased by the configuration read * from the card that is effectively set by pciAssignResources(). See * sysLanPciInit() for this. */LOCAL PCI_RESOURCES pciResources [PCI_MAX_DEV] =    {    {PCI_IO_ADR0, PCI_MEM_ADR0, PCI_INT_LVL0, PCI_INT_VEC0, PCI_REG_MOD, 0, 0},    {PCI_IO_ADR1, PCI_MEM_ADR1, PCI_INT_LVL1, PCI_INT_VEC1, PCI_REG_MOD, 0, 0},    {PCI_IO_ADR2, PCI_MEM_ADR2, PCI_INT_LVL2, PCI_INT_VEC2, PCI_REG_MOD, 0, 0},    {PCI_IO_ADR3, PCI_MEM_ADR3, PCI_INT_LVL3, PCI_INT_VEC3, PCI_REG_MOD, 0, 0}    };/* * This array defines board-specific vendor and device ids, flags to pass to * the drive load routine and the function used to select the media. */LOCAL BOARD_RESOURCES boardResources [] =    {#ifdef INCLUDE_DEC21X40END    {EB143, DEC21X4X_PCI_VENDOR_ID, DEC21143_PCI_DEVICE_ID, DEC_USR_FLAGS_143},    {DC140, DEC21X4X_PCI_VENDOR_ID, DEC21140_PCI_DEVICE_ID, DEC_USR_FLAGS_140},    {DC040, DEC21X4X_PCI_VENDOR_ID, DEC21040_PCI_DEVICE_ID, DEC_USR_FLAGS_040},#ifdef INCLUDE_DEC_UNTESTED    /* Untested cards */    {LC82C168, PNIC_PCI_VENDOR_ID, PNIC_PCI_DEVICE_ID, PNIC_USR_FLAGS},    {PNIC2, PNIC_PCI_VENDOR_ID, PNIC2_PCI_DEVICE_ID, PNIC2_USR_FLAGS},    {MX98713, MACRONIX_PCI_VENDOR_ID, MX98713_PCI_DEVICE_ID, MX98713_USR_FLAGS},    {MX98715, MACRONIX_PCI_VENDOR_ID, MX98715_PCI_DEVICE_ID, MX98715_USR_FLAGS},    {AX88140, ASIX_PCI_VENDOR_ID, AX88140_PCI_DEVICE_ID, AX88140_USR_FLAGS},    {COMET, COMET_PCI_VENDOR_ID, COMET1_PCI_DEVICE_ID, COMET_USR_FLAGS},    {COMET, COMET_PCI_VENDOR_ID, COMET2_PCI_DEVICE_ID, COMET_USR_FLAGS},    {COMET, COMET_PCI_VENDOR_ID, COMET3_PCI_DEVICE_ID, COMET_USR_FLAGS},    {COMPEX9881, COMPEX_PCI_VENDOR_ID, COMPEX9881_PCI_DEVICE_ID,\     COMPEX9881_USR_FLAGS},    {I21145, INTEL_PCI_VENDOR_ID, I21145_PCI_DEVICE_ID, I21145_USR_FLAGS},    {DC140, DAVICOM_PCI_VENDOR_ID, DAVICOM9100_PCI_DEVICE_ID,\     DEC_USR_FLAGS_140},    {DC140, DAVICOM_PCI_VENDOR_ID, DAVICOM9102_PCI_DEVICE_ID,\     DEC_USR_FLAGS_140},    {MX98715, ACCTON_PCI_VENDOR_ID, EN1217_PCI_DEVICE_ID, MX98715_USR_FLAGS},#endif /* INCLUDE_DEC_UNTESTED */#endif /* INCLUDE_DEC21X40END */#ifdef INCLUDE_FEI82557END    {PRO100B, PRO100B_PCI_VENDOR_ID, PRO100B_PCI_DEVICE_ID, 0},    {INBUSINESS, INBUSINESS_PCI_VENDOR_ID, INBUSINESS_PCI_DEVICE_ID, 0},#ifdef  INCLUDE_FEI82557END    {I82559ER, I82559ER_PCI_VENDOR_ID, I82559ER_PCI_DEVICE_ID, 0},#endif  /* INCLUDE_FEI82557END */#endif /* INCLUDE_FEI82557END */    };/* END load strings */LOCAL char	endLoadStr[PCI_MAX_DEV][END_LD_STR_SIZE];/* Index of devices */LOCAL int       currentEndDevice        = 0;#ifdef INCLUDE_FEI82557ENDLOCAL UINT32 feiUnits;                  /* number of FEIs we found */LOCAL FEI_RESOURCE feiResources [PCI_MAX_DEV] =    {    {UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,     UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, {UNKNOWN}, UNKNOWN,     {UNKNOWN}, NULL, FEI_MEMSIZE0, FEI_INIT_STATE_MASK, FEI_INIT_STATE},    {UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,     UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, {UNKNOWN}, UNKNOWN,     {UNKNOWN}, NULL, FEI_MEMSIZE0, FEI_INIT_STATE_MASK, FEI_INIT_STATE},    {UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,     UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, {UNKNOWN}, UNKNOWN,     {UNKNOWN}, NULL, FEI_MEMSIZE0, FEI_INIT_STATE_MASK, FEI_INIT_STATE},    {UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,     UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, {UNKNOWN}, UNKNOWN,     {UNKNOWN}, NULL, FEI_MEMSIZE0, FEI_INIT_STATE_MASK, FEI_INIT_STATE}    };LOCAL const char * phys[] =    {    "None", "i82553-A/B", "i82553-C", "i82503",    "DP83840", "80c240", "80c24", "i82555",    "unknown-8", "unknown-9", "DP83840A", "unknown-11",    "unknown-12", "unknown-13", "unknown-14", "unknown-15"    };enum phy_chips    {    NonSuchPhy=0, I82553AB, I82553C, I82503,    DP83840, S80C240, S80C24, I82555, DP83840A=10, UndefinedPhy    };LOCAL const char *connectors[] = {" RJ45", " BNC", " AUI", " MII"};#endif /* INCLUDE_FEI82557END *//* imports *//* End device table - should be PCI_MAX_DEV+1 entries */IMPORT END_TBL_ENTRY	endDevTbl[];#ifdef INCLUDE_DEC21X40END/* DEC specific imports */IMPORT END_OBJ * 	dec21x40EndLoad (char *, void *);IMPORT int		dec21x40Loops;#endif#ifdef INCLUDE_FEI82557END/* FEI specific imports */

⌨️ 快捷键说明

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