aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.c')
-rw-r--r--lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.c183
1 files changed, 183 insertions, 0 deletions
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.c b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.c
new file mode 100644
index 000000000..6f5eb2a65
--- /dev/null
+++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.c
@@ -0,0 +1,183 @@
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 */
24const PALConfig pal_default_config =
25{
26 .ports = {
27 {
28 /*
29 * PORTA setup.
30 *
31 * PTA4 - PIN33
32 * PTA5 - PIN24
33 * PTA12 - PIN3
34 * PTA13 - PIN4
35 *
36 * PTA18/19 crystal
37 * PTA0/3 SWD
38 */
39 .port = IOPORT1,
40 .pads = {
41 PAL_MODE_ALTERNATIVE_7, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
42 PAL_MODE_ALTERNATIVE_7, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
43 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
44 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
45 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED,
46 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
47 PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_ANALOG, PAL_MODE_UNCONNECTED,
48 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
49 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
50 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
51 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
52 },
53 },
54 {
55 /*
56 * PORTB setup.
57 *
58 * PTB0 - PIN16
59 * PTB1 - PIN17
60 * PTB2 - PIN19
61 * PTB3 - PIN18
62 * PTB16 - PIN0 - UART0_TX
63 * PTB17 - PIN1 - UART0_RX
64 * PTB18 - PIN32
65 * PTB19 - PIN25
66 */
67 .port = IOPORT2,
68 .pads = {
69 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
70 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
71 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
72 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
73 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
74 PAL_MODE_UNCONNECTED, PAL_MODE_ALTERNATIVE_3, PAL_MODE_ALTERNATIVE_3,
75 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED,
76 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
77 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
78 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
79 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
80 },
81 },
82 {
83 /*
84 * PORTC setup.
85 *
86 * PTC0 - PIN15
87 * PTC1 - PIN22
88 * PTC2 - PIN23
89 * PTC3 - PIN9
90 * PTC4 - PIN10
91 * PTC5 - PIN13
92 * PTC6 - PIN11
93 * PTC7 - PIN12
94 * PTC8 - PIN28
95 * PTC9 - PIN27
96 * PTC10 - PIN29
97 * PTC11 - PIN30
98 */
99 .port = IOPORT3,
100 .pads = {
101 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
102 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
103 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
104 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
105 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
106 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
107 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
108 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
109 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
110 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
111 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
112 },
113 },
114 {
115 /*
116 * PORTD setup.
117 *
118 * PTD0 - PIN2
119 * PTD1 - PIN14
120 * PTD2 - PIN7
121 * PTD3 - PIN8
122 * PTD4 - PIN6
123 * PTD5 - PIN20
124 * PTD6 - PIN21
125 * PTD7 - PIN5
126 */
127 .port = IOPORT4,
128 .pads = {
129 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
130 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
131 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED,
132 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
133 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
134 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
135 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
136 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
137 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
138 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
139 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
140 },
141 },
142 {
143 /*
144 * PORTE setup.
145 *
146 * PTE0 - PIN31
147 * PTE1 - PIN26
148 */
149 .port = IOPORT5,
150 .pads = {
151 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED,
152 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
153 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
154 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
155 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
156 PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
157 PAL_MODE_UNCONNECTED, 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,
162 },
163 },
164 },
165};
166#endif
167
168/**
169 * @brief Early initialization code.
170 * @details This initialization must be performed just after stack setup
171 * and before any other initialization.
172 */
173void __early_init(void) {
174
175 k20x_clock_init();
176}
177
178/**
179 * @brief Board-specific initialization code.
180 * @todo Add your board-specific code, if any.
181 */
182void boardInit(void) {
183}