Skip to content

Commit 1c349c3

Browse files
authored
Merge pull request #7 from erique/eth-fixes
Fix AmiTCP online/offline issue
2 parents beaa06f + 6d7f247 commit 1c349c3

File tree

5 files changed

+32
-29
lines changed

5 files changed

+32
-29
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ SUBDIRS := $(dir $(wildcard */Makefile))
66

77
.PHONY: all clean release
88

9-
release: replay.rom poseidon.rom
10-
@7z a replay_rom_`git describe --always --dirty`.zip $^
11-
129
all: replay.rom
1310
@echo "** $@ done"
1411

12+
release: replay.rom poseidon.rom
13+
@7z a replay_rom_`git describe --always --dirty`.zip $^
14+
1515
clean: $(addprefix clean-,$(SUBDIRS:/=))
1616
rm -rf replay.rom
1717
@echo "** $@ done"

build_rom.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
romtool -v build -o replay.rom -t ext -s 64 -e f00000 -a f00010 -r 01.05 -f bootrom/bootrom.bin addmem/AddReplayMem poseidon/PoseidonLoader rtc/battclock.resource usb/usb_eth.autoconfig usb/replayusb.device
4+
romtool -v build -o replay.rom -t ext -s 64 -e f00000 -a f00010 -r 01.06 -f bootrom/bootrom.bin addmem/AddReplayMem poseidon/PoseidonLoader rtc/battclock.resource usb/usb_eth.autoconfig usb/replayusb.device eth/replayeth.device
55
printf "000001: 11" | xxd -r - replay.rom
66
romtool copy -c replay.rom replay.rom
77
romtool info replay.rom

eth/replayeth.device

32 Bytes
Binary file not shown.

eth/replayeth.s

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ VFULL MACRO
8383
ENDM
8484

8585
VERSION EQU 1
86-
REVISION EQU 0
86+
REVISION EQU 1
8787

8888
VSTR MACRO
89-
dc.b '1.0'
89+
dc.b '1.1'
9090
ENDM
9191

9292
VDATE MACRO
93-
dc.b '01.10.2019'
94-
ENDM
93+
dc.b '06.04.2020'
94+
ENDM
9595

9696
; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9797

@@ -188,7 +188,7 @@ ETHER_ADDR_SIZE = 6
188188
BITDEF STATE,PROMISCUOUS,1 ; set if OpenUnit was promiscuous (matches SANA2OPB_PROM)
189189
BITDEF STATE,ACQUIRED,2 ; set if OpenDevice has acquired the hardware
190190
BITDEF STATE,CONFIGURED,3 ; set if S2_CONFIGINTERFACE was successful
191-
BITDEF STATE,ONLINE,4 ; set if S2_ONLINE was successful
191+
BITDEF STATE,PAUSED,4 ; set if S2_OFFLINE was successful
192192
BITDEF STATE,LINKUP,5 ; set if the PHY Ethernet link has been established
193193
BITDEF STATE,TXINUSE,7 ; transfer in flight - tx buffer in use
194194

@@ -437,6 +437,13 @@ OpenDevice: ; ( unitnum:d0, flags:d1, iob:a1, device:a6 )
437437
bsr AcquireHardware
438438
beq.b .failed
439439

440+
; if returning to a CONFIGURED device, then enable NIC, unless PAUSED
441+
btst #STATEB_CONFIGURED,g_State(a6)
442+
beq.b .skipNIC
443+
btst #STATEB_PAUSED,g_State(a6)
444+
bne.b .skipNIC
445+
bsr HW_EnableNIC
446+
.skipNIC
440447
clr.b IO_ERROR(a1)
441448
move.b #NT_REPLYMSG,LN_TYPE(a1)
442449

@@ -1183,8 +1190,8 @@ CmdRead
11831190

11841191
btst #STATEB_CONFIGURED,g_State(a6)
11851192
beq .noconfig
1186-
btst #STATEB_ONLINE,g_State(a6)
1187-
beq .notonline
1193+
btst #STATEB_PAUSED,g_State(a6)
1194+
bne .notonline
11881195

