void flash_program_half_word(u32 address, u16 data, u32 program_size) { flash_wait_for_last_operation(); flash_set_program_size(program_size); FLASH_CR |= FLASH_PG; MMIO16(address) = data; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_PG; /* Disable the PG bit. */ }
void flash_program_half_word(uint32_t address, uint16_t data) { flash_wait_for_last_operation(); flash_set_program_size(FLASH_CR_PROGRAM_X16); FLASH_CR |= FLASH_CR_PG; MMIO16(address) = data; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_CR_PG; /* Disable the PG bit. */ }
void flash_program_option_bytes(uint32_t address, uint16_t data) { flash_wait_for_last_operation(); if ((FLASH_CR & FLASH_CR_OPTWRE) == 0) { flash_unlock_option_bytes(); } FLASH_CR |= FLASH_CR_OPTPG; /* Enable option byte programming. */ MMIO16(address) = data; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_CR_OPTPG; /* Disable option byte programming. */ }
void flash_program_half_word(uint32_t address, uint16_t data) { flash_wait_for_last_operation(); if ((MEMORY_SIZE_REG > 512) && (address >= FLASH_BASE+0x00080000)) FLASH_CR2 |= FLASH_CR_PG; else FLASH_CR |= FLASH_CR_PG; MMIO16(address) = data; flash_wait_for_last_operation(); if ((MEMORY_SIZE_REG > 512) && (address >= FLASH_BASE+0x00080000)) FLASH_CR2 &= ~FLASH_CR_PG; else FLASH_CR &= ~FLASH_CR_PG; }
void flash_program_half_word(uint32_t address, uint16_t data) { flash_wait_for_last_operation(); if ((DESIG_FLASH_SIZE > 512) && (address >= FLASH_BASE+0x00080000)) { FLASH_CR2 |= FLASH_CR_PG; } else { FLASH_CR |= FLASH_CR_PG; } MMIO16(address) = data; flash_wait_for_last_operation(); if ((DESIG_FLASH_SIZE > 512) && (address >= FLASH_BASE+0x00080000)) { FLASH_CR2 &= ~FLASH_CR_PG; } else { FLASH_CR &= ~FLASH_CR_PG; } }