94 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			94 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
/****************************************************************************
 | 
						|
 | 
						|
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 _IOT_NAND_FLASH_API_H
 | 
						|
#define _IOT_NAND_FLASH_API_H
 | 
						|
 | 
						|
#include "iot_spi_api.h"
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
typedef struct _iot_nandfc_cfg {
 | 
						|
    iot_spi_cfg_t spi;
 | 
						|
} iot_nandfc_cfg_t;
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief nandfc_read_chip_info() - get chip ID
 | 
						|
 *
 | 
						|
 * @return              the value of the chip ID
 | 
						|
 */
 | 
						|
uint8_t iot_nandfc_read_chip_ID(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief nandfc_read_manufacture_ID() - get manufacture ID
 | 
						|
 *
 | 
						|
 * @return              the value of the manufacture ID
 | 
						|
 */
 | 
						|
uint8_t iot_nandfc_read_manufactury_ID(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief nandfc_reset_device() - set feature register
 | 
						|
 *
 | 
						|
 * @return              0 success
 | 
						|
 * @return              1 failed
 | 
						|
 */
 | 
						|
int iot_nandfc_reset_device(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_nandfc_erase_block() - set feature register
 | 
						|
 * @param addr:         the block address to be erasen
 | 
						|
 * @return              0 success
 | 
						|
 * @return              1 failed
 | 
						|
 */
 | 
						|
int iot_nandfc_erase_block(uint32_t addr);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_nandfc_read_data() - read the random data within addressed page
 | 
						|
 * @param data:         the pointer of read back data
 | 
						|
 * @param star_addr:    the start address to be read out
 | 
						|
 * @param lenth:        the byte number to be read back
 | 
						|
 * @return              0 success
 | 
						|
 * @                    1 failed
 | 
						|
 */
 | 
						|
int iot_nandfc_read_data(void* data, uint32_t star_addr, uint32_t lenth);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief nandfc_program_data_with_erase() - erase the block then write the 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 iot_nandfc_program_data_with_erase(const void* data, uint32_t star_addr, uint32_t byte_num);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief nandfc_init() - initialize the interface of nand flash
 | 
						|
 *
 | 
						|
 * @param cfg:          the pointer to nandflash initial config structure
 | 
						|
 * @return              0 success
 | 
						|
 * @                    1 failed
 | 
						|
 */
 | 
						|
int iot_nandfc_init(iot_nandfc_cfg_t *cfg);
 | 
						|
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif /*_IOT_NAND_FLASH_API_H*/
 |