158 lines
5.1 KiB
C
158 lines
5.1 KiB
C
/****************************************************************************
|
|
|
|
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
|
|
|
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
|
be copied by any method or incorporated into another program without
|
|
the express written consent of Aerospace C.Power. This Information or any portion
|
|
thereof remains the property of Aerospace C.Power. The Information contained herein
|
|
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
|
liability for its use in any way and conveys no license or title under
|
|
any patent or copyright and makes no representation or warranty that this
|
|
Information is free from patent or copyright infringement.
|
|
|
|
****************************************************************************/
|
|
#ifndef _NAND_FLASH_H
|
|
#define _NAND_FLASH_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define DATA_FIELD_LEN 2048
|
|
#define SPARE_FIELD_LEN 64
|
|
|
|
#ifndef ENABLE
|
|
#define ENABLE 1
|
|
#endif
|
|
#ifndef DISABLE
|
|
#define DISABLE 0
|
|
#endif
|
|
|
|
/**
|
|
* @brief nandfc_read_chip_info() - get chip information
|
|
*
|
|
* @return the value of the chip information register
|
|
*/
|
|
uint32_t nandfc_read_chip_info(void);
|
|
|
|
/**
|
|
* @brief nandfc_get_feature() - get feature register
|
|
* @param addr: the address of feature register
|
|
* @return the value of the feature register
|
|
*/
|
|
uint8_t nandfc_get_feature(uint8_t addr);
|
|
|
|
/**
|
|
* @brief nandfc_set_feature() - set feature register
|
|
* @param addr: the address of feature register
|
|
* @param data: the data to be writen
|
|
* @return 0 success
|
|
* @return 1 failed
|
|
*/
|
|
int nandfc_set_feature(char addr, char data);
|
|
|
|
/**
|
|
* @brief nandfc_write_en_switch() - set feature register
|
|
* @param en: 0 diable
|
|
* 1 enable
|
|
* @return 0 success
|
|
* @return 1 failed
|
|
*/
|
|
int nandfc_write_en_switch(uint8_t en);
|
|
|
|
/**
|
|
* @brief nandfc_reset_device() - set feature register
|
|
*
|
|
* @return 0 success
|
|
* @return 1 failed
|
|
*/
|
|
int nandfc_reset_device(void);
|
|
|
|
/**
|
|
* @brief nandfc_read_page_to_cache() - read the addressed page to cache
|
|
* @param page_addr: the page address to be erasen
|
|
* @return 0 success
|
|
* 1 failed
|
|
*/
|
|
int nandfc_read_page_to_cache(uint32_t page_addr);
|
|
|
|
/**
|
|
* @brief nandfc_read_random_data() - read the random data within addressed page
|
|
* @param data: the pointer of read back data
|
|
* @param raw_addr: the page address to be read
|
|
* @param colum_addr: the colume address to be read
|
|
* @param lenth: the byte number to be read back
|
|
* @return 0 success
|
|
* @ 1 failed
|
|
*/
|
|
int nandfc_read_random_data(void* data, uint32_t raw_addr, uint32_t colum_addr,uint32_t lenth);
|
|
|
|
/**
|
|
* @brief nandfc_read_paramtr_page() - read out the paramter page
|
|
* @param data: the pointer of read back data
|
|
* @param lenth: the byte number to be read back
|
|
* @return 0 success
|
|
* @ 1 failed
|
|
*/
|
|
int nandfc_read_paramtr_page(void* data, uint32_t lenth);
|
|
|
|
/**
|
|
* @brief nandfc_read_uniID_page() - read out the uiniq ID page
|
|
* @param data: the pointer of read back data
|
|
* @return 0 success
|
|
* @ 1 failed
|
|
*/
|
|
int nandfc_read_uniID_page(void* data);
|
|
|
|
/**
|
|
* @brief nandfc_program_page() - write data into the addressed page
|
|
* @param data: the pointer of read back data
|
|
* @param raw_addr: the page address to be writen
|
|
* @param colum_addr: the colume address to be writen
|
|
* @param lenth: the byte number to be writen
|
|
* @return 0 success
|
|
* @ 1 failed
|
|
*/
|
|
int nandfc_program_page(const void* data, uint32_t raw_addr, uint32_t colum_addr, uint32_t byte_num);
|
|
|
|
|
|
/**
|
|
* @brief nandfc_program_page() - write data into the addressed page
|
|
* @param data: the pointer of read back data
|
|
* @param raw_addr: the page address to be writen
|
|
* @param colum_addr: the colume address to be writen
|
|
* @param lenth: the byte number to be writen
|
|
* @return 0 success
|
|
* @ 1 failed
|
|
*/
|
|
int nandfc_program_random_data(const void* data, uint32_t colum_addr, uint32_t raw_addr, uint32_t byte_num);
|
|
|
|
/**
|
|
* @brief nandfc_program_page() - write the random data into the addressed page
|
|
* @param data: the pointer of read back data
|
|
* @param star_addr: the start address to be writen
|
|
* @param byte_num: the byte number to be writen
|
|
* @return 0 success
|
|
* @ 1 failed
|
|
*/
|
|
int nandfc_program_data(const void* data, uint32_t star_addr, uint32_t byte_num);
|
|
|
|
/**
|
|
* @brief nandfc_inter_data_move() - move data in the addressed page
|
|
* @param colum_addr: the colume address to be move
|
|
* @param raw_addr: the page address to be move
|
|
* @param byte_num: the byte number to be move
|
|
* @return 0 success
|
|
* @ 1 failed
|
|
*/
|
|
int nandfc_inter_data_move(const void* data, uint32_t colum_adrr, uint32_t raw_addr, uint32_t byte_num);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /*_NAND_FLASH_H*/
|
|
|