User`s manual

RX600 & RX200 Series Simple Flash API for RX
R01AN0544EU0250 Rev.2.50 Page 25 of 33
March 4, 2014
4.6 R_FlashDataAreaBlankCheck
This function is used to determine if an area in the Data Flash area is blank or not, since this cannot be
determined by simply reading the memory location. This function is required because the user cannot
read data flash locations and check they are blank by comparing them to 0xFF.
Format
uint8_t R_FlashDataAreaBlankCheck(uint32_t address, uint8_t size);
Parameters
address
The address of the area to blank check.
If the parameter 'size'=='BLANK_CHECK_SMALLEST', this should be set to an appropriate address
boundary based upon the smallest blank check size. The smallest blank check size is the same as the
smallest program size for the data flash.
If the parameter 'size' is specified as 'BLANK_CHECK_ENTIRE_BLOCK' this should be set to a
defined Data Block Number ('BLOCK_DB0', 'BLOCK_DB1', 'BLOCK_DB2' or 'BLOCK_DB3') or an
address in the data flash block. Either option will work.
size
This specifies if you are checking an entire flash block or a smaller memory area. The size of the
smaller memory area will match the smallest programming size of the data flash for the MCU being
used. You must set this to either 'BLANK_CHECK_SMALLEST' or 'BLANK_CHECK_ENTIRE_BLOCK'.
Return Values
FLASH_BLANK: (Small memory area check or non-BGO) Address was blank.
(Entire Block & BGO) Blank check operation started.
FLASH_NOT_BLANK: Address was not blank
FLASH_FAILURE: Operation Failed
FLASH_BUSY: Another flash operation is in progress
FLASH_ERROR_ADDRESS: Invalid address was input
FLASH_ERROR_BYTES: Incorrect 'size' was submitted
FLASH_ERROR_ALIGNED: Address not on programming boundary (only required when ‘size !=
BLANK_CHECK_ENTIRE_BLOCK)
Properties
Prototyped in file “r_flash_api_rx_if.h
Implemented in file “r_flash_api_rx.c
Description
Before you can write to any flash area in an MCU, the area must already be blank. Since the memory
locations in RX600 and RX200 Series Data Flash areas are not represented by a defined ‘blank’ value of
0xFF like they are in the User Program area, an additional function is needed to test a section of flash to
determine if it is blank.
RX600 and RX200 Series devices have two methods for checking for blank areas; one checks a smaller
area and the other a larger area. The number of bytes checked by the smaller method is same as the
programming size for the data flash (i.e. 8 bytes on RX610 and RX62x, 2 bytes on RX63x). The larger check
performs the blank check on the entire Data Flash block at once. This function does not have to be called for
each section prior to programming. It is simply here to assist in application programming.
Reentrant
No, but is protected by lock to prevent errors from concurrent function calls.