XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
chip.h
浏览该文件的文档.
1
21#ifndef __xwcd_ds_soc_chip_h__
22#define __xwcd_ds_soc_chip_h__
23
24#include <xwcd/ds/standard.h>
25#include <xwcd/ds/device.h>
26
33#if defined(XWCDCFG_ds_SOC_EIRQ_ROISRT) && (1 == XWCDCFG_ds_SOC_EIRQ_ROISRT)
34# define __xwds_soc_eirq_tbl_qualifier const
35#else
36# define __xwds_soc_eirq_tbl_qualifier
37#endif
38
39#if defined(XWCDCFG_ds_SOC_DMA_ROCBT) && (1 == XWCDCFG_ds_SOC_DMA_ROCBT)
40# define __xwds_soc_dma_tbl_qualifier const
41#else
42# define __xwds_soc_dma_tbl_qualifier
43#endif
44
45struct xwds_soc;
46struct xwds_dma_cfg;
47
53 xwer_t (* get_reset_reason)(struct xwds_soc * /*soc*/,
54 xwu64_t * /*reason*/);
55#if defined(XWCDCFG_ds_SOC_CLK) && (1 == XWCDCFG_ds_SOC_CLK)
56 xwer_t (* clk_req)(struct xwds_soc * /*soc*/,
57 xwid_t /*id*/);
58 xwer_t (* clk_rls)(struct xwds_soc * /*soc*/,
59 xwid_t /*id*/);
60 xwer_t (* clk_getfqcy)(struct xwds_soc * /*soc*/,
61 xwid_t /*id*/,
62 xwu32_t * /*buf*/,
63 xwsz_t * /*num*/);
64#endif
65
66#if defined(XWCDCFG_ds_SOC_PWR) && (1 == XWCDCFG_ds_SOC_PWR)
67 xwer_t (* pwr_req)(struct xwds_soc * /*soc*/,
68 xwid_t /*id*/);
69 xwer_t (* pwr_rls)(struct xwds_soc * /*soc*/,
70 xwid_t /*id*/);
71 xwer_t (* pwr_getvltg)(struct xwds_soc * /*soc*/,
72 xwid_t /*id*/,
73 xwu32_t * /*buf*/,
74 xwsz_t * /*num*/);
75#endif
76
77#if defined(XWCDCFG_ds_SOC_GPIO) && (1 == XWCDCFG_ds_SOC_GPIO)
78 xwer_t (* gpio_req)(struct xwds_soc * /*soc*/,
79 xwid_t /*port*/,
80 xwsq_t /*pinmask*/);
81 xwer_t (* gpio_rls)(struct xwds_soc * /*soc*/,
82 xwid_t /*port*/,
83 xwid_t /*pinmask*/);
84 xwer_t (* gpio_cfg)(struct xwds_soc * /*soc*/,
85 xwid_t /*port*/,
86 xwsq_t /*pinmask*/,
87 void * /*cfg*/);
89 xwid_t /*port*/,
90 xwsq_t /*pinmask*/,
91 xwsq_t /*out*/);
92 xwer_t (* gpio_set)(struct xwds_soc * /*soc*/,
93 xwid_t /*port*/,
94 xwsq_t /*pinmask*/);
95 xwer_t (* gpio_reset)(struct xwds_soc * /*soc*/,
96 xwid_t /*port*/,
97 xwsq_t /*pinmask*/);
98 xwer_t (* gpio_toggle)(struct xwds_soc * /*soc*/,
99 xwid_t /*port*/,
100 xwsq_t /*pinmask*/);
101 xwer_t (* gpio_input)(struct xwds_soc * /*soc*/,
102 xwid_t /*port*/,
103 xwsq_t /*pinmask*/,
104 xwsq_t * /*inbuf*/);
105#endif
106
107#if defined(XWCDCFG_ds_SOC_EIRQ) && (1 == XWCDCFG_ds_SOC_EIRQ)
108 xwer_t (* eirq_req)(struct xwds_soc * /*soc*/,
109 xwid_t /*port*/, xwsq_t /*pinmask*/,
110 xwid_t /*eiid*/, xwsq_t /*eiflag*/);
111 xwer_t (* eirq_rls)(struct xwds_soc * /*soc*/,
112 xwid_t /*port*/, xwsq_t /*pinmask*/,
113 xwid_t /*eiid*/);
114#endif
115
116#if defined(XWCDCFG_ds_SOC_DMA) && (1 == XWCDCFG_ds_SOC_DMA)
117 xwer_t (* dma_req)(struct xwds_soc * /*soc*/,
118 xwid_t /*ch*/);
119 xwer_t (* dma_rls)(struct xwds_soc * /*soc*/,
120 xwid_t /*ch*/);
121 xwer_t (* dma_cfg)(struct xwds_soc * /*soc*/,
122 xwid_t /*ch*/,
123 void * /*cfg*/);
124 xwer_t (* dma_enable)(struct xwds_soc * /*soc*/,
125 xwid_t /*ch*/);
126 xwer_t (* dma_disable)(struct xwds_soc * /*soc*/,
127 xwid_t /*ch*/);
128 xwer_t (* dma_start)(struct xwds_soc * /*soc*/,
129 xwid_t /*ch*/);
130 xwer_t (* dma_stop)(struct xwds_soc * /*soc*/,
131 xwid_t /*ch*/);
132#endif
133};
134
138typedef void * xwds_eirq_arg_t;
139
143typedef void (* xwds_eirq_f)(struct xwds_soc *, xwid_t, xwds_eirq_arg_t);
144
148typedef void * xwds_dma_cbarg_t;
149
153typedef void (* xwds_dma_f)(struct xwds_soc * /* soc */,
154 xwid_t /* ch */,
155 xwu32_t /* rc */,
156 xwds_dma_cbarg_t /* arg */);
157
161struct xwds_soc {
164 /* attributes */
165 const void * xwccfg;
166#if (defined(XWCDCFG_ds_SOC_GPIO) && (1 == XWCDCFG_ds_SOC_GPIO))
167 struct {
168 void * cfg;
173#endif
174#if (defined(XWCDCFG_ds_SOC_CLK) && (1 == XWCDCFG_ds_SOC_CLK))
175 struct {
176 xwsz_t num;
177 } clk;
178#endif
179#if (defined(XWCDCFG_ds_SOC_PWR) && (1 == XWCDCFG_ds_SOC_PWR))
180 struct {
181 xwsz_t num;
182 } pwr;
183#endif
184#if (defined(XWCDCFG_ds_SOC_EIRQ) && (1 == XWCDCFG_ds_SOC_EIRQ))
185 struct {
190#endif
191#if (defined(XWCDCFG_ds_SOC_DMA) && (1 == XWCDCFG_ds_SOC_DMA))
192 struct {
193 xwsz_t ch_num;
194 void * ccfg;
195 atomic_xwbmp_t * chstatus;
198 } dma;
199#endif
200};
201
206void xwds_soc_construct(struct xwds_soc * soc);
207
212void xwds_soc_destruct(struct xwds_soc * soc);
213
218xwer_t xwds_soc_grab(struct xwds_soc * soc);
219
224xwer_t xwds_soc_put(struct xwds_soc * soc);
225
231xwer_t xwds_soc_get_reset_reason(struct xwds_soc * soc, xwu64_t * reason);
232
237#endif /* xwcd/ds/soc/chip.h */
xwer_t xwds_dma_cfg(struct xwds_soc *soc, xwid_t ch, void *cfg, xwds_dma_f cb, xwds_dma_cbarg_t arg)
XWDS API:配置DMA的通道
Definition dma.c:91
玄武设备栈:设备基类
void xwds_soc_destruct(struct xwds_soc *soc)
XWDS API:SOC对象的析构函数
Definition chip.c:65
void(* xwds_eirq_f)(struct xwds_soc *, xwid_t, xwds_eirq_arg_t)
外部中断函数
Definition chip.h:143
xwer_t xwds_soc_grab(struct xwds_soc *soc)
XWDS API:增加对象的引用计数
Definition chip.c:71
void * xwds_dma_cbarg_t
DMA完成回调函数参数
Definition chip.h:148
void(* xwds_dma_f)(struct xwds_soc *, xwid_t, xwu32_t, xwds_dma_cbarg_t)
DMA完成回调函数类型
Definition chip.h:153
xwer_t xwds_soc_put(struct xwds_soc *soc)
XWDS API:减少对象的引用计数
Definition chip.c:77
void xwds_soc_construct(struct xwds_soc *soc)
XWDS API:SOC构造函数
Definition chip.c:58
xwer_t xwds_soc_get_reset_reason(struct xwds_soc *soc, xwu64_t *reason)
XWDS API:获取复位原因
Definition chip.c:83
#define __xwds_soc_dma_tbl_qualifier
Definition chip.h:42
#define __xwds_soc_eirq_tbl_qualifier
Definition chip.h:36
void * xwds_eirq_arg_t
外部中断函数参数
Definition chip.h:138
signed long xwer_t
Definition type.h:554
unsigned long xwid_t
Definition type.h:481
__xwcc_atomic xwsq_t atomic_xwsq_t
Definition type.h:448
unsigned long xwsz_t
Definition type.h:339
__xwcc_atomic xwbmp_t atomic_xwbmp_t
Definition type.h:577
unsigned long xwsq_t
Definition type.h:445
uint64_t xwu64_t
Definition type.h:303
uint32_t xwu32_t
Definition type.h:266
设备(所有设备的基类)
Definition device.h:127
基本驱动函数表(所有设备驱动的基类)
Definition device.h:113
BSP中需要提供的SOC设备驱动函数表
Definition chip.h:51
xwer_t(* gpio_output)(struct xwds_soc *, xwid_t, xwsq_t, xwsq_t)
Definition chip.h:88
xwer_t(* gpio_req)(struct xwds_soc *, xwid_t, xwsq_t)
Definition chip.h:78
xwer_t(* gpio_rls)(struct xwds_soc *, xwid_t, xwid_t)
Definition chip.h:81
xwer_t(* get_reset_reason)(struct xwds_soc *, xwu64_t *)
Definition chip.h:53
struct xwds_driver base
Definition chip.h:52
xwer_t(* eirq_rls)(struct xwds_soc *, xwid_t, xwsq_t, xwid_t)
Definition chip.h:111
xwer_t(* gpio_toggle)(struct xwds_soc *, xwid_t, xwsq_t)
Definition chip.h:98
xwer_t(* gpio_cfg)(struct xwds_soc *, xwid_t, xwsq_t, void *)
Definition chip.h:84
xwer_t(* gpio_set)(struct xwds_soc *, xwid_t, xwsq_t)
Definition chip.h:92
xwer_t(* gpio_input)(struct xwds_soc *, xwid_t, xwsq_t, xwsq_t *)
Definition chip.h:101
xwer_t(* eirq_req)(struct xwds_soc *, xwid_t, xwsq_t, xwid_t, xwsq_t)
Definition chip.h:108
xwer_t(* gpio_reset)(struct xwds_soc *, xwid_t, xwsq_t)
Definition chip.h:95
SOC设备
Definition chip.h:161
xwsz_t num
Definition chip.h:188
xwsz_t port_num
Definition chip.h:170
struct xwds_device dev
Definition chip.h:162
struct xwds_soc::@23 gpio
void * cfg
Definition chip.h:168
const void * xwccfg
Definition chip.h:165
xwds_eirq_arg_t * isrargs
Definition chip.h:187
xwds_eirq_f * isrs
Definition chip.h:186
xwsz_t pin_num
Definition chip.h:171
struct xwds_soc::@24 eirq
atomic_xwsq_t * pins
Definition chip.h:169
玄武设备栈:顶级头文件