Newer
Older
/* Teensyduino Core Library
* http://www.pjrc.com/teensy/
* Copyright (c) 2013 PJRC.COM, LLC.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* 1. The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* 2. If the Software is incorporated into a build system that allows
* selection among a list of target devices, then similar target
* devices manufactured by PJRC.COM must be included in the list of
* target devices and selectable in the same manner.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef _mk20dx128_h_
#define _mk20dx128_h_
#define F_CPU 48000000
#define F_BUS 48000000
#define F_MEM 24000000
#ifndef NULL
#define NULL ((void *)0)
#endif
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
// Slower data can go into FlexRAM, to save space in faster RAM
#define FLEXRAM_DATA __attribute__ ((section(".flexram")))
// Performance-critical code can execute from RAM
#define EXECUTE_FROM_RAM __attribute__ ((section(".ramtext")))
// chapter 11: Port control and interrupts (PORT)
#define PORTA_PCR0 *(volatile uint32_t *)0x40049000 // Pin Control Register n
#define PORT_PCR_ISF (uint32_t)0x01000000 // Interrupt Status Flag
#define PORT_PCR_IRQC(n) (uint32_t)(((n) & 15) << 16) // Interrupt Configuration
#define PORT_PCR_IRQC_MASK (uint32_t)0x000F0000
#define PORT_PCR_LK (uint32_t)0x00008000 // Lock Register
#define PORT_PCR_MUX(n) (uint32_t)(((n) & 7) << 8) // Pin Mux Control
#define PORT_PCR_MUX_MASK (uint32_t)0x00000700
#define PORT_PCR_DSE (uint32_t)0x00000040 // Drive Strength Enable
#define PORT_PCR_ODE (uint32_t)0x00000020 // Open Drain Enable
#define PORT_PCR_PFE (uint32_t)0x00000010 // Passive Filter Enable
#define PORT_PCR_SRE (uint32_t)0x00000004 // Slew Rate Enable
#define PORT_PCR_PE (uint32_t)0x00000002 // Pull Enable
#define PORT_PCR_PS (uint32_t)0x00000001 // Pull Select
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#define PORTA_PCR1 *(volatile uint32_t *)0x40049004 // Pin Control Register n
#define PORTA_PCR2 *(volatile uint32_t *)0x40049008 // Pin Control Register n
#define PORTA_PCR3 *(volatile uint32_t *)0x4004900C // Pin Control Register n
#define PORTA_PCR4 *(volatile uint32_t *)0x40049010 // Pin Control Register n
#define PORTA_PCR5 *(volatile uint32_t *)0x40049014 // Pin Control Register n
#define PORTA_PCR6 *(volatile uint32_t *)0x40049018 // Pin Control Register n
#define PORTA_PCR7 *(volatile uint32_t *)0x4004901C // Pin Control Register n
#define PORTA_PCR8 *(volatile uint32_t *)0x40049020 // Pin Control Register n
#define PORTA_PCR9 *(volatile uint32_t *)0x40049024 // Pin Control Register n
#define PORTA_PCR10 *(volatile uint32_t *)0x40049028 // Pin Control Register n
#define PORTA_PCR11 *(volatile uint32_t *)0x4004902C // Pin Control Register n
#define PORTA_PCR12 *(volatile uint32_t *)0x40049030 // Pin Control Register n
#define PORTA_PCR13 *(volatile uint32_t *)0x40049034 // Pin Control Register n
#define PORTA_PCR14 *(volatile uint32_t *)0x40049038 // Pin Control Register n
#define PORTA_PCR15 *(volatile uint32_t *)0x4004903C // Pin Control Register n
#define PORTA_PCR16 *(volatile uint32_t *)0x40049040 // Pin Control Register n
#define PORTA_PCR17 *(volatile uint32_t *)0x40049044 // Pin Control Register n
#define PORTA_PCR18 *(volatile uint32_t *)0x40049048 // Pin Control Register n
#define PORTA_PCR19 *(volatile uint32_t *)0x4004904C // Pin Control Register n
#define PORTA_PCR20 *(volatile uint32_t *)0x40049050 // Pin Control Register n
#define PORTA_PCR21 *(volatile uint32_t *)0x40049054 // Pin Control Register n
#define PORTA_PCR22 *(volatile uint32_t *)0x40049058 // Pin Control Register n
#define PORTA_PCR23 *(volatile uint32_t *)0x4004905C // Pin Control Register n
#define PORTA_PCR24 *(volatile uint32_t *)0x40049060 // Pin Control Register n
#define PORTA_PCR25 *(volatile uint32_t *)0x40049064 // Pin Control Register n
#define PORTA_PCR26 *(volatile uint32_t *)0x40049068 // Pin Control Register n
#define PORTA_PCR27 *(volatile uint32_t *)0x4004906C // Pin Control Register n
#define PORTA_PCR28 *(volatile uint32_t *)0x40049070 // Pin Control Register n
#define PORTA_PCR29 *(volatile uint32_t *)0x40049074 // Pin Control Register n
#define PORTA_PCR30 *(volatile uint32_t *)0x40049078 // Pin Control Register n
#define PORTA_PCR31 *(volatile uint32_t *)0x4004907C // Pin Control Register n
#define PORTA_GPCLR *(volatile uint32_t *)0x40049080 // Global Pin Control Low Register
#define PORTA_GPCHR *(volatile uint32_t *)0x40049084 // Global Pin Control High Register
#define PORTA_ISFR *(volatile uint32_t *)0x400490A0 // Interrupt Status Flag Register
#define PORTB_PCR0 *(volatile uint32_t *)0x4004A000 // Pin Control Register n
#define PORTB_PCR1 *(volatile uint32_t *)0x4004A004 // Pin Control Register n
#define PORTB_PCR2 *(volatile uint32_t *)0x4004A008 // Pin Control Register n
#define PORTB_PCR3 *(volatile uint32_t *)0x4004A00C // Pin Control Register n
#define PORTB_PCR4 *(volatile uint32_t *)0x4004A010 // Pin Control Register n
#define PORTB_PCR5 *(volatile uint32_t *)0x4004A014 // Pin Control Register n
#define PORTB_PCR6 *(volatile uint32_t *)0x4004A018 // Pin Control Register n
#define PORTB_PCR7 *(volatile uint32_t *)0x4004A01C // Pin Control Register n
#define PORTB_PCR8 *(volatile uint32_t *)0x4004A020 // Pin Control Register n
#define PORTB_PCR9 *(volatile uint32_t *)0x4004A024 // Pin Control Register n
#define PORTB_PCR10 *(volatile uint32_t *)0x4004A028 // Pin Control Register n
#define PORTB_PCR11 *(volatile uint32_t *)0x4004A02C // Pin Control Register n
#define PORTB_PCR12 *(volatile uint32_t *)0x4004A030 // Pin Control Register n
#define PORTB_PCR13 *(volatile uint32_t *)0x4004A034 // Pin Control Register n
#define PORTB_PCR14 *(volatile uint32_t *)0x4004A038 // Pin Control Register n
#define PORTB_PCR15 *(volatile uint32_t *)0x4004A03C // Pin Control Register n
#define PORTB_PCR16 *(volatile uint32_t *)0x4004A040 // Pin Control Register n
#define PORTB_PCR17 *(volatile uint32_t *)0x4004A044 // Pin Control Register n
#define PORTB_PCR18 *(volatile uint32_t *)0x4004A048 // Pin Control Register n
#define PORTB_PCR19 *(volatile uint32_t *)0x4004A04C // Pin Control Register n
#define PORTB_PCR20 *(volatile uint32_t *)0x4004A050 // Pin Control Register n
#define PORTB_PCR21 *(volatile uint32_t *)0x4004A054 // Pin Control Register n
#define PORTB_PCR22 *(volatile uint32_t *)0x4004A058 // Pin Control Register n
#define PORTB_PCR23 *(volatile uint32_t *)0x4004A05C // Pin Control Register n
#define PORTB_PCR24 *(volatile uint32_t *)0x4004A060 // Pin Control Register n
#define PORTB_PCR25 *(volatile uint32_t *)0x4004A064 // Pin Control Register n
#define PORTB_PCR26 *(volatile uint32_t *)0x4004A068 // Pin Control Register n
#define PORTB_PCR27 *(volatile uint32_t *)0x4004A06C // Pin Control Register n
#define PORTB_PCR28 *(volatile uint32_t *)0x4004A070 // Pin Control Register n
#define PORTB_PCR29 *(volatile uint32_t *)0x4004A074 // Pin Control Register n
#define PORTB_PCR30 *(volatile uint32_t *)0x4004A078 // Pin Control Register n
#define PORTB_PCR31 *(volatile uint32_t *)0x4004A07C // Pin Control Register n
#define PORTB_GPCLR *(volatile uint32_t *)0x4004A080 // Global Pin Control Low Register
#define PORTB_GPCHR *(volatile uint32_t *)0x4004A084 // Global Pin Control High Register
#define PORTB_ISFR *(volatile uint32_t *)0x4004A0A0 // Interrupt Status Flag Register
#define PORTC_PCR0 *(volatile uint32_t *)0x4004B000 // Pin Control Register n
#define PORTC_PCR1 *(volatile uint32_t *)0x4004B004 // Pin Control Register n
#define PORTC_PCR2 *(volatile uint32_t *)0x4004B008 // Pin Control Register n
#define PORTC_PCR3 *(volatile uint32_t *)0x4004B00C // Pin Control Register n
#define PORTC_PCR4 *(volatile uint32_t *)0x4004B010 // Pin Control Register n
#define PORTC_PCR5 *(volatile uint32_t *)0x4004B014 // Pin Control Register n
#define PORTC_PCR6 *(volatile uint32_t *)0x4004B018 // Pin Control Register n
#define PORTC_PCR7 *(volatile uint32_t *)0x4004B01C // Pin Control Register n
#define PORTC_PCR8 *(volatile uint32_t *)0x4004B020 // Pin Control Register n
#define PORTC_PCR9 *(volatile uint32_t *)0x4004B024 // Pin Control Register n
#define PORTC_PCR10 *(volatile uint32_t *)0x4004B028 // Pin Control Register n
#define PORTC_PCR11 *(volatile uint32_t *)0x4004B02C // Pin Control Register n
#define PORTC_PCR12 *(volatile uint32_t *)0x4004B030 // Pin Control Register n
#define PORTC_PCR13 *(volatile uint32_t *)0x4004B034 // Pin Control Register n
#define PORTC_PCR14 *(volatile uint32_t *)0x4004B038 // Pin Control Register n
#define PORTC_PCR15 *(volatile uint32_t *)0x4004B03C // Pin Control Register n
#define PORTC_PCR16 *(volatile uint32_t *)0x4004B040 // Pin Control Register n
#define PORTC_PCR17 *(volatile uint32_t *)0x4004B044 // Pin Control Register n
#define PORTC_PCR18 *(volatile uint32_t *)0x4004B048 // Pin Control Register n
#define PORTC_PCR19 *(volatile uint32_t *)0x4004B04C // Pin Control Register n
#define PORTC_PCR20 *(volatile uint32_t *)0x4004B050 // Pin Control Register n
#define PORTC_PCR21 *(volatile uint32_t *)0x4004B054 // Pin Control Register n
#define PORTC_PCR22 *(volatile uint32_t *)0x4004B058 // Pin Control Register n
#define PORTC_PCR23 *(volatile uint32_t *)0x4004B05C // Pin Control Register n
#define PORTC_PCR24 *(volatile uint32_t *)0x4004B060 // Pin Control Register n
#define PORTC_PCR25 *(volatile uint32_t *)0x4004B064 // Pin Control Register n
#define PORTC_PCR26 *(volatile uint32_t *)0x4004B068 // Pin Control Register n
#define PORTC_PCR27 *(volatile uint32_t *)0x4004B06C // Pin Control Register n
#define PORTC_PCR28 *(volatile uint32_t *)0x4004B070 // Pin Control Register n
#define PORTC_PCR29 *(volatile uint32_t *)0x4004B074 // Pin Control Register n
#define PORTC_PCR30 *(volatile uint32_t *)0x4004B078 // Pin Control Register n
#define PORTC_PCR31 *(volatile uint32_t *)0x4004B07C // Pin Control Register n
#define PORTC_GPCLR *(volatile uint32_t *)0x4004B080 // Global Pin Control Low Register
#define PORTC_GPCHR *(volatile uint32_t *)0x4004B084 // Global Pin Control High Register
#define PORTC_ISFR *(volatile uint32_t *)0x4004B0A0 // Interrupt Status Flag Register
#define PORTD_PCR0 *(volatile uint32_t *)0x4004C000 // Pin Control Register n
#define PORTD_PCR1 *(volatile uint32_t *)0x4004C004 // Pin Control Register n
#define PORTD_PCR2 *(volatile uint32_t *)0x4004C008 // Pin Control Register n
#define PORTD_PCR3 *(volatile uint32_t *)0x4004C00C // Pin Control Register n
#define PORTD_PCR4 *(volatile uint32_t *)0x4004C010 // Pin Control Register n
#define PORTD_PCR5 *(volatile uint32_t *)0x4004C014 // Pin Control Register n
#define PORTD_PCR6 *(volatile uint32_t *)0x4004C018 // Pin Control Register n
#define PORTD_PCR7 *(volatile uint32_t *)0x4004C01C // Pin Control Register n
#define PORTD_PCR8 *(volatile uint32_t *)0x4004C020 // Pin Control Register n
#define PORTD_PCR9 *(volatile uint32_t *)0x4004C024 // Pin Control Register n
#define PORTD_PCR10 *(volatile uint32_t *)0x4004C028 // Pin Control Register n
#define PORTD_PCR11 *(volatile uint32_t *)0x4004C02C // Pin Control Register n
#define PORTD_PCR12 *(volatile uint32_t *)0x4004C030 // Pin Control Register n
#define PORTD_PCR13 *(volatile uint32_t *)0x4004C034 // Pin Control Register n
#define PORTD_PCR14 *(volatile uint32_t *)0x4004C038 // Pin Control Register n
#define PORTD_PCR15 *(volatile uint32_t *)0x4004C03C // Pin Control Register n
#define PORTD_PCR16 *(volatile uint32_t *)0x4004C040 // Pin Control Register n
#define PORTD_PCR17 *(volatile uint32_t *)0x4004C044 // Pin Control Register n
#define PORTD_PCR18 *(volatile uint32_t *)0x4004C048 // Pin Control Register n
#define PORTD_PCR19 *(volatile uint32_t *)0x4004C04C // Pin Control Register n
#define PORTD_PCR20 *(volatile uint32_t *)0x4004C050 // Pin Control Register n
#define PORTD_PCR21 *(volatile uint32_t *)0x4004C054 // Pin Control Register n
#define PORTD_PCR22 *(volatile uint32_t *)0x4004C058 // Pin Control Register n
#define PORTD_PCR23 *(volatile uint32_t *)0x4004C05C // Pin Control Register n
#define PORTD_PCR24 *(volatile uint32_t *)0x4004C060 // Pin Control Register n
#define PORTD_PCR25 *(volatile uint32_t *)0x4004C064 // Pin Control Register n
#define PORTD_PCR26 *(volatile uint32_t *)0x4004C068 // Pin Control Register n
#define PORTD_PCR27 *(volatile uint32_t *)0x4004C06C // Pin Control Register n
#define PORTD_PCR28 *(volatile uint32_t *)0x4004C070 // Pin Control Register n
#define PORTD_PCR29 *(volatile uint32_t *)0x4004C074 // Pin Control Register n
Loading
Loading full blame...