flash: wait for ATTN high before waiting for message.

this helps with syncing.
This commit is contained in:
Martin Preuss
2025-05-07 20:03:58 +02:00
parent 9102d90c34
commit cc7ef0cf30

View File

@@ -101,8 +101,8 @@ ioRawInit:
ioRawSendMsg: ioRawSendMsg:
ioRawSendMsg_loop: ioRawSendMsg_loop:
ldi r16, 0xff ; expect ATTN high ldi r16, 0xff ; expect ATTN high
ldi r17, 3 ldi r17, 10
rcall ioWaitForAttnState100ms ; wait for up to 300ms rcall ioWaitForAttnState100ms ; wait for up to 1s
brcs ioRawSendMsg_attnHigh brcs ioRawSendMsg_attnHigh
ret ret
ioRawSendMsg_attnHigh: ioRawSendMsg_attnHigh:
@@ -117,12 +117,21 @@ ioRawSendMsg_attnHigh:
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; @routine ioRawWaitForValidMsg ; @routine ioRawWaitForValidMsg
;
; Wait for valid incoming msg ; Wait for valid incoming msg
; ;
; First waits for ATTN line to go high (released) then wait for ATTN
; line to go low. This way we will only start listening at the beginning of
; a message.
;
; @return CFLAG set if okay (packet received), cleared on error ; @return CFLAG set if okay (packet received), cleared on error
; @clobbers: r16, r17 (r18, r19, r20, r21, r22, X) ; @clobbers: r16, r17 (r18, r19, r20, r21, r22, X)
ioRawWaitForValidMsg: ioRawWaitForValidMsg:
ldi r16, 0xff ; expect ATTN high
ldi r17, 100
rcall ioWaitForAttnState100ms ; wait for up to 10s
brcc ioRawWaitForValidMsg_end ; ATTN not high, exit
ldi r16, 0 ; expect ATTN low ldi r16, 0 ; expect ATTN low
ldi r17, 100 ldi r17, 100
rcall ioWaitForAttnState100ms ; wait for up to 10s rcall ioWaitForAttnState100ms ; wait for up to 10s