#include <stdint.h>
#include <string.h>
#include <stdbool.h>
浏览源代码.
|
int32_t | spic_cmd (uint32_t spic_base, spic_base_config_p spic_base_config) |
| spic向flash发送命令 更多...
|
|
int32_t | spic_read_by_cpu (uint32_t spic_base, spic_base_config_p spic_base_config, uint8_t *read_data, uint32_t read_len) |
| spic以CPU的方式向flash读数据 更多...
|
|
int32_t | spic_write_by_cpu (uint32_t spic_base, spic_base_config_p spic_base_config, uint8_t *write_data, uint32_t write_len) |
| spic以CPU的方式向flash写数据 更多...
|
|
int32_t | spic_read_by_dma (uint32_t spic_base, spic_base_config_p spic_base_config, uint8_t *read_data, uint32_t read_len) |
| spic以DMA的方式向flash读数据 更多...
|
|
int32_t | spic_write_by_dma (uint32_t spic_base, spic_base_config_p spic_base_config, uint8_t *write_data, uint32_t write_len) |
| spic以DMA的方式向flash写数据 更多...
|
|
int32_t | spic_read_xip (uint32_t spic_base, spic_base_config_p spic_base_config, uint8_t *read_data, uint32_t read_len) |
|
int32_t | spic_init (uint32_t spic_base, spic_init_p init) |
| spic控制器初始化 更多...
|
|
int32_t | spic_clk_phase_set (uint32_t spic_base, uint32_t tx_shift, uint32_t tx_nege_en, uint32_t rx_shift, uint32_t rx_nege_en) |
| flash时钟相位调制 更多...
|
|
void | spic_hardware_reset (uint32_t spic_base, uint8_t enable) |
|
int32_t | spic_xip_config (uint32_t spic_base, spic_base_config_p spic_base_config) |
|
void | spic_prefetch_en (uint32_t spic_base, bool en) |
| flash预取开关 更多...
|
|
void | spic_change_clk (uint32_t spic_base, flash_clk_div_t clk) |
|
◆ spic_init_t
成员变量 |
uint32_t |
addr_size |
功能:地址宽度(单位Byte)
|
flash_clk_div_t |
flash_clk_div |
功能:flash时钟分频
|
uint32_t |
flash_sel |
功能:flash选择:0:flash0;1:flash1
|
◆ spic_base_config_t
struct spic_base_config_t |
成员变量 |
uint32_t |
addr |
功能:操作地址
|
uint32_t |
addr_en |
功能:地址是否有效
|
uint32_t |
cmd0 |
功能:命令0
|
uint32_t |
cmd1 |
功能:命令1
|
md_sel_t |
cmd_md |
功能:命令模式
|
md_sel_t |
data_md |
功能:数据模式
|
uint32_t |
dummy |
功能:Dummy周期
|
uint32_t |
dummy_en |
功能:Dummy是否有效
|
◆ DELAY_LINE
◆ RX_NAGE_EN
◆ RX_NAGE_SAMPLE
◆ SPIC_DMA_MODEFI
#define SPIC_DMA_MODEFI 0 |
◆ spic_base_config_p
◆ spic_init_p
◆ spic_change_clk()
void spic_change_clk |
( |
uint32_t |
spic_base, |
|
|
flash_clk_div_t |
clk |
|
) |
| |
◆ spic_clk_phase_set()
int32_t spic_clk_phase_set |
( |
uint32_t |
spic_base, |
|
|
uint32_t |
tx_shift, |
|
|
uint32_t |
tx_nege_en, |
|
|
uint32_t |
rx_shift, |
|
|
uint32_t |
rx_nege_en |
|
) |
| |
flash时钟相位调制
- 参数
-
tx_shift | 偏移X个core_clk,注意X必须小于core_clk与flash_clk的频率倍数(dtr模式下小于倍数的一半) |
tx_nege_en | 配置为1时在shift的基础上再向后平移半个core_clk周期 |
rx_shift | 偏移X个core_clk,注意X必须小于core_clk与flash_clk的频率倍数(dtr模式下小于倍数的一半) |
rx_nege_en | 配置为1时在shift的基础上再向后平移半个core_clk周期 |
- 返回
- int32_t 0:成功;1:失败;
◆ spic_cmd()
spic向flash发送命令
- 参数
-
- 返回
- int32_t 0:成功;1:失败;
◆ spic_hardware_reset()
void spic_hardware_reset |
( |
uint32_t |
spic_base, |
|
|
uint8_t |
enable |
|
) |
| |
◆ spic_init()
int32_t spic_init |
( |
uint32_t |
spic_base, |
|
|
spic_init_p |
init |
|
) |
| |
spic控制器初始化
- 参数
-
- 返回
- int32_t 0:成功;1:失败;
◆ spic_prefetch_en()
void spic_prefetch_en |
( |
uint32_t |
spic_base, |
|
|
bool |
en |
|
) |
| |
◆ spic_read_by_cpu()
int32_t spic_read_by_cpu |
( |
uint32_t |
spic_base, |
|
|
spic_base_config_p |
spic_base_config, |
|
|
uint8_t * |
read_data, |
|
|
uint32_t |
read_len |
|
) |
| |
spic以CPU的方式向flash读数据
- 参数
-
spic_base_config | 配置结构体指针 |
read_data | 数据指针 |
read_len | 数据长度 |
- 返回
- int32_t 0:成功;1:失败;
◆ spic_read_by_dma()
int32_t spic_read_by_dma |
( |
uint32_t |
spic_base, |
|
|
spic_base_config_p |
spic_base_config, |
|
|
uint8_t * |
read_data, |
|
|
uint32_t |
read_len |
|
) |
| |
spic以DMA的方式向flash读数据
- 参数
-
spic_base_config | 配置结构体指针 |
read_data | 数据指针 |
read_len | 数据长度 |
- 返回
- int32_t 0:成功;1:失败;
◆ spic_read_xip()
int32_t spic_read_xip |
( |
uint32_t |
spic_base, |
|
|
spic_base_config_p |
spic_base_config, |
|
|
uint8_t * |
read_data, |
|
|
uint32_t |
read_len |
|
) |
| |
◆ spic_write_by_cpu()
int32_t spic_write_by_cpu |
( |
uint32_t |
spic_base, |
|
|
spic_base_config_p |
spic_base_config, |
|
|
uint8_t * |
write_data, |
|
|
uint32_t |
write_len |
|
) |
| |
spic以CPU的方式向flash写数据
- 参数
-
spic_base_config | 配置结构体指针 |
write_data | 数据指针 |
write_len | 数据长度 |
- 返回
- int32_t 0:成功;1:失败;
◆ spic_write_by_dma()
int32_t spic_write_by_dma |
( |
uint32_t |
spic_base, |
|
|
spic_base_config_p |
spic_base_config, |
|
|
uint8_t * |
write_data, |
|
|
uint32_t |
write_len |
|
) |
| |
spic以DMA的方式向flash写数据
- 参数
-
spic_base_config | 配置结构体指针 |
write_data | 数据指针 |
write_len | 数据长度 |
- 返回
- int32_t 0:成功;1:失败;
◆ spic_xip_config()
◆ enum
初始值:{
FLASH_CLK_DIV_2 = 0,
FLASH_CLK_DIV_4 = 1,
FLASH_CLK_DIV_6 = 2,
FLASH_CLK_DIV_8 = 3,
}flash_clk_div_t
< 功能:flash器件时钟与core_clk时钟频率关系 功能:2分频 功能:4分频 功能:6分频 功能:8分频
< 功能:发送命令、地址、数据的模式选择 功能:单线模式 功能:四线模式 功能:八线模式 功能:保留 功能:单线MERGE模式 功能:四线MERGE模式 功能:保留 功能:保留 功能:DTR单线模式 功能:DTR四线模式 功能:DTR八线模式 功能:保留 功能:DTR单线MERGE模式 功能:DTR四线MERGE模式 功能:保留