]> git.sesse.net Git - pistorm/blob - a314/software-amiga/ethernet_pistorm/sana2.h
Adapt a314eth to work on PiStorm + A314 emulation
[pistorm] / a314 / software-amiga / ethernet_pistorm / sana2.h
1 #ifndef SANA2_SANA2DEVICE_H
2 #define SANA2_SANA2DEVICE_H 1
3 /*
4 **      $Filename: devices/sana2.h $
5 **      $Revision: 4.1 $
6 **      $Date: 1994/10/03 20:55:10 $
7 **
8 **      Structure definitions for SANA-II devices.
9 **
10 **      (C) Copyright 1991 Commodore-Amiga Inc.
11 **              All Rights Reserved
12 */
13
14
15 #ifndef EXEC_TYPES_H
16 #include <exec/types.h>
17 #endif
18
19 #ifndef EXEC_PORTS_H
20 #include <exec/ports.h>
21 #endif
22
23 #ifndef EXEC_IO_H
24 #include <exec/io.h>
25 #endif
26
27 #ifndef EXEC_ERRORS_H
28 #include <exec/errors.h>
29 #endif
30
31 #ifndef DEVICES_TIMER_H
32 #include <devices/timer.h>
33 #endif
34
35 #ifndef UTILITY_TAGITEM_H
36 #include "tagitem.h"
37 #endif
38
39
40 #define SANA2_MAX_ADDR_BITS     (128)
41 #define SANA2_MAX_ADDR_BYTES    ((SANA2_MAX_ADDR_BITS+7)/8)
42
43 struct IOSana2Req
44 {
45         struct IORequest ios2_Req;
46         ULONG ios2_WireError;           /* wire type specific error     */
47         ULONG ios2_PacketType;          /* packet type                  */
48         UBYTE ios2_SrcAddr[SANA2_MAX_ADDR_BYTES];       /* source addr  */
49         UBYTE ios2_DstAddr[SANA2_MAX_ADDR_BYTES];       /* dest address */
50         ULONG ios2_DataLength;          /* length of packet data        */
51         VOID *ios2_Data;                /* packet data                  */
52         VOID *ios2_StatData;            /* statistics data pointer      */
53         VOID *ios2_BufferManagement;    /* see SANA-II OpenDevice adoc  */
54 };
55
56
57 /*
58 ** defines for the io_Flags field
59 */
60 #define SANA2IOB_RAW    (7)             /* raw packet IO requested      */
61 #define SANA2IOF_RAW    (1<<SANA2IOB_RAW)
62
63 #define SANA2IOB_BCAST  (6)             /* broadcast packet (received)  */
64 #define SANA2IOF_BCAST  (1<<SANA2IOB_BCAST)
65
66 #define SANA2IOB_MCAST  (5)             /* multicast packet (received)  */
67 #define SANA2IOF_MCAST  (1<<SANA2IOB_MCAST)
68
69 #define SANA2IOB_QUICK  (IOB_QUICK)     /* quick IO requested (0)       */
70 #define SANA2IOF_QUICK  (IOF_QUICK)
71
72
73 /*
74 ** defines for OpenDevice() flags
75 */
76 #define SANA2OPB_MINE   (0)             /* exclusive access requested   */
77 #define SANA2OPF_MINE   (1<<SANA2OPB_MINE)
78
79 #define SANA2OPB_PROM   (1)             /* promiscuous mode requested   */
80 #define SANA2OPF_PROM   (1<<SANA2OPB_PROM)
81
82
83 /*
84 ** defines for OpenDevice() tags
85 */
86 #define S2_Dummy        (TAG_USER + 0xB0000)
87
88 #define S2_CopyToBuff   (S2_Dummy + 1)
89 #define S2_CopyFromBuff (S2_Dummy + 2)
90 #define S2_PacketFilter (S2_Dummy + 3)
91
92 struct Sana2DeviceQuery
93 {
94 /*
95 ** Standard information
96 */
97         ULONG   SizeAvailable;          /* bytes available              */
98         ULONG   SizeSupplied;           /* bytes supplied               */
99         ULONG   DevQueryFormat;         /* this is type 0               */
100         ULONG   DeviceLevel;            /* this document is level 0     */
101 /*
102 ** Common information
103 */
104         UWORD   AddrFieldSize;          /* address size in bits         */
105         ULONG   MTU;                    /* maximum packet data size     */
106         ULONG   BPS;                    /* line rate (bits/sec)         */
107         ULONG   HardwareType;           /* what the wire is             */
108 /*
109 ** Format specific information
110 */
111 };
112
113
114 /*
115 ** defined Hardware types
116 **
117 **  If your hardware type isn't listed below contact CATS to get a new
118 **  type number added for your hardware.
119 */
120 #define S2WireType_Ethernet             1
121 #define S2WireType_IEEE802              6
122 #define S2WireType_Arcnet               7
123 #define S2WireType_LocalTalk            11
124 #define S2WireType_DyLAN                12
125
126 #define S2WireType_AmokNet              200     /* Amiga Floppy Port hardware */
127
128 #define S2WireType_Liana                202     /* Villate Tronic parallel port hw */
129
130 #define S2WireType_PPP                  253
131 #define S2WireType_SLIP                 254
132 #define S2WireType_CSLIP                255     /* Compressed SLIP */
133
134 #define S2WireType_PLIP                 420     /* SLIP over a parallel port */
135
136 struct Sana2PacketTypeStats
137 {
138         ULONG PacketsSent;              /* transmitted count            */
139         ULONG PacketsReceived;          /* received count               */
140         ULONG BytesSent;                /* bytes transmitted count      */
141         ULONG BytesReceived;            /* bytes received count         */
142         ULONG PacketsDropped;           /* packets dropped count        */
143 };
144
145
146 struct Sana2SpecialStatRecord
147 {
148         ULONG Type;                     /* statistic identifier         */
149         ULONG Count;                    /* the statistic                */
150         char *String;                   /* statistic name               */
151 };
152
153
154 struct Sana2SpecialStatHeader
155 {
156         ULONG RecordCountMax;           /* room available               */
157         ULONG RecordCountSupplied;      /* number supplied              */
158         /* struct Sana2SpecialStatRecord[RecordCountMax]; */
159 };
160
161
162 struct Sana2DeviceStats
163 {
164         ULONG PacketsReceived;          /* received count               */
165         ULONG PacketsSent;              /* transmitted count            */
166         ULONG BadData;                  /* bad packets received         */
167         ULONG Overruns;                 /* hardware miss count          */
168         ULONG Unused;                   /* Unused field                 */
169         ULONG UnknownTypesReceived;     /* orphan count                 */
170         ULONG Reconfigurations;         /* network reconfigurations     */
171         struct timeval LastStart;       /* time of last online          */
172 };
173
174
175 /*
176 ** Device Commands
177 */
178 #define S2_START                (CMD_NONSTD)
179
180 #define S2_DEVICEQUERY          (S2_START+ 0)
181 #define S2_GETSTATIONADDRESS    (S2_START+ 1)
182 #define S2_CONFIGINTERFACE      (S2_START+ 2)
183 #define S2_ADDMULTICASTADDRESS  (S2_START+ 5)
184 #define S2_DELMULTICASTADDRESS  (S2_START+ 6)
185 #define S2_MULTICAST            (S2_START+ 7)
186 #define S2_BROADCAST            (S2_START+ 8)
187 #define S2_TRACKTYPE            (S2_START+ 9)
188 #define S2_UNTRACKTYPE          (S2_START+10)
189 #define S2_GETTYPESTATS         (S2_START+11)
190 #define S2_GETSPECIALSTATS      (S2_START+12)
191 #define S2_GETGLOBALSTATS       (S2_START+13)
192 #define S2_ONEVENT              (S2_START+14)
193 #define S2_READORPHAN           (S2_START+15)
194 #define S2_ONLINE               (S2_START+16)
195 #define S2_OFFLINE              (S2_START+17)
196
197 #define S2_END                  (S2_START+18)
198
199
200 /*
201 ** defined errors for io_Error  (see also <exec/errors.h>)
202 */
203 #define S2ERR_NO_ERROR          0       /* peachy-keen                  */
204 #define S2ERR_NO_RESOURCES      1       /* resource allocation failure  */
205 #define S2ERR_BAD_ARGUMENT      3       /* garbage somewhere            */
206 #define S2ERR_BAD_STATE         4       /* inappropriate state          */
207 #define S2ERR_BAD_ADDRESS       5       /* who?                         */
208 #define S2ERR_MTU_EXCEEDED      6       /* too much to chew             */
209 #define S2ERR_NOT_SUPPORTED     8       /* hardware can't support cmd   */
210 #define S2ERR_SOFTWARE          9       /* software error detected      */
211 #define S2ERR_OUTOFSERVICE      10      /* driver is OFFLINE            */
212 #define S2ERR_TX_FAILURE        11      /* Transmission attempt failed  */
213 /*
214 ** From <exec/errors.h>
215 **
216 **      IOERR_OPENFAIL   (-1) * device/unit failed to open *
217 **      IOERR_ABORTED    (-2) * request terminated early [after AbortIO()] *
218 **      IOERR_NOCMD      (-3) * command not supported by device *
219 **      IOERR_BADLENGTH  (-4) * not a valid length (usually IO_LENGTH) *
220 **      IOERR_BADADDRESS (-5) * invalid address (misaligned or bad range) *
221 **      IOERR_UNITBUSY   (-6) * device opens ok, but requested unit is busy *
222 **      IOERR_SELFTEST   (-7) * hardware failed self-test *
223 */
224
225 /*
226 ** defined errors for ios2_WireError
227 */
228 #define S2WERR_GENERIC_ERROR    0       /* no specific info available   */
229 #define S2WERR_NOT_CONFIGURED   1       /* unit not configured          */
230 #define S2WERR_UNIT_ONLINE      2       /* unit is currently online     */
231 #define S2WERR_UNIT_OFFLINE     3       /* unit is currently offline    */
232 #define S2WERR_ALREADY_TRACKED  4       /* protocol already tracked     */
233 #define S2WERR_NOT_TRACKED      5       /* protocol not tracked         */
234 #define S2WERR_BUFF_ERROR       6       /* buff mgt func returned error */
235 #define S2WERR_SRC_ADDRESS      7       /* source address problem       */
236 #define S2WERR_DST_ADDRESS      8       /* destination address problem  */
237 #define S2WERR_BAD_BROADCAST    9       /* broadcast address problem    */
238 #define S2WERR_BAD_MULTICAST    10      /* multicast address problem    */
239 #define S2WERR_MULTICAST_FULL   11      /* multicast address list full  */
240 #define S2WERR_BAD_EVENT        12      /* unsupported event class      */
241 #define S2WERR_BAD_STATDATA     13      /* statdata failed sanity check */
242 #define S2WERR_IS_CONFIGURED    15      /* attempt to config twice      */
243 #define S2WERR_NULL_POINTER     16      /* null pointer detected        */
244 #define S2WERR_TOO_MANY_RETIRES 17      /* tx failed - too many retries */
245 #define S2WERR_RCVREL_HDW_ERR   18      /* Driver fixable HW error      */
246
247
248 /*
249 ** defined events
250 */
251 #define S2EVENT_ERROR           (1L<<0) /* error catch all              */
252 #define S2EVENT_TX              (1L<<1) /* transmitter error catch all  */
253 #define S2EVENT_RX              (1L<<2) /* receiver error catch all     */
254 #define S2EVENT_ONLINE          (1L<<3) /* unit is in service           */
255 #define S2EVENT_OFFLINE         (1L<<4) /* unit is not in service       */
256 #define S2EVENT_BUFF            (1L<<5) /* buff mgt function error      */
257 #define S2EVENT_HARDWARE        (1L<<6) /* hardware error catch all     */
258 #define S2EVENT_SOFTWARE        (1L<<7) /* software error catch all     */
259
260
261 #endif  /* SANA2_SANA2DEVICE_H */