XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
chip.c
浏览该文件的文档.
1
21#include <xwcd/ds/standard.h>
22#include <string.h>
23#include <xwcd/ds/iochip/chip.h>
24
25static __xwds_vop
27
28static __xwds_vop
30
31static __xwds_vop
33
34static __xwds_vop
36
37#if defined(XWCDCFG_ds_PM) && (1 == XWCDCFG_ds_PM)
38static __xwds_vop
40
41static __xwds_vop
43#endif
44
48 .start = (void *)xwds_iochip_vop_start,
49 .stop = (void *)xwds_iochip_vop_stop,
50#if defined(XWCDCFG_ds_PM) && (1 == XWCDCFG_ds_PM)
51 .suspend = (void *)xwds_iochip_vop_suspend,
53#endif
54};
55
56/******** ******** ******** constructor & destructor ******** ******** ********/
59{
61 iochip->bc.dev.vop = &xwds_iochip_vop;
62}
63
65void xwds_iochip_destruct(struct xwds_iochip * iochip)
66{
67 xwds_device_destruct(&iochip->bc.dev);
68}
69
72{
73 return xwds_device_grab(&iochip->bc.dev);
74}
75
78{
79 return xwds_device_put(&iochip->bc.dev);
80}
81
82/******** ******** base virtual operations ******** ********/
87static __xwds_vop
89{
90 xwer_t rc;
91
92 XWDS_VALIDATE(iochip->xwccfg, "nullptr", -EFAULT);
93
94 rc = xwds_device_vop_probe(&iochip->bc.dev);
95 return rc;
96}
97
102static __xwds_vop
104{
105 xwer_t rc;
106
107 rc = xwds_device_vop_remove(&iochip->bc.dev);
108 return rc;
109}
110
115static __xwds_vop
117{
118 xwer_t rc;
119
120 rc = xwds_device_vop_start(&iochip->bc.dev);
121 return rc;
122}
123
128static __xwds_vop
130{
131 xwer_t rc;
132
133 rc = xwds_device_vop_stop(&iochip->bc.dev);
134 return rc;
135}
136
137#if (defined(XWCDCFG_ds_PM)) && (1 == XWCDCFG_ds_PM)
138/******** ******** pm ******** ********/
143static __xwds_vop
145{
146 xwer_t rc;
147
148 rc = xwds_device_vop_suspend(&iochip->bc.dev);
149 return rc;
150}
151
156static __xwds_vop
158{
159 xwer_t rc;
160
161 rc = xwds_device_vop_resume(&iochip->bc.dev);
162 return rc;
163}
164#endif
static xwer_t xwds_device_grab(struct xwds_device *dev)
XWDS API:增加对象的引用计数
Definition device.h:268
xwer_t xwds_device_vop_start(struct xwds_device *dev)
设备基本操作函数:启动设备
Definition device.c:105
void xwds_device_construct(struct xwds_device *dev)
XWDS API:设备的构造函数
Definition device.c:48
void xwds_device_destruct(struct xwds_device *dev)
XWDS API:设备的析构函数
Definition device.c:56
static xwer_t xwds_device_put(struct xwds_device *dev)
XWDS API:减少对象的引用计数
Definition device.h:281
xwer_t xwds_device_vop_stop(struct xwds_device *dev)
设备基本操作函数:停止设备
Definition device.c:124
xwer_t xwds_device_vop_remove(struct xwds_device *dev)
设备基本操作函数:删除设备
Definition device.c:86
xwer_t xwds_device_vop_resume(struct xwds_device *dev)
设备基本操作函数:继续设备
Definition device.c:163
xwer_t xwds_device_vop_probe(struct xwds_device *dev)
设备基本操作函数:探测设备
Definition device.c:67
xwer_t xwds_device_vop_suspend(struct xwds_device *dev)
设备基本操作函数:暂停设备
Definition device.c:144
xwer_t xwds_iochip_grab(struct xwds_iochip *iochip)
XWDS API:增加对象的引用计数
Definition chip.c:71
xwer_t xwds_iochip_put(struct xwds_iochip *iochip)
XWDS API:减少对象的引用计数
Definition chip.c:77
void xwds_iochip_construct(struct xwds_iochip *iochip)
XWDS API:IOCHIP对象的构造函数
Definition chip.c:58
void xwds_iochip_destruct(struct xwds_iochip *iochip)
XWDS API:IOCHIP对象的析构函数
Definition chip.c:65
#define __xwds_vop
Definition standard.h:36
#define __xwds_api
Definition standard.h:33
#define XWDS_VALIDATE(exp, errstr,...)
Definition standard.h:51
#define __xwds_rodata
Definition standard.h:38
#define EFAULT
Bad address
Definition errno.h:44
signed long xwer_t
Definition type.h:554
static xwer_t xwds_iochip_vop_remove(struct xwds_iochip *iochip)
XWDS VOP:移除IOCHIP
Definition chip.c:103
static xwer_t xwds_iochip_vop_start(struct xwds_iochip *iochip)
XWDS VOP:启动IOCHIP
Definition chip.c:116
static xwer_t xwds_iochip_vop_probe(struct xwds_iochip *iochip)
XWDS VOP:探测IOCHIP
Definition chip.c:88
static xwer_t xwds_iochip_vop_suspend(struct xwds_iochip *iochip)
XWDS VOP:暂停IOCHIP
Definition chip.c:144
static xwer_t xwds_iochip_vop_resume(struct xwds_iochip *iochip)
XWDS VOP:继续IOCHIP
Definition chip.c:157
const struct xwds_virtual_operation xwds_iochip_vop
Definition chip.c:45
static xwer_t xwds_iochip_vop_stop(struct xwds_iochip *iochip)
XWDS VOP:停止IOCHIP
Definition chip.c:129
玄武设备栈:IO扩展芯片
const struct xwds_virtual_operation * vop
Definition device.h:138
IO扩展芯片
Definition chip.h:95
struct xwds_device dev
Definition chip.h:97
union xwds_iochip::@19 bc
基本操作的虚函数表(类似C++的虚函数表)
Definition device.h:99
xwer_t(* stop)(struct xwds_device *)
Definition device.h:103
xwer_t(* remove)(struct xwds_device *)
Definition device.h:101
xwer_t(* probe)(struct xwds_device *)
Definition device.h:100
xwer_t(* resume)(struct xwds_device *)
Definition device.h:106
玄武设备栈:顶级头文件