avr: send firmware version in FLASH_READY and DEVICE messages.
This commit is contained in:
@@ -26,21 +26,21 @@
|
|||||||
; REGS: R3, R4, R16, R17, R18, X (R19, R20, R21)
|
; REGS: R3, R4, R16, R17, R18, X (R19, R20, R21)
|
||||||
|
|
||||||
CPRO_WriteDevice:
|
CPRO_WriteDevice:
|
||||||
ldi r17, COM2_PAYLOAD_FLAGS_UID | (8<<COM2_PAYLOAD_FLAGS_SHIFT_NUM)
|
ldi r17, COM2_PAYLOAD_FLAGS_UID | (12<<COM2_PAYLOAD_FLAGS_SHIFT_NUM)
|
||||||
ldi r18, CPRO_CMD_DEVICE
|
ldi r18, CPRO_CMD_DEVICE
|
||||||
rcall COM2_BeginMsgWithVariablePayload ; (R3, R4, R16, R17, R18, R19, R20, R21, X)
|
rcall COM2_BeginMsgWithVariablePayload ; (R3, R4, R16, R17, R18, R19, R20, R21, X)
|
||||||
push yh
|
push yh
|
||||||
push yl
|
push yl
|
||||||
ldi zh, HIGH(devInfoBlock*2) ; 6-13: devInfoBlock
|
ldi zh, HIGH(devInfoBlock*2) ; 6-17: devInfoBlock
|
||||||
ldi zl, LOW(devInfoBlock*2)
|
ldi zl, LOW(devInfoBlock*2)
|
||||||
ldi r18, 8
|
ldi r18, 12
|
||||||
rcall Utils_CopyFromFlash ; (R17, R18, X, Y)
|
rcall Utils_CopyFromFlash ; (R17, R18, X, Y)
|
||||||
pop yl
|
pop yl
|
||||||
pop yh
|
pop yh
|
||||||
|
|
||||||
sbiw xh:xl, 16 ; go back to beginning of message (1 byte dst addr, 1 byte length, 14 bytes payload)
|
sbiw xh:xl, 20 ; go back to beginning of message (1 byte dst addr, 1 byte length, 14 bytes payload)
|
||||||
rcall com2CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
|
rcall com2CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
|
||||||
sbiw xh:xl, 17 ; go back to beginning of message (1 byte dst addr, 1 byte length, 14 bytes payload, 1 byte crc)
|
sbiw xh:xl, 21 ; go back to beginning of message (1 byte dst addr, 1 byte length, 14 bytes payload, 1 byte crc)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
flashWriteFlashReady:
|
flashWriteFlashReady:
|
||||||
ldi r16, 0xff
|
ldi r16, 0xff
|
||||||
st X+, r16 ; dest address (unused)
|
st X+, r16 ; dest address (unused)
|
||||||
ldi r16, 16 ; msg code+src address+14 payload bytes
|
ldi r16, 20 ; msg code+src address+18 payload bytes
|
||||||
st X+, r16 ; msg len
|
st X+, r16 ; msg len
|
||||||
ldi r16, CPRO_CMD_FLASH_READY
|
ldi r16, CPRO_CMD_FLASH_READY
|
||||||
st X+, r16 ; msg code
|
st X+, r16 ; msg code
|
||||||
@@ -42,9 +42,9 @@ flashWriteFlashReady:
|
|||||||
ldi r18, 4
|
ldi r18, 4
|
||||||
rcall Utils_Copy_SDRAM
|
rcall Utils_Copy_SDRAM
|
||||||
|
|
||||||
ldi zl, low(devInfoBlock*2) ; 8 bytes
|
ldi zl, low(devInfoBlock*2) ; 12 bytes
|
||||||
ldi zh, HIGH(devInfoBlock*2)
|
ldi zh, HIGH(devInfoBlock*2)
|
||||||
ldi r18, 8
|
ldi r18, 12
|
||||||
rcall Utils_CopyFromFlash
|
rcall Utils_CopyFromFlash
|
||||||
|
|
||||||
ldi r16, LOW(PAGESIZE*2) ; 2 bytes
|
ldi r16, LOW(PAGESIZE*2) ; 2 bytes
|
||||||
@@ -52,9 +52,9 @@ flashWriteFlashReady:
|
|||||||
ldi r16, HIGH(PAGESIZE*2)
|
ldi r16, HIGH(PAGESIZE*2)
|
||||||
st X+, r16
|
st X+, r16
|
||||||
|
|
||||||
sbiw xh:xl, 18 ; 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 com2CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
|
||||||
sbiw xh:xl, 19 ; go back to beginning of message
|
sbiw xh:xl, 23 ; go back to beginning of message
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user