hal_exflash.h File Reference

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

#include "ll_xqspi.h"
#include "hal_xqspi.h"
#include "hal_def.h"

Go to the source code of this file.

Classes

struct  _exflash_timing_param
 exFlash AC characteristics More...
 
struct  exflash_func_t
 EXFLASH function Structure definition. More...
 

Macros

#define EXFLASH_ERROR_NONE   ((uint32_t)0x00000000)
 
#define EXFLASH_ERROR_TIMEOUT   ((uint32_t)0x00000001)
 
#define EXFLASH_ERROR_STATUS   ((uint32_t)0x00000002)
 
#define EXFLASH_ERROR_TRANSFER   ((uint32_t)0x00000003)
 
#define EXFLASH_ERROR_ID   ((uint32_t)0x00000004)
 
#define EXFLASH_ERROR_QUAD   ((uint32_t)0x00000005)
 
#define EXFLASH_ERROR_INVALID_PARAM   ((uint32_t)0x00000006)
 
#define EXFLASH_ERROR_INIT   ((uint32_t)0x00000007)
 
#define EXFLASH_ERROR_DEINIT   ((uint32_t)0x00000008)
 
#define EXFLASH_ERROR_WAKEUP   ((uint32_t)0x00000009)
 
#define EXFLASH_ERROR_DEEPSLEEP   ((uint32_t)0x0000000A)
 
#define EXFLASH_ERROR_SUSPEND   ((uint32_t)0x0000000B)
 
#define EXFLASH_ERROR_RESUME   ((uint32_t)0x0000000C)
 
#define EXFLASH_ERROR_LOCK   ((uint32_t)0x0000000D)
 
#define EXFLASH_ERROR_UNLOCK   ((uint32_t)0x0000000E)
 
#define EXFLASH_ERROR_RESET   ((uint32_t)0x0000000F)
 
#define EXFLASH_ERROR_ENABLE_QUAD   ((uint32_t)0x00000010)
 
#define EXFLASH_ERROR_BUSY   ((uint32_t)0x00000011)
 
#define EXFLASH_PROTECT_AREA_00000   0x00
 
#define EXFLASH_PROTECT_AREA_00001   0x01
 
#define EXFLASH_PROTECT_AREA_00010   0x02
 
#define EXFLASH_PROTECT_AREA_00011   0x03
 
#define EXFLASH_PROTECT_AREA_01001   0x09
 
#define EXFLASH_PROTECT_AREA_01010   0x0A
 
#define EXFLASH_PROTECT_AREA_01011   0x0B
 
#define EXFLASH_PROTECT_AREA_00100   0x04
 
#define EXFLASH_PROTECT_AREA_10001   0x11
 
#define EXFLASH_PROTECT_AREA_10010   0x12
 
#define EXFLASH_PROTECT_AREA_10011   0x13
 
#define EXFLASH_PROTECT_AREA_10100   0x14
 
#define EXFLASH_PROTECT_AREA_10110   0x16
 
#define EXFLASH_PROTECT_AREA_11001   0x19
 
#define EXFLASH_PROTECT_AREA_11010   0x1A
 
#define EXFLASH_PROTECT_AREA_11011   0x1B
 
#define EXFLASH_PROTECT_AREA_11100   0x1C
 
#define EXFLASH_PROTECT_AREA_11110   0x1E
 
#define EXFLASH_PROTECT_AREA_11111   0x1F
 
#define EXFLASH_LOCK_OTP   0x01
 
#define EXFLASH_ERASE_SECTOR   0
 
#define EXFLASH_ERASE_BLOCK32K   1
 
#define EXFLASH_ERASE_BLOCK   2
 
#define EXFLASH_ERASE_CHIP   3
 
#define EXFLASH_SINGLE_PAGE_TYPE   0
 
#define EXFLASH_DUAL_PAGE_TYPE   1
 
#define EXFLASH_OTP_BASEADDR1   0x000000
 
#define EXFLASH_OTP_BASEADDR2   0x000100
 
#define EXFLASH_OTP_BASEADDR3   0x000200
 
#define EXFLASH_OTP_BASEADDR4   0x000300
 
#define EXFLASH_SIZE_PAGE_BYTES   ((uint32_t)256)
 
#define EXFLASH_SIZE_SECTOR_BYTES   ((uint32_t)4096)
 
#define EXFLASH_SIZE_BLOCK_32K_BYTES   ((uint32_t)32768)
 
#define EXFLASH_SIZE_BLOCK_BYTES   ((uint32_t)65536)
 
