mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-11-13 20:04:37 +00:00
8279ef4d63
Up to now every IP65 library contained exactly one Ethernet driver. In scenarios without strict memory limitations I might however be benefitial to have an IP65 library containing all Ethernet drivers available for a given target. The Ethernet hardware detection that was already present before is used in this scenario to try to initialize one Ethernet driver after the other until one succeeds. If all drivers fail to initialize the user gets informed as usual. The WIZ811MJ driver was primarily introduced for orthogonality reasons. There are however at least two W5100-based prototypes for the C64 so it makes at least some sense. The name was chosen as sort of placeholder for "something containing a W5100 chip".
96 lines
2.1 KiB
ArmAsm
96 lines
2.1 KiB
ArmAsm
; Wrapper for Contiki ethernet driver
|
|
|
|
.include "../inc/common.i"
|
|
|
|
.export eth_init
|
|
.export eth_rx
|
|
.export eth_tx
|
|
|
|
.import eth_inp
|
|
.import eth_inp_len
|
|
.import eth_outp
|
|
.import eth_outp_len
|
|
|
|
.import eth
|
|
.import eth_driver_io_base
|
|
|
|
.import cfg_mac
|
|
|
|
.struct driver
|
|
drvtype .byte 3
|
|
apiver .byte
|
|
mac .byte 6
|
|
bufaddr .addr
|
|
bufsize .word
|
|
init .byte 3
|
|
poll .byte 3
|
|
send .byte 3
|
|
exit .byte 3
|
|
.endstruct
|
|
|
|
|
|
.code
|
|
|
|
; initialize the ethernet adaptor
|
|
; inputs: none
|
|
; outputs: carry flag is set if there was an error, clear otherwise
|
|
eth_init:
|
|
ldax eth_driver_io_base
|
|
jsr eth+driver::init
|
|
ldx #5
|
|
: lda eth+driver::mac,x
|
|
sta cfg_mac,x
|
|
dex
|
|
bpl :-
|
|
ldax #1518
|
|
stax eth+driver::bufsize
|
|
rts
|
|
|
|
; receive a packet
|
|
; inputs: none
|
|
; outputs:
|
|
; if there was an error receiving the packet (or no packet was ready) then carry flag is set
|
|
; if packet was received correctly then carry flag is clear,
|
|
; eth_inp contains the received packet,
|
|
; and eth_inp_len contains the length of the packet
|
|
eth_rx:
|
|
ldax #eth_inp
|
|
stax eth+driver::bufaddr
|
|
jsr eth+driver::poll
|
|
stax eth_inp_len
|
|
rts
|
|
|
|
; send a packet
|
|
; inputs:
|
|
; eth_outp: packet to send
|
|
; eth_outp_len: length of packet to send
|
|
; outputs:
|
|
; if there was an error sending the packet then carry flag is set
|
|
; otherwise carry flag is cleared
|
|
eth_tx:
|
|
ldax #eth_outp
|
|
stax eth+driver::bufaddr
|
|
ldax eth_outp_len
|
|
jmp eth+driver::send
|
|
|
|
|
|
|
|
; -- LICENSE FOR ethernet.s --
|
|
; The contents of this file are subject to the Mozilla Public License
|
|
; Version 1.1 (the "License"); you may not use this file except in
|
|
; compliance with the License. You may obtain a copy of the License at
|
|
; http://www.mozilla.org/MPL/
|
|
;
|
|
; Software distributed under the License is distributed on an "AS IS"
|
|
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
; License for the specific language governing rights and limitations
|
|
; under the License.
|
|
;
|
|
; The Original Code is ip65.
|
|
;
|
|
; The Initial Developer of the Original Code is Jonno Downes,
|
|
; jonno@jamtronix.com.
|
|
; Portions created by the Initial Developer are Copyright (C) 2009
|
|
; Jonno Downes. All Rights Reserved.
|
|
; -- LICENSE END --
|