A12/13 fix Driver improvement git-ignore cleaned

This commit is contained in:
MHeinrichs
2018-02-03 17:38:48 +01:00
parent 9cd1ded15f
commit 0646520752
32 changed files with 264 additions and 199 deletions
Binary file not shown.
+27 -13
View File
@@ -32,7 +32,7 @@ DEBUG EQU 1
;------------------ options, some depend on hardware (CPLD) configuration -------------------------
_OPT_BUFFER_SWAP EQU 0 ;perform byte swap on buffer ops (1) or assume native endian (0)
_OPT_REG_SWAP EQU 0 ;perform byte swap on register ops (1) or assume native endian (0)
_OPT_ADR_QUIRK EQU 1 ;address lines 12/13 are swapped (1) or linear addressing (0)
_OPT_ADR_QUIRK EQU 0 ;address lines 12/13 are swapped (1) or linear addressing (0)
_OPT_FLOWCONTROL EQU 0 ;perform flow control on RX (1) or not (0)
_OPT_RECV EQU 1 ;faster recv (1) or generic (0)
@@ -805,6 +805,22 @@ READSRAM macro
endm
endc
;read with address shuffling or direct from SRAM (affects $2000-$5000)
ifne _OPT_ADR_QUIRK
;\1 = address register
;\2 = data register, offset
;\3 = destination
READSRAM_LONG macro
eor.w #$6000,\2
move.l (\1,\2.w),\3
eor.w #$6000,\2
endm
else
READSRAM_LONG macro
move.l (\1,\2),\3
endm
endc
; wrap position index (in bytes) \1 (data register .w)
;
@@ -1732,13 +1748,11 @@ _enc624j6l_RecvFrame: ;
move.l a1,a3
ifne _OPT_RECV
move d7,d1 ;start
move #$7000,d2 ;mask
add d0,d1 ;start+bytes
and d2,d1 ;keep only multiples of $1000
and d7,d2 ;keep only multiples of $1000
cmp d1,d2
bne.s .nooptrecv ;sadly, we cannot use faster routine atm
move.l d7,d1 ;start
and.l #$FFFF,d1 ;keep only lower adderess
add.l d0,d1 ;start+bytes
cmp.l #RXSTOP_INIT,d1
bgt.s .nooptrecv ;sadly, we cannot use faster routine atm, because we have a wrap around in the SRAM buffer
ifne _OPT_ADR_QUIRK
eor.w #$6000,d7
@@ -1766,18 +1780,18 @@ _enc624j6l_RecvFrame: ;
;generic loop: check for position overflows with each word
move d0,d1 ;byte count
lsr #1,d1 ;converted to word count
lsr #2,d1 ;converted to dword count
bcs.s .generic_read ;read 1 byte more if impair byte count
subq #1,d1 ;words - 1
.generic_read:
READSRAM a0,d7,d2 ;get current word
;move (a0,d7.w),d2 ;get current word
addq #2,d7 ;increment position
READSRAM_LONG a0,d7,d2 ;get current dword
;move.l (a0,d7.w),d2 ;get current dword
addq #4,d7 ;increment position
ifne _OPT_BUFFER_SWAP
rol.w #8,d2 ;swap buffer to Big Endian
endc
WRAPINDEX d7 ;wrap D7 if beyond buffer
move d2,(a1)+
move.l d2,(a1)+
dbf d1,.generic_read
.end_read:
+100 -96
View File
@@ -345,117 +345,125 @@ PRIVATE REGARGS BOOL read_frame(struct IOSana2Req *req, struct HWFrame *frame)
return ok;
}
/*
** reading packets
*/
/*
** reading packets
*/
/*F*/ PRIVATE REGARGS VOID doreadreqs(BASEPTR)
{
LONG datasize;
struct IOSana2Req *got;
ULONG pkttyp = 0; /* just to avoid warning with opt build, irrelevant otherwise */
BOOL rv;
struct HWFrame *frame = pb->pb_Frame;
LONG datasize,haverec;
struct IOSana2Req *got;
ULONG pkttyp = 0; /* just to avoid warning with opt build, irrelevant otherwise */
BOOL rv;
struct HWFrame *frame = pb->pb_Frame;
d8(("+hw_recv\n"));
rv = hw_recv_frame(pb, frame);
d8(("-hw_recv\n"));
if (rv)
{
pb->pb_DevStats.PacketsReceived++;
haverec = hw_recv_pending(pb);
/*allow only a certain number of packets to be serverd per interrupt*/
pkttyp = frame->hwf_Type;
if(haverec>MAX_READ_PACKAGE){
haverec = MAX_READ_PACKAGE;
}
while(haverec--){
d8(("+hw_recv\n"));
rv = hw_recv_frame(pb, frame);
d8(("-hw_recv\n"));
if (rv)
{
BOOL ok;
pb->pb_DevStats.PacketsReceived++;
pkttyp = frame->hwf_Type;
#if 0
/* perform internal loop back of magic packets of type 0xfffd */
if(pkttyp == HW_MAGIC_LOOPBACK) {
d(("loop back packet (size %ld)\n",frame->hwf_Size));
hw_send_frame(pb, frame);
return;
}
/* perform internal loop back of magic packets of type 0xfffd */
if(pkttyp == HW_MAGIC_LOOPBACK) {
d(("loop back packet (size %ld)\n",frame->hwf_Size));
hw_send_frame(pb, frame);
return;
}
/* plipbox requests online magic (again) */
if(pkttyp == HW_MAGIC_ONLINE) {
d(("request online magic"));
hw_send_magic_pkt(pb, HW_MAGIC_ONLINE);
return;
}
/* plipbox requests online magic (again) */
if(pkttyp == HW_MAGIC_ONLINE) {
d(("request online magic"));
hw_send_magic_pkt(pb, HW_MAGIC_ONLINE);
return;
}
#endif
datasize = frame->hwf_Size - HW_ETH_HDR_SIZE;
datasize = frame->hwf_Size - HW_ETH_HDR_SIZE;
dotracktype(pb, pkttyp, 0, 1, 0, datasize, 0);
dotracktype(pb, pkttyp, 0, 1, 0, datasize, 0);
d(("packet %08lx, size %ld received\n",pkttyp,datasize));
d(("packet %08lx, size %ld received\n",pkttyp,datasize));
ok = FALSE;
ObtainSemaphore(&pb->pb_ReadListSem);
ObtainSemaphore(&pb->pb_ReadListSem);
/* traverse the list of read-requests */
for(got = (struct IOSana2Req *)pb->pb_ReadList.lh_Head;
got->ios2_Req.io_Message.mn_Node.ln_Succ;
got = (struct IOSana2Req *)got->ios2_Req.io_Message.mn_Node.ln_Succ )
{
/* check if this one requests for the new packet we got */
if (got->ios2_PacketType == pkttyp )
{
BOOL ok;
Remove((struct Node*)got);
/* traverse the list of read-requests */
for(got = (struct IOSana2Req *)pb->pb_ReadList.lh_Head;
got->ios2_Req.io_Message.mn_Node.ln_Succ;
got = (struct IOSana2Req *)got->ios2_Req.io_Message.mn_Node.ln_Succ )
{
/* check if this one requests for the new packet we got */
if (got->ios2_PacketType == pkttyp )
{
Remove((struct Node*)got);
ok=TRUE; /* mark, that we found the package and quit list traversing */
break;
}
}
/* deliver packet */
ok = read_frame(got, frame);
if(!ok) {
DoEvent(pb, S2EVENT_ERROR | S2EVENT_BUFF | S2EVENT_SOFTWARE);
}
ReleaseSemaphore(&pb->pb_ReadListSem);
d(("packet received, satisfying S2Request\n"));
DevTermIO(pb, got);
got = NULL;
break;
}
}
if(ok){
/* deliver packet */
ok = read_frame(got, frame);
if(!ok) {
DoEvent(pb, S2EVENT_ERROR | S2EVENT_BUFF | S2EVENT_SOFTWARE);
}
ReleaseSemaphore(&pb->pb_ReadListSem);
}
else
{
d(("Error receiving (%ld. len=%ld)\n", rv, frame->hwf_Size));
/* something went wrong during receipt */
DoEvent(pb, S2EVENT_HARDWARE | S2EVENT_ERROR | S2EVENT_RX);
got = NULL;
pb->pb_DevStats.BadData++;
}
d(("packet received, satisfying S2Request\n"));
DevTermIO(pb, got);
got = NULL; /* delete the request to indicate that we served it*/
}
else {
/* If no one wanted this packet explicitely, there is one chance
** left: somebody waiting for orphaned packets. If this fails, too,
** we will drop it.
*/
d(("unknown packet\n"));
/* If no one wanted this packet explicitely, there is one chance
** left: somebody waiting for orphaned packets. If this fails, too,
** we will drop it.
*/
if (got)
{
d(("unknown packet\n"));
pb->pb_DevStats.UnknownTypesReceived++;
pb->pb_DevStats.UnknownTypesReceived++;
ObtainSemaphore(&pb->pb_ReadOrphanListSem);
got = (struct IOSana2Req *)RemHead((struct List*)&pb->pb_ReadOrphanList);
ReleaseSemaphore(&pb->pb_ReadOrphanListSem);
ObtainSemaphore(&pb->pb_ReadOrphanListSem);
got = (struct IOSana2Req *)RemHead((struct List*)&pb->pb_ReadOrphanList);
ReleaseSemaphore(&pb->pb_ReadOrphanListSem);
if (got)
{
BOOL ok = read_frame(got, frame);
if(!ok) {
DoEvent(pb, S2EVENT_ERROR | S2EVENT_BUFF | S2EVENT_SOFTWARE);
}
if (got)
{
ok = read_frame(got, frame);
if(!ok) {
DoEvent(pb, S2EVENT_ERROR | S2EVENT_BUFF | S2EVENT_SOFTWARE);
}
d(("orphan read\n"));
d(("orphan read\n"));
DevTermIO(pb, got);
}
else
{
dotracktype(pb, pkttyp, 0, 0, 0, 0, 1);
d(("packet thrown away...\n"));
}
}
DevTermIO(pb, got);
}
else
{
dotracktype(pb, pkttyp, 0, 0, 0, 0, 1);
d(("packet thrown away...\n"));
}
}
}
else
{
d(("Error receiving (%ld. len=%ld)\n", rv, frame->hwf_Size));
/* something went wrong during receipt */
DoEvent(pb, S2EVENT_HARDWARE | S2EVENT_ERROR | S2EVENT_RX);
got = NULL;
pb->pb_DevStats.BadData++;
}
}
}
/*E*/
@@ -728,13 +736,9 @@ PRIVATE REGARGS BOOL read_frame(struct IOSana2Req *req, struct HWFrame *frame)
haverec = hw_recv_pending(pb);
}
hw_disable_global_int(pb);
/*allow only a certain number of packets to be serverd per interrupt*/
if(haverec>MAX_READ_PACKAGE)
haverec = MAX_READ_PACKAGE;
/* accept pending receive and start reading */
while( haverec-- )
if( haverec>0 )
{
d2(("*+ do_read\n"));
doreadreqs(pb);