User`s manual

68 rabbit.com The System Identification and User Blocks
writeUserBlockArray
int writeUserBlockArray(unsigned addr, void* sources[], unsigned
numbytes[], int numsources);
DESCRIPTION
Rabbit-based boards are released with System ID blocks located on the primary flash. Version 2
and later of this ID block has a pointer to a User block that can be used for storing calibration con-
stants, passwords, and other non-volatile data. The User block is protected from normal write to
the flash device and can only be accessed through this function or writeUserBlock().
This function writes a set of scattered data from root memory to the User block. If the data to be
written is in contiguous bytes, using the function writeUserBlock()is sufficient. Use of
writeUserBlockArray() is recommended when the data to be written is in noncontiguous
bytes, as may be the case for something like network configuration data. See the Rabbit Micro-
processor Designer's Handbook for more information about the System ID and User blocks.
Backwards Compatibility:
If the System ID block on the board doesn't support the User block, or no System ID block is pres-
ent, then the 8K bytes starting 16K bytes from the top of the primary flash are designated User
block area. This only works if the flash type is small sector. Rabbit manufactured boards with large
sector flash will have valid System ID and User blocks, so is not a problem on Rabbit-based
boards. If users create boards with large sector flash, they must install System ID blocks version
3 or greater to use this function, or modify this function.
PARAMETERS
addr Address offset in the User block to write to.
sources Array of pointer to sources to copy data from.
numbytes Array of number of bytes to copy for each source. The sum of the lengths
in this array must not exceed 32767 bytes, or an error will be returned.
numsources Number of data sources.
RETURN VALUE
0: Successful.
-1: Invalid address or range.
-2: No valid User block found (block version 3 or later).
-3: Flash writing error.
LIBRARY
IDBLOCK.LIB