void flash_program_word(uint32_t address, uint32_t data) { /* Ensure that all flash operations are complete. */ flash_wait_for_last_operation(); flash_set_program_size(FLASH_CR_PROGRAM_X32); /* Enable writes to flash. */ FLASH_CR |= FLASH_CR_PG; /* Program the word. */ MMIO32(address) = data; /* Wait for the write to complete. */ flash_wait_for_last_operation(); /* Disable writes to flash. */ FLASH_CR &= ~FLASH_CR_PG; }
void flash_program_word(u32 address, u32 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. */ MMIO32(address) = data; /* Wait for the write to complete. */ flash_wait_for_last_operation(); /* Disable writes to flash. */ FLASH_CR &= ~FLASH_PG; }
/* For pin_conf_normal value see scu.h define SCU_CONF_XXX or Configuration for * different I/O pins types */ void scu_pinmux(scu_grp_pin_t group_pin, uint32_t scu_conf) { MMIO32(group_pin) = scu_conf; }