103 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			103 lines
		
	
	
		
			3.3 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 IOT_SG_FLASH_API_H
 | 
						|
#define IOT_SG_FLASH_API_H
 | 
						|
 | 
						|
/* os shim includes */
 | 
						|
#include "os_types_api.h"
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_sg_flash_init - sg flash space init.
 | 
						|
 * @retval: size - flash space size.
 | 
						|
 */
 | 
						|
uint32_t iot_sg_flash_init(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_sg_flash_size_query - query flash space size. unit is
 | 
						|
 *                                  1 byte.
 | 
						|
 * @retval: size - flash space size.
 | 
						|
 */
 | 
						|
uint32_t iot_sg_flash_size_query(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_sg_flash_erase_once_query - query flash erase once size, unit is
 | 
						|
 *                                        1 byte.
 | 
						|
 * retval: size - flash erase once size
 | 
						|
 * retval: 0 - query failed
 | 
						|
 */
 | 
						|
uint32_t iot_sg_flash_erase_once_query(void);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_sg_flash_write - write data into customer flash area.
 | 
						|
 * @param write_offset: write data offset.
 | 
						|
 * @param write_len: length of write data.
 | 
						|
 * @param p_write_buf: the pointer to write data.
 | 
						|
 * @retval: ERR_OK - for success case.
 | 
						|
 * @retval: otherwise - error code.
 | 
						|
 */
 | 
						|
uint32_t iot_sg_flash_write(uint32_t write_offset,
 | 
						|
    uint32_t write_len, uint8_t *p_write_buf);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_sg_flash_read - read data from customer flash area.
 | 
						|
 * @param read_offset: read data offset.
 | 
						|
 * @param read_len: length of read data.
 | 
						|
 * @param p_read_buf: the pointer to read data cache.
 | 
						|
 * @retval: ERR_OK - for success case.
 | 
						|
 * @retval: otherwise - error code.
 | 
						|
 */
 | 
						|
uint32_t iot_sg_flash_read(uint32_t read_offset,
 | 
						|
    uint32_t read_len, uint8_t *p_read_buf);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_sg_flash_erase - erase data from customer flash area.
 | 
						|
 * @param erase_offset: erase data offset.
 | 
						|
 * @param erase_len: length of erase data.
 | 
						|
 * @retval: ERR_OK - for success case.
 | 
						|
 * @retval: otherwise - error code.
 | 
						|
 */
 | 
						|
uint32_t iot_sg_flash_erase(uint32_t erase_offset, uint32_t erase_len);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_sg_flash_write_without_erase - write data into customer flash area
 | 
						|
 *        without erase.
 | 
						|
 * @param write_offset: write data offset.
 | 
						|
 * @param write_len: length of write data.
 | 
						|
 * @param p_write_buf: the pointer to write data.
 | 
						|
 * @retval: ERR_OK - for success case.
 | 
						|
 * @retval: otherwise - error code.
 | 
						|
 */
 | 
						|
 | 
						|
uint32_t iot_sg_flash_write_without_erase(uint32_t write_offset,
 | 
						|
    uint32_t write_len, uint8_t *p_write_buf);
 | 
						|
 | 
						|
/**
 | 
						|
 * @brief iot_sg_flash_type_is_internal_check - check flash type is
 | 
						|
 *        internal or external.
 | 
						|
 * @retval: ERR_OK - flash type is internal.
 | 
						|
 * @retval: otherwise - flash type is external.
 | 
						|
 */
 | 
						|
uint32_t iot_sg_flash_type_is_internal_check(void);
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif  /* IOT_SG_FLASH_API_H */
 |