Versions Compared

Key

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

...

Anchor10342321034232 Generic Controller Extension Development Guide Anchor10342921034292The generic controller extension layer allows extending the generic controller through a number of hook functions that are used by the generic controller, when flexibility in handling a specific operation is desirable. A generic controller extension is defined through a structure of type FS_NAND_CTRLR_GEN_EXT, described in Listing 13-10 Listing - API structure type for generic controller extension. Note that all unused function pointers should be set to DEF_NULL.anchor

Code Block

...

typedef struct
HTML Table
summary
classCode_Listing
Table Row (tr)
Table Cell (td)
rowspan6
Anchor
10342981034298
language

...

void
 {
    void              (*Init)        (FS_ERR                  *p_err);        (1)
  void

 
    void             *(*Open)        (FS_NAND_CTRLR_GEN_DATA  *p_ctrlr_data,
(2) void
  (2)
                                      void                    *p_ext_cfg,
FS_ERR

                                      FS_ERR                  *p_err);
  void

 
    void              (*Close)       (void                    *p_ext_data);   (3)
 

 
    FS_NAND_PG_SIZE   (*Setup)       (FS_NAND_CTRLR_GEN_DATA  *p_ctrlr_data,
(4) void
  (4)
                                      void                    *p_ext_data,
FS_ERR

                                      FS_ERR                  *p_err);
  void

 
    void              (*RdStatusChk) (void                    *p_ext_data,
(5) FS_ERR
    (5)
                                      FS_ERR                  *p_err);
  void

 
    void              (*ECC_Calc)    (void                    *p_ext_data,
(6) void
    (6)
                                      void                    *p_sec_buf,
void

                                      void                    *p_oos_buf,

                                      FS_NAND_PG_SIZE          oos_size,
FS_ERR

                                      FS_ERR                  *p_err);
  void

 
    void              (*ECC_Verify)  (void                    *p_ext_data,
(7) void
    (7)
                                      void                    *p_sec_buf,
void

                                      void                    *p_oos_buf,

                                      FS_NAND_PG_SIZE          oos_size,
FS_ERR

                                      FS_ERR                  *p_err);
}

} FS_NAND_CTLRR_GEN_EXT;
cpp
titleListing - API structure type for generic controller extension
linenumberstrue
typedef  struct  fs_nand_ctrlr_gen_ext
{
Anchor
10342991034299
Anchor
10343001034300
Anchor
10343011034301
Anchor
10343021034302
Anchor
10343031034303
Anchor
10343041034304
Anchor
10343051034305
Anchor
10343061034306
Anchor
10343071034307
Anchor
10343081034308
Anchor
10343091034309
Anchor
10343101034310
Anchor
10343111034311
Anchor
10343121034312
Anchor
10343131034313
Anchor
10343141034314
Anchor
10343151034315
Anchor
10343161034316
Anchor
10343171034317
Anchor
10343181034318
Anchor
10343191034319
Anchor
10343201034320
Anchor
10343211034321
Anchor
10343221034322
Anchor
10343231034323
Anchor
10343241034324
Anchor
10343251034325
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)

...


Panel

(1) The Init()

...

 funtion provides an opportunity to initialize an extension. This will be called only once, when the extension is registered with the generic controller (

...

during FSDev_Open()). If multiple generic controller instances are configured with the same extension,

...

the Init()

...

 function will still be called only once.

...

(2) The Open()

...

 function is called by the generic controller’s

...

own Open() function. This function will also receive the controller extension configuration pointer.

...

(3) The Close() function might be called by the generic controller’s own Close() function and allow the extension to release its resources. Close()

...

 will typically never be called.

...

(4) The Setup()

...

 function is called during the generic controller’s

...

own Setup() function and provides an opportunity to setup some internal parameters according to the generic controller’s operating conditions. The generic controller’s instance data is provided as an argument to this function. The function must return the amount of required OOS storage space, in octets (ECC data, for example).

...

(5) The RdStatusChk()

...

 function is called after a sector read operation, by the generic

...

controller’s SecRd()

...

 function. It should determine if a read error has occurred and return an error accordingly.

...

(6) The ECC_Calc()

...

 function is called before a sector is written to the NAND device by the generic

...

controller’s SecWr()

...

 function, and provides an opportunity to calculate the ECC data and to append it to the OOS metadata.

...

(7) The ECC_Verify() function is called after a sector is read from the NAND device by the generic controller’s SecRd() function. It should read the ECC data from the OOS metadata, verify the sector and OOS data integrity, and correct any errors found if possible. It should return an appropriate error code if ECC errors are found.