diff options
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/gpio-imx31.h')
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/gpio-imx31.h | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/gpio-imx31.h b/firmware/target/arm/imx31/gigabeat-s/gpio-imx31.h deleted file mode 100644 index 72956d4efa..0000000000 --- a/firmware/target/arm/imx31/gigabeat-s/gpio-imx31.h +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (c) 2008 by Michael Sevakis | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef GPIO_IMX31_H | ||
22 | #define GPIO_IMX31_H | ||
23 | |||
24 | /* Static registration mechanism for imx31 GPIO interrupts */ | ||
25 | #define USE_GPIO1_EVENTS (1 << 0) | ||
26 | #define USE_GPIO2_EVENTS (1 << 1) | ||
27 | #define USE_GPIO3_EVENTS (1 << 2) | ||
28 | |||
29 | /* Module indexes defined by which GPIO modules are used */ | ||
30 | enum gpio_module_number | ||
31 | { | ||
32 | __GPIO_NUM_START = -1, | ||
33 | #if (GPIO_EVENT_MASK & USE_GPIO1_EVENTS) | ||
34 | GPIO1_NUM, | ||
35 | #endif | ||
36 | #if (GPIO_EVENT_MASK & USE_GPIO2_EVENTS) | ||
37 | GPIO2_NUM, | ||
38 | #endif | ||
39 | #if (GPIO_EVENT_MASK & USE_GPIO3_EVENTS) | ||
40 | GPIO3_NUM, | ||
41 | #endif | ||
42 | GPIO_NUM_GPIO, | ||
43 | }; | ||
44 | |||
45 | /* Module corresponding to the event ID is identified by range */ | ||
46 | enum gpio_event_bases | ||
47 | { | ||
48 | #if (GPIO_EVENT_MASK & USE_GPIO1_EVENTS) | ||
49 | GPIO1_EVENT_FIRST = 32*GPIO1_NUM, | ||
50 | #endif | ||
51 | #if (GPIO_EVENT_MASK & USE_GPIO2_EVENTS) | ||
52 | GPIO2_EVENT_FIRST = 32*GPIO2_NUM, | ||
53 | #endif | ||
54 | #if (GPIO_EVENT_MASK & USE_GPIO3_EVENTS) | ||
55 | GPIO3_EVENT_FIRST = 32*GPIO3_NUM, | ||
56 | #endif | ||
57 | }; | ||
58 | |||
59 | #include "gpio-target.h" | ||
60 | |||
61 | /* Possible values for gpio interrupt line config */ | ||
62 | enum gpio_int_sense_enum | ||
63 | { | ||
64 | GPIO_SENSE_LOW_LEVEL = 0, /* High-level sensitive */ | ||
65 | GPIO_SENSE_HIGH_LEVEL, /* Low-level sensitive */ | ||
66 | GPIO_SENSE_RISING, /* Rising-edge sensitive */ | ||
67 | GPIO_SENSE_FALLING, /* Falling-edge sensitive */ | ||
68 | }; | ||
69 | |||
70 | #define GPIO_SENSE_CONFIG_MASK 0x3 | ||
71 | |||
72 | /* Register map for each module */ | ||
73 | struct gpio_map | ||
74 | { | ||
75 | volatile uint32_t dr; /* 00h */ | ||
76 | volatile uint32_t gdir; /* 04h */ | ||
77 | volatile uint32_t psr; /* 08h */ | ||
78 | union | ||
79 | { | ||
80 | struct | ||
81 | { | ||
82 | volatile uint32_t icr1; /* 0Ch */ | ||
83 | volatile uint32_t icr2; /* 10h */ | ||
84 | }; | ||
85 | volatile uint32_t icr[2]; /* 0Ch */ | ||
86 | }; | ||
87 | volatile uint32_t imr; /* 14h */ | ||
88 | volatile uint32_t isr; /* 18h */ | ||
89 | }; | ||
90 | |||
91 | /* Pending events will be called in array order which allows easy | ||
92 | * pioritization */ | ||
93 | |||
94 | /* Describes a single event for a pin */ | ||
95 | struct gpio_event | ||
96 | { | ||
97 | uint32_t mask; /* mask: 1 << (0...31) */ | ||
98 | enum gpio_int_sense_enum sense; /* Type of sense */ | ||
99 | void (*callback)(void); /* Callback function */ | ||
100 | }; | ||
101 | |||
102 | /* Describes the events attached to a port */ | ||
103 | struct gpio_event_list | ||
104 | { | ||
105 | int ints_priority; /* Interrupt priority for this GPIO */ | ||
106 | unsigned count; /* Count of events for the module */ | ||
107 | const struct gpio_event *events; /* List of events */ | ||
108 | }; | ||
109 | |||
110 | void gpio_init(void); | ||
111 | bool gpio_enable_event(enum gpio_event_ids id); | ||
112 | void gpio_disable_event(enum gpio_event_ids id); | ||
113 | |||
114 | #endif /* GPIO_IMX31_H */ | ||