<< Previous | Next >>

readUserBlock

int readUserBlock( void * dest, unsigned addr, unsigned numbytes );

Description

Reads a number of bytes from the User block on the primary flash to a buffer in root memory. Please note that portions of the User block may be used by the BIOS for your board to store values. For example, any board with an A to D converter will require the BIOS to write calibration constants to the User block. For some versions of the BL2000 and the BL2100 this memory area is 0x1C00 to 0x1FFF. See the user's manual for your particular board for more information before overwriting any part of the User block. Also, see the Rabbit Microprocessor Designer's Handbook for more information on the User block.

NOTE When using a board with serial bootflash (e.g., RCM4300, RCM4310), readUserBlockArray() should be called until it returns zero or a negative error code. A positive return value indicates that the SPI port needed by the serial flash is in use by another device. However, if using µC/OS-II and _SPI_USE_UCOS_MUTEX is #defined, then this function only needs to be called once. If the mutex times out waiting for the SPI port to free up, the run time error ERR_SPI_MUTEX_ERROR will occur. See the description for _rcm43_InitUCOSMutex() for more information on using µC/OS-II and _SPI_USE_UCOS_MUTEX.

Parameters

dest
Pointer to destination to copy data to.

addr
Address offset in User block to read from.

numbytes
Number of bytes to copy.

Return value

 0: Success
-1: Invalid address or range
-2: No valid ID block found (block version 3 or later)

The return values below are applicable only if _SPI_USE_UCOS_MUTEX is not #defined:
-ETIME: (Serial flash only, time out waiting for SPI)
postive N: (Serial flash only, SPI in use by device N)

Library

IDBLOCK.LIB

See also

writeUserBlock, readUserBlockArray


Dynamic C Functions << Previous | Next >> rabbit.com