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

📄 e1000.h

📁 COPE the first practical network coding scheme which is developped on click
💻 H
📖 第 1 页 / 共 3 页
字号:
/***************************************************************************** *****************************************************************************Copyright (c) 1999 - 2000, Intel Corporation All rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice,     this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice,    this list of conditions and the following disclaimer in the documentation     and/or other materials provided with the distribution. 3. Neither the name of Intel Corporation nor the names of its contributors     may be used to endorse or promote products derived from this software     without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AREDISCLAIMED. IN NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOTLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  ***************************************************************************** ****************************************************************************/#ifndef _E1000_H_#define _E1000_H_  /* * * e1000.h *  */#include "e1000_kcompat.h"#include "e1000_fxhw.h"#include "e1000_phy.h"#ifdef IANS#include "ans_driver.h"#include "base_comm.h"#endif#include <linux/types.h>#include <linux/init.h>#include <linux/mm.h>#include <linux/errno.h>#include <linux/ioport.h>#include <linux/pci.h>#include <linux/kernel.h>#include <linux/netdevice.h>#include <linux/etherdevice.h>#include <linux/skbuff.h>#include <linux/delay.h>#include <linux/timer.h>#include <linux/malloc.h>#include <linux/interrupt.h>#include <linux/version.h>#include <linux/string.h>#include <linux/proc_fs.h>#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,3,18) )#include <asm/spinlock.h>#else#include <linux/spinlock.h>#endif#include <asm/bitops.h>#include <asm/io.h>#include <asm/irq.h>#define MDI/* Unix Typedefs */typedef unsigned char uchar_t;typedef unsigned int uint_t;typedef unsigned short ushort_t;typedef unsigned long ulong_t;typedef unsigned long paddr_t;typedef ulong_t major_t;typedef unsigned char boolean_t;typedef unsigned long uintptr_t;#define B_TRUE            1#define B_FALSE         0#define TRUE            1#define FALSE            0typedef struct net_device device_t;typedef struct pci_dev pci_dev_t;typedef struct sk_buff sk_buff_t;typedef struct net_device_stats net_device_stats_t;/* * e1000_defines.h *  *//* Supported RX Buffer Sizes */#define E1000_RXBUFFER_2048		2048#define E1000_RXBUFFER_4096		4096#define E1000_RXBUFFER_8192		8192#define E1000_RXBUFFER_16384	16384/* Max and Min Number of Supported TX and RX Descriptors */ #define E1000_MAX_TXD	256#define E1000_MIN_TXD	80#define E1000_MAX_RXD	256#define E1000_MIN_RXD	80 #define ETH_LENGTH_OF_ADDRESS 6/* The number of entries in the CAM. The CAM (Content Addressable* Memory) holds the directed and multicast addresses that we* monitor. We reserve one of these spots for our directed address,* allowing us E1000_CAM_ENTRIES - 1 multicast addresses.*/#define RET_STATUS_SUCCESS 0#define RET_STATUS_FAILURE 1/* E1000 specific hardware defines */#define e1000regs E1000_REGISTERS#define PE1000_ADAPTER bdd_t*#ifdef MDI#define   DL_MAC_ADDR_LEN 6/***************************************************************************** * Structure for the Ethernet address ( 48 bits ) or 6 bytes *****************************************************************************/typedef union {    uchar_t bytes[DL_MAC_ADDR_LEN];    ushort_t words[DL_MAC_ADDR_LEN / 2];} DL_eaddr_t;#define   DL_ID                  (ENETM_ID)#define   ETHERNET_HEADER_SIZE   14#if defined(DL_STRLOG) && !defined(lint)#define DL_LOG(x)        DLstrlog ? x : 0#else#define DL_LOG(x)#endif#endif                            /* MDI *//* * e1000_sw.h *  * This file has all the defines for all the software defined structures * that are necessary for the  hardware as well as the DLPI interface  */#define E1000_PCI/* The size in bytes of a standard ethernet header */#define ENET_HEADER_SIZE    14#define MAX_INTS            256#define CRC_LENGTH 4 #define MAXIMUM_ETHERNET_PACKET_SIZE    1514#define MAX_NUM_MULTICAST_ADDRESSES     128#define MAX_NUM_PHYS_FRAGS_PER_PACKET   16#define E1000_NUM_MTA_REGISTERS         128#define RCV_PKT_MUL              5/* * This structure is used to define the characterstics of the message that is * sent by the upper layers for transmission. It contains the physical/virtual * address mapping for the physical fragments of the packet and also the length * of the fragment.  */typedef struct _PHYS_ADDRESS_UNIT {    caddr_t FragPhysAddr;    caddr_t FragVirtAddr;    UINT Length;} PHYS_ADDRESS_UNIT, *PPHYS_ADDRESS_UNIT;/*----------------------------------------------------------------------------- A structure that points to the next entry in the queue.-----------------------------------------------------------------------------*/typedef struct _SINGLE_LIST_LINK {    struct _SINGLE_LIST_LINK *Flink;} SINGLE_LIST_LINK, *PSINGLE_LIST_LINK;/* -----------------------------------------------------------------------------* A "ListHead" structure that points to the head and tail of a queue* --------------------------------------------------------------------------- */typedef struct _LIST_DESCRIBER {    struct _SINGLE_LIST_LINK *volatile Flink;    struct _SINGLE_LIST_LINK *volatile Blink;} LIST_DESCRIBER, *PLIST_DESCRIBER;/* MultiCast Command Block (MULTICAST_CB)*  The multicast structure contains an array of multicast addresses and *  also a count of the total number of addresses.*/typedef struct _multicast_cb_t {    ushort mc_count;            /* Number of multicast addresses */    uchar_t MulticastBuffer[(ETH_LENGTH_OF_ADDRESS *                             MAX_NUM_MULTICAST_ADDRESSES)];} mltcst_cb_t, *pmltcst_cb_t;/* ----------------------------------------------------------------------------- QUEUE_INIT_LIST -- Macro which will initialize a queue to NULL.---------------------------------------------------------------------------*/#define QUEUE_INIT_LIST(_LH) \    (_LH)->Flink = (_LH)->Blink = (PSINGLE_LIST_LINK)0/*-----------------------------------------------------------------------------* IS_QUEUE_EMPTY -- Macro which checks to see if a queue is empty.*--------------------------------------------------------------------------- */#define IS_QUEUE_EMPTY(_LH) \    ((_LH)->Flink == (PSINGLE_LIST_LINK)0)/* -------------------------------------------------------------------------* QUEUE_GET_HEAD -- Macro which returns the head of the queue, but does not*                   remove the head from the queue.*------------------------------------------------------------------------- */#define QUEUE_GET_HEAD(_LH) ((PSINGLE_LIST_LINK) ((_LH)->Flink))/*-----------------------------------------------------------------------------* QUEUE_REMOVE_HEAD -- Macro which removes the head of the head of a queue.*-------------------------------------------------------------------------- */#define QUEUE_REMOVE_HEAD(_LH) \    { \        PSINGLE_LIST_LINK ListElem; \        if (ListElem = (_LH)->Flink) \        { \            if(!((_LH)->Flink = ListElem->Flink)) \                (_LH)->Blink = (PSINGLE_LIST_LINK) 0; \        } \    }/*-----------------------------------------------------------------------------* QUEUE_POP_HEAD -- Macro which  will pop the head off of a queue (list), and*                   return it (this differs from QUEUE_REMOVE_HEAD only in*                   the 1st line).*-----------------------------------------------------------------------------*/#define QUEUE_POP_HEAD(_LH) \    (PSINGLE_LIST_LINK) (_LH)->Flink; \    { \        PSINGLE_LIST_LINK ListElem; \        if ((ListElem = (_LH)->Flink)) \        { \            if(!((_LH)->Flink = ListElem->Flink)) \                (_LH)->Blink = (PSINGLE_LIST_LINK) 0; \        } \    }/*-----------------------------------------------------------------------------* QUEUE_GET_TAIL -- Macro which returns the tail of the queue, but does not*                   remove the tail from the queue.*-------------------------------------------------------------------------- */#define QUEUE_GET_TAIL(_LH) ((PSINGLE_LIST_LINK)((_LH)->Blink))/*-----------------------------------------------------------------------------* QUEUE_PUSH_TAIL -- Macro which puts an element at the tail (end) of the queue**--------------------------------------------------------------------------- */#define QUEUE_PUSH_TAIL(_LH,_E) \    if ((_LH)->Blink) \    { \        ((PSINGLE_LIST_LINK)(_LH)->Blink)->Flink = (PSINGLE_LIST_LINK)(_E); \        (_LH)->Blink = (PSINGLE_LIST_LINK)(_E); \    } else \    { \        (_LH)->Flink = \            (_LH)->Blink = (PSINGLE_LIST_LINK)(_E); \    } \    (_E)->Flink = (PSINGLE_LIST_LINK)0;/*-----------------------------------------------------------------------------* QUEUE_PUSH_HEAD -- Macro which puts an element at the head of the queue.*--------------------------------------------------------------------------- */#define QUEUE_PUSH_HEAD(_LH,_E) \    if (!((_E)->Flink = (_LH)->Flink)) \    { \        (_LH)->Blink = (PSINGLE_LIST_LINK)(_E); \    } \    (_LH)->Flink = (PSINGLE_LIST_LINK)(_E);/* Ethernet Frame Structure *//*- Ethernet 6-byte Address */typedef struct _eth_address_t {    uchar_t eth_node_addr[ETH_LENGTH_OF_ADDRESS];} eth_address_t, *peth_address_t;typedef enum {	ANE_ENABLED = 0,	ANE_DISABLED,	ANE_SUSPEND} ANE_state_t;/* This is the hardware dependant part of the board config structure called bdd_t structure, it is very similar to the Adapter structure in the driver. The bd_config structure defined by the DLPI interface has  pointer to this structure*/#define             TX_LOCKUP      0x01typedef struct _ADAPTER_STRUCT {    /*  Hardware defines for the E1000 */    PE1000_REGISTERS HardwareVirtualAddress;    /* e1000 registers */    /* Node Ethernet address */    uchar_t perm_node_address[ETH_LENGTH_OF_ADDRESS];    UCHAR CurrentNetAddress[ETH_LENGTH_OF_ADDRESS];    /* command line options */    UCHAR AutoNeg;    UCHAR ForcedSpeedDuplex;    USHORT AutoNegAdvertised;    UCHAR WaitAutoNegComplete;    BOOLEAN GetLinkStatus;    UCHAR MacType;    UCHAR MediaType;    UINT32 PhyId;	UINT32 PhyAddress;	    /* PCI device info */    UINT16 VendorId;    UINT16 DeviceId;    UINT16 SubSystemId;    UINT16 SubVendorId;    UCHAR DmaFairness;    BOOLEAN LinkStatusChanged;            /* Flags for various hardware-software defines */    u_int e1000_flags;            /* misc. flags */

⌨️ 快捷键说明

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