void flash_program_double_word(u32 address, u64 data, u32 program_size) { /* Ensure that all flash operations are complete. */ flash_wait_for_last_operation(); flash_set_program_size(program_size); /* Enable writes to flash. */ FLASH_CR |= FLASH_PG; /* Program the first half of the word. */ MMIO64(address) = data; /* Wait for the write to complete. */ flash_wait_for_last_operation(); /* Disable writes to flash. */ FLASH_CR &= ~FLASH_PG; }
void flash_program_double_word(uint32_t address, uint64_t data) { /* Ensure that all flash operations are complete. */ flash_wait_for_last_operation(); flash_set_program_size(FLASH_CR_PROGRAM_X64); /* Enable writes to flash. */ FLASH_CR |= FLASH_CR_PG; /* Program the first half of the word. */ MMIO64(address) = data; /* Wait for the write to complete. */ flash_wait_for_last_operation(); /* Disable writes to flash. */ FLASH_CR &= ~FLASH_CR_PG; }