- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Linux 设备驱动程序编程中哪种 GPIO API 更适合以及在什么条件下使用:gpio_set_value()
或 gpiod_set_value()
?
一种将 GPIO desc 作为对象,另一种则采用从设备树中解析出的 GPIO。
最佳答案
对于所有新驱动程序,建议使用 gpiod_*
API。老gpio_*
API 现已被视为已弃用。
来自this提交:
gpiolib: export descriptor-based GPIO interface
This patch exports the
gpiod_*
family of API functions, a safer alternative to the legacy GPIO interface. Differences between the gpiod and legacy gpio APIs are:
- gpio works with integers, whereas gpiod operates on opaque handlers which cannot be forged or used before proper acquisition
- gpiod get/set functions are aware of the active low state of a GPIO
- gpio consumers should now include
<linux/gpio/consumer.h>
to access the new interface, whereas chips drivers will use<linux/gpio/driver.h>
The legacy gpio API is now built as inline functions on top of gpiod.
有关新 gpiod API 的详细信息,请参阅下一个链接:
关于linux-kernel - Linux 内核中的 gpiod_* 与 gpio_* 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39103185/
Linux 设备驱动程序编程中哪种 GPIO API 更适合以及在什么条件下使用:gpio_set_value() 或 gpiod_set_value()? 一种将 GPIO desc 作为对象,另一
我是一名优秀的程序员,十分优秀!