Add higher level flash_program function for f2/f4 to write a buffer into flash.
This commit is contained in:
parent
410be2a39a
commit
4ad30d56b4
|
@ -143,6 +143,7 @@ void flash_program_double_word(u32 address, u64 data);
|
|||
void flash_program_word(u32 address, u32 data);
|
||||
void flash_program_half_word(u32 address, u16 data);
|
||||
void flash_program_byte(u32 address, u8 data);
|
||||
void flash_program(u32 address, u8* data, u32 len);
|
||||
void flash_wait_for_last_operation(void);
|
||||
void flash_program_option_bytes(u32 data);
|
||||
|
||||
|
|
|
@ -218,6 +218,15 @@ void flash_program_byte(u32 address, u8 data)
|
|||
FLASH_CR &= ~FLASH_CR_PG; /* Disable the PG bit. */
|
||||
}
|
||||
|
||||
void flash_program(u32 address, u8* data, u32 len)
|
||||
{
|
||||
/* TODO: Use dword and word size program operations where possible for turbo
|
||||
* speed. */
|
||||
u32 i;
|
||||
for (i=0; i<len; i++)
|
||||
flash_program_byte(address+i, data[i]);
|
||||
}
|
||||
|
||||
void flash_erase_sector(u8 sector, u32 program_size)
|
||||
{
|
||||
flash_wait_for_last_operation();
|
||||
|
|
Loading…
Reference in New Issue