diff options
Diffstat (limited to 'lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.c')
-rw-r--r-- | lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.c | 216 |
1 files changed, 216 insertions, 0 deletions
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.c b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.c new file mode 100644 index 000000000..e59f4ae2c --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.c | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2015 RedoX https://github.com/RedoXyde | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | #include "hal.h" | ||
17 | |||
18 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | const PALConfig pal_default_config = | ||
25 | { | ||
26 | .ports = { | ||
27 | { | ||
28 | /* | ||
29 | * PORTA setup. | ||
30 | * | ||
31 | * PTA0 - SWD | ||
32 | * PTA3 - SWD | ||
33 | * PTA5 - PIN25 | ||
34 | * PTA12 - PIN3 | ||
35 | * PTA13 - PIN4 | ||
36 | * PTA14 - PIN26 | ||
37 | * PTA15 - PIN27 | ||
38 | * PTA16 - PIN28 | ||
39 | * PTA17 - PIN39 | ||
40 | * PTA18 - Crystal | ||
41 | * PTA19 - Crystal | ||
42 | * PTA26 - PIN42 | ||
43 | * PTA28 - PIN40 | ||
44 | * PTA29 - PIN41 | ||
45 | * | ||
46 | */ | ||
47 | .port = IOPORT1, | ||
48 | .pads = { | ||
49 | PAL_MODE_ALTERNATIVE_7, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
50 | PAL_MODE_ALTERNATIVE_7, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, | ||
51 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
52 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
53 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
54 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
55 | PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_ANALOG, PAL_MODE_UNCONNECTED, | ||
56 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
57 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, | ||
58 | PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
59 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
60 | }, | ||
61 | }, | ||
62 | { | ||
63 | /* | ||
64 | * PORTB setup. | ||
65 | * | ||
66 | * PTB0 - PIN16 | ||
67 | * PTB1 - PIN17 | ||
68 | * PTB2 - PIN19 | ||
69 | * PTB3 - PIN18 | ||
70 | * PTB4 - PIN49 | ||
71 | * PTB5 - PIN50 | ||
72 | * PTB10 - PIN31 | ||
73 | * PTB11 - PIN32 | ||
74 | * PTB16 - PIN0 - UART0_RX | ||
75 | * PTB17 - PIN1 - UART0_TX | ||
76 | * PTB18 - PIN29 | ||
77 | * PTB19 - PIN30 | ||
78 | * PTB20 - PIN43 | ||
79 | * PTB21 - PIN46 | ||
80 | * PTB22 - PIN44 | ||
81 | * PTB23 - PIN45 | ||
82 | */ | ||
83 | .port = IOPORT2, | ||
84 | .pads = { | ||
85 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
86 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
87 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
88 | PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
89 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
90 | PAL_MODE_UNCONNECTED, PAL_MODE_ALTERNATIVE_3, PAL_MODE_ALTERNATIVE_3, | ||
91 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
92 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
93 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
94 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
95 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
96 | }, | ||
97 | }, | ||
98 | { | ||
99 | /* | ||
100 | * PORTC setup. | ||
101 | * PTC0 - PIN15 | ||
102 | * PTC1 - PIN22 | ||
103 | * PTC2 - PIN23 | ||
104 | * PTC3 - PIN9 | ||
105 | * PTC4 - PIN10 | ||
106 | * PTC5 - PIN13 | ||
107 | * PTC6 - PIN11 | ||
108 | * PTC7 - PIN12 | ||
109 | * PTC8 - PIN35 | ||
110 | * PTC9 - PIN36 | ||
111 | * PTC10 - PIN37 | ||
112 | * PTC11 - PIN38 | ||
113 | * | ||
114 | */ | ||
115 | .port = IOPORT3, | ||
116 | .pads = { | ||
117 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
118 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
119 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
120 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
121 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
122 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
123 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
124 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
125 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
126 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
127 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
128 | }, | ||
129 | }, | ||
130 | { | ||
131 | /* | ||
132 | * PORTD setup. | ||
133 | * | ||
134 | * PTD0 - PIN2 | ||
135 | * PTD1 - PIN14 | ||
136 | * PTD2 - PIN7 | ||
137 | * PTD3 - PIN8 | ||
138 | * PTD4 - PIN6 | ||
139 | * PTD5 - PIN20 | ||
140 | * PTD6 - PIN21 | ||
141 | * PTD7 - PIN5 | ||
142 | * PTD8 - PIN47 | ||
143 | * PTD9 - PIN48 | ||
144 | * PTD11 - PIN55 | ||
145 | * PTD12 - PIN53 | ||
146 | * PTD13 - PIN52 | ||
147 | * PTD14 - PIN51 | ||
148 | * PTD15 - PIN54 | ||
149 | */ | ||
150 | .port = IOPORT4, | ||
151 | .pads = { | ||
152 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
153 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
154 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
155 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, | ||
156 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
157 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
158 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
159 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
160 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
161 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
162 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
163 | }, | ||
164 | }, | ||
165 | { | ||
166 | /* | ||
167 | * PORTE setup. | ||
168 | * | ||
169 | * PTE0 - SDHC | ||
170 | * PTE1 - SDHC | ||
171 | * PTE2 - SDHC | ||
172 | * PTE3 - SDHC | ||
173 | * PTE4 - SDHC | ||
174 | * PTE5 - SDHC | ||
175 | * PTE6 - USB OTG power switch | ||
176 | * PTE10 - PIN56 | ||
177 | * PTE11 - PIN57 | ||
178 | * PTE24 - PIN33 | ||
179 | * PTE25 - PIN34 | ||
180 | * PTE26 - PIN24 | ||
181 | */ | ||
182 | .port = IOPORT5, | ||
183 | .pads = { | ||
184 | PAL_MODE_ALTERNATIVE_4, PAL_MODE_ALTERNATIVE_4, PAL_MODE_ALTERNATIVE_4, | ||
185 | PAL_MODE_ALTERNATIVE_4, PAL_MODE_ALTERNATIVE_4, PAL_MODE_ALTERNATIVE_4, | ||
186 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
187 | PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
188 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
189 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
190 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
191 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
192 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
193 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
194 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
195 | }, | ||
196 | }, | ||
197 | }, | ||
198 | }; | ||
199 | #endif | ||
200 | |||
201 | /** | ||
202 | * @brief Early initialization code. | ||
203 | * @details This initialization must be performed just after stack setup | ||
204 | * and before any other initialization. | ||
205 | */ | ||
206 | void __early_init(void) { | ||
207 | |||
208 | MK66F18_clock_init(); | ||
209 | } | ||
210 | |||
211 | /** | ||
212 | * @brief Board-specific initialization code. | ||
213 | * @todo Add your board-specific code, if any. | ||
214 | */ | ||
215 | void boardInit(void) { | ||
216 | } | ||