XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
driver.c 文件参考

玄武设备栈:CAN收发器:通用型104x/105x系列收发器:驱动 更多...

driver.c 的引用(Include)关系图:

浏览源代码.

函数

static xwer_t xwds_cantrcv_xxx10xx_check_desc (struct xwds_cantrcv_xxx10xx *xxx10xx)
 
xwer_t xwds_cantrcv_xxx10xx_drv_probe (struct xwds_device *dev)
 XXX10XX基本驱动:探测设备
 
xwer_t xwds_cantrcv_xxx10xx_drv_start (struct xwds_device *dev)
 XXX10XX基本驱动:启动设备
 
xwer_t xwds_cantrcv_xxx10xx_drv_stop (struct xwds_device *dev)
 XXX10XX基本驱动:停止设备
 
xwer_t xwds_cantrcv_xxx10xx_drv_suspend (struct xwds_device *dev)
 XXX10XX基本驱动:暂停设备
 
xwer_t xwds_cantrcv_xxx10xx_drv_resume (struct xwds_device *dev)
 XXX10XX基本驱动:继续设备
 
xwer_t xwds_cantrcv_xxx10xx_drv_set_opmode (struct xwds_cantrcv *cantrcv, xwsq_t opmode)
 XXX10XX CAN接收器驱动:设置CAN接收器的运行模式
 
xwer_t xwds_cantrcv_xxx10xx_drv_enable_wkup (struct xwds_cantrcv *cantrcv)
 XXX10XX CAN接收器驱动:开启CAN接收器的唤醒
 
xwer_t xwds_cantrcv_xxx10xx_drv_disable_wkup (struct xwds_cantrcv *cantrcv)
 XXX10XX CAN接收器驱动:关闭CAN接收器的唤醒
 
void xwds_cantrcv_xxx10xx_eirq_wkup (struct xwds_soc *soc, xwid_t eiid, xwds_eirq_arg_t arg)
 XXX10XX中断函数
 

变量

const struct xwds_cantrcv_driver xwds_cantrcv_xxx10xx_drv
 XXX10XX的驱动集合
 

详细描述

玄武设备栈:CAN收发器:通用型104x/105x系列收发器:驱动

作者

在文件 driver.c 中定义.

函数说明

◆ xwds_cantrcv_xxx10xx_check_desc()

static xwer_t xwds_cantrcv_xxx10xx_check_desc ( struct xwds_cantrcv_xxx10xx xxx10xx)
static

<No error

在文件 driver.c49 行定义.

50{
51 const struct xwds_cantrcv_cfg * cfg;
52 xwer_t rc;
53
54 cfg = xxx10xx->cantrcv.cfg;
56 rc = -EINVAL;
57 } else {
58 rc = XWOK;
59 }
60 return rc;
61}
@ XWDS_CANTRCV_OPMODE_NUM
Definition transceiver.h:44
#define EINVAL
Invalid argument
Definition errno.h:52
#define XWOK
No error
Definition errno.h:182
signed long xwer_t
Definition type.h:554
CAN接收器配置
Definition transceiver.h:85
struct xwds_cantrcv cantrcv
Definition device.h:38
const struct xwds_cantrcv_cfg * cfg
这是这个函数的调用关系图:

◆ xwds_cantrcv_xxx10xx_drv_disable_wkup()

xwer_t xwds_cantrcv_xxx10xx_drv_disable_wkup ( struct xwds_cantrcv cantrcv)

XXX10XX CAN接收器驱动:关闭CAN接收器的唤醒

参数
[in]cantrcvCAN接收器对象指针
返回
错误码
返回值
XWOK没有错误
-EFAULT空指针
-EOPNOTSUPP不支持此API
注解
  • 上下文:中断、中断底半部、线程

在文件 driver.c225 行定义.