#define EXFLASH_SIZE_CHIP_BYTES   ((uint32_t)0x800000)
 
#define EXFLASH_START_ADDR   FLASH_BASE
 
#define EXFLASH_SIZE   GR5405_FLASH_SIZE
 
#define EXFLASH_END_ADDR   (EXFLASH_START_ADDR + EXFLASH_SIZE)
 
#define EXFLASH_ALIAS_OFFSET   (0x02000000UL)
 
#define HAL_EXFLASH_RETRY_DEFAULT_VALUE   ((uint32_t)400000)
 
#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...
 

Typedefs

typedef struct _exflash_timing_param exflash_timing_param_t
 exFlash AC characteristics More...
 
typedef ll_xqspi_hp_init_t exflash_hp_init_t
 HP Mode structure definition. More...
 

Enumerations

enum  {
  BLE_GATT_COMMON_EVT_MTU_EXCHANGE = BLE_GATT_COMMON_EVT_BASE,
  BLE_GATT_COMMON_EVT_PRF_REGISTER,
  BLE_GATT_COMMON_EVT_MAX,
  AMS_PLAYER_ATTR_ID_NAME,
  AMS_PLAYER_ATTR_ID_PLAYBACK_INFO,
  AMS_PLAYER_ATTR_ID_VOLUME,
  IAS_ALERT_NONE,
  IAS_ALERT_MILD,
  IAS_ALERT_HIGH,
  EXFLASH_CONFIG_CACHE_MODE = 0x00,
  EXFLASH_CONFIG_READ_CMD = 0x01,
  EXFLASH_CONFIG_BAUD_RATE = 0x02,
  EXFLASH_CONFIG_CLOCK_MODE = 0x03,
  EXFLASH_CONFIG_CACHE_FLUSH = 0x04,
  EXFLASH_CONFIG_PAGE_TYPE = 0x05,
  LL_PWM_FLICKER_MODE = 0x00,
  LL_PWM_BREATH_MODE,
  LL_PWM_CODING_MODE,
  DFU_CACHE_TYPE_CALL_STACK = 0x00,
  DFU_CACHE_TYPE_REG,
  TRC_PWR_WFE_MODE = 0,
  TRC_PWR_DSLEEP_MODE,
  TRC_PWR_ACTIVE_MODE,
  TRC_PWR_BLE_RET_DSLEEP,
  TRC_PWR_APP_TIMER_REFUSE,
  TRC_PWR_APP_TIMER_PASS,
  TRC_PWR_BLE_TIMER_REFUSE,
  TRC_PWR_BLE_TIMER_PASS,
  TRC_PWR_RTC_TIMER_REFUSE,
  TRC_PWR_RTC_TIMER_PASS,
  TRC_PWR_RTC1_TIMER_REFUSE,
  TRC_PWR_RTC1_TIMER_PASS,
  TRC_PWR_WDT_TIMER_REFUSE,
  TRC_PWR_WDT_TIMER_PASS
}
 

Functions

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 associated handle. More...
 
void hal_exflash_deinit (void)
 De-Initialize the exFlash. More...
 
void hal_exflash_timing_set (exflash_timing_param_t *p_time)
 Configure flash electrical characteristic parameters. More...
 
void hal_exflash_get_info (uint32_t *id, uint32_t *size)
 Get flash id and size. More...
 
uint32_t hal_exflash_config (uint32_t configure, uint32_t value)
 flash parameter configuration More...
 
uint32_t hal_exflash_enable_quad (ll_xqspi_hp_init_t hp_init)
 Enable Quad mode to allow Quad operation. More...
 
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. More...
 
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. More...
 
uint32_t hal_exflash_erase (uint32_t erase_type, uint32_t addr, uint32_t size)
 Erase flash region. More...
 
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.. More...
 
uint32_t hal_exflash_deepsleep (void)
 the exFlash will go to the Deep Power-Down Mode. More...
 
uint32_t hal_exflash_wakeup (void)
 exFlash will be released from Deep Power-Down Mode. More...
 
uint32_t hal_exflash_sr_erase (uint32_t addr)
 Erase single flash security register. More...
 
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. More...
 
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. More...
 
uint32_t hal_exflash_sr_protect (uint32_t lb)
 This function provide the write protect control and status to the Security Registers. 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...
 
hal_status_t hal_exflash_wait_busy (uint32_t retry)
 This function wait for the flash (in qspi mode) to exit the busy state. 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 hal_exflash.h.