Short: SANA-II driver for Vampire V2 ENC28J60 Author: v2eth@amigaworld.de (Matthias Muench) Uploader: v2eth amigaworld de (Matthias Muench) Type: driver/net Version: 1.0 Requires: Vampire V2 card with ENC28J60 module, SANA-II TCP/IP stack Architecture: m68k-amigaos >= 3.0.0 Distribution: Aminet v2eth.device is a SANA-II network driver for the ENC28J60 Ethernet module that plugs into the expansion port of the Vampire V2 accelerator cards (V500 V2+, V600 V2, V1200 V2). It is a drop-in replacement for v2expeth.device: the same hardware, the same MAC address and the same configuration keywords. It was written from scratch in C, with a focus on robustness, low latency and throughput, and works with any SANA-II stack such as Roadshow, Miami, AmiTCP or Genesis. FEATURES -------- - Interrupt mode that really works: the module IRQ wakes the driver directly, a timer is only used as a fallback. Round-trip time for small frames is around 0.64 ms on a V1200 V2 - Double-buffered transmit: while one frame is on the wire, the next one is already transferred to the chip - Sends and receives close to the limit of 10 Mbit/s Ethernet: 9.1 Mbit/s (send) and 8.7 Mbit/s (receive) payload with full-size frames - Correct handling of the ENC28J60 receive ring and its errata, including the read pointer wrap-around and the CS hold time of the MAC/MII registers - Watchdog: detects a stuck chip or a receive overflow and recovers automatically. A module that stops answering is re-probed every 5 s; pending writes fail at once instead of blocking the system - Retransmits frames lost to false late collisions (ENC28J60 errata), counted in S2_GETSPECIALSTATS - No busy waiting when nobody reads: frames stay in the chip until the stack asks for them, the CPU is left to other tasks - 32-bit aligned payload, so the stack's CopyToBuff32 and CopyFromBuff32 functions are used - Clean start and stop of the driver task; Close and Expunge never wait under Forbid() - MAC address derived exactly like v2expeth.device does, so DHCP reservations stay valid - Configuration file may contain several lines and comments - Full SANA-II support: events, packet type statistics, multicast ranges, orphan reads, online/offline, NSCMD_DEVICEQUERY REQUIREMENTS ------------ - Vampire V2 accelerator (V500 V2+, V600 V2 or V1200 V2) - ENC28J60 Ethernet module on the Vampire expansion port - AmigaOS 3.0 or higher - SANA-II TCP/IP stack (Roadshow, Miami, AmiTCP, Genesis) Successfully tested on a Vampire V1200 V2. INSTALLATION ------------ Recommended: open the archive, double-click the "Install" icon in the v2eth/ drawer and follow the AmigaOS Installer (English or German). It copies the driver to DEVS:Networks/ and, if you like, the configuration and the Roadshow interface file. Manual install: 1. Copy Devs/Networks/v2eth.device to DEVS:Networks/ 2. Copy Env/SANA2/v2eth.config to ENV:SANA2/ and ENVARC:SANA2/ (optional, see CONFIGURATION). 3. Roadshow: copy Storage/NetInterfaces/V2Eth to DEVS:NetInterfaces/ or change the device line of your existing interface file: device=v2eth.device unit=0 configure=dhcp Other stacks: select DEVS:Networks/v2eth.device, unit 0. 4. Remove or disable the interface that uses v2expeth.device. Both drivers claim the expansion port through vampire.resource; while one of them is open, the other one cannot be opened (nothing breaks, the open simply fails). 5. Reboot or restart the network. CONFIGURATION ------------- The driver reads ENV:SANA2/v2eth.config. If that file does not exist, ENV:SANA2/v2expeth.config is used, so an existing setup keeps working. Keywords may be spread over several lines. Lines starting with ; or # are comments. INTERRUPT Use the module interrupt. Recommended. (off) TIMER=us Poll interval in microseconds, 1000..1000000. Default 4000, or 50000 with INTERRUPT (then the timer is only a fallback). PRIORITY=n Priority of the driver task, -120..120. (5) SPISPEED=n SPI clock divider 1..127, smaller is faster. (2) FULLDUPLEX Full duplex. Only if the switch port is forced to 10 Mbit/s full duplex as well! (off) MULTICAST Accept all multicast frames. (off) MTU=n MTU, 64..1500. (1500) BPS=n Speed reported to the stack. (10000000) NOWATCHDOG Debugging only: no periodic chip check. (off) NOSPECIALSTATS Accepted for compatibility, no effect. Recommended configuration: INTERRUPT TIMER=20000 The ENC28J60 errata recommend an SPI clock of at least 8 MHz, so use large SPISPEED values for debugging only. MEASUREMENTS ------------ Vampire V1200 V2, SPISPEED 2, INTERRUPT TIMER=20000, 10 Mbit/s half duplex. SANA-II benchmark against a Linux host: v2eth.device 1.0 v2expeth.device 2.7 TX 1514 byte 758 frames/s, 9.1 Mbit/s 424 frames/s, 5.2 Mbit/s RX 1514 byte 727 frames/s, 8.7 Mbit/s mostly lost under flood Round trip 60 byte 0.64 ms average Real TCP download with Roadshow and AGet to RAM: about 900 KB/s with both drivers. That is the practical limit of 10 Mbit/s half duplex Ethernet, so downloads are not faster than with v2expeth.device. The differences are the send rate (uploads), the much shorter latency with INTERRUPT and the fixed bugs listed above. The Vampire drives the SPI bus by programmed I/O, about 0.8 us per byte. At full load the CPU is busy with the transfer, so about 10 Mbit/s is the practical limit of this port, no matter which module is connected. TROUBLESHOOTING --------------- If OpenDevice() fails, the driver stores the reason in ios2_WireError of the failed request: 1 unit number is not 0 2 I/O request too small 3 already opened exclusively by another program 4 out of memory 5 stack did not pass CopyToBuff/CopyFromBuff 6 driver task could not be created 10 no free signals 11 timer.device could not be opened 12 buffers could not be allocated 13 expansion port in use (v2expeth.device still open?) 14 no ENC28J60 answers on the expansion port CHANGELOG --------- 1.0 (30 September 2026) - Initial release. BUILD INFORMATION ----------------- Version: 1.0 Binary size: ~16 KB (stripped) Source code: ~3,290 lines (C + H) Compiler: m68k-amiga-elf-gcc 15.1 + elf2hunk Target CPU: m68020+ LICENSE ------- v2eth.device is freeware. You may use, copy and redistribute the unmodified archive freely, as long as no money is charged beyond the cost of the medium. Redistribution on Aminet and Aminet CD-ROMs is explicitly permitted. The software is provided "as is", without warranty of any kind. The author is not liable for any damage or data loss resulting from the use of this software. CONTACT ------- E-mail: lumiv2eth@amigaworld.de Web: https://www.amigaworld.de/ CREDITS ------- Author Matthias Münch Concept, implementation, testing Built with help from Claude Code (Anthropic) AI assistant for pair programming Special thanks Henryk Richter v2expeth.device - its analysis provided the information about the Vampire expansion port (SPI controller, vampire.resource) and the MAC address scheme. v2eth.device contains no code of v2expeth.device. Greetings Eisman, lokiist, Fossi, yelworC, cappin, Cego, McFly, LoneRaider, evil4dmin, jdb78 In Memoriam Psyria ================================================================ DEUTSCHE VERSION / GERMAN VERSION ================================================================ v2eth.device ist ein SANA-II-Netzwerktreiber für das ENC28J60-Ethernet-Modul am Expansion-Port der Vampire-V2- Beschleunigerkarten (V500 V2+, V600 V2, V1200 V2). Er ersetzt v2expeth.device direkt: gleiche Hardware, gleiche MAC-Adresse, gleiche Config-Keywords. Der Treiber ist komplett neu in C geschrieben, mit Schwerpunkt auf Robustheit, kurzer Antwortzeit und Durchsatz, und funktioniert mit jedem SANA-II-Stack wie Roadshow, Miami, AmiTCP oder Genesis. FUNKTIONEN ---------- - Interrupt-Betrieb, der wirklich funktioniert: Der Modul-IRQ weckt den Treiber direkt, ein Timer dient nur als Rückfallebene. Antwortzeit für kleine Frames rund 0,64 ms auf einer V1200 V2 - Doppelt gepuffertes Senden: Während ein Frame auf der Leitung ist, wird der nächste bereits in den Chip übertragen - Senden und Empfangen nahe an der Grenze von 10-Mbit-Ethernet: 9,1 Mbit/s (Senden) und 8,7 Mbit/s (Empfang) Nutzdaten mit vollen Frames - Korrekte Behandlung des ENC28J60-Empfangsrings und seiner Errata, einschließlich Lesezeiger-Umbruch und CS-Haltezeit der MAC/MII-Register - Watchdog: erkennt einen hängenden Chip oder einen Empfangsüberlauf und stellt den Betrieb selbst wieder her. Antwortet das Modul nicht mehr, prüft der Treiber alle 5 s erneut; wartende Sendeaufträge schlagen sofort fehl, statt das System zu blockieren - Sendet Frames erneut, die durch fälschlich gemeldete späte Kollisionen verloren gingen (ENC28J60-Errata), gezählt in S2_GETSPECIALSTATS - Kein Dauerabfragen, wenn niemand liest: Frames bleiben im Chip, bis der Stack sie anfordert, die CPU bleibt frei - Nutzdaten auf 32 Bit ausgerichtet, daher nutzt der Stack CopyToBuff32 und CopyFromBuff32 - Sauberes Starten und Beenden des Treiber-Tasks; Close und Expunge warten nie unter Forbid() - MAC-Adresse wird genau wie bei v2expeth.device gebildet, DHCP-Reservierungen bleiben also gültig - Konfigurationsdatei darf mehrere Zeilen und Kommentare enthalten - Vollständige SANA-II-Unterstützung: Events, Pakettyp- Statistiken, Multicast-Bereiche, Orphan-Reads, Online/Offline, NSCMD_DEVICEQUERY SYSTEMVORAUSSETZUNGEN --------------------- - Vampire-V2-Beschleuniger (V500 V2+, V600 V2 oder V1200 V2) - ENC28J60-Ethernet-Modul am Expansion-Port der Vampire - AmigaOS 3.0 oder höher - SANA-II-TCP/IP-Stack (Roadshow, Miami, AmiTCP, Genesis) Erfolgreich getestet auf einer Vampire V1200 V2. INSTALLATION ------------ Empfohlen: Archiv öffnen, im Verzeichnis v2eth/ auf "Install" doppelklicken und dem AmigaOS-Installer folgen (deutsche oder englische Sprache). Er kopiert den Treiber nach DEVS:Networks/ und auf Wunsch die Konfiguration und die Roadshow-Interface-Datei. Manuelle Installation: 1. Devs/Networks/v2eth.device nach DEVS:Networks/ kopieren. 2. Env/SANA2/v2eth.config nach ENV:SANA2/ und ENVARC:SANA2/ kopieren (optional, siehe KONFIGURATION). 3. Roadshow: Storage/NetInterfaces/V2Eth nach DEVS:NetInterfaces/ kopieren oder in der vorhandenen Interface-Datei die Device-Zeile ändern: device=v2eth.device unit=0 configure=dhcp Andere Stacks: DEVS:Networks/v2eth.device, Unit 0 eintragen. 4. Das Interface mit v2expeth.device entfernen oder abschalten. Beide Treiber belegen den Expansion-Port über vampire.resource. Solange einer offen ist, lässt sich der andere nicht öffnen (ohne Schaden, das Öffnen schlägt einfach fehl). 5. Neu starten bzw. das Netzwerk neu starten. KONFIGURATION ------------- Der Treiber liest ENV:SANA2/v2eth.config. Fehlt die Datei, wird ENV:SANA2/v2expeth.config verwendet, eine bestehende Einrichtung läuft also weiter. Die Keywords dürfen auf mehrere Zeilen verteilt sein. Zeilen, die mit ; oder # beginnen, sind Kommentare. INTERRUPT Modul-Interrupt nutzen. Empfohlen. (aus) TIMER=us Polling-Intervall in Mikrosekunden, 1000..1000000. Standard 4000, mit INTERRUPT 50000 (dann nur als Rückfallebene). PRIORITY=n Priorität des Treiber-Tasks, -120..120. (5) SPISPEED=n SPI-Teiler 1..127, kleiner ist schneller. (2) FULLDUPLEX Vollduplex. Nur wenn auch der Switch-Port fest auf 10 Mbit/s Vollduplex steht! (aus) MULTICAST Alle Multicast-Frames annehmen. (aus) MTU=n MTU, 64..1500. (1500) BPS=n Dem Stack gemeldete Geschwindigkeit. (10000000) NOWATCHDOG Nur zur Fehlersuche: keine Chip-Prüfung. (aus) NOSPECIALSTATS Wird akzeptiert, hat keine Wirkung. Empfohlene Einstellung: INTERRUPT TIMER=20000 Laut ENC28J60-Errata sollte der SPI-Takt mindestens 8 MHz betragen. Große SPISPEED-Werte also nur zur Fehlersuche verwenden. MESSWERTE --------- Vampire V1200 V2, SPISPEED 2, INTERRUPT TIMER=20000, 10 Mbit/s Halbduplex. SANA-II-Benchmark gegen einen Linux-Rechner: v2eth.device 1.0 v2expeth.device 2.7 Senden 1514 Byte 758 Frames/s, 9,1 Mbit/s 424 Frames/s, 5,2 Mbit/s Empfang 1514 Byte 727 Frames/s, 8,7 Mbit/s unter Flut meist verloren Antwortzeit 60 B 0,64 ms im Mittel Echter TCP-Download mit Roadshow und AGet nach RAM: rund 900 KB/s mit beiden Treibern. Das ist die praktische Grenze von 10-Mbit-Ethernet im Halbduplex, Downloads werden also nicht schneller als mit v2expeth.device. Die Unterschiede liegen beim Senden (Upload), bei der deutlich kürzeren Antwortzeit mit INTERRUPT und bei den behobenen Fehlern. Die Vampire bedient den SPI-Bus per Programm, etwa 0,8 us pro Byte. Unter Volllast ist die CPU mit der Übertragung beschäftigt. Rund 10 Mbit/s sind deshalb die praktische Grenze dieses Ports, egal welches Modul angeschlossen ist. FEHLERSUCHE ----------- Schlägt OpenDevice() fehl, legt der Treiber den Grund in ios2_WireError des Requests ab: 1 Unit-Nummer ist nicht 0 2 I/O-Request zu klein 3 bereits exklusiv von einem anderen Programm geöffnet 4 kein Speicher 5 Stack hat CopyToBuff/CopyFromBuff nicht übergeben 6 Treiber-Task konnte nicht gestartet werden 10 keine freien Signale 11 timer.device nicht verfügbar 12 Puffer konnten nicht angelegt werden 13 Expansion-Port belegt (v2expeth.device noch offen?) 14 kein ENC28J60 am Expansion-Port gefunden VERSIONSHISTORIE ---------------- 1.0 (30. September 2026) - Erstveröffentlichung. BUILD-INFORMATIONEN ------------------- Version: 1.0 Binary-Größe: ~16 KB (gestrippt) Quelltext: ~3.290 Zeilen (C + H) Compiler: m68k-amiga-elf-gcc 15.1 + elf2hunk Ziel-CPU: m68020+ LIZENZ ------ v2eth.device ist Freeware. Das unveränderte Archiv darf frei genutzt, kopiert und weitergegeben werden, solange dafür nicht mehr als die Kosten des Datenträgers verlangt werden. Eine Weitergabe über Aminet und Aminet-CDs ist ausdrücklich erlaubt. Die Software wird "wie sie ist" bereitgestellt, ohne jegliche Gewährleistung. Der Autor haftet nicht für Schäden oder Daten- verluste, die aus der Nutzung dieser Software entstehen. KONTAKT ------- E-Mail: lumiv2eth@amigaworld.de Web: https://www.amigaworld.de/ MITWIRKENDE ----------- Autor Matthias Münch Konzept, Umsetzung, Tests Unterstützt durch Claude Code (Anthropic) KI-Assistent für Pair-Programming Besonderer Dank Henryk Richter v2expeth.device - dessen Analyse lieferte die Informationen über den Expansion-Port der Vampire (SPI-Controller, vampire.resource) und das Schema der MAC-Adresse. v2eth.device enthält keinen Code aus v2expeth.device. Grüße Eisman, lokiist, Fossi, yelworC, cappin, Cego, McFly, LoneRaider, evil4dmin, jdb78 In Erinnerung Psyria