tools/build-R2_19_3/fsboot/cbl/nand/rflnandflash.c File Reference

#include <linuxerr.h>
#include <nandflash.h>
#include <axisrfl/types.h>
#include <axisrfl/mtd.h>
#include <axisrfl/mtd_nand.h>
#include <axisrfl/rflflash.h>
#include <axisrfl/funcs.h>
#include <string.h>

Include dependency graph for rflnandflash.c:

Go to the source code of this file.

Defines

#define diag_printf   printf
#define D(x)   x
#define D_D(x)   x
#define DATA_BUF_SIZE   (2048 + 128)
#define OOB_BUF_SIZE   (4096)
#define ROUND_DOWN(value, boundary)   ((value) & (~((boundary)-1)))
#define NAND_ECC_SIZE   (512)
#define NAND_READ   (0)
#define NAND_WRITE   (1)
#define NAND_CSUM   (2)
#define NO_END_LIMIT   (0xffffffff)
#define CSUM_CHUNK_SIZE   (NAND_ECC_SIZE)
#define TEST_WRITE_FAILED   (0)
#define TEST_WRITE_BADADDR   (0x48000)
#define TEST_ERASE_FAILED   (0)
#define TEST_ERASE_FILL   (0)
#define TEST_ERASE_BADADDR   (0x268000)

Functions

static int rflflash_nand_rw (struct mtd_info *mtd, int mode, size_t start, size_t end, size_t len, size_t *retlen, unsigned long *retcsum, u_char *buffer)
int rflflash_nand_do_erase (unsigned long start, unsigned long end)
int rflflash_nand_erase (struct mtd_info *mtd, unsigned long start, unsigned long end)
unsigned long rflflash_write (unsigned char *source, unsigned long offset, unsigned long end_offset, unsigned long size)
void rflflash_mark_bad (unsigned long from, unsigned long to)
void rflflash_ignore_bad ()
void rflflash_dump (unsigned long from, unsigned long to)
void rflflash_dump_oob (unsigned long from, unsigned long to, unsigned char only_bad)
unsigned long rflflash_read (unsigned long offset, unsigned char *datum, unsigned long size, unsigned long *readlen)
unsigned long rflflash_checksum (unsigned long offset, unsigned long size, unsigned long *ret_csum)
static void nand_hwcontrol (struct mtd_info *mtd, int cmd)
static int nand_device_ready (struct mtd_info *mtd)
unsigned long rflflash_init (void)
unsigned long rflflash_nand_pagesize (void)
unsigned long rflflash_nand_size (void)

Variables

u_char data_buf [DATA_BUF_SIZE]
u_char oob_buf [OOB_BUF_SIZE]
static struct mtd_info mtd_info
static struct nand_chip nand_chip
static struct mtd_infoour_mtd = NULL
unsigned long errno_flash
static unsigned verbose_nand = 0


Define Documentation

#define CSUM_CHUNK_SIZE   (NAND_ECC_SIZE)

Definition at line 107 of file rflnandflash.c.

Referenced by rflflash_nand_rw().

#define D ( x   )     x

Definition at line 51 of file rflnandflash.c.

#define D_D ( x   )     x

Definition at line 53 of file rflnandflash.c.

Referenced by rflflash_nand_erase().

#define DATA_BUF_SIZE   (2048 + 128)

Definition at line 79 of file rflnandflash.c.

#define diag_printf   printf

Definition at line 48 of file rflnandflash.c.

Referenced by rflflash_checksum(), rflflash_init(), rflflash_nand_erase(), and rflflash_nand_rw().

#define NAND_CSUM   (2)

Definition at line 101 of file rflnandflash.c.

Referenced by rflflash_checksum(), and rflflash_nand_rw().

#define NAND_ECC_SIZE   (512)

Definition at line 97 of file rflnandflash.c.

Referenced by rflflash_nand_rw().

#define NAND_READ   (0)

Definition at line 99 of file rflnandflash.c.

Referenced by rflflash_nand_rw(), and rflflash_read().

#define NAND_WRITE   (1)

Definition at line 100 of file rflnandflash.c.

