SAMA5 PMECC: Ported Gallois tables

This commit is contained in:
Gregory Nutt 2013-11-24 12:36:42 -06:00
parent 31a65431f0
commit 23d767a19e
4 changed files with 3256 additions and 5 deletions

View File

@ -228,16 +228,16 @@ endif
endif endif
ifeq ($(CONFIG_SAMA5_EBICS0_NAND),y) ifeq ($(CONFIG_SAMA5_EBICS0_NAND),y)
CHIP_CSRCS += sam_nand.c sam_pmecc.c CHIP_CSRCS += sam_nand.c sam_pmecc.c sam_gf512.c sam_gf1024.c
else else
ifeq ($(CONFIG_SAMA5_EBICS1_NAND),y) ifeq ($(CONFIG_SAMA5_EBICS1_NAND),y)
CHIP_CSRCS += sam_nand.c sam_pmecc.c CHIP_CSRCS += sam_nand.c sam_pmecc.c sam_gf512.c sam_gf1024.c
else else
ifeq ($(CONFIG_SAMA5_EBICS2_NAND),y) ifeq ($(CONFIG_SAMA5_EBICS2_NAND),y)
CHIP_CSRCS += sam_nand.c sam_pmecc.c CHIP_CSRCS += sam_nand.c sam_pmecc.c sam_gf512.c sam_gf1024.c
else else
ifeq ($(CONFIG_SAMA5_EBICS3_NAND),y) ifeq ($(CONFIG_SAMA5_EBICS3_NAND),y)
CHIP_CSRCS += sam_nand.c sam_pmecc.c CHIP_CSRCS += sam_nand.c sam_pmecc.c sam_gf512.c sam_gf1024.c
endif endif
endif endif
endif endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -49,6 +49,9 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/mtd/nand_config.h> #include <nuttx/mtd/nand_config.h>
#include <stdint.h>
#include <stdbool.h>
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
@ -80,7 +83,7 @@
# undef CONFIG_SAMA5_EBICS3_PMECC # undef CONFIG_SAMA5_EBICS3_PMECC
#endif #endif
/* Count the number of banks that confaigured for NAND with PMECC support /* Count the number of banks that configured for NAND with PMECC support
* enabled. * enabled.
*/ */
@ -155,6 +158,20 @@
# endif # endif
#endif #endif
/* Gallois Field Tables *****************************************************/
/* Indexes of tables in Gallois Field tables */
#define PMECC_GF_INDEX_OF 0
#define PMECC_GF_ALPHA_TO 1
/* Gallois Field tables for 512 and 1024 bytes sectors
* First raw is "index_of" and second one is "alpha_to"
*/
#define PMECC_GF_SIZEOF_512 0x2000
#define PMECC_GF_SIZEOF_1024 0x4000
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/
@ -172,6 +189,26 @@ extern "C"
#define EXTERN extern #define EXTERN extern
#endif #endif
/* Gallois Field tables for 512 bytes sectors. First raw is "index_of" and
* second one is "alpha_to"
*/
#ifdef CONFIG_SAMA5_PMECC_GALOIS_TABLE512_ROMADDR
# ifndef CONFIG_SAMA5_PMECC_GALOIS_TABLE512_ROMADDR
# error CONFIG_SAMA5_PMECC_GALOIS_TABLE512_ROMADDR is not defined
# endif
# define pmecc_gf512 ((const int16_t *)CONFIG_SAMA5_PMECC_GALOIS_TABLE512_ROMADDR)
# ifndef CONFIG_SAMA5_PMECC_GALOIS_TABLE1024_ROMADDR
# error CONFIG_SAMA5_PMECC_GALOIS_TABLE1024_ROMADDR is not defined
# endif
# define pmecc_gf1024 ((const int16_t *)CONFIG_SAMA5_PMECC_GALOIS_TABLE1024_ROMADDR)
#else
EXTERN const uint16_t pmecc_gf512[2][PMECC_GF_SIZEOF_512];
EXTERN const uint16_t pmecc_gf1024[2][PMECC_GF_SIZEOF_1024];
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/