mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 07:54:37 +00:00
UTHERNET2:Work in progress
This commit is contained in:
parent
9a5469388a
commit
6666db9b91
@ -13,17 +13,22 @@ AUTO 6
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
ZPTmpPTR .EQ ZPDRV
|
ZPTmpPTR .EQ ZPDRV
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
DEVID .EQ $630E
|
.MA AR.SELECT
|
||||||
|
lda /W5100.AR.]1
|
||||||
|
sta W5100.AR-$81,x
|
||||||
|
lda #W5100.AR.]1
|
||||||
|
sta W5100.AR-$80,x
|
||||||
|
.EM
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* WIZnet W5100 IO Registers
|
* WIZnet W5100 IO Registers
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
W5100.MR .EQ $C084 Mode Register
|
W5100.MR .EQ $C080 Mode Register
|
||||||
W5100.MR.RST .EQ %10000000
|
W5100.MR.RST .EQ %10000000
|
||||||
W5100.MR.PB .EQ %00010000
|
W5100.MR.PB .EQ %00010000
|
||||||
W5100.MR.PPPOE .EQ %00001000
|
W5100.MR.PPPOE .EQ %00001000
|
||||||
W5100.MR.AI .EQ %00000010
|
W5100.MR.AI .EQ %00000010
|
||||||
W5100.MR.IND .EQ %00000001
|
W5100.MR.IND .EQ %00000001
|
||||||
W5100.AR .EQ $C085 Memory Pointer
|
W5100.AR .EQ $C081 Memory Pointer
|
||||||
W5100.AR.GAR .EQ $0001
|
W5100.AR.GAR .EQ $0001
|
||||||
W5100.AR.SUBR .EQ $0005
|
W5100.AR.SUBR .EQ $0005
|
||||||
W5100.AR.SHAR .EQ $0009
|
W5100.AR.SHAR .EQ $0009
|
||||||
@ -55,7 +60,7 @@ W5100.AR.S0.TX.RD .EQ $0422
|
|||||||
W5100.AR.S0.TX.WR .EQ $0424
|
W5100.AR.S0.TX.WR .EQ $0424
|
||||||
W5100.AR.S0.RX.RSR .EQ $0426
|
W5100.AR.S0.RX.RSR .EQ $0426
|
||||||
W5100.AR.S0.RX.RD .EQ $0428
|
W5100.AR.S0.RX.RD .EQ $0428
|
||||||
W5100.DR .EQ $C087
|
W5100.DR .EQ $C083
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
ERRTNOFRAME .EQ 0
|
ERRTNOFRAME .EQ 0
|
||||||
ERRNOBUFFER .EQ 1
|
ERRNOBUFFER .EQ 1
|
||||||
@ -85,22 +90,24 @@ Dev.Detect sta hArgs
|
|||||||
>LDYA L.MSG.DETECT
|
>LDYA L.MSG.DETECT
|
||||||
>SYSCALL SYS.PSTROutYA
|
>SYSCALL SYS.PSTROutYA
|
||||||
|
|
||||||
ldx #$10
|
ldx #$10+$81
|
||||||
.1 stx DEVSLOTx0
|
.1 stx DEVSLOTxF
|
||||||
>LDYAI PP.ID
|
lda #W5100.MR.RST
|
||||||
>STYA PacketPagePTR,x
|
sta W5100.MR-$81,x
|
||||||
>LDYA PacketPageDATA,x
|
|
||||||
cpy #DEVID
|
lda #W5100.MR.AI+W5100.MR.IND
|
||||||
bne .2
|
sta W5100.MR-$81,x
|
||||||
cmp /DEVID
|
|
||||||
|
lda W5100.MR-$81,x
|
||||||
|
cmp #W5100.MR.AI+W5100.MR.IND
|
||||||
beq .3
|
beq .3
|
||||||
|
|
||||||
.2 inc DEV.HEADER.NAME+4
|
inc DEV.HEADER.NAME+4
|
||||||
txa
|
txa
|
||||||
clc
|
clc
|
||||||
adc #$10
|
adc #$10
|
||||||
tax
|
tax
|
||||||
cpx #$80
|
cpx #$80+$81
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
lda #DEVMGR.ERRNOHW
|
lda #DEVMGR.ERRNOHW
|
||||||
@ -185,7 +192,8 @@ DEV.HEADER cld
|
|||||||
jmp (DRV.CS.START,x)
|
jmp (DRV.CS.START,x)
|
||||||
.DA #S.DEV.F.SHARE+S.DEV.F.EVENT
|
.DA #S.DEV.F.SHARE+S.DEV.F.EVENT
|
||||||
DEV.HEADER.NAME >PSTRING "ETH1" NAME
|
DEV.HEADER.NAME >PSTRING "ETH1" NAME
|
||||||
.HS 00.00
|
.DA #DEVMGR.NET.CAP.ARPOFFLOAD
|
||||||
|
.HS 00
|
||||||
.HS 00.00.00.00
|
.HS 00.00.00.00
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Driver Code
|
* Driver Code
|
||||||
@ -207,29 +215,25 @@ L.DEVINFO .DA DEVINFO
|
|||||||
* CS on error
|
* CS on error
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
OPEN jsr Reset
|
OPEN jsr Reset
|
||||||
>LDYAI PP.RxCTL
|
>AR.SELECT SHAR
|
||||||
>STYA PacketPagePTR,x
|
|
||||||
>LDYAI PP.RxCTL.LID+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.BroadcastA
|
|
||||||
>STYA PacketPageDATA,x
|
|
||||||
|
|
||||||
>LDYAI PP.MAC
|
ldy #0
|
||||||
>STYA PacketPagePTR,x
|
.1 lda MAC,y
|
||||||
>LDYA MAC
|
sta W5100.DR-$81,x
|
||||||
>STYA PacketPageDATA,x
|
iny
|
||||||
>LDYAI PP.MAC+2
|
cpy #6
|
||||||
>STYA PacketPagePTR,x
|
bne .1
|
||||||
>LDYA MAC+2
|
|
||||||
>STYA PacketPageDATA,x
|
|
||||||
>LDYAI PP.MAC+4
|
|
||||||
>STYA PacketPagePTR,x
|
|
||||||
>LDYA MAC+4
|
|
||||||
>STYA PacketPageDATA,x
|
|
||||||
|
|
||||||
>LDYAI PP.LineCTL
|
>AR.SELECT RMSR
|
||||||
>STYA PacketPagePTR,x
|
lda #3 8k
|
||||||
>LDYAI PP.LineCTL.LID+PP.LineCTL.SerRxOn+PP.LineCTL.SerTxOn+PP.LineCTL.Auto
|
sta W5100.DR-$81,x ...for Socket0 RX Buffer
|
||||||
>STYA PacketPageDATA,x
|
sta W5100.DR-$81,x ...for Socket0 TX Buffer
|
||||||
|
|
||||||
|
>AR.SELECT S0.MR
|
||||||
|
lda #3 IPRAW
|
||||||
|
sta W5100.DR-$81,x for S0.MR
|
||||||
|
lda #1
|
||||||
|
sta W5100.DR-$81,x for S0.CR
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -239,23 +243,15 @@ OPEN jsr Reset
|
|||||||
* CC no event
|
* CC no event
|
||||||
* CS event
|
* CS event
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
GETEVENT ldx DEVSLOTx0
|
GETEVENT ldx DEVSLOTxF
|
||||||
>LDYAI PP.RxEvent
|
|
||||||
>STYA PacketPagePTR,x
|
|
||||||
>LDYA PacketPageDATA,x
|
|
||||||
and /PP.RxEvent.RxOK+PP.RxEvent.Brdcast+PP.RxEvent.IA
|
|
||||||
bne GETEVENT.RxOK
|
bne GETEVENT.RxOK
|
||||||
lda #ERRTNOFRAME
|
lda #ERRTNOFRAME
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
GETEVENT.RxOK
|
GETEVENT.RxOK
|
||||||
and /PP.RxEvent.Brdcast
|
|
||||||
beq .10
|
|
||||||
lda #$80
|
|
||||||
.10 ldy #S.EVT.DATAHI
|
|
||||||
sta (pEvent),y
|
|
||||||
>LDYA RTDATA,x discard RxStatus
|
|
||||||
>LDYA RTDATA,x get RxLength
|
|
||||||
>STYA FRAMELEN
|
>STYA FRAMELEN
|
||||||
>PUSHYA
|
>PUSHYA
|
||||||
>PUSHBI 0
|
>PUSHBI 0
|
||||||
@ -274,22 +270,8 @@ GETEVENT.RxOK
|
|||||||
lda #S.EVT.F.NET+S.EVT.F.hMEM1
|
lda #S.EVT.F.NET+S.EVT.F.hMEM1
|
||||||
sta (pEvent)
|
sta (pEvent)
|
||||||
ldy #0
|
ldy #0
|
||||||
ldx DEVSLOTx0
|
ldx DEVSLOTxF
|
||||||
|
|
||||||
.1 lda RTDATA,x
|
|
||||||
sta (ZPTmpPTR),y
|
|
||||||
iny
|
|
||||||
bne .2
|
|
||||||
inc ZPTmpPTR+1
|
|
||||||
.2 jsr DecFrameLen
|
|
||||||
beq .8
|
|
||||||
lda RTDATA+1,x
|
|
||||||
sta (ZPTmpPTR),y
|
|
||||||
iny
|
|
||||||
bne .3
|
|
||||||
inc ZPTmpPTR+1
|
|
||||||
.3 jsr DecFrameLen
|
|
||||||
bne .1
|
|
||||||
.8 clc
|
.8 clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -320,35 +302,7 @@ GETINFO >LDYA L.DEVINFO
|
|||||||
SEND >PULLW ZPTmpPTR
|
SEND >PULLW ZPTmpPTR
|
||||||
>PULLW FRAMELEN
|
>PULLW FRAMELEN
|
||||||
|
|
||||||
ldy #11 Add Src MAC Address
|
ldx DEVSLOTxF
|
||||||
ldx #5
|
|
||||||
.10 lda MAC,x
|
|
||||||
sta (ZPTmpPTR),y
|
|
||||||
dey
|
|
||||||
dex
|
|
||||||
bpl .10
|
|
||||||
|
|
||||||
ldx DEVSLOTx0
|
|
||||||
>LDYAI TxCMD.LID+TxCMD.TxStartFULL
|
|
||||||
>STYA TxCMD,x
|
|
||||||
>LDYA FRAMELEN
|
|
||||||
>STYA TxLength,x
|
|
||||||
>LDYAI PP.BusST
|
|
||||||
>STYA PacketPagePTR,x
|
|
||||||
|
|
||||||
ldy #16
|
|
||||||
.1 lda PacketPageDATA,x
|
|
||||||
and #PP.BusST.TxBidErr
|
|
||||||
bne .9
|
|
||||||
lda PacketPageDATA+1,x
|
|
||||||
and /PP.BusST.Rdy4TxNOW
|
|
||||||
bne SENDPREADY
|
|
||||||
bra *
|
|
||||||
lda #0
|
|
||||||
.2 dec
|
|
||||||
bne .2
|
|
||||||
dey
|
|
||||||
bne .1
|
|
||||||
bra *
|
bra *
|
||||||
lda #ERRTIMEOUT
|
lda #ERRTIMEOUT
|
||||||
sec
|
sec
|
||||||
@ -360,14 +314,15 @@ SEND >PULLW ZPTmpPTR
|
|||||||
|
|
||||||
SENDPREADY ldy #0
|
SENDPREADY ldy #0
|
||||||
.1 lda (ZPTmpPTR),y
|
.1 lda (ZPTmpPTR),y
|
||||||
sta RTDATA,x
|
|
||||||
iny
|
iny
|
||||||
bne .2
|
bne .2
|
||||||
inc ZPTmpPTR+1
|
inc ZPTmpPTR+1
|
||||||
.2 jsr DecFrameLen
|
.2 jsr DecFrameLen
|
||||||
beq .8
|
beq .8
|
||||||
.3 lda (ZPTmpPTR),y
|
.3 lda (ZPTmpPTR),y
|
||||||
sta RTDATA+1,x
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
bne .5
|
bne .5
|
||||||
inc ZPTmpPTR+1
|
inc ZPTmpPTR+1
|
||||||
@ -378,11 +333,9 @@ SENDPREADY ldy #0
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* PRIVATE
|
* PRIVATE
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
Reset ldx DEVSLOTx0
|
Reset ldx DEVSLOTxF
|
||||||
>LDYAI PP.SelfCTL
|
lda #W5100.MR.RST
|
||||||
>STYA PacketPagePTR,x
|
sta W5100.MR-$81,x
|
||||||
>LDYAI PP.SelfCTL.LID+PP.SelfCTL.RESET
|
|
||||||
>STYA PacketPageDATA,x
|
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
DecFrameLen lda FRAMELEN
|
DecFrameLen lda FRAMELEN
|
||||||
@ -396,7 +349,7 @@ DecFrameLen lda FRAMELEN
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
DRV.CS.END
|
DRV.CS.END
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
DEVSLOTx0 .BS 1
|
DEVSLOTxF .BS 1
|
||||||
FRAMELEN .BS 2
|
FRAMELEN .BS 2
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
DEVINFO .DA #S.DEVINFO.TYPE.NET
|
DEVINFO .DA #S.DEVINFO.TYPE.NET
|
||||||
|
Loading…
Reference in New Issue
Block a user