summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx31/gpio-imx31.h
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2010-05-07 10:53:19 +0000
committerMichael Sevakis <jethead71@rockbox.org>2010-05-07 10:53:19 +0000
commitd7ef2474120f2a009af139754f6d387c8e83c949 (patch)
tree7b63172498900d1c63c238fd256e532b23dd411e /firmware/target/arm/imx31/gpio-imx31.h
parent235fc05e3be7508c310cfd2ff5151d30b78be971 (diff)
downloadrockbox-d7ef2474120f2a009af139754f6d387c8e83c949.tar.gz
rockbox-d7ef2474120f2a009af139754f6d387c8e83c949.zip
i.MX31/Gigabeat S minor cleaning: Make HW access more obvious in places I forgot to do earlier. Reduce the number of structs that need to be filled-out for some drivers just to simplify a little. Change some types.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25870 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx31/gpio-imx31.h')
-rw-r--r--firmware/target/arm/imx31/gpio-imx31.h55
1 files changed, 14 insertions, 41 deletions
diff --git a/firmware/target/arm/imx31/gpio-imx31.h b/firmware/target/arm/imx31/gpio-imx31.h
index 72956d4efa..a1358672e8 100644
--- a/firmware/target/arm/imx31/gpio-imx31.h
+++ b/firmware/target/arm/imx31/gpio-imx31.h
@@ -42,22 +42,6 @@ enum gpio_module_number
42 GPIO_NUM_GPIO, 42 GPIO_NUM_GPIO,
43}; 43};
44 44
45/* Module corresponding to the event ID is identified by range */
46enum 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 */ 45/* Possible values for gpio interrupt line config */
62enum gpio_int_sense_enum 46enum gpio_int_sense_enum
63{ 47{
@@ -69,44 +53,33 @@ enum gpio_int_sense_enum
69 53
70#define GPIO_SENSE_CONFIG_MASK 0x3 54#define GPIO_SENSE_CONFIG_MASK 0x3
71 55
72/* Register map for each module */
73struct 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 56/* Pending events will be called in array order which allows easy
92 * pioritization */ 57 * pioritization */
93 58
94/* Describes a single event for a pin */ 59/* Describes a single event for a pin */
95struct gpio_event 60struct gpio_event
96{ 61{
97 uint32_t mask; /* mask: 1 << (0...31) */ 62 unsigned long mask; /* mask: 1 << (0...31) */
98 enum gpio_int_sense_enum sense; /* Type of sense */ 63 enum gpio_int_sense_enum sense; /* Type of sense */
99 void (*callback)(void); /* Callback function */ 64 void (*callback)(void); /* Callback function */
100}; 65};
101 66
102/* Describes the events attached to a port */ 67/* Module corresponding to the event ID is identified by range */
103struct gpio_event_list 68enum gpio_event_bases
104{ 69{
105 int ints_priority; /* Interrupt priority for this GPIO */ 70#if (GPIO_EVENT_MASK & USE_GPIO1_EVENTS)
106 unsigned count; /* Count of events for the module */ 71 GPIO1_EVENT_FIRST = 32*GPIO1_NUM,
107 const struct gpio_event *events; /* List of events */ 72#endif
73#if (GPIO_EVENT_MASK & USE_GPIO2_EVENTS)
74 GPIO2_EVENT_FIRST = 32*GPIO2_NUM,
75#endif
76#if (GPIO_EVENT_MASK & USE_GPIO3_EVENTS)
77 GPIO3_EVENT_FIRST = 32*GPIO3_NUM,
78#endif
108}; 79};
109 80
81#include "gpio-target.h"
82
110void gpio_init(void); 83void gpio_init(void);
111bool gpio_enable_event(enum gpio_event_ids id); 84bool gpio_enable_event(enum gpio_event_ids id);
112void gpio_disable_event(enum gpio_event_ids id); 85void gpio_disable_event(enum gpio_event_ids id);