UTHERNET drivers optimisation/bugfix

This commit is contained in:
Rémy GIBERT 2016-04-18 22:15:34 +02:00
parent 5e5a1a42cb
commit ebb4ef0618
2 changed files with 53 additions and 28 deletions

View File

@ -3,7 +3,7 @@ PREFIX /A2OSX.SRC
LOMEM $C00
INC 1
AUTO 6
.LIST OFF
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/DRV/UTHERNET.DRV
@ -43,10 +43,10 @@ PP.RxCTL.ExtradataA .EQ %01000000.00000000
PP.TxCFG .EQ $0106 Transmit Configuration (RW)
PP.TxCMD .EQ $0108 Receiver Control (RW)
PP.TxCMD.LID .EQ %00000000.00001001
PP.TxCMD.TxStart5 .EQ %00000000.00000000 00 = start after 5 Bytes
PP.TxCMD.TxStart381 .EQ %00000000.01000000 01 = start after 381 Bytes
PP.TxCMD.TxStart1021 .EQ %00000000.10000000 10 = start after 1021 Bytes
PP.TxCMD.TxStartFULL .EQ %00000000.11000000 11 = start after ENTIRE Frame
PP.TxCMD.TxStart5 .EQ %00000000.00000000
PP.TxCMD.TxStart381 .EQ %00000000.01000000
PP.TxCMD.TxStart1021 .EQ %00000000.10000000
PP.TxCMD.TxStartFULL .EQ %00000000.11000000
PP.TxCMD.Force .EQ %00000001.00000000
PP.TxCMD.OneColl .EQ %00000010.00000000
PP.TxCMD.InhibitCRC .EQ %00010000.00000000
@ -155,17 +155,31 @@ Dev.Detect sta hArgs
.3 stx DEVSLOTx0
lda hARGS
bne .4
lda #$00
sta MAC
lda #$0E
sta MAC+1
lda #$3A
sta MAC+2
lda A2osX.RANDOM16
eor A2osX.TIMER16
sta MAC+3
eor A2osX.RANDOM16+1
sta MAC+4
eor A2osX.TIMER16+1
sta MAC+5
bra .8
beq .4
>SYSCALL SYS.GetMemPtrA
.4 >SYSCALL SYS.GetMemPtrA
>STYA ZPTmpPTR
jsr DecodeMac
bcc .4
bcc .8
lda #DEVMGR.ERRICL
sec
rts
.4 >LDYA L.MSG.DETECT.OK
.8 >LDYA L.MSG.DETECT.OK
>SYSCALL SYS.PSTROutYA
>LDYA L.DEV.HEADER.NAME
>SYSCALL SYS.PSTROutYA
@ -319,7 +333,7 @@ GETEVENT.RxOK and /PP.RxEvent.Brdcast
CLOSE jsr Reset
clc
rts
*--------------------------------------
*--------------------------------------
GETINFO lda #S.DEVINFO.NET.STATUS.10
sta LINK.STATUS
@ -346,7 +360,7 @@ GETINFO lda #S.DEVINFO.NET.STATUS.10
.2 >LDYA L.DEVINFO
clc
rts
*--------------------------------------
*--------------------------------------
SEND >PULLW ZPTmpPTR
lda (ZPTmpPTR)
@ -359,14 +373,6 @@ SEND >PULLW ZPTmpPTR
eor #$ff
sta Counter+1
ldy #S.ETH.SRCMAC+5
ldx #5
.10 lda MAC,x
sta (ZPTmpPTR),y
dey
dex
bpl .10
ldx DEVSLOTx0
>LDYAI PP.TxCMD.LID+PP.TxCMD.TxStartFULL
>STYA TxCMD,x
@ -394,7 +400,16 @@ SEND >PULLW ZPTmpPTR
sec
rts
SENDPREADY ldy #2
SENDPREADY ldy #S.ETH.SRCMAC+5
ldx #5
.10 lda MAC,x
sta (ZPTmpPTR),y
dey
dex
bpl .10
ldx DEVSLOTx0
ldy #2
.1 inc Counter
bne .11
@ -428,13 +443,13 @@ Reset ldx DEVSLOTx0
>LDYAI PP.SelfCTL.LID+PP.SelfCTL.RESET
>STYA PacketPageDATA,x
rts
*--------------------------------------
*--------------------------------------
DRV.CS.END
*--------------------------------------
*--------------------------------------
DEVSLOTx0 .BS 1
Size .BS 2
Counter .BS 2
*--------------------------------------
*--------------------------------------
DEVINFO .DA #S.DEVINFO.TYPE.NET
DEVFLAGS .DA #0
MAC .BS 6

View File

@ -174,8 +174,8 @@ Dev.Detect sta hArgs
.INB DRV/X.NET.DRV.S
*--------------------------------------
CS.END
MSG.DETECT >PSTRING "UtherNetII/W5100 Driver.\n"
MSG.DETECT.OK >PSTRING "UtherNetII/W5100 Installed As Device : "
MSG.DETECT >PSTRING "UtherNet2/W5100 Driver.\n"
MSG.DETECT.OK >PSTRING "UtherNet2/W5100 Installed As Device : "
MSG.DETECT.KO >PSTRING "Hardware Not Found.\n"
hArgs .BS 1
*--------------------------------------
@ -383,7 +383,17 @@ SEND >PULLW ZPTmpPTR
sec
rts
SEND.READY >AR.SELECT S0.TX.WR
SEND.READY ldy #S.ETH.SRCMAC+5
ldx #5
.1 lda MAC,x
sta (ZPTmpPTR),y
dey
dex
bpl .1
ldx DEVSLOTx8
>AR.SELECT S0.TX.WR
lda W5100.DR,x Get HI
ldy W5100.DR,x Get LO
and /RXTX.MASK
@ -418,8 +428,8 @@ SEND.READY >AR.SELECT S0.TX.WR
lda Offset+1
adc RXTX.Size+1
and /RXTX.MASK
ora /TX.BASE
* and /RXTX.MASK
* ora /TX.BASE
sta W5100.DR,x write HI
pla
sta W5100.DR,x write LO