ne2k.h

Go to the documentation of this file.
00001 /*****************************************************************************************
00002  Copyright (c) 2002-2004 The UbixOS Project
00003  All rights reserved.
00004 
00005  Redistribution and use in source and binary forms, with or without modification, are
00006  permitted provided that the following conditions are met:
00007 
00008  Redistributions of source code must retain the above copyright notice, this list of
00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
00010  form must reproduce the above copyright notice, this list of conditions, the following
00011  disclaimer and the list of authors in the documentation and/or other materials provided
00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
00013  contributors may be used to endorse or promote products derived from this software
00014  without specific prior written permission.
00015 
00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 
00026  $Id: ne2k_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
00027 
00028 *****************************************************************************************/
00029 
00030 #ifndef _NE2K_H
00031 #define _NE2K_H
00032 
00033 #include <ubixos/types.h>
00034 #include <sys/device.old.h>
00035 
00036 #define ether_addr  ether_addr_t
00037 typedef struct dp_rcvhdr
00038 {
00039         uInt8 dr_status;                 /* Copy of rsr                       */
00040         uInt8 dr_next;                   /* Pointer to next packet            */
00041         uInt8 dr_rbcl;                   /* Receive Byte Count Low            */
00042         uInt8 dr_rbch;                   /* Receive Byte Count High           */
00043 } dp_rcvhdr_t;
00044 
00045 typedef union etheraddr {
00046     unsigned char bytes[6];             /* byteorder safe initialization */
00047     unsigned short shorts[3];           /* force 2-byte alignment */
00048 } ether_addr;
00049 
00050 
00051 struct nicBuffer {
00052   struct nicBuffer *next;
00053   int               length;
00054   char             *buffer;
00055   };
00056 
00057 #define RSR_FO         0x08
00058 #define RSR_PRX                0x01
00059 #define DEF_ENABLED    0x200
00060 
00061 #define OK      0
00062 
00063 
00064 #define startPage 0x4C
00065 #define stopPage  0x80
00066 
00067 
00068 #define NE_CMD       0x00
00069 #define NE_PSTART    0x01
00070 #define NE_PSTOP     0x02
00071 #define NE_BNRY      0x03
00072 #define NE_TPSR      0x04
00073 #define NE_ISR       0x07
00074 #define NE_CURRENT   0x07
00075 #define NE_RBCR0     0x0A
00076 #define NE_RBCR1     0x0B
00077 #define NE_RCR       0x0C
00078 #define NE_TCR       0x0D
00079 #define NE_DCR       0x0E
00080 #define NE_IMR       0x0F
00081 
00082 
00083 #define NE_DCR_WTS   0x01
00084 #define NE_DCR_LS    0x08
00085 #define NE_DCR_AR    0x10
00086 #define NE_DCR_FT1   0x40
00087 #define NE_DCR_FT0   0x20
00088 
00089 
00090 
00091 #define E8390_STOP   0x01
00092 #define E8390_NODMA  0x20
00093 #define E8390_PAGE0  0x00
00094 #define E8390_PAGE1  0x40
00095 #define E8390_CMD    0x00
00096 #define E8390_START  0x02
00097 #define E8390_RREAD  0x08
00098 #define E8390_RWRITE 0x10
00099 #define E8390_RXOFF  0x20
00100 #define E8390_TXOFF  0x00
00101 #define E8390_RXCONFIG 0x04
00102 #define E8390_TXCONFIG 0x00
00103 
00104 #define EN0_COUNTER0 0x0d
00105 #define EN0_DCFG     0x0e
00106 #define EN0_RCNTLO   0x0a
00107 #define EN0_RCNTHI   0x0b
00108 #define EN0_ISR      0x07
00109 #define EN0_IMR      0x0f
00110 #define EN0_RSARLO   0x08
00111 #define EN0_RSARHI   0x09
00112 #define EN0_TPSR     0x04
00113 #define EN0_RXCR     0x0c
00114 #define EN0_TXCR     0x0D
00115 #define EN0_STARTPG  0x01
00116 #define EN0_STOPPG   0x02
00117 #define EN0_BOUNDARY 0x03
00118 
00119 #define EN1_PHYS     0x01
00120 #define EN1_CURPAG   0x07
00121 #define EN1_MULT     0x08
00122 
00123 #define NE1SM_START_PG 0x20
00124 #define NE1SM_STOP_PG 0x40
00125 #define NESM_START_PG 0x40
00126 #define NESM_STOP_PG  0x80
00127 
00128 #define ENISR_ALL    0x3f
00129 
00130 #define ENDCFG_WTS   0x01
00131 
00132 #define NE_DATAPORT  0x10
00133 
00134 #define TX_2X_PAGES 12
00135 #define TX_1X_PAGES 6
00136 #define TX_PAGES (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES)
00137 
00138 
00139 #define DP_CURR         0x7     /* Current Page Register             */
00140 #define DP_MAR0         0x8     /* Multicast Address Register 0      */
00141 #define DP_MAR1         0x9     /* Multicast Address Register 1      */
00142 #define DP_MAR2         0xA     /* Multicast Address Register 2      */
00143 #define DP_MAR3         0xB     /* Multicast Address Register 3      */
00144 #define DP_MAR4         0xC     /* Multicast Address Register 4      */
00145 #define DP_MAR5         0xD     /* Multicast Address Register 5      */
00146 #define DP_MAR6         0xE     /* Multicast Address Register 6      */
00147 #define DP_MAR7         0xF     /* Multicast Address Register 7      */
00148 
00149 #define DP_CNTR0        0xD     /* Tally Counter 0                   */
00150 #define DP_CNTR1        0xE     /* Tally Counter 1                   */
00151 #define DP_CNTR2        0xF     /* Tally Counter 2                   */
00152 
00153 
00154 #define DP_PAGESIZE     256
00155 
00156 extern char *nicPacket;
00157 extern uInt32 packetLength;
00158 
00159 
00160 int ne2k_init();
00161 int ne2kProbe(int,struct device *);
00162 int ne2kDevInit(struct device *);
00163 void NS8390_init(struct device *dev,int startp);
00164 
00165 void ne2kISR();
00166 void ne2kHandler();
00167 
00168 int NICtoPC(struct device *dev,void *packet,int length,int nic_addr);
00169 int PCtoNIC(struct device *dev,void *packet,int length);
00170 
00171 struct nicBuffer *ne2kAllocBuffer(int);
00172 struct nicBuffer *ne2kGetBuffer();
00173 void ne2kFreeBuffer(struct nicBuffer *);
00174 
00175 #endif
00176 
00177 /***
00178  $Log: ne2k_8h-source.html,v $
00178  Revision 1.7  2006/12/15 17:47:06  reddawg
00178  Updates
00178 
00179  Revision 1.1.1.1  2006/06/01 12:46:14  reddawg
00180  ubix2
00181 
00182  Revision 1.2  2005/10/12 00:13:36  reddawg
00183  Removed
00184 
00185  Revision 1.1.1.1  2005/09/26 17:23:39  reddawg
00186  no message
00187 
00188  Revision 1.6  2004/07/14 12:03:49  reddawg
00189  ne2k: ne2kInit to ne2k_init
00190  Changed Startup Routines
00191 
00192  Revision 1.5  2004/05/21 14:57:16  reddawg
00193  Cleaned up
00194 
00195 
00196  END
00197  ***/

Generated on Fri Dec 15 11:18:54 2006 for UbixOS V2 by  doxygen 1.4.7