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"

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)
 
#define HAL_EXFLASH_ERROR_TIMEOUT   ((uint32_t)0x00000001)
 
#define HAL_EXFLASH_ERROR_TRANSFER   ((uint32_t)0x00000002)
 
#define HAL_EXFLASH_ERROR_ID   ((uint32_t)0x00000003)
 
#define HAL_EXFLASH_ERROR_QUAD   ((uint32_t)0x00000004)
 
#define HAL_EXFLASH_ERROR_INVALID_PARAM   ((uint32_t)0x00000008)
 
#define EXFLASH_ERASE_SECTOR   0
 
#define EXFLASH_ERASE_CHIP   1
 
#define EXFLASH_SIZE_PAGE_BYTES   ((uint32_t)256)
 
#define EXFLASH_SIZE_SECTOR_BYTES   ((uint32_t)4096)
 
#define EXFLASH_SIZE_CHIP_BYTES   ((uint32_t)0x800000)
 
#define EXFLASH_START_ADDR   FLASH_BASE
 
#define EXFLASH_SIZE   (0x00800000UL)
 
#define EXFLASH_END_ADDR   (EXFLASH_START_ADDR + EXFLASH_SIZE)
 
#define EXFLASH_ALIAS_OFFSET   (0x02000000UL)
 
#define EXFLASH_ALIAS_ADDR   (EXFLASH_START_ADDR + EXFLASH_ALIAS_OFFSET)
 
#define EXFLASH_LOCK_AREA_NONE   0
 
#define EXFLASH_LOCK_AREA_UPPER_1_8   1
 
#define EXFLASH_LOCK_AREA_UPPER_1_4   2
 
#define EXFLASH_LOCK_AREA_UPPER_1_2   3
 
#define EXFLASH_LOCK_AREA_LOWER_1_8   9
 
#define EXFLASH_LOCK_AREA_LOWER_1_4   10
 
#define EXFLASH_LOCK_AREA_LOWER_1_2   11
 
#define EXFLASH_LOCK_AREA_ALL   12
 
#define EXFLASH_LOCK_AREA_TOP_4K   17
 
#define EXFLASH_LOCK_AREA_TOP_8K   18
 
#define EXFLASH_LOCK_AREA_TOP_16K   19
 
#define EXFLASH_LOCK_AREA_TOP_32K   20
 
#define EXFLASH_LOCK_AREA_BOTTOM_4K   25
 
#define EXFLASH_LOCK_AREA_BOTTOM_8K   26
 
#define EXFLASH_LOCK_AREA_BOTTOM_16K   27
 
#define EXFLASH_LOCK_AREA_BOTTOM_32K   28
 
#define EXFLASH_LOCK_AREA_LOWER_7_8   33
 
#define EXFLASH_LOCK_AREA_LOWER_3_4   34
 
#define EXFLASH_LOCK_AREA_UPPER_7_8   41
 
#define EXFLASH_LOCK_AREA_UPPER_3_4   42
 
#define EXFLASH_LOCK_AREA_LOWER_127_128   49
 
#define EXFLASH_LOCK_AREA_LOWER_63_64   50
 
#define EXFLASH_LOCK_AREA_LOWER_31_32   51
 
#define EXFLASH_LOCK_AREA_LOWER_15_16   52
 
#define EXFLASH_LOCK_AREA_UPPER_127_128   57
 
#define EXFLASH_LOCK_AREA_UPPER_63_64   58
 
#define EXFLASH_LOCK_AREA_UPPER_31_32   59
 
#define EXFLASH_LOCK_AREA_UPPER_15_16   60
 
#define HAL_EXFLASH_RETRY_DEFAULT_VALUE   ((uint32_t)400000)
 
#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. exFlash will return to its default power-on state and lose all the current volatile settings. More...
 
hal_status_t hal_exflash_encrypt_mode (exflash_handle_t *p_exflash, uint32_t read_offset, uint32_t key_addr)
 Specify the offset address and encrypted KEY address read by XIP. More...
 
hal_status_t hal_exflash_write_expand (exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size)
 Expand write an amount of data with specified instruction and address to flash. More...
 
hal_status_t hal_exflash_read_expand (exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size)
 Expand read an amount of data with specified instruction and address from flash. 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...
 

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.