WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
hal_sfc_v150_regs_op.h
浏览该文件的文档.
1
9#ifndef HAL_SFC_V150_REGS_OP_H
10#define HAL_SFC_V150_REGS_OP_H
11
12#include <stdint.h>
13#include "errcode.h"
15#include "sfc_porting.h"
16
17#ifdef __cplusplus
18#if __cplusplus
19extern "C" {
20#endif /* __cplusplus */
21#endif /* __cplusplus */
22
34
38typedef struct hal_spi_opreation {
40 uint32_t data_size;
41 uint32_t dummy_byte;
43
49
56void hal_sfc_regs_set_opt_attr(uint32_t rw, uint32_t data_en, uint32_t addr_en);
57
62
66void hal_sfc_dma_wait_done(void);
67
73
79
83static inline void hal_sfc_regs_set_timing(void)
84{
86}
87
92static inline void hal_sfc_regs_set_bus_dma_flash_saddr(uint32_t flash_saddr)
93{
94 ((bus_dma_regs_t *)g_sfc_bus_dma_regs)->bus_dma_flash_saddr = flash_saddr;
95}
96
101static inline void hal_sfc_regs_set_bus_dma_mem_addr(uint8_t *dma_buffer)
102{
103 ((bus_dma_regs_t *)g_sfc_bus_dma_regs)->bus_dma_mem_saddr = (uintptr_t)dma_buffer;
104}
105
110static inline void hal_sfc_regs_set_bus_dma_len(uint32_t length)
111{
112 bus_dma_len_t len_conf;
113 len_conf.d32 = ((bus_dma_regs_t *)g_sfc_bus_dma_regs)->bus_dma_len;
114 len_conf.b.dma_len = length - 1;
115 ((bus_dma_regs_t *)g_sfc_bus_dma_regs)->bus_dma_len = len_conf.d32;
116}
117
121static inline void hal_sfc_regs_set_bus_dma_ahb_ctrl(void)
122{
123 bus_dma_ahb_ctrl_t ahb_ctrl;
124 ahb_ctrl.d32 = 0x7;
125 ((bus_dma_regs_t *)g_sfc_bus_dma_regs)->bus_dma_ahb_ctrl = ahb_ctrl.d32;
126}
127
132static inline void hal_sfc_regs_set_bus_dma_ctrl(uint32_t rw)
133{
134 bus_dma_ctrl_t dma_ctrl;
135 dma_ctrl.d32 = ((bus_dma_regs_t *)g_sfc_bus_dma_regs)->bus_dma_ctrl;
136 dma_ctrl.b.dma_sel_cs = 0x1;
137 dma_ctrl.b.dma_rw = rw;
138 dma_ctrl.b.dma_start = 0x1;
139 ((bus_dma_regs_t *)g_sfc_bus_dma_regs)->bus_dma_ctrl = dma_ctrl.d32;
140}
141
147static inline void hal_sfc_regs_set_databuf(uint32_t index, uint32_t val)
148{
149 ((cmd_databufs_t *)g_sfc_cmd_databuf)->cmd_databuf[index] = val;
150}
151
156static inline uint32_t hal_sfc_regs_get_databuf(uint32_t index)
157{
158 return ((cmd_databufs_t *)g_sfc_cmd_databuf)->cmd_databuf[index];
159}
160
165static inline void hal_sfc_regs_set_bus_baseaddr(uint32_t val)
166{
167 bus_base_addr_t base_addr;
168 base_addr.d32 = ((bus_regs_t *)g_sfc_bus_regs)->bus_base_addr_cs1;
169 base_addr.b.bus_base_addr_high_cs = val;
170 ((bus_regs_t *)g_sfc_bus_regs)->bus_base_addr_cs1 = base_addr.d32;
171}
172
177static inline void hal_sfc_regs_set_bus_flash_size(uint32_t val)
178{
179 bus_flash_size_t flash_size;
180 flash_size.d32 = ((bus_regs_t *)g_sfc_bus_regs)->bus_flash_size;
181 flash_size.b.flash_size_cs1 = val;
182 ((bus_regs_t *)g_sfc_bus_regs)->bus_flash_size = flash_size.d32;
183}
184
189static inline void hal_sfc_regs_set_cmd_addr(uint32_t val)
190{
191 cmd_addr_t addr;
192 addr.d32 = ((cmd_regs_t *)g_sfc_cmd_regs)->cmd_addr;
193 addr.b.cmd_addr = val;
194 ((cmd_regs_t *)g_sfc_cmd_regs)->cmd_addr = addr.d32;
195}
196
197static inline uint32_t hal_sfc_regs_get_timing(void)
198{
199 return ((global_conf_regs_t *)g_sfc_global_conf_regs)->timing;
200}
201
202static inline uint32_t hal_sfc_regs_get_sfc_bus_config1(void)
203{
204 return ((bus_regs_t *)g_sfc_bus_regs)->bus_config1;
205}
206
207static inline void hal_sfc_regs_set_sfc_bus_config1(uint32_t val)
208{
209 ((bus_regs_t *)g_sfc_bus_regs)->bus_config1 = val;
210}
211
212static inline uint32_t hal_sfc_regs_get_sfc_bus_config2(void)
213{
214 return ((bus_regs_t *)g_sfc_bus_regs)->bus_config2;
215}
216
217static inline void hal_sfc_regs_set_sfc_bus_config2(uint32_t val)
218{
219 ((bus_regs_t *)g_sfc_bus_regs)->bus_config2 = val;
220}
221
222static inline uint32_t hal_sfc_regs_get_sfc_bus_flash_size(void)
223{
224 return ((bus_regs_t *)g_sfc_bus_regs)->bus_flash_size;
225}
226
227static inline void hal_sfc_regs_set_sfc_bus_flash_size(uint32_t val)
228{
229 ((bus_regs_t *)g_sfc_bus_regs)->bus_flash_size = val;
230}
231
232static inline uint32_t hal_sfc_regs_get_bus_base_addr_cs0(void)
233{
234 return ((bus_regs_t *)g_sfc_bus_regs)->bus_base_addr_cs0;
235}
236
237static inline void hal_sfc_regs_set_bus_base_addr_cs0(uint32_t val)
238{
239 ((bus_regs_t *)g_sfc_bus_regs)->bus_base_addr_cs0 = val;
240}
241
242static inline uint32_t hal_sfc_regs_get_bus_base_addr_cs1(void)
243{
244 return ((bus_regs_t *)g_sfc_bus_regs)->bus_base_addr_cs1;
245}
246
247static inline void hal_sfc_regs_set_bus_base_addr_cs1(uint32_t val)
248{
249 ((bus_regs_t *)g_sfc_bus_regs)->bus_base_addr_cs1 = val;
250}
251
256#ifdef __cplusplus
257#if __cplusplus
258}
259#endif /* __cplusplus */
260#endif /* __cplusplus */
261
262#endif
void hal_sfc_regs_set_bus_read(spi_opreation_t opt_read)
Set read command info in bus mode
Definition hal_sfc_v150_regs_op.c:68
void hal_sfc_regs_wait_config(void)
Wait region start of cmd_config_t be 0
Definition hal_sfc_v150_regs_op.c:47
void hal_sfc_dma_wait_done(void)
Wait region dma_start of bus_dma_ctrl_t be 0
Definition hal_sfc_v150_regs_op.c:58
void hal_sfc_regs_set_opt_attr(uint32_t rw, uint32_t data_en, uint32_t addr_en)
Set cmd config by command attribute
Definition hal_sfc_v150_regs_op.c:35
uintptr_t g_sfc_bus_dma_regs
Definition hal_sfc.c:14
void hal_sfc_regs_set_bus_write(spi_opreation_t opt_write)
Set write command info in bus mode
Definition hal_sfc_v150_regs_op.c:79
uintptr_t g_sfc_bus_regs
Definition hal_sfc.c:13
void hal_sfc_regs_set_opt(hal_spi_opreation_t hal_opt)
Set cmd config and cmd ins by basic command info
uintptr_t g_sfc_cmd_regs
Definition hal_sfc.c:15
struct hal_spi_opreation hal_spi_opreation_t
SPI mode opreation base info.
uintptr_t g_sfc_global_conf_regs
Definition hal_sfc.c:12
uintptr_t g_sfc_cmd_databuf
Definition hal_sfc.c:16
DMA mode Registers associated with SFC.
Definition hal_sfc_v150_regs_def.h:325
Bus mode Registers associated with SFC.
Definition hal_sfc_v150_regs_def.h:313
SPI data buffer Registers associated with SFC.
Definition hal_sfc_v150_regs_def.h:346
SPI mode Registers associated with SFC.
Definition hal_sfc_v150_regs_def.h:336
Global Config Registers associated with SFC.
Definition hal_sfc_v150_regs_def.h:304
SPI mode opreation base info.
Definition hal_sfc_v150_regs_op.h:38
uint32_t data_size
Definition hal_sfc_v150_regs_op.h:40
uint32_t dummy_byte
Definition hal_sfc_v150_regs_op.h:41
spi_opreation_t opt
Definition hal_sfc_v150_regs_op.h:39
SPI读写擦操作相关参数
Definition flash_config_info.h:54
unsigned int uintptr_t
Definition td_type.h:65
This union represents the bit fields in the SFC bus base addr Register. Read the register into the ...
Definition hal_sfc_v150_regs_def.h:175
uint32_t d32
Definition hal_sfc_v150_regs_def.h:176
struct bus_base_addr::@39 b
uint32_t bus_base_addr_high_cs
Definition hal_sfc_v150_regs_def.h:179
This union represents the bit fields in the SFC bus dma ahb ctrl Register. Read the register into t...
Definition hal_sfc_v150_regs_def.h:219
uint32_t d32
Definition hal_sfc_v150_regs_def.h:220
This union represents the bit fields in the SFC bus dma ctrl Register. Read the register into the d...
Definition hal_sfc_v150_regs_def.h:188
uint32_t d32
Definition hal_sfc_v150_regs_def.h:189
uint32_t dma_start
Definition hal_sfc_v150_regs_def.h:191
struct bus_dma_ctrl::@40 b
uint32_t dma_sel_cs
Definition hal_sfc_v150_regs_def.h:195
uint32_t dma_rw
Definition hal_sfc_v150_regs_def.h:193
This union represents the bit fields in the SFC bus dma len Register. Read the register into the d3...
Definition hal_sfc_v150_regs_def.h:205
struct bus_dma_len::@41 b
uint32_t d32
Definition hal_sfc_v150_regs_def.h:206
uint32_t dma_len
Definition hal_sfc_v150_regs_def.h:208
This union represents the bit fields in the SFC bus flash size Register. Read the register into the...
Definition hal_sfc_v150_regs_def.h:142
struct bus_flash_size::@38 b
uint32_t flash_size_cs1
Definition hal_sfc_v150_regs_def.h:164
uint32_t d32
Definition hal_sfc_v150_regs_def.h:143
This union represents the bit fields in the SFC command address Register. Read the register into th...
Definition hal_sfc_v150_regs_def.h:281
struct cmd_addr::@45 b
uint32_t cmd_addr
Definition hal_sfc_v150_regs_def.h:284
uint32_t d32
Definition hal_sfc_v150_regs_def.h:282