Update in Firmware (pure Z2-AC but LAN becomes Z3) and new pcb

This commit is contained in:
MHeinrichs
2019-02-19 23:01:57 +01:00
parent 021563bffa
commit 94425362cc
55 changed files with 22538 additions and 19513 deletions
+18 -3
View File
@@ -2,8 +2,9 @@ ENC624J6Net - A SANA-II driver for the Scratze card
ENC624J6Net Copyright (C) 2018 Henryk Richter <henryk.richter@gmx.net>
This driver is supposed to support ENC624J600 based ethernet
on the ZII LAN IDE CP card designed by Matze (a1k.org) and Scrat (a1k.org).
This driver is supposed to support ENC624J600 based ethernet on the
ZII LAN IDE CP card designed by Matze (a1k.org), Buggs (a1k.org)
and Scrat (a1k.org).
Please see at the end of the file for information about licensing
conditions.
@@ -41,7 +42,7 @@ PRIORITY=PRI/K/N,BPS/K/N,MTU/K/N,FULLDUPLEX/S,FLOWCONTROL/S,TIMER/K/N,MULTICAST/
caution: requires manual configuration of duplex mode
on the switch, too.
note: this switch should not be enabled in normal cases.
The module feeatures autoconfiguration that determines
The module features autoconfiguration that determines
speed and duplex automatically.
PRIORITY - server task priority (default 1)
@@ -63,6 +64,20 @@ PRIORITY=PRI/K/N,BPS/K/N,MTU/K/N,FULLDUPLEX/S,FLOWCONTROL/S,TIMER/K/N,MULTICAST/
Changelog:
----------
1.99 - fixed soft reset for ZIII firmware
- re-enabled 32 Bit Buffer copies (unless Miami is active)
- default server task priority for AmiTCP=6 (otherwise 0)
- tuned RX/TX balancing to make RoadShow happy
- added Packet Filter hook processing (needs testing)
1.98 - improved TX speed
- precaution: soft-reset cards in detection loop to make
sure that no bogus settings are left over after reset
- optional: disable length check in Sana-II Device Query
1.97 - added New Style Device (NSD) commands
- implemented SANA-II Device Query Extension
1.93 - recompiled using SAS/C, now 1kB smaller
1.91 - first Beta of completely rewritten driver
+102
View File
@@ -0,0 +1,102 @@
VWiznet - A SANA-II driver for W5500 10/100 ethernet modules
Copyright (C) 2018-2019 Henryk Richter <henryk.richter@gmx.net>
This driver is supposed to support W5500 modules hooked up to the expansion
port of Vampire 500V2+ cards.
Installation:
-------------
Installation of the driver is straightforward.
Just copy vwiznet500ex.device from the bin subdirectory to devs:networks
and enable the interface in your favorite TCP/IP stack as usual. So far,
successful tests have been done with the free AmiTCP/IP 3.0b2, AmiTCP4.0-4.2,
Genesis, MiamiDX and RoadShow.
The minimum system requirement is the Gold 2.10 release of Apollo Core
for Vampire 500V2+.
Vampire500 Expansion port Hardware
-----------------------------------
Please see http://wiki.apollo-accelerators.com/doku.php/expansionport for
guidance on pinout of the expansion port.
The W5500 can be clocked way higher than the ENC28J60 that was used for
SDNet. As a consequence of clocks beyond 25 MHz, signal integrity is of
some concern. Therefore it is suggested to connect the module is as close
as possible to the expansion port and use an Ethernet expansion cable
in order to reach the edge of the computer case.
An adapter PCB is in the making. That PCB plugs directly into the Vampire
expansion port, connects readily available W5500 modules on the other
side and contains some components to keep signal integrity in a good shape.
Options
-------
Below you find the options accepted by the driver. Please note that no special
configuration is necessary for normal operation. What you find documented below
is available for tuning purposes.
The options template for the config files
ENVARC:SANA2/vwiznet500ex.config
is as follows:
PRIORITY=PRI/K/N,BPS/K/N,MTU/K/N,SPISPEED/K/N,TIMER/K/N,NOINTERRUPT/S
SPISPEED - SPI clock divider (1-10, default 1), controls maximum
clock of SPI bus. Actual I/O clock is Core_Clock/(3+SPISPEED).
PRIORITY - server task priority (default 1)
BPS - bit per seconds for statistics purposes
MTU - maximum transmission unit (default 1500)
NOINTERRUPT - disable hardware interrupt and use polling instead
(default: interrupt enabled)
TIMER - when disabling interrupt you also need to specify
a timer interval in microseconds
(default: 0, i.e. no timer)
example1 (useful for DSL via PPPoE,
higher priority for server task = more speed with AmiTCP
at the expense of multitasking friendliness):
echo "MTU=1492 SPISPEED=1 PRIORITY=6" >ENVARC:sana2/vwiznet500ex.config
Changelog:
----------
1.99 - re-enabled 32 Bit Buffer copies (unless Miami is active)
- default server task priority for AmiTCP=6 (otherwise 0)
- tuned RX/TX balancing to make RoadShow happy
- added Packet Filter hook processing (needs testing)
1.98 - preparations for V2 of the adapter PCB: hardware based reset
1.97 - added New style device commands
- implemented SANA-II Device Query Extension
1.96 - tuned defaults
1.95 - initial build, aligned with sdnet/v2expeth version
Copyrights / License:
---------------------
Copyright (C) 2018-2019 Henryk Richter <henryk.richter@gmx.net>, all rights reserved.
Binary file not shown.
Binary file not shown.
+20 -14
View File
@@ -197,17 +197,25 @@ ASM SAVEDS LONG DevOpen( ASMR(a1) struct IOSana2Req *ioreq ASMREG(a1),
dbm->dbm_CopyFromBuffer = (BMCALL)((void (*)())(GetTagData(S2_CopyFromBuff, 0,
(struct TagItem *)ioreq->ios2_BufferManagement)));
/* v1.95: disable CopyToBuffer32 due to problems with MiamiDX */
dbm->dbm_PacketFilter = (APTR)( GetTagData(S2_PacketFilter,0,
(struct TagItem *)ioreq->ios2_BufferManagement));
/* v1.95: disabled CopyToBuffer32 due to problems with MiamiDX */
/* v1.99: try identifying Miami */
/* MiamiDX requires byte count to be a multiple of 4 */
#if 1
dbm->dbm_CopyToBuffer32 = (0);
dbm->dbm_CopyFromBuffer32 = (0);
#else
dbm->dbm_CopyToBuffer32 = (BMCALL)((void (*)())(GetTagData(S2_CopyToBuff32, 0,
if( FindPort("MIAMI.1") ) /* Miami active ? */
{
dbm->dbm_CopyToBuffer32 = (0);
dbm->dbm_CopyFromBuffer32 = (0);
}
else
{
dbm->dbm_CopyToBuffer32 = (BMCALL)((void (*)())(GetTagData(S2_CopyToBuff32, 0,
(struct TagItem *)ioreq->ios2_BufferManagement)));
dbm->dbm_CopyFromBuffer32 = (BMCALL)((void (*)())(GetTagData(S2_CopyFromBuff32, 0,
dbm->dbm_CopyFromBuffer32 = (BMCALL)((void (*)())(GetTagData(S2_CopyFromBuff32, 0,
(struct TagItem *)ioreq->ios2_BufferManagement)));
#endif
}
if( !dbm->dbm_CopyToBuffer32 )
dbm->dbm_CopyToBuffer32 = dbm->dbm_CopyToBuffer;
if( !dbm->dbm_CopyFromBuffer32 )
@@ -255,8 +263,6 @@ ASM SAVEDS LONG DevOpen( ASMR(a1) struct IOSana2Req *ioreq ASMREG(a1),
}
ioreq->ios2_Req.io_Message.mn_Node.ln_Type = NT_REPLYMSG;
D(("DevOpen return code %ld\n",ret));
return ret;
}
@@ -580,8 +586,6 @@ ASM SAVEDS VOID DevBeginIO( ASMR(a1) struct IOSana2Req *ioreq ASMREG(a1),
{
struct IOStdReq *stdrq = (struct IOStdReq *)ioreq;
D(("NSCMD_DEVICEQUERY size %ld\n",(ULONG)stdrq->io_Length));
if( (!stdrq->io_Data) || (stdrq->io_Length < sizeof( NSDQueryAnswer ) ) )
{
ioreq->ios2_Req.io_Error = IOERR_BADLENGTH;
@@ -592,7 +596,6 @@ ASM SAVEDS VOID DevBeginIO( ASMR(a1) struct IOSana2Req *ioreq ASMREG(a1),
stdrq->io_Actual = sizeof( NSDQueryAnswer );
ioreq->ios2_Req.io_Error = 0;
}
D(("NSCMD_DEVICEQUERY return %ld\n",(ULONG)ioreq->ios2_Req.io_Error));
}
break;
/* query contents may ask for live data: handle in server.c */
@@ -749,7 +752,10 @@ static LONG dbStartServer( DEVBASEP, LONG unit )
sv_tags[i ].ti_Tag = NP_Name;
sv_tags[i++].ti_Data = (ULONG)db->db_Lib.lib_Node.ln_Name;
sv_tags[i ].ti_Tag = NP_Priority;
sv_tags[i++].ti_Data = (ULONG)0;
if( FindPort("AMITCP") ) /* AmiTCP active ? */
sv_tags[i++].ti_Data = (ULONG)6;
else
sv_tags[i++].ti_Data = (ULONG)0;
sv_tags[i ].ti_Tag = TAG_DONE;
if( (db->db_ServerProc = CreateNewProc(sv_tags)))
+1
View File
@@ -131,6 +131,7 @@ struct db_BufferManagement {
BMCALL dbm_CopyToBuffer32;
BMCALL dbm_CopyFromBuffer;
BMCALL dbm_CopyToBuffer;
APTR dbm_PacketFilter; /* this is actually a Hook */
ULONG dbm_ID;
};
+56 -10
View File
@@ -1,4 +1,3 @@
;APS00001922000000000000000000000000000000000000000000000000000000000000000000000000
; ------------------------------------------------------------------------------
; | Lowlevel Access to memory mapped ENC624J600 in PSP mode |
; | Henryk Richter <henryk.richter@gmx.net> |
@@ -25,9 +24,10 @@
include "enc624j6net/macros.i"
; enable debugging code block
DEBUG EQU 1
DEBUG EQU 0
;
ADD_4RX EQU 1 ;add 4 to valid RX size (fake CRC), fixes shapeshifter RAW treatment
_OPT_LONGRESET EQU 0 ;in testing, don't enable
;------------- <DANGER! APPLY CHANGES HERE ALSO TO enc624j6l.h !!> ------------
;
@@ -365,10 +365,14 @@ _enc624j6l_CheckBoard: ;check whether board is operating correctly
move.l a0,d0
beq .err
move.w #CLOCK_DEF_SET,d0 ;set mask
SETREG ECON2,a0,d0
move.w #CLOCK_DEF_CLR,d0 ;clr mask
CLRREG ECON2,a0,d0
moveq #60,d0 ;let the board settle in if there was
bsr _enc624j6l_UMinDelay ;a reset or POR (unlikely)
; ----------------- quick check for operational mode ------------------
move.w #$1234,d1
WRITEREG EUDAST,a0,d1 ;write data
@@ -377,16 +381,30 @@ _enc624j6l_CheckBoard: ;check whether board is operating correctly
cmp.w d0,d1 ;do we get the register back ?
bne.s .err ;no -> complain
moveq #0,d0 ;magic trick: the board enables Interrupts
lea $4000(a0),a0
move.w d0,($4000,a0) ;0=disable interrupt
lea -$4000(a0),a0
; ------------------------- reset device ------------------------------
move #EIR_CRYPTEN|EIR_MODEXIF|EIR_HASHIF|EIR_AESIF|EIR_LINKIF|EIR_PRDYIF|EIR_PKTIF|EIR_DMAIF|EIR_TXIF|EIR_TXABTIF|EIR_RXABTIF|EIR_PCFULIF,d0
CLRREG EIR,a0,d0
; ifne _OPT_LONGRESET
; moveq #ECON2_ETHRST,d0
; swap d0
; move.l d0,ECON2-2(a0)
; else
moveq #ECON2_ETHRST,d0
WRITEREG ECON2,a0,d0 ;reset board
SETREG ECON2,a0,d0 ;reset board, was: WRITEREG
; endc
moveq #64-1,d1 ;number of loops to test (max. 7.6 ms)
.loop:
moveq #120,d0 ;wait patiently
bsr _enc624j6l_UMinDelay ;
READREG ESTAT,a0,d0
and #(ESTAT_CLKRDY|ESTAT_RSTDONE|ESTAT_PHYRDY),d0
cmp #(ESTAT_CLKRDY|ESTAT_RSTDONE|ESTAT_PHYRDY),d0
@@ -400,6 +418,8 @@ _enc624j6l_CheckBoard: ;check whether board is operating correctly
tst.w d0 ;should have gone to 0 after reset
bne.s .err ;(see above, we've written $1234)
ifne 0
;---------- short RAM check - write phase ----------------------------
;---------- (device is not receiving after reset) --------------------
moveq #3,d1
@@ -425,6 +445,8 @@ _enc624j6l_CheckBoard: ;check whether board is operating correctly
eor.b #3,d1
dbf d0,.rdloop
endc ;ifne 0
;---------- satisfied, return our sincere happiness -------------------
moveq #1,d0 ;all fine
@@ -539,11 +561,11 @@ _enc624j6l_Init:
moveq #ECON1_RXEN,d0 ;no RX, my dear (yet)
CLRREG ECON1,a0,d0 ;
;33.333Mhz clock out frequency (see defines above)
;25 MHz clock out frequency (see defines in registers.i)
move.w #CLOCK_DEF_SET,d0 ;set mask
SETREG ECON2,a0,d0 ;set first, then clear to avoid case of all COCON bits 0
move.w #CLOCK_DEF_CLR,d0 ;clr mask
CLRREG ECON2,a0,d0
move.w #CLOCK_DEF_SET,d0 ;set mask
SETREG ECON2,a0,d0
; disable crypto engine and all interrupts
move #EIR_CRYPTEN|EIR_MODEXIF|EIR_HASHIF|EIR_AESIF|EIR_LINKIF|EIR_PRDYIF|EIR_PKTIF|EIR_DMAIF|EIR_TXIF|EIR_TXABTIF|EIR_RXABTIF|EIR_PCFULIF,d0
@@ -1230,12 +1252,35 @@ _enc624j6l_RecvFrame: ;
ifne _OPT_ADR_QUIRK
eor.w #$6000,d7
endc
endc ;_OPT_ADR_QUIRK
lea (a0,d7.w),a2 ;read pointer
ifeq _OPT_BUFFER_SWAP
move.l d0,d2 ;total bytes
moveq #15,d1 ;
lsr.w #4,d2 ;total/16
and.l d0,d1 ;remainder: max 15 bytes
addq #3,d1 ;remainder, rounded up to +3 bytes
subq #1,d2 ;dbf
blt.s .nopt16_read ;less than 16 bytes -> bail out
bra.s .opt16_read
.opt16_loop:
move.l d3,(a1)+
.opt16_read:
rept 3
move.l (a2)+,(a1)+
endr
move.l (a2)+,d3
dbf d2,.opt16_loop
move.l d3,(a1)+
.nopt16_read:
else ;_OPT_BUFFER_SWAP
moveq #3,d1 ;round bytes up
add d0,d1 ;byte count + 3
endc ;_OPT_BUFFER_SWAP
lsr #2,d1 ;converted to dword count = ceil(bytes/4)
subq #1,d1 ;longwords - 1
blt.s .end_read
.opt_read:
ifne _OPT_BUFFER_SWAP
move.l (a2)+,d2 ;get current word
@@ -1244,11 +1289,12 @@ _enc624j6l_RecvFrame: ;
rol.w #8,d2 ;swap buffer to Big Endian
swap D2
move.l d2,(a1)+
else
else ;_OPT_BUFFER_SWAP
move.l (a2)+,(a1)+
endc
endc ;_OPT_BUFFER_SWAP
dbf d1,.opt_read
bra.s .end_read
.nooptrecv:
endc ;_OPT_RECV
Binary file not shown.
+7 -1
View File
@@ -86,6 +86,7 @@ ASM SAVEDS LONG hw_Find_Boards( ASMR(a0) DEVBASEP ASMREG(a0) )
LONG i,ret = 0;
struct Library *ExpansionBase;
struct ConfigDev *cfg = (0);
APTR boardbase;
if( (ExpansionBase = OpenLibrary( (BYTE*)exp_name, 37 )) )
{
@@ -97,8 +98,13 @@ ASM SAVEDS LONG hw_Find_Boards( ASMR(a0) DEVBASEP ASMREG(a0) )
cfg = FindConfigDev( cfg, ENC_MANUFACTURER, ENC_BOARD );
if( !cfg )
break;
db->db_Units[i].duh_BASE = (APTR)cfg->cd_BoardAddr;
boardbase = (APTR)cfg->cd_BoardAddr;
db->db_Units[i].duh_BASE = boardbase;
D(("Board at %lx\n",(ULONG)cfg->cd_BoardAddr ));
/* bring board to sane state (i.e. perform soft reset) */
/* if( boardbase < (APTR)0x40000000 ) */ /* debug only */
enc624j6l_CheckBoard( boardbase );
}
ret = i;
D(("%ld boards found\n",ret));
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+33 -1
View File
@@ -30,6 +30,11 @@
static LONG server_queryext( DEVBASEP, ULONG unit, struct IOSana2Req *ioreq );
#endif
/* the XSurf500 network panel currently claims length 0 requests
if the line below is not commented out, just check pointer
*/
#define S2QUERYEXT_NOLENGTHCHECK
/* (avoid external link libraries) this call is not time critical */
static void MemSet( void *a, ULONG val, ULONG size )
@@ -396,6 +401,8 @@ static LONG server_HandleS2Commands( DEVBASEP )
ioreq->ios2_Req.io_Error = S2ERR_NO_ERROR;
ioreq->ios2_WireError = S2WERR_GENERIC_ERROR;
D(("server_HandleS2Commands: CMD %ld",(ULONG)ioreq->ios2_Req.io_Command));
switch( ioreq->ios2_Req.io_Command)
{
case S2_ONLINE:
@@ -482,9 +489,16 @@ static LONG server_queryext( DEVBASEP, ULONG unit, struct IOSana2Req *ioreq )
tlist = (struct TagItem*)ioreq->ios2_Data;
D(("Query for %ld bytes TAGLIST %lx\n",(ULONG)ioreq->ios2_DataLength,(ULONG)tlist ));
#ifdef S2QUERYEXT_NOLENGTHCHECK
if( !tlist )
return 0;
#else
/* 3*4 Bytes needed for one Tag + TAG_DONE */
if( (ioreq->ios2_DataLength < 12) || (!tlist) )
return 0;
#endif
tval = GetTagData( S2_DevQueryExtVendorName, 0, tlist );
if( tval )
@@ -494,6 +508,7 @@ static LONG server_queryext( DEVBASEP, ULONG unit, struct IOSana2Req *ioreq )
len = min( s2qep->Length, sizeof(server_vendorstring) );
CopyMem( (void*)server_vendorstring, s2qep->Data, len );
s2qep->Actual = len;
D(("Vendorname Query"));
}
tval = GetTagData( S2_DevQueryExtProductName, 0, tlist );
@@ -504,6 +519,7 @@ static LONG server_queryext( DEVBASEP, ULONG unit, struct IOSana2Req *ioreq )
len = min( s2qep->Length, sizeof(server_productstring) );
CopyMem( (void*)server_productstring, s2qep->Data, len );
s2qep->Actual = len;
D(("Productname Query"));
}
@@ -511,6 +527,7 @@ static LONG server_queryext( DEVBASEP, ULONG unit, struct IOSana2Req *ioreq )
tval2 = GetTagData( S2_DevQueryExtLinkSpeed, 0, tlist );
if( (tval) || (tval2) )
{
D(("Link Status and/or Speed"));
/* ask hardware about link/speed status */
len = hw_get_mac_status(db, unit);
if( len != HW_MAC_INVALID )
@@ -709,6 +726,8 @@ static LONG server_writequeue( DEVBASEP, ULONG unit )
/* error handling */
server_writeerror( db, unit, ioreq, code );
}
if( hw_recv_pending(db,unit) )
break;
}
ReleaseSemaphore( &db->db_Units[unit].du_Sem );
@@ -717,6 +736,9 @@ static LONG server_writequeue( DEVBASEP, ULONG unit )
}
typedef ULONG (* ASM PFCALL)( ASMR(a0) struct Hook * ASMREG(a0), ASMR(a2) void * ASMREG(a2), ASMR(a1) ULONG *ASMREG(a1) );
#define PFTYPE ULONG (*)( struct Hook *,void *,ULONG * )
/* note: entering here with locked semaphore */
static void server_read_frame( DEVBASEP, ULONG unit, struct IOSana2Req *ioreq, UBYTE *frame, ULONG framesize )
{
@@ -726,6 +748,8 @@ static void server_read_frame( DEVBASEP, ULONG unit, struct IOSana2Req *ioreq, U
COPYMAC( ioreq->ios2_DstAddr, frame ); /* macro in server.h */
COPYMAC( ioreq->ios2_SrcAddr, frame+6 );
dbm = (struct db_BufferManagement *)ioreq->ios2_BufferManagement;
if( *frame & 1 ) /* just check Ethernet MULTICAST flag */
{
ULONG mac = *((ULONG*)frame );
@@ -751,9 +775,17 @@ static void server_read_frame( DEVBASEP, ULONG unit, struct IOSana2Req *ioreq, U
ioreq->ios2_Req.io_Error = 0;
ioreq->ios2_WireError = 0;
dbm = (struct db_BufferManagement *)ioreq->ios2_BufferManagement;
D(("ReadFrm IO %lx, DBM %lx frm %lx frmsz %ld\n",(ULONG)ioreq,(ULONG)dbm,(ULONG)frame,framesize));
if( dbm->dbm_PacketFilter ) /* Filter Packets ? */
{
struct Hook *hk = (struct Hook *)dbm->dbm_PacketFilter;
PFCALL dispatch = (PFCALL)hk->h_Entry;
if( !dispatch( hk, (void*)ioreq, (ULONG*)frame ) )
return;
}
if(!(*dbm->dbm_CopyToBuffer32)(ioreq->ios2_Data, frame, framesize ))
{
if(!(*dbm->dbm_CopyToBuffer)(ioreq->ios2_Data, frame, framesize ))
+2 -2
View File
@@ -9,8 +9,8 @@
#define _INC_VERSION_H
#define DEVICEVERSION 1
#define DEVICEREVISION 98
#define DEVICEREVISION 99
#define DEVICEEXTRA Beta
#define DEVICEDATE 03.01.2019
#define DEVICEDATE 08.01.2019
#endif