gr55xx_hal_exflash.h File Reference

Header file containing functions prototypes of EXFLASH HAL library. More...

#include "gr55xx_ll_xqspi.h"
#include "gr55xx_hal_xqspi.h"
#include "gr55xx_hal_def.h"
+ Include dependency graph for gr55xx_hal_exflash.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _exflash_handle
 exFlash handle Structure definition More...
 
struct  _hal_exflash_callback
 HAL_EXFLASH Callback function definition. More...
 

Macros

#define HAL_EXFLASH_ERROR_NONE   ((uint32_t)0x00000000)
 No error
More...
 
#define HAL_EXFLASH_ERROR_TIMEOUT   ((uint32_t)0x00000001)
 Timeout error
More...
 
#define HAL_EXFLASH_ERROR_TRANSFER   ((uint32_t)0x00000002)
 Transfer error
More...
 
#define HAL_EXFLASH_ERROR_ID   ((uint32_t)0x00000003)
 Flash ID error
More...
 
#define HAL_EXFLASH_ERROR_QUAD   ((uint32_t)0x00000004)
 Quad mode error
More...
 
#define HAL_EXFLASH_ERROR_INVALID_PARAM   ((uint32_t)0x00000008)
 Invalid parameters error. More...
 
#define EXFLASH_ERASE_SECTOR   0
 Sector erase. More...
 
#define EXFLASH_ERASE_CHIP   1
 Chip erase
More...
 
#define EXFLASH_SIZE_PAGE_BYTES   ((uint32_t)256)
 Page size in Bytes
More...
 
#define EXFLASH_SIZE_SECTOR_BYTES   ((uint32_t)4096)
 Sector size in Bytes
More...
 
#define EXFLASH_SIZE_CHIP_BYTES   ((uint32_t)0x800000)
 Chip size in Bytes
More...
 
#define EXFLASH_START_ADDR   FLASH_BASE
 Flash start address
More...
 
#define EXFLASH_SIZE   (0x00800000UL)
 Flash size
More...
 
#define EXFLASH_END_ADDR   (EXFLASH_START_ADDR + EXFLASH_SIZE)
 Flash end address
More...
 
#define EXFLASH_ALIAS_OFFSET   (0x02000000UL)
 Alias address offset
More...
 
#define EXFLASH_ALIAS_ADDR   (EXFLASH_START_ADDR + EXFLASH_ALIAS_OFFSET)
 Alias start address
More...
 
#define EXFLASH_LOCK_AREA_NONE   0
 Offset NONE
More...
 
#define EXFLASH_LOCK_AREA_UPPER_1_8   1
 Offset 0x070000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_UPPER_1_4   2
 Offset 0x060000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_UPPER_1_2   3
 Offset 0x040000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_LOWER_1_8   9
 Offset 0x000000 - 0x00FFFF. More...
 
#define EXFLASH_LOCK_AREA_LOWER_1_4   10
 Offset 0x000000 - 0x01FFFF. More...
 
#define EXFLASH_LOCK_AREA_LOWER_1_2   11
 Offset 0x000000 - 0x03FFFF. More...
 
#define EXFLASH_LOCK_AREA_ALL   12
 Offset 0x000000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_TOP_4K   17
 Offset 0x07F000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_TOP_8K   18
 Offset 0x07E000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_TOP_16K   19
 Offset 0x07C000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_TOP_32K   20
 Offset 0x078000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_BOTTOM_4K   25
 Offset 0x000000 - 0x000FFF. More...
 
#define EXFLASH_LOCK_AREA_BOTTOM_8K   26
 Offset 0x000000 - 0x001FFF. More...
 
#define EXFLASH_LOCK_AREA_BOTTOM_16K   27
 Offset 0x000000 - 0x003FFF. More...
 
#define EXFLASH_LOCK_AREA_BOTTOM_32K   28
 Offset 0x000000 - 0x007FFF. More...
 
#define EXFLASH_LOCK_AREA_LOWER_7_8   33
 Offset 0x070000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_LOWER_3_4   34
 Offset 0x060000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_UPPER_7_8   41
 Offset 0x000000 - 0x00FFFF. More...
 
#define EXFLASH_LOCK_AREA_UPPER_3_4   42
 Offset 0x000000 - 0x01FFFF. More...
 
#define EXFLASH_LOCK_AREA_LOWER_127_128   49
 Offset 0x000000 - 0x07EFFF. More...
 
#define EXFLASH_LOCK_AREA_LOWER_63_64   50
 Offset 0x000000 - 0x07DFFF. More...
 
#define EXFLASH_LOCK_AREA_LOWER_31_32   51
 Offset 0x000000 - 0x07BFFF. More...
 
#define EXFLASH_LOCK_AREA_LOWER_15_16   52
 Offset 0x000000 - 0x077FFF. More...
 
#define EXFLASH_LOCK_AREA_UPPER_127_128   57
 Offset 0x001000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_UPPER_63_64   58
 Offset 0x002000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_UPPER_31_32   59
 Offset 0x004000 - 0x07FFFF. More...
 
#define EXFLASH_LOCK_AREA_UPPER_15_16   60
 Offset 0x008000 - 0x07FFFF. More...
 
#define HAL_EXFLASH_RETRY_DEFAULT_VALUE   ((uint32_t)400000)
 400000 times More...
 
#define __HAL_EXFLASH_RESET_HANDLE_STATE(__HANDLE__)   ((__HANDLE__)->state = HAL_EXFLASH_STATE_RESET)
 Reset exFlash handle states. More...
 