226{
227 struct xwds_cantrcv_xxx10xx * xxx10xx;
228 const struct xwds_resource_gpio * gpiorsc;
229 xwsq_t eirq;
230 xwer_t rc;
231
232 xxx10xx = xwds_cast(struct xwds_cantrcv_xxx10xx *, cantrcv);
233 gpiorsc = xxx10xx->gpiorsc.eirq;
234 eirq = xxx10xx->eirq;
235 if (gpiorsc) {
236 rc = xwds_eirq_rls(gpiorsc->soc,
237 gpiorsc->port, gpiorsc->pinmask,
238 eirq);
239 } else {
240 rc = -EOPNOTSUPP;
241 }
242 return rc;
243}
xwer_t xwds_eirq_rls(struct xwds_soc *soc, xwid_t port, xwsq_t pinmask, xwid_t eiid)
XWDS API:释放外部中断
Definition eirq.c:80
#define xwds_cast(type, dev)
Definition standard.h:40
#define EOPNOTSUPP
Operation not supported on socket
Definition errno.h:115
unsigned long xwsq_t
Definition type.h:445
XXX10XX对象
Definition device.h:37
struct xwds_cantrcv_xxx10xx::@28 gpiorsc
const struct xwds_resource_gpio * eirq
Definition device.h:41
设备栈GPIO资源
Definition standard.h:98
struct xwds_soc * soc
Definition standard.h:99
函数调用图:

◆ xwds_cantrcv_xxx10xx_drv_enable_wkup()

xwer_t xwds_cantrcv_xxx10xx_drv_enable_wkup ( struct xwds_cantrcv cantrcv)

XXX10XX CAN接收器驱动:开启CAN接收器的唤醒

参数
[in]cantrcvCAN接收器对象指针
返回
错误码
返回值
XWOK没有错误
-EFAULT空指针
-EOPNOTSUPP不支持此API
注解
  • 上下文:中断、中断底半部、线程

在文件 driver.c202 行定义.

