📄 mx_nand2k.h
字号:
/*****************************************************************************
** mx_nand2k.h
**
** Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
**
** This file contains copyrighted material. Use of this file is
** restricted by the provisions of a Freescale Software License
** Agreement, which has either been electronically accepted by
** you or has been expressly executed between the parties.
**
** Description: Explanation for the usage of this file.
**
** Revision History:
** -----------------
*****************************************************************************/
/*!
* @file mx_nand2k.h
* @defgroup nand_2k_flash
* @brief the header file for nand flash with 2k page
*
* @ingroup nand_2k_flash
* @{
*/
#ifndef __MX_NAND2K_H_
#define __MX_NAND2K_H_
/*****************************************************************************
* <Includes>
*****************************************************************************/
#include "type.h"
#include "flash_report.h"
/*****************************************************************************
* <Macros>
*****************************************************************************/
/*
#define NAND_MAN_ID (gNAND->man_id)
#define NAND_DEV_ID (gNAND->dev_id)
#define NAND_NUM_OF_ROW_ADDR_CYCLES (gNAND->num_of_row_address_cycles)
#define NAND_NUM_OF_BLOCKS (gNAND->num_of_blocks)
#define NAND_NUM_OF_PAGES (gNAND->num_of_pages)
#define NAND_IO_WIDTH (gNAND->io_width)
*/
#define NAND_MAN_ID (0xEC)
#define NAND_DEV_ID (0xDC)
#define NAND_NUM_OF_ROW_ADDR_CYCLES (2)
#define NAND_NUM_OF_BLOCKS (1024)
#define NAND_NUM_OF_PAGES (64)
#define NAND_IO_WIDTH 8
#define NAND_MAIN_BYTESIZE (2048)
#define NAND_SPARE_BYTESIZE (64)
/*
#define NAND_BADBLOCK_MARKER_OFFSET (gNAND->badblock_marker_offset)
*/
#define NAND_BADBLOCK_MARKER_OFFSET (0)
#define NAND_ERROR_NO 0
#define NAND_ERROR_ECC 1
#define NAND_ERROR_PROG 2
#define NAND_ERROR_ERASE 3
#define NAND_ERROR_VERIFY 4
#define NAND_ERROR_INIT 5
/*****************************************************************************
* <Typedefs>
*****************************************************************************/
typedef struct {
u8 man_id;
u8 dev_id;
u8 io_width;
u8 badblock_marker_offset;
u8 num_of_row_address_cycles;
/* number of blocks*/
u32 num_of_blocks;
/* number of pages per block*/
u32 num_of_pages;
u8 model[128];
}nand_t;
/*****************************************************************************
* global var
*****************************************************************************/
/* global var to store nand information*/
extern nand_t *gNAND;
/*!
* nand flash function declarations
*/
/*initialize nand flash */
extern u8 nand_init(void);
/*check whether nand block is good */
extern u8 nand_block_is_good(u32 BlockNum);
/*mark bad block */
extern u8 nand_mark_bad_block(u32 BlockNum);
/*erase block */
extern u8 nand_erase_block(u32 BlockNum);
/*read flash content */
extern u8 nand_read (u32 FlashAddress, u32 TargetAddress, u32 ByteSize);
/*write data to flash*/
extern u8 nand_write(u32 FlashAddress, u32 SourceAddress, u32 ByteSize,u8 file_format);
/* Compare memory content*/
extern u8 nand_compare(u32 FlashAddress, u32 TargetAddress, u32 ByteSize);
/* Erase content in specific range*/
extern u8 nand_erase_conditional(u32 StartAddress, u32 EndAddress);
/* show nand information */
extern void nand_info(void);
/* erase all blocks*/
extern void nand_unconditional_erase_all(void);
/**@}*/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -