OpenOCD
nand/core.h File Reference
Include dependency graph for nand/core.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  nand_block
 Representation of a single NAND block in a NAND device. More...
 
struct  nand_device
 
struct  nand_ecclayout
 
struct  nand_info
 
struct  nand_manufacturer
 
struct  nand_oobfree
 

Macros

#define ERROR_NAND_DEVICE_INVALID   (-1100)
 
#define ERROR_NAND_DEVICE_NOT_PROBED   (-1104)
 
#define ERROR_NAND_ERROR_CORRECTION_FAILED   (-1105)
 
#define ERROR_NAND_NO_BUFFER   (-1106)
 
#define ERROR_NAND_OPERATION_FAILED   (-1101)
 
#define ERROR_NAND_OPERATION_NOT_SUPPORTED   (-1103)
 
#define ERROR_NAND_OPERATION_TIMEOUT   (-1102)
 

Enumerations

enum  {
  NAND_MFR_TOSHIBA = 0x98 , NAND_MFR_SAMSUNG = 0xec , NAND_MFR_FUJITSU = 0x04 , NAND_MFR_NATIONAL = 0x8f ,
  NAND_MFR_RENESAS = 0x07 , NAND_MFR_STMICRO = 0x20 , NAND_MFR_HYNIX = 0xad , NAND_MFR_MICRON = 0x2c
}
 
enum  {
  NAND_NO_AUTOINCR = 0x00000001 , NAND_BUSWIDTH_16 = 0x00000002 , NAND_NO_PADDING = 0x00000004 , NAND_CACHEPRG = 0x00000008 ,
  NAND_COPYBACK = 0x00000010 , NAND_IS_AND = 0x00000020 , NAND_4PAGE_ARRAY = 0x00000040 , BBT_AUTO_REFRESH = 0x00000080 ,
  NAND_NO_READRDY = 0x00000100 , NAND_SAMSUNG_LP_OPTIONS = (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) , LP_OPTIONS = (NAND_SAMSUNG_LP_OPTIONS | NAND_NO_READRDY | NAND_NO_AUTOINCR) , LP_OPTIONS16 = (LP_OPTIONS | NAND_BUSWIDTH_16)
}
 
enum  {
  NAND_CMD_READ0 = 0x0 , NAND_CMD_READ1 = 0x1 , NAND_CMD_RNDOUT = 0x5 , NAND_CMD_PAGEPROG = 0x10 ,
  NAND_CMD_READOOB = 0x50 , NAND_CMD_ERASE1 = 0x60 , NAND_CMD_STATUS = 0x70 , NAND_CMD_STATUS_MULTI = 0x71 ,
  NAND_CMD_SEQIN = 0x80 , NAND_CMD_RNDIN = 0x85 , NAND_CMD_READID = 0x90 , NAND_CMD_ERASE2 = 0xd0 ,
  NAND_CMD_RESET = 0xff , NAND_CMD_READSTART = 0x30 , NAND_CMD_RNDOUTSTART = 0xE0 , NAND_CMD_CACHEDPROG = 0x15
}
 
enum  {
  NAND_STATUS_FAIL = 0x01 , NAND_STATUS_FAIL_N1 = 0x02 , NAND_STATUS_TRUE_READY = 0x20 , NAND_STATUS_READY = 0x40 ,
  NAND_STATUS_WP = 0x80
}
 
enum  oob_formats {
  NAND_OOB_NONE = 0x0 , NAND_OOB_RAW = 0x1 , NAND_OOB_ONLY = 0x2 , NAND_OOB_SW_ECC = 0x10 ,
  NAND_OOB_HW_ECC = 0x20 , NAND_OOB_SW_ECC_KW = 0x40 , NAND_OOB_JFFS2 = 0x100 , NAND_OOB_YAFFS2 = 0x100
}
 

Functions

 COMMAND_HELPER (nand_command_get_device, unsigned int name_index, struct nand_device **nand)
 helper for parsing a nand device command argument string More...
 
struct nand_deviceget_nand_device_by_num (int num)
 
int nand_calculate_ecc (struct nand_device *nand, const uint8_t *dat, uint8_t *ecc_code)
 
int nand_calculate_ecc_kw (struct nand_device *nand, const uint8_t *dat, uint8_t *ecc_code)
 
int nand_correct_data (struct nand_device *nand, u_char *dat, u_char *read_ecc, u_char *calc_ecc)
 nand_correct_data - Detect and correct a 1 bit error for 256 byte block More...
 
int nand_page_command (struct nand_device *nand, uint32_t page, uint8_t cmd, bool oob_only)
 
int nand_read_data_page (struct nand_device *nand, uint8_t *data, uint32_t size)
 
