4 * ADM5120 GPIO wrappers for arch-neutral GPIO calls
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
26 #ifndef _ADM5120_GPIO_H_
27 #define _ADM5120_GPIO_H_
29 #define ADM5120_GPIO_PIN0 0
30 #define ADM5120_GPIO_PIN1 1
31 #define ADM5120_GPIO_PIN2 2
32 #define ADM5120_GPIO_PIN3 3
33 #define ADM5120_GPIO_PIN4 4
34 #define ADM5120_GPIO_PIN5 5
35 #define ADM5120_GPIO_PIN6 6
36 #define ADM5120_GPIO_PIN7 7
37 #define ADM5120_GPIO_P0L0 8
38 #define ADM5120_GPIO_P0L1 9
39 #define ADM5120_GPIO_P0L2 10
40 #define ADM5120_GPIO_P1L0 11
41 #define ADM5120_GPIO_P1L1 12
42 #define ADM5120_GPIO_P1L2 13
43 #define ADM5120_GPIO_P2L0 14
44 #define ADM5120_GPIO_P2L1 15
45 #define ADM5120_GPIO_P2L2 16
46 #define ADM5120_GPIO_P3L0 17
47 #define ADM5120_GPIO_P3L1 18
48 #define ADM5120_GPIO_P3L2 19
49 #define ADM5120_GPIO_P4L0 20
50 #define ADM5120_GPIO_P4L1 21
51 #define ADM5120_GPIO_P4L2 22
52 #define ADM5120_GPIO_MAX 22
53 #define ADM5120_GPIO_COUNT ADM5120_GPIO_MAX+1
55 extern int adm5120_gpio_direction_input(unsigned gpio
);
56 extern int adm5120_gpio_direction_output(unsigned gpio
, int value
);
57 extern int adm5120_gpio_get_value(unsigned gpio
);
58 extern void adm5120_gpio_set_value(unsigned gpio
, int value
);
59 extern int adm5120_gpio_request(unsigned gpio
, const char *label
);
60 extern void adm5120_gpio_free(unsigned gpio
);
61 extern int adm5120_gpio_to_irq(unsigned gpio
);
62 extern int adm5120_irq_to_gpio(unsigned irq
);
65 * Wrappers for the generic GPIO layer
67 static inline int gpio_direction_input(unsigned gpio
)
69 return adm5120_gpio_direction_input(gpio
);
72 static inline int gpio_direction_output(unsigned gpio
, int value
)
74 return adm5120_gpio_direction_output(gpio
,value
);
77 static inline int gpio_get_value(unsigned gpio
)
79 return adm5120_gpio_get_value(gpio
);
82 static inline void gpio_set_value(unsigned gpio
, int value
)
84 adm5120_gpio_set_value(gpio
, value
);
87 static inline int gpio_request(unsigned gpio
, const char *label
)
89 return adm5120_gpio_request(gpio
, label
);
92 static inline void gpio_free(unsigned gpio
)
94 adm5120_gpio_free(gpio
);
97 static inline int gpio_to_irq(unsigned gpio
)
99 return adm5120_gpio_to_irq(gpio
);
102 static inline int irq_to_gpio(unsigned irq
)
104 return adm5120_irq_to_gpio(irq
);
107 #include <asm-generic/gpio.h> /* cansleep wrappers */
This page took 0.066994 seconds and 5 git commands to generate.