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

📄 e1000.h

📁 F:worksip2440a board可启动u-boot-like.tar.gz F:worksip2440a board可启动u-boot-like.tar.gz
💻 H
📖 第 1 页 / 共 5 页
字号:
/*******************************************************************************  Copyright(c) 1999 - 2002 Intel Corporation. All rights reserved.  This program is free software; you can redistribute it and/or modify it  under the terms of the GNU General Public License as published by the Free  Software Foundation; either version 2 of the License, or (at your option)  any later version.  This program is distributed in the hope that it will be useful, but WITHOUT  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for  more details.  You should have received a copy of the GNU General Public License along with  this program; if not, write to the Free Software Foundation, Inc., 59  Temple Place - Suite 330, Boston, MA  02111-1307, USA.  The full GNU General Public License is included in this distribution in the  file called LICENSE.  Contact Information:  Linux NICS <linux.nics@intel.com>  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497*******************************************************************************//* e1000_hw.h * Structures, enums, and macros for the MAC */#ifndef _E1000_HW_H_#define _E1000_HW_H_#include <common.h>#include <malloc.h>#include <net.h>#include <asm/io.h>#include <pci.h>#define E1000_ERR(args...) printf("e1000: " args)#ifdef E1000_DEBUG#define E1000_DBG(args...)	printf("e1000: " args)#define DEBUGOUT(fmt,args...) printf(fmt ,##args)#define DEBUGFUNC()        printf("%s\n", __FUNCTION__);#else#define E1000_DBG(args...)#define DEBUGFUNC()#define DEBUGOUT(fmt,args...)#endif/* Forward declarations of structures used by the shared code */struct e1000_hw;struct e1000_hw_stats;typedef enum {	FALSE = 0,	TRUE = 1} boolean_t;/* Enumerated types specific to the e1000 hardware *//* Media Access Controlers */typedef enum {	e1000_undefined = 0,	e1000_82542_rev2_0,	e1000_82542_rev2_1,	e1000_82543,	e1000_82544,	e1000_82540,	e1000_82545,	e1000_82546,	e1000_num_macs} e1000_mac_type;/* Media Types */typedef enum {	e1000_media_type_copper = 0,	e1000_media_type_fiber = 1,	e1000_num_media_types} e1000_media_type;typedef enum {	e1000_10_half = 0,	e1000_10_full = 1,	e1000_100_half = 2,	e1000_100_full = 3} e1000_speed_duplex_type;typedef enum {	e1000_lan_a = 0,	e1000_lan_b = 1} e1000_lan_loc;/* Flow Control Settings */typedef enum {	e1000_fc_none = 0,	e1000_fc_rx_pause = 1,	e1000_fc_tx_pause = 2,	e1000_fc_full = 3,	e1000_fc_default = 0xFF} e1000_fc_type;/* PCI bus types */typedef enum {	e1000_bus_type_unknown = 0,	e1000_bus_type_pci,	e1000_bus_type_pcix} e1000_bus_type;/* PCI bus speeds */typedef enum {	e1000_bus_speed_unknown = 0,	e1000_bus_speed_33,	e1000_bus_speed_66,	e1000_bus_speed_100,	e1000_bus_speed_133,	e1000_bus_speed_reserved} e1000_bus_speed;/* PCI bus widths */typedef enum {	e1000_bus_width_unknown = 0,	e1000_bus_width_32,	e1000_bus_width_64} e1000_bus_width;/* PHY status info structure and supporting enums */typedef enum {	e1000_cable_length_50 = 0,	e1000_cable_length_50_80,	e1000_cable_length_80_110,	e1000_cable_length_110_140,	e1000_cable_length_140,	e1000_cable_length_undefined = 0xFF} e1000_cable_length;typedef enum {	e1000_10bt_ext_dist_enable_normal = 0,	e1000_10bt_ext_dist_enable_lower,	e1000_10bt_ext_dist_enable_undefined = 0xFF} e1000_10bt_ext_dist_enable;typedef enum {	e1000_rev_polarity_normal = 0,	e1000_rev_polarity_reversed,	e1000_rev_polarity_undefined = 0xFF} e1000_rev_polarity;typedef enum {	e1000_polarity_reversal_enabled = 0,	e1000_polarity_reversal_disabled,	e1000_polarity_reversal_undefined = 0xFF} e1000_polarity_reversal;typedef enum {	e1000_auto_x_mode_manual_mdi = 0,	e1000_auto_x_mode_manual_mdix,	e1000_auto_x_mode_auto1,	e1000_auto_x_mode_auto2,	e1000_auto_x_mode_undefined = 0xFF} e1000_auto_x_mode;typedef enum {	e1000_1000t_rx_status_not_ok = 0,	e1000_1000t_rx_status_ok,	e1000_1000t_rx_status_undefined = 0xFF} e1000_1000t_rx_status;struct e1000_phy_info {	e1000_cable_length cable_length;	e1000_10bt_ext_dist_enable extended_10bt_distance;	e1000_rev_polarity cable_polarity;	e1000_polarity_reversal polarity_correction;	e1000_auto_x_mode mdix_mode;	e1000_1000t_rx_status local_rx;	e1000_1000t_rx_status remote_rx;};struct e1000_phy_stats {	uint32_t idle_errors;	uint32_t receive_errors;};/* Error Codes */#define E1000_SUCCESS      0#define E1000_ERR_EEPROM   1#define E1000_ERR_PHY      2#define E1000_ERR_CONFIG   3#define E1000_ERR_PARAM    4#define E1000_ERR_MAC_TYPE 5#define E1000_ERR_NOLINK   6#define E1000_ERR_TIMEOUT  7/* PCI Device IDs */#define E1000_DEV_ID_82542          0x1000#define E1000_DEV_ID_82543GC_FIBER  0x1001#define E1000_DEV_ID_82543GC_COPPER 0x1004#define E1000_DEV_ID_82544EI_COPPER 0x1008#define E1000_DEV_ID_82544EI_FIBER  0x1009#define E1000_DEV_ID_82544GC_COPPER 0x100C#define E1000_DEV_ID_82544GC_LOM    0x100D#define E1000_DEV_ID_82540EM        0x100E#define E1000_DEV_ID_82540EM_LOM    0x1015#define E1000_DEV_ID_82545EM_COPPER 0x100F#define E1000_DEV_ID_82545EM_FIBER  0x1011#define E1000_DEV_ID_82546EB_COPPER 0x1010#define E1000_DEV_ID_82546EB_FIBER  0x1012#define NUM_DEV_IDS 13#define NODE_ADDRESS_SIZE 6#define ETH_LENGTH_OF_ADDRESS 6/* MAC decode size is 128K - This is the size of BAR0 */#define MAC_DECODE_SIZE (128 * 1024)#define E1000_82542_2_0_REV_ID 2#define E1000_82542_2_1_REV_ID 3#define SPEED_10    10#define SPEED_100   100#define SPEED_1000  1000#define HALF_DUPLEX 1#define FULL_DUPLEX 2/* The sizes (in bytes) of a ethernet packet */#define ENET_HEADER_SIZE             14#define MAXIMUM_ETHERNET_FRAME_SIZE  1518	/* With FCS */#define MINIMUM_ETHERNET_FRAME_SIZE  64	/* With FCS */#define ETHERNET_FCS_SIZE            4#define MAXIMUM_ETHERNET_PACKET_SIZE \    (MAXIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE)#define MINIMUM_ETHERNET_PACKET_SIZE \    (MINIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE)#define CRC_LENGTH                   ETHERNET_FCS_SIZE#define MAX_JUMBO_FRAME_SIZE         0x3F00/* 802.1q VLAN Packet Sizes */#define VLAN_TAG_SIZE                     4	/* 802.3ac tag (not DMAed) *//* Ethertype field values */#define ETHERNET_IEEE_VLAN_TYPE 0x8100	/* 802.3ac packet */#define ETHERNET_IP_TYPE        0x0800	/* IP packets */#define ETHERNET_ARP_TYPE       0x0806	/* Address Resolution Protocol (ARP) *//* Packet Header defines */#define IP_PROTOCOL_TCP    6#define IP_PROTOCOL_UDP    0x11/* This defines the bits that are set in the Interrupt Mask * Set/Read Register.  Each bit is documented below: *   o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0) *   o RXSEQ  = Receive Sequence Error */#define POLL_IMS_ENABLE_MASK ( \    E1000_IMS_RXDMT0 |         \    E1000_IMS_RXSEQ)/* This defines the bits that are set in the Interrupt Mask * Set/Read Register.  Each bit is documented below: *   o RXT0   = Receiver Timer Interrupt (ring 0) *   o TXDW   = Transmit Descriptor Written Back *   o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0) *   o RXSEQ  = Receive Sequence Error *   o LSC    = Link Status Change */#define IMS_ENABLE_MASK ( \    E1000_IMS_RXT0   |    \    E1000_IMS_TXDW   |    \    E1000_IMS_RXDMT0 |    \    E1000_IMS_RXSEQ  |    \    E1000_IMS_LSC)/* The number of high/low register pairs in the RAR. The RAR (Receive Address * Registers) holds the directed and multicast addresses that we monitor. We * reserve one of these spots for our directed address, allowing us room for * E1000_RAR_ENTRIES - 1 multicast addresses. */#define E1000_RAR_ENTRIES 16#define MIN_NUMBER_OF_DESCRIPTORS 8#define MAX_NUMBER_OF_DESCRIPTORS 0xFFF8/* Receive Descriptor */struct e1000_rx_desc {	uint64_t buffer_addr;	/* Address of the descriptor's data buffer */	uint16_t length;	/* Length of data DMAed into data buffer */	uint16_t csum;		/* Packet checksum */	uint8_t status;		/* Descriptor status */	uint8_t errors;		/* Descriptor Errors */	uint16_t special;};/* Receive Decriptor bit definitions */#define E1000_RXD_STAT_DD       0x01	/* Descriptor Done */#define E1000_RXD_STAT_EOP      0x02	/* End of Packet */#define E1000_RXD_STAT_IXSM     0x04	/* Ignore checksum */#define E1000_RXD_STAT_VP       0x08	/* IEEE VLAN Packet */#define E1000_RXD_STAT_TCPCS    0x20	/* TCP xsum calculated */#define E1000_RXD_STAT_IPCS     0x40	/* IP xsum calculated */#define E1000_RXD_STAT_PIF      0x80	/* passed in-exact filter */#define E1000_RXD_ERR_CE        0x01	/* CRC Error */#define E1000_RXD_ERR_SE        0x02	/* Symbol Error */#define E1000_RXD_ERR_SEQ       0x04	/* Sequence Error */#define E1000_RXD_ERR_CXE       0x10	/* Carrier Extension Error */#define E1000_RXD_ERR_TCPE      0x20	/* TCP/UDP Checksum Error */#define E1000_RXD_ERR_IPE       0x40	/* IP Checksum Error */#define E1000_RXD_ERR_RXE       0x80	/* Rx Data Error */#define E1000_RXD_SPC_VLAN_MASK 0x0FFF	/* VLAN ID is in lower 12 bits */#define E1000_RXD_SPC_PRI_MASK  0xE000	/* Priority is in upper 3 bits */#define E1000_RXD_SPC_PRI_SHIFT 0x000D	/* Priority is in upper 3 of 16 */#define E1000_RXD_SPC_CFI_MASK  0x1000	/* CFI is bit 12 */#define E1000_RXD_SPC_CFI_SHIFT 0x000C	/* CFI is bit 12 *//* mask to determine if packets should be dropped due to frame errors */

⌨️ 快捷键说明

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