e1000_hw.h

来自「是关于linux2.5.1的完全源码」· C头文件 代码 · 共 1,508 行 · 第 1/5 页

H
1,508
字号
/*******************************************************************************  This software program is available to you under a choice of one of two  licenses. You may choose to be licensed under either the GNU General Public  License 2.0, June 1991, available at http://www.fsf.org/copyleft/gpl.html,  or the Intel BSD + Patent License, the text of which follows:    Recipient has requested a license and Intel Corporation ("Intel") is willing  to grant a license for the software entitled Linux Base Driver for the  Intel(R) PRO/1000 Family of Adapters (e1000) (the "Software") being provided  by Intel Corporation. The following definitions apply to this license:    "Licensed Patents" means patent claims licensable by Intel Corporation which  are necessarily infringed by the use of sale of the Software alone or when  combined with the operating system referred to below.    "Recipient" means the party to whom Intel delivers this Software.    "Licensee" means Recipient and those third parties that receive a license to  any operating system available under the GNU General Public License 2.0 or  later.    Copyright (c) 1999 - 2002 Intel Corporation.  All rights reserved.    The license is provided to Recipient and Recipient's Licensees under the  following terms.    Redistribution and use in source and binary forms of the Software, with or  without modification, are permitted provided that the following conditions  are met:    Redistributions of source code of the Software may retain the above  copyright notice, this list of conditions and the following disclaimer.    Redistributions in binary form of the Software may reproduce the above  copyright notice, this list of conditions and the following disclaimer in  the documentation and/or materials provided with the distribution.    Neither the name of Intel Corporation nor the names of its contributors  shall be used to endorse or promote products derived from this Software  without specific prior written permission.    Intel hereby grants Recipient and Licensees a non-exclusive, worldwide,  royalty-free patent license under Licensed Patents to make, use, sell, offer  to sell, import and otherwise transfer the Software, if any, in source code  and object code form. This license shall include changes to the Software  that are error corrections or other minor changes to the Software that do  not add functionality or features when the Software is incorporated in any  version of an operating system that has been distributed under the GNU  General Public License 2.0 or later. This patent license shall apply to the  combination of the Software and any operating system licensed under the GNU  General Public License 2.0 or later if, at the time Intel provides the  Software to Recipient, such addition of the Software to the then publicly  available versions of such operating systems available under the GNU General  Public License 2.0 or later (whether in gold, beta or alpha form) causes  such combination to be covered by the Licensed Patents. The patent license  shall not apply to any other combinations which include the Software. NO  hardware per se is licensed hereunder.    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  IMPLIED WARRANTIES OF MECHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR IT CONTRIBUTORS BE LIABLE FOR ANY  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES  (INCLUDING, BUT NOT LIMITED, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  ANY LOSS OF USE; DATA, OR PROFITS; OR BUSINESS INTERUPTION) 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.*******************************************************************************//* e1000_hw.h * Structures, enums, and macros for the MAC */#ifndef _E1000_HW_H_#define _E1000_HW_H_#include "e1000_osdep.h"/* Forward declarations of structures used by the shared code */struct e1000_hw;struct e1000_hw_stats;/* Enumerated types specific to the e1000 hardware *//* Media Access Controlers */typedef enum {    e1000_82542_rev2_0 = 0,    e1000_82542_rev2_1,    e1000_82543,    e1000_82544,    e1000_82540,    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;/* 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/* Function prototypes *//* Initialization */void e1000_reset_hw(struct e1000_hw *hw);int32_t e1000_init_hw(struct e1000_hw *hw);/* Link Configuration */int32_t e1000_setup_link(struct e1000_hw *hw);int32_t e1000_phy_setup_autoneg(struct e1000_hw *hw);void e1000_config_collision_dist(struct e1000_hw *hw);int32_t e1000_config_fc_after_link_up(struct e1000_hw *hw);int32_t e1000_check_for_link(struct e1000_hw *hw);void e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t * speed, uint16_t * duplex);int32_t e1000_wait_autoneg(struct e1000_hw *hw);/* PHY */int32_t e1000_read_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *phy_data);int32_t e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t data);void e1000_phy_hw_reset(struct e1000_hw *hw);int32_t e1000_phy_reset(struct e1000_hw *hw);int32_t e1000_detect_gig_phy(struct e1000_hw *hw);int32_t e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info);int32_t e1000_validate_mdi_setting(struct e1000_hw *hw);/* EEPROM Functions */int32_t e1000_read_eeprom(struct e1000_hw *hw, uint16_t reg, uint16_t *data);int32_t e1000_validate_eeprom_checksum(struct e1000_hw *hw);int32_t e1000_read_part_num(struct e1000_hw *hw, uint32_t * part_num);int32_t e1000_read_mac_addr(struct e1000_hw * hw);/* Filters (multicast, vlan, receive) */void e1000_init_rx_addrs(struct e1000_hw *hw);void e1000_mc_addr_list_update(struct e1000_hw *hw, uint8_t * mc_addr_list, uint32_t mc_addr_count, uint32_t pad);uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr);void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value);void e1000_rar_set(struct e1000_hw *hw, uint8_t * mc_addr, uint32_t rar_index);void e1000_write_vfta(struct e1000_hw *hw, uint32_t offset, uint32_t value);void e1000_clear_vfta(struct e1000_hw *hw);/* LED functions */int32_t e1000_setup_led(struct e1000_hw *hw);int32_t e1000_cleanup_led(struct e1000_hw *hw);int32_t e1000_led_on(struct e1000_hw *hw);int32_t e1000_led_off(struct e1000_hw *hw);/* Adaptive IFS Functions *//* Everything else */void e1000_clear_hw_cntrs(struct e1000_hw *hw);void e1000_reset_adaptive(struct e1000_hw *hw);void e1000_update_adaptive(struct e1000_hw *hw);void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats, uint32_t frame_len, uint8_t * mac_addr);void e1000_get_bus_info(struct e1000_hw *hw);void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);/* 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 NUM_DEV_IDS 9#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

⌨️ 快捷键说明

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