XWOS API
4.0
XWOS C/C++ API参考手册
|
玄武设备栈:IO扩展芯片:GPIO 更多...
#include <xwcd/ds/standard.h>
#include <string.h>
#include <xwos/lib/xwaop.h>
#include <xwcd/ds/iochip/gpio.h>
函数 | |
xwer_t | xwds_iochip_gpio_req (struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmask, xwtm_t to) |
XWDS API:申请IO扩展芯片的GPIO | |
xwer_t | xwds_iochip_gpio_rls (struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmask, xwtm_t to) |
XWDS API:释放IO扩展芯片的GPIO | |
xwer_t | xwds_iochip_gpio_cfg (struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmask, void *cfg, xwtm_t to) |
XWDS API:配置IO扩展芯片的GPIO | |
xwer_t | xwds_iochip_gpio_set (struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmask, xwtm_t to) |
XWDS API:将IO扩展芯片的GPIO设置为高电平 | |
xwer_t | xwds_iochip_gpio_reset (struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmask, xwtm_t to) |
XWDS API:将IO扩展芯片的GPIO设置为低电平 | |
xwer_t | xwds_iochip_gpio_toggle (struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmask, xwtm_t to) |
XWDS API:翻转IO扩展芯片的GPIO电平 | |
xwer_t | xwds_iochip_gpio_output (struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmask, xwsq_t out, xwtm_t to) |
XWDS API:并行输出多个IO扩展芯片的GPIO | |
xwer_t | xwds_iochip_gpio_input (struct xwds_iochip *iochip, xwid_t port, xwsq_t pinmask, xwsq_t *inbuf, xwtm_t to) |
XWDS API:并行读取多个IO扩展芯片的GPIO | |
玄武设备栈:IO扩展芯片:GPIO
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
在文件 gpio.c 中定义.
xwer_t xwds_iochip_gpio_cfg | ( | struct xwds_iochip * | iochip, |
xwid_t | port, | ||
xwsq_t | pinmask, | ||
void * | cfg, | ||
xwtm_t | to | ||
) |
XWDS API:配置IO扩展芯片的GPIO
[in] | iochip | IOCHIP对象指针 |
[in] | port | GPIO端口 |
[in] | pinmask | 引脚的掩码,取值 xwds_iochip_gpio_pin_em 中的任意项的或运算 |
[in] | cfg | GPIO配置,取值依据不同IOCHIP |
[in] | to | 期望唤醒的时间点 |
XWOK | 没有错误 |
-EFAULT | 无效指针 |
-ERANGE | GPIO PORT错误 |
-ENOSYS | 不支持的API |
<No error
xwer_t xwds_iochip_gpio_input | ( | struct xwds_iochip * | iochip, |
xwid_t | port, | ||
xwsq_t | pinmask, | ||
xwsq_t * | inbuf, | ||
xwtm_t | to | ||
) |
XWDS API:并行读取多个IO扩展芯片的GPIO
[in] | iochip | IOCHIP对象指针 |
[in] | port | GPIO端口 |
[in] | pinmask | 引脚的掩码,取值 xwds_iochip_gpio_pin_em 中的任意项的或运算 |
[out] | inbuf | 输入缓冲区 |
[in] | to | 期望唤醒的时间点 |
XWOK | 没有错误 |
-EFAULT | 无效指针 |
-ERANGE | GPIO PORT错误 |
-EPERM | GPIO PIN未被申请 |
-ENOSYS | 不支持的API |
<No error
xwer_t xwds_iochip_gpio_output | ( | struct xwds_iochip * | iochip, |
xwid_t | port, | ||
xwsq_t | pinmask, | ||
xwsq_t | out, | ||
xwtm_t | to | ||
) |
XWDS API:并行输出多个IO扩展芯片的GPIO
[in] | iochip | IOCHIP对象指针 |
[in] | port | GPIO端口 |
[in] | pinmask | 引脚的掩码,取值 xwds_iochip_gpio_pin_em 中的任意项的或运算 |
[in] | out | 输出值,取值 xwds_iochip_gpio_pin_em 中的任意项的或运算, 只有被pinmask掩码覆盖的部分有效,未覆盖的pin输出不会发生改变。 |
[in] | to | 期望唤醒的时间点 |
XWOK | 没有错误 |
-EFAULT | 无效指针 |
-ERANGE | GPIO PORT错误 |
-EPERM | GPIO PIN未被申请 |
-ENOSYS | 不支持的API |
<No error
xwer_t xwds_iochip_gpio_req | ( | struct xwds_iochip * | iochip, |
xwid_t | port, | ||
xwsq_t | pinmask, | ||
xwtm_t | to | ||
) |
XWDS API:申请IO扩展芯片的GPIO
[in] | iochip | IOCHIP对象指针 |
[in] | port | GPIO端口 |
[in] | pinmask | 引脚的掩码,取值 xwds_iochip_gpio_pin_em 中的任意项的或运算 |
[in] | to | 期望唤醒的时间点 |
XWOK | 没有错误 |
-EFAULT | 无效指针 |
-ERANGE | GPIO PORT错误 |
-EBUSY | GPIO PIN已被使用 |
<No error
xwer_t xwds_iochip_gpio_reset | ( | struct xwds_iochip * | iochip, |
xwid_t | port, | ||
xwsq_t | pinmask, | ||
xwtm_t | to | ||
) |
XWDS API:将IO扩展芯片的GPIO设置为低电平
[in] | iochip | IOCHIP对象指针 |
[in] | port | GPIO端口 |
[in] | pinmask | 引脚的掩码,取值 xwds_iochip_gpio_pin_em 中的任意项的或运算 |
[in] | to | 期望唤醒的时间点 |
XWOK | 没有错误 |
-EFAULT | 无效指针 |
-ERANGE | GPIO PORT错误 |
-EPERM | GPIO PIN未被申请 |
-ENOSYS | 不支持的API |
<No error
xwer_t xwds_iochip_gpio_rls | ( | struct xwds_iochip * | iochip, |
xwid_t | port, | ||
xwsq_t | pinmask, | ||
xwtm_t | to | ||
) |
XWDS API:释放IO扩展芯片的GPIO
[in] | iochip | IOCHIP对象指针 |
[in] | port | GPIO端口 |
[in] | pinmask | 引脚的掩码,取值 xwds_iochip_gpio_pin_em 中的任意项的或运算 |
[in] | to | 期望唤醒的时间点 |
XWOK | 没有错误 |
-EFAULT | 无效指针 |
-ERANGE | GPIO PORT错误 |
-EPERM | GPIO PIN未被申请 |
<No error
xwer_t xwds_iochip_gpio_set | ( | struct xwds_iochip * | iochip, |
xwid_t | port, | ||
xwsq_t | pinmask, | ||
xwtm_t | to | ||
) |
XWDS API:将IO扩展芯片的GPIO设置为高电平
[in] | iochip | IOCHIP对象指针 |
[in] | port | GPIO端口 |
[in] | pinmask | 引脚的掩码,取值 xwds_iochip_gpio_pin_em 中的任意项的或运算 |
[in] | to | 期望唤醒的时间点 |
XWOK | 没有错误 |
-EFAULT | 无效指针 |
-ERANGE | GPIO PORT错误 |
-EPERM | GPIO PIN未被申请 |
-ENOSYS | 不支持的API |
<No error
xwer_t xwds_iochip_gpio_toggle | ( | struct xwds_iochip * | iochip, |
xwid_t | port, | ||
xwsq_t | pinmask, | ||
xwtm_t | to | ||
) |
XWDS API:翻转IO扩展芯片的GPIO电平
[in] | iochip | IOCHIP对象指针 |
[in] | port | GPIO端口 |
[in] | pinmask | 引脚的掩码,取值 xwds_iochip_gpio_pin_em 中的任意项的或运算 |
[in] | to | 期望唤醒的时间点 |
XWOK | 没有错误 |
-EFAULT | 无效指针 |
-ERANGE | GPIO PORT错误 |
-EPERM | GPIO PIN未被申请 |
-ENOSYS | 不支持的API |
<No error