igb_osdep.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 
00003   Intel(R) Gigabit Ethernet Linux driver
00004   Copyright(c) 2007-2009 Intel Corporation.
00005 
00006   This program is free software; you can redistribute it and/or modify it
00007   under the terms and conditions of the GNU General Public License,
00008   version 2, as published by the Free Software Foundation.
00009 
00010   This program is distributed in the hope it will be useful, but WITHOUT
00011   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00013   more details.
00014 
00015   You should have received a copy of the GNU General Public License along with
00016   this program; if not, write to the Free Software Foundation, Inc.,
00017   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
00018 
00019   The full GNU General Public License is included in this distribution in
00020   the file called "COPYING".
00021 
00022   Contact Information:
00023   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
00024   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
00025 
00026 *******************************************************************************/
00027 
00028 FILE_LICENCE ( GPL2_ONLY );
00029 
00030 /* glue for the OS independent part of e1000
00031  * includes register access macros
00032  */
00033 
00034 #ifndef _IGB_OSDEP_H_
00035 #define _IGB_OSDEP_H_
00036 
00037 /* Begin OS Dependencies */
00038 
00039 #define u8         unsigned char
00040 #define bool       boolean_t
00041 #define dma_addr_t unsigned long
00042 #define __le16     uint16_t
00043 #define __le32     uint32_t
00044 #define __le64     uint64_t
00045 
00046 #define __iomem
00047 #define __devinit
00048 
00049 #define msleep(x) mdelay(x)
00050 
00051 #define ETH_FCS_LEN 4
00052 
00053 typedef int spinlock_t;
00054 typedef enum {
00055     false = 0,
00056     true = 1
00057 } boolean_t;
00058 
00059 #define TRUE  1
00060 #define FALSE 0
00061 
00062 #define usec_delay(x) udelay(x)
00063 #define msec_delay(x) mdelay(x)
00064 #define msec_delay_irq(x) mdelay(x)
00065 
00066 /* End OS Dependencies */
00067 
00068 #define PCI_COMMAND_REGISTER   PCI_COMMAND
00069 #define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE
00070 #define ETH_ADDR_LEN           ETH_ALEN
00071 
00072 #ifdef __BIG_ENDIAN
00073 #define E1000_BIG_ENDIAN __BIG_ENDIAN
00074 #endif
00075 
00076 
00077 #define DEBUGOUT(S) if (0) { printf(S); }
00078 #define DEBUGOUT1(S, A...) if (0) { printf(S, A); }
00079 
00080 #define DEBUGFUNC(F) DEBUGOUT(F "\n")
00081 #define DEBUGOUT2 DEBUGOUT1
00082 #define DEBUGOUT3 DEBUGOUT2
00083 #define DEBUGOUT7 DEBUGOUT3
00084 
00085 #define E1000_REGISTER(a, reg) (reg)
00086 
00087 #define E1000_WRITE_REG(a, reg, value) do {  \
00088                 writel((value), ((a)->hw_addr + E1000_REGISTER(a, reg))); } while (0)
00089 
00090 #define E1000_READ_REG(a, reg) (readl((a)->hw_addr + E1000_REGISTER(a, reg)))
00091 
00092 #define E1000_WRITE_REG_ARRAY(a, reg, offset, value) do { \
00093           writel((value), ((a)->hw_addr + E1000_REGISTER(a, reg) + ((offset) << 2))); } while (0);
00094 
00095 #define E1000_READ_REG_ARRAY(a, reg, offset) ( \
00096     readl((a)->hw_addr + E1000_REGISTER(a, reg) + ((offset) << 2)))
00097 
00098 #define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
00099 #define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
00100 
00101 #define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
00102     writew((value), ((a)->hw_addr + E1000_REGISTER(a, reg) + ((offset) << 1))))
00103 
00104 #define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
00105     readw((a)->hw_addr + E1000_REGISTER(a, reg) + ((offset) << 1)))
00106 
00107 #define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
00108     writeb((value), ((a)->hw_addr + E1000_REGISTER(a, reg) + (offset))))
00109 
00110 #define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
00111     readb((a)->hw_addr + E1000_REGISTER(a, reg) + (offset)))
00112 
00113 #define E1000_WRITE_REG_IO(a, reg, offset) do { \
00114     outl(reg, ((a)->io_base));                  \
00115     outl(offset, ((a)->io_base + 4));      } while (0)
00116 
00117 #define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, E1000_STATUS)
00118 
00119 #define E1000_WRITE_FLASH_REG(a, reg, value) ( \
00120     writel((value), ((a)->flash_address + reg)))
00121 
00122 #define E1000_WRITE_FLASH_REG16(a, reg, value) ( \
00123     writew((value), ((a)->flash_address + reg)))
00124 
00125 #define E1000_READ_FLASH_REG(a, reg) (readl((a)->flash_address + reg))
00126 
00127 #define E1000_READ_FLASH_REG16(a, reg) (readw((a)->flash_address + reg))
00128 
00129 #endif /* _IGB_OSDEP_H_ */

Generated on Tue Apr 6 20:01:01 2010 for gPXE by  doxygen 1.5.7.1