CI130X SDK API手册  2.2.0
本手册用于描述CI130X SDK各个组件和驱动API
ci130x_dtrflash.h
浏览该文件的文档.
1 #ifndef __SPIC_H_
2 #define __SPIC_H_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <stdint.h>
9 #include <string.h>
10 #include <stdbool.h>
11 
12 #define SPIC_DMA_MODEFI 0 //待芯片回来,提高主频后,再测试哪一种方式效率更高,且代码更少
13 
14 //FLASH的时序窗口调整
15 #define RX_NAGE_SAMPLE 0
16 #define RX_NAGE_EN 1
17 #define DELAY_LINE 0x1A //1 ~ 32S
18 
19 typedef enum
20 {
21  FLASH_CLK_DIV_2 = 0,
22  FLASH_CLK_DIV_4 = 1,
23  FLASH_CLK_DIV_6 = 2,
24  FLASH_CLK_DIV_8 = 3,
25 }flash_clk_div_t;
26 
27 typedef enum
28 {
29  MD_SEL_LINE_1 = 0,
30  MD_SEL_LINE_4 = 1,
31  MD_SEL_LINE_8 = 2,
32  MD_SEL_RESERVED_0 = 3,
33  MD_SEL_LINE_1_MERGE = 4,
34  MD_SEL_LINE_4_MERGE = 5,
35  MD_SEL_RESERVED_1 = 6,
36  MD_SEL_RESERVED_2 = 7,
37  MD_SEL_DTR_LINE_1 = 8,
38  MD_SEL_DTR_LINE_4 = 9,
39  MD_SEL_DTR_LINE_8 = 10,
40  MD_SEL_RESERVED_3 = 11,
41  MD_SEL_DTR_LINE_1_MERGE = 12,
42  MD_SEL_DTR_LINE_4_MERGE = 13,
43  MD_SEL_RESERVED_4 = 14,
44 }md_sel_t;
45 
46 typedef struct
47 {
48  flash_clk_div_t flash_clk_div;
49  uint32_t flash_sel;
50  uint32_t addr_size;
52 
53 typedef struct
54 {
55  md_sel_t cmd_md;
56  md_sel_t data_md;
57  uint32_t cmd0;
58  uint32_t cmd1;
59  uint32_t addr;
60  uint32_t addr_en;
61  uint32_t dummy;
62  uint32_t dummy_en;
64 
65 int32_t spic_cmd(uint32_t spic_base,spic_base_config_p spic_base_config);
66 
67 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);
68 
69 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);
70 
71 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);
72 
73 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);
74 
75 int32_t spic_read_xip(uint32_t spic_base,spic_base_config_p spic_base_config,uint8_t* read_data,uint32_t read_len);
76 
77 int32_t spic_init(uint32_t spic_base,spic_init_p init);
78 
79 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);
80 
81 void spic_hardware_reset(uint32_t spic_base,uint8_t enable);
82 
83 int32_t spic_xip_config(uint32_t spic_base,spic_base_config_p spic_base_config);
84 
85 void spic_prefetch_en(uint32_t spic_base,bool en);
86 
87 void spic_change_clk(uint32_t spic_base,flash_clk_div_t clk);
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif
int32_t spic_init(uint32_t spic_base, spic_init_p init)
spic控制器初始化
Definition: ci130x_dtrflash.c:592
md_sel_t data_md
Definition: ci130x_dtrflash.h:56
uint32_t flash_sel
Definition: ci130x_dtrflash.h:49
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时钟相位调制
Definition: ci130x_dtrflash.c:622
flash_clk_div_t flash_clk_div
Definition: ci130x_dtrflash.h:48
uint32_t addr_size
Definition: ci130x_dtrflash.h:50
void spic_prefetch_en(uint32_t spic_base, bool en)
flash预取开关
Definition: ci130x_dtrflash.c:691
md_sel_t cmd_md
Definition: ci130x_dtrflash.h:55
uint32_t addr_en
Definition: ci130x_dtrflash.h:60
uint32_t cmd1
Definition: ci130x_dtrflash.h:58
int32_t spic_read_xip(uint32_t spic_base, spic_base_config_p spic_base_config, uint8_t *read_data, uint32_t read_len)
void spic_hardware_reset(uint32_t spic_base, uint8_t enable)
struct spic_init_t * spic_init_p
Definition: ci130x_dtrflash.h:46
int32_t spic_cmd(uint32_t spic_base, spic_base_config_p spic_base_config)
spic向flash发送命令
Definition: ci130x_dtrflash.c:335
struct spic_base_config_t * spic_base_config_p
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写数据
Definition: ci130x_dtrflash.c:415
int32_t spic_xip_config(uint32_t spic_base, spic_base_config_p spic_base_config)
Definition: ci130x_dtrflash.c:571
uint32_t cmd0
Definition: ci130x_dtrflash.h:57
uint32_t addr
Definition: ci130x_dtrflash.h:59
void spic_change_clk(uint32_t spic_base, flash_clk_div_t clk)
Definition: ci130x_dtrflash.c:128
Definition: ci130x_dtrflash.h:53
uint32_t dummy
Definition: ci130x_dtrflash.h:61
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读数据
Definition: ci130x_dtrflash.c:468
uint32_t dummy_en
Definition: ci130x_dtrflash.h:62
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写数据
Definition: ci130x_dtrflash.c:524
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读数据
Definition: ci130x_dtrflash.c:358