Go to the documentation of this file.
52 #ifndef ___HAL_EXFLASH_H__
53 #define ___HAL_EXFLASH_H__
78 #define EXFLASH_ERROR_NONE ((uint32_t)0x00000000)
79 #define EXFLASH_ERROR_TIMEOUT ((uint32_t)0x00000001)
80 #define EXFLASH_ERROR_STATUS ((uint32_t)0x00000002)
81 #define EXFLASH_ERROR_TRANSFER ((uint32_t)0x00000003)
82 #define EXFLASH_ERROR_ID ((uint32_t)0x00000004)
83 #define EXFLASH_ERROR_QUAD ((uint32_t)0x00000005)
84 #define EXFLASH_ERROR_INVALID_PARAM ((uint32_t)0x00000006)
85 #define EXFLASH_ERROR_INIT ((uint32_t)0x00000007)
86 #define EXFLASH_ERROR_DEINIT ((uint32_t)0x00000008)
87 #define EXFLASH_ERROR_WAKEUP ((uint32_t)0x00000009)
88 #define EXFLASH_ERROR_DEEPSLEEP ((uint32_t)0x0000000A)
89 #define EXFLASH_ERROR_SUSPEND ((uint32_t)0x0000000B)
90 #define EXFLASH_ERROR_RESUME ((uint32_t)0x0000000C)
91 #define EXFLASH_ERROR_LOCK ((uint32_t)0x0000000D)
92 #define EXFLASH_ERROR_UNLOCK ((uint32_t)0x0000000E)
93 #define EXFLASH_ERROR_RESET ((uint32_t)0x0000000F)
94 #define EXFLASH_ERROR_ENABLE_QUAD ((uint32_t)0x00000010)
95 #define EXFLASH_ERROR_BUSY ((uint32_t)0x00000011)
101 #define EXFLASH_PROTECT_AREA_00000 0x00
102 #define EXFLASH_PROTECT_AREA_00001 0x01
104 #define EXFLASH_PROTECT_AREA_00010 0x02
106 #define EXFLASH_PROTECT_AREA_00011 0x03
108 #define EXFLASH_PROTECT_AREA_01001 0x09
110 #define EXFLASH_PROTECT_AREA_01010 0x0A
112 #define EXFLASH_PROTECT_AREA_01011 0x0B
114 #define EXFLASH_PROTECT_AREA_00100 0x04
115 #define EXFLASH_PROTECT_AREA_10001 0x11
117 #define EXFLASH_PROTECT_AREA_10010 0x12
119 #define EXFLASH_PROTECT_AREA_10011 0x13
121 #define EXFLASH_PROTECT_AREA_10100 0x14
123 #define EXFLASH_PROTECT_AREA_10110 0x16
125 #define EXFLASH_PROTECT_AREA_11001 0x19
127 #define EXFLASH_PROTECT_AREA_11010 0x1A
129 #define EXFLASH_PROTECT_AREA_11011 0x1B
131 #define EXFLASH_PROTECT_AREA_11100 0x1C
133 #define EXFLASH_PROTECT_AREA_11110 0x1E
135 #define EXFLASH_PROTECT_AREA_11111 0x1F
141 #define EXFLASH_LOCK_OTP 0x01
147 #define EXFLASH_ERASE_SECTOR 0
148 #define EXFLASH_ERASE_BLOCK32K 1
149 #define EXFLASH_ERASE_BLOCK 2
150 #define EXFLASH_ERASE_CHIP 3
156 #define EXFLASH_SINGLE_PAGE_TYPE 0
157 #define EXFLASH_DUAL_PAGE_TYPE 1
163 #define EXFLASH_OTP_BASEADDR1 0x000000
164 #define EXFLASH_OTP_BASEADDR2 0x000100
165 #define EXFLASH_OTP_BASEADDR3 0x000200
166 #define EXFLASH_OTP_BASEADDR4 0x000300
173 #define EXFLASH_SIZE_PAGE_BYTES ((uint32_t)256)
174 #define EXFLASH_SIZE_SECTOR_BYTES ((uint32_t)4096)
175 #define EXFLASH_SIZE_BLOCK_32K_BYTES ((uint32_t)32768)
176 #define EXFLASH_SIZE_BLOCK_BYTES ((uint32_t)65536)
178 #define EXFLASH_SIZE_CHIP_BYTES ((uint32_t)0x800000)
179 #define EXFLASH_START_ADDR FLASH_BASE
180 #define EXFLASH_SIZE GR5405_FLASH_SIZE
181 #define EXFLASH_END_ADDR (EXFLASH_START_ADDR + EXFLASH_SIZE)
183 #define EXFLASH_ALIAS_OFFSET (0x02000000UL)
239 uint32_t (*p_exflash_config)(uint32_t configure, uint32_t value);
241 uint32_t (*p_exflash_read)(uint32_t addr, uint8_t *p_data, uint32_t size);
242 uint32_t (*p_exflash_write)(uint32_t addr, uint8_t *p_data, uint32_t size);
243 uint32_t (*p_exflash_erase)(uint32_t erase_type, uint32_t addr, uint32_t size);
244 uint32_t (*p_exflash_block_protect)(uint32_t cmp, uint32_t bp);
245 uint32_t (*p_exflash_suspend)(void);
246 uint32_t (*p_exflash_resume)(void);
247 uint32_t (*p_exflash_deepsleep)(void);
248 uint32_t (*p_exflash_wakeup)(void);
249 uint32_t (*p_exflash_sr_erase)(uint32_t addr);
250 uint32_t (*p_exflash_sr_program)(uint32_t addr, uint8_t *p_data, uint32_t size);
251 uint32_t (*p_exflash_sr_read)(uint32_t addr, uint8_t *p_data, uint32_t size);
252 uint32_t (*p_exflash_sr_protect)(uint32_t lb);
268 #define HAL_EXFLASH_RETRY_DEFAULT_VALUE ((uint32_t)400000)
281 #define __HAL_EXFLASH_POWER_ON() ll_xqspi_enable_exflash_power()
286 #define __HAL_EXFLASH_POWER_OFF() ll_xqspi_disable_exflash_power()
struct _exflash_timing_param exflash_timing_param_t
exFlash AC characteristics
@ EXFLASH_CONFIG_PAGE_TYPE
EXFLASH function Structure definition.
Header file containing functions prototypes of XQSPI LL library.
@ EXFLASH_CONFIG_CLOCK_MODE
@ EXFLASH_CONFIG_CACHE_MODE
hal_status_t hal_exflash_wait_busy(uint32_t retry)
This function wait for the flash (in qspi mode) to exit the busy state.
Header file containing functions prototypes of XQSPI HAL library.
@ EXFLASH_CONFIG_READ_CMD
uint32_t hal_exflash_sr_erase(uint32_t addr)
Erase single flash security register.
void hal_exflash_deinit(void)
De-Initialize the exFlash.
uint32_t hal_exflash_sr_read(uint32_t addr, uint8_t *p_data, uint32_t size)
Read an amount of data from flash security register.
hal_status_t hal_exflash_write_status_reg(uint16_t reg_status)
This function writes the status register of a flash.
uint32_t hal_exflash_enable_quad(ll_xqspi_hp_init_t hp_init)
Enable Quad mode to allow Quad operation.
void hal_exflash_timing_set(exflash_timing_param_t *p_time)
Configure flash electrical characteristic parameters.
XQSPI High Performance mode init structures definition.
@ EXFLASH_CONFIG_CACHE_FLUSH
uint32_t hal_exflash_config(uint32_t configure, uint32_t value)
flash parameter configuration
ll_xqspi_hp_init_t exflash_hp_init_t
HP Mode structure definition.
uint32_t hal_exflash_sr_program(uint32_t addr, uint8_t *p_data, uint32_t size)
Write an amount of data into flash security register.
uint32_t hal_exflash_sr_protect(uint32_t lb)
This function provide the write protect control and status to the Security Registers.
uint32_t hal_exflash_write(uint32_t addr, uint8_t *p_data, uint32_t size)
Write an amount of data with specified instruction and address to flash.
uint32_t hal_exflash_erase(uint32_t erase_type, uint32_t addr, uint32_t size)
Erase flash region.
exFlash AC characteristics
@ EXFLASH_CONFIG_BAUD_RATE
hal_status_t
HAL Status structures definition.
hal_status_t hal_exflash_read_status_reg(uint16_t *p_reg_status)
This function reads the status register of a flash.
This file contains HAL common definitions, enumeration, macros and structures definitions.
uint32_t hal_exflash_init(exflash_func_t *exflash_func)
Initialize the exFlash according to the specified parameters in the exflash_init_t and initialize the...
uint32_t hal_exflash_wakeup(void)
exFlash will be released from Deep Power-Down Mode.
uint32_t hal_exflash_block_protect(uint32_t cmp, uint32_t bp)
Lock area of flash to be software protected against Write and Erase operation..
hal_status_t hal_exflash_read_uid(uint8_t *uid)
This function serves to read UID of flash.
uint32_t hal_exflash_read(uint32_t addr, uint8_t *p_data, uint32_t size)
Read an amount of data with specified instruction and address from flash.
uint32_t hal_exflash_deepsleep(void)
the exFlash will go to the Deep Power-Down Mode.
void hal_exflash_get_info(uint32_t *id, uint32_t *size)
Get flash id and size.