avr: use NETMSG functions, increase waiting times.

This commit is contained in:
Martin Preuss
2025-03-25 00:38:12 +01:00
parent aee2c384c8
commit cac611deae
4 changed files with 24 additions and 24 deletions

View File

@@ -82,7 +82,7 @@ checkFlash_end:
flashProcess: flashProcess:
rcall Flash_Init rcall Flash_Init
flashProcess_loop1: flashProcess_loop1:
; wait up to 10s for incoming FLASH_DATA message ; wait up to 20s for incoming FLASH_DATA message
ldi r16, CPRO_CMD_FLASH_DATA ldi r16, CPRO_CMD_FLASH_DATA
rcall ioWaitForGivenMsg ; (r16, r17, r18, r19, r20, r22, X) rcall ioWaitForGivenMsg ; (r16, r17, r18, r19, r20, r22, X)
brcc flashProcess_end ; no FLASH_DATA or FLASH_END msg brcc flashProcess_end ; no FLASH_DATA or FLASH_END msg
@@ -244,7 +244,7 @@ flashProcessWriteFlashRsp:
st X+, r17 ; src address (not used) st X+, r17 ; src address (not used)
st X+, r16 ; payload byte st X+, r16 ; payload byte
sbiw xh:xl, 5 sbiw xh:xl, 5
rcall com2CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X) rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 6 sbiw xh:xl, 6
ret ret
; @end ; @end
@@ -284,7 +284,7 @@ flashProcessWriteFlashReady:
st X+, r16 st X+, r16
sbiw xh:xl, 22 ; go back to beginning of message sbiw xh:xl, 22 ; go back to beginning of message
rcall com2CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X) rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 23 ; go back to beginning of message sbiw xh:xl, 23 ; go back to beginning of message
ret ret
; @end ; @end

View File

@@ -25,7 +25,7 @@
; @clobbers: r16, r17, r20, X (r18, r19, r22) ; @clobbers: r16, r17, r20, X (r18, r19, r22)
ioWaitForGivenMsg: ioWaitForGivenMsg:
ldi r20, 10 ; number of tries ldi r20, 100 ; number of tries
ioWaitForGivenMsg_loop: ioWaitForGivenMsg_loop:
push r16 push r16
push r20 push r20

View File

@@ -124,8 +124,8 @@ ioRawSendMsg_attnHigh:
ioRawWaitForValidMsg: ioRawWaitForValidMsg:
ldi r16, 0 ; expect ATTN low ldi r16, 0 ; expect ATTN low
ldi r17, 100 ldi r17, 200
rcall ioWaitForAttnState100ms ; wait for up to 10s rcall ioWaitForAttnState100ms ; wait for up to 20s
brcs ioRawWaitForValidMsg_attnLow brcs ioRawWaitForValidMsg_attnLow
ret ret
ioRawWaitForValidMsg_attnLow: ioRawWaitForValidMsg_attnLow:
@@ -138,12 +138,12 @@ ioRawWaitForValidMsg_attnLow:
ret ret
ioRawWaitForValidMsg_packetReceived: ioRawWaitForValidMsg_packetReceived:
ldi r16, 0xff ; expect ATTN high ldi r16, 0xff ; expect ATTN high
ldi r17, 100 ldi r17, 200
rcall ioWaitForAttnState100ms ; wait for up to 10s rcall ioWaitForAttnState100ms ; wait for up to 20s
brcc ioRawWaitForValidMsg_end brcc ioRawWaitForValidMsg_end
ldi xl, LOW(flashRecvBuffer) ldi xl, LOW(flashRecvBuffer)
ldi xh, HIGH(flashRecvBuffer) ldi xh, HIGH(flashRecvBuffer)
rcall com2CheckMessageInBuffer ; (R16, R17, R18, R19, R20, X) rcall NETMSG_CheckMessageInBuffer
ioRawWaitForValidMsg_end: ioRawWaitForValidMsg_end:
ret ret
; @end ; @end

View File

@@ -132,7 +132,7 @@ ioRecvMsg:
brcc ioRecvMsg_error brcc ioRecvMsg_error
push xl push xl
push xh push xh
rcall com2CheckMessageInBuffer ; (R16, R17, R18, R19, R20, X) rcall NETMSG_CheckMessageInBuffer ; (R16, R17, R18, R19, R20, X)
pop xh pop xh
pop xl pop xl
brcs ioRecvMsg_end brcs ioRecvMsg_end