#define __HAL_EXFLASH_POWER_ON()   ll_xqspi_enable_exflash_power()
 Enable the specified exFlash power. More...
 
#define __HAL_EXFLASH_POWER_OFF()   ll_xqspi_disable_exflash_power()
 Disable the specified exFlash power. More...
 
#define IS_EXFLASH_ERASE_TYPE(__TYPE__)
 Check if exFlash erase type is valid. More...
 
#define IS_EXFLASH_LOCK_AREA(__AREA__)
 Check if exFlash lock area type is valid. More...
 

Typedefs

typedef struct _exflash_handle exflash_handle_t
 exFlash handle Structure definition More...
 
typedef struct _hal_exflash_callback hal_exflash_callback_t
 HAL_EXFLASH Callback function definition. More...
 
typedef hal_status_t(* exflash_operation_func) (exflash_handle_t *p_exflash)
 HAL exFlash operation function. More...
 

Enumerations

enum  hal_exflash_state_t {
  HAL_EXFLASH_STATE_RESET = 0x00, HAL_EXFLASH_STATE_READY = 0x01, HAL_EXFLASH_STATE_BUSY = 0x02, HAL_EXFLASH_STATE_BUSY_READ = 0x12,
  HAL_EXFLASH_STATE_BUSY_WRITE = 0x22, HAL_EXFLASH_STATE_BUSY_ERASE = 0x42, HAL_EXFLASH_STATE_SUSPEND_WRITE = 0x21, HAL_EXFLASH_STATE_SUSPEND_ERASE = 0x41,
  HAL_EXFLASH_STATE_ERROR = 0x04
}
 HAL exFlash State Enumerations definition. More...
 
enum  hal_eflash_security { HAL_EXFLASH_UNENCRYPTED = 0x00, HAL_EXFLASH_ENCRYPTED = 0x01 }
 HAL exFlash Security Enumerations definition. More...
 

Functions

hal_status_t hal_exflash_init (exflash_handle_t *p_exflash)
 Initialize the exFlash according to the specified parameters in the exflash_init_t and initialize the associated handle. More...
 
hal_status_t hal_exflash_deinit (exflash_handle_t *p_exflash)
 De-initialize the exFlash peripheral. More...
 
void hal_exflash_msp_init (exflash_handle_t *p_exflash)
 Initialize the exFlash MSP. More...
 
void hal_exflash_msp_deinit (exflash_handle_t *p_exflash)
 De-initialize the exFlash MSP. More...
 
hal_status_t hal_exflash_operation_protection (exflash_handle_t *p_exflash, uint32_t base_priority)
 During Flash erase/write operation, Disable external interrupts with a priority less than or equal to base_priority in the system. More...
 
hal_status_t hal_exflash_write (exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size)
 Write an amount of data with specified instruction and address to flash. More...
 
hal_status_t hal_exflash_read (exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size)
 Read an amount of data with specified instruction and address from flash. More...
 
hal_status_t hal_exflash_read_align_word (exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size)
 [High speed]Read an amount of data with specified instruction and address from flash. More...
 
hal_status_t hal_exflash_erase (exflash_handle_t *p_exflash, uint32_t erase_type, uint32_t addr, uint32_t size)
 Erase flash region. More...
 
hal_status_t hal_exflash_suspend (exflash_handle_t *p_exflash)
 Suspend flash pragram/erase. More...
 
hal_status_t hal_exflash_resume (exflash_handle_t *p_exflash)
 Resume flash pragram/erase. More...
 
hal_status_t hal_exflash_lock (exflash_handle_t *p_exflash, uint32_t lock_type)
 Lock area of flash to be software protected against Write and Erase operation. More...
 
hal_status_t hal_exflash_unlock (exflash_handle_t *p_exflash)
 Unlock write/erase protected in flash. More...
 
hal_status_t hal_exflash_deepsleep (exflash_handle_t *p_exflash)
 the exFlash will go to the Deep Power-Down Mode. More...
 
hal_status_t hal_exflash_wakeup (exflash_handle_t *p_exflash)
 exFlash will be released from Deep Power-Down Mode. More...
 
hal_status_t hal_exflash_reset (exflash_handle_t *p_exflash)
 Reset exFlash. More...
 
hal_exflash_state_t hal_exflash_get_state (exflash_handle_t *p_exflash)
 Return the exFlash handle state. More...
 
uint32_t hal_exflash_get_error (exflash_handle_t *p_exflash)
 Return the exFlash error code. More...
 
void hal_exflash_set_retry (exflash_handle_t *p_exflash, uint32_t retry)
 Set the exFlash internal process timeout value. More...
 
hal_status_t hal_exflash_operation (exflash_handle_t *p_exflash, exflash_operation_func p_func_exflash_operation)
 Call user XIP Flash operation functon. More...
 
hal_status_t hal_exflash_read_status_reg (uint16_t *p_reg_status)
 This function reads the status register of a flash. More...
 
hal_status_t hal_exflash_write_status_reg (uint16_t reg_status)
 This function writes the status register of a flash. More...
 
hal_status_t hal_exflash_read_uid (uint8_t *uid)
 This function serves to read UID of flash. More...
 

Detailed Description

Header file containing functions prototypes of EXFLASH HAL library.

Author
BLE Driver Team
Attention
Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file gr55xx_hal_exflash.h.