Linux GPIO Interfaces

Source: Internet
Author: User

That said, if the Convention are supported on their platform, drivers should
Use it when possible. Platforms must declare GENERIC_GPIO support in their
Kconfig (Boolean True), and provide an <asm/gpio.h> file. Drivers that can ' t
Work without standard GPIO calls should has Kconfig entries which depend
On Generic_gpio. The GPIO calls is available, either as "real code" or as
Optimized-away stubs, when drivers use the Include file:

#include <linux/gpio.h>

Identifying GPIOs
-----------------
GPIOs is identified by unsigned integers in the range 0..max_int.
Reserves "negative" numbers for other purposes like marking signals as
"Not available on this board", or indicating faults. Code that doesn ' t
Touch the underlying hardware treats these integers as opaque cookies.

If you want to initialize a structure with the invalid GPIO number, use
Some negative number (perhaps "-einval"); That'll never be valid. To
Test if such number from such a structure could reference a GPIO, you
May use this predicate:

int gpio_is_valid (int number);

A number that's not valid'll be rejected by calls which request
or free GPIOs (see below). Other numbers may also is rejected; For
Example, a number might is valid but temporarily unused on a given board.

Linux GPIO Interfaces

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.