avr: use NETMSG functions, increase waiting times.
This commit is contained in:
@@ -82,7 +82,7 @@ checkFlash_end:
|
||||
flashProcess:
|
||||
rcall Flash_Init
|
||||
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
|
||||
rcall ioWaitForGivenMsg ; (r16, r17, r18, r19, r20, r22, X)
|
||||
brcc flashProcess_end ; no FLASH_DATA or FLASH_END msg
|
||||
@@ -244,7 +244,7 @@ flashProcessWriteFlashRsp:
|
||||
st X+, r17 ; src address (not used)
|
||||
st X+, r16 ; payload byte
|
||||
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
|
||||
ret
|
||||
; @end
|
||||
@@ -259,33 +259,33 @@ flashProcessWriteFlashRsp:
|
||||
|
||||
flashProcessWriteFlashReady:
|
||||
ldi r16, 0xff
|
||||
st X+, r16 ; dest address (unused)
|
||||
ldi r16, 20 ; msg code+src address+18 payload bytes
|
||||
st X+, r16 ; msg len
|
||||
st X+, r16 ; dest address (unused)
|
||||
ldi r16, 20 ; msg code+src address+18 payload bytes
|
||||
st X+, r16 ; msg len
|
||||
ldi r16, CPRO_CMD_FLASH_READY
|
||||
st X+, r16 ; msg code
|
||||
st X+, r16 ; msg code
|
||||
ldi r16, COM2_MAINTENANCE_ADDR
|
||||
st X+, r16 ; src address
|
||||
st X+, r16 ; src address
|
||||
|
||||
; payload
|
||||
ldi yh, HIGH(flashUid) ; 4 bytes
|
||||
ldi yh, HIGH(flashUid) ; 4 bytes
|
||||
ldi yl, LOW(flashUid)
|
||||
ldi r18, 4
|
||||
rcall Utils_Copy_SDRAM ; (R17, R18, X, Y)
|
||||
rcall Utils_Copy_SDRAM ; (R17, R18, X, Y)
|
||||
|
||||
ldi zl, LOW(devInfoBlock*2) ; 12 bytes
|
||||
ldi zl, LOW(devInfoBlock*2) ; 12 bytes
|
||||
ldi zh, HIGH(devInfoBlock*2)
|
||||
ldi r18, 12
|
||||
rcall Utils_CopyFromFlash ; (R16, R18, X, Z)
|
||||
rcall Utils_CopyFromFlash ; (R16, R18, X, Z)
|
||||
|
||||
ldi r16, LOW(PAGESIZE*2) ; 2 bytes
|
||||
ldi r16, LOW(PAGESIZE*2) ; 2 bytes
|
||||
st X+, r16
|
||||
ldi r16, HIGH(PAGESIZE*2)
|
||||
st X+, r16
|
||||
|
||||
sbiw xh:xl, 22 ; go back to beginning of message
|
||||
rcall com2CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
|
||||
sbiw xh:xl, 23 ; go back to beginning of message
|
||||
sbiw xh:xl, 22 ; go back to beginning of message
|
||||
rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
|
||||
sbiw xh:xl, 23 ; go back to beginning of message
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
; @clobbers: r16, r17, r20, X (r18, r19, r22)
|
||||
|
||||
ioWaitForGivenMsg:
|
||||
ldi r20, 10 ; number of tries
|
||||
ldi r20, 100 ; number of tries
|
||||
ioWaitForGivenMsg_loop:
|
||||
push r16
|
||||
push r20
|
||||
|
||||
@@ -123,9 +123,9 @@ ioRawSendMsg_attnHigh:
|
||||
; @clobbers: r16, r17 (r18, r19, r20, r21, r22, X)
|
||||
|
||||
ioRawWaitForValidMsg:
|
||||
ldi r16, 0 ; expect ATTN low
|
||||
ldi r17, 100
|
||||
rcall ioWaitForAttnState100ms ; wait for up to 10s
|
||||
ldi r16, 0 ; expect ATTN low
|
||||
ldi r17, 200
|
||||
rcall ioWaitForAttnState100ms ; wait for up to 20s
|
||||
brcs ioRawWaitForValidMsg_attnLow
|
||||
ret
|
||||
ioRawWaitForValidMsg_attnLow:
|
||||
@@ -137,13 +137,13 @@ ioRawWaitForValidMsg_attnLow:
|
||||
brcs ioRawWaitForValidMsg_packetReceived
|
||||
ret
|
||||
ioRawWaitForValidMsg_packetReceived:
|
||||
ldi r16, 0xff ; expect ATTN high
|
||||
ldi r17, 100
|
||||
rcall ioWaitForAttnState100ms ; wait for up to 10s
|
||||
ldi r16, 0xff ; expect ATTN high
|
||||
ldi r17, 200
|
||||
rcall ioWaitForAttnState100ms ; wait for up to 20s
|
||||
brcc ioRawWaitForValidMsg_end
|
||||
ldi xl, LOW(flashRecvBuffer)
|
||||
ldi xh, HIGH(flashRecvBuffer)
|
||||
rcall com2CheckMessageInBuffer ; (R16, R17, R18, R19, R20, X)
|
||||
rcall NETMSG_CheckMessageInBuffer
|
||||
ioRawWaitForValidMsg_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -132,7 +132,7 @@ ioRecvMsg:
|
||||
brcc ioRecvMsg_error
|
||||
push xl
|
||||
push xh
|
||||
rcall com2CheckMessageInBuffer ; (R16, R17, R18, R19, R20, X)
|
||||
rcall NETMSG_CheckMessageInBuffer ; (R16, R17, R18, R19, R20, X)
|
||||
pop xh
|
||||
pop xl
|
||||
brcs ioRecvMsg_end
|
||||
|
||||
Reference in New Issue
Block a user