1 #ifndef SANA2_SANA2DEVICE_H 2 #define SANA2_SANA2DEVICE_H 3 4 /* 5 SANA-II v3 driver definitions 6 7 Copyright © 2002-2005 The MorphOS Development Team, All Rights Reserved. 8 */ 9 10 11 #ifndef EXEC_TYPES_H 12 # include <exec/types.h> 13 #endif 14 15 #ifndef EXEC_PORTS_H 16 # include <exec/ports.h> 17 #endif 18 19 #ifndef EXEC_IO_H 20 # include <exec/io.h> 21 #endif 22 23 #ifndef EXEC_ERRORS_H 24 # include <exec/errors.h> 25 #endif 26 27 #ifndef DEVICES_TIMER_H 28 # include <devices/timer.h> 29 #endif 30 31 #ifndef UTILITY_TAGITEM_H 32 # include <utility/tagitem.h> 33 #endif 34 35 #pragma pack(2) 36 37 38 #define SANA2_MAX_ADDR_BITS (128) 39 #define SANA2_MAX_ADDR_BYTES ((SANA2_MAX_ADDR_BITS + 7) / 8) 40 41 struct IOSana2Req 42 { 43 struct IORequest ios2_Req; 44 ULONG ios2_WireError; 45 ULONG ios2_PacketType; 46 UBYTE ios2_SrcAddr[SANA2_MAX_ADDR_BYTES]; 47 UBYTE ios2_DstAddr[SANA2_MAX_ADDR_BYTES]; 48 ULONG ios2_DataLength; 49 APTR ios2_Data; 50 APTR ios2_StatData; 51 APTR ios2_BufferManagement; 52 }; 53 54 55 /* 56 * io_Flags defines 57 */ 58 #define SANA2IOB_RAW (7) 59 #define SANA2IOF_RAW (1<<SANA2IOB_RAW) 60 61 #define SANA2IOB_BCAST (6) 62 #define SANA2IOF_BCAST (1<<SANA2IOB_BCAST) 63 64 #define SANA2IOB_MCAST (5) 65 #define SANA2IOF_MCAST (1<<SANA2IOB_MCAST) 66 67 #define SANA2IOB_QUICK (IOB_QUICK) 68 #define SANA2IOF_QUICK (IOF_QUICK) 69 70 71 /* 72 * OpenDevice() flags 73 */ 74 #define SANA2OPB_MINE (0) 75 #define SANA2OPF_MINE (1<<SANA2OPB_MINE) 76 77 #define SANA2OPB_PROM (1) 78 #define SANA2OPF_PROM (1<<SANA2OPB_PROM) 79 80 81 /* 82 * OpenDevice()'s tags 83 */ 84 #define S2_Dummy (TAG_USER+0xB0000) 85 86 #define S2_CopyToBuff (S2_Dummy+1) 87 #define S2_CopyFromBuff (S2_Dummy+2) 88 #define S2_PacketFilter (S2_Dummy+3) 89 #define S2_CopyToBuff16 (S2_Dummy+4) 90 #define S2_CopyFromBuff16 (S2_Dummy+5) 91 #define S2_CopyToBuff32 (S2_Dummy+6) 92 #define S2_CopyFromBuff32 (S2_Dummy+7) 93 #define S2_DMACopyToBuff32 (S2_Dummy+8) 94 #define S2_DMACopyFromBuff32 (S2_Dummy+9) 95 96 struct Sana2DeviceQuery 97 { 98 ULONG SizeAvailable; 99 ULONG SizeSupplied; 100 ULONG DevQueryFormat; 101 ULONG DeviceLevel; 102 UWORD AddrFieldSize; 103 ULONG MTU; 104 ULONG BPS; 105 ULONG HardwareType; 106 }; 107 108 /* 109 * SANA2 extension - not supported by all SANA2 devices 110 */ 111 112 #define SANA2QFMT_LINKEXT 0x4C494E4B 113 114 struct LinkExtSana2DeviceQuery 115 { 116 ULONG SizeAvailable; 117 ULONG SizeSupplied; 118 ULONG DevQueryFormat; /* Must be set to SANA2QFMT_LINKEXT */ 119 ULONG DeviceLevel; 120 UWORD AddrFieldSize; 121 ULONG MTU; 122 ULONG BPS; 123 ULONG HardwareType; 124 125 /* 126 ** New fields for DevQueryFormat SANA2QFMT_LINKEXT. Remember to check SizeSupplied! 127 ** Not all drivers will report all these fields, and the SizeSupplied will indicate 128 ** which fields are available. 129 */ 130 ULONG LinkFlags; /* Link status flags. You must ignore unknown bits */ 131 }; 132 133 /* 134 * LinkFlags defines 135 */ 136 #define SANA2LNKB_LINKUP (0) /* If set hw link is up else down */ 137 138 #define SANA2LNKF_LINKUP (1<<SANA2LNKB_LINKUP) 139 140 141 #define S2WireType_Ethernet 1 142 #define S2WireType_IEEE802 6 143 #define S2WireType_Arcnet 7 144 #define S2WireType_LocalTalk 11 145 #define S2WireType_DyLAN 12 146 #define S2WireType_AmokNet 200 147 #define S2WireType_Liana 202 148 #define S2WireType_PPP 253 149 #define S2WireType_SLIP 254 150 #define S2WireType_CSLIP 255 151 #define S2WireType_PLIP 420 152 153 struct Sana2PacketTypeStats 154 { 155 ULONG PacketsSent; 156 ULONG PacketsReceived; 157 ULONG BytesSent; 158 ULONG BytesReceived; 159 ULONG PacketsDropped; 160 }; 161 162 struct Sana2SpecialStatRecord 163 { 164 ULONG Type; 165 ULONG Count; 166 char *String; 167 }; 168 169 struct Sana2SpecialStatHeader 170 { 171 ULONG RecordCountMax; 172 ULONG RecordCountSupplied; 173 /* 174 * struct Sana2SpecialStatRecord[RecordCountMax]; 175 */ 176 }; 177 178 struct Sana2DeviceStats 179 { 180 ULONG PacketsReceived; 181 ULONG PacketsSent; 182 ULONG BadData; 183 ULONG Overruns; 184 ULONG Unused; 185 ULONG UnknownTypesReceived; 186 ULONG Reconfigurations; 187 struct TimeVal LastStart; 188 }; 189 190 #define S2_START (CMD_NONSTD) 191 192 #define S2_DEVICEQUERY (S2_START+0) 193 #define S2_GETSTATIONADDRESS (S2_START+1) 194 #define S2_CONFIGINTERFACE (S2_START+2) 195 #define S2_ADDMULTICASTADDRESS (S2_START+5) 196 #define S2_DELMULTICASTADDRESS (S2_START+6) 197 #define S2_MULTICAST (S2_START+7) 198 #define S2_BROADCAST (S2_START+8) 199 #define S2_TRACKTYPE (S2_START+9) 200 #define S2_UNTRACKTYPE (S2_START+10) 201 #define S2_GETTYPESTATS (S2_START+11) 202 #define S2_GETSPECIALSTATS (S2_START+12) 203 #define S2_GETGLOBALSTATS (S2_START+13) 204 #define S2_ONEVENT (S2_START+14) 205 #define S2_READORPHAN (S2_START+15) 206 #define S2_ONLINE (S2_START+16) 207 #define S2_OFFLINE (S2_START+17) 208 209 #define S2_END (S2_START+18) 210 211 #ifndef NSCMD_DEVICEQUERY 212 #define NSCMD_DEVICEQUERY 0x4000 213 #endif 214 #define S2_ADDMULTICASTADDRESSES 0xc000 215 #define S2_DELMULTICASTADDRESSES 0xc001 216 217 218 #define S2ERR_NO_ERROR 0 219 #define S2ERR_NO_RESOURCES 1 220 #define S2ERR_BAD_ARGUMENT 3 221 #define S2ERR_BAD_STATE 4 222 #define S2ERR_BAD_ADDRESS 5 223 #define S2ERR_MTU_EXCEEDED 6 224 #define S2ERR_NOT_SUPPORTED 8 225 #define S2ERR_SOFTWARE 9 226 #define S2ERR_OUTOFSERVICE 10 227 #define S2ERR_TX_FAILURE 11 228 229 /* 230 * ios2_WireError error defines 231 */ 232 #define S2WERR_GENERIC_ERROR 0 233 #define S2WERR_NOT_CONFIGURED 1 234 #define S2WERR_UNIT_ONLINE 2 235 #define S2WERR_UNIT_OFFLINE 3 236 #define S2WERR_ALREADY_TRACKED 4 237 #define S2WERR_NOT_TRACKED 5 238 #define S2WERR_BUFF_ERROR 6 239 #define S2WERR_SRC_ADDRESS 7 240 #define S2WERR_DST_ADDRESS 8 241 #define S2WERR_BAD_BROADCAST 9 242 #define S2WERR_BAD_MULTICAST 10 243 #define S2WERR_MULTICAST_FULL 11 244 #define S2WERR_BAD_EVENT 12 245 #define S2WERR_BAD_STATDATA 13 246 #define S2WERR_IS_CONFIGURED 15 247 #define S2WERR_NULL_POINTER 16 248 #define S2WERR_TOO_MANY_RETIRES 17 249 #define S2WERR_RCVREL_HDW_ERR 18 250 251 252 #define S2EVENT_ERROR (1<<0) 253 #define S2EVENT_TX (1<<1) 254 #define S2EVENT_RX (1<<2) 255 #define S2EVENT_ONLINE (1<<3) 256 #define S2EVENT_OFFLINE (1<<4) 257 #define S2EVENT_BUFF (1<<5) 258 #define S2EVENT_HARDWARE (1<<6) 259 #define S2EVENT_SOFTWARE (1<<7) 260 261 #define S2EVENT_CONNECT (1 << 9) 262 #define S2EVENT_DISCONNECT (1 << 10) 263 264 /* 265 * SANA2 extension - not supported by all SANA2 devices 266 */ 267 #define S2EVENT_LINKUP (1<<16) 268 #define S2EVENT_LINKDOWN (1<<17) 269 270 #pragma pack() 271 272 #endif /* SANA2_SANA2DEVICE_H */