Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With this feature enabled, overall write and read speed should be improved. Also, robustness will be improved for specific cases. However, more RAM will be consumed.

RAM usage =
    <Nbr of blks on device> / 8 octets

The result should be rounded up.

...

If, for example, the value is 4, each time a specific updated sector is requested, the NAND translation layer must search the sector in a group of four sectors. Thus, if the update block metadata cache (FS_NAND_CFG_UPDATE_BLK_META_CACHE_EN) is disabled, four sectors must be read from the device to find the requested sector. The four entries will instead be read from the cache, if it is enabled. If the value is set to 0, the table will be disabled completely, meaning that all sectors of the block might have to be read before the specified sector is found. If the value is 1, the table completely specifies the location of the sector, and thus no search must be performed. In that case, enabling the update block metadata cache will yield no performance benefit.

RAM usage =
    <Nbr update blks> x
    (log2(<Nbr secs per blk>) - log2(<Subset size>) x
    <Max associativity> /
    8 octets

The result should be rounded up.

Anchor
FS_NAND_CFG_RSVD_AVAIL_BLK_CNT
FS_NAND_CFG_RSVD_AVAIL_BLK_CNT

FS_NAND_CFG_RSVD_AVAIL_BLK_CNT

This #define indicates the number of blocks in the available blocks table that are reserved for metadata block folding. Since this operation is critical and must be done before adding blocks to the available blocks table, the driver needs enough reserved blocks to make sure at least one of them is not bad so that the metadata can be folded successfully. When set to 3, probability of the metadata folding operation failing is almost null. This value is sufficient for most applications.

...

Note that the FS_NAND_DfltCfg constant should be used to initialize the FS_NAND_CFG structure to default values. This will ensure all fields will automatically be set to sane default values.Listing 15-3

Code Block
languagecpp
titleListing - NAND translation layer configuration structure

...

linenumberstrue
typedef  struct  fs_nand_cfg {
    void                *BSPPtr;                     (1)
    FS_NAND_CTRLR_API   *CtrlrPtr;                   (2)
    void                *CtrlrCfgPtr;                (3)
    FS_NAND_PART_API    *PartPtr;                    (4)
    void                *PartCfgPtr;                 (5)
    FS_SEC_SIZE          SecSize;                    (6)
    FS_NAND_BLK_QTY      BlkCnt;                     (7)
    FS_NAND_BLK_QTY      BlkIxFirst;                 (8)
    FS_NAND_UB_QTY       UB_CntMax;                  (9)
    CPU_INT08U           RUB_MaxAssoc;              (10)
    CPU_INT08U           AvailBlkTblEntryCntMax;    (11)
} FS_NAND_CFG;


Panel

(1) This field must be set to a pointer to the controller-specific BSP layer implementation’s API you want the controller layer to use (

...

see Board Support Package

...

). If you use a different controller layer implementation, that field might not be needed.

...

(2) This field must be set to a pointer to the controller layer implementation’s API you wish to use (

...

see Controller Layer).

...

(3) This field must be set to a pointer to the configuration structure for the specified controller layer implementation.

...

(4) This field must be set to a pointer to the part layer implementation’s API you wish to use (

...

see API structure type for generic controller

...

extension)

...

(5) This field must be set to a pointer to the configuration structure specific to the chosen part layer implementation.

...

(6) This field must contain the sector size for the device (care must be taken when choosing sector size:

...

see Performance Considerations). The

...

value FS_NAND_CFG_DEFAULT

...

 instructs the translation layer to use the page size reported by the part layer as its sector size.

...

(7) This field must contain the number of blocks you want µC/FS to use. This can be useful if you want to reserve blocks for data to be used outside the file system (by a bootloader, for example). The

...

value FS_NAND_CFG_DEFAULT

...

 instructs the translation layer to use the number of blocks reported by the part layer.

...

(8) This field must contain the index of the first block you want µC/FS to use. This can be useful if you want to reserve blocks for data to be used outside the file system (by a bootloader, for example).

...

(9) This field must be set to the maximum number of update blocks you want the NAND translation layer to use. A greater number can improve performance but will also reduce available space on the device and consume RAM. You are encouraged to experiment with different values to evaluate which one suits your application best.

...

(10) This field must be set to the maximum associativity of the random update blocks (RUB). The update blocks temporarily contain sectors from data blocks until they are merged (copied to respective data blocks). The associativity specifies the number of data blocks from which a single RUB can contain sectors. A high setting will usually lead to better overall write and read speeds and will reduce wear. However, a low setting will lower the time of execution of the worst-case write operation.

...

(11) This field must be set to the size of the available blocks table. Available blocks are ready to be erased and used as update or data blocks. The table must, at least, be large enough to contain the reserved available blocks (

...

see FS_NAND_CFG_RSVD_AVAIL_BLK_

...

CNT) and a few more for general operations. The

...

value FS_NAND_CFG_

...

DEFAULT instructs the translation layer to use 10 or (1 + FS_NAND_CFG_RSVD_AVAIL_BLK_CNT) entries, whichever is larger.