11891196
move.l IOS2_BUFFERMANAGEMENT(a1),d0
11901197
beq .noctx
@@ -1227,8 +1234,8 @@ CmdReadOrphan
12271234

12281235
btst #STATEB_CONFIGURED,g_State(a6)
12291236
beq .noconfig
1230-
btst #STATEB_ONLINE,g_State(a6)
1231-
beq .notonline
1237+
btst #STATEB_PAUSED,g_State(a6)
1238+
bne .notonline
12321239

12331240
move.l IOS2_BUFFERMANAGEMENT(a1),d0
12341241
beq .noctx
@@ -1275,8 +1282,8 @@ CmdWrite
12751282

12761283
btst #STATEB_CONFIGURED,g_State(a6)
12771284
beq .noconfig
1278-
btst #STATEB_ONLINE,g_State(a6)
1279-
beq .notonline
1285+
btst #STATEB_PAUSED,g_State(a6)
1286+
bne .notonline
12801287

12811288
move.l IOS2_BUFFERMANAGEMENT(a1),d0
12821289
beq .noctx
@@ -1400,11 +1407,8 @@ CmdConfigInterface
14001407

14011408
bset #STATEB_CONFIGURED,g_State(a6)
14021409

1403-
; Genesis WTF?
1404-
; Genesis/NetConnect3/AmiTCP will put the interface ONLINE first
1405-
; and then CONFIGURE, assuming the ONLINE state is sticky..
1406-
bclr #STATEB_ONLINE,g_State(a6)
1407-
bne CmdOnline
1410+
bset #STATEB_PAUSED,g_State(a6)
1411+
beq CmdOnline
14081412

14091413
.done
14101414
bra.w TermIO
@@ -1525,9 +1529,8 @@ CmdOnline
15251529
kprintf "S2_ONLINE"
15261530
kprintf_reset_color
15271531

1528-
; Genesis WTF? - see note in CmdConfigInterface
1529-
bset #STATEB_ONLINE,g_State(a6)
1530-
bne.b .terminate
1532+
bclr #STATEB_PAUSED,g_State(a6)
1533+
beq.b .terminate
15311534

15321535
btst #STATEB_CONFIGURED,g_State(a6)
15331536
beq.b .noconfig
@@ -1550,8 +1553,8 @@ CmdOffline
15501553
kprintf "S2_OFFLINE"
15511554
kprintf_reset_color
15521555

1553-
bclr #STATEB_ONLINE,g_State(a6)
1554-
beq.b .offline
1556+
bset #STATEB_PAUSED,g_State(a6)
1557+
bne.b .offline
15551558

15561559
moveq.l #S2ERR_OUTOFSERVICE,d0
15571560
moveq.l #S2WERR_UNIT_OFFLINE,d1
@@ -1581,8 +1584,8 @@ CmdOnEvent
15811584
; already in the state to be waited for.
15821585

15831586
moveq.l #S2EVENT_ONLINE,d0
1584-
btst #STATEB_ONLINE,g_State(a6)
1585-
beq.b .offline
1587+
btst #STATEB_PAUSED,g_State(a6)
1588+
bne.b .offline
15861589
.check and.l IOS2_WIREERROR(a1),d0
15871590
beq.b .enqueue
15881591

@@ -1888,8 +1891,8 @@ AcquireHardware ; ( unitnum:d0, flags:d1, iob:a1, device:a6 )
18881891
ReleaseHardware ; ( device:a6 )
18891892
kprintf "ReleaseHardware"
18901893

1891-
bclr #STATEB_ONLINE,g_State(a6)
1892-
beq.b .offline
1894+
bclr #STATEB_PAUSED,g_State(a6)
1895+
bne.b .offline
18931896

18941897
kprintf " NIC online - going offline"
18951898

replay.rom

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)