92 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			92 lines
		
	
	
		
			2.7 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 _NOR_FLASH_H
 | ||
|  | #define _NOR_FLASH_H
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #ifndef ENABLE
 | ||
|  | #define ENABLE  1
 | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #ifndef DISABLE
 | ||
|  | #define DISABLE 0
 | ||
|  | #endif
 | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief norfc_one_byte_comand_send() - send one byte cammand | ||
|  |  * @param cmd:          the cammand to be sent | ||
|  |  * @return              0 success | ||
|  |  *                      1 failed | ||
|  |  */ | ||
|  | uint8_t norfc_one_byte_comand_send(uint8_t cmd); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief norfc_write_en_switch() - disable or enable writing | ||
|  |  * @param en:           0 -- disable, 1-- enable | ||
|  |  * @return              0 success | ||
|  |  *                      1 failed | ||
|  |  */ | ||
|  | uint8_t norfc_write_en_switch(uint8_t en); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief norfc_get_status_reg() - get flash status registor's value | ||
|  |  * @param reg:          status registor | ||
|  |  * @return              status registor value | ||
|  |  */ | ||
|  | uint8_t norfc_get_status_reg(uint8_t reg); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief norfc_is_flash_busy() - check the flash is busy or not | ||
|  |  * @param NULL | ||
|  |  * @return              1 -- busy, 0 -- idle | ||
|  |  */ | ||
|  | uint32_t norfc_is_flash_busy(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief norfc_set_status_reg() - set flash status registor's value | ||
|  |  * @param data:         the data's pointer to be set | ||
|  |  * @param byte_num:     the lenth of data to be set | ||
|  |  * @return              0 success | ||
|  |  *                      1 failed | ||
|  |  */ | ||
|  | uint8_t norfc_set_status_reg(const void *data, uint8_t byte_num); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief norfc_set_cfg_reg() - set config  registor value | ||
|  |  * @param data:         the data to be set | ||
|  |  * @return              0 success | ||
|  |  *                      1 failed | ||
|  |  */ | ||
|  | uint8_t norfc_set_cfg_reg(uint8_t data); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief norfc_read_data_bytes() - normal read data for address | ||
|  |  * @param data:         the data pointer | ||
|  |  * @param star_addr:    the start address | ||
|  |  * @param lenth:        the lenth of reading data | ||
|  |  * @return              0 success | ||
|  |  *                      1 failed | ||
|  |  */ | ||
|  | uint8_t norfc_read_data_bytes( void* data, uint32_t star_addr, uint32_t lenth); | ||
|  | 
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif /*_NOR_FLASH_H*/
 |