User`s manual
RX600 & RX200 Series Simple Flash API for RX
R01AN0544EU0250 Rev.2.50 Page 29 of 33
March 4, 2014
4.9 R_FlashSetLockBitProtection
Enables or disables lock bit protection.
Format
uint8_t R_FlashSetLockBitProtection(uint32_t lock_bit);
Parameters
lock_bit
Boolean value that determines whether to enable or disable lock bit protection. If set to ‘true’ then lock
bit protection will be enabled. If set to ‘false’ then lock bit protection will be disabled.
Return Values
FLASH_SUCCESS: Operation was successful
FLASH_BUSY: Flash is busy with another operation
Properties
Prototyped in file “r_flash_api_rx_if.h”
Implemented in file “r_flash_api_rx.c”
Description
Each block of ROM has a lock bit associated with it. If lock bit protection is enabled and the lock bit is set for
a given block then that block cannot be programmed or erased. If an attempt to erase or program the block
is made, the operation will be ignored. This function controls whether lock bit protection is enabled. If
disabled then all flash blocks are eligible for programming and erasure regardless of whether their lock bit is
set or not.
Reentrant
No, but is protected by lock to prevent errors from concurrent function calls.
Example
uint8_t ret;
/* Enable lock bit protection (this is default out of reset) */
ret = R_FlashSetLockBitProtection(true);
/* Check for errors. */
if (FLASH_SUCCESS != ret)
{
. . .
}
Special Notes:
• Lock bits for a flash block are cleared by erasing the flash block with lock bit protection disabled.
• This function is not available for use when the FLASH_API_RX_CFG_IGNORE_LOCK_BITS macro
is defined in r_flash_api_rx_config.h.