WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
sfc.c 文件参考
#include <stdbool.h>
#include <securec.h>
#include <tcxo.h>
#include <sfc_porting.h>
#include <hal_sfc.h>
#include "osal_interrupt.h"
#include "sfc.h"
sfc.c 的引用(Include)关系图:

宏定义

#define BYTES_64_MASK   0x3F
 
#define BYTES_4K_MASK   0xFFF
 
#define BYTES_4_MASK   0x3
 
#define BYTES_64K   0x10000
 
#define BYTES_4K   0x1000
 
#define BYTES_64   0x40
 
#define BYTES_4   0x4
 
#define BYTES_18   0x12
 
#define ERASE_CHIP   0
 
#define SFC_READ_TIME_SHIFT_NUM   6
 
#define GREEDY_MIN_ERASE_NUM   2
 

函数

STATIC errcode_t check_init_param (const sfc_flash_config_t *config)
 
STATIC errcode_t check_opt_param (uint32_t addr, uint32_t size)
 
STATIC errcode_t build_flash_ctrl (const flash_spi_info_t *spi_info, sfc_read_if_t read_type, sfc_write_if_t write_type)
 
STATIC errcode_t build_cmds (uint32_t flash_id, sfc_read_if_t read_type, sfc_write_if_t write_type)
 
STATIC errcode_t do_greedy_erase (uint32_t hal_erase_size, uint32_t start_sector)
 
errcode_t uapi_sfc_init (sfc_flash_config_t *config)
 初始化并配置SFC,未识别的Flash默认采用单线读写512KB的配置。
 
errcode_t uapi_sfc_init_rom (sfc_flash_config_t *config)
 初始化并配置SFC。rom 默认采用单线读写512KB的配置。
 
void uapi_sfc_deinit (void)
 去初始化SFC。
 
SFC_SECTION errcode_t uapi_sfc_reg_read (uint32_t flash_addr, uint8_t *read_buffer, uint32_t read_size)
 提供寄存器模式读功能,读取的数据将按字节存入read_buffer中。不允许在中断中调用。
 
SFC_SECTION errcode_t uapi_sfc_reg_write (uint32_t flash_addr, uint8_t *write_data, uint32_t write_size)
 提供寄存器模式写功能,预计写入的数据按字节存入write_data中。不允许在中断中调用。
 
SFC_SECTION errcode_t uapi_sfc_dma_read (uint32_t flash_addr, uint8_t *read_buffer, uint32_t read_size)
 提供DMA模式读功能,读取的数据将按字节存入read_buffer中。不允许在中断中调用。
 
SFC_SECTION errcode_t uapi_sfc_dma_write (uint32_t flash_addr, uint8_t *write_buffer, uint32_t write_size)
 提供寄存器模式写功能,预计写入的数据按字节存入write_data中。不允许在中断中调用。
 
SFC_SECTION errcode_t uapi_sfc_reg_erase (uint32_t flash_addr, uint32_t erase_size)
 使用寄存器模式进行对Flash的擦除,不使能写回时强制要求地址和大小按扇区对齐。不允许在中断中调用。
 
SFC_SECTION errcode_t uapi_sfc_reg_erase_chip (void)
 使用寄存器模式对整片Flash进行擦除。不允许在中断中调用。
 
SFC_SECTION errcode_t uapi_sfc_reg_other_flash_opt (sfc_flash_op_t cmd_type, uint8_t cmd, uint8_t *buffer, uint32_t length)
 使用寄存器模式对Flash属性进行读写。不允许在中断中调用。
 

宏定义说明

◆ BYTES_18

#define BYTES_18   0x12

◆ BYTES_4

#define BYTES_4   0x4

◆ BYTES_4_MASK

#define BYTES_4_MASK   0x3

◆ BYTES_4K

#define BYTES_4K   0x1000

◆ BYTES_4K_MASK

#define BYTES_4K_MASK   0xFFF

◆ BYTES_64

#define BYTES_64   0x40

◆ BYTES_64_MASK

#define BYTES_64_MASK   0x3F

Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved.

Description: Provides sfc driver source
History:
2022-11-29, Create file.

◆ BYTES_64K

#define BYTES_64K   0x10000

◆ ERASE_CHIP

#define ERASE_CHIP   0

◆ GREEDY_MIN_ERASE_NUM

#define GREEDY_MIN_ERASE_NUM   2

◆ SFC_READ_TIME_SHIFT_NUM

#define SFC_READ_TIME_SHIFT_NUM   6

函数说明

◆ build_cmds()

STATIC errcode_t build_cmds ( uint32_t  flash_id,
sfc_read_if_t  read_type,
sfc_write_if_t  write_type 
)

◆ build_flash_ctrl()

STATIC errcode_t build_flash_ctrl ( const flash_spi_info_t spi_info,
sfc_read_if_t  read_type,
sfc_write_if_t  write_type 
)

◆ check_init_param()

STATIC errcode_t check_init_param ( const sfc_flash_config_t config)

◆ check_opt_param()

STATIC errcode_t check_opt_param ( uint32_t  addr,
uint32_t  size 
)

◆ do_greedy_erase()

STATIC errcode_t do_greedy_erase ( uint32_t  hal_erase_size,
uint32_t  start_sector 
)