- Driver optimization
This commit is contained in:
Binary file not shown.
@@ -255,7 +255,7 @@ PRIVATE APTR pb_AllocExpansion( ULONG portid, BASEPTR )
|
|||||||
struct BufferManagement *bm;
|
struct BufferManagement *bm;
|
||||||
LONG rv = 0; /* get rid of warning with opt build */
|
LONG rv = 0; /* get rid of warning with opt build */
|
||||||
|
|
||||||
d(("entered\n"));
|
d(("entered for unit %ld\n",unit));
|
||||||
|
|
||||||
/* Make sure our open remains single-threaded. */
|
/* Make sure our open remains single-threaded. */
|
||||||
ObtainSemaphore(&pb->pb_Lock);
|
ObtainSemaphore(&pb->pb_Lock);
|
||||||
@@ -304,6 +304,7 @@ PRIVATE APTR pb_AllocExpansion( ULONG portid, BASEPTR )
|
|||||||
if( !cfg )
|
if( !cfg )
|
||||||
break;
|
break;
|
||||||
pb->pb_HWBase.hwb_boards[i] = cfg->cd_BoardAddr;
|
pb->pb_HWBase.hwb_boards[i] = cfg->cd_BoardAddr;
|
||||||
|
d(("board at = %ld\n",(ULONG)pb->pb_HWBase.hwb_boards[i] ));
|
||||||
}
|
}
|
||||||
pb->pb_HWBase.hwb_boards[i] = (0);
|
pb->pb_HWBase.hwb_boards[i] = (0);
|
||||||
}
|
}
|
||||||
@@ -383,10 +384,10 @@ PRIVATE APTR pb_AllocExpansion( ULONG portid, BASEPTR )
|
|||||||
}
|
}
|
||||||
#else /* PROTO_SDNET */
|
#else /* PROTO_SDNET */
|
||||||
unsigned char addr[6] = { 0x1a,0x11,0xaf,0xa0,0x47,0x11 };
|
unsigned char addr[6] = { 0x1a,0x11,0xaf,0xa0,0x47,0x11 };
|
||||||
#endif /* PROTO_SDNET */
|
|
||||||
#endif /* PROTO_ENC624NET */
|
|
||||||
memcpy(pb->pb_CfgAddr, addr, HW_ADDRFIELDSIZE);
|
memcpy(pb->pb_CfgAddr, addr, HW_ADDRFIELDSIZE);
|
||||||
memcpy(pb->pb_DefAddr, addr, HW_ADDRFIELDSIZE);
|
memcpy(pb->pb_DefAddr, addr, HW_ADDRFIELDSIZE);
|
||||||
|
#endif /* PROTO_SDNET */
|
||||||
|
#endif /* PROTO_ENC624NET */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -438,7 +439,7 @@ PRIVATE APTR pb_AllocExpansion( ULONG portid, BASEPTR )
|
|||||||
{
|
{
|
||||||
d(("starting server"));
|
d(("starting server"));
|
||||||
if (pb->pb_Server = CreateNewProcTags(NP_Entry, ServerTask, NP_Name,
|
if (pb->pb_Server = CreateNewProcTags(NP_Entry, ServerTask, NP_Name,
|
||||||
NP_Priority, 9, SERVERTASKNAME, TAG_DONE))
|
NP_Priority, 59, SERVERTASKNAME, TAG_DONE))
|
||||||
{
|
{
|
||||||
ss.ss_Error = 1;
|
ss.ss_Error = 1;
|
||||||
ss.ss_PLIPBase = pb;
|
ss.ss_PLIPBase = pb;
|
||||||
@@ -670,12 +671,15 @@ PRIVATE APTR pb_AllocExpansion( ULONG portid, BASEPTR )
|
|||||||
switch(ios2->ios2_Req.io_Command)
|
switch(ios2->ios2_Req.io_Command)
|
||||||
{
|
{
|
||||||
case CMD_READ:
|
case CMD_READ:
|
||||||
|
/*
|
||||||
if (pb->pb_Flags & PLIPF_OFFLINE)
|
if (pb->pb_Flags & PLIPF_OFFLINE)
|
||||||
{
|
{
|
||||||
ios2->ios2_Req.io_Error = S2ERR_OUTOFSERVICE;
|
ios2->ios2_Req.io_Error = S2ERR_OUTOFSERVICE;
|
||||||
ios2->ios2_WireError = S2WERR_UNIT_OFFLINE;
|
ios2->ios2_WireError = S2WERR_UNIT_OFFLINE;
|
||||||
}
|
}
|
||||||
else if (ios2->ios2_BufferManagement == NULL)
|
else
|
||||||
|
*/
|
||||||
|
if (ios2->ios2_BufferManagement == NULL)
|
||||||
{
|
{
|
||||||
ios2->ios2_Req.io_Error = S2ERR_BAD_ARGUMENT;
|
ios2->ios2_Req.io_Error = S2ERR_BAD_ARGUMENT;
|
||||||
ios2->ios2_WireError = S2WERR_BUFF_ERROR;
|
ios2->ios2_WireError = S2WERR_BUFF_ERROR;
|
||||||
@@ -684,7 +688,7 @@ PRIVATE APTR pb_AllocExpansion( ULONG portid, BASEPTR )
|
|||||||
{
|
{
|
||||||
ios2->ios2_Req.io_Flags &= ~SANA2IOF_QUICK;
|
ios2->ios2_Req.io_Flags &= ~SANA2IOF_QUICK;
|
||||||
ObtainSemaphore(&pb->pb_ReadListSem);
|
ObtainSemaphore(&pb->pb_ReadListSem);
|
||||||
AddTail((struct List*)&pb->pb_ReadList, (struct Node*)ios2);
|
AddHead((struct List*)&pb->pb_ReadList, (struct Node*)ios2);
|
||||||
ReleaseSemaphore(&pb->pb_ReadListSem);
|
ReleaseSemaphore(&pb->pb_ReadListSem);
|
||||||
ios2 = NULL;
|
ios2 = NULL;
|
||||||
}
|
}
|
||||||
@@ -806,7 +810,7 @@ PRIVATE APTR pb_AllocExpansion( ULONG portid, BASEPTR )
|
|||||||
case S2_GETTYPESTATS:
|
case S2_GETTYPESTATS:
|
||||||
if (!gettrackrec(pb, ios2->ios2_PacketType, (struct Sana2PacketTypeStats *)ios2->ios2_StatData))
|
if (!gettrackrec(pb, ios2->ios2_PacketType, (struct Sana2PacketTypeStats *)ios2->ios2_StatData))
|
||||||
{
|
{
|
||||||
ios2->ios2_Req.io_Error = S2ERR_BAD_STATE;
|
ios2->ios2_Req.io_Error = S2ERR_NO_ERROR; /*S2ERR_BAD_STATE;*/
|
||||||
ios2->ios2_WireError = S2WERR_NOT_TRACKED;
|
ios2->ios2_WireError = S2WERR_NOT_TRACKED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -29,12 +29,12 @@
|
|||||||
DEBUG EQU 1
|
DEBUG EQU 1
|
||||||
;
|
;
|
||||||
|
|
||||||
; FIXME: needs verification
|
;------------------ options, some depend on hardware (CPLD) configuration -------------------------
|
||||||
; also: either swap buffer or registers/pointers etc.
|
|
||||||
_OPT_BUFFER_SWAP EQU 1 ;perform byte swap on buffer ops (1) or assume native endian (0)
|
_OPT_BUFFER_SWAP EQU 1 ;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_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 1 ;address lines 12/13 are swapped (1) or linear addressing (0)
|
||||||
_OPT_FLOWCONTROL EQU 1 ;perform flow control on RX (1) or not (0)
|
_OPT_FLOWCONTROL EQU 1 ;perform flow control on RX (1) or not (0)
|
||||||
|
_OPT_RECV EQU 1 ;faster recv (1) or generic (0)
|
||||||
|
|
||||||
;
|
;
|
||||||
; options for buffer memory configuration, please reserve some space for private variables
|
; options for buffer memory configuration, please reserve some space for private variables
|
||||||
@@ -1662,6 +1662,34 @@ _enc624j6l_RecvFrame: ;
|
|||||||
;a1: dest pointer
|
;a1: dest pointer
|
||||||
move.l a1,a3
|
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
|
||||||
|
|
||||||
|
ifne _OPT_ADR_QUIRK
|
||||||
|
eor.w #$6000,d7
|
||||||
|
endc
|
||||||
|
lea (a0,d7.w),a2 ;read pointer
|
||||||
|
move d0,d1 ;byte count
|
||||||
|
lsr #1,d1 ;converted to word count
|
||||||
|
bcs.s .opt_read ;read 1 byte more if impair byte count
|
||||||
|
subq #1,d1 ;words - 1
|
||||||
|
.opt_read:
|
||||||
|
move (a2)+,d2 ;get current word
|
||||||
|
ifne _OPT_BUFFER_SWAP
|
||||||
|
rol.w #8,d2 ;swap buffer to Big Endian
|
||||||
|
endc
|
||||||
|
move d2,(a1)+
|
||||||
|
dbf d1,.opt_read
|
||||||
|
bra.s .end_read
|
||||||
|
.nooptrecv:
|
||||||
|
endc ;_OPT_RECV
|
||||||
|
|
||||||
;generic loop: check for position overflows with each word
|
;generic loop: check for position overflows with each word
|
||||||
move d0,d1 ;byte count
|
move d0,d1 ;byte count
|
||||||
lsr #1,d1 ;converted to word count
|
lsr #1,d1 ;converted to word count
|
||||||
@@ -1678,6 +1706,7 @@ _enc624j6l_RecvFrame: ;
|
|||||||
move d2,(a1)+
|
move d2,(a1)+
|
||||||
dbf d1,.generic_read
|
dbf d1,.generic_read
|
||||||
|
|
||||||
|
.end_read:
|
||||||
;frame copied, now advance HW pointer
|
;frame copied, now advance HW pointer
|
||||||
READREG PNextPacket,a0,d1 ;write pointer for next packet
|
READREG PNextPacket,a0,d1 ;write pointer for next packet
|
||||||
cmp #RXSTART_INIT,d1
|
cmp #RXSTART_INIT,d1
|
||||||
|
|||||||
@@ -421,19 +421,16 @@ GLOBAL REGARGS BOOL hw_send_frame(struct PLIPBase *pb, struct HWFrame *frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLOBAL REGARGS BOOL hw_recv_pending(struct PLIPBase *pb)
|
GLOBAL REGARGS LONG hw_recv_pending(struct PLIPBase *pb)
|
||||||
{
|
{
|
||||||
#ifdef PROTO_ENC624NET
|
#ifdef PROTO_ENC624NET
|
||||||
struct HWBase *hwb = &pb->pb_HWBase;
|
struct HWBase *hwb = &pb->pb_HWBase;
|
||||||
int num = enc624j6l_HaveRecv( BOARD );
|
LONG num = enc624j6l_HaveRecv( BOARD );
|
||||||
#else
|
#else
|
||||||
u08 num;
|
u08 num;
|
||||||
num = enc28j60_has_recv();
|
num = enc28j60_has_recv();
|
||||||
#endif
|
#endif
|
||||||
if( num > 0 )
|
return (LONG)num;
|
||||||
return TRUE;
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* important: don't call this without enc28j60_has_recv() > 0 check */
|
/* important: don't call this without enc28j60_has_recv() > 0 check */
|
||||||
@@ -446,13 +443,10 @@ GLOBAL REGARGS BOOL hw_recv_frame(struct PLIPBase *pb, struct HWFrame *frame)
|
|||||||
struct HWBase *hwb = &pb->pb_HWBase;
|
struct HWBase *hwb = &pb->pb_HWBase;
|
||||||
|
|
||||||
len = enc624j6l_RecvFrame( BOARD, ptr+sizeof(USHORT), 1518 );
|
len = enc624j6l_RecvFrame( BOARD, ptr+sizeof(USHORT), 1518 );
|
||||||
|
|
||||||
frame->hwf_Size = len;
|
frame->hwf_Size = len;
|
||||||
|
|
||||||
if( len > 0 )
|
if( len > 0 )
|
||||||
rc = TRUE;
|
rc = TRUE;
|
||||||
else
|
|
||||||
frame->hwf_Size = 0;
|
|
||||||
#else
|
#else
|
||||||
BOOL rc = FALSE;
|
BOOL rc = FALSE;
|
||||||
u08 *ptr = (u08*)frame;
|
u08 *ptr = (u08*)frame;
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ struct PLIPBase
|
|||||||
UBYTE pb_Unit; /* unit of 1st OpenDevice() */
|
UBYTE pb_Unit; /* unit of 1st OpenDevice() */
|
||||||
UBYTE pb_pad1; /* make the following long alligned */
|
UBYTE pb_pad1; /* make the following long alligned */
|
||||||
BPTR pb_SegList; /* pointer to code */
|
BPTR pb_SegList; /* pointer to code */
|
||||||
struct Library * pb_VampireBase;
|
struct Library * pb_VampireBase; /* used for sdnet only */
|
||||||
struct Library * pb_ExpansionBase;
|
struct Library * pb_ExpansionBase;
|
||||||
struct Library * pb_UtilityBase;
|
struct Library * pb_UtilityBase;
|
||||||
struct Library * pb_DOSBase;
|
struct Library * pb_DOSBase;
|
||||||
struct Library * pb_SysBase;
|
struct Library * pb_SysBase;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ GLOBAL REGARGS BOOL hw_send_frame(struct PLIPBase *pb, struct HWFrame *frame);
|
|||||||
GLOBAL REGARGS BOOL hw_send_magic_pkt(struct PLIPBase *pb, USHORT magic);
|
GLOBAL REGARGS BOOL hw_send_magic_pkt(struct PLIPBase *pb, USHORT magic);
|
||||||
|
|
||||||
GLOBAL REGARGS ULONG hw_recv_sigmask(struct PLIPBase *pb);
|
GLOBAL REGARGS ULONG hw_recv_sigmask(struct PLIPBase *pb);
|
||||||
GLOBAL REGARGS BOOL hw_recv_pending(struct PLIPBase *pb);
|
GLOBAL REGARGS LONG hw_recv_pending(struct PLIPBase *pb);
|
||||||
GLOBAL REGARGS BOOL hw_recv_frame(struct PLIPBase *pb, struct HWFrame *frame);
|
GLOBAL REGARGS BOOL hw_recv_frame(struct PLIPBase *pb, struct HWFrame *frame);
|
||||||
|
|
||||||
GLOBAL REGARGS void hw_config_init(struct PLIPBase *pb);
|
GLOBAL REGARGS void hw_config_init(struct PLIPBase *pb);
|
||||||
|
|||||||
+40
-29
@@ -48,6 +48,12 @@
|
|||||||
*/
|
*/
|
||||||
typedef enum { AW_OK, AW_BUFFER_ERROR, AW_ERROR } AW_RESULT;
|
typedef enum { AW_OK, AW_BUFFER_ERROR, AW_ERROR } AW_RESULT;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** definitions
|
||||||
|
*/
|
||||||
|
#define SINGLE_RW 1
|
||||||
|
|
||||||
|
|
||||||
/*E*/
|
/*E*/
|
||||||
/*F*/ /* imports */
|
/*F*/ /* imports */
|
||||||
/* external functions */
|
/* external functions */
|
||||||
@@ -234,13 +240,6 @@ PRIVATE REGARGS VOID dos2reqs(BASEPTR);
|
|||||||
nextwrite = (struct IOSana2Req *) currentwrite->ios2_Req.io_Message.mn_Node.ln_Succ;
|
nextwrite = (struct IOSana2Req *) currentwrite->ios2_Req.io_Message.mn_Node.ln_Succ;
|
||||||
currentwrite = nextwrite )
|
currentwrite = nextwrite )
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (hw_recv_pending(pb))
|
|
||||||
{
|
|
||||||
d(("incoming data!"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
code = write_frame(pb, currentwrite);
|
code = write_frame(pb, currentwrite);
|
||||||
|
|
||||||
if (code == AW_BUFFER_ERROR) /* BufferManagement callback error */
|
if (code == AW_BUFFER_ERROR) /* BufferManagement callback error */
|
||||||
@@ -683,8 +682,10 @@ PRIVATE REGARGS BOOL read_frame(struct IOSana2Req *req, struct HWFrame *frame)
|
|||||||
|
|
||||||
if (init(pb))
|
if (init(pb))
|
||||||
{
|
{
|
||||||
ULONG recv=0, portsigmask, recvsigmask, wmask;
|
ULONG recv=0, portsigmask, recvsigmask, wmask,specialmask;
|
||||||
|
LONG haverec;
|
||||||
BOOL running;
|
BOOL running;
|
||||||
|
struct IOSana2Req *wr;
|
||||||
|
|
||||||
/* Ok, we are fine and will tell this mother personally :-) */
|
/* Ok, we are fine and will tell this mother personally :-) */
|
||||||
pb->pb_Startup->ss_Error = 0;
|
pb->pb_Startup->ss_Error = 0;
|
||||||
@@ -693,8 +694,9 @@ PRIVATE REGARGS BOOL read_frame(struct IOSana2Req *req, struct HWFrame *frame)
|
|||||||
pb->pb_Flags &= ~PLIPF_REPLYSS;
|
pb->pb_Flags &= ~PLIPF_REPLYSS;
|
||||||
ReplyMsg((struct Message*)pb->pb_Startup);
|
ReplyMsg((struct Message*)pb->pb_Startup);
|
||||||
|
|
||||||
portsigmask = 1 << pb->pb_ServerPort->mp_SigBit;
|
portsigmask = 1 << pb->pb_ServerPort->mp_SigBit;
|
||||||
recvsigmask = hw_recv_sigmask(pb);
|
recvsigmask = hw_recv_sigmask(pb);
|
||||||
|
specialmask = portsigmask | SIGBREAKF_CTRL_C;
|
||||||
|
|
||||||
wmask = SIGBREAKF_CTRL_F | SIGBREAKF_CTRL_C | portsigmask | recvsigmask;
|
wmask = SIGBREAKF_CTRL_F | SIGBREAKF_CTRL_C | portsigmask | recvsigmask;
|
||||||
|
|
||||||
@@ -706,38 +708,47 @@ PRIVATE REGARGS BOOL read_frame(struct IOSana2Req *req, struct HWFrame *frame)
|
|||||||
|
|
||||||
/* send packets if any */
|
/* send packets if any */
|
||||||
d2(("*+ do_write\n"));
|
d2(("*+ do_write\n"));
|
||||||
dowritereqs(pb);
|
wr = (struct IOSana2Req *)pb->pb_WriteList.lh_Head;
|
||||||
|
if( wr->ios2_Req.io_Message.mn_Node.ln_Succ )
|
||||||
|
{
|
||||||
|
dowritereqs(pb);
|
||||||
|
}
|
||||||
d2(("*- do_write\n"));
|
d2(("*- do_write\n"));
|
||||||
|
|
||||||
/* if no recv is pending then wait for incoming signals */
|
/* if no recv is pending then wait for incoming signals */
|
||||||
if (!hw_recv_pending(pb)) {
|
haverec = hw_recv_pending(pb);
|
||||||
d2(("**> wait\n"));
|
if( !haverec )
|
||||||
recv = Wait(wmask);
|
{
|
||||||
d2(("**> wait: got 0x%08lx\n", recv));
|
d2(("**> wait\n"));
|
||||||
|
recv = Wait(wmask);
|
||||||
|
d2(("**> wait: got 0x%08lx\n", recv));
|
||||||
|
haverec = hw_recv_pending(pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* accept pending receive and start reading */
|
/* accept pending receive and start reading */
|
||||||
if (hw_recv_pending(pb))
|
if( haverec )
|
||||||
{
|
{
|
||||||
d2(("*+ do_read\n"));
|
d2(("*+ do_read\n"));
|
||||||
doreadreqs(pb);
|
doreadreqs(pb);
|
||||||
d2(("*- do_read\n"));
|
d2(("*- do_read\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* handle SANA-II send requests */
|
|
||||||
if (recv & portsigmask)
|
|
||||||
{
|
|
||||||
d(("SANA-II request(s)\n"));
|
|
||||||
dos2reqs(pb);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* stop server task */
|
if( recv & specialmask )
|
||||||
if (recv & SIGBREAKF_CTRL_C)
|
{
|
||||||
{
|
/* handle SANA-II send requests */
|
||||||
d(("received break signal\n"));
|
if (recv & portsigmask)
|
||||||
running = FALSE;
|
{
|
||||||
}
|
d(("SANA-II request(s)\n"));
|
||||||
|
dos2reqs(pb);
|
||||||
|
recv &= ~portsigmask;
|
||||||
|
}
|
||||||
|
/* stop server task */
|
||||||
|
if (recv & SIGBREAKF_CTRL_C)
|
||||||
|
{
|
||||||
|
d(("received break signal\n"));
|
||||||
|
running = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user