Referenced by rflflash_nand_rw(), and rflflash_write().

#define NO_END_LIMIT   (0xffffffff)

Definition at line 104 of file rflnandflash.c.

Referenced by rflflash_checksum(), and rflflash_read().

#define OOB_BUF_SIZE   (4096)

Definition at line 82 of file rflnandflash.c.

#define ROUND_DOWN ( value,
boundary   )     ((value) & (~((boundary)-1)))

Definition at line 96 of file rflnandflash.c.

#define TEST_ERASE_BADADDR   (0x268000)

Definition at line 118 of file rflnandflash.c.

Referenced by rflflash_nand_erase().

#define TEST_ERASE_FAILED   (0)

Definition at line 116 of file rflnandflash.c.

#define TEST_ERASE_FILL   (0)

Definition at line 117 of file rflnandflash.c.

#define TEST_WRITE_BADADDR   (0x48000)

Definition at line 115 of file rflnandflash.c.

Referenced by rflflash_nand_rw().

#define TEST_WRITE_FAILED   (0)

Definition at line 114 of file rflnandflash.c.


Function Documentation

static int nand_device_ready ( struct mtd_info mtd  )  [static]

Definition at line 675 of file rflnandflash.c.

Referenced by rflflash_init().

static void nand_hwcontrol ( struct mtd_info mtd,
int  cmd 
) [static]

Definition at line 631 of file rflnandflash.c.

References NAND_CTL_CLRALE, NAND_CTL_CLRCLE, NAND_CTL_CLRNCE, NAND_CTL_SETALE, NAND_CTL_SETCLE, and NAND_CTL_SETNCE.

Referenced by rflflash_init().

unsigned long rflflash_checksum ( unsigned long  offset,
unsigned long  size,
unsigned long *  ret_csum 
)

Definition at line 601 of file rflnandflash.c.

References diag_printf, errno_flash, NAND_CSUM, NO_END_LIMIT, our_mtd, and rflflash_nand_rw().

void rflflash_dump ( unsigned long  from,
unsigned long  to 
)

Definition at line 438 of file rflnandflash.c.

References mtd_info::block_isbad, data_buf, mtd_info::erasesize, our_mtd, rflflash_init(), rflflash_nand_pagesize(), and rflflash_read().

Referenced by decode_load_info().

void rflflash_dump_oob ( unsigned long  from,
unsigned long  to,
unsigned char  only_bad 
)

Definition at line 503 of file rflnandflash.c.

References nand_chip::badblockpos, buf, mtd_info::erasesize, nand_chip, oob_buf, mtd_info::oobsize, our_mtd, mtd_info::priv, mtd_info::read_oob, rflflash_init(), rflflash_nand_erase(), rflflash_nand_pagesize(), and mtd_info::write_oob.

Referenced by decode_load_info().

void rflflash_ignore_bad (  ) 

Definition at line 426 of file rflnandflash.c.

References mtd_info::ignore_bad, our_mtd, and rflflash_init().

Referenced by decode_load_info().

unsigned long rflflash_init ( void   ) 

Definition at line 686 of file rflnandflash.c.

References D, data_buf, diag_printf, mtd_info::erasesize, errno_flash, memset(), mtd_info, nand_chip, nand_device_ready(), NAND_ECC_SOFT, nand_hwcontrol(), nand_scan(), NAND_USE_FLASH_BBT, oob_buf, mtd_info::oobblock, mtd_info::oobsize, our_mtd, and mtd_info::size.

Referenced by decode_load_info(), rflflash_dump(), rflflash_dump_oob(), rflflash_ignore_bad(), rflflash_mark_bad(), and rflflash_nand_do_erase().

void rflflash_mark_bad ( unsigned long  from,
unsigned long  to 
)

Definition at line 401 of file rflnandflash.c.

References mtd_info::block_markbad, mtd_info::erasesize, exit, mtd_info::ignore_bad, our_mtd, rflflash_init(), and rflflash_nand_pagesize().

Referenced by decode_load_info().

int rflflash_nand_do_erase ( unsigned long  start,
unsigned long  end 
)

Definition at line 280 of file rflnandflash.c.

