XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
driver.c
浏览该文件的文档.
1
21#include <xwos/standard.h>
22#include <xwos/lib/xwlog.h>
23#include <xwcd/ds/soc/gpio.h>
24#include <xwcd/ds/soc/eirq.h>
28
29#define LOGTAG "TCA9539"
30
31static __xwbsp_code
33 xwu8_t reg, xwu8_t data,
34 xwtm_t to)
35{
36 xwer_t rc;
37 struct xwds_i2cm * bus;
38 struct xwds_i2c_msg msg;
39 xwu8_t txdata[2];
40
41 bus = tca9539->iochip.bc.i2cp.bus;
42 txdata[0] = (xwu8_t)reg;
43 txdata[1] = (xwu8_t)data;
44 msg.addr = tca9539->iochip.bc.i2cp.addr;
48 msg.data = txdata;
49 msg.size = sizeof(txdata);
50 rc = xwds_i2cm_xfer(bus, &msg, to);
51 return rc;
52}
53
54static __xwbsp_code
56 xwu8_t reg, xwu8_t * buf,
57 xwtm_t to)
58{
59 xwer_t rc;
60 struct xwds_i2cm * bus;
61 struct xwds_i2c_msg msg;
62
63 bus = tca9539->iochip.bc.i2cp.bus;
64 msg.addr = tca9539->iochip.bc.i2cp.addr;
66 msg.data = &reg;
67 msg.size = 1;
68 rc = xwds_i2cm_xfer(bus, &msg, to);
69 if (XWOK == rc) {
70 msg.addr = tca9539->iochip.bc.i2cp.addr;
74 msg.data = buf;
75 msg.size = 1;
76 rc = xwds_i2cm_xfer(bus, &msg, to);
77 }
78 return rc;
79}
80
81/******** ******** base driver ******** ********/
84{
85 struct xwds_tca9539 * tca9539;
86 const struct xwds_resource_gpio * gpiorsc;
87 xwer_t rc;
88
89 tca9539 = xwds_cast(struct xwds_tca9539 *, dev);
90 gpiorsc = tca9539->gpiorsc.rst;
91 if (NULL != gpiorsc) {
92 rc = xwds_gpio_req(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
93 if (rc < 0) {
94 goto err_gpio_req_rst;
95 }
96 xwds_tca9539_reset(tca9539, true);
97 }
98 gpiorsc = tca9539->gpiorsc.irq;
99 if (NULL != gpiorsc) {
100 rc = xwds_gpio_req(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
101 if (rc < 0) {
102 goto err_gpio_req_irq;
103 }
104 }
105 return XWOK;
106
107err_gpio_req_irq:
108 gpiorsc = tca9539->gpiorsc.rst;
109 if (NULL != gpiorsc) {
110 xwds_gpio_rls(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
111 }
112err_gpio_req_rst:
113 return rc;
114}
115
118{
119 struct xwds_tca9539 * tca9539;
120 const struct xwds_resource_gpio * gpiorsc;
121
122 tca9539 = xwds_cast(struct xwds_tca9539 *, dev);
123 gpiorsc = tca9539->gpiorsc.irq;
124 if (NULL != gpiorsc) {
125 xwds_gpio_rls(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
126 }
127 gpiorsc = tca9539->gpiorsc.rst;
128 if (NULL != gpiorsc) {
129 xwds_gpio_rls(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
130 }
131 return XWOK;
132}
133
134#if defined(XWCDCFG_ds_PM) && (1 == XWCDCFG_ds_PM)
137{
138 return xwds_tca9539_drv_stop(dev);
139}
140
143{
144 return xwds_tca9539_drv_start(dev);
145}
146#endif
147
148/******** ******** gpio operation driver ******** ********/
152 xwtm_t to)
153{
154 XWOS_UNUSED(iochip);
157 XWOS_UNUSED(to);
158 return XWOK;
159}
160
164 xwtm_t to)
165{
166 XWOS_UNUSED(iochip);
169 XWOS_UNUSED(to);
170 return XWOK;
171}
172
175 xwid_t port, xwsq_t pinmsk, void * cfg,
176 xwtm_t to)
177{
178 struct xwds_tca9539 * tca9539 = xwds_cast(struct xwds_tca9539 *, iochip);
179 const struct xwds_tca9539_pincfg * pincfg = cfg;
180 xwer_t rc;
181 xwu8_t oldval;
182 xwu8_t newval;
183 xwu8_t cfgval;
184 xwu8_t regmsk;
185
186 regmsk = (xwu8_t)pinmsk & 0xFFU;
188 cfgval = regmsk;
189 } else {
190 cfgval = regmsk ^ regmsk;
191 }
192 if (1U == port) {
193 rc = xwds_tca9539_read(tca9539, XWDS_TCA9539_REG_P1_CFG, &oldval, to);
194 if (rc < 0) {
195 goto err_read;
196 }
197 newval = oldval & (~regmsk);
198 newval |= cfgval;
199 rc = xwds_tca9539_write(tca9539, XWDS_TCA9539_REG_P1_CFG, newval, to);
200 if (rc < 0) {
201 goto err_write;
202 }
203 } else {
204 rc = xwds_tca9539_read(tca9539, XWDS_TCA9539_REG_P0_CFG, &oldval, to);
205 if (rc < 0) {
206 goto err_read;
207 }
208 newval = oldval & (~regmsk);
209 newval |= cfgval;
210 rc = xwds_tca9539_write(tca9539, XWDS_TCA9539_REG_P0_CFG, newval, to);
211 if (rc < 0) {
212 goto err_write;
213 }
214 }
215 return XWOK;
216
217err_write:
218err_read:
219 return rc;
220}
221
224 xwid_t port, xwsq_t pinmsk,
225 xwtm_t to)
226{
227 struct xwds_tca9539 * tca9539 = xwds_cast(struct xwds_tca9539 *, iochip);
228 xwer_t rc;
229 xwu8_t oldval;
230 xwu8_t newval;
231 xwu8_t regmsk;
232
233 regmsk = (xwu8_t)pinmsk & 0xFFU;
234 if (1U == port) {
235 rc = xwds_tca9539_read(tca9539,
236 XWDS_TCA9539_REG_P1_OUTPUT, &oldval, to);
237 if (rc < 0) {
238 goto err_read;
239 }
240 newval = oldval & (~regmsk);
241 newval |= regmsk;
242 rc = xwds_tca9539_write(tca9539,
243 XWDS_TCA9539_REG_P1_OUTPUT, newval, to);
244 if (rc < 0) {
245 goto err_write;
246 }
247 } else {
248 rc = xwds_tca9539_read(tca9539,
249 XWDS_TCA9539_REG_P0_OUTPUT, &oldval, to);
250 if (rc < 0) {
251 goto err_read;
252 }
253 newval = oldval & (~regmsk);
254 newval |= regmsk;
255 rc = xwds_tca9539_write(tca9539,
256 XWDS_TCA9539_REG_P0_OUTPUT, newval, to);
257 if (rc < 0) {
258 goto err_write;
259 }
260 }
261 return XWOK;
262
263err_write:
264err_read:
265 return rc;
266}
267
270 xwid_t port, xwsq_t pinmsk,
271 xwtm_t to)
272{
273 struct xwds_tca9539 * tca9539 = xwds_cast(struct xwds_tca9539 *, iochip);
274 xwer_t rc;
275 xwu8_t oldval;
276 xwu8_t newval;
277 xwu8_t regmsk;
278
279 regmsk = (xwu8_t)pinmsk & 0xFFU;
280 if (1U == port) {
281 rc = xwds_tca9539_read(tca9539,
282 XWDS_TCA9539_REG_P1_OUTPUT, &oldval, to);
283 if (rc < 0) {
284 goto err_read;
285 }
286 newval = oldval & (~regmsk);
287 rc = xwds_tca9539_write(tca9539,
288 XWDS_TCA9539_REG_P1_OUTPUT, newval, to);
289 if (rc < 0) {
290 goto err_write;
291 }
292 } else {
293 rc = xwds_tca9539_read(tca9539,
294 XWDS_TCA9539_REG_P0_OUTPUT, &oldval, to);
295 if (rc < 0) {
296 goto err_read;
297 }
298 newval = oldval & (~regmsk);
299 rc = xwds_tca9539_write(tca9539,
300 XWDS_TCA9539_REG_P0_OUTPUT, newval, to);
301 if (rc < 0) {
302 goto err_write;
303 }
304 }
305 return XWOK;
306
307err_write:
308err_read:
309 return rc;
310}
311
314 xwid_t port, xwsq_t pinmsk,
315 xwtm_t to)
316{
317 struct xwds_tca9539 * tca9539 = xwds_cast(struct xwds_tca9539 *, iochip);
318 xwer_t rc;
319 xwu8_t oldval;
320 xwu8_t newval;
321 xwu8_t regmsk;
322
323 regmsk = (xwu8_t)pinmsk & 0xFFU;
324 if (1U == port) {
325 rc = xwds_tca9539_read(tca9539,
326 XWDS_TCA9539_REG_P1_OUTPUT, &oldval, to);
327 if (rc < 0) {
328 goto err_read;
329 }
330 newval = oldval & (~regmsk);
331 newval ^= regmsk;
332 rc = xwds_tca9539_write(tca9539,
333 XWDS_TCA9539_REG_P1_OUTPUT, newval, to);
334 if (rc < 0) {
335 goto err_write;
336 }
337 } else {
338 rc = xwds_tca9539_read(tca9539,
339 XWDS_TCA9539_REG_P0_OUTPUT, &oldval, to);
340 if (rc < 0) {
341 goto err_read;
342 }
343 newval = oldval & (~regmsk);
344 newval ^= regmsk;
345 rc = xwds_tca9539_write(tca9539,
346 XWDS_TCA9539_REG_P0_OUTPUT, newval, to);
347 if (rc < 0) {
348 goto err_write;
349 }
350 }
351 return XWOK;
352
353err_write:
354err_read:
355 return rc;
356}
357
360 xwid_t port, xwsq_t pinmsk, xwsq_t out,
361 xwtm_t to)
362{
363 struct xwds_tca9539 * tca9539 = xwds_cast(struct xwds_tca9539 *, iochip);
364 xwer_t rc;
365 xwu8_t oldval;
366 xwu8_t newval;
367 xwu8_t regmsk;
368
369 regmsk = (xwu8_t)pinmsk & 0xFFU;
370 if (1U == port) {
371 rc = xwds_tca9539_read(tca9539,
372 XWDS_TCA9539_REG_P1_OUTPUT, &oldval, to);
373 if (rc < 0) {
374 goto err_read;
375 }
376 newval = oldval & (~regmsk);
377 newval |= (regmsk & (xwu8_t)out);
378 rc = xwds_tca9539_write(tca9539,
379 XWDS_TCA9539_REG_P1_OUTPUT, newval, to);
380 if (rc < 0) {
381 goto err_write;
382 }
383 } else {
384 rc = xwds_tca9539_read(tca9539,
385 XWDS_TCA9539_REG_P0_OUTPUT, &oldval, to);
386 if (rc < 0) {
387 goto err_read;
388 }
389 newval = oldval & (~regmsk);
390 newval |= (regmsk & (xwu8_t)out);
391 rc = xwds_tca9539_write(tca9539,
392 XWDS_TCA9539_REG_P0_OUTPUT, newval, to);
393 if (rc < 0) {
394 goto err_write;
395 }
396 }
397 return XWOK;
398
399err_write:
400err_read:
401 return rc;
402}
403
406 xwid_t port, xwsq_t pinmsk, xwsq_t * in,
407 xwtm_t to)
408{
409 struct xwds_tca9539 * tca9539 = xwds_cast(struct xwds_tca9539 *, iochip);
410 xwer_t rc;
411 xwu8_t regval;
412 xwu8_t regmsk;
413
414 regmsk = (xwu8_t)pinmsk & 0xFFU;
415 if (1U == port) {
416 rc = xwds_tca9539_read(tca9539,
417 XWDS_TCA9539_REG_P1_INPUT, &regval, to);
418 if (rc < 0) {
419 goto err_read;
420 }
421 *in = regval & regmsk;
422 } else {
423 rc = xwds_tca9539_read(tca9539,
424 XWDS_TCA9539_REG_P0_INPUT, &regval, to);
425 if (rc < 0) {
426 goto err_read;
427 }
428 *in = regval & regmsk;
429 }
430 return XWOK;
431
432err_read:
433 return rc;
434}
435
438 .base = {
439 .name = "xwds.tca9539",
440 .probe = NULL,
441 .remove = NULL,
442 .start = xwds_tca9539_drv_start,
443 .stop = xwds_tca9539_drv_stop,
444#if defined(XWCDCFG_ds_PM) && (1 == XWCDCFG_ds_PM)
445 .suspend = xwds_tca9539_drv_suspend,
446 .resume = xwds_tca9539_drv_resume,
447#endif
448 },
449 .gpio_req = xwds_tca9539_drv_gpio_req,
450 .gpio_rls = xwds_tca9539_drv_gpio_rls,
451 .gpio_cfg = xwds_tca9539_drv_gpio_cfg,
452 .gpio_set = xwds_tca9539_drv_gpio_set,
453 .gpio_reset = xwds_tca9539_drv_gpio_reset,
454 .gpio_toggle = xwds_tca9539_drv_gpio_toggle,
455 .gpio_output = xwds_tca9539_drv_gpio_output,
456 .gpio_input = xwds_tca9539_drv_gpio_input,
457};
458
459/******** ******** TCA9539 APIs ******** ********/
461void xwds_tca9539_reset(struct xwds_tca9539 * tca9539, bool active)
462{
463 const struct xwds_resource_gpio * gpiorsc;
464
465 gpiorsc = tca9539->gpiorsc.rst;
466 if (gpiorsc) {
467 if (active) {
468 xwds_gpio_reset(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
469 } else {
470 xwds_gpio_set(gpiorsc->soc, gpiorsc->port, gpiorsc->pinmask);
471 }
472 }
473}
474
477{
478 const struct xwds_tca9539_cfg * chipcfg;
479 const struct xwds_resource_gpio * gpiorsc;
480 xwer_t rc;
481
482 chipcfg = (const struct xwds_tca9539_cfg *)tca9539->iochip.gpio.cfg;
483 rc = xwds_tca9539_write(tca9539,
484 XWDS_TCA9539_REG_P0_CFG, chipcfg->p0.direction.u8,
485 to);
486 if (rc < 0) {
487 goto err_write;
488 }
489 rc = xwds_tca9539_write(tca9539,
490 XWDS_TCA9539_REG_P1_CFG, chipcfg->p1.direction.u8,
491 to);
492 if (rc < 0) {
493 goto err_write;
494 }
495 rc = xwds_tca9539_write(tca9539,
496 XWDS_TCA9539_REG_P0_OUTPUT, chipcfg->p0.out.u8,
497 to);
498 if (rc < 0) {
499 goto err_write;
500 }
501 rc = xwds_tca9539_write(tca9539,
502 XWDS_TCA9539_REG_P1_OUTPUT, chipcfg->p1.out.u8,
503 to);
504 if (rc < 0) {
505 goto err_write;
506 }
507 gpiorsc = tca9539->gpiorsc.irq;
508 if (NULL != gpiorsc) {
509 rc = xwds_eirq_req(gpiorsc->soc,
510 gpiorsc->port, gpiorsc->pinmask, tca9539->eirq,
512 eisr, tca9539);
513 if (rc < 0) {
514 goto err_eirq_req;
515 }
516 }
517 return XWOK;
518
519err_eirq_req:
520err_write:
521 return rc;
522}
523
525void xwds_tca9539_quit(struct xwds_tca9539 * tca9539)
526{
527 const struct xwds_resource_gpio * gpiorsc;
528
529 gpiorsc = tca9539->gpiorsc.irq;
530 if (NULL != gpiorsc) {
531 xwds_eirq_rls(gpiorsc->soc,
532 gpiorsc->port, gpiorsc->pinmask, tca9539->eirq);
533 }
534}
535
537void xwds_tca9539_dump(struct xwds_tca9539 * tca9539, xwtm_t to)
538{
539 xwer_t rc;
540 xwu8_t val[8];
541
542 rc = xwds_tca9539_read(tca9539,
543 XWDS_TCA9539_REG_P0_INPUT, &val[0], to);
544 if (rc < 0) {
545 goto err_read;
546 }
547 rc = xwds_tca9539_read(tca9539,
548 XWDS_TCA9539_REG_P1_INPUT, &val[1], to);
549 if (rc < 0) {
550 goto err_read;
551 }
552 rc = xwds_tca9539_read(tca9539,
553 XWDS_TCA9539_REG_P0_OUTPUT, &val[2], to);
554 if (rc < 0) {
555 goto err_read;
556 }
557 rc = xwds_tca9539_read(tca9539,
558 XWDS_TCA9539_REG_P1_OUTPUT, &val[3], to);
559 if (rc < 0) {
560 goto err_read;
561 }
562 rc = xwds_tca9539_read(tca9539,
563 XWDS_TCA9539_REG_P0_POLINV, &val[4], to);
564 if (rc < 0) {
565 goto err_read;
566 }
567 rc = xwds_tca9539_read(tca9539,
568 XWDS_TCA9539_REG_P1_POLINV, &val[5], to);
569 if (rc < 0) {
570 goto err_read;
571 }
572 rc = xwds_tca9539_read(tca9539,
573 XWDS_TCA9539_REG_P0_CFG, &val[6], to);
574 if (rc < 0) {
575 goto err_read;
576 }
577 rc = xwds_tca9539_read(tca9539,
578 XWDS_TCA9539_REG_P1_CFG, &val[7], to);
579 if (rc < 0) {
580 goto err_read;
581 }
582 xwlogf(INFO, LOGTAG,
583 "[ID:%d] 0x%X, 0x%X, 0x%X, 0x%X, 0x%X, 0x%X, 0x%X, 0x%X\r\n",
584 tca9539->iochip.bc.i2cp.dev.id,
585 val[0], val[1], val[2], val[3],
586 val[4], val[5], val[6], val[7]);
587err_read:
588 return;
589}
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
xwer_t xwds_eirq_rls(struct xwds_soc *soc, xwid_t port, xwsq_t pinmask, xwid_t eiid)
XWDS API:释放外部中断
Definition eirq.c:80
玄武设备栈:SOC:外部中断
@ XWDS_SOC_EIF_TM_FALLING
Definition eirq.h:42
@ XWDS_SOC_EIF_WKUP
Definition eirq.h:49
xwer_t xwds_i2cm_xfer(struct xwds_i2cm *i2cm, struct xwds_i2c_msg *msg, xwtm_t to)
XWDS API:传输I2C消息
Definition master.c:201
@ XWDS_I2C_F_WR
Definition common.h:43
@ XWDS_I2C_F_START
Definition common.h:46
@ XWDS_I2C_F_RD
Definition common.h:42
@ XWDS_I2C_F_STOP
Definition common.h:56
void(* xwds_eirq_f)(struct xwds_soc *, xwid_t, xwds_eirq_arg_t)
外部中断函数
Definition chip.h:143
#define xwds_cast(type, dev)
Definition standard.h:40
#define XWDS_TCA9539_REG_P0_POLINV
Definition device.h:38
xwer_t xwds_tca9539_drv_start(struct xwds_device *dev)
TCA9539基本驱动:启动设备
Definition driver.c:83
#define XWDS_TCA9539_REG_P1_INPUT
Definition device.h:35
#define XWDS_TCA9539_REG_P0_OUTPUT
Definition device.h:36
#define XWDS_TCA9539_REG_P1_OUTPUT
Definition device.h:37
#define XWDS_TCA9539_REG_P1_CFG
Definition device.h:41
#define XWDS_TCA9539_REG_P1_POLINV
Definition device.h:39
#define XWDS_TCA9539_REG_P0_CFG
Definition device.h:40
#define XWDS_TCA9539_REG_P0_INPUT
Definition device.h:34
@ XWDS_TCA9539_PIN_DIRECTION_IN
Definition device.h:48
#define __xwbsp_rodata
Definition compiler.h:251
#define __xwbsp_code
Definition compiler.h:231
#define __xwbsp_api
Definition compiler.h:235
#define XWOK
No error
Definition errno.h:182
xws64_t xwtm_t
XWOS系统时间 (有符号)
Definition type.h:742
signed long xwer_t
Definition type.h:554
#define NULL
Definition type.h:28
unsigned long xwid_t
Definition type.h:481
uint8_t xwu8_t
Definition type.h:194
unsigned long xwsq_t
Definition type.h:445
uint16_t xwu16_t
Definition type.h:230
#define xwlogf(lv, tag, fmt,...)
格式化日志,并输出
Definition xwlog.h:119
#define XWOS_UNUSED(x)
Definition standard.h:66
xwer_t xwds_tca9539_drv_gpio_input(struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmsk, xwsq_t *in, xwtm_t to)
TCA9539 GPIO驱动:并行读取多个IO扩展芯片的GPIO
Definition driver.c:405
xwer_t xwds_tca9539_drv_gpio_req(struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmask, xwtm_t to)
TCA9539 GPIO驱动:申请IO扩展芯片的GPIO
Definition driver.c:150
xwer_t xwds_tca9539_drv_gpio_reset(struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmsk, xwtm_t to)
TCA9539 GPIO驱动:将IO扩展芯片的GPIO设置为低电平
Definition driver.c:269
#define LOGTAG
Definition driver.c:29
void xwds_tca9539_dump(struct xwds_tca9539 *tca9539, xwtm_t to)
TCA9539 API:输出TCA9539的寄存器信息
Definition driver.c:537
xwer_t xwds_tca9539_drv_stop(struct xwds_device *dev)
TCA9539基本驱动:停止设备
Definition driver.c:117
xwer_t xwds_tca9539_drv_suspend(struct xwds_device *dev)
TCA9539基本驱动:暂停设备
Definition driver.c:136
void xwds_tca9539_reset(struct xwds_tca9539 *tca9539, bool active)
TCA9539 API:复位TCA9539
Definition driver.c:461
xwer_t xwds_tca9539_drv_gpio_output(struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmsk, xwsq_t out, xwtm_t to)
TCA9539 GPIO驱动:并行输出多个IO扩展芯片的GPIO
Definition driver.c:359
xwer_t xwds_tca9539_drv_gpio_cfg(struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmsk, void *cfg, xwtm_t to)
TCA9539 GPIO驱动:配置IO扩展芯片的GPIO
Definition driver.c:174
static xwer_t xwds_tca9539_write(struct xwds_tca9539 *tca9539, xwu8_t reg, xwu8_t data, xwtm_t to)
Definition driver.c:32
xwer_t xwds_tca9539_drv_resume(struct xwds_device *dev)
TCA9539基本驱动:继续设备
Definition driver.c:142
xwer_t xwds_tca9539_run(struct xwds_tca9539 *tca9539, xwds_eirq_f eisr, xwtm_t to)
TCA9539 API:启动TCA9539
Definition driver.c:476
xwer_t xwds_tca9539_drv_gpio_toggle(struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmsk, xwtm_t to)
TCA9539 GPIO驱动:翻转IO扩展芯片的GPIO电平
Definition driver.c:313
void xwds_tca9539_quit(struct xwds_tca9539 *tca9539)
TCA9539 API:停止运行TCA9539
Definition driver.c:525
const struct xwds_iochip_driver xwds_tca9539_drv
TCA9539的驱动
Definition driver.c:437
xwer_t xwds_tca9539_drv_gpio_set(struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmsk, xwtm_t to)
TCA9539 GPIO驱动:将IO扩展芯片的GPIO设置为高电平
Definition driver.c:223
xwer_t xwds_tca9539_drv_gpio_rls(struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmask, xwtm_t to)
TCA9539 GPIO驱动:释放IO扩展芯片的GPIO
Definition driver.c:162
static xwer_t xwds_tca9539_read(struct xwds_tca9539 *tca9539, xwu8_t reg, xwu8_t *buf, xwtm_t to)
Definition driver.c:55
玄武设备栈:I2C IO扩展芯片:TCA9539:驱动
玄武设备栈:I2C:外设
玄武设备栈:I2C IO扩展芯片:TCA9539
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_rls(struct xwds_soc *soc, xwid_t port, xwsq_t pinmask)
XWDS API:释放SOC的GPIO
Definition gpio.c:63
xwer_t xwds_gpio_set(struct xwds_soc *soc, xwid_t port, xwsq_t pinmask)
XWDS API:将SOC的GPIO设置为高电平
Definition gpio.c:131
xwer_t xwds_gpio_req(struct xwds_soc *soc, xwid_t port, xwsq_t pinmask)
XWDS API:申请SOC的GPIO
Definition gpio.c:27
玄武设备栈:SOC:GPIO
设备(所有设备的基类)
Definition device.h:127
xwid_t id
Definition device.h:131
const char * name
Definition device.h:115
I2C消息
Definition common.h:62
xwsz_t size
Definition common.h:68
xwu8_t * data
Definition common.h:67
xwu16_t addr
Definition common.h:63
xwu16_t flag
Definition common.h:66
I2C主机
Definition master.h:53
struct xwds_device dev
Definition peripheral.h:49
xwu16_t addr
Definition peripheral.h:53
struct xwds_i2cm * bus
Definition peripheral.h:52
BSP中需要提供的IO扩展芯片设备驱动函数表
Definition chip.h:52
struct xwds_driver base
Definition chip.h:53
IO扩展芯片
Definition chip.h:95
struct xwds_i2cp i2cp
Definition chip.h:99
union xwds_iochip::@19 bc
struct xwds_iochip::@20 gpio
void * cfg
Definition chip.h:108
设备栈GPIO资源
Definition standard.h:98
struct xwds_soc * soc
Definition standard.h:99
TCA9539配置
Definition device.h:56
TCA9539 PIN配置
Definition device.h:120
TCA9539对象
Definition device.h:127
const struct xwds_resource_gpio * irq
Definition device.h:131
const struct xwds_resource_gpio * rst
Definition device.h:130
xwid_t eirq
Definition device.h:133
struct xwds_iochip iochip
Definition device.h:128
struct xwds_tca9539::@39 gpiorsc
XWOS通用库:日志
XWOS的标准头文件