Tweaked the driver a bit
This commit is contained in:
Binary file not shown.
@@ -813,10 +813,13 @@ _enc624j6l_IntServer:
|
||||
beq.s .rts ;exit quickly when no packet pending
|
||||
;CLRREG EIR,a1,d1 ;clear interrupt bit
|
||||
|
||||
move #$C000,d0 ;disable board interrupt until /INT from ENC toggles
|
||||
lea $4000(a1),a1 ;D0: Bit15 = overall board int enable, Bit14 = ignore int until toggle (1)
|
||||
move.w d0,($4000,a1)
|
||||
lea -$4000(a1),a1
|
||||
;move #$C000,d0 ;disable board interrupt until /INT from ENC toggles
|
||||
;lea $4000(a1),a1 ;D0: Bit15 = overall board int enable, Bit14 = ignore int until toggle (1)
|
||||
;move.w d0,($4000,a1)
|
||||
;lea -$4000(a1),a1
|
||||
|
||||
move #EIE_INTIE,D0 ;disable board interrupt until someone enables it again
|
||||
CLRREG EIE,A1,d0
|
||||
|
||||
READREG PSigTask,a1,d0 ;upper two bytes
|
||||
swap d0 ;
|
||||
@@ -1034,7 +1037,7 @@ _enc624j6l_RecvFrame: ;
|
||||
|
||||
ifne _OPT_RECV
|
||||
move.l d7,d1 ;start
|
||||
and.l #$FFFF,d1 ;keep only lower adderess
|
||||
and.l #$FFFF,d1 ;keep only lower address
|
||||
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
|
||||
@@ -1049,12 +1052,12 @@ _enc624j6l_RecvFrame: ;
|
||||
subq #1,d1 ;words - 1
|
||||
.opt_read:
|
||||
ifne _OPT_BUFFER_SWAP
|
||||
move.w (a2)+,d2 ;get current word
|
||||
rol.w #8,d2 ;swap buffer to Big Endian
|
||||
move.w d2,(a1)+
|
||||
move.w (a2)+,d2 ;get current word
|
||||
rol.w #8,d2 ;swap buffer to Big Endian
|
||||
move.w d2,(a1)+
|
||||
move.l (a2)+,d2 ;get current word
|
||||
rol.w #8,d2 ;swap buffer to Big Endian
|
||||
swap D2
|
||||
rol.w #8,d2 ;swap buffer to Big Endian
|
||||
swap D2
|
||||
move.l d2,(a1)+
|
||||
else
|
||||
move.l (a2)+,(a1)+
|
||||
endc
|
||||
@@ -1063,7 +1066,7 @@ _enc624j6l_RecvFrame: ;
|
||||
.nooptrecv:
|
||||
endc ;_OPT_RECV
|
||||
|
||||
;generic loop: check for position overflows with each word
|
||||
;generic loop: check for position overflows with each dword
|
||||
move d0,d1 ;byte count
|
||||
lsr #2,d1 ;converted to dword count
|
||||
bcs.s .generic_read ;read 1 byte more if impair byte count
|
||||
@@ -1071,12 +1074,15 @@ _enc624j6l_RecvFrame: ;
|
||||
.generic_read:
|
||||
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
|
||||
SWAP D2
|
||||
rol.w #8,d2 ;swap buffer to Big Endian
|
||||
SWAP D2
|
||||
endc
|
||||
move.l d2,(a1)+ ; store currend dword
|
||||
addq #4,d7 ;increment position
|
||||
WRAPINDEX d7 ;wrap D7 if beyond buffer
|
||||
move.l d2,(a1)+
|
||||
dbf d1,.generic_read
|
||||
|
||||
.end_read:
|
||||
@@ -1186,10 +1192,9 @@ _enc624j6l_TransmitFrame:
|
||||
swap d4
|
||||
move.w #8,d4
|
||||
.txcopy:
|
||||
move.l (a1)+,d1
|
||||
move.l (a1)+,d3
|
||||
|
||||
ifne _OPT_BUFFER_SWAP
|
||||
move.l (a1)+,d1
|
||||
move.l (a1)+,d3
|
||||
; byte swap in 16 Bit words
|
||||
rol.w d4,d1
|
||||
rol.w d4,d3
|
||||
@@ -1199,9 +1204,12 @@ _enc624j6l_TransmitFrame:
|
||||
rol.w d4,d3
|
||||
swap d1
|
||||
swap d3
|
||||
move.l d1,(a2)+ ;save to SRAM
|
||||
move.l d3,(a2)+ ;save to SRAM
|
||||
else
|
||||
move.l (a1)+,(a2)+ ;save to SRAM
|
||||
move.l (a1)+,(a2)+ ;save to SRAM
|
||||
endc
|
||||
move.l d1,(a2)+ ;save to SRAM
|
||||
move.l d3,(a2)+ ;save to SRAM
|
||||
|
||||
dbf d0,.txcopy
|
||||
swap d4
|
||||
|
||||
+101
-114
@@ -353,109 +353,103 @@ PRIVATE REGARGS BOOL read_frame(struct IOSana2Req *req, struct HWFrame *frame)
|
||||
LONG datasize;
|
||||
struct IOSana2Req *got;
|
||||
ULONG pkttyp = 0; /* just to avoid warning with opt build, irrelevant otherwise */
|
||||
BOOL rv;
|
||||
BOOL rv,ok;
|
||||
struct HWFrame *frame = pb->pb_Frame;
|
||||
|
||||
while(hw_recv_pending(pb)){
|
||||
d8(("+hw_recv\n"));
|
||||
rv = hw_recv_frame(pb, frame);
|
||||
d8(("-hw_recv\n"));
|
||||
if (rv)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
dotracktype(pb, pkttyp, 0, 1, 0, datasize, 0);
|
||||
|
||||
d(("packet %08lx, size %ld received\n",pkttyp,datasize));
|
||||
ok = FALSE;
|
||||
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 )
|
||||
{
|
||||
Remove((struct Node*)got);
|
||||
ok =TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ReleaseSemaphore(&pb->pb_ReadListSem);
|
||||
|
||||
if(!ok){
|
||||
/* 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"));
|
||||
|
||||
pb->pb_DevStats.UnknownTypesReceived++;
|
||||
|
||||
ObtainSemaphore(&pb->pb_ReadOrphanListSem);
|
||||
got = (struct IOSana2Req *)RemHead((struct List*)&pb->pb_ReadOrphanList);
|
||||
ReleaseSemaphore(&pb->pb_ReadOrphanListSem);
|
||||
|
||||
if (got)
|
||||
{
|
||||
d(("orphan read\n"));
|
||||
ok=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
d8(("+hw_recv\n"));
|
||||
rv = hw_recv_frame(pb, frame);
|
||||
d8(("-hw_recv\n"));
|
||||
if (rv)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
dotracktype(pb, pkttyp, 0, 1, 0, datasize, 0);
|
||||
|
||||
d(("packet %08lx, size %ld received\n",pkttyp,datasize));
|
||||
|
||||
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);
|
||||
|
||||
/* deliver packet */
|
||||
ok = read_frame(got, frame);
|
||||
if(!ok) {
|
||||
DoEvent(pb, S2EVENT_ERROR | S2EVENT_BUFF | S2EVENT_SOFTWARE);
|
||||
}
|
||||
|
||||
d(("packet received, satisfying S2Request\n"));
|
||||
DevTermIO(pb, got);
|
||||
got = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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++;
|
||||
}
|
||||
|
||||
/* 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++;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
d(("orphan read\n"));
|
||||
|
||||
DevTermIO(pb, got);
|
||||
}
|
||||
else
|
||||
{
|
||||
dotracktype(pb, pkttyp, 0, 0, 0, 0, 1);
|
||||
d(("packet thrown away...\n"));
|
||||
}
|
||||
}
|
||||
if(ok){
|
||||
/* deliver packet */
|
||||
ok = read_frame(got, frame);
|
||||
if(!ok) {
|
||||
DoEvent(pb, S2EVENT_ERROR | S2EVENT_BUFF | S2EVENT_SOFTWARE);
|
||||
}
|
||||
|
||||
d(("packet received, satisfying S2Request\n"));
|
||||
DevTermIO(pb, got);
|
||||
}
|
||||
else{
|
||||
/* throw it away*/
|
||||
dotracktype(pb, pkttyp, 0, 0, 0, 0, 1);
|
||||
d(("packet thrown away...\n"));
|
||||
}
|
||||
got = NULL;
|
||||
}
|
||||
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*/
|
||||
|
||||
@@ -725,21 +719,14 @@ PRIVATE REGARGS BOOL read_frame(struct IOSana2Req *req, struct HWFrame *frame)
|
||||
hw_enable_global_int(pb);
|
||||
recv = Wait(wmask);
|
||||
d2(("**> wait: got 0x%08lx\n", recv));
|
||||
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;
|
||||
|
||||
/*hw_disable_global_int(pb);*/
|
||||
|
||||
/* accept pending receive and start reading */
|
||||
while( haverec-- )
|
||||
{
|
||||
d2(("*+ do_read\n"));
|
||||
doreadreqs(pb);
|
||||
d2(("*- do_read\n"));
|
||||
}
|
||||
d2(("*+ do_read\n"));
|
||||
doreadreqs(pb);
|
||||
d2(("*- do_read\n"));
|
||||
|
||||
|
||||
if( recv & specialmask )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user