libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
sgpio.h
Go to the documentation of this file.
1/** @defgroup sgpio_defines Serial General Purpose I/O
2
3@brief <b>Defined Constants and Types for the LPC43xx Serial General Purpose
4I/O</b>
5
6@ingroup LPC43xx_defines
7
8@version 1.0.0
9
10@author @htmlonly &copy; @endhtmlonly 2012 Michael Ossmann <mike@ossmann.com>
11
12@date 10 March 2013
13
14LGPL License Terms @ref lgpl_license
15 */
16/** @defgroup sdio_defines SDIO
17
18@brief <b>Defined Constants and Types for the LPC43xx SDIO</b>
19
20@ingroup LPC43xx_defines
21
22@version 1.0.0
23
24@author @htmlonly &copy; @endhtmlonly 2012 Michael Ossmann <mike@ossmann.com>
25
26@date 10 March 2013
27
28LGPL License Terms @ref lgpl_license
29 */
30/*
31 * This file is part of the libopencm3 project.
32 *
33 * Copyright (C) 2012 Michael Ossmann <mike@ossmann.com>
34 * Copyright (C) 2012 Jared Boone <jared@sharebrained.com>
35 * Copyright (C) 2012 Benjamin Vernoux <titanmkd@gmail.com>
36 *
37 * This library is free software: you can redistribute it and/or modify
38 * it under the terms of the GNU Lesser General Public License as published by
39 * the Free Software Foundation, either version 3 of the License, or
40 * (at your option) any later version.
41 *
42 * This library is distributed in the hope that it will be useful,
43 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 * GNU Lesser General Public License for more details.
46 *
47 * You should have received a copy of the GNU Lesser General Public License
48 * along with this library. If not, see <http://www.gnu.org/licenses/>.
49 */
50
51#ifndef LPC43XX_SGPIO_H
52#define LPC43XX_SGPIO_H
53
54/**@{*/
55
58
59/* --- SGPIO registers ----------------------------------------------------- */
60
61/* Pin multiplexer configuration registers (OUT_MUX_CFG0 to 15) */
62#define SGPIO_OUT_MUX_CFG(pin) MMIO32(SGPIO_PORT_BASE + (pin * 0x04))
63#define SGPIO_OUT_MUX_CFG0 MMIO32(SGPIO_PORT_BASE + 0x00)
64#define SGPIO_OUT_MUX_CFG1 MMIO32(SGPIO_PORT_BASE + 0x04)
65#define SGPIO_OUT_MUX_CFG2 MMIO32(SGPIO_PORT_BASE + 0x08)
66#define SGPIO_OUT_MUX_CFG3 MMIO32(SGPIO_PORT_BASE + 0x0C)
67#define SGPIO_OUT_MUX_CFG4 MMIO32(SGPIO_PORT_BASE + 0x10)
68#define SGPIO_OUT_MUX_CFG5 MMIO32(SGPIO_PORT_BASE + 0x14)
69#define SGPIO_OUT_MUX_CFG6 MMIO32(SGPIO_PORT_BASE + 0x18)
70#define SGPIO_OUT_MUX_CFG7 MMIO32(SGPIO_PORT_BASE + 0x1C)
71#define SGPIO_OUT_MUX_CFG8 MMIO32(SGPIO_PORT_BASE + 0x20)
72#define SGPIO_OUT_MUX_CFG9 MMIO32(SGPIO_PORT_BASE + 0x24)
73#define SGPIO_OUT_MUX_CFG10 MMIO32(SGPIO_PORT_BASE + 0x28)
74#define SGPIO_OUT_MUX_CFG11 MMIO32(SGPIO_PORT_BASE + 0x2C)
75#define SGPIO_OUT_MUX_CFG12 MMIO32(SGPIO_PORT_BASE + 0x30)
76#define SGPIO_OUT_MUX_CFG13 MMIO32(SGPIO_PORT_BASE + 0x34)
77#define SGPIO_OUT_MUX_CFG14 MMIO32(SGPIO_PORT_BASE + 0x38)
78#define SGPIO_OUT_MUX_CFG15 MMIO32(SGPIO_PORT_BASE + 0x3C)
79
80/* SGPIO multiplexer configuration registers (SGPIO_MUX_CFG0 to 15) */
81#define SGPIO_MUX_CFG(slice) MMIO32(SGPIO_PORT_BASE + 0x40 + \
82 (slice * 0x04))
83#define SGPIO_MUX_CFG0 MMIO32(SGPIO_PORT_BASE + 0x40)
84#define SGPIO_MUX_CFG1 MMIO32(SGPIO_PORT_BASE + 0x44)
85#define SGPIO_MUX_CFG2 MMIO32(SGPIO_PORT_BASE + 0x48)
86#define SGPIO_MUX_CFG3 MMIO32(SGPIO_PORT_BASE + 0x4C)
87#define SGPIO_MUX_CFG4 MMIO32(SGPIO_PORT_BASE + 0x50)
88#define SGPIO_MUX_CFG5 MMIO32(SGPIO_PORT_BASE + 0x54)
89#define SGPIO_MUX_CFG6 MMIO32(SGPIO_PORT_BASE + 0x58)
90#define SGPIO_MUX_CFG7 MMIO32(SGPIO_PORT_BASE + 0x5C)
91#define SGPIO_MUX_CFG8 MMIO32(SGPIO_PORT_BASE + 0x60)
92#define SGPIO_MUX_CFG9 MMIO32(SGPIO_PORT_BASE + 0x64)
93#define SGPIO_MUX_CFG10 MMIO32(SGPIO_PORT_BASE + 0x68)
94#define SGPIO_MUX_CFG11 MMIO32(SGPIO_PORT_BASE + 0x6C)
95#define SGPIO_MUX_CFG12 MMIO32(SGPIO_PORT_BASE + 0x70)
96#define SGPIO_MUX_CFG13 MMIO32(SGPIO_PORT_BASE + 0x74)
97#define SGPIO_MUX_CFG14 MMIO32(SGPIO_PORT_BASE + 0x78)
98#define SGPIO_MUX_CFG15 MMIO32(SGPIO_PORT_BASE + 0x7C)
99
100/* Slice multiplexer configuration registers (SLICE_MUX_CFG0 to 15) */
101#define SGPIO_SLICE_MUX_CFG(slice) MMIO32(SGPIO_PORT_BASE + 0x80 + \
102 (slice * 0x04))
103#define SGPIO_SLICE_MUX_CFG0 MMIO32(SGPIO_PORT_BASE + 0x80)
104#define SGPIO_SLICE_MUX_CFG1 MMIO32(SGPIO_PORT_BASE + 0x84)
105#define SGPIO_SLICE_MUX_CFG2 MMIO32(SGPIO_PORT_BASE + 0x88)
106#define SGPIO_SLICE_MUX_CFG3 MMIO32(SGPIO_PORT_BASE + 0x8C)
107#define SGPIO_SLICE_MUX_CFG4 MMIO32(SGPIO_PORT_BASE + 0x90)
108#define SGPIO_SLICE_MUX_CFG5 MMIO32(SGPIO_PORT_BASE + 0x94)
109#define SGPIO_SLICE_MUX_CFG6 MMIO32(SGPIO_PORT_BASE + 0x98)
110#define SGPIO_SLICE_MUX_CFG7 MMIO32(SGPIO_PORT_BASE + 0x9C)
111#define SGPIO_SLICE_MUX_CFG8 MMIO32(SGPIO_PORT_BASE + 0xA0)
112#define SGPIO_SLICE_MUX_CFG9 MMIO32(SGPIO_PORT_BASE + 0xA4)
113#define SGPIO_SLICE_MUX_CFG10 MMIO32(SGPIO_PORT_BASE + 0xA8)
114#define SGPIO_SLICE_MUX_CFG11 MMIO32(SGPIO_PORT_BASE + 0xAC)
115#define SGPIO_SLICE_MUX_CFG12 MMIO32(SGPIO_PORT_BASE + 0xB0)
116#define SGPIO_SLICE_MUX_CFG13 MMIO32(SGPIO_PORT_BASE + 0xB4)
117#define SGPIO_SLICE_MUX_CFG14 MMIO32(SGPIO_PORT_BASE + 0xB8)
118#define SGPIO_SLICE_MUX_CFG15 MMIO32(SGPIO_PORT_BASE + 0xBC)
119
120/* Slice data registers (REG0 to 15) */
121#define SGPIO_REG(slice) MMIO32(SGPIO_PORT_BASE + 0xC0 + \
122 (slice * 0x04))
123#define SGPIO_REG0 MMIO32(SGPIO_PORT_BASE + 0xC0)
124#define SGPIO_REG1 MMIO32(SGPIO_PORT_BASE + 0xC4)
125#define SGPIO_REG2 MMIO32(SGPIO_PORT_BASE + 0xC8)
126#define SGPIO_REG3 MMIO32(SGPIO_PORT_BASE + 0xCC)
127#define SGPIO_REG4 MMIO32(SGPIO_PORT_BASE + 0xD0)
128#define SGPIO_REG5 MMIO32(SGPIO_PORT_BASE + 0xD4)
129#define SGPIO_REG6 MMIO32(SGPIO_PORT_BASE + 0xD8)
130#define SGPIO_REG7 MMIO32(SGPIO_PORT_BASE + 0xDC)
131#define SGPIO_REG8 MMIO32(SGPIO_PORT_BASE + 0xE0)
132#define SGPIO_REG9 MMIO32(SGPIO_PORT_BASE + 0xE4)
133#define SGPIO_REG10 MMIO32(SGPIO_PORT_BASE + 0xE8)
134#define SGPIO_REG11 MMIO32(SGPIO_PORT_BASE + 0xEC)
135#define SGPIO_REG12 MMIO32(SGPIO_PORT_BASE + 0xF0)
136#define SGPIO_REG13 MMIO32(SGPIO_PORT_BASE + 0xF4)
137#define SGPIO_REG14 MMIO32(SGPIO_PORT_BASE + 0xF8)
138#define SGPIO_REG15 MMIO32(SGPIO_PORT_BASE + 0xFC)
139
140/* Slice data shadow registers (REG_SS0 to 15) */
141#define SGPIO_REG_SS(slice) MMIO32(SGPIO_PORT_BASE + 0x100 + \
142 (slice * 0x04))
143#define SGPIO_REG_SS0 MMIO32(SGPIO_PORT_BASE + 0x100)
144#define SGPIO_REG_SS1 MMIO32(SGPIO_PORT_BASE + 0x104)
145#define SGPIO_REG_SS2 MMIO32(SGPIO_PORT_BASE + 0x108)
146#define SGPIO_REG_SS3 MMIO32(SGPIO_PORT_BASE + 0x10C)
147#define SGPIO_REG_SS4 MMIO32(SGPIO_PORT_BASE + 0x110)
148#define SGPIO_REG_SS5 MMIO32(SGPIO_PORT_BASE + 0x114)
149#define SGPIO_REG_SS6 MMIO32(SGPIO_PORT_BASE + 0x118)
150#define SGPIO_REG_SS7 MMIO32(SGPIO_PORT_BASE + 0x11C)
151#define SGPIO_REG_SS8 MMIO32(SGPIO_PORT_BASE + 0x120)
152#define SGPIO_REG_SS9 MMIO32(SGPIO_PORT_BASE + 0x124)
153#define SGPIO_REG_SS10 MMIO32(SGPIO_PORT_BASE + 0x128)
154#define SGPIO_REG_SS11 MMIO32(SGPIO_PORT_BASE + 0x12C)
155#define SGPIO_REG_SS12 MMIO32(SGPIO_PORT_BASE + 0x130)
156#define SGPIO_REG_SS13 MMIO32(SGPIO_PORT_BASE + 0x134)
157#define SGPIO_REG_SS14 MMIO32(SGPIO_PORT_BASE + 0x138)
158#define SGPIO_REG_SS15 MMIO32(SGPIO_PORT_BASE + 0x13C)
159
160/* Reload registers (PRESET0 to 15) */
161#define SGPIO_PRESET(slice) MMIO32(SGPIO_PORT_BASE + 0x140 + \
162 (slice * 0x04))
163#define SGPIO_PRESET0 MMIO32(SGPIO_PORT_BASE + 0x140)
164#define SGPIO_PRESET1 MMIO32(SGPIO_PORT_BASE + 0x144)
165#define SGPIO_PRESET2 MMIO32(SGPIO_PORT_BASE + 0x148)
166#define SGPIO_PRESET3 MMIO32(SGPIO_PORT_BASE + 0x14C)
167#define SGPIO_PRESET4 MMIO32(SGPIO_PORT_BASE + 0x150)
168#define SGPIO_PRESET5 MMIO32(SGPIO_PORT_BASE + 0x154)
169#define SGPIO_PRESET6 MMIO32(SGPIO_PORT_BASE + 0x158)
170#define SGPIO_PRESET7 MMIO32(SGPIO_PORT_BASE + 0x15C)
171#define SGPIO_PRESET8 MMIO32(SGPIO_PORT_BASE + 0x160)
172#define SGPIO_PRESET9 MMIO32(SGPIO_PORT_BASE + 0x164)
173#define SGPIO_PRESET10 MMIO32(SGPIO_PORT_BASE + 0x168)
174#define SGPIO_PRESET11 MMIO32(SGPIO_PORT_BASE + 0x16C)
175#define SGPIO_PRESET12 MMIO32(SGPIO_PORT_BASE + 0x170)
176#define SGPIO_PRESET13 MMIO32(SGPIO_PORT_BASE + 0x174)
177#define SGPIO_PRESET14 MMIO32(SGPIO_PORT_BASE + 0x178)
178#define SGPIO_PRESET15 MMIO32(SGPIO_PORT_BASE + 0x17C)
179
180/* Down counter registers (COUNT0 to 15) */
181#define SGPIO_COUNT(slice) MMIO32(SGPIO_PORT_BASE + 0x180 + \
182 (slice * 0x04))
183#define SGPIO_COUNT0 MMIO32(SGPIO_PORT_BASE + 0x180)
184#define SGPIO_COUNT1 MMIO32(SGPIO_PORT_BASE + 0x184)
185#define SGPIO_COUNT2 MMIO32(SGPIO_PORT_BASE + 0x188)
186#define SGPIO_COUNT3 MMIO32(SGPIO_PORT_BASE + 0x18C)
187#define SGPIO_COUNT4 MMIO32(SGPIO_PORT_BASE + 0x190)
188#define SGPIO_COUNT5 MMIO32(SGPIO_PORT_BASE + 0x194)
189#define SGPIO_COUNT6 MMIO32(SGPIO_PORT_BASE + 0x198)
190#define SGPIO_COUNT7 MMIO32(SGPIO_PORT_BASE + 0x19C)
191#define SGPIO_COUNT8 MMIO32(SGPIO_PORT_BASE + 0x1A0)
192#define SGPIO_COUNT9 MMIO32(SGPIO_PORT_BASE + 0x1A4)
193#define SGPIO_COUNT10 MMIO32(SGPIO_PORT_BASE + 0x1A8)
194#define SGPIO_COUNT11 MMIO32(SGPIO_PORT_BASE + 0x1AC)
195#define SGPIO_COUNT12 MMIO32(SGPIO_PORT_BASE + 0x1B0)
196#define SGPIO_COUNT13 MMIO32(SGPIO_PORT_BASE + 0x1B4)
197#define SGPIO_COUNT14 MMIO32(SGPIO_PORT_BASE + 0x1B8)
198#define SGPIO_COUNT15 MMIO32(SGPIO_PORT_BASE + 0x1BC)
199
200/* Position registers (POS0 to 15) */
201#define SGPIO_POS(slice) MMIO32(SGPIO_PORT_BASE + 0x1C0 + \
202 (slice * 0x04))
203#define SGPIO_POS0 MMIO32(SGPIO_PORT_BASE + 0x1C0)
204#define SGPIO_POS1 MMIO32(SGPIO_PORT_BASE + 0x1C4)
205#define SGPIO_POS2 MMIO32(SGPIO_PORT_BASE + 0x1C8)
206#define SGPIO_POS3 MMIO32(SGPIO_PORT_BASE + 0x1CC)
207#define SGPIO_POS4 MMIO32(SGPIO_PORT_BASE + 0x1D0)
208#define SGPIO_POS5 MMIO32(SGPIO_PORT_BASE + 0x1D4)
209#define SGPIO_POS6 MMIO32(SGPIO_PORT_BASE + 0x1D8)
210#define SGPIO_POS7 MMIO32(SGPIO_PORT_BASE + 0x1DC)
211#define SGPIO_POS8 MMIO32(SGPIO_PORT_BASE + 0x1E0)
212#define SGPIO_POS9 MMIO32(SGPIO_PORT_BASE + 0x1E4)
213#define SGPIO_POS10 MMIO32(SGPIO_PORT_BASE + 0x1E8)
214#define SGPIO_POS11 MMIO32(SGPIO_PORT_BASE + 0x1EC)
215#define SGPIO_POS12 MMIO32(SGPIO_PORT_BASE + 0x1F0)
216#define SGPIO_POS13 MMIO32(SGPIO_PORT_BASE + 0x1F4)
217#define SGPIO_POS14 MMIO32(SGPIO_PORT_BASE + 0x1F8)
218#define SGPIO_POS15 MMIO32(SGPIO_PORT_BASE + 0x1FC)
219
220/* Slice name to slice index mapping */
221#define SGPIO_SLICE_A 0
222#define SGPIO_SLICE_B 1
223#define SGPIO_SLICE_C 2
224#define SGPIO_SLICE_D 3
225#define SGPIO_SLICE_E 4
226#define SGPIO_SLICE_F 5
227#define SGPIO_SLICE_G 6
228#define SGPIO_SLICE_H 7
229#define SGPIO_SLICE_I 8
230#define SGPIO_SLICE_J 9
231#define SGPIO_SLICE_K 10
232#define SGPIO_SLICE_L 11
233#define SGPIO_SLICE_M 12
234#define SGPIO_SLICE_N 13
235#define SGPIO_SLICE_O 14
236#define SGPIO_SLICE_P 15
237
238/* Mask for pattern match function of slice A */
239#define SGPIO_MASK_A MMIO32(SGPIO_PORT_BASE + 0x200)
240
241/* Mask for pattern match function of slice H */
242#define SGPIO_MASK_H MMIO32(SGPIO_PORT_BASE + 0x204)
243
244/* Mask for pattern match function of slice I */
245#define SGPIO_MASK_I MMIO32(SGPIO_PORT_BASE + 0x208)
246
247/* Mask for pattern match function of slice P */
248#define SGPIO_MASK_P MMIO32(SGPIO_PORT_BASE + 0x20C)
249
250/* GPIO input status register */
251#define SGPIO_GPIO_INREG MMIO32(SGPIO_PORT_BASE + 0x210)
252
253/* GPIO output control register */
254#define SGPIO_GPIO_OUTREG MMIO32(SGPIO_PORT_BASE + 0x214)
255
256/* GPIO OE control register */
257#define SGPIO_GPIO_OENREG MMIO32(SGPIO_PORT_BASE + 0x218)
258
259/* Enables the slice COUNT counter */
260#define SGPIO_CTRL_ENABLE MMIO32(SGPIO_PORT_BASE + 0x21C)
261
262/* Disables the slice COUNT counter */
263#define SGPIO_CTRL_DISABLE MMIO32(SGPIO_PORT_BASE + 0x220)
264
265/* Shift clock interrupt clear mask */
266#define SGPIO_CLR_EN_0 MMIO32(SGPIO_PORT_BASE + 0xF00)
267
268/* Shift clock interrupt set mask */
269#define SGPIO_SET_EN_0 MMIO32(SGPIO_PORT_BASE + 0xF04)
270
271/* Shift clock interrupt enable */
272#define SGPIO_ENABLE_0 MMIO32(SGPIO_PORT_BASE + 0xF08)
273
274/* Shift clock interrupt status */
275#define SGPIO_STATUS_0 MMIO32(SGPIO_PORT_BASE + 0xF0C)
276
277/* Shift clock interrupt clear status */
278#define SGPIO_CLR_STATUS_0 MMIO32(SGPIO_PORT_BASE + 0xF10)
279
280/* Shift clock interrupt set status */
281#define SGPIO_SET_STATUS_0 MMIO32(SGPIO_PORT_BASE + 0xF14)
282
283/* Exchange clock interrupt clear mask */
284#define SGPIO_CLR_EN_1 MMIO32(SGPIO_PORT_BASE + 0xF20)
285
286/* Exchange clock interrupt set mask */
287#define SGPIO_SET_EN_1 MMIO32(SGPIO_PORT_BASE + 0xF24)
288
289/* Exchange clock interrupt enable */
290#define SGPIO_ENABLE_1 MMIO32(SGPIO_PORT_BASE + 0xF28)
291
292/* Exchange clock interrupt status */
293#define SGPIO_STATUS_1 MMIO32(SGPIO_PORT_BASE + 0xF2C)
294
295/* Exchange clock interrupt clear status */
296#define SGPIO_CLR_STATUS_1 MMIO32(SGPIO_PORT_BASE + 0xF30)
297
298/* Exchange clock interrupt set status */
299#define SGPIO_SET_STATUS_1 MMIO32(SGPIO_PORT_BASE + 0xF34)
300
301/* Pattern match interrupt clear mask */
302#define SGPIO_CLR_EN_2 MMIO32(SGPIO_PORT_BASE + 0xF40)
303
304/* Pattern match interrupt set mask */
305#define SGPIO_SET_EN_2 MMIO32(SGPIO_PORT_BASE + 0xF44)
306
307/* Pattern match interrupt enable */
308#define SGPIO_ENABLE_2 MMIO32(SGPIO_PORT_BASE + 0xF48)
309
310/* Pattern match interrupt status */
311#define SGPIO_STATUS_2 MMIO32(SGPIO_PORT_BASE + 0xF4C)
312
313/* Pattern match interrupt clear status */
314#define SGPIO_CLR_STATUS_2 MMIO32(SGPIO_PORT_BASE + 0xF50)
315
316/* Pattern match interrupt set status */
317#define SGPIO_SET_STATUS_2 MMIO32(SGPIO_PORT_BASE + 0xF54)
318
319/* Input interrupt clear mask */
320#define SGPIO_CLR_EN_3 MMIO32(SGPIO_PORT_BASE + 0xF60)
321
322/* Input bit match interrupt set mask */
323#define SGPIO_SET_EN_3 MMIO32(SGPIO_PORT_BASE + 0xF64)
324
325/* Input bit match interrupt enable */
326#define SGPIO_ENABLE_3 MMIO32(SGPIO_PORT_BASE + 0xF68)
327
328/* Input bit match interrupt status */
329#define SGPIO_STATUS_3 MMIO32(SGPIO_PORT_BASE + 0xF6C)
330
331/* Input bit match interrupt clear status */
332#define SGPIO_CLR_STATUS_3 MMIO32(SGPIO_PORT_BASE + 0xF70)
333
334/* Input bit match interrupt set status */
335#define SGPIO_SET_STATUS_3 MMIO32(SGPIO_PORT_BASE + 0xF74)
336
337/* --- Common register fields ----------------------------------- */
338/* TODO: Generate this stuff with the gen.py script as well! */
339
340#define SGPIO_OUT_MUX_CFG_P_OUT_CFG_SHIFT (0)
341#define SGPIO_OUT_MUX_CFG_P_OUT_CFG_MASK \
342 (0xf << SGPIO_OUT_MUX_CFG_P_OUT_CFG_SHIFT)
343#define SGPIO_OUT_MUX_CFG_P_OUT_CFG(x) \
344 ((x) << SGPIO_OUT_MUX_CFG_P_OUT_CFG_SHIFT)
345
346#define SGPIO_OUT_MUX_CFG_P_OE_CFG_SHIFT (4)
347#define SGPIO_OUT_MUX_CFG_P_OE_CFG_MASK \
348 (0x7 << SGPIO_OUT_MUX_CFG_P_OE_CFG_SHIFT)
349#define SGPIO_OUT_MUX_CFG_P_OE_CFG(x) \
350 ((x) << SGPIO_OUT_MUX_CFG_P_OE_CFG_SHIFT)
351
352#define SGPIO_MUX_CFG_EXT_CLK_ENABLE_SHIFT (0)
353#define SGPIO_MUX_CFG_EXT_CLK_ENABLE_MASK \
354 (1 << SGPIO_MUX_CFG_EXT_CLK_ENABLE_SHIFT)
355#define SGPIO_MUX_CFG_EXT_CLK_ENABLE(x) \
356 ((x) << SGPIO_MUX_CFG_EXT_CLK_ENABLE_SHIFT)
357
358#define SGPIO_MUX_CFG_CLK_SOURCE_PIN_MODE_SHIFT (1)
359#define SGPIO_MUX_CFG_CLK_SOURCE_PIN_MODE_MASK \
360 (0x3 << SGPIO_MUX_CFG_CLK_SOURCE_PIN_MODE_SHIFT)
361#define SGPIO_MUX_CFG_CLK_SOURCE_PIN_MODE(x) \
362 ((x) << SGPIO_MUX_CFG_CLK_SOURCE_PIN_MODE_SHIFT)
363
364#define SGPIO_MUX_CFG_CLK_SOURCE_SLICE_MODE_SHIFT (3)
365#define SGPIO_MUX_CFG_CLK_SOURCE_SLICE_MODE_MASK \
366 (0x3 << SGPIO_MUX_CFG_CLK_SOURCE_SLICE_MODE_SHIFT)
367#define SGPIO_MUX_CFG_CLK_SOURCE_SLICE_MODE(x) \
368 ((x) << SGPIO_MUX_CFG_CLK_SOURCE_SLICE_MODE_SHIFT)
369
370#define SGPIO_MUX_CFG_QUALIFIER_MODE_SHIFT (5)
371#define SGPIO_MUX_CFG_QUALIFIER_MODE_MASK \
372 (0x3 << SGPIO_MUX_CFG_QUALIFIER_MODE_SHIFT)
373#define SGPIO_MUX_CFG_QUALIFIER_MODE(x) \
374 ((x) << SGPIO_MUX_CFG_QUALIFIER_MODE_SHIFT)
375
376#define SGPIO_MUX_CFG_QUALIFIER_PIN_MODE_SHIFT (7)
377#define SGPIO_MUX_CFG_QUALIFIER_PIN_MODE_MASK \
378 (0x3 << SGPIO_MUX_CFG_QUALIFIER_PIN_MODE_SHIFT)
379#define SGPIO_MUX_CFG_QUALIFIER_PIN_MODE(x) \
380 ((x) << SGPIO_MUX_CFG_QUALIFIER_PIN_MODE_SHIFT)
381
382#define SGPIO_MUX_CFG_QUALIFIER_SLICE_MODE_SHIFT (9)
383#define SGPIO_MUX_CFG_QUALIFIER_SLICE_MODE_MASK \
384 (0x3 << SGPIO_MUX_CFG_QUALIFIER_SLICE_MODE_SHIFT)
385#define SGPIO_MUX_CFG_QUALIFIER_SLICE_MODE(x) \
386 ((x) << SGPIO_MUX_CFG_QUALIFIER_SLICE_MODE_SHIFT)
387
388#define SGPIO_MUX_CFG_CONCAT_ENABLE_SHIFT (11)
389#define SGPIO_MUX_CFG_CONCAT_ENABLE_MASK \
390 (1 << SGPIO_MUX_CFG_CONCAT_ENABLE_SHIFT)
391#define SGPIO_MUX_CFG_CONCAT_ENABLE(x) \
392 ((x) << SGPIO_MUX_CFG_CONCAT_ENABLE_SHIFT)
393
394#define SGPIO_MUX_CFG_CONCAT_ORDER_SHIFT (12)
395#define SGPIO_MUX_CFG_CONCAT_ORDER_MASK \
396 (0x3 << SGPIO_MUX_CFG_CONCAT_ORDER_SHIFT)
397#define SGPIO_MUX_CFG_CONCAT_ORDER(x) \
398 ((x) << SGPIO_MUX_CFG_CONCAT_ORDER_SHIFT)
399
400#define SGPIO_SLICE_MUX_CFG_MATCH_MODE_SHIFT (0)
401#define SGPIO_SLICE_MUX_CFG_MATCH_MODE_MASK \
402 (1 << SGPIO_SLICE_MUX_CFG_MATCH_MODE_SHIFT)
403#define SGPIO_SLICE_MUX_CFG_MATCH_MODE(x) \
404 ((x) << SGPIO_SLICE_MUX_CFG_MATCH_MODE_SHIFT)
405
406#define SGPIO_SLICE_MUX_CFG_CLK_CAPTURE_MODE_SHIFT (1)
407#define SGPIO_SLICE_MUX_CFG_CLK_CAPTURE_MODE_MASK \
408 (1 << SGPIO_SLICE_MUX_CFG_CLK_CAPTURE_MODE_SHIFT)
409#define SGPIO_SLICE_MUX_CFG_CLK_CAPTURE_MODE(x) \
410 ((x) << SGPIO_SLICE_MUX_CFG_CLK_CAPTURE_MODE_SHIFT)
411
412#define SGPIO_SLICE_MUX_CFG_CLKGEN_MODE_SHIFT (2)
413#define SGPIO_SLICE_MUX_CFG_CLKGEN_MODE_MASK \
414 (1 << SGPIO_SLICE_MUX_CFG_CLKGEN_MODE_SHIFT)
415#define SGPIO_SLICE_MUX_CFG_CLKGEN_MODE(x) \
416 ((x) << SGPIO_SLICE_MUX_CFG_CLKGEN_MODE_SHIFT)
417
418#define SGPIO_SLICE_MUX_CFG_INV_OUT_CLK_SHIFT (3)
419#define SGPIO_SLICE_MUX_CFG_INV_OUT_CLK_MASK \
420 (1 << SGPIO_SLICE_MUX_CFG_INV_OUT_CLK_SHIFT)
421#define SGPIO_SLICE_MUX_CFG_INV_OUT_CLK(x) \
422 ((x) << SGPIO_SLICE_MUX_CFG_INV_OUT_CLK_SHIFT)
423
424#define SGPIO_SLICE_MUX_CFG_DATA_CAPTURE_MODE_SHIFT (4)
425#define SGPIO_SLICE_MUX_CFG_DATA_CAPTURE_MODE_MASK \
426 (0x3 << SGPIO_SLICE_MUX_CFG_DATA_CAPTURE_MODE_SHIFT)
427#define SGPIO_SLICE_MUX_CFG_DATA_CAPTURE_MODE(x) \
428 ((x) << SGPIO_SLICE_MUX_CFG_DATA_CAPTURE_MODE_SHIFT)
429
430#define SGPIO_SLICE_MUX_CFG_PARALLEL_MODE_SHIFT (6)
431#define SGPIO_SLICE_MUX_CFG_PARALLEL_MODE_MASK \
432 (0x3 << SGPIO_SLICE_MUX_CFG_PARALLEL_MODE_SHIFT)
433#define SGPIO_SLICE_MUX_CFG_PARALLEL_MODE(x) \
434 ((x) << SGPIO_SLICE_MUX_CFG_PARALLEL_MODE_SHIFT)
435
436#define SGPIO_SLICE_MUX_CFG_INV_QUALIFIER_SHIFT (8)
437#define SGPIO_SLICE_MUX_CFG_INV_QUALIFIER_MASK \
438 (1 << SGPIO_SLICE_MUX_CFG_INV_QUALIFIER_SHIFT)
439#define SGPIO_SLICE_MUX_CFG_INV_QUALIFIER(x) \
440 ((x) << SGPIO_SLICE_MUX_CFG_INV_QUALIFIER_SHIFT)
441
442#define SGPIO_POS_POS_SHIFT (0)
443#define SGPIO_POS_POS_MASK (0xff << SGPIO_POS_POS_SHIFT)
444#define SGPIO_POS_POS(x) ((x) << SGPIO_POS_POS_SHIFT)
445
446#define SGPIO_POS_POS_RESET_SHIFT (8)
447#define SGPIO_POS_POS_RESET_MASK (0xff << SGPIO_POS_POS_RESET_SHIFT)
448#define SGPIO_POS_POS_RESET(x) ((x) << SGPIO_POS_POS_RESET_SHIFT)
449
450/* --- AUTO-GENERATED STUFF FOLLOWS ----------------------------- */
451
452/* --- SGPIO_OUT_MUX_CFG[0..15] values ------------------------------------ */
453
454/* P_OUT_CFG: Output control of output SGPIOn */
455#define SGPIO_OUT_MUX_CFGx_P_OUT_CFG_SHIFT (0)
456#define SGPIO_OUT_MUX_CFGx_P_OUT_CFG_MASK \
457 (0xf << SGPIO_OUT_MUX_CFGx_P_OUT_CFG_SHIFT)
458#define SGPIO_OUT_MUX_CFGx_P_OUT_CFG(x) \
459 ((x) << SGPIO_OUT_MUX_CFGx_P_OUT_CFG_SHIFT)
460
461/* P_OE_CFG: Output enable source */
462#define SGPIO_OUT_MUX_CFGx_P_OE_CFG_SHIFT (4)
463#define SGPIO_OUT_MUX_CFGx_P_OE_CFG_MASK \
464 (0x7 << SGPIO_OUT_MUX_CFGx_P_OE_CFG_SHIFT)
465#define SGPIO_OUT_MUX_CFGx_P_OE_CFG(x) \
466 ((x) << SGPIO_OUT_MUX_CFGx_P_OE_CFG_SHIFT)
467
468/* --- SGPIO_MUX_CFG[0..15] values ---------------------------------------- */
469
470/* EXT_CLK_ENABLE: Select clock signal */
471#define SGPIO_MUX_CFGx_EXT_CLK_ENABLE_SHIFT (0)
472#define SGPIO_MUX_CFGx_EXT_CLK_ENABLE \
473 (1 << SGPIO_MUX_CFGx_EXT_CLK_ENABLE_SHIFT)
474
475/* CLK_SOURCE_PIN_MODE: Select source clock pin */
476#define SGPIO_MUX_CFGx_CLK_SOURCE_PIN_MODE_SHIFT (1)
477#define SGPIO_MUX_CFGx_CLK_SOURCE_PIN_MODE_MASK \
478 (0x3 << SGPIO_MUX_CFGx_CLK_SOURCE_PIN_MODE_SHIFT)
479#define SGPIO_MUX_CFGx_CLK_SOURCE_PIN_MODE(x) \
480 ((x) << SGPIO_MUX_CFGx_CLK_SOURCE_PIN_MODE_SHIFT)
481
482/* CLK_SOURCE_SLICE_MODE: Select clock source slice */
483#define SGPIO_MUX_CFGx_CLK_SOURCE_SLICE_MODE_SHIFT (3)
484#define SGPIO_MUX_CFGx_CLK_SOURCE_SLICE_MODE_MASK \
485 (0x3 << SGPIO_MUX_CFGx_CLK_SOURCE_SLICE_MODE_SHIFT)
486#define SGPIO_MUX_CFGx_CLK_SOURCE_SLICE_MODE(x) \
487 ((x) << SGPIO_MUX_CFGx_CLK_SOURCE_SLICE_MODE_SHIFT)
488
489/* QUALIFIER_MODE: Select qualifier mode */
490#define SGPIO_MUX_CFGx_QUALIFIER_MODE_SHIFT (5)
491#define SGPIO_MUX_CFGx_QUALIFIER_MODE_MASK \
492 (0x3 << SGPIO_MUX_CFGx_QUALIFIER_MODE_SHIFT)
493#define SGPIO_MUX_CFGx_QUALIFIER_MODE(x) \
494 ((x) << SGPIO_MUX_CFGx_QUALIFIER_MODE_SHIFT)
495
496/* QUALIFIER_PIN_MODE: Select qualifier pin */
497#define SGPIO_MUX_CFGx_QUALIFIER_PIN_MODE_SHIFT (7)
498#define SGPIO_MUX_CFGx_QUALIFIER_PIN_MODE_MASK \
499 (0x3 << SGPIO_MUX_CFGx_QUALIFIER_PIN_MODE_SHIFT)
500#define SGPIO_MUX_CFGx_QUALIFIER_PIN_MODE(x) \
501 ((x) << SGPIO_MUX_CFGx_QUALIFIER_PIN_MODE_SHIFT)
502
503/* QUALIFIER_SLICE_MODE: Select qualifier slice */
504#define SGPIO_MUX_CFGx_QUALIFIER_SLICE_MODE_SHIFT (9)
505#define SGPIO_MUX_CFGx_QUALIFIER_SLICE_MODE_MASK \
506 (0x3 << SGPIO_MUX_CFGx_QUALIFIER_SLICE_MODE_SHIFT)
507#define SGPIO_MUX_CFGx_QUALIFIER_SLICE_MODE(x) \
508 ((x) << SGPIO_MUX_CFG0_QUALIFIER_SLICE_MODE_SHIFT)
509
510/* CONCAT_ENABLE: Enable concatenation */
511#define SGPIO_MUX_CFGx_CONCAT_ENABLE_SHIFT (11)
512#define SGPIO_MUX_CFGx_CONCAT_ENABLE \
513 (1 << SGPIO_MUX_CFGx_CONCAT_ENABLE_SHIFT)
514
515/* CONCAT_ORDER: Select concatenation order */
516#define SGPIO_MUX_CFGx_CONCAT_ORDER_SHIFT (12)
517#define SGPIO_MUX_CFGx_CONCAT_ORDER_MASK \
518 (0x3 << SGPIO_MUX_CFGx_CONCAT_ORDER_SHIFT)
519#define SGPIO_MUX_CFGx_CONCAT_ORDER(x) \
520 ((x) << SGPIO_MUX_CFGx_CONCAT_ORDER_SHIFT)
521
522/* --- SGPIO_SLICE_MUX_CFG[0..15] values ---------------------------------- */
523
524/* MATCH_MODE: Match mode */
525#define SGPIO_SLICE_MUX_CFGx_MATCH_MODE_SHIFT (0)
526#define SGPIO_SLICE_MUX_CFGx_MATCH_MODE \
527 (1 << SGPIO_SLICE_MUX_CFG0_MATCH_MODE_SHIFT)
528
529/* CLK_CAPTURE_MODE: Capture clock mode */
530#define SGPIO_SLICE_MUX_CFGx_CLK_CAPTURE_MODE_SHIFT (1)
531#define SGPIO_SLICE_MUX_CFGx_CLK_CAPTURE_MODE \
532 (1 << SGPIO_SLICE_MUX_CFGx_CLK_CAPTURE_MODE_SHIFT)
533
534/* CLKGEN_MODE: Clock generation mode */
535#define SGPIO_SLICE_MUX_CFGx_CLKGEN_MODE_SHIFT (2)
536#define SGPIO_SLICE_MUX_CFGx_CLKGEN_MODE \
537 (1 << SGPIO_SLICE_MUX_CFGx_CLKGEN_MODE_SHIFT)
538
539/* INV_OUT_CLK: Invert output clock */
540#define SGPIO_SLICE_MUX_CFGx_INV_OUT_CLK_SHIFT (3)
541#define SGPIO_SLICE_MUX_CFGx_INV_OUT_CLK \
542 (1 << SGPIO_SLICE_MUX_CFGx_INV_OUT_CLK_SHIFT)
543
544/* DATA_CAPTURE_MODE: Condition for input bit match interrupt */
545#define SGPIO_SLICE_MUX_CFGx_DATA_CAPTURE_MODE_SHIFT (4)
546#define SGPIO_SLICE_MUX_CFGx_DATA_CAPTURE_MODE_MASK \
547 (0x3 << SGPIO_SLICE_MUX_CFGx_DATA_CAPTURE_MODE_SHIFT)
548#define SGPIO_SLICE_MUX_CFGx_DATA_CAPTURE_MODE(x) \
549 ((x) << SGPIO_SLICE_MUX_CFGx_DATA_CAPTURE_MODE_SHIFT)
550
551/* PARALLEL_MODE: Parallel mode */
552#define SGPIO_SLICE_MUX_CFGx_PARALLEL_MODE_SHIFT (6)
553#define SGPIO_SLICE_MUX_CFGx_PARALLEL_MODE_MASK \
554 (0x3 << SGPIO_SLICE_MUX_CFGx_PARALLEL_MODE_SHIFT)
555#define SGPIO_SLICE_MUX_CFGx_PARALLEL_MODE(x) \
556 ((x) << SGPIO_SLICE_MUX_CFGx_PARALLEL_MODE_SHIFT)
557
558/* INV_QUALIFIER: Inversion qualifier */
559#define SGPIO_SLICE_MUX_CFGx_INV_QUALIFIER_SHIFT (8)
560#define SGPIO_SLICE_MUX_CFGx_INV_QUALIFIER \
561 (1 << SGPIO_SLICE_MUX_CFGx_INV_QUALIFIER_SHIFT)
562
563
564/* --- SGPIO_POS[0..15] values -------------------------------------------- */
565
566/* POS: Each time COUNT reaches 0x0 POS counts down */
567#define SGPIO_POSx_POS_SHIFT (0)
568#define SGPIO_POSx_POS_MASK (0xff << SGPIO_POSx_POS_SHIFT)
569#define SGPIO_POSx_POS(x) ((x) << SGPIO_POSx_POS_SHIFT)
570
571/* POS_RESET: Reload value for POS after POS reaches 0x0 */
572#define SGPIO_POSx_POS_RESET_SHIFT (8)
573#define SGPIO_POSx_POS_RESET_MASK (0xff << SGPIO_POSx_POS_RESET_SHIFT)
574#define SGPIO_POSx_POS_RESET(x) ((x) << SGPIO_POSx_POS_RESET_SHIFT)
575
576
577/* SGPIO structure for faster/better code generation (especially when optimized
578 * with -O2/-O3)
579 */
580/* This structure is compliant with LPC43xx User Manual UM10503 Rev.1.4 - 3
581 * September 2012
582 */
583typedef struct {
584 /* Pin multiplexer configuration registers. RW */
585 volatile uint32_t OUT_MUX_CFG[16];
586 /* SGPIO multiplexer configuration registers. RW */
587 volatile uint32_t SGPIO_MUX_CFG[16];
588 /* Slice multiplexer configuration registers. RW */
589 volatile uint32_t SLICE_MUX_CFG[16];
590 /* Slice data registers. RW */
591 volatile uint32_t REG[16];
592 /* Slice data shadow registers. Each time POS reaches 0x0 the contents
593 * of REG_SS is exchanged with the content of REG. RW
594 */
595 volatile uint32_t REG_SS[16];
596 /* Reload registers. Counter reload value; loaded when COUNT reaches
597 * 0x0 RW
598 */
599 volatile uint32_t PRESET[16];
600 /* Down counter registers, counts down each shift clock cycle. RW */
601 volatile uint32_t COUNT[16];
602 /* Position registers. POS Each time COUNT reaches 0x0 POS counts down.
603 * POS_RESET Reload value for POS after POS reaches 0x0. RW
604 */
605 volatile uint32_t POS[16];
606 /* Slice A mask register. Mask for pattern match function of slice A.
607 * RW
608 */
609 volatile uint32_t MASK_A;
610 /* Slice H mask register. Mask for pattern match function of slice H.
611 * RW
612 */
613 volatile uint32_t MASK_H;
614 /* Slice I mask register. Mask for pattern match function of slice I.
615 * RW
616 */
617 volatile uint32_t MASK_I;
618 /* Slice P mask register. Mask for pattern match function of slice P.
619 * RW
620 */
621 volatile uint32_t MASK_P;
622 /* GPIO input status register. R */
623 volatile uint32_t GPIO_INREG;
624 /* GPIO output control register. RW */
625 volatile uint32_t GPIO_OUTREG;
626 /* GPIO output enable register. RW */
627 volatile uint32_t GPIO_OENREG;
628 /* Slice count enable register. RW */
629 volatile uint32_t CTRL_ENABLE;
630 /* Slice count disable register. RW */
631 volatile uint32_t CTRL_DISABLE;
632 volatile uint32_t RES0[823];
633 /* Shift clock interrupt clear mask register. W */
634 volatile uint32_t CLR_EN_0;
635 /* Shift clock interrupt set mask register. W */
636 volatile uint32_t SET_EN_0;
637 /* Shift clock interrupt enable register. R */
638 volatile uint32_t ENABLE_0;
639 /* Shift clock interrupt status register. R */
640 volatile uint32_t STATUS_0;
641 /* Shift clock interrupt clear status register. W */
642 volatile uint32_t CLR_STATUS_0;
643 /* Shift clock interrupt set status register. W */
644 volatile uint32_t SET_STATUS_0;
645 volatile uint32_t RES1[2];
646 /* Exchange clock interrupt clear mask register. W */
647 volatile uint32_t CLR_EN_1;
648 /* Exchange clock interrupt set mask register. W */
649 volatile uint32_t SET_EN_1;
650 /* Exchange clock interrupt enable. R */
651 volatile uint32_t ENABLE_1;
652 /* Exchange clock interrupt status register. R */
653 volatile uint32_t STATUS_1;
654 /* Exchange clock interrupt clear status register. W */
655 volatile uint32_t CLR_STATUS_1;
656 /* Exchange clock interrupt set status register. W */
657 volatile uint32_t SET_STATUS_1;
658 volatile uint32_t RES2[2];
659 /* Pattern match interrupt clear mask register. W */
660 volatile uint32_t CLR_EN_2;
661 /* Pattern match interrupt set mask register. W */
662 volatile uint32_t SET_EN_2;
663 /* Pattern match interrupt enable register. R */
664 volatile uint32_t ENABLE_2;
665 /* Pattern match interrupt status register. R */
666 volatile uint32_t STATUS_2;
667 /* Pattern match interrupt clear status register. W */
668 volatile uint32_t CLR_STATUS_2;
669 /* Pattern match interrupt set status register. W */
670 volatile uint32_t SET_STATUS_2;
671 volatile uint32_t RES3[2];
672 /* Input interrupt clear mask register. W */
673 volatile uint32_t CLR_EN_3;
674 /* Input bit match interrupt set mask register. W */
675 volatile uint32_t SET_EN_3;
676 /* Input bit match interrupt enable register. R */
677 volatile uint32_t ENABLE_3;
678 /* Input bit match interrupt status register. R */
679 volatile uint32_t STATUS_3;
680 /* Input bit match interrupt clear status register. W */
681 volatile uint32_t CLR_STATUS_3;
682 /* Input bit match interrupt set status register. W */
683 volatile uint32_t SET_STATUS_3;
684} sgpio_t;
685
686/* Global access to SGPIO structure */
687#define SGPIO ((sgpio_t *)SGPIO_PORT_BASE)
688
689/**@}*/
690
691#endif
#define SGPIO_MUX_CFG(slice)
Definition: sgpio.h:81
Definition: sgpio.h:583
volatile uint32_t CLR_STATUS_2
Definition: sgpio.h:668
volatile uint32_t CTRL_ENABLE
Definition: sgpio.h:629
volatile uint32_t STATUS_0
Definition: sgpio.h:640
volatile uint32_t SET_STATUS_1
Definition: sgpio.h:657
volatile uint32_t CLR_STATUS_3
Definition: sgpio.h:681
volatile uint32_t CTRL_DISABLE
Definition: sgpio.h:631
volatile uint32_t CLR_STATUS_0
Definition: sgpio.h:642
volatile uint32_t CLR_EN_1
Definition: sgpio.h:647
volatile uint32_t SET_EN_1
Definition: sgpio.h:649
volatile uint32_t STATUS_1
Definition: sgpio.h:653
volatile uint32_t ENABLE_0
Definition: sgpio.h:638
volatile uint32_t CLR_EN_2
Definition: sgpio.h:660
volatile uint32_t MASK_I
Definition: sgpio.h:617
volatile uint32_t SET_EN_3
Definition: sgpio.h:675
volatile uint32_t ENABLE_1
Definition: sgpio.h:651
volatile uint32_t CLR_STATUS_1
Definition: sgpio.h:655
volatile uint32_t GPIO_OENREG
Definition: sgpio.h:627
volatile uint32_t CLR_EN_0
Definition: sgpio.h:634
volatile uint32_t MASK_A
Definition: sgpio.h:609
volatile uint32_t GPIO_INREG
Definition: sgpio.h:623
volatile uint32_t MASK_H
Definition: sgpio.h:613
volatile uint32_t SET_STATUS_3
Definition: sgpio.h:683
volatile uint32_t SET_STATUS_0
Definition: sgpio.h:644
volatile uint32_t GPIO_OUTREG
Definition: sgpio.h:625
volatile uint32_t ENABLE_3
Definition: sgpio.h:677
volatile uint32_t ENABLE_2
Definition: sgpio.h:664
volatile uint32_t STATUS_2
Definition: sgpio.h:666
volatile uint32_t STATUS_3
Definition: sgpio.h:679
volatile uint32_t SET_EN_0
Definition: sgpio.h:636
volatile uint32_t SET_EN_2
Definition: sgpio.h:662
volatile uint32_t CLR_EN_3
Definition: sgpio.h:673
volatile uint32_t MASK_P
Definition: sgpio.h:621
volatile uint32_t SET_STATUS_2
Definition: sgpio.h:670