4 * Copyright Derek Molloy, School of Electronic Engineering, Dublin City University
5 * www.eeng.dcu.ie/~molloyd/
7 * Based on Software by RidgeRun
8 * Copyright (c) 2011, RidgeRun
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the RidgeRun.
21 * 4. Neither the name of the RidgeRun nor the
22 * names of its contributors may be used to endorse or promote products
23 * derived from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY RIDGERUN ''AS IS'' AND ANY
26 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL RIDGERUN BE LIABLE FOR ANY
29 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
32 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 /****************************************************************
42 ****************************************************************/
44 #define SYSFS_GPIO_DIR "/sys/class/gpio"
45 #define POLL_TIMEOUT (3 * 1000) /* 3 seconds */
47 #define SYSFS_OMAP_MUX_DIR "/sys/kernel/debug/omap_mux/"
59 /****************************************************************
61 ****************************************************************/
62 int gpio_export(unsigned int gpio);
63 int gpio_unexport(unsigned int gpio);
64 int gpio_set_dir(unsigned int gpio, PIN_DIRECTION out_flag);
65 int gpio_set_value(unsigned int gpio, PIN_VALUE value);
66 int gpio_get_value(unsigned int gpio, unsigned int *value);
67 int gpio_set_edge(unsigned int gpio, char *edge);
68 int gpio_fd_open(unsigned int gpio);
69 int gpio_fd_close(int fd);
70 int gpio_omap_mux_setup(const char *omap_pin0_name, const char *mode);
72 #endif /* SIMPLEGPIO_H_ */