User`s manual

Dynamic C Users Manual digi.com 133
FS2_USE_PROGRAM_FLASH
The number of kilobytes reserved in the first flash for use by FS2. If not defined in an application, it
defaults to zero, meaning that the first flash is not used by FS2. The actual amount of flash used by FS2 is
determined by the minimum of this macro and XMEM_RESERVE_SIZE.
XMEM_RESERVE_SIZE
This macro is the number of bytes (which must be a multiple of 4096) reserved in the first flash for use by
FS2 and possibly other customer-defined purposes. This is defined as 0x0000. Memory set aside with
XMEM_RESERVE_SIZE will NOT be available for xmem code.
This macro is defined in the BIOS prior to Dynamic C version 9.30 and in memconfig.lib thereafter.
10.1.2.3 FS2 and Use of the First Flash
To use the first flash in FS2, follow these steps:
1. Define XMEM_RESERVE_SIZE (currently set to 0x0000) to the number of bytes to allocate in the first
flash for the file system.
2. Define FS2_USE_PROGRAM_FLASH to the number of KB (1024 bytes) to allocate in the first flash
for the file system. Do this in the application code before #use "fs2.lib".
3. Obtain the LX
i
number of the first flash: Call fs_get_other_lx()when there are two flash memo-
ries; call fs_get_flash_lx() when there is only one.
4. If desired, create additional logical extents by calling the FS2 function fs_setup() to further parti-
tion the device. This function can also change the logical sector sizes of an extent. Please see the func-
tion description for fs_setup() in the Dynamic C Function Reference Manual for more
information.
Example Code Using First Flash in FS2
If the target board has two flash memories, the following code will cause the file system to use the first
flash:
FSLXnum flash1; // logical extent number
File f; // struct for file information
flash1 = fs_get_other_lx();
if (flash1) {
fs_set_lx(flash1, flash1);
fcreate(&f, 10);
. . .
}
To obtain the logical extent number for a one flash board, fs_get_flash_lx() must be called instead
of fs_get_other_lx().
i. For a description of logical extents please see Section 10.1.4.2, “Logical Extents (LX),” on
page 136.