...
Anchor
...
To use the NAND driver, you must include the following ten files in the build, in addition to the generic file system files: Anchor
...
FS_Init()
) must have previously been called....
...
Listing 15-1 Opening a NAND device volume
L15-1(1) Declare and initialize configuration structures. Structures should be initialized to allow for forward compatibility in case some new fields in those structures are added in future µC/FS versions.
...
L15-1(2) Register the NAND device driver FS_NAND
.
...
L15-1(3) The NAND part layer configuration structure should be initialized. For more information about these parameters, see section “Statically configured part layer”
...
.
...
L15-1(4) The NAND controller layer configuration structure should be initialized. For more information about these parameters, see section
...
15-4-1 “Generic Controller Layer Implementation”
...
. Please note that you might need to use a different controller layer. If this is the case, the configuration might be different (see section
...
...
).
...
L15-1(5) The NAND generic controller software ECC extension should be initialized. For more information about these parameters, see section “Generic Controller Extension Layer”
...
. Please note that if you are using a different controller layer implementation, there probably won’t be a controller extension layer. Also, if using the generic controller, you might need to use a different extension. Refer to section “Generic Controller Extension Layer”
...
for a list of available controller extensions.
...
L15-1(6) The NAND translation layer structure should be initialized. For more information about these parameters, see section
...
15-3-1 “Translation Layer Configuration”
...
.
...
L15-1(7) FSDev_Open()
opens/initializes a file system device. The parameters are the device name (a) and a pointer to a device driver-specific configuration structure (b). The device name (a) is composed of a device driver name (“nand”), a single colon, an ASCII-formatted integer (the unit number) and another colon.
...
L15-1(8) FS_NAND_LowFmt()
low-level formats a NAND. If the NAND has never been used with µC/FS, it must be low-level formatted before being used. Low-level formatting will create and initialize the low-level driver metadata on the device.
...
L15-1(9) FSVol_Open()
opens/mounts a volume. The parameters are the volume name (a), the device name (b) and the index of the partition that will be opened (c). There is no restriction on the volume name (a); however, it is typical to give the volume the same name as the underlying device. If the default partition is to be opened, or if the device is not partition, then the partition number (c) should be 0.
...
L15-1(10) FSVol_Fmt()
formats a file system device. If the NAND has just been low-level formatted, there will be no file system on the corresponding volume after it is opened (it will be unformatted). The volume must be formatted before files can be created or accessed.
...
Anchor
If the NAND initialization succeeds, the file system traces (if a sufficiently high trace level is configured) will produce an output similar to Listing 13 Listing 15-1. See section E-9 “Trace Configuration” on page 507 about configuring the trace level. Anchor
...
...
Anchor
Handling different use-cases
If the above example does not apply to your situation, we strongly recommend you read the sections about the different layers. This will help you determine if other existing implementations are suitable for you, or if you need to develop your own implementation of some of those layers.