Mercurial > nand-ecoscentric
changeset 3398:aecb165864c8
io/nand: Make interface richer - Add plf_priv member of device struct, CYG_NAND_DEVICE_2, CYG_NAND_ECC_ALG_DECLARATION
| author | Ross Younger <wry@ecoscentric.com> |
|---|---|
| date | Mon, 12 Jan 2015 17:42:41 +1300 |
| parents | 4cce65f46b89 |
| children | 3c98ca6c7e46 |
| files | packages/io/nand/current/ChangeLog packages/io/nand/current/include/nand_device.h packages/io/nand/current/include/nand_ecc.h |
| diffstat | 3 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/io/nand/current/ChangeLog +++ b/packages/io/nand/current/ChangeLog @@ -1,3 +1,9 @@ +2015-01-12 Ross Younger <wry@ecoscentric.com> + + * include/nand_device.h: Add 'plf_priv' member of device struct and + CYG_NAND_DEVICE_2 initialiser macro. + * include/nand_ecc.h: Add CYG_NAND_ECC_ALG_DECLARATION + 2014-12-06 Ross Younger <wry@ecoscentric.com> * src/nandinit.cxx: Another tweak to initialiser priority
--- a/packages/io/nand/current/include/nand_device.h +++ b/packages/io/nand/current/include/nand_device.h @@ -225,6 +225,7 @@ struct _cyg_nand_device_t { struct cyg_nand_dev_fns_v2 *fns; /* Access functions */ void * priv; /* If required, points to private device-specific data. */ + void * plf_priv; /* If required, points to private platform-specific data. */ /* Data about the device need not be defined statically. Indeed @@ -303,7 +304,7 @@ struct cyg_nand_dev_fns_v2 _funsv2_ = { .is_factory_bad = _factorybad_, \ } -#define CYG_NAND_DEVICE(_structname_, _devname_, _funs_, _priv_, _ecc_, _oob_)\ +#define CYG_NAND_DEVICE_2(_structname_, _devname_, _funs_, _priv_, _plf_priv_, _ecc_, _oob_)\ struct _cyg_nand_device_t _structname_ CYG_HAL_TABLE_ENTRY(cyg_nand_dev) = \ { \ .version = 2, \ @@ -311,10 +312,14 @@ struct _cyg_nand_device_t _structname_ C .devname = _devname_, \ .fns = _funs_, \ .priv = _priv_, \ + .plf_priv = _plf_priv_, \ .ecc = _ecc_, \ .oob = _oob_, \ } +#define CYG_NAND_DEVICE(_structname_, _devname_, _funs_, _priv_, _ecc_, _oob_)\ + CYG_NAND_DEVICE_2(_structname_, _devname_, _funs_, _priv_, NULL, _ecc_, _oob_) + /* To declare a new NAND device, * first provide its functions and tie them together with CYG_NAND_FUNCTIONS_V2, * then instantiate it with CYG_NAND_DEVICE_V2.
--- a/packages/io/nand/current/include/nand_ecc.h +++ b/packages/io/nand/current/include/nand_ecc.h @@ -134,6 +134,9 @@ typedef struct { CYG_NAND_ECC_ALG(_name, _dataz, _eccz, _init_rd, _init_wr, _calc_rd, _calc_wr, \ _repair, NAND_ECC_FLAG_IS_HARDWARE) +#define CYG_NAND_ECC_ALG_DECLARATION(_name) \ + __externC cyg_nand_ecc_t _name; + /* Useful code ==================================================== */ /* Quick & dirty calc: no of ECC bytes per page.
