zoukankan      html  css  js  c++  java
  • linux中的GPIO操作(gpio封装接口)

    在linux当中,由于其结构复杂,系统庞大,对gpio的操作与普通单片机有所不同。

    linux当中,对gpio的操作都已经向层封装好了独立的api接口,操作时只需要调用对应接口即可。

    常用接口如下:

      

     1 static inline int gpio_get_value(unsigned int gpio)
     2 {
     3 return __gpio_get_value(gpio);
     4 }
     5 
     6 static inline void gpio_set_value(unsigned int gpio, int value)
     7 {
     8     __gpio_set_value(gpio, value);
     9 }
    10 
    11 static inline int gpio_to_irq(unsigned int gpio)
    12 {
    13     return __gpio_to_irq(gpio);
    14 }
    15 
    16 struct device;
    17 
    18 int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
    19 
    20 int devm_gpio_request_one(struct device *dev, unsigned gpio, unsigned long flags, const char *label);
    21 
    22 void devm_gpio_free(struct device *dev, unsigned int gpio);
    23 
    24 static inline bool gpio_is_valid(int number)
    25 
    26 {
    27   return number >= 0 && number < ARCH_NR_GPIOS;
    28 }

    (转载自:https://www.cnblogs.com/Cqlismy/p/11891789.html)

  • 相关阅读:
    shell的一本书
    linux设置网络三种方法
    BIOS讲解
    对于ssh和hadoop联系讲解和ssh的基本内容
    Httphandler
    ASP.NET配置文件
    Httpmoudle
    ASP.NET页面生命周期
    ASP.NET页面跳转方法的集合
    OutputCache的使用
  • 原文地址:https://www.cnblogs.com/goahead--linux/p/13965083.html
Copyright © 2011-2022 走看看