Merge pull request #100 from oliverschmidt/master
Do not reject frames with a length exactly equal to the uIP bufer size.
This commit is contained in:
commit
bfc1e816de
@ -39,7 +39,7 @@
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
.byte $65, $74, $68 ; "eth"
|
.byte $65, $74, $68 ; "eth"
|
||||||
.byte $01 ; Ethernet driver API version number
|
.byte $01 ; Ethernet driver API version number
|
||||||
|
|
||||||
; Ethernet address
|
; Ethernet address
|
||||||
mac: .byte $00, $0E, $3A ; OUI of Cirrus Logic
|
mac: .byte $00, $0E, $3A ; OUI of Cirrus Logic
|
||||||
.byte $11, $11, $11
|
.byte $11, $11, $11
|
||||||
@ -67,13 +67,13 @@ cnt: .res 2 ; Frame length counter
|
|||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
|
||||||
.segment "EXTZP": zeropage
|
.segment "EXTZP": zeropage
|
||||||
|
|
||||||
; Empty segment to avoid linker warnings
|
; Empty segment to avoid linker warnings
|
||||||
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
fixup: .byte fixup02-fixup01, fixup03-fixup02, fixup04-fixup03
|
fixup: .byte fixup02-fixup01, fixup03-fixup02, fixup04-fixup03
|
||||||
.byte fixup05-fixup04, fixup06-fixup05, fixup07-fixup06
|
.byte fixup05-fixup04, fixup06-fixup05, fixup07-fixup06
|
||||||
.byte fixup08-fixup07, fixup09-fixup08, fixup10-fixup09
|
.byte fixup08-fixup07, fixup09-fixup08, fixup10-fixup09
|
||||||
@ -243,16 +243,16 @@ fixup29:lda rxtxreg
|
|||||||
bne :+
|
bne :+
|
||||||
inc cnt+1
|
inc cnt+1
|
||||||
|
|
||||||
; Is cnt > bufsize ?
|
; Is bufsize < cnt ?
|
||||||
: sec
|
: sec
|
||||||
lda cnt
|
lda bufsize
|
||||||
sbc bufsize
|
sbc cnt
|
||||||
lda cnt+1
|
lda bufsize+1
|
||||||
sbc bufsize+1
|
sbc cnt+1
|
||||||
bcc :+
|
bcs :+
|
||||||
|
|
||||||
; Yes, skip frame
|
; Yes, skip frame
|
||||||
; PACKETPP = $0102, PPDATA = PPDATA | $0040
|
; PACKETPP = $0102, PPDATA = PPDATA | $0040
|
||||||
lda #$02
|
lda #$02
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup30:sta packetpp
|
fixup30:sta packetpp
|
||||||
@ -260,7 +260,7 @@ fixup31:stx packetpp+1
|
|||||||
fixup32:lda ppdata
|
fixup32:lda ppdata
|
||||||
ora #$40
|
ora #$40
|
||||||
fixup33:sta ppdata
|
fixup33:sta ppdata
|
||||||
|
|
||||||
; No frame ready
|
; No frame ready
|
||||||
lda #$00
|
lda #$00
|
||||||
tax
|
tax
|
||||||
@ -272,7 +272,7 @@ fixup33:sta ppdata
|
|||||||
sta ptr
|
sta ptr
|
||||||
stx ptr+1
|
stx ptr+1
|
||||||
ldx cnt+1
|
ldx cnt+1
|
||||||
ldy #$00
|
ldy #$00
|
||||||
read:
|
read:
|
||||||
fixup34:lda rxtxreg
|
fixup34:lda rxtxreg
|
||||||
sta (ptr),y
|
sta (ptr),y
|
||||||
@ -298,7 +298,7 @@ send:
|
|||||||
; Save frame length
|
; Save frame length
|
||||||
sta cnt
|
sta cnt
|
||||||
stx cnt+1
|
stx cnt+1
|
||||||
|
|
||||||
; Transmit command
|
; Transmit command
|
||||||
lda #$C0
|
lda #$C0
|
||||||
ldx #$00
|
ldx #$00
|
||||||
@ -318,7 +318,7 @@ fixup39:stx txlen+1
|
|||||||
|
|
||||||
; 8 retries
|
; 8 retries
|
||||||
: ldy #$08
|
: ldy #$08
|
||||||
|
|
||||||
; Check for avaliable buffer space
|
; Check for avaliable buffer space
|
||||||
; PACKETPP = $0138, PPDATA & $0100 ?
|
; PACKETPP = $0138, PPDATA & $0100 ?
|
||||||
: lda #$38
|
: lda #$38
|
||||||
@ -330,7 +330,7 @@ fixup42:lda ppdata+1
|
|||||||
bne :+
|
bne :+
|
||||||
|
|
||||||
; No space avaliable, skip a received frame
|
; No space avaliable, skip a received frame
|
||||||
; PACKETPP = $0102, PPDATA = PPDATA | $0040
|
; PACKETPP = $0102, PPDATA = PPDATA | $0040
|
||||||
lda #$02
|
lda #$02
|
||||||
ldx #$01
|
ldx #$01
|
||||||
fixup43:sta packetpp
|
fixup43:sta packetpp
|
||||||
@ -372,5 +372,5 @@ fixup48:sta rxtxreg+1
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
; Driver signature
|
; Driver signature
|
||||||
.byte $65, $74, $68 ; "eth"
|
.byte $65, $74, $68 ; "eth"
|
||||||
.byte $01 ; Ethernet driver API version number
|
.byte $01 ; Ethernet driver API version number
|
||||||
|
|
||||||
; Ethernet address
|
; Ethernet address
|
||||||
mac: .byte $00, $80, $0F ; OUI of Standard Microsystems
|
mac: .byte $00, $80, $0F ; OUI of Standard Microsystems
|
||||||
.byte $11, $11, $11
|
.byte $11, $11, $11
|
||||||
@ -67,13 +67,13 @@ len: .res 2 ; Frame length
|
|||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
|
||||||
.segment "EXTZP": zeropage
|
.segment "EXTZP": zeropage
|
||||||
|
|
||||||
; Empty segment to avoid linker warnings
|
; Empty segment to avoid linker warnings
|
||||||
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
fixup: .byte fixup02-fixup01, fixup03-fixup02, fixup04-fixup03
|
fixup: .byte fixup02-fixup01, fixup03-fixup02, fixup04-fixup03
|
||||||
.byte fixup05-fixup04, fixup06-fixup05, fixup07-fixup06
|
.byte fixup05-fixup04, fixup06-fixup05, fixup07-fixup06
|
||||||
.byte fixup08-fixup07, fixup09-fixup08, fixup10-fixup09
|
.byte fixup08-fixup07, fixup09-fixup08, fixup10-fixup09
|
||||||
@ -153,7 +153,7 @@ init:
|
|||||||
lda reg+1
|
lda reg+1
|
||||||
sta (ptr),y
|
sta (ptr),y
|
||||||
dey
|
dey
|
||||||
|
|
||||||
; Advance to next fixup location
|
; Advance to next fixup location
|
||||||
inx
|
inx
|
||||||
cpx #fixups
|
cpx #fixups
|
||||||
@ -169,7 +169,7 @@ init:
|
|||||||
; Reset ETH card
|
; Reset ETH card
|
||||||
: lda #$00 ; Bank 0
|
: lda #$00 ; Bank 0
|
||||||
fixup00:sta ethbsr
|
fixup00:sta ethbsr
|
||||||
|
|
||||||
lda #%10000000 ; Software reset
|
lda #%10000000 ; Software reset
|
||||||
fixup01:sta ethrcr+1
|
fixup01:sta ethrcr+1
|
||||||
|
|
||||||
@ -192,14 +192,14 @@ fixup05:stx ethrcr+1
|
|||||||
|
|
||||||
lda #$01 ; Bank 1
|
lda #$01 ; Bank 1
|
||||||
fixup06:sta ethbsr
|
fixup06:sta ethbsr
|
||||||
|
|
||||||
fixup07:lda ethcr+1
|
fixup07:lda ethcr+1
|
||||||
ora #%00010000 ; No wait (IOCHRDY)
|
ora #%00010000 ; No wait (IOCHRDY)
|
||||||
fixup08:sta ethcr+1
|
fixup08:sta ethcr+1
|
||||||
|
|
||||||
lda #%00001001 ; Auto release
|
lda #%00001001 ; Auto release
|
||||||
fixup09:sta ethctr+1
|
fixup09:sta ethctr+1
|
||||||
|
|
||||||
; Set MAC address
|
; Set MAC address
|
||||||
lda mac
|
lda mac
|
||||||
ldx mac+1
|
ldx mac+1
|
||||||
@ -217,11 +217,11 @@ fixup15:stx ethiar+5
|
|||||||
; Set interrupt mask
|
; Set interrupt mask
|
||||||
lda #$02 ; Bank 2
|
lda #$02 ; Bank 2
|
||||||
fixup16:sta ethbsr
|
fixup16:sta ethbsr
|
||||||
|
|
||||||
lda #%00000000 ; No interrupts
|
lda #%00000000 ; No interrupts
|
||||||
fixup17:sta ethmsk
|
fixup17:sta ethmsk
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
|
||||||
poll:
|
poll:
|
||||||
@ -253,7 +253,7 @@ fixup22:lda ethdata ; Need high byte only
|
|||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
|
|
||||||
; The packet contains 3 extra words
|
; The packet contains 3 extra words
|
||||||
fixup23:lda ethdata ; Total number of bytes
|
fixup23:lda ethdata ; Total number of bytes
|
||||||
sbc #$05 ; Actually 5 or 6 depending on carry
|
sbc #$05 ; Actually 5 or 6 depending on carry
|
||||||
@ -262,13 +262,13 @@ fixup24:lda ethdata
|
|||||||
sbc #$00
|
sbc #$00
|
||||||
sta len+1
|
sta len+1
|
||||||
|
|
||||||
; Is len > bufsize ?
|
; Is bufsize < len ?
|
||||||
sec
|
sec
|
||||||
lda len
|
lda bufsize
|
||||||
sbc bufsize
|
sbc len
|
||||||
lda len+1
|
lda bufsize+1
|
||||||
sbc bufsize+1
|
sbc len+1
|
||||||
bcc :+
|
bcs :+
|
||||||
|
|
||||||
; Yes, skip packet
|
; Yes, skip packet
|
||||||
; Remove and release RX packet from the FIFO
|
; Remove and release RX packet from the FIFO
|
||||||
@ -285,8 +285,8 @@ fixup25:sta ethmmucr
|
|||||||
ldx bufaddr+1
|
ldx bufaddr+1
|
||||||
sta ptr
|
sta ptr
|
||||||
stx ptr+1
|
stx ptr+1
|
||||||
ldx len+1
|
ldx len+1
|
||||||
ldy #$00
|
ldy #$00
|
||||||
read:
|
read:
|
||||||
fixup26:lda ethdata
|
fixup26:lda ethdata
|
||||||
sta (ptr),y
|
sta (ptr),y
|
||||||
@ -297,7 +297,7 @@ fixup26:lda ethdata
|
|||||||
bne read
|
bne read
|
||||||
dex
|
dex
|
||||||
bpl read
|
bpl read
|
||||||
|
|
||||||
; Remove and release RX packet from the FIFO
|
; Remove and release RX packet from the FIFO
|
||||||
lda #%10000000
|
lda #%10000000
|
||||||
fixup27:sta ethmmucr
|
fixup27:sta ethmmucr
|
||||||
@ -395,8 +395,8 @@ fixup39:sta ethdata
|
|||||||
bcc :+
|
bcc :+
|
||||||
|
|
||||||
; Yes
|
; Yes
|
||||||
lda #%00100000 ; ODD
|
lda #%00100000 ; ODD
|
||||||
bne :++ ; Always
|
bne :++ ; Always
|
||||||
|
|
||||||
; No
|
; No
|
||||||
: lda #$00
|
: lda #$00
|
||||||
@ -413,5 +413,5 @@ fixup42:sta ethmmucr
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user