linux的gpio操作的api寻找
授人以鱼不如授人以渔,那么,拿人以鱼不如学人以渔
在有需求的时候能够找到对应的寻找点,那么就成功了
文件drivers/gpio/gpiolib.c
,所需要的gpio的api都在里面了,例如
/**
* gpio_export - export a GPIO through sysfs gpio在sysfs的出口,供用户使用
* @gpio: gpio to make available, already requested
* @direction_may_change: true if userspace may change gpio direction
* Context: arch_initcall or later
*
* When drivers want to make a GPIO accessible to userspace after they
* have requested it -- perhaps while debugging, or as part of their
* public interface -- they may use this routine. If the GPIO can
* change direction (some can't) and the caller allows it, userspace
* will see "direction" sysfs attribute which may be used to change
* the gpio's direction. A "value" attribute will always be provided.
*
* Returns zero on success, else an error.
*/
static int gpiod_export(struct g