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/arm/include/at91_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 /*-
    2  * Copyright (C) 2006 M. Warner Losh. All rights reserved.
    3  * Copyright (C) 2012 Ian Lepore. All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/10.2/sys/arm/include/at91_gpio.h 248911 2013-03-29 19:52:57Z ian $
   27  */
   28 
   29 #ifndef _ARM_AT91_GPIO_H
   30 #define _ARM_AT91_GPIO_H
   31 
   32 #ifndef _KERNEL
   33 #include <sys/types.h>
   34 #endif
   35 #include <sys/ioccom.h>
   36 
   37 /* Userland GPIO API for Atmel AT91 series SOC.
   38  *
   39  * Open /dev/pioN (where N is 0 for PIOA, 1 for PIOB, etc), and use ioctl(2)
   40  * calls to configure the pin(s) as needed.
   41  *
   42  * The userland interrupt support allows you to use read(2) and/or select(2) to
   43  * get notified of interrupts on PIO pins for which you enabled interrupt
   44  * notifications.  Each time an interrupt occurs on a given pin, that pin number
   45  * is written into a buffer as a uint8_t.  Thus, reading from /dev/pioN delivers
   46  * info on which interrupt(s) have occurred since the last read.  You can also
   47  * use select() to block until an interrupt occurs (you still need to read() to
   48  * consume the interrupt number bytes from the buffer.)
   49  */
   50 
   51 struct at91_gpio_info
   52 {
   53         uint32_t        output_status;  /* Current state of output pins */
   54         uint32_t        input_status;   /* 1->out 0->in bitmask */
   55         uint32_t        highz_status;   /* 1->highz 0->driven bitmask */
   56         uint32_t        pullup_status;  /* 1->floating 0->pullup engaged */
   57         uint32_t        glitch_status;  /* 0-> no glitch filter 1->gf */
   58         uint32_t        enabled_status; /* 1->used for pio 0->other */
   59         uint32_t        periph_status;  /* 0->A periph 1->B periph */
   60         uint32_t        intr_status;    /* 1-> ISR enabled, 0->disabled */
   61         uint32_t        extra_status[8];/* Extra status info, device depend */
   62 };
   63 
   64 struct at91_gpio_cfg
   65 {
   66         uint32_t        cfgmask;        /* which things change */
   67 #define AT91_GPIO_CFG_INPUT     0x01    /* configure input/output pins */
   68 #define AT91_GPIO_CFG_HI_Z      0x02    /* HiZ */
   69 #define AT91_GPIO_CFG_PULLUP    0x04    /* Enable/disable pullup resistors */
   70 #define AT91_GPIO_CFG_GLITCH    0x08    /* Glitch filtering */
   71 #define AT91_GPIO_CFG_GPIO      0x10    /* Use pin for PIO or peripheral */
   72 #define AT91_GPIO_CFG_PERIPH    0x20    /* Select which peripheral to use */
   73 #define AT91_GPIO_CFG_INTR      0x40    /* Select pin for interrupts */
   74         uint32_t        iomask;         /* Mask of bits to change */
   75         uint32_t        input;          /* or output */
   76         uint32_t        hi_z;           /* Disable output */
   77         uint32_t        pullup;         /* Enable pullup resistor */
   78         uint32_t        glitch;         /* Glitch filtering */
   79         uint32_t        gpio;           /* Enabled for PIO (1) or periph (0) */
   80         uint32_t        periph;         /* Select periph A (0) or periph B (1) */
   81         uint32_t        intr;           /* Enable interrupt (1), or not (0) */
   82 };
   83 
   84 struct at91_gpio_bang
   85 {
   86         uint32_t        clockpin;       /* clock pin MASK */
   87         uint32_t        datapin;        /* Data pin MASK */
   88         uint32_t        bits;           /* bits to clock out (all 32) */
   89 };
   90 
   91 struct at91_gpio_bang_many
   92 {
   93         uint32_t        clockpin;       /* clock pin MASK */
   94         uint32_t        datapin;        /* Data pin MASK */
   95         void            *bits;          /* bits to clock out */
   96         uint32_t        numbits;        /* Number of bits to clock out */
   97 };
   98 
   99 #define AT91_GPIO_SET           _IOW('g', 0, uint32_t)                  /* Turn bits on */
  100 #define AT91_GPIO_CLR           _IOW('g', 1, uint32_t)                  /* Turn bits off */
  101 #define AT91_GPIO_READ          _IOR('g', 2, uint32_t)                  /* Read input bit state */
  102 #define AT91_GPIO_INFO          _IOR('g', 3, struct at91_gpio_info)     /* State of pio cfg */
  103 #define AT91_GPIO_CFG           _IOW('g', 4, struct at91_gpio_cfg)      /* Configure pio */
  104 #define AT91_GPIO_BANG          _IOW('g', 5, struct at91_gpio_bang)     /* bit bang 32 bits */
  105 #define AT91_GPIO_BANG_MANY     _IOW('g', 6, struct at91_gpio_bang_many)/* bit bang >32 bits */
  106 
  107 #endif /* _ARM_AT91_GPIO_H */
  108 

Cache object: 4c945fea21cd036293fa7bc9fdab9437


[ 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.