3 Copyright (C) 2001-2012 Neil Cafferkey
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston,
26 #include <exec/types.h>
27 #include <exec/devices.h>
28 #include <exec/interrupts.h>
29 #include <exec/semaphores.h>
30 #include <devices/sana2.h>
31 #include <devices/sana2specialstats.h>
32 #include <devices/timer.h>
38 #define DEVICE_NAME "intelpro100.device"
41 #define DATE "12.6.2012"
43 #define UTILITY_VERSION 39
44 #define PROMETHEUS_VERSION 2
45 #define POWERPCI_VERSION 2
46 #define EXPANSION_VERSION 50
47 #define OPENPCI_VERSION 1
60 #if defined(__mc68000) && !defined(__AROS__)
61 #define _REG(A, B) B __asm(#A)
62 #define REG(A, B) _REG(A, B)
69 #define STR(A) _STR(A)
80 struct ExecBase
*sys_base
;
81 struct UtilityBase
*utility_base
;
82 struct Library
*prometheus_base
;
83 struct Library
*powerpci_base
;
84 struct Library
*openpci_base
;
85 struct MinList pci_units
;
86 struct timerequest timer_request
;
88 struct Library
*expansion_base
;
89 struct ExecIFace
*i_exec
;
90 struct UtilityIFace
*i_utility
;
91 struct PCIIFace
*i_pci
;
92 struct TimerIFace
*i_timer
;
94 VOID (*wrapper_int_code
)();
122 #define IO_WINDOW_SIZE 0x40
124 #define ETH_ADDRESSSIZE 6
125 #define ETH_HEADERSIZE 14
127 #define ETH_MAXPACKETSIZE ((ETH_HEADERSIZE) + (ETH_MTU))
129 #define ETH_PACKET_DEST 0
130 #define ETH_PACKET_SOURCE 6
131 #define ETH_PACKET_TYPE 12
132 #define ETH_PACKET_IEEELEN 12
133 #define ETH_PACKET_SNAPTYPE 20
134 #define ETH_PACKET_DATA 14
136 #define SPECIAL_STAT_COUNT 3
138 #define TX_SLOT_COUNT 10
139 #define RX_SLOT_COUNT 10
141 (sizeof(ULONG) * (PROCB_EXTBUFFER + PRO_FRAGLEN * 2) \
142 + ((ETH_HEADERSIZE + 3) & ~3))
144 (sizeof(ULONG) * PROCB_BUFFER + ((ETH_MAXPACKETSIZE + 3) & ~3))
154 struct MsgPort
*request_ports
[REQUEST_QUEUE_COUNT
];
155 struct DevBase
*device
;
157 ULONG (*ByteIn
)(APTR
, UBYTE
);
158 VOID (*ByteOut
)(APTR
, ULONG
, UBYTE
);
159 UWORD (*LEWordIn
)(APTR
, ULONG
);
160 ULONG (*LELongIn
)(APTR
, ULONG
);
161 VOID (*LEWordOut
)(APTR
, ULONG
, UWORD
);
162 VOID (*LELongOut
)(APTR
, ULONG
, ULONG
);
163 APTR (*AllocDMAMem
)(APTR
, UPINT
, UWORD
);
164 VOID (*FreeDMAMem
)(APTR
, APTR
);
166 UBYTE address
[ETH_ADDRESSSIZE
];
167 UBYTE default_address
[ETH_ADDRESSSIZE
];
168 struct MinList openers
;
169 struct MinList type_trackers
;
170 struct MinList multicast_ranges
;
171 struct MinList tx_requests
;
172 struct Interrupt status_int
;
173 struct Interrupt rx_int
;
174 struct Interrupt tx_int
;
175 struct Interrupt tx_end_int
;
176 struct Sana2DeviceStats stats
;
178 ULONG special_stats
[SPECIAL_STAT_COUNT
];
187 struct SignalSemaphore access_lock
;
190 UWORD eeprom_addr_size
;
197 struct MsgPort read_port
;
198 BOOL (*rx_function
)(REG(a0
, APTR
), REG(a1
, APTR
), REG(d0
, ULONG
));
199 BOOL (*tx_function
)(REG(a0
, APTR
), REG(a1
, APTR
), REG(d0
, ULONG
));
200 UBYTE
*(*dma_tx_function
)(REG(a0
, APTR
));
201 struct Hook
*filter_hook
;
202 struct MinList initial_stats
;
203 #if defined(__amigaos4__) || defined(__MORPHOS__) || defined(__AROS__)
204 const VOID
*real_rx_function
;
205 const VOID
*real_tx_function
;
206 const VOID
*real_dma_tx_function
;
215 struct Sana2PacketTypeStats stats
;
223 struct Sana2PacketTypeStats stats
;
232 ULONG lower_bound_left
;
233 ULONG upper_bound_left
;
234 UWORD lower_bound_right
;
235 UWORD upper_bound_right
;
241 #define UNITF_SHARED (1 << 0)
242 #define UNITF_ONLINE (1 << 1)
243 #define UNITF_ALLMCAST (1 << 2)
244 #define UNITF_HAVEADAPTER (1 << 3)
245 #define UNITF_CONFIGURED (1 << 4)
246 #define UNITF_PROM (1 << 5)
247 #define UNITF_WASONLINE (1 << 6) /* card was online at time of removal */
248 #define UNITF_TXBUFFERINUSE (1 << 7)
249 #define UNITF_MCASTBUFFERINUSE (1 << 8)
252 /* Library and device bases */
254 #define SysBase (base->sys_base)
255 #define UtilityBase (base->utility_base)
256 #define ExpansionBase (base->expansion_base)
257 #define OpenPciBase (base->openpci_base)
258 #define PrometheusBase (base->prometheus_base)
259 #define PowerPCIBase (base->powerpci_base)
260 #define TimerBase (base->timer_request.tr_node.io_Device)
263 #define IExec (base->i_exec)
264 #define IUtility (base->i_utility)
265 #define ITimer (base->i_timer)