1 memcpy_rx(), Flash management, Memcpy_rx() – Maxim Integrated 78M6612 M-API Library User Manual
Page 37

UG_6612_036
78M6612 M-API Library User Guide
Rev. 1.00
37
4.8 Flash Management
4.8.1 Memcpy_rx()
Purpose
Write to Flash the content data from a specific RAM location. If the length of the
source and the starting ROM location cause the write operation to span more than
one 512-byte Flash page, the Read/Erase/Verify/Write will take place on all the
pages involved. An erase operation will result in the Flash contents being set to
0xFF. CE will be disabled during execution of this API. After the write, this API will
validate the write by comparing the Flash content against the RAM content and the
return code is reflected from this comparison.
Note1: When calling this API, CE must be turned off. See MAPI_CEOff and
MAPI_CEOn
APIs in the sections above.
Note2: it is the task of the application to setup the specific Flash bank before calling
this API. An example use of this API is as follows:
ok = memcpy_rx ((int8r_t *) ROMData, (int8x_t *) RAMData, ROMSIZE);
Synopsis
Bool memcpy_rx ( Unsigned char code *dst,
Unsigned char xdata *src,
Unsigned integer len );
Parameters
dst
Input parameter.
Specifies starting ROM address of Flash to be written (destination).
src
Input parameter.
Use contents at this RAM address location as the source data.
len
Input parameter.
Length (in bytes) of data to write to Flash.
Return Codes
TRUE if the Write was successful.
FALSE if the Write was not completed.
Note: To avoid accidental write to Flash, this function requires a ‘flash write’ confirmation from the
application layer. This confirmation is done such as follows: there shall be a function called
get_buff()
, at application level, which returns a pointer of Xdata whose content is checked as
the following:
uint8x_t xdata *bptr;
bptr = get_buff ();
if ((']' == toupper (*(bptr + 0)) && 'U' == toupper (*(bptr + 1))) ||
(')' == toupper (*(bptr + 0)) && 'U' == toupper (*(bptr + 1))) ||
('C' == toupper (*(bptr + 0)) && 'A' == toupper (*(bptr + 1))) ||
('C' == toupper (*(bptr + 0)) && 'L' == toupper (*(bptr + 1))) ||
('C' == toupper (*(bptr + 1)) && 'C' == toupper (*(bptr + 2))) ||
('U' == toupper (*(bptr + 1)) && 'C' == toupper (*(bptr + 2))) ||
('U' == toupper (*(bptr + 1)) && 'M' == toupper (*(bptr + 2)))
)
uint8x_t *get_buff (void)
{
return Bufptr;
}