The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/gpio.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $OpenBSD: gpio.h,v 1.8 2011/10/03 20:24:51 matthieu Exp $       */
    2 /*
    3  * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
    4  *
    5  * Permission to use, copy, modify, and distribute this software for any
    6  * purpose with or without fee is hereby granted, provided that the above
    7  * copyright notice and this permission notice appear in all copies.
    8  *
    9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   16  */
   17 
   18 #ifndef _SYS_GPIO_H_
   19 #define _SYS_GPIO_H_
   20 
   21 /* GPIO pin states */
   22 #define GPIO_PIN_LOW            0x00    /* low level (logical 0) */
   23 #define GPIO_PIN_HIGH           0x01    /* high level (logical 1) */
   24 
   25 /* Max name length of a pin */
   26 #define GPIOPINMAXNAME          64
   27 
   28 /* GPIO pin configuration flags */
   29 #define GPIO_PIN_INPUT          0x0001  /* input direction */
   30 #define GPIO_PIN_OUTPUT         0x0002  /* output direction */
   31 #define GPIO_PIN_INOUT          0x0004  /* bi-directional */
   32 #define GPIO_PIN_OPENDRAIN      0x0008  /* open-drain output */
   33 #define GPIO_PIN_PUSHPULL       0x0010  /* push-pull output */
   34 #define GPIO_PIN_TRISTATE       0x0020  /* output disabled */
   35 #define GPIO_PIN_PULLUP         0x0040  /* internal pull-up enabled */
   36 #define GPIO_PIN_PULLDOWN       0x0080  /* internal pull-down enabled */
   37 #define GPIO_PIN_INVIN          0x0100  /* invert input */
   38 #define GPIO_PIN_INVOUT         0x0200  /* invert output */
   39 #define GPIO_PIN_USER           0x0400  /* user != 0 can access */
   40 #define GPIO_PIN_SET            0x8000  /* set for securelevel access */
   41 
   42 /* GPIO controller description */
   43 struct gpio_info {
   44         int gpio_npins;         /* total number of pins available */
   45 };
   46 
   47 /* GPIO pin operation (read/write/toggle) */
   48 struct gpio_pin_op {
   49         char gp_name[GPIOPINMAXNAME];   /* pin name */
   50         int gp_pin;                     /* pin number */
   51         int gp_value;                   /* value */
   52 };
   53 
   54 /* GPIO pin configuration */
   55 struct gpio_pin_set {
   56         char gp_name[GPIOPINMAXNAME];
   57         int gp_pin;
   58         int gp_caps;
   59         int gp_flags;
   60         char gp_name2[GPIOPINMAXNAME];  /* new name */
   61 };
   62 
   63 /* Attach/detach device drivers that use GPIO pins */
   64 struct gpio_attach {
   65         char ga_dvname[16];     /* device name */
   66         int ga_offset;          /* pin number */
   67         u_int32_t ga_mask;      /* binary mask */
   68         u_int32_t ga_flags;     /* flags */
   69 };
   70 
   71 #define GPIOINFO                _IOR('G', 0, struct gpio_info)
   72 #define GPIOPINREAD             _IOWR('G', 1, struct gpio_pin_op)
   73 #define GPIOPINWRITE            _IOWR('G', 2, struct gpio_pin_op)
   74 #define GPIOPINTOGGLE           _IOWR('G', 3, struct gpio_pin_op)
   75 #define GPIOPINSET              _IOWR('G', 4, struct gpio_pin_set)
   76 #define GPIOPINUNSET            _IOWR('G', 5, struct gpio_pin_set)
   77 #define GPIOATTACH              _IOWR('G', 6, struct gpio_attach)
   78 #define GPIODETACH              _IOWR('G', 7, struct gpio_attach)
   79 
   80 #endif  /* !_SYS_GPIO_H_ */

Cache object: e0eeaa265d7523767e80ecfd3cd9935c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.