libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
pio_common_all.h
Go to the documentation of this file.
1/*
2 * This file is part of the libopencm3 project.
3 *
4 * Copyright (C) 2012 Gareth McMullin <gareth@blacksphere.co.nz>
5 * Copyright (C) 2014 Felix Held <felix-libopencm3@felixheld.de>
6 *
7 * This library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA PIO.H
22The order of header inclusion is important. pio.h includes the device
23specific memorymap.h header before including this header file.*/
24
25#if defined(LIBOPENCM3_PIO_H)
26
27#ifndef LIBOPENCM3_PIO_COMMON_ALL_H
28#define LIBOPENCM3_PIO_COMMON_ALL_H
29
31
32/* --- Convenience macros ------------------------------------------------ */
33
34/* GPIO port base addresses (for convenience) */
35#define PIOA PIOA_BASE
36#define PIOB PIOB_BASE
37#define PIOC PIOC_BASE
38#define PIOD PIOD_BASE
39#define PIOE PIOE_BASE
40#define PIOF PIOF_BASE
41#define PIOG PIOG_BASE
42#define PIOH PIOH_BASE
43
44/* --- PIO registers ----------------------------------------------------- */
45
46/* PIO Enable Register */
47#define PIO_PER(port) MMIO32((port) + 0x0000)
48
49/* PIO Disable Register */
50#define PIO_PDR(port) MMIO32((port) + 0x0004)
51
52/* PIO Status Register */
53#define PIO_PSR(port) MMIO32((port) + 0x0008)
54
55/* Output Enable Register */
56#define PIO_OER(port) MMIO32((port) + 0x0010)
57
58/* Output Disable Register */
59#define PIO_ODR(port) MMIO32((port) + 0x0014)
60
61/* Output Status Register */
62#define PIO_OSR(port) MMIO32((port) + 0x0018)
63
64/* Glitch Input Filter Enable Register */
65#define PIO_IFER(port) MMIO32((port) + 0x0020)
66
67/* Glitch Input Filter Disable Register */
68#define PIO_IFDR(port) MMIO32((port) + 0x0024)
69
70/* Glitch Input Filter Status Register */
71#define PIO_IFSR(port) MMIO32((port) + 0x0028)
72
73/* Set Output Data Register */
74#define PIO_SODR(port) MMIO32((port) + 0x0030)
75
76/* Clear Output Data Register */
77#define PIO_CODR(port) MMIO32((port) + 0x0034)
78
79/* Output Data Status Register */
80#define PIO_ODSR(port) MMIO32((port) + 0x0038)
81
82/* Pin Data Status Register */
83#define PIO_PDSR(port) MMIO32((port) + 0x003C)
84
85/* Interrupt Enable Register */
86#define PIO_IER(port) MMIO32((port) + 0x0040)
87
88/* Interrupt Disable Register */
89#define PIO_IDR(port) MMIO32((port) + 0x0044)
90
91/* Interrupt Mask Register */
92#define PIO_IMR(port) MMIO32((port) + 0x0048)
93
94/* Interrupt Status Register */
95#define PIO_ISR(port) MMIO32((port) + 0x004C)
96
97/* Multi-driver Enable Register */
98#define PIO_MDER(port) MMIO32((port) + 0x0050)
99
100/* Multi-driver Disable Register */
101#define PIO_MDDR(port) MMIO32((port) + 0x0054)
102
103/* Multi-driver Status Register */
104#define PIO_MDSR(port) MMIO32((port) + 0x0058)
105
106/* Pull-up Disable Register */
107#define PIO_PUDR(port) MMIO32((port) + 0x0060)
108
109/* Pull-up Enable Register */
110#define PIO_PUER(port) MMIO32((port) + 0x0064)
111
112/* Pad Pull-up Status Register */
113#define PIO_PUSR(port) MMIO32((port) + 0x0068)
114
115/* Slow Clock Divider Debouncing Register */
116#define PIO_SCDR(port) MMIO32((port) + 0x008C)
117
118/* Output Write Enable */
119#define PIO_OWER(port) MMIO32((port) + 0x00A0)
120
121/* Output Write Disable */
122#define PIO_OWDR(port) MMIO32((port) + 0x00A4)
123
124/* Output Write Status Register */
125#define PIO_OWSR(port) MMIO32((port) + 0x00A8)
126
127/* Additional Interrupt Modes Enable Register */
128#define PIO_AIMER(port) MMIO32((port) + 0x00B0)
129
130/* Additional Interrupt Modes Disables Register */
131#define PIO_AIMDR(port) MMIO32((port) + 0x00B4)
132
133/* Additional Interrupt Modes Mask Register */
134#define PIO_AIMMR(port) MMIO32((port) + 0x00B8)
135
136/* Edge Select Register */
137#define PIO_ESR(port) MMIO32((port) + 0x00C0)
138
139/* Level Select Register */
140#define PIO_LSR(port) MMIO32((port) + 0x00C4)
141
142/* Edge/Level Status Register */
143#define PIO_ELSR(port) MMIO32((port) + 0x00C8)
144
145/* Falling Edge/Low Level Select Register */
146#define PIO_FELLSR(port) MMIO32((port) + 0x00D0)
147
148/* Rising Edge/High Level Select Register */
149#define PIO_REHLSR(port) MMIO32((port) + 0x00D4)
150
151/* Fall/Rise - Low/High Status Register */
152#define PIO_FRLHSR(port) MMIO32((port) + 0x00D8)
153
154/* Lock Status */
155#define PIO_LOCKSR(port) MMIO32((port) + 0x00E0)
156
157/* Write Protect Mode Register */
158#define PIO_WPMR(port) MMIO32((port) + 0x00E4)
159
160/* Write Protect Status Register */
161#define PIO_WPSR(port) MMIO32((port) + 0x00E8)
162
163
164#endif
165
166#else
167#warning "pio_common_all.h should not be included explicitly, only via pio.h"
168#endif