References exit, our_mtd, rflflash_init(), rflflash_nand_erase(), and mtd_info::size.

Referenced by decode_load_info().

int rflflash_nand_erase ( struct mtd_info mtd,
unsigned long  start,
unsigned long  end 
)

Definition at line 299 of file rflnandflash.c.

References mtd_info::block_isbad, mtd_info::block_markbad, D, D_D, diag_printf, mtd_info::erase, mtd_info::erasesize, memset(), erase_info::mtd, TEST_ERASE_BADADDR, and verbose_nand.

Referenced by rflflash_dump_oob(), rflflash_nand_do_erase(), and rflflash_write().

unsigned long rflflash_nand_pagesize ( void   ) 

Definition at line 744 of file rflnandflash.c.

References mtd_info::oobblock, and our_mtd.

Referenced by rflflash_dump(), rflflash_dump_oob(), and rflflash_mark_bad().

static int rflflash_nand_rw ( struct mtd_info mtd,
int  mode,
size_t  start,
size_t  end,
size_t  len,
size_t *  retlen,
unsigned long *  retcsum,
u_char *  buffer 
) [static]

Definition at line 135 of file rflnandflash.c.

References mtd_info::block_isbad, mtd_info::block_markbad, buf, CSUM_CHUNK_SIZE, D, diag_printf, mtd_info::erasesize, exit, min_t, n, NAND_CSUM, NAND_ECC_SIZE, NAND_READ, NAND_WRITE, mtd_info::read_ecc, ROUND_DOWN, TEST_WRITE_BADADDR, verbose_nand, and mtd_info::write_ecc.

Referenced by rflflash_checksum(), rflflash_read(), and rflflash_write().

unsigned long rflflash_nand_size ( void   ) 

Definition at line 756 of file rflnandflash.c.

References our_mtd, and mtd_info::size.

unsigned long rflflash_read ( unsigned long  offset,
unsigned char *  datum,
unsigned long  size,
unsigned long *  readlen 
)

Definition at line 571 of file rflnandflash.c.

References errno_flash, NAND_READ, NO_END_LIMIT, our_mtd, read, and rflflash_nand_rw().

Referenced by rflflash_dump().

unsigned long rflflash_write ( unsigned char *  source,
unsigned long  offset,
unsigned long  end_offset,
unsigned long  size 
)

Definition at line 371 of file rflnandflash.c.

References errno_flash, NAND_WRITE, our_mtd, rflflash_nand_erase(), and rflflash_nand_rw().

Referenced by decode_load_info().


Variable Documentation

u_char data_buf[DATA_BUF_SIZE]

Definition at line 85 of file rflnandflash.c.

Referenced by nand_do_read_ecc(), nand_scan(), rflflash_dump(), and rflflash_init().

unsigned long errno_flash

Definition at line 121 of file rflnandflash.c.

Referenced by rflflash_checksum(), rflflash_init(), rflflash_read(), and rflflash_write().

struct mtd_info mtd_info [static]

Definition at line 89 of file rflnandflash.c.

Referenced by rflflash_init().

struct nand_chip nand_chip [static]

Definition at line 90 of file rflnandflash.c.

Referenced by rflflash_dump_oob(), and rflflash_init().

u_char oob_buf[OOB_BUF_SIZE]

Definition at line 86 of file rflnandflash.c.

Referenced by nand_wait(), rflflash_dump_oob(), and rflflash_init().

struct mtd_info* our_mtd = NULL [static]

Definition at line 93 of file rflnandflash.c.

Referenced by rflflash_checksum(), rflflash_dump(), rflflash_dump_oob(), rflflash_ignore_bad(), rflflash_init(), rflflash_mark_bad(), rflflash_nand_do_erase(), rflflash_nand_pagesize(), rflflash_nand_size(), rflflash_read(), and rflflash_write().

unsigned verbose_nand = 0 [static]

Definition at line 123 of file rflnandflash.c.

Referenced by rflflash_nand_erase(), and rflflash_nand_rw().


Generated on Fri Nov 28 00:08:40 2008 for elphel by  doxygen 1.5.1