avr: started working on flash protocol.
This commit is contained in:
@@ -1,19 +1,5 @@
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data
|
||||
|
||||
|
||||
.dseg
|
||||
|
||||
flashDataBegin:
|
||||
flashCurrentAddress: .byte 2
|
||||
flashLastReceivedMsg: .byte 2
|
||||
flashDataEnd:
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
@@ -31,7 +17,7 @@ Flash_StartPage:
|
||||
push zh
|
||||
push zl
|
||||
ldi r16, ((PAGESIZE*2)-1)
|
||||
and r16, zl
|
||||
and zl, r16
|
||||
rcall Flash_ReadPageIntoPageBuffer
|
||||
pop zl
|
||||
pop zh
|
||||
@@ -47,7 +33,7 @@ Flash_StartPage:
|
||||
|
||||
Flash_FinishPage:
|
||||
ldi r16, ((PAGESIZE*2)-1)
|
||||
and r16, zl
|
||||
and zl, r16
|
||||
rcall Flash_ErasePage
|
||||
rcall Flash_WritePage
|
||||
ret
|
||||
@@ -76,7 +62,7 @@ Flash_ReadPageIntoPageBuffer_loop:
|
||||
ldi r20, (1<<SPMEN) ; enable next SPM, write into temp page buffer
|
||||
rcall utilsDoSpm ; (R16)
|
||||
adiw ZH:ZL, 2
|
||||
sbiw r25:r24, 2 ;use subi for PAGESIZEB<=256
|
||||
sbiw r25:r24, 2 ; use subi for PAGESIZEB<=256
|
||||
brne Flash_ReadPageIntoPageBuffer_loop
|
||||
out SREG, r15
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user