int nand_read_page_raw (struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
 
int nand_read_status (struct nand_device *nand, uint8_t *status)
 
int nand_register_commands (struct command_context *cmd_ctx)
 
int nand_write_data_page (struct nand_device *nand, uint8_t *data, uint32_t size)
 
int nand_write_finish (struct nand_device *nand)
 
int nand_write_page_raw (struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
 

Variables

struct nand_devicenand_devices
 

Macro Definition Documentation

◆ ERROR_NAND_DEVICE_INVALID

#define ERROR_NAND_DEVICE_INVALID   (-1100)

Definition at line 216 of file nand/core.h.

◆ ERROR_NAND_DEVICE_NOT_PROBED

#define ERROR_NAND_DEVICE_NOT_PROBED   (-1104)

Definition at line 220 of file nand/core.h.

◆ ERROR_NAND_ERROR_CORRECTION_FAILED

#define ERROR_NAND_ERROR_CORRECTION_FAILED   (-1105)

Definition at line 221 of file nand/core.h.

◆ ERROR_NAND_NO_BUFFER

#define ERROR_NAND_NO_BUFFER   (-1106)

Definition at line 222 of file nand/core.h.

◆ ERROR_NAND_OPERATION_FAILED

#define ERROR_NAND_OPERATION_FAILED   (-1101)

Definition at line 217 of file nand/core.h.

◆ ERROR_NAND_OPERATION_NOT_SUPPORTED

#define ERROR_NAND_OPERATION_NOT_SUPPORTED   (-1103)

Definition at line 219 of file nand/core.h.

◆ ERROR_NAND_OPERATION_TIMEOUT

#define ERROR_NAND_OPERATION_TIMEOUT   (-1102)

Definition at line 218 of file nand/core.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NAND_MFR_TOSHIBA 
NAND_MFR_SAMSUNG 
NAND_MFR_FUJITSU 
NAND_MFR_NATIONAL 
NAND_MFR_RENESAS 
NAND_MFR_STMICRO 
NAND_MFR_HYNIX 
NAND_MFR_MICRON 

Definition at line 66 of file nand/core.h.

◆ anonymous enum

anonymous enum
Enumerator
NAND_NO_AUTOINCR 
NAND_BUSWIDTH_16 
NAND_NO_PADDING 
NAND_CACHEPRG 
NAND_COPYBACK 
NAND_IS_AND 
NAND_4PAGE_ARRAY 
BBT_AUTO_REFRESH 
NAND_NO_READRDY 
NAND_SAMSUNG_LP_OPTIONS 
LP_OPTIONS 
LP_OPTIONS16 

Definition at line 94 of file nand/core.h.

◆ anonymous enum

anonymous enum
Enumerator
NAND_CMD_READ0 
NAND_CMD_READ1 
NAND_CMD_RNDOUT 
NAND_CMD_PAGEPROG 
NAND_CMD_READOOB 
NAND_CMD_ERASE1 
NAND_CMD_STATUS 
NAND_CMD_STATUS_MULTI 
NAND_CMD_SEQIN 
NAND_CMD_RNDIN 
NAND_CMD_READID 
NAND_CMD_ERASE2 
NAND_CMD_RESET 
NAND_CMD_READSTART 
NAND_CMD_RNDOUTSTART 
NAND_CMD_CACHEDPROG 

Definition at line 138 of file nand/core.h.

◆ anonymous enum

anonymous enum
Enumerator
NAND_STATUS_FAIL 
NAND_STATUS_FAIL_N1 
NAND_STATUS_TRUE_READY 
NAND_STATUS_READY 
NAND_STATUS_WP 

Definition at line 161 of file nand/core.h.

◆ oob_formats

Enumerator
NAND_OOB_NONE 
NAND_OOB_RAW 
NAND_OOB_ONLY 
NAND_OOB_SW_ECC 
NAND_OOB_HW_ECC 
NAND_OOB_SW_ECC_KW 
NAND_OOB_JFFS2 
NAND_OOB_YAFFS2 

Definition at line 170 of file nand/core.h.

Function Documentation

◆ COMMAND_HELPER()

COMMAND_HELPER ( nand_command_get_device  ,
unsigned int  name_index,
struct nand_device **  nand 
)

helper for parsing a nand device command argument string

Definition at line 197 of file flash/nand/core.c.

References CMD, CMD_ARGV, COMMAND_PARSE_NUMBER, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, get_nand_device_by_name(), and get_nand_device_by_num().

◆ get_nand_device_by_num()

struct nand_device* get_nand_device_by_num ( int  num)

Definition at line 184 of file flash/nand/core.c.

References nand_devices, nand_device::next, and NULL.

Referenced by COMMAND_HANDLER(), and COMMAND_HELPER().

◆ nand_calculate_ecc()

int nand_calculate_ecc ( struct nand_device nand,
const uint8_t *  dat,
uint8_t *  ecc_code 
)

Definition at line 48 of file ecc.c.

References nand_ecc_precalc_table.

Referenced by nand_fileio_read().

◆ nand_calculate_ecc_kw()

int nand_calculate_ecc_kw ( struct nand_device nand,
const uint8_t *  dat,
uint8_t *  ecc_code 
)

Definition at line 93 of file ecc_kw.c.

References gf_build_log_exp_table(), gf_exp, and gf_log.

Referenced by nand_fileio_read().

◆ nand_correct_data()

int nand_correct_data ( struct nand_device nand,
u_char *  dat,
u_char *  read_ecc,
u_char *  calc_ecc 
)

nand_correct_data - Detect and correct a 1 bit error for 256 byte block

Definition at line 113 of file ecc.c.

References countbits(), s0, s1, and s2.

Referenced by lpc32xx_read_page_slc().

◆ nand_page_command()

◆ nand_read_data_page()

int nand_read_data_page ( struct nand_device nand,
uint8_t *  data,
uint32_t  size 
)

◆ nand_read_page_raw()

int nand_read_page_raw ( struct nand_device nand,
uint32_t  page,
uint8_t *  data,
uint32_t  data_size,
uint8_t *  oob,
uint32_t  oob_size 
)

◆ nand_read_status()

◆ nand_register_commands()

int nand_register_commands ( struct command_context cmd_ctx)

Definition at line 611 of file flash/nand/tcl.c.

References nand_command_handlers, NULL, and register_commands().

Referenced by setup_command_handler().

◆ nand_write_data_page()

◆ nand_write_finish()

◆ nand_write_page_raw()

int nand_write_page_raw ( struct nand_device nand,
uint32_t  page,
uint8_t *  data,
uint32_t  data_size,
uint8_t *  oob,
uint32_t  oob_size 
)

Variable Documentation

◆ nand_devices

struct nand_device* nand_devices
extern