54 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			54 lines
		
	
	
		
			2.0 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 FLASH_BENCH_H
							 | 
						||
| 
								 | 
							
								#define FLASH_BENCH_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "flash.h"
							 | 
						||
| 
								 | 
							
								#include "sbl_boot.h"
							 | 
						||
| 
								 | 
							
								#include "mtd.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define FLASH_BENCH_SIZE_1M 0x00100000
							 | 
						||
| 
								 | 
							
								#define FLASH_BENCH_SIZE_2M (FLASH_BENCH_SIZE_1M << 1)
							 | 
						||
| 
								 | 
							
								#define FLASH_BENCH_SIZE_4M (FLASH_BENCH_SIZE_1M << 2)
							 | 
						||
| 
								 | 
							
								#define FLASH_BENCH_SIZE_8M (FLASH_BENCH_SIZE_1M << 3)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define FLASH_BENCH_FLASH_BASE  FLASH_BASE_ADDRESS
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define FLASH_DEF_SECTOR_SIZE   (SECTOR_ERASE_SIZE)  /* TODO , Read from chip. */
							 | 
						||
| 
								 | 
							
								#define FLASH_DEF_PAGE_SIZE     (PAGE_PROGRAM_SIZE)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _bench_flash_infor_t {
							 | 
						||
| 
								 | 
							
								    uint32_t    chip_size;
							 | 
						||
| 
								 | 
							
								    uint16_t    sec_size;
							 | 
						||
| 
								 | 
							
								    uint16_t    id;
							 | 
						||
| 
								 | 
							
								}iot_flash_info_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void flash_bench_get_flash_image_offset(uint32_t part[], uint32_t *p_num);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								uint32_t flash_bench_get_flash_base_addr(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void flash_bench_read_contrl(void *data, uint32_t offset, uint32_t size);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void flash_bench_read_cache(void *data, uint32_t offset, uint32_t size);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void flash_bench_get_flash_info(iot_flash_info_t *p_info);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void get_offset_array(uint32_t part,uint8_t data[],uint32_t imglen);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void flash_bench_init(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* FLASH_BENCH_H */
							 |