Brian Swetland | 12981aa | 2009-01-02 01:31:43 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
Unnati Gandhi | e8262ac | 2014-07-17 14:37:49 +0530 | [diff] [blame] | 5 | * Copyright (c) 2014 The Linux Foundation. All rights reserved |
| 6 | * |
Brian Swetland | 12981aa | 2009-01-02 01:31:43 -0800 | [diff] [blame] | 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in |
| 14 | * the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 20 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 21 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 25 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 27 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 | * SUCH DAMAGE. |
| 29 | */ |
| 30 | |
Unnati Gandhi | e8262ac | 2014-07-17 14:37:49 +0530 | [diff] [blame] | 31 | #include <platform/gpio.h> |
| 32 | |
Brian Swetland | 12981aa | 2009-01-02 01:31:43 -0800 | [diff] [blame] | 33 | #ifndef __DEV_GPIO_H |
| 34 | #define __DEV_GPIO_H |
| 35 | |
Greg Grisco | d2471ef | 2011-07-14 13:00:42 -0700 | [diff] [blame] | 36 | #ifndef GPIO_INPUT |
Brian Swetland | 12981aa | 2009-01-02 01:31:43 -0800 | [diff] [blame] | 37 | #define GPIO_INPUT 0x0000 |
Greg Grisco | d2471ef | 2011-07-14 13:00:42 -0700 | [diff] [blame] | 38 | #endif |
| 39 | #ifndef GPIO_OUTPUT |
Brian Swetland | 12981aa | 2009-01-02 01:31:43 -0800 | [diff] [blame] | 40 | #define GPIO_OUTPUT 0x0001 |
Greg Grisco | d2471ef | 2011-07-14 13:00:42 -0700 | [diff] [blame] | 41 | #endif |
Brian Swetland | 12981aa | 2009-01-02 01:31:43 -0800 | [diff] [blame] | 42 | |
| 43 | #define GPIO_LEVEL 0x0000 |
| 44 | #define GPIO_EDGE 0x0010 |
| 45 | |
| 46 | #define GPIO_RISING 0x0020 |
| 47 | #define GPIO_FALLING 0x0040 |
| 48 | |
| 49 | #define GPIO_HIGH 0x0020 |
| 50 | #define GPIO_LOW 0x0040 |
| 51 | |
| 52 | #define GPIO_PULLUP 0x0100 |
| 53 | #define GPIO_PULLDOWN 0x0200 |
| 54 | |
| 55 | int gpio_config(unsigned nr, unsigned flags); |
| 56 | void gpio_set(unsigned nr, unsigned on); |
| 57 | int gpio_get(unsigned nr); |
| 58 | |
| 59 | #endif |