00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _NE2K_H
00025 #define _NE2K_H
00026
00027 #include <ubixos/types.h>
00028 #include <sys/device.old.h>
00029
00030 #define ether_addr ether_addr_t
00031 typedef struct dp_rcvhdr
00032 {
00033 uInt8 dr_status;
00034 uInt8 dr_next;
00035 uInt8 dr_rbcl;
00036 uInt8 dr_rbch;
00037 } dp_rcvhdr_t;
00038
00039 typedef union etheraddr {
00040 unsigned char bytes[6];
00041 unsigned short shorts[3];
00042 } ether_addr;
00043
00044
00045 struct nicBuffer {
00046 struct nicBuffer *next;
00047 int length;
00048 char *buffer;
00049 };
00050
00051 #define RSR_FO 0x08
00052 #define RSR_PRX 0x01
00053 #define DEF_ENABLED 0x200
00054
00055 #define OK 0
00056
00057
00058 #define startPage 0x4C
00059 #define stopPage 0x80
00060
00061
00062 #define NE_CMD 0x00
00063 #define NE_PSTART 0x01
00064 #define NE_PSTOP 0x02
00065 #define NE_BNRY 0x03
00066 #define NE_TPSR 0x04
00067 #define NE_ISR 0x07
00068 #define NE_CURRENT 0x07
00069 #define NE_RBCR0 0x0A
00070 #define NE_RBCR1 0x0B
00071 #define NE_RCR 0x0C
00072 #define NE_TCR 0x0D
00073 #define NE_DCR 0x0E
00074 #define NE_IMR 0x0F
00075
00076
00077 #define NE_DCR_WTS 0x01
00078 #define NE_DCR_LS 0x08
00079 #define NE_DCR_AR 0x10
00080 #define NE_DCR_FT1 0x40
00081 #define NE_DCR_FT0 0x20
00082
00083
00084
00085 #define E8390_STOP 0x01
00086 #define E8390_NODMA 0x20
00087 #define E8390_PAGE0 0x00
00088 #define E8390_PAGE1 0x40
00089 #define E8390_CMD 0x00
00090 #define E8390_START 0x02
00091 #define E8390_RREAD 0x08
00092 #define E8390_RWRITE 0x10
00093 #define E8390_RXOFF 0x20
00094 #define E8390_TXOFF 0x00
00095 #define E8390_RXCONFIG 0x04
00096 #define E8390_TXCONFIG 0x00
00097
00098 #define EN0_COUNTER0 0x0d
00099 #define EN0_DCFG 0x0e
00100 #define EN0_RCNTLO 0x0a
00101 #define EN0_RCNTHI 0x0b
00102 #define EN0_ISR 0x07
00103 #define EN0_IMR 0x0f
00104 #define EN0_RSARLO 0x08
00105 #define EN0_RSARHI 0x09
00106 #define EN0_TPSR 0x04
00107 #define EN0_RXCR 0x0c
00108 #define EN0_TXCR 0x0D
00109 #define EN0_STARTPG 0x01
00110 #define EN0_STOPPG 0x02
00111 #define EN0_BOUNDARY 0x03
00112
00113 #define EN1_PHYS 0x01
00114 #define EN1_CURPAG 0x07
00115 #define EN1_MULT 0x08
00116
00117 #define NE1SM_START_PG 0x20
00118 #define NE1SM_STOP_PG 0x40
00119 #define NESM_START_PG 0x40
00120 #define NESM_STOP_PG 0x80
00121
00122 #define ENISR_ALL 0x3f
00123
00124 #define ENDCFG_WTS 0x01
00125
00126 #define NE_DATAPORT 0x10
00127
00128 #define TX_2X_PAGES 12
00129 #define TX_1X_PAGES 6
00130 #define TX_PAGES (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES)
00131
00132
00133 #define DP_CURR 0x7
00134 #define DP_MAR0 0x8
00135 #define DP_MAR1 0x9
00136 #define DP_MAR2 0xA
00137 #define DP_MAR3 0xB
00138 #define DP_MAR4 0xC
00139 #define DP_MAR5 0xD
00140 #define DP_MAR6 0xE
00141 #define DP_MAR7 0xF
00142
00143 #define DP_CNTR0 0xD
00144 #define DP_CNTR1 0xE
00145 #define DP_CNTR2 0xF
00146
00147
00148 #define DP_PAGESIZE 256
00149
00150 extern char *nicPacket;
00151 extern uInt32 packetLength;
00152
00153
00154 int ne2kInit(uInt32);
00155 int ne2kProbe(int,struct device *);
00156 int ne2kDevInit(struct device *);
00157 void NS8390_init(struct device *dev,int startp);
00158
00159 void ne2kISR();
00160 void ne2kHandler();
00161
00162 int NICtoPC(struct device *dev,void *packet,int length,int nic_addr);
00163 int PCtoNIC(struct device *dev,void *packet,int length);
00164
00165 struct nicBuffer *ne2kAllocBuffer(int);
00166 struct nicBuffer *ne2kGetBuffer();
00167 void ne2kFreeBuffer(struct nicBuffer *);
00168
00169 #endif
00170
00171
00172
00173
00174