Download Dynamic C Function Reference Manual

Transcript
fs_init (FS2)
int fs_init( long reserveblocks, int num_blocks );
DESCRIPTION
Initialize the filesystem. The static structure _fs contains information that defines the number
and parameters associated with each extent or “partition.” This function must be called before
any of the other functions in this library, except for fs_setup(), fs_get_*_lx() and
fs_get_lx_size().
Pre-main initialization will create up to 3 devices:
• The second flash device (if available on the board)
• Battery-backed SRAM (if FS2_RAM_RESERVE defined)
• The first (program) flash (if both XMEM_RESERVE_SIZE and
FS2_USE_PROGRAM_FLASH defined)
The LX numbers of the default devices can be obtained using the fs_get_flash_lx(),
fs_get_ram_lx() and fs_get_other_lx() calls. If none of these devices can be set
up successfully, fs_init() will return ENOSPC when called.
This function performs complete consistency checks and, if necessary, fixups for each LX. It
may take up to several seconds to run. It should only be called once at application initialization
time.
Note: When using µC/OS-II, fs_init() must be called before OSInit().
PARAMETERS
reserveblocks
num_blocks
Must be zero. Retained for backward compatibility.
Ignored (backward compatibility).
RETURN VALUE
0: Success.
!0: Failure.
ERRNO VALUES
EINVAL - the reserveblocks parameter was non-zero.
EIO - I/O error. This indicates a hardware problem.
ENOMEM - Insufficient memory for required buffers.
ENOSPC - No valid extents obtained e.g. there is no recognized flash or RAM memory device
available.
LIBRARY
fs2.lib
SEE ALSO
fs_setup (FS2), fs_get_flash_lx (FS2)
156
rabbit.com
Dynamic C Functions