fresh commit

This commit is contained in:
Marcin Bzdulski committed 2026-11-02 13:12:04 +01:00
commit e68c1ec8c6
20 files changed
+5802

No files matched your search

Binary file not shown.
+340
View File
@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
+43
View File
@@ -0,0 +1,43 @@
; Installer for 3c589.device.
; Copyright © 2003 Neil Cafferkey.
; $VER: "Install 3c589.device" 1.2 (25.2.2004)
; Set constants
(set #kick-too-low-msg "Kickstart 2.05 or greater is required.")
(set #dev-name "3c589.device")
(set #devs-source "Devs/networks")
(set @default-dest "DEVS:networks")
(set #pccard-name "pccard.library")
(set #libs-source "Libs")
(set #libs-dest "LIBS:")
; Check Kickstart version
(if (< (/ (getversion) 65536) 37)
(abort #kick-too-low-msg)
)
; Install pccard.library
(copylib
(source (tackon #libs-source #pccard-name))
(dest #libs-dest)
; (newname #dev-name)
(help @copylib-help)
)
; Install device
(copylib
(source (tackon #devs-source #dev-name))
(dest @default-dest)
(help @copylib-help)
)
BIN
View File
Binary file not shown.
Binary file not shown.
+234
View File
@@ -0,0 +1,234 @@
@database "3c589.device Manual"
@$VER: "3c589.device Manual" 1.5 (4.2.2010)
@author "Neil Cafferkey"
@(c) "Neil Cafferkey"
Copyright (C) 2003-2010 Neil Cafferkey
This manual is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This manual is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this manual; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
@node "main" "3c589.device Manual"
@{b}@{u}3c589.device 1.5@{uu}@{ub} - A 3Com Etherlink III PC Card driver
@{"Introduction" link "intro"}
@{"Installation and Usage" link "install"}
@{"Performance" link "performance"}
@{"Author and Legal Information" link "author-legal"}
@{"History" link "history"}
@endnode
@node "intro" "Introduction"
@{u}@{b}Introduction@{ub}@{uu}
3c589.device is a SANA-II network driver for 3Com Etherlink III PC Cards.
These are sold by several companies under a variety of model names; see
below for (probable) compatibility. In short, 10 Mbps cards work; 100 Mbps
cards do not. Also note that the original 3C589 "A" revision (without any
extension letter) does not work.
The following ethernet and ethernet/modem cards should work:
@{u}@{b}Company@{uu} @{u}Model@{ub}@{uu}
@{b}3Com@{ub} 3C562
3C562B
3C562C
3C562D
3C563B
3C563C
3C563D
3C589B
3C589C
3C589D
3C589E
@{b}3Com Megahertz@{ub} 3C3FEM556C
3CCE589EC
3CCE589ET
3CCEM556
3CCEM556B
3CXE589D
3CXE589EC
3CXEM556
@{b}Farallon/Netopia@{ub} EtherMac/EtherWave PN595-TP
EtherMac/EtherWave PN595-C
@{b}Hitachi@{ub} HT-4840-13
@{b}Motorola@{ub} Marquis
@endnode
@node "install" "Installation and Usage"
@{u}@{b}Requirements@{ub}@{uu}
3c589.device needs an A600 or A1200 and OS 2.05 or greater.
@{u}@{b}Installation@{ub}@{uu}
To install 3c589.device, run the 'Install' script. In your networking
software, set the SANA-II device name to @{b}networks/3c589.device@{ub} and the
unit number to @{b}0@{ub}.
@{u}@{b}Cable types@{ub}@{uu}
Your Etherlink III card will have been programmed to use a certain cable
type. If you need to change this setting, I believe there is 3Com software
available for Windows to change this and other settings. Check their web
site.
In the future there may be a utility provided to change this setting on an
Amiga.
3c589.device has so far only been tested with @{"10baseT" link "cable"} cabling. @{"10base2" link "cable"}
cabling should also work. I'm not sure if there was ever an Etherlink III
PC Card with an AUI connection, but if there was, it should work.
@{u}@{b}Multifunction cards@{ub}@{uu}
Although 3c589.device works with some multifunction ethernet/modem cards,
only one of these functions can be used at a time. This is due to
limitations in AmigaOS's card.resource.
@{u}@{b}A1200 hardware bug@{ub}@{uu}
The A1200 (but not the A600) has a hardware bug which prevents a card being
reset except on insertion or removal. There are both hardware and software
remedies for this problem. The software solution is CardReset
(util/boot/CardReset.lha on Aminet). There are several different types of
hardware fixes, some of which are available commercially.
@{u}@{b}Problems@{ub}@{uu}
With some A1200 motherboards, hot insertion or removal of a 3c589-compatible
card may cause the system to reset.
Miami will cause the system to hang if the card is removed while online.
Re-insertion won't help.
@endnode
@node "performance" "Performance"
@{u}@{b}Performance@{ub}@{uu}
On a 40MHz 68030 system, the following FTP speeds have been achieved:
@{b}@{u}Upload@{uu} @{u}Download@{ub}@{uu}
@{i}kbytes/s kbytes/s@{ui}
@{b}AmiTCP 3.0b:@{ub} 407 497
@{b}Genesis:@{ub} 373 551
@{b}Miami 3.2b:@{ub} 191 279
There is no version of the device specially compiled for CPUs above the
68000, since there was no performance benefit.
@endnode
@node "author-legal" "Author and Legal Information"
@{u}@{b}Author and Legal Information@{ub}@{uu}
3c589.device was written by Neil Cafferkey.
Please send bug reports, suggestions, and any other correspondence to one of
the following addresses.
E-mail: caffer@cs.ucc.ie
Post: Neil Cafferkey,
30, Upper Kensington,
Rochestown,
Cork,
Ireland.
3c589.device and pccard.library are released under the terms of the
@{"GNU General Public Licence" link "GPL/MAIN"}. See the individual source files for copyright
information.
The full pccard.library archive, which includes the source code and
developer files, is available on Aminet as "util/libs/pccard.lha".
All trademarks are owned by their owners.
@endnode
@node "history" "History"
@{u}@{b}History@{ub}@{uu}
@{b}V1.5 (February 2010)@{ub}
- Fixed lock-up when closing device under AmigaOS 4.0.
@{b}V1.4 (March 2004)@{ub}
- Now works with 3C562D/3C563D (thanks to Francisco Miguel Guerrero García
for lending me one of these cards).
- Multicast and broadcast flags weren't set properly. Fixed.
- Fixed memory leak in initialisation code (thanks to Adam Markiewicz).
- Only the first packet read in any interrupt could be recognised as
an orphan. Fixed.
- Support for IEEE 802.3 frames.
- Fixed bug in media selection code.
- Removed request for information about Farallon and Motorola cards, since
it appears that they use the same manufacturer and product codes as the
official 3Com cards, and hence already work (thanks to Kjell Linden).
- Fixed a bug in handling transmission errors.
@{b}V1.3 (February 2003)@{ub}
- Added 4 to reported length of incoming raw packets to make ShapeShifter
and Fusion work (thanks to Marcin Ozdzinski).
- Fixed a buffer overrun.
@{b}V1.2 (January 2003)@{ub}
- Bug fix: couldn't handle more than 64kb of attribute address space,
causing some cards not to work (thanks to Tom Parker).
@{b}V1.1 (January 2003)@{ub}
- First release.
@endnode
@node "cable" "Cable Types"
10baseT: Twisted Pair (TP) cabling with RJ45 connectors.
10base2: Thin coaxial cable with BNC connectors.
@endnode
BIN
View File
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@
Short: Driver for 3Com PCMCIA network cards
Author: caffer@cs.ucc.ie (Neil Cafferkey)
Uploader: caffer@cs.ucc.ie (Neil Cafferkey)
Version: 1.5
Type: driver/net
Requires: A1200 or A600, compatible card
Architecture: m68k-amigaos >= 2.0.0
3c589.device is a SANA-II network driver for 3Com Etherlink III PC Cards
(PCMCIA cards). Note that not all 3Com cards work with this driver, and that
some compatible cards are rebranded by other manufacturers. See the
documentation in the archive for a list of compatible cards. In short,
10 Mbps cards work; 100 Mbps cards do not.
This package is released under the GNU General Public Licence.
Changes in this version:
- Fixed lock-up when closing device under AmigaOS 4.0.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+31
View File
@@ -0,0 +1,31 @@
# File: Makefile
CFLAGS = -msmall-code -O3 -ansi -Wall -Wno-uninitialized -Wno-parentheses
CC = gcc $(CFLAGS)
MAKEFILE = Makefile
LINKER = ld -e _Main -s
AMIGA_LIB = GG:lib/libamiga.a
C_LIB = GG:lib/libnix/libnix13.a
DEV_NAME = 3c589.device
OBJS = device.o unit.o request.o
HDRS = device.h
.c.o :
$(CC) -c $<
$(DEV_NAME): $(MAKEFILE) $(OBJS)
$(LINKER) $(OBJS) $(AMIGA_LIB) $(C_LIB) -o $(DEV_NAME)
Protect "$(DEV_NAME)" "-e"
$(OBJS): $(MAKEFILE) $(HDRS)
unit.o: etherlink3.h
install: $(DEV_NAME)
Copy CLONE "$(DEV_NAME)" "DEVS:networks/"
Flush "$(DEV_NAME)"
clean:
Delete "$(DEV_NAME)" "#?.o"
+27
View File
@@ -0,0 +1,27 @@
DESIGN NOTES:
- Type tracking has been implemented in an unusual way in order to make it
more suitable for multiple users. Each client that tracks a particular
packet type is given the impression that it is the only one doing so.
When a client begins tracking a packet type that is already being
tracked, the current packet statistics are recorded internally. These
initial statistics are then subtracted from the figures returned from
every S2_GETTYPESTATS call the client makes.
- The cards' 8-bit statistics registers appear to be unreadable using the
A1200's PCMCIA slot.
- S2_CopyToBuff32 functions are not used because the non-raw portion of
received packets is not 32-bit aligned.
TCP/IP STACK BUGS TO CONSIDER:
- Miami(DX) doesn't like requests being aborted upon S2_OFFLINE.
- MiamiDX's CopyFromBuff16/32 functions appear to be broken.
- Genesis calls S2_ONLINE before S2_CONFIGINTERFACE?
- When a device goes back online without Genesis's intervention, Genesis
displays the message "eth0 is online again" or similar, but keeps the
interface's indicator red and doesn't disable the "Online" button or
enable the "Offline" button.
+651
View File
@@ -0,0 +1,651 @@
/*
File: device.c
Author: Neil Cafferkey
Copyright (C) 2000-2010 Neil Cafferkey
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#include <exec/types.h>
#include <exec/resident.h>
#include <exec/errors.h>
#include <utility/utility.h>
#include "initializers.h"
#include <proto/exec.h>
#include <proto/alib.h>
#include <proto/utility.h>
#include "device.h"
#include "unit_protos.h"
#include "request_protos.h"
#define VERSION 1
#define REVISION 5
#define UNIT_COUNT 1
#define UTILITY_VERSION 36
#define PCCARD_VERSION 1
/* Private prototypes */
static struct DevBase *DevInit(struct DevBase *dev_base REG("d0"),
APTR seg_list REG("a0"),struct DevBase *base REG(BASE_REG));
static BYTE DevOpen(ULONG unit_no REG("d0"),
struct IOSana2Req *request REG("a1"),ULONG flags REG("d1"),
struct DevBase *base REG(BASE_REG));
static APTR DevClose(struct IOSana2Req *request REG("a1"),
struct DevBase *base REG(BASE_REG));
static APTR DevExpunge(struct DevBase *base REG(BASE_REG));
static APTR DevReserved();
static VOID DevBeginIO(struct IOSana2Req *request REG("a1"),
struct DevBase *base REG(BASE_REG));
static VOID DevAbortIO(struct IOSana2Req *request REG("a1"),
struct DevBase *base REG(BASE_REG));
VOID DeleteDevice(struct DevBase *base);
extern const APTR vectors[];
extern const APTR init_table[];
/* Return an error immediately if someone tries to run the device */
LONG Main()
{
return -1;
}
#define DEVICE_NAME "3c589.device"
const TEXT device_name[]=DEVICE_NAME;
static const TEXT version_string[]=DEVICE_NAME " 1.5 (3.2.2010)\n";
static const TEXT card_name[]=CARDRESNAME;
static const TEXT utility_name[]=UTILITYNAME;
static const TEXT pccard_name[]=PCCARDNAME;
static const TEXT timer_name[]=TIMERNAME;
const struct Resident device_rom_tag=
{
RTC_MATCHWORD,
(struct Resident *)&device_rom_tag,
(APTR)init_table,
RTF_AUTOINIT,
VERSION,
NT_DEVICE,
0,
(STRPTR)device_name,
(STRPTR)version_string,
(APTR)init_table
};
static const APTR vectors[]=
{
(APTR)DevOpen,
(APTR)DevClose,
(APTR)DevExpunge,
(APTR)DevReserved,
(APTR)DevBeginIO,
(APTR)DevAbortIO,
(APTR)-1
};
static const struct
{
SMALLINITBYTEDEF(type);
SMALLINITPINTDEF(name);
SMALLINITBYTEDEF(flags);
SMALLINITWORDDEF(version);
SMALLINITWORDDEF(revision);
SMALLINITPINTDEF(id_string);
INITENDDEF;
}
init_data=
{
SMALLINITBYTE(OFFSET(Node,ln_Type),NT_DEVICE),
SMALLINITPINT(OFFSET(Node,ln_Name),device_name),
SMALLINITBYTE(OFFSET(Library,lib_Flags),LIBF_SUMUSED|LIBF_CHANGED),
SMALLINITWORD(OFFSET(Library,lib_Version),VERSION),
SMALLINITWORD(OFFSET(Library,lib_Revision),REVISION),
SMALLINITPINT(OFFSET(Library,lib_IdString),version_string),
INITEND
};
static const APTR init_table[]=
{
(APTR)sizeof(struct DevBase),
(APTR)vectors,
(APTR)&init_data,
(APTR)DevInit
};
static const ULONG rx_tags[]=
{
S2_CopyToBuff,
S2_CopyToBuff16
};
static const ULONG tx_tags[]=
{
S2_CopyFromBuff,
S2_CopyFromBuff16,
S2_CopyFromBuff32
};
/****i* 3c589.device/DevInit ***********************************************
*
* NAME
* DevInit -- .
*
* SYNOPSIS
* dev_base = DevInit(dev_base,seg_list)
*
* struct DevBase *DevInit(struct DevBase *,APTR);
*
* FUNCTION
*
* INPUTS
*
* RESULT
*
* EXAMPLE
*
* NOTES
*
* BUGS
*
* SEE ALSO
*
****************************************************************************
*
*/
static struct DevBase *DevInit(struct DevBase *dev_base REG("d0"),
APTR seg_list REG("a0"),struct DevBase *base REG(BASE_REG))
{
BOOL success=TRUE;
dev_base->sys_base=(APTR)base;
base=dev_base;
base->seg_list=seg_list;
base->card_base=OpenResource(card_name);
base->utility_base=(APTR)OpenLibrary(utility_name,UTILITY_VERSION);
base->pccard_base=OpenLibrary(pccard_name,PCCARD_VERSION);
if((base->card_base==NULL)||(base->utility_base==NULL)||
(base->pccard_base==NULL))
success=FALSE;
if(OpenDevice(timer_name,UNIT_VBLANK,(APTR)&base->timer_request,0)!=0)
success=FALSE;
NewList((APTR)(&dev_base->units));
if(!success)
{
DeleteDevice(base);
base=NULL;
}
return base;
}
/****i* 3c589.device/DevOpen ***********************************************
*
* NAME
* DevOpen -- .
*
* SYNOPSIS
* error = DevOpen(unit_num,request,flags)
*
* BYTE DevOpen(ULONG,struct IOSana2Req *,ULONG);
*
* FUNCTION
*
* INPUTS
*
* RESULT
*
* EXAMPLE
*
* NOTES
*
* BUGS
*
* SEE ALSO
*
****************************************************************************
*
*/
static BYTE DevOpen(ULONG unit_num REG("d0"),
struct IOSana2Req *request REG("a1"),ULONG flags REG("d1"),
struct DevBase *base REG(BASE_REG))
{
struct DevUnit *unit;
BYTE error=0;
struct Opener *opener;
struct TagItem *tag_list;
UWORD i;
base->device.dd_Library.lib_OpenCnt++;
base->device.dd_Library.lib_Flags&=~LIBF_DELEXP;
request->ios2_Req.io_Unit=NULL;
tag_list=request->ios2_BufferManagement;
request->ios2_BufferManagement=NULL;
/* Check request size and unit number */
if((request->ios2_Req.io_Message.mn_Length<sizeof(struct IOSana2Req))
||(unit_num>=UNIT_COUNT))
error=IOERR_OPENFAIL;
/* Get the requested unit */
if(error==0)
{
request->ios2_Req.io_Unit=(APTR)unit=GetUnit(unit_num,base);
if(unit==NULL)
error=IOERR_OPENFAIL;
}
/* Handle device sharing */
if(error==0)
{
if((unit->open_count!=0)&&(((unit->flags&UNITF_SHARED)==0)||
((flags&SANA2OPF_MINE)!=0)))
error=IOERR_UNITBUSY;
unit->open_count++;
}
if(error==0)
{
if((flags&SANA2OPF_MINE)==0)
unit->flags|=UNITF_SHARED;
else if((flags&SANA2OPF_PROM)!=0)
unit->flags|=UNITF_PROM;
/* Set up buffer-management structure and get hooks */
request->ios2_BufferManagement=opener=
AllocVec(sizeof(struct Opener),MEMF_PUBLIC);
if(opener==NULL)
error=IOERR_OPENFAIL;
}
if(error==0)
{
NewList(&opener->read_port.mp_MsgList);
opener->read_port.mp_Flags=PA_IGNORE;
NewList((APTR)&opener->initial_stats);
for(i=0;i<2;i++)
opener->rx_function=(APTR)GetTagData(rx_tags[i],
(UPINT)opener->rx_function,tag_list);
for(i=0;i<3;i++)
opener->tx_function=(APTR)GetTagData(tx_tags[i],
(UPINT)opener->tx_function,tag_list);
opener->filter_hook=(APTR)GetTagData(S2_PacketFilter,NULL,tag_list);
opener->dma_tx_function=
(APTR)GetTagData(S2_DMACopyFromBuff32,NULL,tag_list);
Disable();
AddTail((APTR)&unit->openers,(APTR)opener);
Enable();
}
/* Back out if anything went wrong */
if(error!=0)
DevClose(request,base);
/* Return */
request->ios2_Req.io_Error=error;
return error;
}
/****i* 3c589.device/DevClose **********************************************
*
* NAME
* DevClose -- .
*
* SYNOPSIS
* seg_list = DevClose(request)
*
* APTR DevClose(struct IOSana2Req *);
*
* FUNCTION
*
* INPUTS
*
* RESULT
*
* EXAMPLE
*
* NOTES
*
* BUGS
*
* SEE ALSO
*
****************************************************************************
*
*/
static APTR DevClose(struct IOSana2Req *request REG("a1"),
struct DevBase *base REG(BASE_REG))
{
struct DevUnit *unit;
APTR seg_list;
struct Opener *opener;
/* Free buffer-management resources */
opener=(APTR)request->ios2_BufferManagement;
if(opener!=NULL)
{
Disable();
Remove((APTR)opener);
Enable();
FreeVec(opener);
}
/* Delete the unit if it's no longer in use */
unit=(APTR)request->ios2_Req.io_Unit;
if(unit!=NULL)
{
if((--unit->open_count)==0)
{
Remove((APTR)unit);
DeleteUnit(unit,base);
}
}
/* Expunge the device if a delayed expunge is pending */
seg_list=NULL;
if((--base->device.dd_Library.lib_OpenCnt)==0)
{
if((base->device.dd_Library.lib_Flags&LIBF_DELEXP)!=0)
seg_list=DevExpunge(base);
}
return seg_list;
}
/****i* 3c589.device/DevExpunge ********************************************
*
* NAME
* DevExpunge -- .
*
* SYNOPSIS
* seg_list = DevExpunge()
*
* APTR DevExpunge(VOID);
*
* FUNCTION
*
* INPUTS
*
* RESULT
*
* EXAMPLE
*
* NOTES
*
* BUGS
*
* SEE ALSO
*
****************************************************************************
*
*/
static APTR DevExpunge(struct DevBase *base REG(BASE_REG))
{
APTR seg_list;
if(base->device.dd_Library.lib_OpenCnt==0)
{
seg_list=base->seg_list;
Remove((APTR)base);
DeleteDevice(base);
}
else
{
base->device.dd_Library.lib_Flags|=LIBF_DELEXP;
seg_list=NULL;
}
return seg_list;
}
/****i* 3c589.device/DevReserved *******************************************
*
* NAME
* DevReserved -- .
*
* SYNOPSIS
* result = DevReserved()
*
* APTR DevReserved(VOID);
*
* FUNCTION
*
* INPUTS
*
* RESULT
*
* EXAMPLE
*
* NOTES
*
* BUGS
*
* SEE ALSO
*
****************************************************************************
*
*/
static APTR DevReserved()
{
return NULL;
}
/****i* 3c589.device/DevBeginIO ********************************************
*
* NAME
* DevBeginIO -- .
*
* SYNOPSIS
* DevBeginIO(request)
*
* VOID DevBeginIO(struct IORequest *);
*
* FUNCTION
*
* INPUTS
*
* RESULT
*
* EXAMPLE
*
* NOTES
*
* BUGS
*
* SEE ALSO
*
****************************************************************************
*
*/
static VOID DevBeginIO(struct IOSana2Req *request REG("a1"),
struct DevBase *base REG(BASE_REG))
{
struct DevUnit *unit;
request->ios2_Req.io_Error=0;
unit=(APTR)request->ios2_Req.io_Unit;
if(AttemptSemaphore(&unit->access_lock))
ServiceRequest(request,base);
else
{
PutRequest(unit->request_ports[GENERAL_QUEUE],(APTR)request,base);
}
return;
}
/****i* 3c589.device/DevAbortIO ********************************************
*
* NAME
* DevAbortIO -- Try to stop a request.
*
* SYNOPSIS
* DevAbortIO(request)
*
* VOID DevAbortIO(struct IOSana2Req *);
*
* FUNCTION
* Do our best to halt the progress of a request.
*
* INPUTS
*
* RESULT
*
* EXAMPLE
*
* NOTES
*
* BUGS
*
* SEE ALSO
*
****************************************************************************
*
* Disable() used instead of a semaphore because device uses interrupts.
*
*/
static VOID DevAbortIO(struct IOSana2Req *request REG("a1"),
struct DevBase *base REG(BASE_REG))
{
struct DevUnit *unit;
unit=(APTR)request->ios2_Req.io_Unit;
Disable();
if((request->ios2_Req.io_Message.mn_Node.ln_Type==NT_MESSAGE)
&&((request->ios2_Req.io_Flags&IOF_QUICK)==0))
{
Remove((APTR)request);
request->ios2_Req.io_Error=IOERR_ABORTED;
request->ios2_WireError=S2WERR_GENERIC_ERROR;
ReplyMsg((APTR)request);
}
Enable();
return;
}
/****i* 3c589.device/DeleteDevice ******************************************
*
* NAME
* DeleteDevice -- .
*
* SYNOPSIS
* DeleteDevice()
*
* VOID DeleteDevice(VOID);
*
* FUNCTION
*
* INPUTS
*
* RESULT
*
* EXAMPLE
*
* NOTES
*
* BUGS
*
* SEE ALSO
*
****************************************************************************
*
*/
VOID DeleteDevice(struct DevBase *base)
{
UWORD neg_size,pos_size;
/* Close devices */
CloseDevice((APTR)&base->timer_request);
/* Close libraries */
if(base->pccard_base!=NULL)
CloseLibrary(base->pccard_base);
if(base->utility_base!=NULL)
CloseLibrary((APTR)base->utility_base);
/* Free device's memory */
neg_size=base->device.dd_Library.lib_NegSize;
pos_size=base->device.dd_Library.lib_PosSize;
FreeMem((UBYTE *)base-neg_size,pos_size+neg_size);
return;
}
+257
View File
@@ -0,0 +1,257 @@
/*
Copyright (C) 2001-2004 Neil Cafferkey
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#ifndef DEVICE_H
#define DEVICE_H
#include <exec/types.h>
#include <exec/devices.h>
#include <exec/interrupts.h>
#include <exec/semaphores.h>
#include <devices/sana2.h>
#include <devices/sana2specialstats.h>
#include <resources/card.h>
#include <libraries/pccard.h>
#include <devices/timer.h>
#ifndef UPINT
typedef ULONG UPINT;
typedef LONG PINT;
#endif
#ifdef __mc68000
#define REG(A) __asm(A)
#else
#define REG(A)
#endif
#define USE_HACKS
struct DevBase
{
struct Device device;
APTR seg_list;
struct ExecBase *sys_base;
APTR card_base;
struct UtilityBase *utility_base;
struct Library *pccard_base;
struct MinList units;
struct timerequest timer_request;
};
enum
{
WRITE_QUEUE,
ADOPT_QUEUE,
EVENT_QUEUE,
GENERAL_QUEUE,
REQUEST_QUEUE_COUNT
};
#define ADDRESS_SIZE 6
#define HEADER_SIZE 14
#define PREAMBLE_SIZE 4
#define PACKET_DEST 0
#define PACKET_SOURCE 6
#define PACKET_TYPE 12
#define PACKET_DATA 14
#define MTU 1500
#define MAX_PACKET_SIZE ((HEADER_SIZE)+(MTU))
#define STAT_COUNT 3
struct DevUnit
{
struct MinNode node;
ULONG unit_num;
ULONG open_count;
UWORD flags;
UWORD transceiver;
struct Task *task;
struct MsgPort *request_ports[REQUEST_QUEUE_COUNT];
struct DevBase *device;
struct CardHandle *card_handle;
UBYTE *tuple_buffer;
UBYTE *rx_buffer;
UBYTE *tx_buffer;
volatile UBYTE *config_base;
volatile UBYTE *io_base;
ULONG card_removed_signal;
ULONG card_inserted_signal;
ULONG range_count;
UBYTE address[ADDRESS_SIZE];
UBYTE default_address[ADDRESS_SIZE];
struct MinList openers;
struct MinList type_trackers;
struct MinList multicast_ranges;
struct Interrupt rx_int;
struct Interrupt tx_int;
struct Sana2DeviceStats stats;
ULONG special_stats[STAT_COUNT];
struct SignalSemaphore access_lock;
UWORD rx_filter_cmd;
};
struct Opener
{
struct MinNode node;
struct MsgPort read_port;
BOOL (*rx_function)(APTR REG("a0"),APTR REG("a1"),ULONG REG("d0"));
BOOL (*tx_function)(APTR REG("a0"),APTR REG("a1"),ULONG REG("d0"));
ULONG *(*dma_tx_function)(APTR REG("a0"));
struct Hook *filter_hook;
struct MinList initial_stats;
};
struct TypeStats
{
struct MinNode node;
ULONG packet_type;
struct Sana2PacketTypeStats stats;
};
struct TypeTracker
{
struct MinNode node;
ULONG packet_type;
struct Sana2PacketTypeStats stats;
ULONG user_count;
};
struct AddressRange
{
struct MinNode node;
ULONG add_count;
ULONG lower_bound_left;
ULONG upper_bound_left;
UWORD lower_bound_right;
UWORD upper_bound_right;
};
/* Unit flags */
#define UNITF_SHARED (1<<0)
#define UNITF_ONLINE (1<<1)
#define UNITF_HAVECARD (1<<2)
#define UNITF_HAVEADAPTER (1<<3)
#define UNITF_CONFIGURED (1<<4)
#define UNITF_PROM (1<<5)
#define UNITF_ROADRUNNER (1<<6)
IMPORT const TEXT device_name[];
#define HANDLE_PRIORITY 10
#define S2_3C589_WRITEEEPROM 0x998f
/* Endianness macros */
#define BEWord(A)\
(A)
#define MakeBEWord(A)\
BEWord(A)
#define LEWord(A)\
({\
UWORD _LEWord_A=(A);\
_LEWord_A=((_LEWord_A)<<8)|((_LEWord_A)>>8);\
})
#define MakeLEWord(A)\
LEWord(A)
#define BELong(A)\
(A)
#define LELong(A)\
({\
ULONG _LELong_A=(A);\
_LELong_A=(LEWord(_LELong_A)<<16)|LEWord((_LELong_A)>>16);\
})
#define MakeLELong(A)\
LELong(A)
/* I/O macros */
#define ByteIn(address)\
(*((volatile UBYTE *)(address)))
#define ByteOut(address,value)\
*((volatile UBYTE *)(address))=(value)
#define WordIn(address)\
(*((volatile UWORD *)(address)))
#define WordOut(address,value)\
*((volatile UWORD *)(address))=(value)
#define LongIn(address)\
(*((volatile ULONG *)(address)))
#define LongOut(address,value)\
*((volatile ULONG *)(address))=(value)
#define LEWordIn(address)\
LEWord(WordIn(address))
#define LEWordOut(address,value)\
WordOut(address,MakeLEWord(value))
#define LELongIn(address)\
LELong(LongIn(address))
#define LELongOut(address,value)\
LongOut(address,MakeLELong(value))
#define BEWordOut(address,value)\
WordOut(address,MakeBEWord(value))
/* Library and device bases */
#define SysBase (base->sys_base)
#define CardResource (base->card_base)
#define UtilityBase (base->utility_base)
#define PCCardBase (base->pccard_base)
#define TimerBase (base->timer_request.tr_node.io_Device)
#ifndef BASE_REG
#define BASE_REG "a6"
#endif
/*register APTR base asm(BASE_REG);*/
#endif
+320
View File
@@ -0,0 +1,320 @@
/*
Copyright (C) 2002 Neil Cafferkey
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#ifndef ETHERLINK3_H
#define ETHERLINK3_H
/* Registers */
/* ========= */
/* All Windows */
#define EL3REG_COMMAND 14
#define EL3REG_STATUS 14
/* Window 0 */
#define EL3REG_MAKERID 0
#define EL3REG_PRODUCTID 2
#define EL3REG_ADAPTERID 2
#define EL3REG_CONFIG 4
#define EL3REG_ADDRCONFIG 6
#define EL3REG_RESCONFIG 8 /* also in window 3 */
#define EL3REG_EEPROMCMD 10 /* window 2 has alternative version */
#define EL3REG_EEPROMDATA 12
/* Window 1 */
#define EL3REG_DATA0 0
#define EL3REG_DATA1 2
#define EL3REG_RXSTATUS 8
#define EL3REG_TIMER 10
#define EL3REG_TXSTATUS 11
#define EL3REG_TXSPACE 12 /* also in window 3 */
/* Window 2 */
#define EL3REG_ADDRESS0 0
#define EL3REG_ADDRESS1 1
#define EL3REG_ADDRESS2 2
#define EL3REG_ADDRESS3 3
#define EL3REG_ADDRESS4 4
#define EL3REG_ADDRESS5 5
#define EL3REG_SRAMDIAG 6
#define EL3REG_MULTIFUNCCONFIG 8
#define EL3REG_ALTEEPROMCMD 10
/* Window 3 */
#define EL3REG_ROMCONTROL 4
#define EL3REG_TXRECLAIM 6
#define EL3REG_RXSPACE 10
/* Window 4 */
#define EL3REG_FIFODIAG 4
#define EL3REG_NETDIAG 6
#define EL3REG_CONTROLLERSTATUS 8
#define EL3REG_MEDIA 10
/* Window 5 */
#define EL3REG_TXSTARTTHRESH 0
#define EL3REG_TXAVAILTHRESH 2
#define EL3REG_RXEARLYTHRESH 6
#define EL3REG_RXFILTER 8
#define EL3REG_INTMASK 10
#define EL3REG_READZEROMASK 12
/* (Some) EEPROM data offsets */
/* ========================== */
#define EL3EEPROM_ADDRESS0 0
#define EL3EEPROM_ADDRESS1 1
#define EL3EEPROM_ADDRESS2 2
#define EL3EEPROM_PRODUCTID 3
#define EL3EEPROM_MANFDATA0 4
#define EL3EEPROM_MANFDATA1 5
#define EL3EEPROM_MANFDATA2 6
#define EL3EEPROM_MAKERID 7
#define EL3EEPROM_ADDRCONFIG 8
#define EL3EEPROM_RESCONFIG 9
#define EL3EEPROM_ALTADDRESS0 10
#define EL3EEPROM_ALTADDRESS1 11
#define EL3EEPROM_ALTADDRESS2 12
#define EL3EEPROM_SOFTWAREINFO 13
#define EL3EEPROM_COMPATIBILITY 14
#define EL3EEPROM_CHECKSUM 15
/* EEPROM commands */
/* =============== */
#define EL3ECMD_WRITEDISABLE (0x0<<4)
#define EL3ECMD_WRITEALL (0x1<<4)
#define EL3ECMD_ERASEALL (0x2<<4)
#define EL3ECMD_WRITEENABLE (0x3<<4)
#define EL3ECMD_WRITE (0x4<<4)
#define EL3ECMD_READ (0x8<<4)
#define EL3ECMD_ERASE (0xc<<4)
/* Commands */
/* ======== */
#define EL3CMD_GLOBALRESET (0<<11)
#define EL3CMD_SELECTWINDOW (1<<11)
#define EL3CMD_STARTCOAX (2<<11)
#define EL3CMD_RXDISABLE (3<<11)
#define EL3CMD_RXENABLE (4<<11)
#define EL3CMD_RXRESET (5<<11)
#define EL3CMD_RXDISCARD (8<<11)
#define EL3CMD_TXENABLE (9<<11)
#define EL3CMD_TXDISABLE (10<<11)
#define EL3CMD_TXRESET (11<<11)
#define EL3CMD_REQINT (12<<11)
#define EL3CMD_ACKINT (13<<11)
#define EL3CMD_SETINTMASK (14<<11)
#define EL3CMD_SETZEROMASK (15<<11)
#define EL3CMD_SETRXFILTER (16<<11)
#define EL3CMD_SETRXTHRESH (17<<11)
#define EL3CMD_SETTXTHRESH (18<<11)
#define EL3CMD_SETTXSTART (19<<11)
#define EL3CMD_STATSENABLE (21<<11)
#define EL3CMD_STATSDISABLE (22<<11)
#define EL3CMD_STOPCOAX (23<<11)
#define EL3CMD_POWERUP (27<<11)
#define EL3CMD_POWERDOWN (28<<11)
#define EL3CMD_POWERAUTO (29<<11)
/* Interrupt types */
/* =============== */
#define EL3INTB_UPDATESTATS 7
#define EL3INTB_REQINT 6
#define EL3INTB_RXEARLY 5
#define EL3INTB_RXCOMPLETE 4
#define EL3INTB_TXAVAIL 3
#define EL3INTB_TXCOMPLETE 2
#define EL3INTB_FAILURE 1
#define EL3INTB_ANY 0
#define EL3INTF_UPDATESTATS (1<<EL3INTB_UPDATESTATS)
#define EL3INTF_REQINT (1<<EL3INTB_REQINT)
#define EL3INTF_RXEARLY (1<<EL3INTB_RXEARLY)
#define EL3INTF_RXCOMPLETE (1<<EL3INTB_RXCOMPLETE)
#define EL3INTF_TXAVAIL (1<<EL3INTB_TXAVAIL)
#define EL3INTF_TXCOMPLETE (1<<EL3INTB_TXCOMPLETE)
#define EL3INTF_FAILURE (1<<EL3INTB_FAILURE)
#define EL3INTF_ANY (1<<EL3INTB_ANY)
/* Register Details */
/* ================ */
/* Configuration Control Register */
#define EL3REG_CONFIGB_NOTPCCARD 14
#define EL3REG_CONFIGB_HASAUI 13
#define EL3REG_CONFIGB_HASCOAX 12
#define EL3REG_CONFIGB_HASTP 9
#define EL3REG_CONFIGB_USEINTERNAL 8
#define EL3REG_CONFIGB_RESET 2
#define EL3REG_CONFIGB_ENABLE 0
#define EL3REG_CONFIGF_NOTPCCARD (1<<EL3REG_CONFIGB_NOTPCCARD)
#define EL3REG_CONFIGF_HASAUI (1<<EL3REG_CONFIGB_HASAUI)
#define EL3REG_CONFIGF_HASCOAX (1<<EL3REG_CONFIGB_HASCOAX)
#define EL3REG_CONFIGF_HASTP (1<<EL3REG_CONFIGB_HASTP)
#define EL3REG_CONFIGF_USEINTERNAL (1<<EL3REG_CONFIGB_USEINTERNAL)
#define EL3REG_CONFIGF_RESET (1<<EL3REG_CONFIGB_RESET)
#define EL3REG_CONFIGF_ENABLE (1<<EL3REG_CONFIGB_ENABLE)
/* Address Configuration Register */
#define EL3REG_ADDRCONFIGB_AUTOSELECT 7
#define EL3REG_ADDRCONFIGF_AUTOSELECT (1<<EL3REG_ADDRCONFIGB_AUTOSELECT)
#define EL3REG_ADDRCONFIG_XCVRMASK 0xc000
#define EL3REG_ADDRCONFIG_XCVRTP (0<<14)
#define EL3REG_ADDRCONFIG_XCVRAUI (1<<14)
#define EL3REG_ADDRCONFIG_XCVRCOAX (3<<14)
/* Status Register */
#define EL3REG_STATUSB_CMDINPROGRESS 12
#define EL3REG_STATUSF_CMDINPROGRESS (1<<EL3REG_STATUSB_CMDINPROGRESS)
#define EL3REG_STATUS_WINDOWMASK 0xe0
/* EEPROM Command Register */
#define EL3REG_EEPROMCMDB_BUSY 15
#define EL3REG_EEPROMCMDF_BUSY (1<<EL3REG_EEPROMCMDB_BUSY)
/* RX Status Register */
#define EL3REG_RXSTATUSB_INCOMPLETE 15
#define EL3REG_RXSTATUSB_ERROR 14
#define EL3REG_RXSTATUSF_INCOMPLETE (1<<EL3REG_RXSTATUSB_INCOMPLETE)
#define EL3REG_RXSTATUSF_ERROR (1<<EL3REG_RXSTATUSB_ERROR)
#define EL3REG_RXSTATUS_ERRORMASK 0x3800
#define EL3REG_RXSTATUS_SIZEMASK 0x07ff
/* TX Status Register */
#define EL3REG_TXSTATUSB_COMPLETE 7
#define EL3REG_TXSTATUSB_ONSUCCESS 6
#define EL3REG_TXSTATUSB_JABBER 5
#define EL3REG_TXSTATUSB_UNDERRUN 4
#define EL3REG_TXSTATUSB_MAXCOLLISIONS 3
#define EL3REG_TXSTATUSB_OVERFLOW 2
#define EL3REG_TXSTATUSF_COMPLETE (1<<EL3REG_TXSTATUSB_COMPLETE)
#define EL3REG_TXSTATUSF_ONSUCCESS (1<<EL3REG_TXSTATUSB_ONSUCCESS)
#define EL3REG_TXSTATUSF_JABBER (1<<EL3REG_TXSTATUSB_JABBER)
#define EL3REG_TXSTATUSF_UNDERRUN (1<<EL3REG_TXSTATUSB_UNDERRUN)
#define EL3REG_TXSTATUSF_MAXCOLLISIONS (1<<EL3REG_TXSTATUSB_MAXCOLLISIONS)
#define EL3REG_TXSTATUSF_OVERFLOW (1<<EL3REG_TXSTATUSB_OVERFLOW)
/* Net Diagnostic Port Register */
#define EL3REG_NETDIAGB_EXTERNALLOOP 15
#define EL3REG_NETDIAGB_ENDECLOOP 14
#define EL3REG_NETDIAGB_CONTROLLERLOOP 13
#define EL3REG_NETDIAGB_FIFOLOOP 12
#define EL3REG_NETDIAGB_TXON 11
#define EL3REG_NETDIAGB_RXON 10
#define EL3REG_NETDIAGB_TXING 9
#define EL3REG_NETDIAGB_NEEDTXRESET 8
#define EL3REG_NETDIAGB_STATSON 7
#define EL3REG_NETDIAGB_TESTLVD 0
#define EL3REG_NETDIAGF_EXTERNALLOOP (1<<EL3REG_NETDIAGB_EXTERNALLOOP)
#define EL3REG_NETDIAGF_ENDECLOOP (1<<EL3REG_NETDIAGB_ENDECLOOP)
#define EL3REG_NETDIAGF_CONTROLLERLOOP (1<<EL3REG_NETDIAGB_CONTROLLERLOOP)
#define EL3REG_NETDIAGF_FIFOLOOP (1<<EL3REG_NETDIAGB_FIFOLOOP)
#define EL3REG_NETDIAGF_TXON (1<<EL3REG_NETDIAGB_TXON)
#define EL3REG_NETDIAGF_RXON (1<<EL3REG_NETDIAGB_RXON)
#define EL3REG_NETDIAGF_TXING (1<<EL3REG_NETDIAGB_TXING)
#define EL3REG_NETDIAGF_NEEDTXRESET (1<<EL3REG_NETDIAGB_NEEDTXRESET)
#define EL3REG_NETDIAGF_STATSON (1<<EL3REG_NETDIAGB_STATSON)
#define EL3REG_NETDIAGF_TESTLVD (1<<EL3REG_NETDIAGB_TESTLVD)
#define EL3REG_NETDIAG_REVMASK 0x3e
/* Media Type and Status Register */
#define EL3REG_MEDIAB_TP 15
#define EL3REG_MEDIAB_COAX 14
#define EL3REG_MEDIAB_SQE 12
#define EL3REG_MEDIAB_BEAT 11
#define EL3REG_MEDIAB_POLEREV 10
#define EL3REG_MEDIAB_JABBER 9
#define EL3REG_MEDIAB_UNSQUELCH 8
#define EL3REG_MEDIAB_BEATENABLE 7
#define EL3REG_MEDIAB_JABBERENABLE 6
#define EL3REG_MEDIAB_CRS 5
#define EL3REG_MEDIAB_COLLISION 4
#define EL3REG_MEDIAB_SQESTATSENABLE 3
#define EL3REG_MEDIAB_CRCSTRIPDISABLE 2
#define EL3REG_MEDIAB_LINKLIGHT 0
#define EL3REG_MEDIAF_TP (1<<EL3REG_MEDIAB_TP)
#define EL3REG_MEDIAF_COAX (1<<EL3REG_MEDIAB_COAX)
#define EL3REG_MEDIAF_SQE (1<<EL3REG_MEDIAB_SQE)
#define EL3REG_MEDIAF_BEAT (1<<EL3REG_MEDIAB_BEAT)
#define EL3REG_MEDIAF_POLEREV (1<<EL3REG_MEDIAB_POLEREV)
#define EL3REG_MEDIAF_JABBER (1<<EL3REG_MEDIAB_JABBER)
#define EL3REG_MEDIAF_UNSQUELCH (1<<EL3REG_MEDIAB_UNSQUELCH)
#define EL3REG_MEDIAF_BEATENABLE (1<<EL3REG_MEDIAB_BEATENABLE)
#define EL3REG_MEDIAF_JABBERENABLE (1<<EL3REG_MEDIAB_JABBERENABLE)
#define EL3REG_MEDIAF_CRS (1<<EL3REG_MEDIAB_CRS)
#define EL3REG_MEDIAF_COLLISION (1<<EL3REG_MEDIAB_COLLISION)
#define EL3REG_MEDIAF_SQESTATSENABLE (1<<EL3REG_MEDIAB_SQESTATSENABLE)
#define EL3REG_MEDIAF_CRCSTRIPDISABLE (1<<EL3REG_MEDIAB_CRCSTRIPDISABLE)
#define EL3REG_MEDIAF_LINKLIGHT (1<<EL3REG_MEDIAB_LINKLIGHT)
/* Command parameters */
/* ================== */
#define EL3CMD_SETRXFILTERB_UCAST 0
#define EL3CMD_SETRXFILTERB_MCAST 1
#define EL3CMD_SETRXFILTERB_BCAST 2
#define EL3CMD_SETRXFILTERB_PROM 3
#define EL3CMD_SETRXFILTERF_UCAST (1<<EL3CMD_SETRXFILTERB_UCAST)
#define EL3CMD_SETRXFILTERF_MCAST (1<<EL3CMD_SETRXFILTERB_MCAST)
#define EL3CMD_SETRXFILTERF_BCAST (1<<EL3CMD_SETRXFILTERB_BCAST)
#define EL3CMD_SETRXFILTERF_PROM (1<<EL3CMD_SETRXFILTERB_PROM)
#endif
+105
View File
@@ -0,0 +1,105 @@
/*
$VER: initializers.h 41.4 (21.11.2003)
Copyright (C) 2000-2003 Neil Cafferkey
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this file; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#ifndef EXEC_INITIALIZERS_H
#define EXEC_INITIALIZERS_H
#include <exec/types.h>
/* Use the OFFSET macro as the offset parameter of one of the other
macros */
/*
#ifdef OFFSET
#undef OFFSET
#endif
*/
#define OFFSET(struct_name, struct_field) \
((ULONG)(&(((struct struct_name *)0)->struct_field)))
/* Use the following macros in the structure definition */
#define INITBYTEDEF(name) \
UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
UBYTE name ## _o3; UBYTE name ## _v; UBYTE name ## _p
#define INITWORDDEF(name) \
UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
UWORD name ## _v
#define INITLONGDEF(name) \
UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
ULONG name ## _v
#define INITPINTDEF(name) \
UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
UPINT name ## _v
#define SMALLINITBYTEDEF(name) \
UBYTE name ## _c; UBYTE name ## _o; UBYTE name ## _v; UBYTE name ## _p
#define SMALLINITWORDDEF(name) \
UBYTE name ## _c; UBYTE name ## _o; UWORD name ## _v
#define SMALLINITLONGDEF(name) \
UBYTE name ## _c; UBYTE name ## _o; ULONG name ## _v
#define SMALLINITPINTDEF(name) \
UBYTE name ## _c; UBYTE name ## _o; UPINT name ## _v
#define INITENDDEF UBYTE the_end
/* Use the following macros to fill in a structure */
#define NEWINITBYTE(offset, value) \
0xe0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
(UBYTE)(value), 0
#define NEWINITWORD(offset, value) \
0xd0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
(UWORD)(value)
#define NEWINITLONG(offset, value) \
0xc0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
(ULONG)(value)
#define INITPINT(offset, value) \
0xc0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
(UPINT)(value)
#define SMALLINITBYTE(offset, value) \
0xa0, (offset), (UBYTE)(value), 0
#define SMALLINITWORD(offset, value) \
0x90, (offset), (UWORD)(value)
#define SMALLINITLONG(offset, value) \
0x80, (offset), (ULONG)(value)
#define SMALLINITPINT(offset, value) \
0x80, (offset), (UPINT)(value)
#define INITEND 0
/* Obsolete definitions */
#define INITBYTE(offset, value) \
(0xe000 | ((UWORD)(offset) >> 16)), \
(UWORD)(offset), (UWORD)((value) << 8)
#define INITWORD(offset, value) \
(0xd000 | ((UWORD)(offset) >> 16)), (UWORD)(offset), (UWORD)(value)
#define INITLONG(offset, value) \
(0xc000 | ((UWORD)(offset) >> 16)), (UWORD)(offset), \
(UWORD)((value) >> 16), (UWORD)(value)
#define INITAPTR(offset, value) \
(0xc000 | ((UWORD)(offset) >> 16)), (UWORD)(offset), \
(UWORD)((ULONG)(value) >> 16), (UWORD)(value)
#endif
+1523
View File
File diff suppressed because it is too large. Load diff
+36
View File
@@ -0,0 +1,36 @@
/*
File: request_protos.h
Author: Neil Cafferkey
Copyright (C) 2002 Neil Cafferkey
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#ifndef REQUEST_PROTOS_H
#define REQUEST_PROTOS_H
#include "device.h"
VOID ServiceRequest(struct IOSana2Req *request,struct DevBase *base);
VOID PutRequest(struct MsgPort *port,struct IORequest *request,
struct DevBase *base);
#endif
+2166
View File
File diff suppressed because it is too large. Load diff
+49
View File
@@ -0,0 +1,49 @@
/*
File: unit_protos.h
Author: Neil Cafferkey
Copyright (C) 2002 Neil Cafferkey
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
*/
#ifndef UNIT_PROTOS_H
#define UNIT_PROTOS_H
#include "device.h"
struct DevUnit *GetUnit(ULONG unit_num,struct DevBase *base);
struct DevUnit *FindUnit(ULONG unit_num,struct DevBase *base);
struct DevUnit *CreateUnit(ULONG unit_num,struct DevBase *base);
VOID DeleteUnit(struct DevUnit *unit,struct DevBase *base);
VOID ConfigureAdapter(struct DevUnit *unit,struct DevBase *base);
VOID GoOnline(struct DevUnit *unit,struct DevBase *base);
VOID GoOffline(struct DevUnit *unit,struct DevBase *base);
BOOL AddMulticastRange(struct DevUnit *unit,UBYTE *lower_bound,
UBYTE *upper_bound,struct DevBase *base);
BOOL RemMulticastRange(struct DevUnit *unit,UBYTE *lower_bound,
UBYTE *upper_bound,struct DevBase *base);
struct TypeStats *FindTypeStats(struct DevUnit *unit,struct MinList *list,
ULONG packet_type,struct DevBase *base);
VOID FlushUnit(struct DevUnit *unit,UBYTE last_queue,BYTE error,
struct DevBase *base);
#endif