LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
am1808.h
Go to the documentation of this file.
1 /*
2  * LEGO® MINDSTORMS EV3
3  *
4  * Copyright (C) 2010-2013 The LEGO Group
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 
22 #ifndef AM1808_H_
23 #define AM1808_H_
24 
25 #ifndef PCASM
26 #include <mach/da8xx.h>
27 #else
28 #define __iomem
29 #endif
30 
31 enum
32 {
47 };
48 
49 
50 typedef struct
51 {
52  int Pin;
56 }
57 MRM;
58 
60 { // Pin MuxReg Mask Mode
61 
62  { GP0_1 , 1, 0xF0FFFFFF, 0x08000000 },
63  { GP0_2 , 1, 0xFF0FFFFF, 0x00800000 },
64  { GP0_3 , 1, 0xFFF0FFFF, 0x00080000 },
65  { GP0_4 , 1, 0xFFFF0FFF, 0x00008000 },
66  { GP0_5 , 1, 0xFFFFF0FF, 0x00000800 },
67  { GP0_6 , 1, 0xFFFFFF0F, 0x00000080 },
68  { GP0_7 , 1, 0xFFFFFFF0, 0x00000008 },
69 
70  { GP0_11, 0, 0xFFF0FFFF, 0x00080000 },
71  { GP0_12, 0, 0xFFFF0FFF, 0x00008000 },
72  { GP0_13, 0, 0xFFFFF0FF, 0x00000800 },
73  { GP0_14, 0, 0xFFFFFF0F, 0x00000080 },
74  { GP0_15, 0, 0xFFFFFFF0, 0x00000008 },
75 
76  { GP1_0 , 4, 0x0FFFFFFF, 0x80000000 },
77  { GP1_8 , 3, 0xFFFFFFF0, 0x00000004 },
78 
79  { GP1_9, 2, 0xF0FFFFFF, 0x04000000 },
80  { GP1_10, 2, 0xFF0FFFFF, 0x00400000 },
81  { GP1_11, 2, 0xFFF0FFFF, 0x00040000 },
82  { GP1_12, 2, 0xFFFF0FFF, 0x00004000 },
83  { GP1_13, 2, 0xFFFFF0FF, 0x00000400 },
84  { GP1_14, 2, 0xFFFFFF0F, 0x00000040 },
85  { GP1_15, 2, 0xFFFFFFF0, 0x00000008 },
86 
87  { GP2_0, 6, 0x0FFFFFFF, 0x80000000 },
88  { GP2_1, 6, 0xF0FFFFFF, 0x08000000 },
89  { GP2_2, 6, 0xFF0FFFFF, 0x00800000 },
90  { GP2_3, 6, 0xFFF0FFFF, 0x00080000 },
91  { GP2_4, 6, 0xFFFF0FFF, 0x00008000 },
92  { GP2_5, 6, 0xFFFFF0FF, 0x00000800 },
93  { GP2_6, 6, 0xFFFFFF0F, 0x00000080 },
94  { GP2_7, 6, 0xFFFFFFF0, 0x00000008 },
95 
96  { GP2_8, 5, 0x0FFFFFFF, 0x80000000 },
97  { GP2_9, 5, 0xF0FFFFFF, 0x08000000 },
98  { GP2_10, 5, 0xFF0FFFFF, 0x00800000 },
99  { GP2_11, 5, 0xFFF0FFFF, 0x00080000 },
100  { GP2_12, 5, 0xFFFF0FFF, 0x00008000 },
101  { GP2_13, 5, 0xFFFFF0FF, 0x00000800 },
102 
103  { GP3_0, 8, 0x0FFFFFFF, 0x80000000 },
104  { GP3_1 , 8, 0xF0FFFFFF, 0x08000000 },
105  { GP3_2, 8, 0xFF0FFFFF, 0x00800000 },
106  { GP3_3, 8, 0xFFF0FFFF, 0x00080000 },
107  { GP3_4, 8, 0xFFFF0FFF, 0x00008000 },
108  { GP3_5, 8, 0xFFFFF0FF, 0x00000800 },
109  { GP3_6, 8, 0xFFFFFF0F, 0x00000080 },
110  { GP3_7, 8, 0xFFFFFFF0, 0x00000008 },
111 
112  { GP3_8, 7, 0x0FFFFFFF, 0x80000000 },
113  { GP3_9, 7, 0xF0FFFFFF, 0x08000000 },
114  { GP3_10, 7, 0xFF0FFFFF, 0x00800000 },
115  { GP3_11, 7, 0xFFF0FFFF, 0x00080000 },
116  { GP3_12, 7, 0xFFFF0FFF, 0x00008000 },
117  { GP3_13, 7, 0xFFFFF0FF, 0x00000800 },
118  { GP3_14, 7, 0xFFFFFF0F, 0x00000080 },
119  { GP3_15, 7, 0xFFFFFFF0, 0x00000008 },
120 
121  { GP4_1, 10, 0xF0FFFFFF, 0x08000000 },
122 
123  { GP4_8, 9, 0x0FFFFFFF, 0x80000000 },
124  { GP4_9, 9, 0xF0FFFFFF, 0x08000000 },
125  { GP4_10, 9, 0xFF0FFFFF, 0x00800000 },
126 
127  { GP4_12, 9, 0xFFFF0FFF, 0x00008000 },
128 
129  { GP4_14, 9, 0xFFFFFF0F, 0x00000080 },
130 
131  { GP5_0, 12, 0x0FFFFFFF, 0x80000000 },
132  { GP5_1, 12, 0xF0FFFFFF, 0x08000000 },
133  { GP5_2, 12, 0xFF0FFFFF, 0x00800000 },
134  { GP5_3, 12, 0xFFF0FFFF, 0x00080000 },
135  { GP5_4, 12, 0xFFFF0FFF, 0x00008000 },
136  { GP5_5, 12, 0xFFFFF0FF, 0x00000800 },
137  { GP5_6, 12, 0xFFFFFF0F, 0x00000080 },
138  { GP5_7, 12, 0xFFFFFFF0, 0x00000008 },
139 
140  { GP5_8, 11, 0x0FFFFFFF, 0x80000000 },
141  { GP5_9, 11, 0xF0FFFFFF, 0x08000000 },
142  { GP5_10, 11, 0xFF0FFFFF, 0x00800000 },
143  { GP5_11, 11, 0xFFF0FFFF, 0x00080000 },
144  { GP5_12, 11, 0xFFFF0FFF, 0x00008000 },
145  { GP5_13, 11, 0xFFFFF0FF, 0x00000800 },
146  { GP5_14, 11, 0xFFFFFF0F, 0x00000080 },
147  { GP5_15, 11, 0xFFFFFFF0, 0x00000008 },
148 
149  { GP6_0 , 19, 0xF0FFFFFF, 0x08000000 },
150  { GP6_1, 19, 0xFF0FFFFF, 0x00800000 },
151  { GP6_2, 19, 0xFFF0FFFF, 0x00080000 },
152  { GP6_3, 19, 0xFFFF0FFF, 0x00008000 },
153  { GP6_4, 19, 0xFFFFF0FF, 0x00000800 },
154  { GP6_5, 16, 0xFFFFFF0F, 0x00000080 },
155 
156  { GP6_6, 14, 0xFFFFFF0F, 0x00000080 },
157  { GP6_7, 14, 0xFFFFFFF0, 0x00000008 },
158 
159  { GP6_8, 13, 0x0FFFFFFF, 0x80000000 },
160  { GP6_9, 13, 0xF0FFFFFF, 0x08000000 },
161  { GP6_10, 13, 0xFF0FFFFF, 0x00800000 },
162  { GP6_11, 13, 0xFFF0FFFF, 0x00080000 },
163  { GP6_12, 13, 0xFFFF0FFF, 0x00008000 },
164  { GP6_13, 13, 0xFFFFF0FF, 0x00000800 },
165  { GP6_14, 13, 0xFFFFFF0F, 0x00000080 },
166  { GP6_15, 13, 0xFFFFFFF0, 0x00000008 },
167 
168  { GP7_4, 17, 0xFF0FFFFF, 0x00800000 },
169  { GP7_8, 17, 0xFFFFFF0F, 0x00000080 },
170  { GP7_9, 17, 0xFFFFFFF0, 0x00000008 },
171  { GP7_10, 16, 0x0FFFFFFF, 0x80000000 },
172  { GP7_11, 16, 0xF0FFFFFF, 0x08000000 },
173  { GP7_12, 16, 0xFF0FFFFF, 0x00800000 },
174  { GP7_13, 16, 0xFFF0FFFF, 0x00080000 },
175  { GP7_14, 16, 0xFFFF0FFF, 0x00008000 },
176  { GP7_15, 16, 0xFFFFF0FF, 0x00000800 },
177 
178  { GP8_2 , 3 , 0xF0FFFFFF, 0x04000000 },
179  { GP8_3 , 3 , 0xFF0FFFFF, 0x00400000 },
180  { GP8_5 , 3 , 0xFFFF0FFF, 0x00004000 },
181  { GP8_6 , 3 , 0xFFFFF0FF, 0x00000400 },
182  { GP8_8 , 19, 0xFFFFFF0F, 0x00000080 },
183  { GP8_9 , 19, 0xFFFFFFF0, 0x00000008 },
184  { GP8_10, 18, 0x0FFFFFFF, 0x80000000 },
185  { GP8_11, 18, 0xF0FFFFFF, 0x08000000 },
186  { GP8_12, 18, 0xFF0FFFFF, 0x00800000 },
187  { GP8_13, 18, 0xFFF0FFFF, 0x00080000 },
188  { GP8_14, 18, 0xFFFF0FFF, 0x00008000 },
189  { GP8_15, 18, 0xFFFFF0FF, 0x00000800 },
190 
191 
192  { UART0_TXD, 3, 0xFF0FFFFF, 0x00200000 },
193  { UART0_RXD, 3, 0xFFF0FFFF, 0x00020000 },
194 
195  { UART1_TXD, 4, 0x0FFFFFFF, 0x20000000 },
196  { UART1_RXD, 4, 0xF0FFFFFF, 0x02000000 },
197 
198  { SPI0_MOSI, 3, 0xFFFF0FFF, 0x00001000 },
199  { SPI0_MISO, 3, 0xFFFFF0FF, 0x00000100 },
200  { SPI0_SCL, 3, 0xFFFFFFF0, 0x00000001 },
201  { SPI0_CS, 3, 0xF0FFFFFF, 0x01000000 },
202 
203  { SPI1_MOSI, 5, 0xFF0FFFFF, 0x00100000 },
204  { SPI1_MISO, 5, 0xFFF0FFFF, 0x00010000 },
205  { SPI1_SCL, 5, 0xFFFFF0FF, 0x00000100 },
206  { SPI1_CS, 5, 0xFFFF0FFF, 0x00008000 },
207 
208  { EPWM1A, 5, 0xFFFFFFF0, 0x00000002 },
209  { EPWM1B, 5, 0xFFFFFF0F, 0x00000020 },
210  { APWM0, 2, 0x0FFFFFFF, 0x20000000 },
211  { APWM1, 1, 0x0FFFFFFF, 0x40000000 },
212  { EPWM0B, 3, 0xFFFFFF0F, 0x00000020 },
213 
214  { AXR3, 2, 0xFFF0FFFF, 0x00010000 },
215  { AXR4, 2, 0xFFFF0FFF, 0x00001000 },
216 
217  {-1 }
218 };
219 
220 typedef struct gpio_controller *__iomem GPIOC;
221 
222 typedef struct
223 {
224  int Pin; // GPIO pin number
225  GPIOC pGpio; // GPIO bank base address
226  u32 Mask; // GPIO pin mask
227 }
228 INPIN;
229 
230 #define REGUnlock {\
231  iowrite32(0x83E70B13,da8xx_syscfg0_base + 0x38);\
232  iowrite32(0x95A4F1E0,da8xx_syscfg0_base + 0x3C);\
233  }
234 
235 #define REGLock {\
236  iowrite32(0x00000000,da8xx_syscfg0_base + 0x38);\
237  iowrite32(0x00000000,da8xx_syscfg0_base + 0x3C);\
238  }
239 
240 
241 
242 
243 #else
244 
245 extern MRM MuxRegMap[];
246 
247 #endif /* AM1808_H_ */
248 
249 
Definition: am1808.h:35
Definition: am1808.h:35
Definition: am1808.h:41
Definition: am1808.h:38
Definition: am1808.h:34
Definition: am1808.h:37
Definition: am1808.h:34
Definition: am1808.h:35
Definition: am1808.h:33
Definition: am1808.h:46
Definition: am1808.h:37
Definition: am1808.h:35
Definition: am1808.h:39
Definition: am1808.h:37
Definition: am1808.h:38
Definition: am1808.h:37
Definition: am1808.h:33
Definition: am1808.h:35
Definition: am1808.h:35
MRM MuxRegMap[]
Definition: am1808.h:59
Definition: am1808.h:33
GPIOC pGpio
Definition: am1808.h:225
Definition: am1808.h:39
Definition: am1808.h:33
Definition: am1808.h:33
Definition: am1808.h:41
Definition: am1808.h:41
Definition: am1808.h:222
Definition: am1808.h:41
Definition: am1808.h:40
Definition: am1808.h:40
Definition: am1808.h:35
Definition: am1808.h:39
Definition: am1808.h:33
Definition: am1808.h:40
Definition: am1808.h:46
Definition: am1808.h:39
Definition: am1808.h:40
Definition: am1808.h:41
Definition: am1808.h:36
Definition: am1808.h:39
Definition: am1808.h:37
Definition: am1808.h:35
Definition: am1808.h:41
Definition: am1808.h:38
Definition: am1808.h:33
Definition: am1808.h:40
Definition: am1808.h:34
Definition: am1808.h:37
Definition: am1808.h:36
Definition: am1808.h:46
u16 MuxReg
Definition: am1808.h:53
Definition: am1808.h:37
Definition: am1808.h:37
Definition: am1808.h:38
Definition: am1808.h:37
Definition: am1808.h:38
Definition: am1808.h:46
Definition: am1808.h:33
Definition: am1808.h:35
Definition: am1808.h:36
Definition: am1808.h:39
Definition: am1808.h:38
Definition: am1808.h:38
Definition: am1808.h:40
Definition: am1808.h:38
Definition: am1808.h:34
Definition: am1808.h:34
Definition: am1808.h:46
Definition: am1808.h:34
Definition: am1808.h:40
Definition: am1808.h:37
Definition: am1808.h:35
Definition: am1808.h:36
Definition: am1808.h:34
Definition: am1808.h:37
Definition: am1808.h:41
Definition: am1808.h:34
struct gpio_controller *__iomem GPIOC
Definition: am1808.h:220
Definition: am1808.h:36
int Pin
Definition: am1808.h:224
Definition: am1808.h:39
Definition: am1808.h:41
Definition: am1808.h:38
Definition: am1808.h:40
Definition: am1808.h:34
Definition: am1808.h:40
uint16_t u16
Definition: common.h:159
Definition: am1808.h:36
Definition: am1808.h:41
Definition: am1808.h:50
Definition: am1808.h:40
Definition: am1808.h:37
Definition: am1808.h:39
Definition: am1808.h:34
Definition: am1808.h:40
Definition: am1808.h:39
Definition: am1808.h:33
Definition: am1808.h:36
Definition: am1808.h:33
Definition: am1808.h:36
Definition: am1808.h:36
Definition: am1808.h:40
Definition: am1808.h:40
Definition: am1808.h:35
Definition: am1808.h:36
Definition: am1808.h:41
Definition: am1808.h:41
Definition: am1808.h:39
Definition: am1808.h:33
Definition: am1808.h:38
u32 Mask
Definition: am1808.h:226
Definition: am1808.h:39
Definition: am1808.h:37
Definition: am1808.h:38
Definition: am1808.h:36
Definition: am1808.h:41
Definition: am1808.h:38
Definition: am1808.h:34
Definition: am1808.h:34
Definition: am1808.h:36
Definition: am1808.h:41
Definition: am1808.h:37
Definition: am1808.h:34
int Pin
Definition: am1808.h:52
Definition: am1808.h:39
Definition: am1808.h:41
Definition: am1808.h:36
u32 Mask
Definition: am1808.h:54
Definition: am1808.h:35
Definition: am1808.h:39
Definition: am1808.h:39
Definition: am1808.h:39
Definition: am1808.h:38
Definition: am1808.h:38
Definition: am1808.h:37
Definition: am1808.h:33
Definition: am1808.h:33
Definition: am1808.h:33
Definition: am1808.h:34
Definition: am1808.h:38
uint32_t u32
Definition: common.h:158
Definition: am1808.h:44
Definition: am1808.h:36
Definition: am1808.h:39
Definition: am1808.h:40
Definition: am1808.h:40
Definition: am1808.h:35
Definition: am1808.h:37
Definition: am1808.h:46
Definition: am1808.h:35
Definition: am1808.h:35
Definition: am1808.h:41
Definition: am1808.h:41
Definition: am1808.h:35
Definition: am1808.h:40
Definition: am1808.h:36
Definition: am1808.h:33
Definition: am1808.h:46
Definition: am1808.h:45
Definition: am1808.h:33
u32 Mode
Definition: am1808.h:55
Definition: am1808.h:36
Definition: am1808.h:34
Definition: am1808.h:38
Definition: am1808.h:34