203{
204 struct xwds_cantrcv_xxx10xx * xxx10xx;
205 const struct xwds_resource_gpio * gpiorsc;
206 xwsq_t eirq;
207 xwer_t rc;
208
209 xxx10xx = xwds_cast(struct xwds_cantrcv_xxx10xx *, cantrcv);
210 gpiorsc = xxx10xx->gpiorsc.eirq;
211 eirq = xxx10xx->eirq;
212 if (gpiorsc) {
213 rc = xwds_eirq_req(gpiorsc->soc,
214 gpiorsc->port, gpiorsc->pinmask,
217 } else {
218 rc = -EOPNOTSUPP;
219 }
220
221 return rc;
222}
void xwds_cantrcv_xxx10xx_eirq_wkup(struct xwds_soc *soc, xwid_t eiid, xwds_eirq_arg_t arg)
XXX10XX中断函数
Definition driver.c:246
xwer_t xwds_eirq_req(struct xwds_soc *soc, xwid_t port, xwsq_t pinmask, xwid_t eiid, xwsq_t eiflag, xwds_eirq_f isr, xwds_eirq_arg_t arg)
XWDS API:申请外部中断
Definition eirq.c:26
@ XWDS_SOC_EIF_TM_FALLING
Definition eirq.h:42
@ XWDS_SOC_EIF_WKUP
Definition eirq.h:49
函数调用图:

◆ xwds_cantrcv_xxx10xx_drv_resume()

xwer_t xwds_cantrcv_xxx10xx_drv_resume ( struct xwds_device dev)

XXX10XX基本驱动:继续设备

<No error

在文件 driver.c148 行定义.

149{
150 struct xwds_cantrcv_xxx10xx * xxx10xx;
151 const struct xwds_resource_gpio * gpiorsc;
152 xwer_t rc;
153
154 xxx10xx = xwds_cast(struct xwds_cantrcv_xxx10xx *, dev);
155 gpiorsc = xxx10xx->gpiorsc.stb;
156 if (NULL != gpiorsc) {
157 rc = xwds_gpio_req(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
158 if (rc < 0) {
159 goto err_gpio_req_stb;
160 }
161 }
162 return XWOK;
163
164err_gpio_req_stb:
165 return rc;
166}
#define NULL
Definition type.h:28
xwer_t xwds_gpio_req(struct xwds_soc *soc, xwid_t port, xwsq_t pinmask)
XWDS API:申请SOC的GPIO
Definition gpio.c:27
const struct xwds_resource_gpio * stb
Definition device.h:40
函数调用图:

◆ xwds_cantrcv_xxx10xx_drv_set_opmode()

xwer_t xwds_cantrcv_xxx10xx_drv_set_opmode ( struct xwds_cantrcv cantrcv,
xwsq_t  opmode 
)

XXX10XX CAN接收器驱动:设置CAN接收器的运行模式

参数
[in]cantrcvCAN接收器对象指针
[in]opmode唤醒模式
返回
错误码
返回值
XWOK没有错误
-EFAULT空指针
-ERANGE不支持的模式
注解
  • 上下文:中断、中断底半部、线程

<No error

在文件 driver.c170 行定义.

172{
173 struct xwds_cantrcv_xxx10xx * xxx10xx;
174 const struct xwds_resource_gpio * gpiorsc;
175 xwer_t rc;
176
177 xxx10xx = xwds_cast(struct xwds_cantrcv_xxx10xx *, cantrcv);
178 gpiorsc = xxx10xx->gpiorsc.stb;
179 switch (opmode) {
181 rc = xwds_gpio_reset(gpiorsc->soc,
182 gpiorsc->port,
183 gpiorsc->pinmask);
184 if (XWOK == rc) {
186 }
187 break;
190 rc = xwds_gpio_set(gpiorsc->soc,
191 gpiorsc->port,
192 gpiorsc->pinmask);
193 break;
194 default:
195 rc = -ERANGE;
196 break;
197 }
198 return rc;
199}
@ XWDS_CANTRCV_OPMODE_NORMAL
Definition transceiver.h:41
@ XWDS_CANTRCV_OPMODE_STANDBY
Definition transceiver.h:43
@ XWDS_CANTRCV_OPMODE_SLEEP
Definition transceiver.h:42
@ XWDS_CANTRCV_WKUPRS_BY_PIN
Definition transceiver.h:55
#define ERANGE
Result too large
Definition errno.h:64
xwer_t xwds_gpio_reset(struct xwds_soc *soc, xwid_t port, xwsq_t pinmask)
XWDS API:将SOC的GPIO设置为低电平
Definition gpio.c:170
xwer_t xwds_gpio_set(struct xwds_soc *soc, xwid_t port, xwsq_t pinmask)
XWDS API:将SOC的GPIO设置为高电平
Definition gpio.c:131
函数调用图:

◆ xwds_cantrcv_xxx10xx_drv_start()

xwer_t xwds_cantrcv_xxx10xx_drv_start ( struct xwds_device dev)

XXX10XX基本驱动:启动设备

<No error

在文件 driver.c82 行定义.

83{
84 struct xwds_cantrcv_xxx10xx * xxx10xx;
85 const struct xwds_resource_gpio * gpiorsc;
86 xwer_t rc;
87
88 xxx10xx = xwds_cast(struct xwds_cantrcv_xxx10xx *, dev);
89 gpiorsc = xxx10xx->gpiorsc.stb;
90 if (NULL != gpiorsc) {
91 rc = xwds_gpio_req(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
92 if (rc < 0) {
93 goto err_gpio_req_stb;
94 }
95 }
96 gpiorsc = xxx10xx->gpiorsc.eirq;
97 if (NULL != gpiorsc) {
98 rc = xwds_gpio_req(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
99 if (rc < 0) {
100 goto err_gpio_req_eirq;
101 }
102 }
103 return XWOK;
104
105err_gpio_req_eirq:
106 gpiorsc = xxx10xx->gpiorsc.stb;
107 if (NULL != gpiorsc) {
108 xwds_gpio_rls(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
109 }
110err_gpio_req_stb:
111 return rc;
112}
xwer_t xwds_gpio_rls(struct xwds_soc *soc, xwid_t port, xwsq_t pinmask)
XWDS API:释放SOC的GPIO
Definition gpio.c:63
函数调用图:

◆ xwds_cantrcv_xxx10xx_drv_stop()

xwer_t xwds_cantrcv_xxx10xx_drv_stop ( struct xwds_device dev)

XXX10XX基本驱动:停止设备

<No error

在文件 driver.c115 行定义.

116{
117 struct xwds_cantrcv_xxx10xx * xxx10xx;
118 const struct xwds_resource_gpio * gpiorsc;
119
120 xxx10xx = xwds_cast(struct xwds_cantrcv_xxx10xx *, dev);
121 gpiorsc = xxx10xx->gpiorsc.eirq;
122 if (NULL != gpiorsc) {
123 xwds_gpio_rls(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
124 }
125 gpiorsc = xxx10xx->gpiorsc.stb;
126 if (NULL != gpiorsc) {
127 xwds_gpio_rls(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
128 }
129 return XWOK;
130}
函数调用图:

◆ xwds_cantrcv_xxx10xx_drv_suspend()

xwer_t xwds_cantrcv_xxx10xx_drv_suspend ( struct xwds_device dev)

XXX10XX基本驱动:暂停设备

<No error

在文件 driver.c134 行定义.

135{
136 struct xwds_cantrcv_xxx10xx * xxx10xx;
137 const struct xwds_resource_gpio * gpiorsc;
138
139 xxx10xx = xwds_cast(struct xwds_cantrcv_xxx10xx *, dev);
140 gpiorsc = xxx10xx->gpiorsc.stb;
141 if (NULL != gpiorsc) {
142 xwds_gpio_rls(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
143 }
144 return XWOK;
145}
函数调用图:

◆ xwds_cantrcv_xxx10xx_eirq_wkup()

void xwds_cantrcv_xxx10xx_eirq_wkup ( struct xwds_soc soc,
xwid_t  eiid,
xwds_eirq_arg_t  arg 
)

XXX10XX中断函数

< 去除未使用变量的警告

在文件 driver.c246 行定义.

248{
249 struct xwds_cantrcv_xxx10xx * xxx10xx;
250
251 XWOS_UNUSED(soc);
252 xxx10xx = arg;
253 if (eiid == xxx10xx->eirq) {
256 }
257}
void xwds_cantrcv_drvcb_wakeup_notification(struct xwds_cantrcv *cantrcv)
CAN接收器回调函数:CAN接收器的唤醒通知
@ XWDS_CANTRCV_WKUPRS_BY_BUS
Definition transceiver.h:52
#define XWOS_UNUSED(x)
Definition standard.h:66
函数调用图:
这是这个函数的调用关系图:

变量说明

◆ xwds_cantrcv_xxx10xx_drv

const struct xwds_cantrcv_driver xwds_cantrcv_xxx10xx_drv
初始值:
= {
.base = {
.name = "can.transceiver.xxx10xx",
.remove = ((void *)0) ,
},
}
xwer_t xwds_cantrcv_xxx10xx_drv_stop(struct xwds_device *dev)
XXX10XX基本驱动:停止设备
Definition driver.c:115
xwer_t xwds_cantrcv_xxx10xx_drv_disable_wkup(struct xwds_cantrcv *cantrcv)
XXX10XX CAN接收器驱动:关闭CAN接收器的唤醒
Definition driver.c:225
xwer_t xwds_cantrcv_xxx10xx_drv_enable_wkup(struct xwds_cantrcv *cantrcv)
XXX10XX CAN接收器驱动:开启CAN接收器的唤醒
Definition driver.c:202
xwer_t xwds_cantrcv_xxx10xx_drv_set_opmode(struct xwds_cantrcv *cantrcv, xwsq_t opmode)
XXX10XX CAN接收器驱动:设置CAN接收器的运行模式
Definition driver.c:170
xwer_t xwds_cantrcv_xxx10xx_drv_suspend(struct xwds_device *dev)
XXX10XX基本驱动:暂停设备
Definition driver.c:134
xwer_t xwds_cantrcv_xxx10xx_drv_start(struct xwds_device *dev)
XXX10XX基本驱动:启动设备
Definition driver.c:82
xwer_t xwds_cantrcv_xxx10xx_drv_resume(struct xwds_device *dev)
XXX10XX基本驱动:继续设备
Definition driver.c:148
xwer_t xwds_cantrcv_xxx10xx_drv_probe(struct xwds_device *dev)
XXX10XX基本驱动:探测设备
Definition driver.c:65

XXX10XX的驱动集合

在文件 driver.c31 行定义.