📄 jnand.h
字号:
#ifndef __JNAND_H__
#define __JNAND_H__
/*===========================================================================
Flash Programming Plug-In for Lauterbach JTAG/ICD TRACE32
DESCRIPTION
Copyright (c) 1998, 1999 by QUALCOMM, Incorporated. All Rights Reserved.
Copyright (c) 2000, 2001 by QUALCOMM, Incorporated. All Rights Reserved.
===========================================================================*/
/*===========================================================================
EDIT HISTORY FOR FILE
This section contains comments describing changes made to this file.
Notice that changes are listed in reverse chronological order.
$PVCSPath: L:/src/asw/MSM6050/vcs/jf.h_v 1.2 07 Nov 2001 12:30:02 dionh $
$Header: //depot/asic/MSMSHARED/tools/jnand/jnand.h#4 $ $DateTime: 2003/08/28 11:11:23 $ $Author: dionh $
when who what, where, why
-------- --- ----------------------------------------------------------
08/28/03 drh Add error enums to support raw NAND driver test
03/04/03 drh Modifications to support new spanless boot method.
03/03/03 drh Taken back from NANDPRG with modifications to allow use
with same exact code in both using conditional compile
09/25/02 drh Taken from JNAND and used in NANDPRG - initial version
07/12/02 drh Added private error codes.
Added SET_ERR macro to put errors in private debug area.
11/07/01 drh Add FLASH_ERASE5 to account for Lauterbach software
passing either 2 or 5 to indicate erase
11/03/99 lss Before including this header file, jfi.h should be
included first for common definitions
12/03/98 lss Created.
===========================================================================*/
/* ------------------------------------------------------------------------
** Header files
** ------------------------------------------------------------------------ */
#ifdef BUILD_JNAND
#include "jnand_comdef.h"
#include "jnand_msg.h"
#include "jnand_crc.h"
#include "jnand_debug.h"
#else
#include "comdef.h"
#include "ap_armprg.h"
#include "ap_crc.h"
#endif
#include "jnand_bib.h"
#include "jnand_param.h"
/* NAND driver headers */
#include "fs_device.h"
#include "fs_nand_device.h"
#ifndef UNIX_UNIT_TEST
#include "fs_nand_toshiba.h"
#include "fs_nand_samsung.h"
#else
#error code not present
#endif
/* for memcpy() */
#include <string.h>
/* ------------------------------------------------------------------------
** External function definitions
** ------------------------------------------------------------------------ */
/* Exported functions from jnand.c */
extern uint32 flash_program (void);
extern uint32 flash_program_boot (void);
extern uint32 flash_erase_boot (void);
extern uint32 flash_erase (void);
extern uint32 flash_initialize (void);
extern uint32 flash_initialize_boot (void);
extern uint32 flash_finalize (void);
extern uint32 flash_finalize_boot (void);
extern uint32 flash_report (void);
/* Exported functions from jtest.c */
extern int verify_boot_info (void);
extern int verify_boot_block (unsigned int boot_crc, int boot_pages);
#ifdef SELF_TEST
#error code not present
#endif
/* ------------------------------------------------------------------------
** External data definitions
** ------------------------------------------------------------------------ */
/* from jfparam.c */
extern struct type_jtag_flash_param jtag_flash_param;
/* from jnand.c */
/* NAND device parameters */
extern int block_count; /* number of erasable units in flash */
extern int pages_in_block; /* number of pages in block */
extern int page_size; /* number of bytes in a page */
extern int eu_size; /* eraseable unit size */
extern int max_pages; /* number of pages in the device */
extern char *flash_name;
extern struct fs_device_data * nand_device;
extern dword crc;
/* Pointer to overlay on the param block a separate definition of the data */
extern struct type_jtag_report *report_ptr;
/* Table of ID strings */
extern const char *id_tbl[];
/* How many pages written to boot block */
extern int boot_block_pages;
/*===========================================================================
LOCAL DEFINITIONS AND DECLARATIONS FOR MODULE
This section contains local definitions for constants, macros, types,
variables and other items needed by this module.
===========================================================================*/
/* Defines related flash buffers and sizes */
#define MAX_BLOCKS 4096
#define MAX_BLOCK_SIZE 32
#define MAX_PAGE_SIZE 512
#define NAND_FILL_CHAR (0xFF)
/*
* The first available block in NAND flash for image data is the second
* non-bad block past block 0. This allows for bad blocks to be anywhere
* except block 0.
*
* 0 - Boot loader
* first non-bad block past block 0 - BIB
* second non-bad block past block 0 - First available for code
*/
#define FIRST_POSSIBLE_BLOCK 1
typedef enum
{
ERR_OK = 0, /* Success. Send an acknowledgement. */
ERR_BAD_CMD, /* Failure: Not a valid command from JTAG ICD */
ERR_DEV_MISSING, /* Failure: No NAND device found. */
ERR_REQ_BLK_BAD, /* Failure: One of the required blocks bad */
ERR_OUT_OF_NAND, /* Failure: Ran past end of NAND flash */
ERR_SPANS_TOO_BIG, /* Failure: Number of spans > span buffer size */
ERR_PAGE_TOO_BIG, /* Failure: Size of page > page buffer */
ERR_PAST_SPANS_END, /* Failure: More spans than will fit in block */
ERR_PAST_NAND_END, /* Failure: Image+ bad blocks > flash avail */
ERR_ERASE_FAIL, /* Failure: Erase of "good block" failed */
ERR_WRITE_FAIL, /* Failure: Write of "good block" failed */
ERR_READ_FAIL, /* Failure: Read back for verify after write */
ERR_VERIFY_FAIL, /* Failure: Verify after readback failed */
ERR_COMPARE_FAIL, /* Failure: Compare failed in self test verify */
ERR_CRC_FAIL, /* Failure: CRC failed during flash verify */
ERR_BIBCRC_FAIL, /* Failure: CRC passed to selftest did not match*/
ERR_MAGIC1_FAIL, /* Failure: Magic1 not correct in boot_info */
ERR_MAGIC2_FAIL, /* Failure: Magic2 not correct in boot_info */
ERR_BIBVER_FAIL, /* Failure: VIB version not correct in boot_info*/
ERR_OVER_CONSUME, /* Failure: Consumed too much of input buffer */
ERR_PAGE_UNIT_CALC, /* Failure: Off by one error in whole page calc */
ERR_BIB_TOO_BIG, /* Failure: BIB + spans too long for one block */
ERR_BIB_BAD, /* Failure: BIB block was bad */
ERR_SPAN_DIVIDE, /* Failure: Partial span remainder */
ERR_SPAN_NOTALIGN, /* Failure: Span not aligned on a page boundary */
ERR_ADDR_REVERSE, /* Failure: Current code address < previous */
ERR_PPI_TOO_BIG, /* Failure: Partial page index > page_size */
ERR_ECC_READ, /* Failure: Uncorrectable ECC error */
ERR_ECC, /* Success: Correctable ECC error */
ERR_ECC_SELF, /* Failure: Error in the ECC itself */
ERR_BAD_BLOCK, /* Failure: Block identified as bad */
} fatal_code_type;
#ifdef BUILD_JNAND
#define SET_ERR(x) debug_info.status=((uint32)(x))
#else
#define SET_ERR(x)
#endif
/* Defines used to tell write_current_page whether to be updating
* the checksum for data written from this page */
#define UPDATE_CRC 1
#define NO_UPDATE_CRC 0
#endif /* __JNAND_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -