diff options
author | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
commit | dc90387ce7d8ba7b607d9c48540bf6d8b560f14d (patch) | |
tree | 4ccb8fa5886b66fa9d480edef74236c27f035e16 /lib/chibios-contrib/os/hal |
Diffstat (limited to 'lib/chibios-contrib/os/hal')
559 files changed, 188505 insertions, 0 deletions
diff --git a/lib/chibios-contrib/os/hal/boards/EXP430FR5969/board.c b/lib/chibios-contrib/os/hal/boards/EXP430FR5969/board.c new file mode 100644 index 000000000..08c71112f --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/EXP430FR5969/board.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2016 Andrew Wygle aka awygle | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
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 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | {VAL_IOPORT1_OUT, VAL_IOPORT1_DIR, VAL_IOPORT1_REN, VAL_IOPORT1_SEL0, | ||
28 | VAL_IOPORT1_SEL1}, | ||
29 | {VAL_IOPORT2_OUT, VAL_IOPORT2_DIR, VAL_IOPORT2_REN, VAL_IOPORT2_SEL0, | ||
30 | VAL_IOPORT2_SEL1}, | ||
31 | {VAL_IOPORT0_OUT, VAL_IOPORT0_DIR, VAL_IOPORT0_REN, VAL_IOPORT0_SEL0, | ||
32 | VAL_IOPORT0_SEL1} | ||
33 | }; /* Set UART TX pin correctly */ | ||
34 | #endif /* HAL_USE_PAL */ | ||
35 | |||
36 | /** | ||
37 | * Board-specific initialization code. | ||
38 | */ | ||
39 | void boardInit(void) { | ||
40 | |||
41 | /* | ||
42 | * External interrupts setup, all disabled initially. | ||
43 | */ | ||
44 | _disable_interrupts(); | ||
45 | |||
46 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/EXP430FR5969/board.h b/lib/chibios-contrib/os/hal/boards/EXP430FR5969/board.h new file mode 100644 index 000000000..a0ed8f792 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/EXP430FR5969/board.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2016 Andrew Wygle aka awygle | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the EXP430FR5969 LaunchPad board | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_EXP430FR5959 | ||
28 | #define BOARD_NAME "MSP430FR5969 LaunchPad" | ||
29 | |||
30 | /* | ||
31 | * IO lines assignments. | ||
32 | */ | ||
33 | #define LINE_LED_G PAL_LINE(IOPORT1, 0U) | ||
34 | #define LINE_LED_R PAL_LINE(IOPORT2, 14U) | ||
35 | #define LINE_SW_S1 PAL_LINE(IOPORT2, 13U) | ||
36 | #define LINE_SW_S2 PAL_LINE(IOPORT1, 1U) | ||
37 | |||
38 | /* | ||
39 | * I/O ports initial setup, this configuration is established soon after reset | ||
40 | * in the initialization code. | ||
41 | * Please refer to the MSP430X Family Users Guide for details. | ||
42 | */ | ||
43 | /* | ||
44 | * Port A setup: | ||
45 | * | ||
46 | * P1.0 - Green LED (output low) | ||
47 | * P1.1 - Switch S2 (input pullup) | ||
48 | * P1.2 - BoosterPack BP19 (input pullup) | ||
49 | * P1.3 - BoosterPack BP11 (input pullup) | ||
50 | * P1.4 - BoosterPack BP12 (input pullup) | ||
51 | * P1.5 - BoosterPack BP13 (input pullup) | ||
52 | * P1.6 - BoosterPack BP15 (input pullup) | ||
53 | * P1.7 - BoosterPack BP14 (input pullup) | ||
54 | * P2.0 - Application UART TX (alternate 2) | ||
55 | * P2.1 - Application UART RX (alternate 2) | ||
56 | * P2.2 - BoosterPack BP7 (input pullup) | ||
57 | * P2.3 - N/C (input pullup) | ||
58 | * P2.4 - BoosterPack BP6 (input pullup) | ||
59 | * P2.5 - BoosterPack BP4 (input pullup) | ||
60 | * P2.6 - BoosterPack BP3 (input pullup) | ||
61 | * P2.7 - N/C (input pullup) | ||
62 | */ | ||
63 | #define VAL_IOPORT1_OUT 0xFCFE | ||
64 | #define VAL_IOPORT1_DIR 0x0001 | ||
65 | #define VAL_IOPORT1_REN 0xFCFE | ||
66 | #define VAL_IOPORT1_SEL0 0x0000 | ||
67 | #define VAL_IOPORT1_SEL1 0x0300 | ||
68 | |||
69 | /* | ||
70 | * Port B setup: | ||
71 | * | ||
72 | * P3.0 - BoosterPack BP18 (input pullup) | ||
73 | * P3.1 - N/C (input pullup) | ||
74 | * P3.2 - N/C (input pullup) | ||
75 | * P3.3 - N/C (input pullup) | ||
76 | * P3.4 - BoosterPack BP8 (input pullup) | ||
77 | * P3.5 - BoosterPack BP9 (input pullup) | ||
78 | * P3.6 - BoosterPack BP10 (input pullup) | ||
79 | * P3.7 - N/C (input pullup) | ||
80 | * P4.0 - Application UART CTS (input pullup) | ||
81 | * P4.1 - Application UART RTS (output high) | ||
82 | * P4.2 - BoosterPack BP2 (input pullup) | ||
83 | * P4.3 - BoosterPack BP5 (input pullup) | ||
84 | * P4.4 - N/C (input pullup) | ||
85 | * P4.5 - Switch S1 (input pullup) | ||
86 | * P4.6 - Red LED (output low) | ||
87 | * P4.7 - N/C (input pullup) | ||
88 | */ | ||
89 | #define VAL_IOPORT2_OUT 0xBFFF | ||
90 | #define VAL_IOPORT2_DIR 0x4200 | ||
91 | #define VAL_IOPORT2_REN 0xBDFF | ||
92 | #define VAL_IOPORT2_SEL0 0x0000 | ||
93 | #define VAL_IOPORT2_SEL1 0x0000 | ||
94 | |||
95 | /* | ||
96 | * Port J setup: | ||
97 | * | ||
98 | * PJ.0 - TDO (input pullup) | ||
99 | * PJ.1 - TDI (input pullup) | ||
100 | * PJ.2 - TMS (input pullup) | ||
101 | * PJ.3 - TCK (input pullup) | ||
102 | * PJ.4 - LFXIN (alternate 1) | ||
103 | * PJ.5 - LFXOUT (alternate 1) | ||
104 | * PJ.6 - HFXIN (N/C) (input pullup) | ||
105 | * PJ.7 - HFXOUT (N/C) (input pullup) | ||
106 | */ | ||
107 | #define VAL_IOPORT0_OUT 0x00FF | ||
108 | #define VAL_IOPORT0_DIR 0x0000 | ||
109 | #define VAL_IOPORT0_REN 0x00CF | ||
110 | #define VAL_IOPORT0_SEL0 0x0030 | ||
111 | #define VAL_IOPORT0_SEL1 0x0000 | ||
112 | |||
113 | #if !defined(_FROM_ASM_) | ||
114 | #ifdef __cplusplus | ||
115 | extern "C" { | ||
116 | #endif | ||
117 | void boardInit(void); | ||
118 | #ifdef __cplusplus | ||
119 | } | ||
120 | #endif | ||
121 | #endif /* _FROM_ASM_ */ | ||
122 | |||
123 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/EXP430FR5969/board.mk b/lib/chibios-contrib/os/hal/boards/EXP430FR5969/board.mk new file mode 100644 index 000000000..9b0d0e11f --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/EXP430FR5969/board.mk | |||
@@ -0,0 +1,8 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/EXP430FR5969/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/EXP430FR5969 | ||
6 | |||
7 | ALLINC += $(BOARDINC) | ||
8 | ALLSRC += $(BOARDSRC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/EXP430FR6989/board.c b/lib/chibios-contrib/os/hal/boards/EXP430FR6989/board.c new file mode 100644 index 000000000..309491152 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/EXP430FR6989/board.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2016 Andrew Wygle aka awygle | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
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 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | {VAL_IOPORT1_OUT, VAL_IOPORT1_DIR, VAL_IOPORT1_REN, VAL_IOPORT1_SEL0, | ||
28 | VAL_IOPORT1_SEL1}, | ||
29 | {VAL_IOPORT2_OUT, VAL_IOPORT2_DIR, VAL_IOPORT2_REN, VAL_IOPORT2_SEL0, | ||
30 | VAL_IOPORT2_SEL1}, | ||
31 | {VAL_IOPORT3_OUT, VAL_IOPORT3_DIR, VAL_IOPORT3_REN, VAL_IOPORT3_SEL0, | ||
32 | VAL_IOPORT3_SEL1}, | ||
33 | {VAL_IOPORT4_OUT, VAL_IOPORT4_DIR, VAL_IOPORT4_REN, VAL_IOPORT4_SEL0, | ||
34 | VAL_IOPORT4_SEL1}, | ||
35 | {VAL_IOPORT5_OUT, VAL_IOPORT5_DIR, VAL_IOPORT5_REN, VAL_IOPORT5_SEL0, | ||
36 | VAL_IOPORT5_SEL1}, | ||
37 | {VAL_IOPORT0_OUT, VAL_IOPORT0_DIR, VAL_IOPORT0_REN, VAL_IOPORT0_SEL0, | ||
38 | VAL_IOPORT0_SEL1} | ||
39 | }; /* Set UART TX pin correctly */ | ||
40 | #endif /* HAL_USE_PAL */ | ||
41 | |||
42 | /** | ||
43 | * Board-specific initialization code. | ||
44 | */ | ||
45 | void boardInit(void) { | ||
46 | |||
47 | /* | ||
48 | * External interrupts setup, all disabled initially. | ||
49 | */ | ||
50 | _disable_interrupts(); | ||
51 | |||
52 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/EXP430FR6989/board.h b/lib/chibios-contrib/os/hal/boards/EXP430FR6989/board.h new file mode 100644 index 000000000..4561feacc --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/EXP430FR6989/board.h | |||
@@ -0,0 +1,205 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2016 Andrew Wygle aka awygle | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the EXP430FR6989 LaunchPad board | ||
22 | */ | ||
23 | |||
24 | /* NOTE: LCD segment pins configured as unused - controlled by LCD driver if | ||
25 | * present | ||
26 | */ | ||
27 | |||
28 | /* | ||
29 | * Board identifier. | ||
30 | */ | ||
31 | #define BOARD_EXP430FR6989 | ||
32 | #define BOARD_NAME "MSP430FR6989 LaunchPad" | ||
33 | |||
34 | /* | ||
35 | * IO lines assignments. | ||
36 | */ | ||
37 | #define LINE_LED_R PAL_LINE(IOPORT1, 0U) | ||
38 | #define LINE_LED_G PAL_LINE(IOPORT5, 7U) | ||
39 | #define LINE_SW_S1 PAL_LINE(IOPORT1, 1U) | ||
40 | #define LINE_SW_S2 PAL_LINE(IOPORT1, 2U) | ||
41 | |||
42 | /* | ||
43 | * I/O ports initial setup, this configuration is established soon after reset | ||
44 | * in the initialization code. | ||
45 | * Please refer to the MSP430X Family Users Guide for details. | ||
46 | */ | ||
47 | /* | ||
48 | * Port A setup: | ||
49 | * | ||
50 | * P1.0 - Red LED (output low) | ||
51 | * P1.1 - Switch S1 (input pullup falling-edge interrupt) | ||
52 | * P1.2 - Switch S2 (input pullup falling-edge interrupt) | ||
53 | * P1.3 - BoosterPack BP34 (input pullup) | ||
54 | * P1.4 - BoosterPack BP7 (input pullup) | ||
55 | * P1.5 - BoosterPack BP18 (input pullup) | ||
56 | * P1.6 - BoosterPack BP15 (input pullup) | ||
57 | * P1.7 - BoosterPack BP14 (input pullup) | ||
58 | * P2.0 - BoosterPack BP8 (input pullup) | ||
59 | * P2.1 - BoosterPack BP19 (input pullup) | ||
60 | * P2.2 - BoosterPack BP35 (input pullup) | ||
61 | * P2.3 - BoosterPack BP31 (input pullup) | ||
62 | * P2.4 - BoosterPack BP12 (input pullup) | ||
63 | * P2.5 - BoosterPack BP13 (input pullup) | ||
64 | * P2.6 - BoosterPack BP39 (input pullup) | ||
65 | * P2.7 - BoosterPack BP40 (input pullup) | ||
66 | */ | ||
67 | #define VAL_IOPORT1_OUT 0xFFFE | ||
68 | #define VAL_IOPORT1_DIR 0x0001 | ||
69 | #define VAL_IOPORT1_REN 0xFFFE | ||
70 | #define VAL_IOPORT1_SEL0 0x0000 | ||
71 | #define VAL_IOPORT1_SEL1 0x0000 | ||
72 | |||
73 | /* | ||
74 | * Port B setup: | ||
75 | * | ||
76 | * P3.0 - BoosterPack BP33 (input pullup) | ||
77 | * P3.1 - BoosterPack BP32 (input pullup) | ||
78 | * P3.2 - BoosterPack BP5 (input pullup) | ||
79 | * P3.3 - BoosterPack BP38 (input pullup) | ||
80 | * P3.4 - Application UART TX (alternate 1) | ||
81 | * P3.5 - Application UART RX (alternate 1) | ||
82 | * P3.6 - BoosterPack BP37 (input pullup) | ||
83 | * P3.7 - BoosterPack BP36 (input pullup) | ||
84 | * P4.0 - BoosterPack BP10 (input pullup) | ||
85 | * P4.1 - BoosterPack BP9 (input pullup) | ||
86 | * P4.2 - BoosterPack BP4 (input pullup) | ||
87 | * P4.3 - BoosterPack BP3 (input pullup) | ||
88 | * P4.4 - LCD S8 (input pullup) | ||
89 | * P4.5 - LCD S7 (input pullup) | ||
90 | * P4.6 - LCD S6 (input pullup) | ||
91 | * P4.7 - BoosterPack BP11 (input pullup) | ||
92 | */ | ||
93 | #define VAL_IOPORT2_OUT 0xFFCF | ||
94 | #define VAL_IOPORT2_DIR 0x0000 | ||
95 | #define VAL_IOPORT2_REN 0xFFCF | ||
96 | #define VAL_IOPORT2_SEL0 0x0030 | ||
97 | #define VAL_IOPORT2_SEL1 0x0000 | ||
98 | |||
99 | /* | ||
100 | * Port C setup: | ||
101 | * | ||
102 | * P5.0 - LCD S38 (input pullup) | ||
103 | * P5.1 - LCD S37 (input pullup) | ||
104 | * P5.2 - LCD S36 (input pullup) | ||
105 | * P5.3 - LCD S35 (input pullup) | ||
106 | * P5.4 - LCD S12 (input pullup) | ||
107 | * P5.5 - LCD S11 (input pullup) | ||
108 | * P5.6 - LCD S10 (input pullup) | ||
109 | * P5.7 - LCD S9 (input pullup) | ||
110 | * P6.0 - LCD R23 (input pullup) | ||
111 | * P6.1 - LCD R13 (input pullup) | ||
112 | * P6.2 - LCD R03 (input pullup) | ||
113 | * P6.3 - LCD COM0 (input pullup) | ||
114 | * P6.4 - LCD COM1 (input pullup) | ||
115 | * P6.5 - LCD COM2 (input pullup) | ||
116 | * P6.6 - LCD COM3 (input pullup) | ||
117 | * P6.7 - LCD S31 (input pullup) | ||
118 | */ | ||
119 | #define VAL_IOPORT3_OUT 0xFFFF | ||
120 | #define VAL_IOPORT3_DIR 0x0000 | ||
121 | #define VAL_IOPORT3_REN 0xFFFF | ||
122 | #define VAL_IOPORT3_SEL0 0x0000 | ||
123 | #define VAL_IOPORT3_SEL1 0x0000 | ||
124 | |||
125 | /* | ||
126 | * Port D setup: | ||
127 | * | ||
128 | * P7.0 - LCD S17 (input pullup) | ||
129 | * P7.1 - LCD S16 (input pullup) | ||
130 | * P7.2 - LCD S15 (input pullup) | ||
131 | * P7.3 - LCD S14 (input pullup) | ||
132 | * P7.4 - LCD S13 (input pullup) | ||
133 | * P7.5 - LCD S30 (input pullup) | ||
134 | * P7.6 - LCD S29 (input pullup) | ||
135 | * P7.7 - LCD S27 (input pullup) | ||
136 | * P8.0 - LCD S21 (input pullup) | ||
137 | * P8.1 - LCD S20 (input pullup) | ||
138 | * P8.2 - LCD S19 (input pullup) | ||
139 | * P8.3 - LCD S18 (input pullup) | ||
140 | * P8.4 - BoosterPack BP23 (input pullup) | ||
141 | * P8.5 - BoosterPack BP24 (input pullup) | ||
142 | * P8.6 - BoosterPack BP25 (input pullup) | ||
143 | * P8.7 - BoosterPack BP26 (input pullup) | ||
144 | */ | ||
145 | #define VAL_IOPORT4_OUT 0xFFFF | ||
146 | #define VAL_IOPORT4_DIR 0x0000 | ||
147 | #define VAL_IOPORT4_REN 0xFFFF | ||
148 | #define VAL_IOPORT4_SEL0 0x0000 | ||
149 | #define VAL_IOPORT4_SEL1 0x0000 | ||
150 | |||
151 | /* | ||
152 | * Port E setup: | ||
153 | * | ||
154 | * P9.0 - BoosterPack BP27 (input pullup) | ||
155 | * P9.1 - BoosterPack BP28 (input pullup) | ||
156 | * P9.2 - BoosterPack BP2 (input pullup) | ||
157 | * P9.3 - BoosterPack BP6 (input pullup) | ||
158 | * P9.4 - BoosterPack BP17 (input pullup) | ||
159 | * P9.5 - BoosterPack BP29 (input pullup) | ||
160 | * P9.6 - BoosterPack BP30 (input pullup) | ||
161 | * P9.7 - Green LED (output low) | ||
162 | * P10.0 - LCD S4 (input pullup) | ||
163 | * P10.1 - LCD S28 (input pullup) | ||
164 | * P10.2 - LCD S39 (input pullup) | ||
165 | * P10.3 - N/C Internally (input pullup) | ||
166 | * P10.4 - N/C Internally (input pullup) | ||
167 | * P10.5 - N/C Internally (input pullup) | ||
168 | * P10.6 - N/C Internally (input pullup) | ||
169 | * P10.7 - N/C Internally (input pullup) | ||
170 | */ | ||
171 | #define VAL_IOPORT5_OUT 0xFF7F | ||
172 | #define VAL_IOPORT5_DIR 0x0080 | ||
173 | #define VAL_IOPORT5_REN 0xFF7F | ||
174 | #define VAL_IOPORT5_SEL0 0x0000 | ||
175 | #define VAL_IOPORT5_SEL1 0x0000 | ||
176 | |||
177 | /* | ||
178 | * Port J setup: | ||
179 | * | ||
180 | * PJ.0 - TDO (input pullup) | ||
181 | * PJ.1 - TDI (input pullup) | ||
182 | * PJ.2 - TMS (input pullup) | ||
183 | * PJ.3 - TCK (input pullup) | ||
184 | * PJ.4 - LFXIN (alternate 1) | ||
185 | * PJ.5 - LFXOUT (alternate 1) | ||
186 | * PJ.6 - HFXIN (N/C) (input pullup) | ||
187 | * PJ.7 - HFXOUT (N/C) (input pullup) | ||
188 | */ | ||
189 | #define VAL_IOPORT0_OUT 0x00FF | ||
190 | #define VAL_IOPORT0_DIR 0x0000 | ||
191 | #define VAL_IOPORT0_REN 0x00CF | ||
192 | #define VAL_IOPORT0_SEL0 0x0030 | ||
193 | #define VAL_IOPORT0_SEL1 0x0000 | ||
194 | |||
195 | #if !defined(_FROM_ASM_) | ||
196 | #ifdef __cplusplus | ||
197 | extern "C" { | ||
198 | #endif | ||
199 | void boardInit(void); | ||
200 | #ifdef __cplusplus | ||
201 | } | ||
202 | #endif | ||
203 | #endif /* _FROM_ASM_ */ | ||
204 | |||
205 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/EXP430FR6989/board.mk b/lib/chibios-contrib/os/hal/boards/EXP430FR6989/board.mk new file mode 100644 index 000000000..80fbb4cf6 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/EXP430FR6989/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/EXP430FR6989/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/EXP430FR6989 | ||
6 | |||
7 | ALLINC += $(BOARDINC) | ||
8 | ALLSRC += $(BOARDSRC) | ||
9 | |||
diff --git a/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.c b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.c new file mode 100644 index 000000000..afa1b8101 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | /** | ||
21 | * @brief PAL setup. | ||
22 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
23 | * This variable is used by the HAL when initializing the PAL driver. | ||
24 | */ | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | .ports = { | ||
28 | { | ||
29 | .port = IOPORT1, // PORTA | ||
30 | .pads = { | ||
31 | /* PTA0*/ PAL_MODE_ALTERNATIVE_7, /* PTA1*/ PAL_MODE_UNCONNECTED, /* PTA2*/ PAL_MODE_OUTPUT_PUSHPULL, | ||
32 | /* PTA3*/ PAL_MODE_ALTERNATIVE_7, /* PTA4*/ PAL_MODE_UNCONNECTED, /* PTA5*/ PAL_MODE_UNCONNECTED, | ||
33 | /* PTA6*/ PAL_MODE_UNCONNECTED, /* PTA7*/ PAL_MODE_UNCONNECTED, /* PTA8*/ PAL_MODE_UNCONNECTED, | ||
34 | /* PTA9*/ PAL_MODE_UNCONNECTED, /*PTA10*/ PAL_MODE_UNCONNECTED, /*PTA11*/ PAL_MODE_UNCONNECTED, | ||
35 | /*PTA12*/ PAL_MODE_UNCONNECTED, /*PTA13*/ PAL_MODE_UNCONNECTED, /*PTA14*/ PAL_MODE_UNCONNECTED, | ||
36 | /*PTA15*/ PAL_MODE_UNCONNECTED, /*PTA16*/ PAL_MODE_UNCONNECTED, /*PTA17*/ PAL_MODE_UNCONNECTED, | ||
37 | /*PTA18*/ PAL_MODE_INPUT_ANALOG, /*PTA19*/ PAL_MODE_INPUT_ANALOG, /*PTA20*/ PAL_MODE_UNCONNECTED, | ||
38 | /*PTA21*/ PAL_MODE_UNCONNECTED, /*PTA22*/ PAL_MODE_UNCONNECTED, /*PTA23*/ PAL_MODE_UNCONNECTED, | ||
39 | /*PTA24*/ PAL_MODE_UNCONNECTED, /*PTA25*/ PAL_MODE_UNCONNECTED, /*PTA26*/ PAL_MODE_UNCONNECTED, | ||
40 | /*PTA27*/ PAL_MODE_UNCONNECTED, /*PTA28*/ PAL_MODE_UNCONNECTED, /*PTA29*/ PAL_MODE_UNCONNECTED, | ||
41 | /*PTA30*/ PAL_MODE_UNCONNECTED, /*PTA31*/ PAL_MODE_UNCONNECTED, | ||
42 | }, | ||
43 | }, | ||
44 | { | ||
45 | .port = IOPORT2, // PORTB | ||
46 | .pads = { | ||
47 | /* PTB0*/ PAL_MODE_ALTERNATIVE_2, /* PTB1*/ PAL_MODE_ALTERNATIVE_2, /* PTB2*/ PAL_MODE_UNCONNECTED, | ||
48 | /* PTB3*/ PAL_MODE_UNCONNECTED, /* PTB4*/ PAL_MODE_UNCONNECTED, /* PTB5*/ PAL_MODE_UNCONNECTED, | ||
49 | /* PTB6*/ PAL_MODE_UNCONNECTED, /* PTB7*/ PAL_MODE_UNCONNECTED, /* PTB8*/ PAL_MODE_UNCONNECTED, | ||
50 | /* PTB9*/ PAL_MODE_UNCONNECTED, /*PTB10*/ PAL_MODE_UNCONNECTED, /*PTB11*/ PAL_MODE_UNCONNECTED, | ||
51 | /*PTB12*/ PAL_MODE_UNCONNECTED, /*PTB13*/ PAL_MODE_UNCONNECTED, /*PTB14*/ PAL_MODE_UNCONNECTED, | ||
52 | /*PTB15*/ PAL_MODE_UNCONNECTED, /*PTB16*/ PAL_MODE_ALTERNATIVE_3, /*PTB17*/ PAL_MODE_ALTERNATIVE_3, | ||
53 | /*PTB18*/ PAL_MODE_UNCONNECTED, /*PTB19*/ PAL_MODE_UNCONNECTED, /*PTB20*/ PAL_MODE_UNCONNECTED, | ||
54 | /*PTB21*/ PAL_MODE_UNCONNECTED, /*PTB22*/ PAL_MODE_UNCONNECTED, /*PTB23*/ PAL_MODE_UNCONNECTED, | ||
55 | /*PTB24*/ PAL_MODE_UNCONNECTED, /*PTB25*/ PAL_MODE_UNCONNECTED, /*PTB26*/ PAL_MODE_UNCONNECTED, | ||
56 | /*PTB27*/ PAL_MODE_UNCONNECTED, /*PTB28*/ PAL_MODE_UNCONNECTED, /*PTB29*/ PAL_MODE_UNCONNECTED, | ||
57 | /*PTB30*/ PAL_MODE_UNCONNECTED, /*PTB31*/ PAL_MODE_UNCONNECTED, | ||
58 | }, | ||
59 | }, | ||
60 | { | ||
61 | .port = IOPORT3, // PORTC | ||
62 | .pads = { | ||
63 | /* PTC0*/ PAL_MODE_UNCONNECTED, /* PTC1*/ PAL_MODE_UNCONNECTED, /* PTC2*/ PAL_MODE_UNCONNECTED, | ||
64 | /* PTC3*/ PAL_MODE_OUTPUT_PUSHPULL, /* PTC4*/ PAL_MODE_UNCONNECTED, /* PTC5*/ PAL_MODE_UNCONNECTED, | ||
65 | /* PTC6*/ PAL_MODE_UNCONNECTED, /* PTC7*/ PAL_MODE_UNCONNECTED, /* PTC8*/ PAL_MODE_UNCONNECTED, | ||
66 | /* PTC9*/ PAL_MODE_UNCONNECTED, /*PTC10*/ PAL_MODE_UNCONNECTED, /*PTC11*/ PAL_MODE_UNCONNECTED, | ||
67 | /*PTC12*/ PAL_MODE_UNCONNECTED, /*PTC13*/ PAL_MODE_UNCONNECTED, /*PTC14*/ PAL_MODE_UNCONNECTED, | ||
68 | /*PTC15*/ PAL_MODE_UNCONNECTED, /*PTC16*/ PAL_MODE_UNCONNECTED, /*PTC17*/ PAL_MODE_UNCONNECTED, | ||
69 | /*PTC18*/ PAL_MODE_UNCONNECTED, /*PTC19*/ PAL_MODE_UNCONNECTED, /*PTC20*/ PAL_MODE_UNCONNECTED, | ||
70 | /*PTC21*/ PAL_MODE_UNCONNECTED, /*PTC22*/ PAL_MODE_UNCONNECTED, /*PTC23*/ PAL_MODE_UNCONNECTED, | ||
71 | /*PTC24*/ PAL_MODE_UNCONNECTED, /*PTC25*/ PAL_MODE_UNCONNECTED, /*PTC26*/ PAL_MODE_UNCONNECTED, | ||
72 | /*PTC27*/ PAL_MODE_UNCONNECTED, /*PTC28*/ PAL_MODE_UNCONNECTED, /*PTC29*/ PAL_MODE_UNCONNECTED, | ||
73 | /*PTC30*/ PAL_MODE_UNCONNECTED, /*PTC31*/ PAL_MODE_UNCONNECTED, | ||
74 | }, | ||
75 | }, | ||
76 | { | ||
77 | .port = IOPORT4, // PORTD | ||
78 | .pads = { | ||
79 | /* PTD0*/ PAL_MODE_UNCONNECTED, /* PTD1*/ PAL_MODE_UNCONNECTED, /* PTD2*/ PAL_MODE_UNCONNECTED, | ||
80 | /* PTD3*/ PAL_MODE_UNCONNECTED, /* PTD4*/ PAL_MODE_OUTPUT_PUSHPULL, /* PTD5*/ PAL_MODE_UNCONNECTED, | ||
81 | /* PTD6*/ PAL_MODE_UNCONNECTED, /* PTD7*/ PAL_MODE_UNCONNECTED, /* PTD8*/ PAL_MODE_UNCONNECTED, | ||
82 | /* PTD9*/ PAL_MODE_UNCONNECTED, /*PTD10*/ PAL_MODE_UNCONNECTED, /*PTD11*/ PAL_MODE_UNCONNECTED, | ||
83 | /*PTD12*/ PAL_MODE_UNCONNECTED, /*PTD13*/ PAL_MODE_UNCONNECTED, /*PTD14*/ PAL_MODE_UNCONNECTED, | ||
84 | /*PTD15*/ PAL_MODE_UNCONNECTED, /*PTD16*/ PAL_MODE_UNCONNECTED, /*PTD17*/ PAL_MODE_UNCONNECTED, | ||
85 | /*PTD18*/ PAL_MODE_UNCONNECTED, /*PTD19*/ PAL_MODE_UNCONNECTED, /*PTD20*/ PAL_MODE_UNCONNECTED, | ||
86 | /*PTD21*/ PAL_MODE_UNCONNECTED, /*PTD22*/ PAL_MODE_UNCONNECTED, /*PTD23*/ PAL_MODE_UNCONNECTED, | ||
87 | /*PTD24*/ PAL_MODE_UNCONNECTED, /*PTD25*/ PAL_MODE_UNCONNECTED, /*PTD26*/ PAL_MODE_UNCONNECTED, | ||
88 | /*PTD27*/ PAL_MODE_UNCONNECTED, /*PTD28*/ PAL_MODE_UNCONNECTED, /*PTD29*/ PAL_MODE_UNCONNECTED, | ||
89 | /*PTD30*/ PAL_MODE_UNCONNECTED, /*PTD31*/ PAL_MODE_UNCONNECTED, | ||
90 | }, | ||
91 | }, | ||
92 | { | ||
93 | .port = IOPORT5, // PORTE | ||
94 | .pads = { | ||
95 | /* PTE0*/ PAL_MODE_UNCONNECTED, /* PTE1*/ PAL_MODE_UNCONNECTED, /* PTE2*/ PAL_MODE_UNCONNECTED, | ||
96 | /* PTE3*/ PAL_MODE_UNCONNECTED, /* PTE4*/ PAL_MODE_UNCONNECTED, /* PTE5*/ PAL_MODE_UNCONNECTED, | ||
97 | /* PTE6*/ PAL_MODE_UNCONNECTED, /* PTE7*/ PAL_MODE_UNCONNECTED, /* PTE8*/ PAL_MODE_UNCONNECTED, | ||
98 | /* PTE9*/ PAL_MODE_UNCONNECTED, /*PTE10*/ PAL_MODE_UNCONNECTED, /*PTE11*/ PAL_MODE_UNCONNECTED, | ||
99 | /*PTE12*/ PAL_MODE_UNCONNECTED, /*PTE13*/ PAL_MODE_UNCONNECTED, /*PTE14*/ PAL_MODE_UNCONNECTED, | ||
100 | /*PTE15*/ PAL_MODE_UNCONNECTED, /*PTE16*/ PAL_MODE_UNCONNECTED, /*PTE17*/ PAL_MODE_UNCONNECTED, | ||
101 | /*PTE18*/ PAL_MODE_UNCONNECTED, /*PTE19*/ PAL_MODE_UNCONNECTED, /*PTE20*/ PAL_MODE_UNCONNECTED, | ||
102 | /*PTE21*/ PAL_MODE_UNCONNECTED, /*PTE22*/ PAL_MODE_UNCONNECTED, /*PTE23*/ PAL_MODE_UNCONNECTED, | ||
103 | /*PTE24*/ PAL_MODE_UNCONNECTED, /*PTE25*/ PAL_MODE_UNCONNECTED, /*PTE26*/ PAL_MODE_UNCONNECTED, | ||
104 | /*PTE27*/ PAL_MODE_UNCONNECTED, /*PTE28*/ PAL_MODE_UNCONNECTED, /*PTE29*/ PAL_MODE_UNCONNECTED, | ||
105 | /*PTE30*/ PAL_MODE_UNCONNECTED, /*PTE31*/ PAL_MODE_UNCONNECTED, | ||
106 | }, | ||
107 | }, | ||
108 | }, | ||
109 | }; | ||
110 | #endif | ||
111 | |||
112 | /** | ||
113 | * @brief Early initialization code. | ||
114 | * @details This initialization must be performed just after stack setup | ||
115 | * and before any other initialization. | ||
116 | */ | ||
117 | void __early_init(void) { | ||
118 | |||
119 | k20x_clock_init(); | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * @brief Board-specific initialization code. | ||
124 | * @todo Add your board-specific code, if any. | ||
125 | */ | ||
126 | void boardInit(void) { | ||
127 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h new file mode 100644 index 000000000..262d06de0 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for Freescale Freedom K20D50M board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_FREESCALE_FREEDOM_K20D50M | ||
28 | #define BOARD_NAME "Freescale Freedom K20D50M" | ||
29 | |||
30 | /* External 8 MHz crystal. */ | ||
31 | #define KINETIS_XTAL_FREQUENCY 8000000UL | ||
32 | |||
33 | /* | ||
34 | * MCU type | ||
35 | */ | ||
36 | #define K20x5 | ||
37 | |||
38 | /* | ||
39 | * Onboard features. | ||
40 | */ | ||
41 | #define GPIO_LED_RED IOPORT3 | ||
42 | #define PIN_LED_RED 3 | ||
43 | #define GPIO_LED_GREEN IOPORT4 | ||
44 | #define PIN_LED_GREEN 4 | ||
45 | #define GPIO_LED_BLUE IOPORT1 | ||
46 | #define PIN_LED_BLUE 2 | ||
47 | |||
48 | /* Inertial sensor: MMA8451Q */ | ||
49 | /* Default I2C address 0x1D */ | ||
50 | #define I2C_GYRO I2C0 | ||
51 | |||
52 | #define LINE_LED_RED PAL_LINE(GPIO_LED_RED, PIN_LED_RED) | ||
53 | #define LINE_LED_GREEN PAL_LINE(GPIO_LED_GREEN, PIN_LED_GREEN) | ||
54 | #define LINE_LED_BLUE PAL_LINE(GPIO_LED_BLUE, PIN_LED_BLUE) | ||
55 | #define LINE_GYRO_SCL PAL_LINE(GPIOB, 0U) | ||
56 | #define LINE_GYRO_SDA PAL_LINE(GPIOB, 1U) | ||
57 | #define LINE_GYRO_INT1 PAL_LINE(GPIOC, 11U) | ||
58 | #define LINE_GYRO_INT2 PAL_LINE(GPIOC, 6U) | ||
59 | |||
60 | #if !defined(_FROM_ASM_) | ||
61 | #ifdef __cplusplus | ||
62 | extern "C" { | ||
63 | #endif | ||
64 | void boardInit(void); | ||
65 | #ifdef __cplusplus | ||
66 | } | ||
67 | #endif | ||
68 | #endif /* _FROM_ASM_ */ | ||
69 | |||
70 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.mk b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.mk new file mode 100644 index 000000000..9e8a23601 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/FREESCALE_FREEDOM_K20D50M | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.c b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.c new file mode 100644 index 000000000..574e6279f --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | /** | ||
21 | * @brief PAL setup. | ||
22 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
23 | * This variable is used by the HAL when initializing the PAL driver. | ||
24 | */ | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | .ports = { | ||
28 | { | ||
29 | .port = IOPORT1, // PORTA | ||
30 | .pads = { | ||
31 | /* PTA0*/ PAL_MODE_ALTERNATIVE_7, /* PTA1*/ PAL_MODE_ALTERNATIVE_2, /* PTA2*/ PAL_MODE_ALTERNATIVE_2, | ||
32 | /* PTA3*/ PAL_MODE_ALTERNATIVE_7, /* PTA4*/ PAL_MODE_INPUT_ANALOG, /* PTA5*/ PAL_MODE_INPUT_ANALOG, | ||
33 | /* PTA6*/ PAL_MODE_UNCONNECTED, /* PTA7*/ PAL_MODE_UNCONNECTED, /* PTA8*/ PAL_MODE_UNCONNECTED, | ||
34 | /* PTA9*/ PAL_MODE_UNCONNECTED, /*PTA10*/ PAL_MODE_UNCONNECTED, /*PTA11*/ PAL_MODE_UNCONNECTED, | ||
35 | /*PTA12*/ PAL_MODE_INPUT_ANALOG, /*PTA13*/ PAL_MODE_INPUT_ANALOG, /*PTA14*/ PAL_MODE_INPUT_ANALOG, | ||
36 | /*PTA15*/ PAL_MODE_INPUT_ANALOG, /*PTA16*/ PAL_MODE_INPUT_ANALOG, /*PTA17*/ PAL_MODE_INPUT_ANALOG, | ||
37 | /*PTA18*/ PAL_MODE_INPUT_ANALOG, /*PTA19*/ PAL_MODE_INPUT_ANALOG, /*PTA20*/ PAL_MODE_ALTERNATIVE_7, | ||
38 | /*PTA21*/ PAL_MODE_UNCONNECTED, /*PTA22*/ PAL_MODE_UNCONNECTED, /*PTA23*/ PAL_MODE_UNCONNECTED, | ||
39 | /*PTA24*/ PAL_MODE_UNCONNECTED, /*PTA25*/ PAL_MODE_UNCONNECTED, /*PTA26*/ PAL_MODE_UNCONNECTED, | ||
40 | /*PTA27*/ PAL_MODE_UNCONNECTED, /*PTA28*/ PAL_MODE_UNCONNECTED, /*PTA29*/ PAL_MODE_UNCONNECTED, | ||
41 | /*PTA30*/ PAL_MODE_UNCONNECTED, /*PTA31*/ PAL_MODE_UNCONNECTED, | ||
42 | }, | ||
43 | }, | ||
44 | { | ||
45 | .port = IOPORT2, // PORTB | ||
46 | .pads = { | ||
47 | /* PTB0*/ PAL_MODE_INPUT_ANALOG, /* PTB1*/ PAL_MODE_INPUT_ANALOG, /* PTB2*/ PAL_MODE_INPUT_ANALOG, | ||
48 | /* PTB3*/ PAL_MODE_INPUT_ANALOG, /* PTB4*/ PAL_MODE_UNCONNECTED, /* PTB5*/ PAL_MODE_UNCONNECTED, | ||
49 | /* PTB6*/ PAL_MODE_UNCONNECTED, /* PTB7*/ PAL_MODE_UNCONNECTED, /* PTB8*/ PAL_MODE_INPUT_ANALOG, | ||
50 | /* PTB9*/ PAL_MODE_INPUT_ANALOG, /*PTB10*/ PAL_MODE_INPUT_ANALOG, /*PTB11*/ PAL_MODE_INPUT_ANALOG, | ||
51 | /*PTB12*/ PAL_MODE_UNCONNECTED, /*PTB13*/ PAL_MODE_UNCONNECTED, /*PTB14*/ PAL_MODE_UNCONNECTED, | ||
52 | /*PTB15*/ PAL_MODE_UNCONNECTED, /*PTB16*/ PAL_MODE_INPUT_ANALOG, /*PTB17*/ PAL_MODE_INPUT_ANALOG, | ||
53 | /*PTB18*/ PAL_MODE_OUTPUT_PUSHPULL, /*PTB19*/ PAL_MODE_OUTPUT_PUSHPULL, /*PTB20*/ PAL_MODE_UNCONNECTED, | ||
54 | /*PTB21*/ PAL_MODE_UNCONNECTED, /*PTB22*/ PAL_MODE_UNCONNECTED, /*PTB23*/ PAL_MODE_UNCONNECTED, | ||
55 | /*PTB24*/ PAL_MODE_UNCONNECTED, /*PTB25*/ PAL_MODE_UNCONNECTED, /*PTB26*/ PAL_MODE_UNCONNECTED, | ||
56 | /*PTB27*/ PAL_MODE_UNCONNECTED, /*PTB28*/ PAL_MODE_UNCONNECTED, /*PTB29*/ PAL_MODE_UNCONNECTED, | ||
57 | /*PTB30*/ PAL_MODE_UNCONNECTED, /*PTB31*/ PAL_MODE_UNCONNECTED, | ||
58 | }, | ||
59 | }, | ||
60 | { | ||
61 | .port = IOPORT3, // PORTC | ||
62 | .pads = { | ||
63 | /* PTC0*/ PAL_MODE_INPUT_ANALOG, /* PTC1*/ PAL_MODE_INPUT_ANALOG, /* PTC2*/ PAL_MODE_INPUT_ANALOG, | ||
64 | /* PTC3*/ PAL_MODE_INPUT_ANALOG, /* PTC4*/ PAL_MODE_INPUT_ANALOG, /* PTC5*/ PAL_MODE_INPUT_ANALOG, | ||
65 | /* PTC6*/ PAL_MODE_INPUT_ANALOG, /* PTC7*/ PAL_MODE_INPUT_ANALOG, /* PTC8*/ PAL_MODE_INPUT_ANALOG, | ||
66 | /* PTC9*/ PAL_MODE_INPUT_ANALOG, /*PTC10*/ PAL_MODE_INPUT_ANALOG, /*PTC11*/ PAL_MODE_INPUT_ANALOG, | ||
67 | /*PTC12*/ PAL_MODE_INPUT_ANALOG, /*PTC13*/ PAL_MODE_INPUT_ANALOG, /*PTC14*/ PAL_MODE_INPUT_ANALOG, | ||
68 | /*PTC15*/ PAL_MODE_INPUT_ANALOG, /*PTC16*/ PAL_MODE_INPUT_ANALOG, /*PTC17*/ PAL_MODE_INPUT_ANALOG, | ||
69 | /*PTC18*/ PAL_MODE_UNCONNECTED, /*PTC19*/ PAL_MODE_UNCONNECTED, /*PTC20*/ PAL_MODE_UNCONNECTED, | ||
70 | /*PTC21*/ PAL_MODE_UNCONNECTED, /*PTC22*/ PAL_MODE_UNCONNECTED, /*PTC23*/ PAL_MODE_UNCONNECTED, | ||
71 | /*PTC24*/ PAL_MODE_UNCONNECTED, /*PTC25*/ PAL_MODE_UNCONNECTED, /*PTC26*/ PAL_MODE_UNCONNECTED, | ||
72 | /*PTC27*/ PAL_MODE_UNCONNECTED, /*PTC28*/ PAL_MODE_UNCONNECTED, /*PTC29*/ PAL_MODE_UNCONNECTED, | ||
73 | /*PTC30*/ PAL_MODE_UNCONNECTED, /*PTC31*/ PAL_MODE_UNCONNECTED, | ||
74 | }, | ||
75 | }, | ||
76 | { | ||
77 | .port = IOPORT4, // PORTD | ||
78 | .pads = { | ||
79 | /* PTD0*/ PAL_MODE_INPUT_ANALOG, /* PTD1*/ PAL_MODE_OUTPUT_PUSHPULL, /* PTD2*/ PAL_MODE_INPUT_ANALOG, | ||
80 | /* PTD3*/ PAL_MODE_INPUT_ANALOG, /* PTD4*/ PAL_MODE_INPUT_ANALOG, /* PTD5*/ PAL_MODE_INPUT_ANALOG, | ||
81 | /* PTD6*/ PAL_MODE_INPUT_ANALOG, /* PTD7*/ PAL_MODE_INPUT_ANALOG, /* PTD8*/ PAL_MODE_INPUT_ANALOG, | ||
82 | /* PTD9*/ PAL_MODE_UNCONNECTED, /*PTD10*/ PAL_MODE_UNCONNECTED, /*PTD11*/ PAL_MODE_UNCONNECTED, | ||
83 | /*PTD12*/ PAL_MODE_UNCONNECTED, /*PTD13*/ PAL_MODE_UNCONNECTED, /*PTD14*/ PAL_MODE_UNCONNECTED, | ||
84 | /*PTD15*/ PAL_MODE_UNCONNECTED, /*PTD16*/ PAL_MODE_UNCONNECTED, /*PTD17*/ PAL_MODE_UNCONNECTED, | ||
85 | /*PTD18*/ PAL_MODE_UNCONNECTED, /*PTD19*/ PAL_MODE_UNCONNECTED, /*PTD20*/ PAL_MODE_UNCONNECTED, | ||
86 | /*PTD21*/ PAL_MODE_UNCONNECTED, /*PTD22*/ PAL_MODE_UNCONNECTED, /*PTD23*/ PAL_MODE_UNCONNECTED, | ||
87 | /*PTD24*/ PAL_MODE_UNCONNECTED, /*PTD25*/ PAL_MODE_UNCONNECTED, /*PTD26*/ PAL_MODE_UNCONNECTED, | ||
88 | /*PTD27*/ PAL_MODE_UNCONNECTED, /*PTD28*/ PAL_MODE_UNCONNECTED, /*PTD29*/ PAL_MODE_UNCONNECTED, | ||
89 | /*PTD30*/ PAL_MODE_UNCONNECTED, /*PTD31*/ PAL_MODE_UNCONNECTED, | ||
90 | }, | ||
91 | }, | ||
92 | { | ||
93 | .port = IOPORT5, // PORTE | ||
94 | .pads = { | ||
95 | /* PTE0*/ PAL_MODE_INPUT_ANALOG, /* PTE1*/ PAL_MODE_INPUT_ANALOG, /* PTE2*/ PAL_MODE_INPUT_ANALOG, | ||
96 | /* PTE3*/ PAL_MODE_INPUT_ANALOG, /* PTE4*/ PAL_MODE_INPUT_ANALOG, /* PTE5*/ PAL_MODE_INPUT_ANALOG, | ||
97 | /* PTE6*/ PAL_MODE_UNCONNECTED, /* PTE7*/ PAL_MODE_UNCONNECTED, /* PTE8*/ PAL_MODE_UNCONNECTED, | ||
98 | /* PTE9*/ PAL_MODE_UNCONNECTED, /*PTE10*/ PAL_MODE_UNCONNECTED, /*PTE11*/ PAL_MODE_UNCONNECTED, | ||
99 | /*PTE12*/ PAL_MODE_UNCONNECTED, /*PTE13*/ PAL_MODE_UNCONNECTED, /*PTE14*/ PAL_MODE_UNCONNECTED, | ||
100 | /*PTE15*/ PAL_MODE_UNCONNECTED, /*PTE16*/ PAL_MODE_UNCONNECTED, /*PTE17*/ PAL_MODE_UNCONNECTED, | ||
101 | /*PTE18*/ PAL_MODE_UNCONNECTED, /*PTE19*/ PAL_MODE_UNCONNECTED, /*PTE20*/ PAL_MODE_INPUT_ANALOG, | ||
102 | /*PTE21*/ PAL_MODE_INPUT_ANALOG, /*PTE22*/ PAL_MODE_INPUT_ANALOG, /*PTE23*/ PAL_MODE_INPUT_ANALOG, | ||
103 | /*PTE24*/ PAL_MODE_ALTERNATIVE_5, /*PTE25*/ PAL_MODE_ALTERNATIVE_5, /*PTE26*/ PAL_MODE_UNCONNECTED, | ||
104 | /*PTE27*/ PAL_MODE_UNCONNECTED, /*PTE28*/ PAL_MODE_UNCONNECTED, /*PTE29*/ PAL_MODE_INPUT_ANALOG, | ||
105 | /*PTE30*/ PAL_MODE_INPUT_ANALOG, /*PTE31*/ PAL_MODE_INPUT_ANALOG, | ||
106 | }, | ||
107 | }, | ||
108 | }, | ||
109 | }; | ||
110 | #endif | ||
111 | |||
112 | /** | ||
113 | * @brief Early initialization code. | ||
114 | * @details This initialization must be performed just after stack setup | ||
115 | * and before any other initialization. | ||
116 | */ | ||
117 | void __early_init(void) { | ||
118 | |||
119 | kl2x_clock_init(); | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * @brief Board-specific initialization code. | ||
124 | * @todo Add your board-specific code, if any. | ||
125 | */ | ||
126 | void boardInit(void) { | ||
127 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h new file mode 100644 index 000000000..e6d8723a3 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for Freescale Freedom KL25Z board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_FREESCALE_FREEDOM_KL25Z | ||
28 | #define BOARD_NAME "Freescale Freedom KL25Z" | ||
29 | |||
30 | /* External 8 MHz crystal. */ | ||
31 | #define KINETIS_XTAL_FREQUENCY 8000000UL | ||
32 | |||
33 | /* | ||
34 | * MCU type | ||
35 | */ | ||
36 | #define KL25 | ||
37 | |||
38 | /* | ||
39 | * Onboard features. | ||
40 | */ | ||
41 | #define GPIO_LED_RED IOPORT2 | ||
42 | #define PIN_LED_RED 18 | ||
43 | #define GPIO_LED_GREEN IOPORT2 | ||
44 | #define PIN_LED_GREEN 19 | ||
45 | #define GPIO_LED_BLUE IOPORT4 | ||
46 | #define PIN_LED_BLUE 1 | ||
47 | |||
48 | /* Inertial sensor: MMA8451Q */ | ||
49 | /* Default I2C address 0x1D */ | ||
50 | /* Note: the pins PTE24/25 are assigned to I2C0 by default; | ||
51 | * if I2C0 is wanted on other pins, these need to be | ||
52 | * assigned another function explicitly! | ||
53 | */ | ||
54 | #define I2C_GYRO I2C0 | ||
55 | |||
56 | #define LINE_LED_RED PAL_LINE(GPIO_LED_RED, PIN_LED_RED) | ||
57 | #define LINE_LED_GREEN PAL_LINE(GPIO_LED_GREEN, PIN_LED_GREEN) | ||
58 | #define LINE_LED_BLUE PAL_LINE(GPIO_LED_BLUE, PIN_LED_BLUE) | ||
59 | #define LINE_GYRO_SCL PAL_LINE(GPIOE, 24U) | ||
60 | #define LINE_GYRO_SDA PAL_LINE(GPIOE, 25U) | ||
61 | #define LINE_GYRO_INT1 PAL_LINE(GPIOA, 14U) | ||
62 | #define LINE_GYRO_INT2 PAL_LINE(GPIOA, 15U) | ||
63 | |||
64 | /* | ||
65 | * Not configured: | ||
66 | * - TSI Slider on PTB16/TSI0_CH9 and PTB17/TSI_CH10 | ||
67 | */ | ||
68 | |||
69 | #if !defined(_FROM_ASM_) | ||
70 | #ifdef __cplusplus | ||
71 | extern "C" { | ||
72 | #endif | ||
73 | void boardInit(void); | ||
74 | #ifdef __cplusplus | ||
75 | } | ||
76 | #endif | ||
77 | #endif /* _FROM_ASM_ */ | ||
78 | |||
79 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.mk b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.mk new file mode 100644 index 000000000..164e5ed88 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/FREESCALE_FREEDOM_KL25Z | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.c b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.c new file mode 100644 index 000000000..ede9061ce --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 flabbergast <[email protected]> | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | /** | ||
21 | * @brief PAL setup. | ||
22 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
23 | * This variable is used by the HAL when initializing the PAL driver. | ||
24 | */ | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | .ports = { | ||
28 | { | ||
29 | .port = IOPORT1, // PORTA | ||
30 | .pads = { | ||
31 | /* PTA0*/ PAL_MODE_ALTERNATIVE_7, /* PTA1*/ PAL_MODE_ALTERNATIVE_2, /* PTA2*/ PAL_MODE_ALTERNATIVE_2, | ||
32 | /* PTA3*/ PAL_MODE_ALTERNATIVE_7, /* PTA4*/ PAL_MODE_INPUT_ANALOG, /* PTA5*/ PAL_MODE_INPUT_ANALOG, | ||
33 | /* PTA6*/ PAL_MODE_UNCONNECTED, /* PTA7*/ PAL_MODE_UNCONNECTED, /* PTA8*/ PAL_MODE_UNCONNECTED, | ||
34 | /* PTA9*/ PAL_MODE_UNCONNECTED, /*PTA10*/ PAL_MODE_UNCONNECTED, /*PTA11*/ PAL_MODE_UNCONNECTED, | ||
35 | /*PTA12*/ PAL_MODE_INPUT_ANALOG, /*PTA13*/ PAL_MODE_INPUT_ANALOG, /*PTA14*/ PAL_MODE_UNCONNECTED, | ||
36 | /*PTA15*/ PAL_MODE_UNCONNECTED, /*PTA16*/ PAL_MODE_UNCONNECTED, /*PTA17*/ PAL_MODE_UNCONNECTED, | ||
37 | /*PTA18*/ PAL_MODE_INPUT_ANALOG, /*PTA19*/ PAL_MODE_INPUT_ANALOG, /*PTA20*/ PAL_MODE_ALTERNATIVE_7, | ||
38 | /*PTA21*/ PAL_MODE_UNCONNECTED, /*PTA22*/ PAL_MODE_UNCONNECTED, /*PTA23*/ PAL_MODE_UNCONNECTED, | ||
39 | /*PTA24*/ PAL_MODE_UNCONNECTED, /*PTA25*/ PAL_MODE_UNCONNECTED, /*PTA26*/ PAL_MODE_UNCONNECTED, | ||
40 | /*PTA27*/ PAL_MODE_UNCONNECTED, /*PTA28*/ PAL_MODE_UNCONNECTED, /*PTA29*/ PAL_MODE_UNCONNECTED, | ||
41 | /*PTA30*/ PAL_MODE_UNCONNECTED, /*PTA31*/ PAL_MODE_UNCONNECTED, | ||
42 | }, | ||
43 | }, | ||
44 | { | ||
45 | .port = IOPORT2, // PORTB | ||
46 | .pads = { | ||
47 | /* PTB0*/ PAL_MODE_INPUT_ANALOG, /* PTB1*/ PAL_MODE_INPUT_ANALOG, /* PTB2*/ PAL_MODE_INPUT_ANALOG, | ||
48 | /* PTB3*/ PAL_MODE_INPUT_ANALOG, /* PTB4*/ PAL_MODE_UNCONNECTED, /* PTB5*/ PAL_MODE_UNCONNECTED, | ||
49 | /* PTB6*/ PAL_MODE_UNCONNECTED, /* PTB7*/ PAL_MODE_UNCONNECTED, /* PTB8*/ PAL_MODE_INPUT_ANALOG, | ||
50 | /* PTB9*/ PAL_MODE_UNCONNECTED, /*PTB10*/ PAL_MODE_UNCONNECTED, /*PTB11*/ PAL_MODE_UNCONNECTED, | ||
51 | /*PTB12*/ PAL_MODE_UNCONNECTED, /*PTB13*/ PAL_MODE_UNCONNECTED, /*PTB14*/ PAL_MODE_UNCONNECTED, | ||
52 | /*PTB15*/ PAL_MODE_UNCONNECTED, /*PTB16*/ PAL_MODE_INPUT_ANALOG, /*PTB17*/ PAL_MODE_INPUT_ANALOG, | ||
53 | /*PTB18*/ PAL_MODE_INPUT_ANALOG, /*PTB19*/ PAL_MODE_INPUT_ANALOG, /*PTB20*/ PAL_MODE_UNCONNECTED, | ||
54 | /*PTB21*/ PAL_MODE_UNCONNECTED, /*PTB22*/ PAL_MODE_UNCONNECTED, /*PTB23*/ PAL_MODE_UNCONNECTED, | ||
55 | /*PTB24*/ PAL_MODE_UNCONNECTED, /*PTB25*/ PAL_MODE_UNCONNECTED, /*PTB26*/ PAL_MODE_UNCONNECTED, | ||
56 | /*PTB27*/ PAL_MODE_UNCONNECTED, /*PTB28*/ PAL_MODE_UNCONNECTED, /*PTB29*/ PAL_MODE_UNCONNECTED, | ||
57 | /*PTB30*/ PAL_MODE_UNCONNECTED, /*PTB31*/ PAL_MODE_UNCONNECTED, | ||
58 | }, | ||
59 | }, | ||
60 | { | ||
61 | .port = IOPORT3, // PORTC | ||
62 | .pads = { | ||
63 | /* PTC0*/ PAL_MODE_INPUT_ANALOG, /* PTC1*/ PAL_MODE_INPUT_ANALOG, /* PTC2*/ PAL_MODE_INPUT_ANALOG, | ||
64 | /* PTC3*/ PAL_MODE_INPUT, /* PTC4*/ PAL_MODE_INPUT_ANALOG, /* PTC5*/ PAL_MODE_INPUT_ANALOG, | ||
65 | /* PTC6*/ PAL_MODE_INPUT_ANALOG, /* PTC7*/ PAL_MODE_INPUT_ANALOG, /* PTC8*/ PAL_MODE_INPUT_ANALOG, | ||
66 | /* PTC9*/ PAL_MODE_INPUT_ANALOG, /*PTC10*/ PAL_MODE_INPUT_ANALOG, /*PTC11*/ PAL_MODE_INPUT_ANALOG, | ||
67 | /*PTC12*/ PAL_MODE_UNCONNECTED, /*PTC13*/ PAL_MODE_UNCONNECTED, /*PTC14*/ PAL_MODE_UNCONNECTED, | ||
68 | /*PTC15*/ PAL_MODE_UNCONNECTED, /*PTC16*/ PAL_MODE_UNCONNECTED, /*PTC17*/ PAL_MODE_UNCONNECTED, | ||
69 | /*PTC18*/ PAL_MODE_UNCONNECTED, /*PTC19*/ PAL_MODE_UNCONNECTED, /*PTC20*/ PAL_MODE_UNCONNECTED, | ||
70 | /*PTC21*/ PAL_MODE_UNCONNECTED, /*PTC22*/ PAL_MODE_UNCONNECTED, /*PTC23*/ PAL_MODE_UNCONNECTED, | ||
71 | /*PTC24*/ PAL_MODE_UNCONNECTED, /*PTC25*/ PAL_MODE_UNCONNECTED, /*PTC26*/ PAL_MODE_UNCONNECTED, | ||
72 | /*PTC27*/ PAL_MODE_UNCONNECTED, /*PTC28*/ PAL_MODE_UNCONNECTED, /*PTC29*/ PAL_MODE_UNCONNECTED, | ||
73 | /*PTC30*/ PAL_MODE_UNCONNECTED, /*PTC31*/ PAL_MODE_UNCONNECTED, | ||
74 | }, | ||
75 | }, | ||
76 | { | ||
77 | .port = IOPORT4, // PORTD | ||
78 | .pads = { | ||
79 | /* PTD0*/ PAL_MODE_INPUT_PULLUP, /* PTD1*/ PAL_MODE_INPUT_ANALOG, /* PTD2*/ PAL_MODE_INPUT_ANALOG, | ||
80 | /* PTD3*/ PAL_MODE_INPUT_ANALOG, /* PTD4*/ PAL_MODE_INPUT_ANALOG, /* PTD5*/ PAL_MODE_OUTPUT_PUSHPULL, | ||
81 | /* PTD6*/ PAL_MODE_INPUT_ANALOG, /* PTD7*/ PAL_MODE_INPUT_ANALOG, /* PTD8*/ PAL_MODE_UNCONNECTED, | ||
82 | /* PTD9*/ PAL_MODE_UNCONNECTED, /*PTD10*/ PAL_MODE_UNCONNECTED, /*PTD11*/ PAL_MODE_UNCONNECTED, | ||
83 | /*PTD12*/ PAL_MODE_UNCONNECTED, /*PTD13*/ PAL_MODE_UNCONNECTED, /*PTD14*/ PAL_MODE_UNCONNECTED, | ||
84 | /*PTD15*/ PAL_MODE_UNCONNECTED, /*PTD16*/ PAL_MODE_UNCONNECTED, /*PTD17*/ PAL_MODE_UNCONNECTED, | ||
85 | /*PTD18*/ PAL_MODE_UNCONNECTED, /*PTD19*/ PAL_MODE_UNCONNECTED, /*PTD20*/ PAL_MODE_UNCONNECTED, | ||
86 | /*PTD21*/ PAL_MODE_UNCONNECTED, /*PTD22*/ PAL_MODE_UNCONNECTED, /*PTD23*/ PAL_MODE_UNCONNECTED, | ||
87 | /*PTD24*/ PAL_MODE_UNCONNECTED, /*PTD25*/ PAL_MODE_UNCONNECTED, /*PTD26*/ PAL_MODE_UNCONNECTED, | ||
88 | /*PTD27*/ PAL_MODE_UNCONNECTED, /*PTD28*/ PAL_MODE_UNCONNECTED, /*PTD29*/ PAL_MODE_UNCONNECTED, | ||
89 | /*PTD30*/ PAL_MODE_UNCONNECTED, /*PTD31*/ PAL_MODE_UNCONNECTED, | ||
90 | }, | ||
91 | }, | ||
92 | { | ||
93 | .port = IOPORT5, // PORTE | ||
94 | .pads = { | ||
95 | /* PTE0*/ PAL_MODE_INPUT_ANALOG, /* PTE1*/ PAL_MODE_INPUT_ANALOG, /* PTE2*/ PAL_MODE_UNCONNECTED, | ||
96 | /* PTE3*/ PAL_MODE_UNCONNECTED, /* PTE4*/ PAL_MODE_UNCONNECTED, /* PTE5*/ PAL_MODE_UNCONNECTED, | ||
97 | /* PTE6*/ PAL_MODE_UNCONNECTED, /* PTE7*/ PAL_MODE_UNCONNECTED, /* PTE8*/ PAL_MODE_UNCONNECTED, | ||
98 | /* PTE9*/ PAL_MODE_UNCONNECTED, /*PTE10*/ PAL_MODE_UNCONNECTED, /*PTE11*/ PAL_MODE_UNCONNECTED, | ||
99 | /*PTE12*/ PAL_MODE_UNCONNECTED, /*PTE13*/ PAL_MODE_UNCONNECTED, /*PTE14*/ PAL_MODE_UNCONNECTED, | ||
100 | /*PTE15*/ PAL_MODE_UNCONNECTED, /*PTE16*/ PAL_MODE_UNCONNECTED, /*PTE17*/ PAL_MODE_UNCONNECTED, | ||
101 | /*PTE18*/ PAL_MODE_UNCONNECTED, /*PTE19*/ PAL_MODE_UNCONNECTED, /*PTE20*/ PAL_MODE_INPUT_ANALOG, | ||
102 | /*PTE21*/ PAL_MODE_INPUT_ANALOG, /*PTE22*/ PAL_MODE_INPUT, /*PTE23*/ PAL_MODE_INPUT_ANALOG, | ||
103 | /*PTE24*/ PAL_MODE_ALTERNATIVE_5, /*PTE25*/ PAL_MODE_ALTERNATIVE_5, /*PTE26*/ PAL_MODE_UNCONNECTED, | ||
104 | /*PTE27*/ PAL_MODE_UNCONNECTED, /*PTE28*/ PAL_MODE_UNCONNECTED, /*PTE29*/ PAL_MODE_OUTPUT_PUSHPULL, | ||
105 | /*PTE30*/ PAL_MODE_INPUT_ANALOG, /*PTE31*/ PAL_MODE_OUTPUT_PUSHPULL, | ||
106 | }, | ||
107 | }, | ||
108 | }, | ||
109 | }; | ||
110 | #endif | ||
111 | |||
112 | /** | ||
113 | * @brief Early initialization code. | ||
114 | * @details This initialization must be performed just after stack setup | ||
115 | * and before any other initialization. | ||
116 | */ | ||
117 | void __early_init(void) { | ||
118 | |||
119 | kl2x_clock_init(); | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * @brief Board-specific initialization code. | ||
124 | * @todo Add your board-specific code, if any. | ||
125 | */ | ||
126 | void boardInit(void) { | ||
127 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h new file mode 100644 index 000000000..838094a0a --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2016 flabbergast <[email protected]> | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for Freescale Freedom KL26Z board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_FREESCALE_FREEDOM_KL26Z | ||
28 | #define BOARD_NAME "Freescale Freedom KL26Z" | ||
29 | |||
30 | /* External 8 MHz crystal. */ | ||
31 | #define KINETIS_XTAL_FREQUENCY 8000000UL | ||
32 | |||
33 | /* | ||
34 | * MCU type | ||
35 | */ | ||
36 | #define KL26 | ||
37 | |||
38 | /* | ||
39 | * Onboard features. | ||
40 | */ | ||
41 | #define GPIO_LED_RED IOPORT5 | ||
42 | #define PIN_LED_RED 29 | ||
43 | #define GPIO_LED_GREEN IOPORT5 | ||
44 | #define PIN_LED_GREEN 31 | ||
45 | #define GPIO_LED_BLUE IOPORT4 | ||
46 | #define PIN_LED_BLUE 5 | ||
47 | #define GPIO_BUTTON IOPORT4 | ||
48 | #define PIN_BUTTON 0 | ||
49 | #define GPIO_LIGHT_SENSOR IOPORT5 | ||
50 | #define PIN_LIGHT_SENSOR 22 | ||
51 | |||
52 | /* Inertial sensor: FXOS8700CQ */ | ||
53 | /* Default I2C address 0x1D */ | ||
54 | /* Note: the pins PTE24/25 are assigned to I2C0 by default; | ||
55 | * if I2C0 is wanted on other pins, these need to be | ||
56 | * assigned another function explicitly! | ||
57 | */ | ||
58 | #define I2C_GYRO I2C0 | ||
59 | |||
60 | #define LINE_LED_RED PAL_LINE(GPIO_LED_RED, PIN_LED_RED) | ||
61 | #define LINE_LED_GREEN PAL_LINE(GPIO_LED_GREEN, PIN_LED_GREEN) | ||
62 | #define LINE_LED_BLUE PAL_LINE(GPIO_LED_BLUE, PIN_LED_BLUE) | ||
63 | #define LINE_BUTTON PAL_LINE(GPIO_BUTTON, PIN_BUTTON) | ||
64 | #define LINE_LIGHT_SENSOR PAL_LINE(GPIO_LIGHT_SENSOR, PIN_LIGHT_SENSOR) | ||
65 | #define LINE_GYRO_SCL PAL_LINE(GPIOE, 24U) | ||
66 | #define LINE_GYRO_SDA PAL_LINE(GPIOE, 25U) | ||
67 | #define LINE_GYRO_INT1 PAL_LINE(GPIOD, 0U) | ||
68 | #define LINE_GYRO_INT2 PAL_LINE(GPIOD, 1U) | ||
69 | |||
70 | /* | ||
71 | * Not configured: | ||
72 | * - TSI Slider on PTB16/TSI0_CH9 and PTB17/TSI_CH10 | ||
73 | * - I2C inertial sensor on I2C0, routed to PTE25 and PTE25 | ||
74 | * Note: these pins are assigned to I2C0 by default; | ||
75 | * if I2C0 is wanted on other pins, these need to be | ||
76 | * assigned another function explicitly! | ||
77 | */ | ||
78 | |||
79 | #if !defined(_FROM_ASM_) | ||
80 | #ifdef __cplusplus | ||
81 | extern "C" { | ||
82 | #endif | ||
83 | void boardInit(void); | ||
84 | #ifdef __cplusplus | ||
85 | } | ||
86 | #endif | ||
87 | #endif /* _FROM_ASM_ */ | ||
88 | |||
89 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.mk b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.mk new file mode 100644 index 000000000..9df27479e --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/FREESCALE_FREEDOM_KL26Z | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/MCHCK_K20/board.c b/lib/chibios-contrib/os/hal/boards/MCHCK_K20/board.c new file mode 100644 index 000000000..109e36125 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/MCHCK_K20/board.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | /** | ||
21 | * @brief PAL setup. | ||
22 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
23 | * This variable is used by the HAL when initializing the PAL driver. | ||
24 | */ | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | .ports = { | ||
28 | { | ||
29 | .port = IOPORT1, // PORTA | ||
30 | .pads = { | ||
31 | /* PTA0*/ PAL_MODE_ALTERNATIVE_7, /* PTA1*/ PAL_MODE_UNCONNECTED, /* PTA2*/ PAL_MODE_UNCONNECTED, | ||
32 | /* PTA3*/ PAL_MODE_ALTERNATIVE_7, /* PTA4*/ PAL_MODE_UNCONNECTED, /* PTA5*/ PAL_MODE_UNCONNECTED, | ||
33 | /* PTA6*/ PAL_MODE_UNCONNECTED, /* PTA7*/ PAL_MODE_UNCONNECTED, /* PTA8*/ PAL_MODE_UNCONNECTED, | ||
34 | /* PTA9*/ PAL_MODE_UNCONNECTED, /*PTA10*/ PAL_MODE_UNCONNECTED, /*PTA11*/ PAL_MODE_UNCONNECTED, | ||
35 | /*PTA12*/ PAL_MODE_UNCONNECTED, /*PTA13*/ PAL_MODE_UNCONNECTED, /*PTA14*/ PAL_MODE_UNCONNECTED, | ||
36 | /*PTA15*/ PAL_MODE_UNCONNECTED, /*PTA16*/ PAL_MODE_UNCONNECTED, /*PTA17*/ PAL_MODE_UNCONNECTED, | ||
37 | /*PTA18*/ PAL_MODE_UNCONNECTED, /*PTA19*/ PAL_MODE_UNCONNECTED, /*PTA20*/ PAL_MODE_UNCONNECTED, | ||
38 | /*PTA21*/ PAL_MODE_UNCONNECTED, /*PTA22*/ PAL_MODE_UNCONNECTED, /*PTA23*/ PAL_MODE_UNCONNECTED, | ||
39 | /*PTA24*/ PAL_MODE_UNCONNECTED, /*PTA25*/ PAL_MODE_UNCONNECTED, /*PTA26*/ PAL_MODE_UNCONNECTED, | ||
40 | /*PTA27*/ PAL_MODE_UNCONNECTED, /*PTA28*/ PAL_MODE_UNCONNECTED, /*PTA29*/ PAL_MODE_UNCONNECTED, | ||
41 | /*PTA30*/ PAL_MODE_UNCONNECTED, /*PTA31*/ PAL_MODE_UNCONNECTED, | ||
42 | }, | ||
43 | }, | ||
44 | { | ||
45 | .port = IOPORT2, // PORTB | ||
46 | .pads = { | ||
47 | /* PTB0*/ PAL_MODE_UNCONNECTED, /* PTB1*/ PAL_MODE_UNCONNECTED, /* PTB2*/ PAL_MODE_UNCONNECTED, | ||
48 | /* PTB3*/ PAL_MODE_UNCONNECTED, /* PTB4*/ PAL_MODE_UNCONNECTED, /* PTB5*/ PAL_MODE_UNCONNECTED, | ||
49 | /* PTB6*/ PAL_MODE_UNCONNECTED, /* PTB7*/ PAL_MODE_UNCONNECTED, /* PTB8*/ PAL_MODE_UNCONNECTED, | ||
50 | /* PTB9*/ PAL_MODE_UNCONNECTED, /*PTB10*/ PAL_MODE_UNCONNECTED, /*PTB11*/ PAL_MODE_UNCONNECTED, | ||
51 | /*PTB12*/ PAL_MODE_UNCONNECTED, /*PTB13*/ PAL_MODE_UNCONNECTED, /*PTB14*/ PAL_MODE_UNCONNECTED, | ||
52 | /*PTB15*/ PAL_MODE_UNCONNECTED, /*PTB16*/ PAL_MODE_OUTPUT_PUSHPULL, /*PTB17*/ PAL_MODE_UNCONNECTED, | ||
53 | /*PTB18*/ PAL_MODE_UNCONNECTED, /*PTB19*/ PAL_MODE_UNCONNECTED, /*PTB20*/ PAL_MODE_UNCONNECTED, | ||
54 | /*PTB21*/ PAL_MODE_UNCONNECTED, /*PTB22*/ PAL_MODE_UNCONNECTED, /*PTB23*/ PAL_MODE_UNCONNECTED, | ||
55 | /*PTB24*/ PAL_MODE_UNCONNECTED, /*PTB25*/ PAL_MODE_UNCONNECTED, /*PTB26*/ PAL_MODE_UNCONNECTED, | ||
56 | /*PTB27*/ PAL_MODE_UNCONNECTED, /*PTB28*/ PAL_MODE_UNCONNECTED, /*PTB29*/ PAL_MODE_UNCONNECTED, | ||
57 | /*PTB30*/ PAL_MODE_UNCONNECTED, /*PTB31*/ PAL_MODE_UNCONNECTED, | ||
58 | }, | ||
59 | }, | ||
60 | { | ||
61 | .port = IOPORT3, // PORTC | ||
62 | .pads = { | ||
63 | /* PTC0*/ PAL_MODE_UNCONNECTED, /* PTC1*/ PAL_MODE_UNCONNECTED, /* PTC2*/ PAL_MODE_UNCONNECTED, | ||
64 | /* PTC3*/ PAL_MODE_UNCONNECTED, /* PTC4*/ PAL_MODE_UNCONNECTED, /* PTC5*/ PAL_MODE_UNCONNECTED, | ||
65 | /* PTC6*/ PAL_MODE_UNCONNECTED, /* PTC7*/ PAL_MODE_UNCONNECTED, /* PTC8*/ PAL_MODE_UNCONNECTED, | ||
66 | /* PTC9*/ PAL_MODE_UNCONNECTED, /*PTC10*/ PAL_MODE_UNCONNECTED, /*PTC11*/ PAL_MODE_UNCONNECTED, | ||
67 | /*PTC12*/ PAL_MODE_UNCONNECTED, /*PTC13*/ PAL_MODE_UNCONNECTED, /*PTC14*/ PAL_MODE_UNCONNECTED, | ||
68 | /*PTC15*/ PAL_MODE_UNCONNECTED, /*PTC16*/ PAL_MODE_UNCONNECTED, /*PTC17*/ PAL_MODE_UNCONNECTED, | ||
69 | /*PTC18*/ PAL_MODE_UNCONNECTED, /*PTC19*/ PAL_MODE_UNCONNECTED, /*PTC20*/ PAL_MODE_UNCONNECTED, | ||
70 | /*PTC21*/ PAL_MODE_UNCONNECTED, /*PTC22*/ PAL_MODE_UNCONNECTED, /*PTC23*/ PAL_MODE_UNCONNECTED, | ||
71 | /*PTC24*/ PAL_MODE_UNCONNECTED, /*PTC25*/ PAL_MODE_UNCONNECTED, /*PTC26*/ PAL_MODE_UNCONNECTED, | ||
72 | /*PTC27*/ PAL_MODE_UNCONNECTED, /*PTC28*/ PAL_MODE_UNCONNECTED, /*PTC29*/ PAL_MODE_UNCONNECTED, | ||
73 | /*PTC30*/ PAL_MODE_UNCONNECTED, /*PTC31*/ PAL_MODE_UNCONNECTED, | ||
74 | }, | ||
75 | }, | ||
76 | { | ||
77 | .port = IOPORT4, // PORTD | ||
78 | .pads = { | ||
79 | /* PTD0*/ PAL_MODE_UNCONNECTED, /* PTD1*/ PAL_MODE_UNCONNECTED, /* PTD2*/ PAL_MODE_UNCONNECTED, | ||
80 | /* PTD3*/ PAL_MODE_UNCONNECTED, /* PTD4*/ PAL_MODE_UNCONNECTED, /* PTD5*/ PAL_MODE_UNCONNECTED, | ||
81 | /* PTD6*/ PAL_MODE_UNCONNECTED, /* PTD7*/ PAL_MODE_UNCONNECTED, /* PTD8*/ PAL_MODE_UNCONNECTED, | ||
82 | /* PTD9*/ PAL_MODE_UNCONNECTED, /*PTD10*/ PAL_MODE_UNCONNECTED, /*PTD11*/ PAL_MODE_UNCONNECTED, | ||
83 | /*PTD12*/ PAL_MODE_UNCONNECTED, /*PTD13*/ PAL_MODE_UNCONNECTED, /*PTD14*/ PAL_MODE_UNCONNECTED, | ||
84 | /*PTD15*/ PAL_MODE_UNCONNECTED, /*PTD16*/ PAL_MODE_UNCONNECTED, /*PTD17*/ PAL_MODE_UNCONNECTED, | ||
85 | /*PTD18*/ PAL_MODE_UNCONNECTED, /*PTD19*/ PAL_MODE_UNCONNECTED, /*PTD20*/ PAL_MODE_UNCONNECTED, | ||
86 | /*PTD21*/ PAL_MODE_UNCONNECTED, /*PTD22*/ PAL_MODE_UNCONNECTED, /*PTD23*/ PAL_MODE_UNCONNECTED, | ||
87 | /*PTD24*/ PAL_MODE_UNCONNECTED, /*PTD25*/ PAL_MODE_UNCONNECTED, /*PTD26*/ PAL_MODE_UNCONNECTED, | ||
88 | /*PTD27*/ PAL_MODE_UNCONNECTED, /*PTD28*/ PAL_MODE_UNCONNECTED, /*PTD29*/ PAL_MODE_UNCONNECTED, | ||
89 | /*PTD30*/ PAL_MODE_UNCONNECTED, /*PTD31*/ PAL_MODE_UNCONNECTED, | ||
90 | }, | ||
91 | }, | ||
92 | { | ||
93 | .port = IOPORT5, // PORTE | ||
94 | .pads = { | ||
95 | /* PTE0*/ PAL_MODE_UNCONNECTED, /* PTE1*/ PAL_MODE_UNCONNECTED, /* PTE2*/ PAL_MODE_UNCONNECTED, | ||
96 | /* PTE3*/ PAL_MODE_UNCONNECTED, /* PTE4*/ PAL_MODE_UNCONNECTED, /* PTE5*/ PAL_MODE_UNCONNECTED, | ||
97 | /* PTE6*/ PAL_MODE_UNCONNECTED, /* PTE7*/ PAL_MODE_UNCONNECTED, /* PTE8*/ PAL_MODE_UNCONNECTED, | ||
98 | /* PTE9*/ PAL_MODE_UNCONNECTED, /*PTE10*/ PAL_MODE_UNCONNECTED, /*PTE11*/ PAL_MODE_UNCONNECTED, | ||
99 | /*PTE12*/ PAL_MODE_UNCONNECTED, /*PTE13*/ PAL_MODE_UNCONNECTED, /*PTE14*/ PAL_MODE_UNCONNECTED, | ||
100 | /*PTE15*/ PAL_MODE_UNCONNECTED, /*PTE16*/ PAL_MODE_UNCONNECTED, /*PTE17*/ PAL_MODE_UNCONNECTED, | ||
101 | /*PTE18*/ PAL_MODE_UNCONNECTED, /*PTE19*/ PAL_MODE_UNCONNECTED, /*PTE20*/ PAL_MODE_UNCONNECTED, | ||
102 | /*PTE21*/ PAL_MODE_UNCONNECTED, /*PTE22*/ PAL_MODE_UNCONNECTED, /*PTE23*/ PAL_MODE_UNCONNECTED, | ||
103 | /*PTE24*/ PAL_MODE_UNCONNECTED, /*PTE25*/ PAL_MODE_UNCONNECTED, /*PTE26*/ PAL_MODE_UNCONNECTED, | ||
104 | /*PTE27*/ PAL_MODE_UNCONNECTED, /*PTE28*/ PAL_MODE_UNCONNECTED, /*PTE29*/ PAL_MODE_UNCONNECTED, | ||
105 | /*PTE30*/ PAL_MODE_UNCONNECTED, /*PTE31*/ PAL_MODE_UNCONNECTED, | ||
106 | }, | ||
107 | }, | ||
108 | }, | ||
109 | }; | ||
110 | #endif | ||
111 | |||
112 | /** | ||
113 | * @brief Early initialization code. | ||
114 | * @details This initialization must be performed just after stack setup | ||
115 | * and before any other initialization. | ||
116 | */ | ||
117 | void __early_init(void) { | ||
118 | |||
119 | k20x_clock_init(); | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * @brief Board-specific initialization code. | ||
124 | * @todo Add your board-specific code, if any. | ||
125 | */ | ||
126 | void boardInit(void) { | ||
127 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/MCHCK_K20/board.h b/lib/chibios-contrib/os/hal/boards/MCHCK_K20/board.h new file mode 100644 index 000000000..701d55dd9 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/MCHCK_K20/board.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for MCHCL K20 board with MX20DX128 processor. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_MCHCK_K20_MX20DX128 | ||
28 | #define BOARD_NAME "MCHCK K20 MX20DX128" | ||
29 | |||
30 | /* | ||
31 | * MCU type | ||
32 | */ | ||
33 | #define K20x5 | ||
34 | |||
35 | #define GPIOB_LED 16 | ||
36 | |||
37 | #define LINE_LED PAL_LINE(GPIOB, GPIOB_LED) | ||
38 | |||
39 | #if !defined(_FROM_ASM_) | ||
40 | #ifdef __cplusplus | ||
41 | extern "C" { | ||
42 | #endif | ||
43 | void boardInit(void); | ||
44 | #ifdef __cplusplus | ||
45 | } | ||
46 | #endif | ||
47 | #endif /* _FROM_ASM_ */ | ||
48 | |||
49 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/MCHCK_K20/board.mk b/lib/chibios-contrib/os/hal/boards/MCHCK_K20/board.mk new file mode 100644 index 000000000..cbd24d791 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/MCHCK_K20/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/MCHCK_K20/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/MCHCK_K20 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/MICROBIT/board.c b/lib/chibios-contrib/os/hal/boards/MICROBIT/board.c new file mode 100644 index 000000000..12f78e29b --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/MICROBIT/board.c | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | Copyright (C) 2017 Stéphane D'Alu | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | |||
21 | /* RAM Banks | ||
22 | * (Values are defined in Nordic gcc_startup_nrf51.s) | ||
23 | */ | ||
24 | #define NRF_POWER_RAMON_ADDRESS 0x40000524 | ||
25 | #define NRF_POWER_RAMONB_ADDRESS 0x40000554 | ||
26 | #define NRF_POWER_RAMONx_RAMxON_ONMODE_Msk 0x3 | ||
27 | |||
28 | /** | ||
29 | * @brief PAL setup. | ||
30 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
31 | * This variable is used by the HAL when initializing the PAL driver. | ||
32 | */ | ||
33 | const PALConfig pal_default_config = | ||
34 | { | ||
35 | .pads = { | ||
36 | PAL_MODE_OUTPUT_OPENDRAIN, /* P0.0 : SCL P19 */ | ||
37 | PAL_MODE_UNCONNECTED, /* P0.1 : PAD1 P2 */ | ||
38 | PAL_MODE_UNCONNECTED, /* P0.2 : PAD2 P1 */ | ||
39 | PAL_MODE_UNCONNECTED, /* P0.3 : PAD3 P0 */ | ||
40 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.4 : COL1 P3 */ | ||
41 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.5 : COL2 P4 */ | ||
42 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.6 : COL3 P10 */ | ||
43 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.7 : COL4 */ | ||
44 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.8 : COL5 */ | ||
45 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.9 : COL6 */ | ||
46 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.10: COL7 P9 */ | ||
47 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.11: COL8 P7 */ | ||
48 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.12: COL9 P6 */ | ||
49 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.13: ROW1 */ | ||
50 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.14: ROW2 */ | ||
51 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.15: ROW3 */ | ||
52 | PAL_MODE_UNCONNECTED, /* P0.16 P16 */ | ||
53 | PAL_MODE_INPUT, /* P0.17: BTN_A P5 */ | ||
54 | PAL_MODE_UNCONNECTED, /* P0.18 P8 */ | ||
55 | PAL_MODE_INPUT, /* P0.19: BTN_RST */ | ||
56 | PAL_MODE_UNCONNECTED, /* P0.20 P12 */ | ||
57 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.21: SPI_MOSI P15 */ | ||
58 | PAL_MODE_INPUT_PULLUP, /* P0.22: SPI_MISO P14 */ | ||
59 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.23: SPI_SCK P13 */ | ||
60 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.24: UART_TX */ | ||
61 | PAL_MODE_INPUT_PULLUP, /* P0.25: UART_RX */ | ||
62 | PAL_MODE_INPUT, /* P0.26: BTN_B P11 */ | ||
63 | PAL_MODE_INPUT, /* P0.27: ACC_INT2 */ | ||
64 | PAL_MODE_INPUT, /* P0.28: ACC_INT1 */ | ||
65 | PAL_MODE_INPUT, /* P0.29: MAG_INT1 */ | ||
66 | PAL_MODE_OUTPUT_OPENDRAIN, /* P0.30: SDA P20 */ | ||
67 | PAL_MODE_UNCONNECTED, /* P0.31 */ | ||
68 | }, | ||
69 | }; | ||
70 | #endif | ||
71 | |||
72 | /** | ||
73 | * @brief Early initialization code. | ||
74 | * @details This initialization is performed just after reset before BSS and | ||
75 | * DATA segments initialization. | ||
76 | */ | ||
77 | void __early_init(void) | ||
78 | { | ||
79 | /* Make sure ALL RAM banks are powered on */ | ||
80 | *(uint32_t *)NRF_POWER_RAMON_ADDRESS |= NRF_POWER_RAMONx_RAMxON_ONMODE_Msk; | ||
81 | *(uint32_t *)NRF_POWER_RAMONB_ADDRESS |= NRF_POWER_RAMONx_RAMxON_ONMODE_Msk; | ||
82 | } | ||
83 | |||
84 | /** | ||
85 | * @brief Late initialization code. | ||
86 | * @note This initialization is performed after BSS and DATA segments | ||
87 | * initialization and before invoking the main() function. | ||
88 | */ | ||
89 | void boardInit(void) | ||
90 | { | ||
91 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/MICROBIT/board.h b/lib/chibios-contrib/os/hal/boards/MICROBIT/board.h new file mode 100644 index 000000000..157bd7502 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/MICROBIT/board.h | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Stephane D'Alu | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * See: https://www.microbit.co.uk/device/pins | ||
22 | * https://lancaster-university.github.io/microbit-docs/ubit/display/ | ||
23 | */ | ||
24 | |||
25 | /* Board identifier. */ | ||
26 | #define BOARD_MICROBIT | ||
27 | #define BOARD_NAME "micro:bit" | ||
28 | |||
29 | /* Board oscillators-related settings. */ | ||
30 | #define NRF51_XTAL_VALUE 16000000 | ||
31 | #define NRF51_LFCLK_SOURCE 0 /* RC oscillator */ | ||
32 | |||
33 | /* | ||
34 | * IO pins assignments. | ||
35 | */ | ||
36 | #define IOPORT1_P0 3U | ||
37 | #define IOPORT1_P1 2U | ||
38 | #define IOPORT1_P2 1U | ||
39 | #define IOPORT1_P3 4U | ||
40 | #define IOPORT1_P4 5U | ||
41 | #define IOPORT1_P5 17U | ||
42 | #define IOPORT1_P6 12U | ||
43 | #define IOPORT1_P7 11U | ||
44 | #define IOPORT1_P8 18U | ||
45 | #define IOPORT1_P9 10U | ||
46 | #define IOPORT1_P10 6U | ||
47 | #define IOPORT1_P11 26U | ||
48 | #define IOPORT1_P12 20U | ||
49 | #define IOPORT1_P13 23U | ||
50 | #define IOPORT1_P14 22U | ||
51 | #define IOPORT1_P15 21U | ||
52 | #define IOPORT1_P16 16U | ||
53 | #define IOPORT1_P19 0U | ||
54 | #define IOPORT1_P20 30U | ||
55 | #define IOPORT1_BTN_A 17U | ||
56 | #define IOPORT1_BTN_B 26U | ||
57 | #define IOPORT1_BTN_RST 19U | ||
58 | #define IOPORT1_LED_COL_1 4U | ||
59 | #define IOPORT1_LED_COL_2 5U | ||
60 | #define IOPORT1_LED_COL_3 6U | ||
61 | #define IOPORT1_LED_COL_4 7U | ||
62 | #define IOPORT1_LED_COL_5 8U | ||
63 | #define IOPORT1_LED_COL_6 9U | ||
64 | #define IOPORT1_LED_COL_7 10U | ||
65 | #define IOPORT1_LED_COL_8 11U | ||
66 | #define IOPORT1_LED_COL_9 12U | ||
67 | #define IOPORT1_LED_ROW_1 13U | ||
68 | #define IOPORT1_LED_ROW_2 14U | ||
69 | #define IOPORT1_LED_ROW_3 15U | ||
70 | #define IOPORT1_PAD_0 IOPORT1_P0 | ||
71 | #define IOPORT1_PAD_1 IOPORT1_P1 | ||
72 | #define IOPORT1_PAD_2 IOPORT1_P2 | ||
73 | #define IOPORT1_SPI_MOSI 21U | ||
74 | #define IOPORT1_SPI_MISO 22U | ||
75 | #define IOPORT1_SPI_SCK 23U | ||
76 | #define IOPORT1_I2C_SCL 0U | ||
77 | #define IOPORT1_I2C_SDA 30U | ||
78 | #define IOPORT1_UART_TX 24U | ||
79 | #define IOPORT1_UART_RX 25U | ||
80 | #define IOPORT1_ACC_INT1 28U | ||
81 | #define IOPORT1_ACC_INT2 27U | ||
82 | #define IOPORT1_MAG_INT1 29U | ||
83 | |||
84 | |||
85 | /* | ||
86 | * IO lines assignments. | ||
87 | */ | ||
88 | #define LINE_P0 PAL_LINE(IOPORT1, IOPORT1_P0) | ||
89 | #define LINE_P1 PAL_LINE(IOPORT1, IOPORT1_P1) | ||
90 | #define LINE_P2 PAL_LINE(IOPORT1, IOPORT1_P2) | ||
91 | #define LINE_P3 PAL_LINE(IOPORT1, IOPORT1_P3) | ||
92 | #define LINE_P4 PAL_LINE(IOPORT1, IOPORT1_P4) | ||
93 | #define LINE_P5 PAL_LINE(IOPORT1, IOPORT1_P5) | ||
94 | #define LINE_P6 PAL_LINE(IOPORT1, IOPORT1_P6) | ||
95 | #define LINE_P7 PAL_LINE(IOPORT1, IOPORT1_P7) | ||
96 | #define LINE_P8 PAL_LINE(IOPORT1, IOPORT1_P8) | ||
97 | #define LINE_P9 PAL_LINE(IOPORT1, IOPORT1_P9) | ||
98 | #define LINE_P10 PAL_LINE(IOPORT1, IOPORT1_P10) | ||
99 | #define LINE_P11 PAL_LINE(IOPORT1, IOPORT1_P11) | ||
100 | #define LINE_P12 PAL_LINE(IOPORT1, IOPORT1_P12) | ||
101 | #define LINE_P13 PAL_LINE(IOPORT1, IOPORT1_P13) | ||
102 | #define LINE_P14 PAL_LINE(IOPORT1, IOPORT1_P14) | ||
103 | #define LINE_P15 PAL_LINE(IOPORT1, IOPORT1_P15) | ||
104 | #define LINE_P16 PAL_LINE(IOPORT1, IOPORT1_P16) | ||
105 | #define LINE_P19 PAL_LINE(IOPORT1, IOPORT1_P19) | ||
106 | #define LINE_P20 PAL_LINE(IOPORT1, IOPORT1_P20) | ||
107 | #define LINE_BTN_A PAL_LINE(IOPORT1, IOPORT1_BTN_A) | ||
108 | #define LINE_BTN_B PAL_LINE(IOPORT1, IOPORT1_BTN_B) | ||
109 | #define LINE_BTN_RST PAL_LINE(IOPORT1, IOPORT1_BTN_RST) | ||
110 | #define LINE_LED_COL_1 PAL_LINE(IOPORT1, IOPORT1_LED_COL_1) | ||
111 | #define LINE_LED_COL_2 PAL_LINE(IOPORT1, IOPORT1_LED_COL_2) | ||
112 | #define LINE_LED_COL_3 PAL_LINE(IOPORT1, IOPORT1_LED_COL_3) | ||
113 | #define LINE_LED_COL_4 PAL_LINE(IOPORT1, IOPORT1_LED_COL_4) | ||
114 | #define LINE_LED_COL_5 PAL_LINE(IOPORT1, IOPORT1_LED_COL_5) | ||
115 | #define LINE_LED_COL_6 PAL_LINE(IOPORT1, IOPORT1_LED_COL_6) | ||
116 | #define LINE_LED_COL_7 PAL_LINE(IOPORT1, IOPORT1_LED_COL_7) | ||
117 | #define LINE_LED_COL_8 PAL_LINE(IOPORT1, IOPORT1_LED_COL_8) | ||
118 | #define LINE_LED_COL_9 PAL_LINE(IOPORT1, IOPORT1_LED_COL_9) | ||
119 | #define LINE_LED_ROW_1 PAL_LINE(IOPORT1, IOPORT1_LED_ROW_1) | ||
120 | #define LINE_LED_ROW_2 PAL_LINE(IOPORT1, IOPORT1_LED_ROW_2) | ||
121 | #define LINE_LED_ROW_3 PAL_LINE(IOPORT1, IOPORT1_LED_ROW_3) | ||
122 | #define LINE_PAD_0 PAL_LINE(IOPORT1, IOPORT1_PAD_0) | ||
123 | #define LINE_PAD_1 PAL_LINE(IOPORT1, IOPORT1_PAD_1) | ||
124 | #define LINE_PAD_2 PAL_LINE(IOPORT1, IOPORT1_PAD_2) | ||
125 | #define LINE_SPI_MOSI PAL_LINE(IOPORT1, IOPORT1_SPI_MOSI) | ||
126 | #define LINE_SPI_MISO PAL_LINE(IOPORT1, IOPORT1_SPI_MISO) | ||
127 | #define LINE_SPI_SCK PAL_LINE(IOPORT1, IOPORT1_SPI_SCK) | ||
128 | #define LINE_I2C_SCL PAL_LINE(IOPORT1, IOPORT1_I2C_SCL) | ||
129 | #define LINE_I2C_SDA PAL_LINE(IOPORT1, IOPORT1_I2C_SDA) | ||
130 | #define LINE_UART_TX PAL_LINE(IOPORT1, IOPORT1_UART_TX) | ||
131 | #define LINE_UART_RX PAL_LINE(IOPORT1, IOPORT1_UART_RX) | ||
132 | #define LINE_ACC_INT1 PAL_LINE(IOPORT1, IOPORT1_ACC_INT1) | ||
133 | #define LINE_ACC_INT2 PAL_LINE(IOPORT1, IOPORT1_ACC_INT2) | ||
134 | #define LINE_MAG_INT1 PAL_LINE(IOPORT1, IOPORT1_MAG_INT1) | ||
135 | |||
136 | |||
137 | #if !defined(_FROM_ASM_) | ||
138 | #ifdef __cplusplus | ||
139 | extern "C" { | ||
140 | #endif | ||
141 | void boardInit(void); | ||
142 | #ifdef __cplusplus | ||
143 | } | ||
144 | #endif | ||
145 | #endif /* _FROM_ASM_ */ | ||
146 | |||
147 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/MICROBIT/board.mk b/lib/chibios-contrib/os/hal/boards/MICROBIT/board.mk new file mode 100644 index 000000000..8e26ae6a2 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/MICROBIT/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/MICROBIT/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/MICROBIT | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2/board.c b/lib/chibios-contrib/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2/board.c new file mode 100644 index 000000000..09b44f777 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2/board.c | |||
@@ -0,0 +1,261 @@ | |||
1 | /* | ||
2 | ChibiOS/RT - Copyright (C) 2014 Uladzimir Pylinsky aka barthess | ||
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 | |||
17 | #include "hal.h" | ||
18 | #include "stm32_gpio.h" | ||
19 | |||
20 | /*===========================================================================*/ | ||
21 | /* Driver local definitions. */ | ||
22 | /*===========================================================================*/ | ||
23 | |||
24 | /*===========================================================================*/ | ||
25 | /* Driver exported variables. */ | ||
26 | /*===========================================================================*/ | ||
27 | |||
28 | /*===========================================================================*/ | ||
29 | /* Driver local variables and types. */ | ||
30 | /*===========================================================================*/ | ||
31 | |||
32 | /** | ||
33 | * @brief Type of STM32 GPIO port setup. | ||
34 | */ | ||
35 | typedef struct { | ||
36 | uint32_t moder; | ||
37 | uint32_t otyper; | ||
38 | uint32_t ospeedr; | ||
39 | uint32_t pupdr; | ||
40 | uint32_t odr; | ||
41 | uint32_t afrl; | ||
42 | uint32_t afrh; | ||
43 | } gpio_setup_t; | ||
44 | |||
45 | /** | ||
46 | * @brief Type of STM32 GPIO initialization data. | ||
47 | */ | ||
48 | typedef struct { | ||
49 | #if STM32_HAS_GPIOA || defined(__DOXYGEN__) | ||
50 | gpio_setup_t PAData; | ||
51 | #endif | ||
52 | #if STM32_HAS_GPIOB || defined(__DOXYGEN__) | ||
53 | gpio_setup_t PBData; | ||
54 | #endif | ||
55 | #if STM32_HAS_GPIOC || defined(__DOXYGEN__) | ||
56 | gpio_setup_t PCData; | ||
57 | #endif | ||
58 | #if STM32_HAS_GPIOD || defined(__DOXYGEN__) | ||
59 | gpio_setup_t PDData; | ||
60 | #endif | ||
61 | #if STM32_HAS_GPIOE || defined(__DOXYGEN__) | ||
62 | gpio_setup_t PEData; | ||
63 | #endif | ||
64 | #if STM32_HAS_GPIOF || defined(__DOXYGEN__) | ||
65 | gpio_setup_t PFData; | ||
66 | #endif | ||
67 | #if STM32_HAS_GPIOG || defined(__DOXYGEN__) | ||
68 | gpio_setup_t PGData; | ||
69 | #endif | ||
70 | #if STM32_HAS_GPIOH || defined(__DOXYGEN__) | ||
71 | gpio_setup_t PHData; | ||
72 | #endif | ||
73 | #if STM32_HAS_GPIOI || defined(__DOXYGEN__) | ||
74 | gpio_setup_t PIData; | ||
75 | #endif | ||
76 | #if STM32_HAS_GPIOJ || defined(__DOXYGEN__) | ||
77 | gpio_setup_t PJData; | ||
78 | #endif | ||
79 | #if STM32_HAS_GPIOK || defined(__DOXYGEN__) | ||
80 | gpio_setup_t PKData; | ||
81 | #endif | ||
82 | } gpio_config_t; | ||
83 | |||
84 | /** | ||
85 | * @brief STM32 GPIO static initialization data. | ||
86 | */ | ||
87 | static const gpio_config_t gpio_default_config = { | ||
88 | #if STM32_HAS_GPIOA | ||
89 | {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, | ||
90 | VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, | ||
91 | #endif | ||
92 | #if STM32_HAS_GPIOB | ||
93 | {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, | ||
94 | VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, | ||
95 | #endif | ||
96 | #if STM32_HAS_GPIOC | ||
97 | {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, | ||
98 | VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, | ||
99 | #endif | ||
100 | #if STM32_HAS_GPIOD | ||
101 | {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, | ||
102 | VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, | ||
103 | #endif | ||
104 | #if STM32_HAS_GPIOE | ||
105 | {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, | ||
106 | VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, | ||
107 | #endif | ||
108 | #if STM32_HAS_GPIOF | ||
109 | {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, | ||
110 | VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, | ||
111 | #endif | ||
112 | #if STM32_HAS_GPIOG | ||
113 | {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, | ||
114 | VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, | ||
115 | #endif | ||
116 | #if STM32_HAS_GPIOH | ||
117 | {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, | ||
118 | VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, | ||
119 | #endif | ||
120 | #if STM32_HAS_GPIOI | ||
121 | {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, | ||
122 | VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}, | ||
123 | #endif | ||
124 | #if STM32_HAS_GPIOJ | ||
125 | {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, | ||
126 | VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH}, | ||
127 | #endif | ||
128 | #if STM32_HAS_GPIOK | ||
129 | {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, | ||
130 | VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH} | ||
131 | #endif | ||
132 | }; | ||
133 | |||
134 | /*===========================================================================*/ | ||
135 | /* Driver local functions. */ | ||
136 | /*===========================================================================*/ | ||
137 | |||
138 | static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) { | ||
139 | |||
140 | gpiop->OTYPER = config->otyper; | ||
141 | gpiop->OSPEEDR = config->ospeedr; | ||
142 | gpiop->PUPDR = config->pupdr; | ||
143 | gpiop->ODR = config->odr; | ||
144 | gpiop->AFRL = config->afrl; | ||
145 | gpiop->AFRH = config->afrh; | ||
146 | gpiop->MODER = config->moder; | ||
147 | } | ||
148 | |||
149 | static void stm32_gpio_init(void) { | ||
150 | |||
151 | /* Enabling GPIO-related clocks, the mask comes from the | ||
152 | registry header file.*/ | ||
153 | rccResetAHB1(STM32_GPIO_EN_MASK); | ||
154 | rccEnableAHB1(STM32_GPIO_EN_MASK, true); | ||
155 | |||
156 | /* Initializing all the defined GPIO ports.*/ | ||
157 | #if STM32_HAS_GPIOA | ||
158 | gpio_init(GPIOA, &gpio_default_config.PAData); | ||
159 | #endif | ||
160 | #if STM32_HAS_GPIOB | ||
161 | gpio_init(GPIOB, &gpio_default_config.PBData); | ||
162 | #endif | ||
163 | #if STM32_HAS_GPIOC | ||
164 | gpio_init(GPIOC, &gpio_default_config.PCData); | ||
165 | #endif | ||
166 | #if STM32_HAS_GPIOD | ||
167 | gpio_init(GPIOD, &gpio_default_config.PDData); | ||
168 | #endif | ||
169 | #if STM32_HAS_GPIOE | ||
170 | gpio_init(GPIOE, &gpio_default_config.PEData); | ||
171 | #endif | ||
172 | #if STM32_HAS_GPIOF | ||
173 | gpio_init(GPIOF, &gpio_default_config.PFData); | ||
174 | #endif | ||
175 | #if STM32_HAS_GPIOG | ||
176 | gpio_init(GPIOG, &gpio_default_config.PGData); | ||
177 | #endif | ||
178 | #if STM32_HAS_GPIOH | ||
179 | gpio_init(GPIOH, &gpio_default_config.PHData); | ||
180 | #endif | ||
181 | #if STM32_HAS_GPIOI | ||
182 | gpio_init(GPIOI, &gpio_default_config.PIData); | ||
183 | #endif | ||
184 | #if STM32_HAS_GPIOJ | ||
185 | gpio_init(GPIOJ, &gpio_default_config.PJData); | ||
186 | #endif | ||
187 | #if STM32_HAS_GPIOK | ||
188 | gpio_init(GPIOK, &gpio_default_config.PKData); | ||
189 | #endif | ||
190 | } | ||
191 | |||
192 | /*===========================================================================*/ | ||
193 | /* Driver interrupt handlers. */ | ||
194 | /*===========================================================================*/ | ||
195 | |||
196 | /*===========================================================================*/ | ||
197 | /* Driver exported functions. */ | ||
198 | /*===========================================================================*/ | ||
199 | |||
200 | /** | ||
201 | * @brief Early initialization code. | ||
202 | * @details GPIO ports and system clocks are initialized before everything | ||
203 | * else. | ||
204 | */ | ||
205 | void __early_init(void) { | ||
206 | |||
207 | stm32_gpio_init(); | ||
208 | stm32_clock_init(); | ||
209 | } | ||
210 | |||
211 | #if HAL_USE_SDC || defined(__DOXYGEN__) | ||
212 | /** | ||
213 | * @brief SDC card detection. | ||
214 | */ | ||
215 | bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { | ||
216 | |||
217 | (void)sdcp; | ||
218 | /* TODO: Fill the implementation.*/ | ||
219 | return true; | ||
220 | } | ||
221 | |||
222 | /** | ||
223 | * @brief SDC card write protection detection. | ||
224 | */ | ||
225 | bool sdc_lld_is_write_protected(SDCDriver *sdcp) { | ||
226 | |||
227 | (void)sdcp; | ||
228 | /* TODO: Fill the implementation.*/ | ||
229 | return false; | ||
230 | } | ||
231 | #endif /* HAL_USE_SDC */ | ||
232 | |||
233 | #if HAL_USE_MMC_SPI || defined(__DOXYGEN__) | ||
234 | /** | ||
235 | * @brief MMC_SPI card detection. | ||
236 | */ | ||
237 | bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { | ||
238 | |||
239 | (void)mmcp; | ||
240 | /* TODO: Fill the implementation.*/ | ||
241 | return true; | ||
242 | } | ||
243 | |||
244 | /** | ||
245 | * @brief MMC_SPI card write protection detection. | ||
246 | */ | ||
247 | bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | ||
248 | |||
249 | (void)mmcp; | ||
250 | /* TODO: Fill the implementation.*/ | ||
251 | return false; | ||
252 | } | ||
253 | #endif | ||
254 | |||
255 | /** | ||
256 | * @brief Board-specific initialization code. | ||
257 | * @todo Add your board-specific code, if any. | ||
258 | */ | ||
259 | void boardInit(void) { | ||
260 | |||
261 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2/board.h b/lib/chibios-contrib/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2/board.h new file mode 100644 index 000000000..0788eb7fe --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2/board.h | |||
@@ -0,0 +1,1150 @@ | |||
1 | /* | ||
2 | ChibiOS/RT - Copyright (C) 2014 Uladzimir Pylinsky aka barthess | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for STMicroelectronics STM32F4-Discovery board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_NAME "NAND and SRAM test board (codename Buod)" | ||
28 | |||
29 | /* | ||
30 | * Board oscillators-related settings. | ||
31 | */ | ||
32 | #if !defined(STM32_LSECLK) | ||
33 | #define STM32_LSECLK 32768 | ||
34 | #endif | ||
35 | |||
36 | #if !defined(STM32_HSECLK) | ||
37 | #define STM32_HSECLK 12000000 | ||
38 | #endif | ||
39 | |||
40 | /* | ||
41 | * Board voltages. | ||
42 | * Required for performance limits calculation. | ||
43 | */ | ||
44 | #define STM32_VDD 300 | ||
45 | |||
46 | /* | ||
47 | * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. | ||
48 | */ | ||
49 | #define STM32F407xx | ||
50 | |||
51 | /* | ||
52 | * IO pins assignments. | ||
53 | */ | ||
54 | #define GPIOA_PIN0 0 | ||
55 | #define GPIOA_PIN1 1 | ||
56 | #define GPIOA_PIN2 2 | ||
57 | #define GPIOA_PIN3 3 | ||
58 | #define GPIOA_SPI1_NSS 4 | ||
59 | #define GPIOA_PIN5 5 | ||
60 | #define GPIOA_PIN6 6 | ||
61 | #define GPIOA_PIN7 7 | ||
62 | #define GPIOA_PIN8 8 | ||
63 | #define GPIOA_USB_PRESENT 9 | ||
64 | #define GPIOA_PIN10 10 | ||
65 | #define GPIOA_OTG_FS_DM 11 | ||
66 | #define GPIOA_OTG_FS_DP 12 | ||
67 | #define GPIOA_JTMS 13 | ||
68 | #define GPIOA_JTCK 14 | ||
69 | #define GPIOA_JTDI 15 | ||
70 | |||
71 | |||
72 | |||
73 | #define GPIOA_USB_PRESENT 9 | ||
74 | #define GPIOA_PIN10 10 | ||
75 | #define GPIOA_OTG_FS_DM 11 | ||
76 | #define GPIOA_OTG_FS_DP 12 | ||
77 | |||
78 | |||
79 | #define GPIOB_PIN0 0 | ||
80 | #define GPIOB_NAND_WP 1 | ||
81 | #define GPIOB_PIN2 2 | ||
82 | #define GPIOB_JTDO 3 | ||
83 | #define GPIOB_JTRST 4 | ||
84 | #define GPIOB_NVRAM_PWR 5 | ||
85 | #define GPIOB_PIN6 6 | ||
86 | #define GPIOB_PIN7 7 | ||
87 | #define GPIOB_PIN8 8 | ||
88 | #define GPIOB_PIN9 9 | ||
89 | #define GPIOB_PIN10 10 | ||
90 | #define GPIOB_PIN11 11 | ||
91 | #define GPIOB_PIN12 12 | ||
92 | #define GPIOB_PIN13 13 | ||
93 | #define GPIOB_PIN14 14 | ||
94 | #define GPIOB_PIN15 15 | ||
95 | |||
96 | #define GPIOC_PIN0 0 | ||
97 | #define GPIOC_PIN1 1 | ||
98 | #define GPIOC_PIN2 2 | ||
99 | #define GPIOC_PIN3 3 | ||
100 | #define GPIOC_PIN4 4 | ||
101 | #define GPIOC_PIN5 5 | ||
102 | #define GPIOC_PIN6 6 | ||
103 | #define GPIOC_PIN7 7 | ||
104 | #define GPIOC_PIN8 8 | ||
105 | #define GPIOC_PIN9 9 | ||
106 | #define GPIOC_PIN10 10 | ||
107 | #define GPIOC_PIN11 11 | ||
108 | #define GPIOC_PIN12 12 | ||
109 | #define GPIOC_PIN13 13 | ||
110 | #define GPIOC_PIN14 14 | ||
111 | #define GPIOC_PIN15 15 | ||
112 | |||
113 | #define GPIOD_MEM_D2 0 | ||
114 | #define GPIOD_MEM_D3 1 | ||
115 | #define GPIOD_PIN2 2 | ||
116 | #define GPIOD_PIN3 3 | ||
117 | #define GPIOD_MEM_OE 4 | ||
118 | #define GPIOD_MEM_WE 5 | ||
119 | #define GPIOD_NAND_RB_NWAIT 6 | ||
120 | #define GPIOD_NAND_CE1 7 | ||
121 | #define GPIOD_MEM_D13 8 | ||
122 | #define GPIOD_MEM_D14 9 | ||
123 | #define GPIOD_MEM_D15 10 | ||
124 | #define GPIOD_MEM_A16 11 | ||
125 | #define GPIOD_MEM_A17 12 | ||
126 | #define GPIOD_PIN13 13 | ||
127 | #define GPIOD_MEM_D0 14 | ||
128 | #define GPIOD_MEM_D1 15 | ||
129 | |||
130 | #define GPIOE_SRAM_LB 0 | ||
131 | #define GPIOE_SRAM_UB 1 | ||
132 | #define GPIOE_PIN2 2 | ||
133 | #define GPIOE_PIN3 3 | ||
134 | #define GPIOE_PIN4 4 | ||
135 | #define GPIOE_PIN5 5 | ||
136 | #define GPIOE_PIN6 6 | ||
137 | #define GPIOE_MEM_D4 7 | ||
138 | #define GPIOE_MEM_D5 8 | ||
139 | #define GPIOE_MEM_D6 9 | ||
140 | #define GPIOE_MEM_D7 10 | ||
141 | #define GPIOE_MEM_D8 11 | ||
142 | #define GPIOE_MEM_D9 12 | ||
143 | #define GPIOE_MEM_D10 13 | ||
144 | #define GPIOE_MEM_D11 14 | ||
145 | #define GPIOE_MEM_D12 15 | ||
146 | |||
147 | #define GPIOF_MEM_A0 0 | ||
148 | #define GPIOF_MEM_A1 1 | ||
149 | #define GPIOF_MEM_A2 2 | ||
150 | #define GPIOF_MEM_A3 3 | ||
151 | #define GPIOF_MEM_A4 4 | ||
152 | #define GPIOF_MEM_A5 5 | ||
153 | #define GPIOF_PIN6 6 | ||
154 | #define GPIOF_PIN7 7 | ||
155 | #define GPIOF_PIN8 8 | ||
156 | #define GPIOF_PIN9 9 | ||
157 | #define GPIOF_PIN10 10 | ||
158 | #define GPIOF_PIN11 11 | ||
159 | #define GPIOF_MEM_A6 12 | ||
160 | #define GPIOF_MEM_A7 13 | ||
161 | #define GPIOF_MEM_A8 14 | ||
162 | #define GPIOF_MEM_A9 15 | ||
163 | |||
164 | #define GPIOG_MEM_A10 0 | ||
165 | #define GPIOG_MEM_A11 1 | ||
166 | #define GPIOG_MEM_A12 2 | ||
167 | #define GPIOG_MEM_A13 3 | ||
168 | #define GPIOG_MEM_A14 4 | ||
169 | #define GPIOG_MEM_A15 5 | ||
170 | #define GPIOG_NAND_RB1 6 | ||
171 | #define GPIOG_NAND_RB2 7 | ||
172 | #define GPIOG_PIN8 8 | ||
173 | #define GPIOG_NAND_CE2 9 | ||
174 | #define GPIOG_PIN10 10 | ||
175 | #define GPIOG_PIN11 11 | ||
176 | #define GPIOG_SRAM_CS1 12 | ||
177 | #define GPIOG_PIN13 13 | ||
178 | #define GPIOG_PIN14 14 | ||
179 | #define GPIOG_PIN15 15 | ||
180 | |||
181 | #define GPIOH_OSC_IN 0 | ||
182 | #define GPIOH_OSC_OUT 1 | ||
183 | #define GPIOH_PIN2 2 | ||
184 | #define GPIOH_PIN3 3 | ||
185 | #define GPIOH_PIN4 4 | ||
186 | #define GPIOH_PIN5 5 | ||
187 | #define GPIOH_PIN6 6 | ||
188 | #define GPIOH_I2C3_SCL 7 | ||
189 | #define GPIOH_I2C3_SDA 8 | ||
190 | #define GPIOH_PIN9 9 | ||
191 | #define GPIOH_PIN10 10 | ||
192 | #define GPIOH_PIN11 11 | ||
193 | #define GPIOH_PIN12 12 | ||
194 | #define GPIOH_PIN13 13 | ||
195 | #define GPIOH_PIN14 14 | ||
196 | #define GPIOH_PIN15 15 | ||
197 | |||
198 | #define GPIOI_PIN0 0 | ||
199 | #define GPIOI_PIN1 1 | ||
200 | #define GPIOI_PIN2 2 | ||
201 | #define GPIOI_PIN3 3 | ||
202 | #define GPIOI_PIN4 4 | ||
203 | #define GPIOI_PIN5 5 | ||
204 | #define GPIOI_PIN6 6 | ||
205 | #define GPIOI_PIN7 7 | ||
206 | #define GPIOI_PIN8 8 | ||
207 | #define GPIOI_PIN9 9 | ||
208 | #define GPIOI_LED_R 10 | ||
209 | #define GPIOI_LED_G 11 | ||
210 | #define GPIOI_PIN12 12 | ||
211 | #define GPIOI_PIN13 13 | ||
212 | #define GPIOI_PIN14 14 | ||
213 | #define GPIOI_PIN15 15 | ||
214 | |||
215 | /* | ||
216 | * I/O ports initial setup, this configuration is established soon after reset | ||
217 | * in the initialization code. | ||
218 | * Please refer to the STM32 Reference Manual for details. | ||
219 | */ | ||
220 | #define PIN_MODE_INPUT(n) (0U << ((n) * 2)) | ||
221 | #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2)) | ||
222 | #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2)) | ||
223 | #define PIN_MODE_ANALOG(n) (3U << ((n) * 2)) | ||
224 | #define PIN_ODR_LOW(n) (0U << (n)) | ||
225 | #define PIN_ODR_HIGH(n) (1U << (n)) | ||
226 | #define PIN_OTYPE_PUSHPULL(n) (0U << (n)) | ||
227 | #define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) | ||
228 | #define PIN_OSPEED_2M(n) (0U << ((n) * 2)) | ||
229 | #define PIN_OSPEED_25M(n) (1U << ((n) * 2)) | ||
230 | #define PIN_OSPEED_50M(n) (2U << ((n) * 2)) | ||
231 | #define PIN_OSPEED_100M(n) (3U << ((n) * 2)) | ||
232 | #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2)) | ||
233 | #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2)) | ||
234 | #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2)) | ||
235 | #define PIN_AFIO_AF(n, v) ((v##U) << ((n % 8) * 4)) | ||
236 | |||
237 | /* | ||
238 | * GPIOA setup: | ||
239 | */ | ||
240 | #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \ | ||
241 | PIN_MODE_INPUT(GPIOA_PIN1) | \ | ||
242 | PIN_MODE_INPUT(GPIOA_PIN2) | \ | ||
243 | PIN_MODE_INPUT(GPIOA_PIN3) | \ | ||
244 | PIN_MODE_ALTERNATE(GPIOA_SPI1_NSS) | \ | ||
245 | PIN_MODE_INPUT(GPIOA_PIN5) | \ | ||
246 | PIN_MODE_INPUT(GPIOA_PIN6) | \ | ||
247 | PIN_MODE_INPUT(GPIOA_PIN7) | \ | ||
248 | PIN_MODE_INPUT(GPIOA_PIN8) | \ | ||
249 | PIN_MODE_INPUT(GPIOA_USB_PRESENT) | \ | ||
250 | PIN_MODE_INPUT(GPIOA_PIN10) | \ | ||
251 | PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) | \ | ||
252 | PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) | \ | ||
253 | PIN_MODE_ALTERNATE(GPIOA_JTMS) | \ | ||
254 | PIN_MODE_ALTERNATE(GPIOA_JTCK) | \ | ||
255 | PIN_MODE_ALTERNATE(GPIOA_JTDI)) | ||
256 | #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \ | ||
257 | PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \ | ||
258 | PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \ | ||
259 | PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \ | ||
260 | PIN_OTYPE_PUSHPULL(GPIOA_SPI1_NSS) | \ | ||
261 | PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \ | ||
262 | PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \ | ||
263 | PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \ | ||
264 | PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \ | ||
265 | PIN_OTYPE_PUSHPULL(GPIOA_USB_PRESENT) |\ | ||
266 | PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \ | ||
267 | PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) | \ | ||
268 | PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) | \ | ||
269 | PIN_OTYPE_PUSHPULL(GPIOA_JTMS) | \ | ||
270 | PIN_OTYPE_PUSHPULL(GPIOA_JTCK) | \ | ||
271 | PIN_OTYPE_PUSHPULL(GPIOA_JTDI)) | ||
272 | #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_100M(GPIOA_PIN0) | \ | ||
273 | PIN_OSPEED_100M(GPIOA_PIN1) | \ | ||
274 | PIN_OSPEED_100M(GPIOA_PIN2) | \ | ||
275 | PIN_OSPEED_100M(GPIOA_PIN3) | \ | ||
276 | PIN_OSPEED_100M(GPIOA_SPI1_NSS) | \ | ||
277 | PIN_OSPEED_100M(GPIOA_PIN5) | \ | ||
278 | PIN_OSPEED_100M(GPIOA_PIN6) | \ | ||
279 | PIN_OSPEED_100M(GPIOA_PIN7) | \ | ||
280 | PIN_OSPEED_100M(GPIOA_PIN8) | \ | ||
281 | PIN_OSPEED_100M(GPIOA_USB_PRESENT) | \ | ||
282 | PIN_OSPEED_100M(GPIOA_PIN10) | \ | ||
283 | PIN_OSPEED_100M(GPIOA_OTG_FS_DM) | \ | ||
284 | PIN_OSPEED_100M(GPIOA_OTG_FS_DP) | \ | ||
285 | PIN_OSPEED_100M(GPIOA_JTMS) | \ | ||
286 | PIN_OSPEED_100M(GPIOA_JTCK) | \ | ||
287 | PIN_OSPEED_100M(GPIOA_JTDI)) | ||
288 | #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_PIN0) | \ | ||
289 | PIN_PUPDR_FLOATING(GPIOA_PIN1) | \ | ||
290 | PIN_PUPDR_FLOATING(GPIOA_PIN2) | \ | ||
291 | PIN_PUPDR_FLOATING(GPIOA_PIN3) | \ | ||
292 | PIN_PUPDR_FLOATING(GPIOA_SPI1_NSS) | \ | ||
293 | PIN_PUPDR_FLOATING(GPIOA_PIN5) | \ | ||
294 | PIN_PUPDR_FLOATING(GPIOA_PIN6) | \ | ||
295 | PIN_PUPDR_FLOATING(GPIOA_PIN7) | \ | ||
296 | PIN_PUPDR_FLOATING(GPIOA_PIN8) | \ | ||
297 | PIN_PUPDR_FLOATING(GPIOA_USB_PRESENT) |\ | ||
298 | PIN_PUPDR_FLOATING(GPIOA_PIN10) | \ | ||
299 | PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) | \ | ||
300 | PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) | \ | ||
301 | PIN_PUPDR_FLOATING(GPIOA_JTMS) | \ | ||
302 | PIN_PUPDR_FLOATING(GPIOA_JTCK) | \ | ||
303 | PIN_PUPDR_FLOATING(GPIOA_JTDI)) | ||
304 | #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \ | ||
305 | PIN_ODR_HIGH(GPIOA_PIN1) | \ | ||
306 | PIN_ODR_HIGH(GPIOA_PIN2) | \ | ||
307 | PIN_ODR_HIGH(GPIOA_PIN3) | \ | ||
308 | PIN_ODR_HIGH(GPIOA_SPI1_NSS) | \ | ||
309 | PIN_ODR_HIGH(GPIOA_PIN5) | \ | ||
310 | PIN_ODR_HIGH(GPIOA_PIN6) | \ | ||
311 | PIN_ODR_HIGH(GPIOA_PIN7) | \ | ||
312 | PIN_ODR_HIGH(GPIOA_PIN8) | \ | ||
313 | PIN_ODR_HIGH(GPIOA_USB_PRESENT) | \ | ||
314 | PIN_ODR_HIGH(GPIOA_PIN10) | \ | ||
315 | PIN_ODR_HIGH(GPIOA_OTG_FS_DM) | \ | ||
316 | PIN_ODR_HIGH(GPIOA_OTG_FS_DP) | \ | ||
317 | PIN_ODR_HIGH(GPIOA_JTMS) | \ | ||
318 | PIN_ODR_HIGH(GPIOA_JTCK) | \ | ||
319 | PIN_ODR_HIGH(GPIOA_JTDI)) | ||
320 | #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0) | \ | ||
321 | PIN_AFIO_AF(GPIOA_PIN1, 0) | \ | ||
322 | PIN_AFIO_AF(GPIOA_PIN2, 0) | \ | ||
323 | PIN_AFIO_AF(GPIOA_PIN3, 0) | \ | ||
324 | PIN_AFIO_AF(GPIOA_SPI1_NSS, 5) | \ | ||
325 | PIN_AFIO_AF(GPIOA_PIN5, 0) | \ | ||
326 | PIN_AFIO_AF(GPIOA_PIN6, 0) | \ | ||
327 | PIN_AFIO_AF(GPIOA_PIN7, 0)) | ||
328 | #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0) | \ | ||
329 | PIN_AFIO_AF(GPIOA_USB_PRESENT, 0) | \ | ||
330 | PIN_AFIO_AF(GPIOA_PIN10, 0) | \ | ||
331 | PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10) | \ | ||
332 | PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10) | \ | ||
333 | PIN_AFIO_AF(GPIOA_JTMS, 0) | \ | ||
334 | PIN_AFIO_AF(GPIOA_JTCK, 0) | \ | ||
335 | PIN_AFIO_AF(GPIOA_JTDI, 0)) | ||
336 | |||
337 | /* | ||
338 | * GPIOB setup: | ||
339 | */ | ||
340 | #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \ | ||
341 | PIN_MODE_OUTPUT(GPIOB_NAND_WP) | \ | ||
342 | PIN_MODE_INPUT(GPIOB_PIN2) | \ | ||
343 | PIN_MODE_ALTERNATE(GPIOB_JTDO) | \ | ||
344 | PIN_MODE_ALTERNATE(GPIOB_JTRST) | \ | ||
345 | PIN_MODE_OUTPUT(GPIOB_NVRAM_PWR) | \ | ||
346 | PIN_MODE_INPUT(GPIOB_PIN6) | \ | ||
347 | PIN_MODE_INPUT(GPIOB_PIN7) | \ | ||
348 | PIN_MODE_INPUT(GPIOB_PIN8) | \ | ||
349 | PIN_MODE_INPUT(GPIOB_PIN9) | \ | ||
350 | PIN_MODE_INPUT(GPIOB_PIN10) | \ | ||
351 | PIN_MODE_INPUT(GPIOB_PIN11) | \ | ||
352 | PIN_MODE_INPUT(GPIOB_PIN12) | \ | ||
353 | PIN_MODE_INPUT(GPIOB_PIN13) | \ | ||
354 | PIN_MODE_INPUT(GPIOB_PIN14) | \ | ||
355 | PIN_MODE_INPUT(GPIOB_PIN15)) | ||
356 | |||
357 | #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \ | ||
358 | PIN_OTYPE_PUSHPULL(GPIOB_NAND_WP) | \ | ||
359 | PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \ | ||
360 | PIN_OTYPE_PUSHPULL(GPIOB_JTDO) | \ | ||
361 | PIN_OTYPE_PUSHPULL(GPIOB_JTRST) | \ | ||
362 | PIN_OTYPE_OPENDRAIN(GPIOB_NVRAM_PWR) | \ | ||
363 | PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | \ | ||
364 | PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \ | ||
365 | PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \ | ||
366 | PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \ | ||
367 | PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \ | ||
368 | PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \ | ||
369 | PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \ | ||
370 | PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \ | ||
371 | PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \ | ||
372 | PIN_OTYPE_PUSHPULL(GPIOB_PIN15)) | ||
373 | #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_100M(GPIOB_PIN0) | \ | ||
374 | PIN_OSPEED_100M(GPIOB_NAND_WP) | \ | ||
375 | PIN_OSPEED_100M(GPIOB_PIN2) | \ | ||
376 | PIN_OSPEED_100M(GPIOB_JTDO) | \ | ||
377 | PIN_OSPEED_100M(GPIOB_JTRST) | \ | ||
378 | PIN_OSPEED_2M(GPIOB_NVRAM_PWR) | \ | ||
379 | PIN_OSPEED_100M(GPIOB_PIN6) | \ | ||
380 | PIN_OSPEED_100M(GPIOB_PIN7) | \ | ||
381 | PIN_OSPEED_100M(GPIOB_PIN8) | \ | ||
382 | PIN_OSPEED_100M(GPIOB_PIN9) | \ | ||
383 | PIN_OSPEED_100M(GPIOB_PIN10) | \ | ||
384 | PIN_OSPEED_100M(GPIOB_PIN11) | \ | ||
385 | PIN_OSPEED_100M(GPIOB_PIN12) | \ | ||
386 | PIN_OSPEED_100M(GPIOB_PIN13) | \ | ||
387 | PIN_OSPEED_100M(GPIOB_PIN14) | \ | ||
388 | PIN_OSPEED_100M(GPIOB_PIN15)) | ||
389 | #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(GPIOB_PIN0) | \ | ||
390 | PIN_PUPDR_PULLDOWN(GPIOB_NAND_WP) | \ | ||
391 | PIN_PUPDR_FLOATING(GPIOB_PIN2) | \ | ||
392 | PIN_PUPDR_FLOATING(GPIOB_JTDO) | \ | ||
393 | PIN_PUPDR_FLOATING(GPIOB_JTRST) | \ | ||
394 | PIN_PUPDR_FLOATING(GPIOB_NVRAM_PWR) | \ | ||
395 | PIN_PUPDR_FLOATING(GPIOB_PIN6) | \ | ||
396 | PIN_PUPDR_FLOATING(GPIOB_PIN7) | \ | ||
397 | PIN_PUPDR_FLOATING(GPIOB_PIN8) | \ | ||
398 | PIN_PUPDR_FLOATING(GPIOB_PIN9) | \ | ||
399 | PIN_PUPDR_FLOATING(GPIOB_PIN10) | \ | ||
400 | PIN_PUPDR_FLOATING(GPIOB_PIN11) | \ | ||
401 | PIN_PUPDR_FLOATING(GPIOB_PIN12) | \ | ||
402 | PIN_PUPDR_FLOATING(GPIOB_PIN13) | \ | ||
403 | PIN_PUPDR_FLOATING(GPIOB_PIN14) | \ | ||
404 | PIN_PUPDR_FLOATING(GPIOB_PIN15)) | ||
405 | #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \ | ||
406 | PIN_ODR_LOW(GPIOB_NAND_WP) | \ | ||
407 | PIN_ODR_HIGH(GPIOB_PIN2) | \ | ||
408 | PIN_ODR_HIGH(GPIOB_JTDO) | \ | ||
409 | PIN_ODR_HIGH(GPIOB_JTRST) | \ | ||
410 | PIN_ODR_LOW(GPIOB_NVRAM_PWR) | \ | ||
411 | PIN_ODR_HIGH(GPIOB_PIN6) | \ | ||
412 | PIN_ODR_HIGH(GPIOB_PIN7) | \ | ||
413 | PIN_ODR_HIGH(GPIOB_PIN8) | \ | ||
414 | PIN_ODR_HIGH(GPIOB_PIN9) | \ | ||
415 | PIN_ODR_HIGH(GPIOB_PIN10) | \ | ||
416 | PIN_ODR_HIGH(GPIOB_PIN11) | \ | ||
417 | PIN_ODR_HIGH(GPIOB_PIN12) | \ | ||
418 | PIN_ODR_HIGH(GPIOB_PIN13) | \ | ||
419 | PIN_ODR_HIGH(GPIOB_PIN14) | \ | ||
420 | PIN_ODR_HIGH(GPIOB_PIN15)) | ||
421 | #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0) | \ | ||
422 | PIN_AFIO_AF(GPIOB_NAND_WP, 0) | \ | ||
423 | PIN_AFIO_AF(GPIOB_PIN2, 0) | \ | ||
424 | PIN_AFIO_AF(GPIOB_JTDO, 0) | \ | ||
425 | PIN_AFIO_AF(GPIOB_JTRST, 0) | \ | ||
426 | PIN_AFIO_AF(GPIOB_NVRAM_PWR, 0) | \ | ||
427 | PIN_AFIO_AF(GPIOB_PIN6, 0) | \ | ||
428 | PIN_AFIO_AF(GPIOB_PIN7, 0)) | ||
429 | #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0) | \ | ||
430 | PIN_AFIO_AF(GPIOB_PIN9, 0) | \ | ||
431 | PIN_AFIO_AF(GPIOB_PIN10, 0) | \ | ||
432 | PIN_AFIO_AF(GPIOB_PIN11, 0) | \ | ||
433 | PIN_AFIO_AF(GPIOB_PIN12, 0) | \ | ||
434 | PIN_AFIO_AF(GPIOB_PIN13, 0) | \ | ||
435 | PIN_AFIO_AF(GPIOB_PIN14, 0) | \ | ||
436 | PIN_AFIO_AF(GPIOB_PIN15, 0)) | ||
437 | |||
438 | /* | ||
439 | * GPIOC setup: | ||
440 | */ | ||
441 | #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \ | ||
442 | PIN_MODE_INPUT(GPIOC_PIN1) | \ | ||
443 | PIN_MODE_INPUT(GPIOC_PIN2) | \ | ||
444 | PIN_MODE_INPUT(GPIOC_PIN3) | \ | ||
445 | PIN_MODE_INPUT(GPIOC_PIN4) | \ | ||
446 | PIN_MODE_INPUT(GPIOC_PIN5) | \ | ||
447 | PIN_MODE_INPUT(GPIOC_PIN6) | \ | ||
448 | PIN_MODE_INPUT(GPIOC_PIN7) | \ | ||
449 | PIN_MODE_INPUT(GPIOC_PIN8) | \ | ||
450 | PIN_MODE_INPUT(GPIOC_PIN9) | \ | ||
451 | PIN_MODE_INPUT(GPIOC_PIN10) | \ | ||
452 | PIN_MODE_INPUT(GPIOC_PIN11) | \ | ||
453 | PIN_MODE_INPUT(GPIOC_PIN12) | \ | ||
454 | PIN_MODE_INPUT(GPIOC_PIN13) | \ | ||
455 | PIN_MODE_INPUT(GPIOC_PIN14) | \ | ||
456 | PIN_MODE_INPUT(GPIOC_PIN15)) | ||
457 | #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \ | ||
458 | PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \ | ||
459 | PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \ | ||
460 | PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \ | ||
461 | PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \ | ||
462 | PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \ | ||
463 | PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \ | ||
464 | PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \ | ||
465 | PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \ | ||
466 | PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \ | ||
467 | PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \ | ||
468 | PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \ | ||
469 | PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \ | ||
470 | PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \ | ||
471 | PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | \ | ||
472 | PIN_OTYPE_PUSHPULL(GPIOC_PIN15)) | ||
473 | #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_100M(GPIOC_PIN0) |\ | ||
474 | PIN_OSPEED_100M(GPIOC_PIN1) | \ | ||
475 | PIN_OSPEED_100M(GPIOC_PIN2) | \ | ||
476 | PIN_OSPEED_100M(GPIOC_PIN3) | \ | ||
477 | PIN_OSPEED_100M(GPIOC_PIN4) | \ | ||
478 | PIN_OSPEED_100M(GPIOC_PIN5) | \ | ||
479 | PIN_OSPEED_100M(GPIOC_PIN6) | \ | ||
480 | PIN_OSPEED_100M(GPIOC_PIN7) | \ | ||
481 | PIN_OSPEED_100M(GPIOC_PIN8) | \ | ||
482 | PIN_OSPEED_100M(GPIOC_PIN9) | \ | ||
483 | PIN_OSPEED_100M(GPIOC_PIN10) | \ | ||
484 | PIN_OSPEED_100M(GPIOC_PIN11) | \ | ||
485 | PIN_OSPEED_100M(GPIOC_PIN12) | \ | ||
486 | PIN_OSPEED_100M(GPIOC_PIN13) | \ | ||
487 | PIN_OSPEED_100M(GPIOC_PIN14) | \ | ||
488 | PIN_OSPEED_100M(GPIOC_PIN15)) | ||
489 | #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(GPIOC_PIN0) | \ | ||
490 | PIN_PUPDR_FLOATING(GPIOC_PIN1) | \ | ||
491 | PIN_PUPDR_FLOATING(GPIOC_PIN2) | \ | ||
492 | PIN_PUPDR_FLOATING(GPIOC_PIN3) | \ | ||
493 | PIN_PUPDR_FLOATING(GPIOC_PIN4) | \ | ||
494 | PIN_PUPDR_FLOATING(GPIOC_PIN5) | \ | ||
495 | PIN_PUPDR_FLOATING(GPIOC_PIN6) | \ | ||
496 | PIN_PUPDR_FLOATING(GPIOC_PIN7) | \ | ||
497 | PIN_PUPDR_FLOATING(GPIOC_PIN8) | \ | ||
498 | PIN_PUPDR_FLOATING(GPIOC_PIN9) | \ | ||
499 | PIN_PUPDR_FLOATING(GPIOC_PIN10) | \ | ||
500 | PIN_PUPDR_FLOATING(GPIOC_PIN11) | \ | ||
501 | PIN_PUPDR_FLOATING(GPIOC_PIN12) | \ | ||
502 | PIN_PUPDR_FLOATING(GPIOC_PIN13) | \ | ||
503 | PIN_PUPDR_FLOATING(GPIOC_PIN14) | \ | ||
504 | PIN_PUPDR_FLOATING(GPIOC_PIN15)) | ||
505 | #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \ | ||
506 | PIN_ODR_HIGH(GPIOC_PIN1) | \ | ||
507 | PIN_ODR_HIGH(GPIOC_PIN2) | \ | ||
508 | PIN_ODR_HIGH(GPIOC_PIN3) | \ | ||
509 | PIN_ODR_HIGH(GPIOC_PIN4) | \ | ||
510 | PIN_ODR_HIGH(GPIOC_PIN5) | \ | ||
511 | PIN_ODR_HIGH(GPIOC_PIN6) | \ | ||
512 | PIN_ODR_HIGH(GPIOC_PIN7) | \ | ||
513 | PIN_ODR_HIGH(GPIOC_PIN8) | \ | ||
514 | PIN_ODR_HIGH(GPIOC_PIN9) | \ | ||
515 | PIN_ODR_HIGH(GPIOC_PIN10) | \ | ||
516 | PIN_ODR_HIGH(GPIOC_PIN11) | \ | ||
517 | PIN_ODR_HIGH(GPIOC_PIN12) | \ | ||
518 | PIN_ODR_HIGH(GPIOC_PIN13) | \ | ||
519 | PIN_ODR_HIGH(GPIOC_PIN14) | \ | ||
520 | PIN_ODR_HIGH(GPIOC_PIN15)) | ||
521 | #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0) | \ | ||
522 | PIN_AFIO_AF(GPIOC_PIN1, 0) | \ | ||
523 | PIN_AFIO_AF(GPIOC_PIN2, 0) | \ | ||
524 | PIN_AFIO_AF(GPIOC_PIN3, 0) | \ | ||
525 | PIN_AFIO_AF(GPIOC_PIN4, 0) | \ | ||
526 | PIN_AFIO_AF(GPIOC_PIN5, 0) | \ | ||
527 | PIN_AFIO_AF(GPIOC_PIN6, 0) | \ | ||
528 | PIN_AFIO_AF(GPIOC_PIN7, 0)) | ||
529 | #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0) | \ | ||
530 | PIN_AFIO_AF(GPIOC_PIN9, 0) | \ | ||
531 | PIN_AFIO_AF(GPIOC_PIN10, 0) | \ | ||
532 | PIN_AFIO_AF(GPIOC_PIN11, 0) | \ | ||
533 | PIN_AFIO_AF(GPIOC_PIN12, 0) | \ | ||
534 | PIN_AFIO_AF(GPIOC_PIN13, 0) | \ | ||
535 | PIN_AFIO_AF(GPIOC_PIN14, 0) | \ | ||
536 | PIN_AFIO_AF(GPIOC_PIN15, 0)) | ||
537 | |||
538 | /* | ||
539 | * GPIOD setup: | ||
540 | */ | ||
541 | #define VAL_GPIOD_MODER (PIN_MODE_ALTERNATE(GPIOD_MEM_D2) | \ | ||
542 | PIN_MODE_ALTERNATE(GPIOD_MEM_D3) | \ | ||
543 | PIN_MODE_INPUT(GPIOD_PIN2) | \ | ||
544 | PIN_MODE_INPUT(GPIOD_PIN3) | \ | ||
545 | PIN_MODE_ALTERNATE(GPIOD_MEM_OE) | \ | ||
546 | PIN_MODE_ALTERNATE(GPIOD_MEM_WE) | \ | ||
547 | PIN_MODE_INPUT(GPIOD_NAND_RB_NWAIT) | \ | ||
548 | PIN_MODE_ALTERNATE(GPIOD_NAND_CE1) | \ | ||
549 | PIN_MODE_ALTERNATE(GPIOD_MEM_D13) | \ | ||
550 | PIN_MODE_ALTERNATE(GPIOD_MEM_D14) | \ | ||
551 | PIN_MODE_ALTERNATE(GPIOD_MEM_D15) | \ | ||
552 | PIN_MODE_ALTERNATE(GPIOD_MEM_A16) | \ | ||
553 | PIN_MODE_ALTERNATE(GPIOD_MEM_A17) | \ | ||
554 | PIN_MODE_INPUT(GPIOD_PIN13) | \ | ||
555 | PIN_MODE_ALTERNATE(GPIOD_MEM_D0) | \ | ||
556 | PIN_MODE_ALTERNATE(GPIOD_MEM_D1)) | ||
557 | #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_MEM_D2) | \ | ||
558 | PIN_OTYPE_PUSHPULL(GPIOD_MEM_D3) | \ | ||
559 | PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \ | ||
560 | PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \ | ||
561 | PIN_OTYPE_PUSHPULL(GPIOD_MEM_OE) | \ | ||
562 | PIN_OTYPE_PUSHPULL(GPIOD_MEM_WE) | \ | ||
563 | PIN_OTYPE_PUSHPULL(GPIOD_NAND_RB_NWAIT) |\ | ||
564 | PIN_OTYPE_PUSHPULL(GPIOD_NAND_CE1) | \ | ||
565 | PIN_OTYPE_PUSHPULL(GPIOD_MEM_D13) | \ | ||
566 | PIN_OTYPE_PUSHPULL(GPIOD_MEM_D14) | \ | ||
567 | PIN_OTYPE_PUSHPULL(GPIOD_MEM_D15) | \ | ||
568 | PIN_OTYPE_PUSHPULL(GPIOD_MEM_A16) | \ | ||
569 | PIN_OTYPE_PUSHPULL(GPIOD_MEM_A17) | \ | ||
570 | PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \ | ||
571 | PIN_OTYPE_PUSHPULL(GPIOD_MEM_D0) | \ | ||
572 | PIN_OTYPE_PUSHPULL(GPIOD_MEM_D1)) | ||
573 | #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_100M(GPIOD_MEM_D2) | \ | ||
574 | PIN_OSPEED_100M(GPIOD_MEM_D3) | \ | ||
575 | PIN_OSPEED_100M(GPIOD_PIN2) | \ | ||
576 | PIN_OSPEED_100M(GPIOD_PIN3) | \ | ||
577 | PIN_OSPEED_100M(GPIOD_MEM_OE) | \ | ||
578 | PIN_OSPEED_100M(GPIOD_MEM_WE) | \ | ||
579 | PIN_OSPEED_100M(GPIOD_NAND_RB_NWAIT) | \ | ||
580 | PIN_OSPEED_100M(GPIOD_NAND_CE1) | \ | ||
581 | PIN_OSPEED_100M(GPIOD_MEM_D13) | \ | ||
582 | PIN_OSPEED_100M(GPIOD_MEM_D14) | \ | ||
583 | PIN_OSPEED_100M(GPIOD_MEM_D15) | \ | ||
584 | PIN_OSPEED_100M(GPIOD_MEM_A16) | \ | ||
585 | PIN_OSPEED_100M(GPIOD_MEM_A17) | \ | ||
586 | PIN_OSPEED_100M(GPIOD_PIN13) | \ | ||
587 | PIN_OSPEED_100M(GPIOD_MEM_D0) | \ | ||
588 | PIN_OSPEED_100M(GPIOD_MEM_D1)) | ||
589 | |||
590 | #define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(GPIOD_MEM_D2) | \ | ||
591 | PIN_PUPDR_FLOATING(GPIOD_MEM_D3) | \ | ||
592 | PIN_PUPDR_FLOATING(GPIOD_PIN2) | \ | ||
593 | PIN_PUPDR_FLOATING(GPIOD_PIN3) | \ | ||
594 | PIN_PUPDR_FLOATING(GPIOD_MEM_OE) | \ | ||
595 | PIN_PUPDR_FLOATING(GPIOD_MEM_WE) | \ | ||
596 | PIN_PUPDR_FLOATING(GPIOD_NAND_RB_NWAIT) |\ | ||
597 | PIN_PUPDR_PULLUP(GPIOD_NAND_CE1) | \ | ||
598 | PIN_PUPDR_FLOATING(GPIOD_MEM_D13) | \ | ||
599 | PIN_PUPDR_FLOATING(GPIOD_MEM_D14) | \ | ||
600 | PIN_PUPDR_FLOATING(GPIOD_MEM_D15) | \ | ||
601 | PIN_PUPDR_FLOATING(GPIOD_MEM_A16) | \ | ||
602 | PIN_PUPDR_FLOATING(GPIOD_MEM_A17) | \ | ||
603 | PIN_PUPDR_FLOATING(GPIOD_PIN13) | \ | ||
604 | PIN_PUPDR_FLOATING(GPIOD_MEM_D0) | \ | ||
605 | PIN_PUPDR_FLOATING(GPIOD_MEM_D1)) | ||
606 | #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_MEM_D2) | \ | ||
607 | PIN_ODR_HIGH(GPIOD_MEM_D3) | \ | ||
608 | PIN_ODR_HIGH(GPIOD_PIN2) | \ | ||
609 | PIN_ODR_HIGH(GPIOD_PIN3) | \ | ||
610 | PIN_ODR_HIGH(GPIOD_MEM_OE) | \ | ||
611 | PIN_ODR_HIGH(GPIOD_MEM_WE) | \ | ||
612 | PIN_ODR_HIGH(GPIOD_NAND_RB_NWAIT) | \ | ||
613 | PIN_ODR_HIGH(GPIOD_NAND_CE1) | \ | ||
614 | PIN_ODR_HIGH(GPIOD_MEM_D13) | \ | ||
615 | PIN_ODR_HIGH(GPIOD_MEM_D14) | \ | ||
616 | PIN_ODR_HIGH(GPIOD_MEM_D15) | \ | ||
617 | PIN_ODR_HIGH(GPIOD_MEM_A16) | \ | ||
618 | PIN_ODR_HIGH(GPIOD_MEM_A17) | \ | ||
619 | PIN_ODR_HIGH(GPIOD_PIN13) | \ | ||
620 | PIN_ODR_HIGH(GPIOD_MEM_D0) | \ | ||
621 | PIN_ODR_HIGH(GPIOD_MEM_D1)) | ||
622 | #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_MEM_D2, 12) | \ | ||
623 | PIN_AFIO_AF(GPIOD_MEM_D3, 12) | \ | ||
624 | PIN_AFIO_AF(GPIOD_PIN2, 0) | \ | ||
625 | PIN_AFIO_AF(GPIOD_PIN3, 0) | \ | ||
626 | PIN_AFIO_AF(GPIOD_MEM_OE, 12) | \ | ||
627 | PIN_AFIO_AF(GPIOD_MEM_WE, 12) | \ | ||
628 | PIN_AFIO_AF(GPIOD_NAND_RB_NWAIT, 0) | \ | ||
629 | PIN_AFIO_AF(GPIOD_NAND_CE1, 12)) | ||
630 | #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_MEM_D13, 12) | \ | ||
631 | PIN_AFIO_AF(GPIOD_MEM_D14, 12) | \ | ||
632 | PIN_AFIO_AF(GPIOD_MEM_D15, 12) | \ | ||
633 | PIN_AFIO_AF(GPIOD_MEM_A16, 12) | \ | ||
634 | PIN_AFIO_AF(GPIOD_MEM_A17, 12) | \ | ||
635 | PIN_AFIO_AF(GPIOD_PIN13, 0) | \ | ||
636 | PIN_AFIO_AF(GPIOD_MEM_D0, 12) | \ | ||
637 | PIN_AFIO_AF(GPIOD_MEM_D1, 12)) | ||
638 | |||
639 | /* | ||
640 | * GPIOE setup: | ||
641 | */ | ||
642 | #define VAL_GPIOE_MODER (PIN_MODE_ALTERNATE(GPIOE_SRAM_LB) | \ | ||
643 | PIN_MODE_ALTERNATE(GPIOE_SRAM_UB) | \ | ||
644 | PIN_MODE_INPUT(GPIOE_PIN2) | \ | ||
645 | PIN_MODE_INPUT(GPIOE_PIN3) | \ | ||
646 | PIN_MODE_INPUT(GPIOE_PIN4) | \ | ||
647 | PIN_MODE_INPUT(GPIOE_PIN5) | \ | ||
648 | PIN_MODE_INPUT(GPIOE_PIN6) | \ | ||
649 | PIN_MODE_ALTERNATE(GPIOE_MEM_D4) | \ | ||
650 | PIN_MODE_ALTERNATE(GPIOE_MEM_D5) | \ | ||
651 | PIN_MODE_ALTERNATE(GPIOE_MEM_D6) | \ | ||
652 | PIN_MODE_ALTERNATE(GPIOE_MEM_D7) | \ | ||
653 | PIN_MODE_ALTERNATE(GPIOE_MEM_D8) | \ | ||
654 | PIN_MODE_ALTERNATE(GPIOE_MEM_D9) | \ | ||
655 | PIN_MODE_ALTERNATE(GPIOE_MEM_D10) | \ | ||
656 | PIN_MODE_ALTERNATE(GPIOE_MEM_D11) | \ | ||
657 | PIN_MODE_ALTERNATE(GPIOE_MEM_D12)) | ||
658 | #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_SRAM_LB) | \ | ||
659 | PIN_OTYPE_PUSHPULL(GPIOE_SRAM_UB) | \ | ||
660 | PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \ | ||
661 | PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \ | ||
662 | PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \ | ||
663 | PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \ | ||
664 | PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \ | ||
665 | PIN_OTYPE_PUSHPULL(GPIOE_MEM_D4) | \ | ||
666 | PIN_OTYPE_PUSHPULL(GPIOE_MEM_D5) | \ | ||
667 | PIN_OTYPE_PUSHPULL(GPIOE_MEM_D6) | \ | ||
668 | PIN_OTYPE_PUSHPULL(GPIOE_MEM_D7) | \ | ||
669 | PIN_OTYPE_PUSHPULL(GPIOE_MEM_D8) | \ | ||
670 | PIN_OTYPE_PUSHPULL(GPIOE_MEM_D9) | \ | ||
671 | PIN_OTYPE_PUSHPULL(GPIOE_MEM_D10) | \ | ||
672 | PIN_OTYPE_PUSHPULL(GPIOE_MEM_D11) | \ | ||
673 | PIN_OTYPE_PUSHPULL(GPIOE_MEM_D12)) | ||
674 | #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_100M(GPIOE_SRAM_LB) | \ | ||
675 | PIN_OSPEED_100M(GPIOE_SRAM_UB) | \ | ||
676 | PIN_OSPEED_100M(GPIOE_PIN2) | \ | ||
677 | PIN_OSPEED_100M(GPIOE_PIN3) | \ | ||
678 | PIN_OSPEED_100M(GPIOE_PIN4) | \ | ||
679 | PIN_OSPEED_100M(GPIOE_PIN5) | \ | ||
680 | PIN_OSPEED_100M(GPIOE_PIN6) | \ | ||
681 | PIN_OSPEED_100M(GPIOE_MEM_D4) | \ | ||
682 | PIN_OSPEED_100M(GPIOE_MEM_D5) | \ | ||
683 | PIN_OSPEED_100M(GPIOE_MEM_D6) | \ | ||
684 | PIN_OSPEED_100M(GPIOE_MEM_D7) | \ | ||
685 | PIN_OSPEED_100M(GPIOE_MEM_D8) | \ | ||
686 | PIN_OSPEED_100M(GPIOE_MEM_D9) | \ | ||
687 | PIN_OSPEED_100M(GPIOE_MEM_D10) | \ | ||
688 | PIN_OSPEED_100M(GPIOE_MEM_D11) | \ | ||
689 | PIN_OSPEED_100M(GPIOE_MEM_D12)) | ||
690 | #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(GPIOE_SRAM_LB) | \ | ||
691 | PIN_PUPDR_FLOATING(GPIOE_SRAM_UB) | \ | ||
692 | PIN_PUPDR_FLOATING(GPIOE_PIN2) | \ | ||
693 | PIN_PUPDR_FLOATING(GPIOE_PIN3) | \ | ||
694 | PIN_PUPDR_FLOATING(GPIOE_PIN4) | \ | ||
695 | PIN_PUPDR_FLOATING(GPIOE_PIN5) | \ | ||
696 | PIN_PUPDR_FLOATING(GPIOE_PIN6) | \ | ||
697 | PIN_PUPDR_FLOATING(GPIOE_MEM_D4) | \ | ||
698 | PIN_PUPDR_FLOATING(GPIOE_MEM_D5) | \ | ||
699 | PIN_PUPDR_FLOATING(GPIOE_MEM_D6) | \ | ||
700 | PIN_PUPDR_FLOATING(GPIOE_MEM_D7) | \ | ||
701 | PIN_PUPDR_FLOATING(GPIOE_MEM_D8) | \ | ||
702 | PIN_PUPDR_FLOATING(GPIOE_MEM_D9) | \ | ||
703 | PIN_PUPDR_FLOATING(GPIOE_MEM_D10) | \ | ||
704 | PIN_PUPDR_FLOATING(GPIOE_MEM_D11) | \ | ||
705 | PIN_PUPDR_FLOATING(GPIOE_MEM_D12)) | ||
706 | #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_SRAM_LB) | \ | ||
707 | PIN_ODR_HIGH(GPIOE_SRAM_UB) | \ | ||
708 | PIN_ODR_HIGH(GPIOE_PIN2) | \ | ||
709 | PIN_ODR_HIGH(GPIOE_PIN3) | \ | ||
710 | PIN_ODR_HIGH(GPIOE_PIN4) | \ | ||
711 | PIN_ODR_HIGH(GPIOE_PIN5) | \ | ||
712 | PIN_ODR_HIGH(GPIOE_PIN6) | \ | ||
713 | PIN_ODR_HIGH(GPIOE_MEM_D4) | \ | ||
714 | PIN_ODR_HIGH(GPIOE_MEM_D5) | \ | ||
715 | PIN_ODR_HIGH(GPIOE_MEM_D6) | \ | ||
716 | PIN_ODR_HIGH(GPIOE_MEM_D7) | \ | ||
717 | PIN_ODR_HIGH(GPIOE_MEM_D8) | \ | ||
718 | PIN_ODR_HIGH(GPIOE_MEM_D9) | \ | ||
719 | PIN_ODR_HIGH(GPIOE_MEM_D10) | \ | ||
720 | PIN_ODR_HIGH(GPIOE_MEM_D11) | \ | ||
721 | PIN_ODR_HIGH(GPIOE_MEM_D12)) | ||
722 | #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_SRAM_LB, 12) | \ | ||
723 | PIN_AFIO_AF(GPIOE_SRAM_UB, 12) | \ | ||
724 | PIN_AFIO_AF(GPIOE_PIN2, 0) | \ | ||
725 | PIN_AFIO_AF(GPIOE_PIN3, 0) | \ | ||
726 | PIN_AFIO_AF(GPIOE_PIN4, 0) | \ | ||
727 | PIN_AFIO_AF(GPIOE_PIN5, 0) | \ | ||
728 | PIN_AFIO_AF(GPIOE_PIN6, 0) | \ | ||
729 | PIN_AFIO_AF(GPIOE_MEM_D4, 12)) | ||
730 | #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_MEM_D5, 12) | \ | ||
731 | PIN_AFIO_AF(GPIOE_MEM_D6, 12) | \ | ||
732 | PIN_AFIO_AF(GPIOE_MEM_D7, 12) | \ | ||
733 | PIN_AFIO_AF(GPIOE_MEM_D8, 12) | \ | ||
734 | PIN_AFIO_AF(GPIOE_MEM_D9, 12) | \ | ||
735 | PIN_AFIO_AF(GPIOE_MEM_D10, 12) | \ | ||
736 | PIN_AFIO_AF(GPIOE_MEM_D11, 12) | \ | ||
737 | PIN_AFIO_AF(GPIOE_MEM_D12, 12)) | ||
738 | |||
739 | /* | ||
740 | * GPIOF setup: | ||
741 | */ | ||
742 | #define VAL_GPIOF_MODER (PIN_MODE_ALTERNATE(GPIOF_MEM_A0) | \ | ||
743 | PIN_MODE_ALTERNATE(GPIOF_MEM_A1) | \ | ||
744 | PIN_MODE_ALTERNATE(GPIOF_MEM_A2) | \ | ||
745 | PIN_MODE_ALTERNATE(GPIOF_MEM_A3) | \ | ||
746 | PIN_MODE_ALTERNATE(GPIOF_MEM_A4) | \ | ||
747 | PIN_MODE_ALTERNATE(GPIOF_MEM_A5) | \ | ||
748 | PIN_MODE_INPUT(GPIOF_PIN6) | \ | ||
749 | PIN_MODE_INPUT(GPIOF_PIN7) | \ | ||
750 | PIN_MODE_INPUT(GPIOF_PIN8) | \ | ||
751 | PIN_MODE_INPUT(GPIOF_PIN9) | \ | ||
752 | PIN_MODE_INPUT(GPIOF_PIN10) | \ | ||
753 | PIN_MODE_INPUT(GPIOF_PIN11) | \ | ||
754 | PIN_MODE_ALTERNATE(GPIOF_MEM_A6) | \ | ||
755 | PIN_MODE_ALTERNATE(GPIOF_MEM_A7) | \ | ||
756 | PIN_MODE_ALTERNATE(GPIOF_MEM_A8) | \ | ||
757 | PIN_MODE_ALTERNATE(GPIOF_MEM_A9)) | ||
758 | #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_MEM_A0) | \ | ||
759 | PIN_OTYPE_PUSHPULL(GPIOF_MEM_A1) | \ | ||
760 | PIN_OTYPE_PUSHPULL(GPIOF_MEM_A2) | \ | ||
761 | PIN_OTYPE_PUSHPULL(GPIOF_MEM_A3) | \ | ||
762 | PIN_OTYPE_PUSHPULL(GPIOF_MEM_A4) | \ | ||
763 | PIN_OTYPE_PUSHPULL(GPIOF_MEM_A5) | \ | ||
764 | PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \ | ||
765 | PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \ | ||
766 | PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \ | ||
767 | PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \ | ||
768 | PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \ | ||
769 | PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \ | ||
770 | PIN_OTYPE_PUSHPULL(GPIOF_MEM_A6) | \ | ||
771 | PIN_OTYPE_PUSHPULL(GPIOF_MEM_A7) | \ | ||
772 | PIN_OTYPE_PUSHPULL(GPIOF_MEM_A8) | \ | ||
773 | PIN_OTYPE_PUSHPULL(GPIOF_MEM_A9)) | ||
774 | #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_100M(GPIOF_MEM_A0) | \ | ||
775 | PIN_OSPEED_100M(GPIOF_MEM_A1) | \ | ||
776 | PIN_OSPEED_100M(GPIOF_MEM_A2) | \ | ||
777 | PIN_OSPEED_100M(GPIOF_MEM_A3) | \ | ||
778 | PIN_OSPEED_100M(GPIOF_MEM_A4) | \ | ||
779 | PIN_OSPEED_100M(GPIOF_MEM_A5) | \ | ||
780 | PIN_OSPEED_100M(GPIOF_PIN6) | \ | ||
781 | PIN_OSPEED_100M(GPIOF_PIN7) | \ | ||
782 | PIN_OSPEED_100M(GPIOF_PIN8) | \ | ||
783 | PIN_OSPEED_100M(GPIOF_PIN9) | \ | ||
784 | PIN_OSPEED_100M(GPIOF_PIN10) | \ | ||
785 | PIN_OSPEED_100M(GPIOF_PIN11) | \ | ||
786 | PIN_OSPEED_100M(GPIOF_MEM_A6) | \ | ||
787 | PIN_OSPEED_100M(GPIOF_MEM_A7) | \ | ||
788 | PIN_OSPEED_100M(GPIOF_MEM_A8) | \ | ||
789 | PIN_OSPEED_100M(GPIOF_MEM_A9)) | ||
790 | #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_MEM_A0) | \ | ||
791 | PIN_PUPDR_FLOATING(GPIOF_MEM_A1) | \ | ||
792 | PIN_PUPDR_FLOATING(GPIOF_MEM_A2) | \ | ||
793 | PIN_PUPDR_FLOATING(GPIOF_MEM_A3) | \ | ||
794 | PIN_PUPDR_FLOATING(GPIOF_MEM_A4) | \ | ||
795 | PIN_PUPDR_FLOATING(GPIOF_MEM_A5) | \ | ||
796 | PIN_PUPDR_FLOATING(GPIOF_PIN6) | \ | ||
797 | PIN_PUPDR_FLOATING(GPIOF_PIN7) | \ | ||
798 | PIN_PUPDR_FLOATING(GPIOF_PIN8) | \ | ||
799 | PIN_PUPDR_FLOATING(GPIOF_PIN9) | \ | ||
800 | PIN_PUPDR_FLOATING(GPIOF_PIN10) | \ | ||
801 | PIN_PUPDR_FLOATING(GPIOF_PIN11) | \ | ||
802 | PIN_PUPDR_FLOATING(GPIOF_MEM_A6) | \ | ||
803 | PIN_PUPDR_FLOATING(GPIOF_MEM_A7) | \ | ||
804 | PIN_PUPDR_FLOATING(GPIOF_MEM_A8) | \ | ||
805 | PIN_PUPDR_FLOATING(GPIOF_MEM_A9)) | ||
806 | #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_MEM_A0) | \ | ||
807 | PIN_ODR_HIGH(GPIOF_MEM_A1) | \ | ||
808 | PIN_ODR_HIGH(GPIOF_MEM_A2) | \ | ||
809 | PIN_ODR_HIGH(GPIOF_MEM_A3) | \ | ||
810 | PIN_ODR_HIGH(GPIOF_MEM_A4) | \ | ||
811 | PIN_ODR_HIGH(GPIOF_MEM_A5) | \ | ||
812 | PIN_ODR_HIGH(GPIOF_PIN6) | \ | ||
813 | PIN_ODR_HIGH(GPIOF_PIN7) | \ | ||
814 | PIN_ODR_HIGH(GPIOF_PIN8) | \ | ||
815 | PIN_ODR_HIGH(GPIOF_PIN9) | \ | ||
816 | PIN_ODR_HIGH(GPIOF_PIN10) | \ | ||
817 | PIN_ODR_HIGH(GPIOF_PIN11) | \ | ||
818 | PIN_ODR_HIGH(GPIOF_MEM_A6) | \ | ||
819 | PIN_ODR_HIGH(GPIOF_MEM_A7) | \ | ||
820 | PIN_ODR_HIGH(GPIOF_MEM_A8) | \ | ||
821 | PIN_ODR_HIGH(GPIOF_MEM_A9)) | ||
822 | #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_MEM_A0, 12) | \ | ||
823 | PIN_AFIO_AF(GPIOF_MEM_A1, 12) | \ | ||
824 | PIN_AFIO_AF(GPIOF_MEM_A2, 12) | \ | ||
825 | PIN_AFIO_AF(GPIOF_MEM_A3, 12) | \ | ||
826 | PIN_AFIO_AF(GPIOF_MEM_A4, 12) | \ | ||
827 | PIN_AFIO_AF(GPIOF_MEM_A5, 12) | \ | ||
828 | PIN_AFIO_AF(GPIOF_PIN6, 0) | \ | ||
829 | PIN_AFIO_AF(GPIOF_PIN7, 0)) | ||
830 | #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0) | \ | ||
831 | PIN_AFIO_AF(GPIOF_PIN9, 0) | \ | ||
832 | PIN_AFIO_AF(GPIOF_PIN10, 0) | \ | ||
833 | PIN_AFIO_AF(GPIOF_PIN11, 0) | \ | ||
834 | PIN_AFIO_AF(GPIOF_MEM_A6, 12) | \ | ||
835 | PIN_AFIO_AF(GPIOF_MEM_A7, 12) | \ | ||
836 | PIN_AFIO_AF(GPIOF_MEM_A8, 12) | \ | ||
837 | PIN_AFIO_AF(GPIOF_MEM_A9, 12)) | ||
838 | |||
839 | /* | ||
840 | * GPIOG setup: | ||
841 | */ | ||
842 | #define VAL_GPIOG_MODER (PIN_MODE_ALTERNATE(GPIOG_MEM_A10) | \ | ||
843 | PIN_MODE_ALTERNATE(GPIOG_MEM_A11) | \ | ||
844 | PIN_MODE_ALTERNATE(GPIOG_MEM_A12) | \ | ||
845 | PIN_MODE_ALTERNATE(GPIOG_MEM_A13) | \ | ||
846 | PIN_MODE_ALTERNATE(GPIOG_MEM_A14) | \ | ||
847 | PIN_MODE_ALTERNATE(GPIOG_MEM_A15) | \ | ||
848 | PIN_MODE_ALTERNATE(GPIOG_NAND_RB1) | \ | ||
849 | PIN_MODE_ALTERNATE(GPIOG_NAND_RB2) | \ | ||
850 | PIN_MODE_INPUT(GPIOG_PIN8) | \ | ||
851 | PIN_MODE_ALTERNATE(GPIOG_NAND_CE2) | \ | ||
852 | PIN_MODE_INPUT(GPIOG_PIN10) | \ | ||
853 | PIN_MODE_INPUT(GPIOG_PIN11) | \ | ||
854 | PIN_MODE_ALTERNATE(GPIOG_SRAM_CS1) | \ | ||
855 | PIN_MODE_INPUT(GPIOG_PIN13) | \ | ||
856 | PIN_MODE_INPUT(GPIOG_PIN14) | \ | ||
857 | PIN_MODE_INPUT(GPIOG_PIN15)) | ||
858 | #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_MEM_A10) | \ | ||
859 | PIN_OTYPE_PUSHPULL(GPIOG_MEM_A11) | \ | ||
860 | PIN_OTYPE_PUSHPULL(GPIOG_MEM_A12) | \ | ||
861 | PIN_OTYPE_PUSHPULL(GPIOG_MEM_A13) | \ | ||
862 | PIN_OTYPE_PUSHPULL(GPIOG_MEM_A14) | \ | ||
863 | PIN_OTYPE_PUSHPULL(GPIOG_MEM_A15) | \ | ||
864 | PIN_OTYPE_PUSHPULL(GPIOG_NAND_RB1) | \ | ||
865 | PIN_OTYPE_PUSHPULL(GPIOG_NAND_RB2) | \ | ||
866 | PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | \ | ||
867 | PIN_OTYPE_PUSHPULL(GPIOG_NAND_CE2) | \ | ||
868 | PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | \ | ||
869 | PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | \ | ||
870 | PIN_OTYPE_PUSHPULL(GPIOG_SRAM_CS1) | \ | ||
871 | PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | \ | ||
872 | PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | \ | ||
873 | PIN_OTYPE_PUSHPULL(GPIOG_PIN15)) | ||
874 | #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_100M(GPIOG_MEM_A10) | \ | ||
875 | PIN_OSPEED_100M(GPIOG_MEM_A11) | \ | ||
876 | PIN_OSPEED_100M(GPIOG_MEM_A12) | \ | ||
877 | PIN_OSPEED_100M(GPIOG_MEM_A13) | \ | ||
878 | PIN_OSPEED_100M(GPIOG_MEM_A14) | \ | ||
879 | PIN_OSPEED_100M(GPIOG_MEM_A15) | \ | ||
880 | PIN_OSPEED_100M(GPIOG_NAND_RB1) | \ | ||
881 | PIN_OSPEED_100M(GPIOG_NAND_RB2) | \ | ||
882 | PIN_OSPEED_100M(GPIOG_PIN8) | \ | ||
883 | PIN_OSPEED_100M(GPIOG_NAND_CE2) | \ | ||
884 | PIN_OSPEED_100M(GPIOG_PIN10) | \ | ||
885 | PIN_OSPEED_100M(GPIOG_PIN11) | \ | ||
886 | PIN_OSPEED_100M(GPIOG_SRAM_CS1) | \ | ||
887 | PIN_OSPEED_100M(GPIOG_PIN13) | \ | ||
888 | PIN_OSPEED_100M(GPIOG_PIN14) | \ | ||
889 | PIN_OSPEED_100M(GPIOG_PIN15)) | ||
890 | |||
891 | #define VAL_GPIOG_PUPDR (PIN_PUPDR_FLOATING(GPIOG_MEM_A10) | \ | ||
892 | PIN_PUPDR_FLOATING(GPIOG_MEM_A11) | \ | ||
893 | PIN_PUPDR_FLOATING(GPIOG_MEM_A12) | \ | ||
894 | PIN_PUPDR_FLOATING(GPIOG_MEM_A13) | \ | ||
895 | PIN_PUPDR_FLOATING(GPIOG_MEM_A14) | \ | ||
896 | PIN_PUPDR_FLOATING(GPIOG_MEM_A15) | \ | ||
897 | PIN_PUPDR_PULLUP(GPIOG_NAND_RB1) | \ | ||
898 | PIN_PUPDR_FLOATING(GPIOG_NAND_RB2) | \ | ||
899 | PIN_PUPDR_FLOATING(GPIOG_PIN8) | \ | ||
900 | PIN_PUPDR_PULLUP(GPIOG_NAND_CE2) | \ | ||
901 | PIN_PUPDR_FLOATING(GPIOG_PIN10) | \ | ||
902 | PIN_PUPDR_FLOATING(GPIOG_PIN11) | \ | ||
903 | PIN_PUPDR_FLOATING(GPIOG_SRAM_CS1) | \ | ||
904 | PIN_PUPDR_FLOATING(GPIOG_PIN13) | \ | ||
905 | PIN_PUPDR_FLOATING(GPIOG_PIN14) | \ | ||
906 | PIN_PUPDR_FLOATING(GPIOG_PIN15)) | ||
907 | #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_MEM_A10) | \ | ||
908 | PIN_ODR_HIGH(GPIOG_MEM_A11) | \ | ||
909 | PIN_ODR_HIGH(GPIOG_MEM_A12) | \ | ||
910 | PIN_ODR_HIGH(GPIOG_MEM_A13) | \ | ||
911 | PIN_ODR_HIGH(GPIOG_MEM_A14) | \ | ||
912 | PIN_ODR_HIGH(GPIOG_MEM_A15) | \ | ||
913 | PIN_ODR_HIGH(GPIOG_NAND_RB1) | \ | ||
914 | PIN_ODR_HIGH(GPIOG_NAND_RB2) | \ | ||
915 | PIN_ODR_HIGH(GPIOG_PIN8) | \ | ||
916 | PIN_ODR_HIGH(GPIOG_NAND_CE2) | \ | ||
917 | PIN_ODR_HIGH(GPIOG_PIN10) | \ | ||
918 | PIN_ODR_HIGH(GPIOG_PIN11) | \ | ||
919 | PIN_ODR_HIGH(GPIOG_SRAM_CS1) | \ | ||
920 | PIN_ODR_HIGH(GPIOG_PIN13) | \ | ||
921 | PIN_ODR_HIGH(GPIOG_PIN14) | \ | ||
922 | PIN_ODR_HIGH(GPIOG_PIN15)) | ||
923 | #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_MEM_A10, 12) | \ | ||
924 | PIN_AFIO_AF(GPIOG_MEM_A11, 12) | \ | ||
925 | PIN_AFIO_AF(GPIOG_MEM_A12, 12) | \ | ||
926 | PIN_AFIO_AF(GPIOG_MEM_A13, 12) | \ | ||
927 | PIN_AFIO_AF(GPIOG_MEM_A14, 12) | \ | ||
928 | PIN_AFIO_AF(GPIOG_MEM_A15, 12) | \ | ||
929 | PIN_AFIO_AF(GPIOG_NAND_RB1, 12) | \ | ||
930 | PIN_AFIO_AF(GPIOG_NAND_RB2, 12)) | ||
931 | #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0) | \ | ||
932 | PIN_AFIO_AF(GPIOG_NAND_CE2, 12) | \ | ||
933 | PIN_AFIO_AF(GPIOG_PIN10, 0) | \ | ||
934 | PIN_AFIO_AF(GPIOG_PIN11, 0) | \ | ||
935 | PIN_AFIO_AF(GPIOG_SRAM_CS1, 12) | \ | ||
936 | PIN_AFIO_AF(GPIOG_PIN13, 0) | \ | ||
937 | PIN_AFIO_AF(GPIOG_PIN14, 0) | \ | ||
938 | PIN_AFIO_AF(GPIOG_PIN15, 0)) | ||
939 | |||
940 | /* | ||
941 | * GPIOH setup: | ||
942 | */ | ||
943 | #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \ | ||
944 | PIN_MODE_INPUT(GPIOH_OSC_OUT) | \ | ||
945 | PIN_MODE_INPUT(GPIOH_PIN2) | \ | ||
946 | PIN_MODE_INPUT(GPIOH_PIN3) | \ | ||
947 | PIN_MODE_INPUT(GPIOH_PIN4) | \ | ||
948 | PIN_MODE_INPUT(GPIOH_PIN5) | \ | ||
949 | PIN_MODE_INPUT(GPIOH_PIN6) | \ | ||
950 | PIN_MODE_ALTERNATE(GPIOH_I2C3_SCL) | \ | ||
951 | PIN_MODE_ALTERNATE(GPIOH_I2C3_SDA) | \ | ||
952 | PIN_MODE_INPUT(GPIOH_PIN9) | \ | ||
953 | PIN_MODE_INPUT(GPIOH_PIN10) | \ | ||
954 | PIN_MODE_INPUT(GPIOH_PIN11) | \ | ||
955 | PIN_MODE_INPUT(GPIOH_PIN12) | \ | ||
956 | PIN_MODE_INPUT(GPIOH_PIN13) | \ | ||
957 | PIN_MODE_INPUT(GPIOH_PIN14) | \ | ||
958 | PIN_MODE_INPUT(GPIOH_PIN15)) | ||
959 | #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \ | ||
960 | PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \ | ||
961 | PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \ | ||
962 | PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \ | ||
963 | PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \ | ||
964 | PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \ | ||
965 | PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \ | ||
966 | PIN_OTYPE_OPENDRAIN(GPIOH_I2C3_SCL) | \ | ||
967 | PIN_OTYPE_OPENDRAIN(GPIOH_I2C3_SDA) | \ | ||
968 | PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \ | ||
969 | PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \ | ||
970 | PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \ | ||
971 | PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \ | ||
972 | PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \ | ||
973 | PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \ | ||
974 | PIN_OTYPE_PUSHPULL(GPIOH_PIN15)) | ||
975 | #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_100M(GPIOH_OSC_IN) | \ | ||
976 | PIN_OSPEED_100M(GPIOH_OSC_OUT) | \ | ||
977 | PIN_OSPEED_100M(GPIOH_PIN2) | \ | ||
978 | PIN_OSPEED_100M(GPIOH_PIN3) | \ | ||
979 | PIN_OSPEED_100M(GPIOH_PIN4) | \ | ||
980 | PIN_OSPEED_100M(GPIOH_PIN5) | \ | ||
981 | PIN_OSPEED_100M(GPIOH_PIN6) | \ | ||
982 | PIN_OSPEED_2M(GPIOH_I2C3_SCL) | \ | ||
983 | PIN_OSPEED_2M(GPIOH_I2C3_SDA) | \ | ||
984 | PIN_OSPEED_100M(GPIOH_PIN9) | \ | ||
985 | PIN_OSPEED_100M(GPIOH_PIN10) | \ | ||
986 | PIN_OSPEED_100M(GPIOH_PIN11) | \ | ||
987 | PIN_OSPEED_100M(GPIOH_PIN12) | \ | ||
988 | PIN_OSPEED_100M(GPIOH_PIN13) | \ | ||
989 | PIN_OSPEED_100M(GPIOH_PIN14) | \ | ||
990 | PIN_OSPEED_100M(GPIOH_PIN15)) | ||
991 | #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \ | ||
992 | PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \ | ||
993 | PIN_PUPDR_FLOATING(GPIOH_PIN2) | \ | ||
994 | PIN_PUPDR_FLOATING(GPIOH_PIN3) | \ | ||
995 | PIN_PUPDR_FLOATING(GPIOH_PIN4) | \ | ||
996 | PIN_PUPDR_FLOATING(GPIOH_PIN5) | \ | ||
997 | PIN_PUPDR_FLOATING(GPIOH_PIN6) | \ | ||
998 | PIN_PUPDR_FLOATING(GPIOH_I2C3_SCL) | \ | ||
999 | PIN_PUPDR_FLOATING(GPIOH_I2C3_SDA) | \ | ||
1000 | PIN_PUPDR_FLOATING(GPIOH_PIN9) | \ | ||
1001 | PIN_PUPDR_FLOATING(GPIOH_PIN10) | \ | ||
1002 | PIN_PUPDR_FLOATING(GPIOH_PIN11) | \ | ||
1003 | PIN_PUPDR_FLOATING(GPIOH_PIN12) | \ | ||
1004 | PIN_PUPDR_FLOATING(GPIOH_PIN13) | \ | ||
1005 | PIN_PUPDR_FLOATING(GPIOH_PIN14) | \ | ||
1006 | PIN_PUPDR_FLOATING(GPIOH_PIN15)) | ||
1007 | #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \ | ||
1008 | PIN_ODR_HIGH(GPIOH_OSC_OUT) | \ | ||
1009 | PIN_ODR_HIGH(GPIOH_PIN2) | \ | ||
1010 | PIN_ODR_HIGH(GPIOH_PIN3) | \ | ||
1011 | PIN_ODR_HIGH(GPIOH_PIN4) | \ | ||
1012 | PIN_ODR_HIGH(GPIOH_PIN5) | \ | ||
1013 | PIN_ODR_HIGH(GPIOH_PIN6) | \ | ||
1014 | PIN_ODR_HIGH(GPIOH_I2C3_SCL) | \ | ||
1015 | PIN_ODR_HIGH(GPIOH_I2C3_SDA) | \ | ||
1016 | PIN_ODR_HIGH(GPIOH_PIN9) | \ | ||
1017 | PIN_ODR_HIGH(GPIOH_PIN10) | \ | ||
1018 | PIN_ODR_HIGH(GPIOH_PIN11) | \ | ||
1019 | PIN_ODR_HIGH(GPIOH_PIN12) | \ | ||
1020 | PIN_ODR_HIGH(GPIOH_PIN13) | \ | ||
1021 | PIN_ODR_HIGH(GPIOH_PIN14) | \ | ||
1022 | PIN_ODR_HIGH(GPIOH_PIN15)) | ||
1023 | #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0) | \ | ||
1024 | PIN_AFIO_AF(GPIOH_OSC_OUT, 0) | \ | ||
1025 | PIN_AFIO_AF(GPIOH_PIN2, 0) | \ | ||
1026 | PIN_AFIO_AF(GPIOH_PIN3, 0) | \ | ||
1027 | PIN_AFIO_AF(GPIOH_PIN4, 0) | \ | ||
1028 | PIN_AFIO_AF(GPIOH_PIN5, 0) | \ | ||
1029 | PIN_AFIO_AF(GPIOH_PIN6, 0) | \ | ||
1030 | PIN_AFIO_AF(GPIOH_I2C3_SCL, 4)) | ||
1031 | #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_I2C3_SDA, 4) | \ | ||
1032 | PIN_AFIO_AF(GPIOH_PIN9, 0) | \ | ||
1033 | PIN_AFIO_AF(GPIOH_PIN10, 0) | \ | ||
1034 | PIN_AFIO_AF(GPIOH_PIN11, 0) | \ | ||
1035 | PIN_AFIO_AF(GPIOH_PIN12, 0) | \ | ||
1036 | PIN_AFIO_AF(GPIOH_PIN13, 0) | \ | ||
1037 | PIN_AFIO_AF(GPIOH_PIN14, 0) | \ | ||
1038 | PIN_AFIO_AF(GPIOH_PIN15, 0)) | ||
1039 | |||
1040 | /* | ||
1041 | * GPIOI setup: | ||
1042 | */ | ||
1043 | #define VAL_GPIOI_MODER (PIN_MODE_INPUT(GPIOI_PIN0) | \ | ||
1044 | PIN_MODE_INPUT(GPIOI_PIN1) | \ | ||
1045 | PIN_MODE_INPUT(GPIOI_PIN2) | \ | ||
1046 | PIN_MODE_INPUT(GPIOI_PIN3) | \ | ||
1047 | PIN_MODE_INPUT(GPIOI_PIN4) | \ | ||
1048 | PIN_MODE_INPUT(GPIOI_PIN5) | \ | ||
1049 | PIN_MODE_INPUT(GPIOI_PIN6) | \ | ||
1050 | PIN_MODE_INPUT(GPIOI_PIN7) | \ | ||
1051 | PIN_MODE_INPUT(GPIOI_PIN8) | \ | ||
1052 | PIN_MODE_INPUT(GPIOI_PIN9) | \ | ||
1053 | PIN_MODE_OUTPUT(GPIOI_LED_R) | \ | ||
1054 | PIN_MODE_OUTPUT(GPIOI_LED_G) | \ | ||
1055 | PIN_MODE_INPUT(GPIOI_PIN12) | \ | ||
1056 | PIN_MODE_INPUT(GPIOI_PIN13) | \ | ||
1057 | PIN_MODE_INPUT(GPIOI_PIN14) | \ | ||
1058 | PIN_MODE_INPUT(GPIOI_PIN15)) | ||
1059 | #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) | \ | ||
1060 | PIN_OTYPE_PUSHPULL(GPIOI_PIN1) | \ | ||
1061 | PIN_OTYPE_PUSHPULL(GPIOI_PIN2) | \ | ||
1062 | PIN_OTYPE_PUSHPULL(GPIOI_PIN3) | \ | ||
1063 | PIN_OTYPE_PUSHPULL(GPIOI_PIN4) | \ | ||
1064 | PIN_OTYPE_PUSHPULL(GPIOI_PIN5) | \ | ||
1065 | PIN_OTYPE_PUSHPULL(GPIOI_PIN6) | \ | ||
1066 | PIN_OTYPE_PUSHPULL(GPIOI_PIN7) | \ | ||
1067 | PIN_OTYPE_PUSHPULL(GPIOI_PIN8) | \ | ||
1068 | PIN_OTYPE_PUSHPULL(GPIOI_PIN9) | \ | ||
1069 | PIN_OTYPE_PUSHPULL(GPIOI_LED_R) | \ | ||
1070 | PIN_OTYPE_PUSHPULL(GPIOI_LED_G) | \ | ||
1071 | PIN_OTYPE_PUSHPULL(GPIOI_PIN12) | \ | ||
1072 | PIN_OTYPE_PUSHPULL(GPIOI_PIN13) | \ | ||
1073 | PIN_OTYPE_PUSHPULL(GPIOI_PIN14) | \ | ||
1074 | PIN_OTYPE_PUSHPULL(GPIOI_PIN15)) | ||
1075 | #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_100M(GPIOI_PIN0) | \ | ||
1076 | PIN_OSPEED_100M(GPIOI_PIN1) | \ | ||
1077 | PIN_OSPEED_100M(GPIOI_PIN2) | \ | ||
1078 | PIN_OSPEED_100M(GPIOI_PIN3) | \ | ||
1079 | PIN_OSPEED_100M(GPIOI_PIN4) | \ | ||
1080 | PIN_OSPEED_100M(GPIOI_PIN5) | \ | ||
1081 | PIN_OSPEED_100M(GPIOI_PIN6) | \ | ||
1082 | PIN_OSPEED_100M(GPIOI_PIN7) | \ | ||
1083 | PIN_OSPEED_100M(GPIOI_PIN8) | \ | ||
1084 | PIN_OSPEED_100M(GPIOI_PIN9) | \ | ||
1085 | PIN_OSPEED_100M(GPIOI_LED_R) | \ | ||
1086 | PIN_OSPEED_100M(GPIOI_LED_G) | \ | ||
1087 | PIN_OSPEED_100M(GPIOI_PIN12) | \ | ||
1088 | PIN_OSPEED_100M(GPIOI_PIN13) | \ | ||
1089 | PIN_OSPEED_100M(GPIOI_PIN14) | \ | ||
1090 | PIN_OSPEED_100M(GPIOI_PIN15)) | ||
1091 | #define VAL_GPIOI_PUPDR (PIN_PUPDR_FLOATING(GPIOI_PIN0) | \ | ||
1092 | PIN_PUPDR_FLOATING(GPIOI_PIN1) | \ | ||
1093 | PIN_PUPDR_FLOATING(GPIOI_PIN2) | \ | ||
1094 | PIN_PUPDR_FLOATING(GPIOI_PIN3) | \ | ||
1095 | PIN_PUPDR_FLOATING(GPIOI_PIN4) | \ | ||
1096 | PIN_PUPDR_FLOATING(GPIOI_PIN5) | \ | ||
1097 | PIN_PUPDR_FLOATING(GPIOI_PIN6) | \ | ||
1098 | PIN_PUPDR_FLOATING(GPIOI_PIN7) | \ | ||
1099 | PIN_PUPDR_FLOATING(GPIOI_PIN8) | \ | ||
1100 | PIN_PUPDR_FLOATING(GPIOI_PIN9) | \ | ||
1101 | PIN_PUPDR_FLOATING(GPIOI_LED_R) | \ | ||
1102 | PIN_PUPDR_FLOATING(GPIOI_LED_G) | \ | ||
1103 | PIN_PUPDR_FLOATING(GPIOI_PIN12) | \ | ||
1104 | PIN_PUPDR_FLOATING(GPIOI_PIN13) | \ | ||
1105 | PIN_PUPDR_FLOATING(GPIOI_PIN14) | \ | ||
1106 | PIN_PUPDR_FLOATING(GPIOI_PIN15)) | ||
1107 | #define VAL_GPIOI_ODR (PIN_ODR_HIGH(GPIOI_PIN0) | \ | ||
1108 | PIN_ODR_HIGH(GPIOI_PIN1) | \ | ||
1109 | PIN_ODR_HIGH(GPIOI_PIN2) | \ | ||
1110 | PIN_ODR_HIGH(GPIOI_PIN3) | \ | ||
1111 | PIN_ODR_HIGH(GPIOI_PIN4) | \ | ||
1112 | PIN_ODR_HIGH(GPIOI_PIN5) | \ | ||
1113 | PIN_ODR_HIGH(GPIOI_PIN6) | \ | ||
1114 | PIN_ODR_HIGH(GPIOI_PIN7) | \ | ||
1115 | PIN_ODR_HIGH(GPIOI_PIN8) | \ | ||
1116 | PIN_ODR_HIGH(GPIOI_PIN9) | \ | ||
1117 | PIN_ODR_LOW(GPIOI_LED_R) | \ | ||
1118 | PIN_ODR_LOW(GPIOI_LED_G) | \ | ||
1119 | PIN_ODR_HIGH(GPIOI_PIN12) | \ | ||
1120 | PIN_ODR_HIGH(GPIOI_PIN13) | \ | ||
1121 | PIN_ODR_HIGH(GPIOI_PIN14) | \ | ||
1122 | PIN_ODR_HIGH(GPIOI_PIN15)) | ||
1123 | #define VAL_GPIOI_AFRL (PIN_AFIO_AF(GPIOI_PIN0, 0) | \ | ||
1124 | PIN_AFIO_AF(GPIOI_PIN1, 0) | \ | ||
1125 | PIN_AFIO_AF(GPIOI_PIN2, 0) | \ | ||
1126 | PIN_AFIO_AF(GPIOI_PIN3, 0) | \ | ||
1127 | PIN_AFIO_AF(GPIOI_PIN4, 0) | \ | ||
1128 | PIN_AFIO_AF(GPIOI_PIN5, 0) | \ | ||
1129 | PIN_AFIO_AF(GPIOI_PIN6, 0) | \ | ||
1130 | PIN_AFIO_AF(GPIOI_PIN7, 0)) | ||
1131 | #define VAL_GPIOI_AFRH (PIN_AFIO_AF(GPIOI_PIN8, 0) | \ | ||
1132 | PIN_AFIO_AF(GPIOI_PIN9, 0) | \ | ||
1133 | PIN_AFIO_AF(GPIOI_LED_R, 0) | \ | ||
1134 | PIN_AFIO_AF(GPIOI_LED_G, 0) | \ | ||
1135 | PIN_AFIO_AF(GPIOI_PIN12, 0) | \ | ||
1136 | PIN_AFIO_AF(GPIOI_PIN13, 0) | \ | ||
1137 | PIN_AFIO_AF(GPIOI_PIN14, 0) | \ | ||
1138 | PIN_AFIO_AF(GPIOI_PIN15, 0)) | ||
1139 | |||
1140 | #if !defined(_FROM_ASM_) | ||
1141 | #ifdef __cplusplus | ||
1142 | extern "C" { | ||
1143 | #endif | ||
1144 | void boardInit(void); | ||
1145 | #ifdef __cplusplus | ||
1146 | } | ||
1147 | #endif | ||
1148 | #endif /* _FROM_ASM_ */ | ||
1149 | |||
1150 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2/board.mk b/lib/chibios-contrib/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2/board.mk new file mode 100644 index 000000000..0303442f2 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = $(CHIBIOS_CONTRIB)/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = $(CHIBIOS_CONTRIB)/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS2 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NRF51-DK/board.c b/lib/chibios-contrib/os/hal/boards/NRF51-DK/board.c new file mode 100644 index 000000000..c5237d7f7 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NRF51-DK/board.c | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | Copyright (C) 2015 Fabio Utzig | ||
3 | 2016 Stéphane D'Alu / Bruno Remond | ||
4 | |||
5 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | you may not use this file except in compliance with the License. | ||
7 | You may obtain a copy of the License at | ||
8 | |||
9 | http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | |||
11 | Unless required by applicable law or agreed to in writing, software | ||
12 | distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | See the License for the specific language governing permissions and | ||
15 | limitations under the License. | ||
16 | */ | ||
17 | |||
18 | #include "hal.h" | ||
19 | |||
20 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
21 | |||
22 | /* RAM Banks | ||
23 | * (Values are defined in Nordic gcc_startup_nrf51.s) | ||
24 | */ | ||
25 | #define NRF_POWER_RAMON_ADDRESS 0x40000524 | ||
26 | #define NRF_POWER_RAMONB_ADDRESS 0x40000554 | ||
27 | #define NRF_POWER_RAMONx_RAMxON_ONMODE_Msk 0x3 | ||
28 | |||
29 | /** | ||
30 | * @brief PAL setup. | ||
31 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
32 | * This variable is used by the HAL when initializing the PAL driver. | ||
33 | */ | ||
34 | const PALConfig pal_default_config = | ||
35 | { | ||
36 | .pads = { | ||
37 | PAL_MODE_UNCONNECTED, /* P0.0 */ | ||
38 | PAL_MODE_UNCONNECTED, /* P0.1 */ | ||
39 | PAL_MODE_UNCONNECTED, /* P0.2 */ | ||
40 | PAL_MODE_UNCONNECTED, /* P0.3 */ | ||
41 | PAL_MODE_UNCONNECTED, /* P0.4 */ | ||
42 | PAL_MODE_UNCONNECTED, /* P0.5 */ | ||
43 | PAL_MODE_UNCONNECTED, /* P0.6 */ | ||
44 | PAL_MODE_OUTPUT_OPENDRAIN, /* P0.7 : SCL */ | ||
45 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.8 : UART_RTS */ | ||
46 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.9 : UART_TX */ | ||
47 | PAL_MODE_INPUT_PULLUP, /* P0.10: UART_CTS */ | ||
48 | PAL_MODE_INPUT_PULLUP, /* P0.11: UART_RX */ | ||
49 | PAL_MODE_UNCONNECTED, /* P0.12 */ | ||
50 | PAL_MODE_UNCONNECTED, /* P0.13 */ | ||
51 | PAL_MODE_UNCONNECTED, /* P0.14 */ | ||
52 | PAL_MODE_UNCONNECTED, /* P0.15 */ | ||
53 | PAL_MODE_UNCONNECTED, /* P0.16 */ | ||
54 | PAL_MODE_INPUT_PULLUP, /* P0.17: BTN1 */ | ||
55 | PAL_MODE_INPUT_PULLUP, /* P0.18: BTN2 */ | ||
56 | PAL_MODE_INPUT_PULLUP, /* P0.19: BTN3 */ | ||
57 | PAL_MODE_INPUT_PULLUP, /* P0.20: BTN4 */ | ||
58 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.21: LED1 */ | ||
59 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.22: LED2 */ | ||
60 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.23: LED3 */ | ||
61 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.24: LED4 | SPI_SEL */ | ||
62 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.25: SPI_MOSI */ | ||
63 | PAL_MODE_UNCONNECTED, /* P0.26: XTAL (32MHz) */ | ||
64 | PAL_MODE_UNCONNECTED, /* P0.27: XTAL (32MHz) */ | ||
65 | PAL_MODE_INPUT_PULLUP, /* P0.28: SPI_MISO */ | ||
66 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.29: SPI_SCK */ | ||
67 | PAL_MODE_OUTPUT_OPENDRAIN, /* P0.30: SDA */ | ||
68 | PAL_MODE_UNCONNECTED, /* P0.31 */ | ||
69 | }, | ||
70 | }; | ||
71 | #endif | ||
72 | |||
73 | /** | ||
74 | * @brief Early initialization code. | ||
75 | * @details This initialization is performed just after reset before BSS and | ||
76 | * DATA segments initialization. | ||
77 | */ | ||
78 | void __early_init(void) | ||
79 | { | ||
80 | /* Make sure ALL RAM banks are powered on */ | ||
81 | *(uint32_t *)NRF_POWER_RAMON_ADDRESS |= NRF_POWER_RAMONx_RAMxON_ONMODE_Msk; | ||
82 | *(uint32_t *)NRF_POWER_RAMONB_ADDRESS |= NRF_POWER_RAMONx_RAMxON_ONMODE_Msk; | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * @brief Late initialization code. | ||
87 | * @note This initialization is performed after BSS and DATA segments | ||
88 | * initialization and before invoking the main() function. | ||
89 | */ | ||
90 | void boardInit(void) | ||
91 | { | ||
92 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NRF51-DK/board.h b/lib/chibios-contrib/os/hal/boards/NRF51-DK/board.h new file mode 100644 index 000000000..67e1724f6 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NRF51-DK/board.h | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | Copyright (C) 2015 Fabio Utzig | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* Board identifier. */ | ||
21 | #define BOARD_NRF51_DK | ||
22 | #define BOARD_NAME "nRF51 DK" | ||
23 | |||
24 | /* Board oscillators-related settings. */ | ||
25 | #define NRF51_XTAL_VALUE 16000000 | ||
26 | #define NRF51_LFCLK_SOURCE 1 | ||
27 | |||
28 | /* GPIO pins. */ | ||
29 | #define BTN1 17 | ||
30 | #define BTN2 18 | ||
31 | #define BTN3 19 | ||
32 | #define BTN4 20 | ||
33 | #define LED1 21 | ||
34 | #define LED2 22 | ||
35 | #define LED3 23 | ||
36 | #define LED4 24 | ||
37 | #define UART_RTS 8 | ||
38 | #define UART_TX 9 | ||
39 | #define UART_CTS 10 | ||
40 | #define UART_RX 11 | ||
41 | #define SPI_SCK 29 | ||
42 | #define SPI_MOSI 25 | ||
43 | #define SPI_MISO 28 | ||
44 | #define SPI_SS 24 | ||
45 | #define I2C_SCL 7 | ||
46 | #define I2C_SDA 30 | ||
47 | #define AIN0 26 | ||
48 | #define AIN1 27 | ||
49 | #define AIN2 1 | ||
50 | #define AIN3 2 | ||
51 | #define AIN4 3 | ||
52 | #define AIN5 4 | ||
53 | #define AIN6 5 | ||
54 | #define AIN7 6 | ||
55 | #define AREF0 0 | ||
56 | #define AREF1 6 | ||
57 | |||
58 | /* | ||
59 | * IO pins assignments. | ||
60 | */ | ||
61 | #define IOPORT1_BTN1 17U | ||
62 | #define IOPORT1_BTN2 18U | ||
63 | #define IOPORT1_BTN3 19U | ||
64 | #define IOPORT1_BTN4 20U | ||
65 | #define IOPORT1_LED1 21U | ||
66 | #define IOPORT1_LED2 22U | ||
67 | #define IOPORT1_LED3 23U | ||
68 | #define IOPORT1_LED4 24U | ||
69 | #define IOPORT1_UART_RTS 8U | ||
70 | #define IOPORT1_UART_TX 9U | ||
71 | #define IOPORT1_UART_CTS 10U | ||
72 | #define IOPORT1_UART_RX 11U | ||
73 | #define IOPORT1_SPI_SCK 29U | ||
74 | #define IOPORT1_SPI_MOSI 25U | ||
75 | #define IOPORT1_SPI_MISO 28U | ||
76 | #define IOPORT1_SPI_SS 24U | ||
77 | #define IOPORT1_I2C_SCL 7U | ||
78 | #define IOPORT1_I2C_SDA 30U | ||
79 | #define IOPORT1_A0 1U | ||
80 | #define IOPORT1_A1 2U | ||
81 | #define IOPORT1_A2 3U | ||
82 | #define IOPORT1_A3 4U | ||
83 | #define IOPORT1_A4 5U | ||
84 | #define IOPORT1_A5 6U | ||
85 | #define IOPORT1_AIN0 26U | ||
86 | #define IOPORT1_AIN1 27U | ||
87 | #define IOPORT1_AIN2 1U | ||
88 | #define IOPORT1_AIN3 2U | ||
89 | #define IOPORT1_AIN4 3U | ||
90 | #define IOPORT1_AIN5 4U | ||
91 | #define IOPORT1_AIN6 5U | ||
92 | #define IOPORT1_AIN7 6U | ||
93 | #define IOPORT1_AREF0 0U | ||
94 | #define IOPORT1_AREF1 6U | ||
95 | |||
96 | /* | ||
97 | * IO lines assignments. | ||
98 | */ | ||
99 | #define LINE_BTN1 PAL_LINE(IOPORT1, IOPORT1_BTN1) | ||
100 | #define LINE_BTN2 PAL_LINE(IOPORT1, IOPORT1_BTN2) | ||
101 | #define LINE_BTN3 PAL_LINE(IOPORT1, IOPORT1_BTN3) | ||
102 | #define LINE_BTN4 PAL_LINE(IOPORT1, IOPORT1_BTN4) | ||
103 | #define LINE_LED1 PAL_LINE(IOPORT1, IOPORT1_LED1) | ||
104 | #define LINE_LED2 PAL_LINE(IOPORT1, IOPORT1_LED2) | ||
105 | #define LINE_LED3 PAL_LINE(IOPORT1, IOPORT1_LED3) | ||
106 | #define LINE_LED4 PAL_LINE(IOPORT1, IOPORT1_LED4) | ||
107 | #define LINE_UART_RTS PAL_LINE(IOPORT1, IOPORT1_UART_RTS) | ||
108 | #define LINE_UART_TX PAL_LINE(IOPORT1, IOPORT1_UART_TX) | ||
109 | #define LINE_UART_CTS PAL_LINE(IOPORT1, IOPORT1_UART_CTS) | ||
110 | #define LINE_UART_RX PAL_LINE(IOPORT1, IOPORT1_UART_RX) | ||
111 | #define LINE_SPI_SCK PAL_LINE(IOPORT1, IOPORT1_SPI_SCK) | ||
112 | #define LINE_SPI_MOSI PAL_LINE(IOPORT1, IOPORT1_SPI_MOSI) | ||
113 | #define LINE_SPI_MISO PAL_LINE(IOPORT1, IOPORT1_SPI_MISO) | ||
114 | #define LINE_SPI_SS PAL_LINE(IOPORT1, IOPORT1_SPI_SS) | ||
115 | #define LINE_I2C_SCL PAL_LINE(IOPORT1, IOPORT1_I2C_SCL) | ||
116 | #define LINE_I2C_SDA PAL_LINE(IOPORT1, IOPORT1_I2C_SDA) | ||
117 | #define LINE_A0 PAL_LINE(IOPORT1, IOPORT1_A0) | ||
118 | #define LINE_A1 PAL_LINE(IOPORT1, IOPORT1_A1) | ||
119 | #define LINE_A2 PAL_LINE(IOPORT1, IOPORT1_A2) | ||
120 | #define LINE_A3 PAL_LINE(IOPORT1, IOPORT1_A3) | ||
121 | #define LINE_A4 PAL_LINE(IOPORT1, IOPORT1_A4) | ||
122 | #define LINE_A5 PAL_LINE(IOPORT1, IOPORT1_A5) | ||
123 | #define LINE_AIN0 PAL_LINE(IOPORT1, IOPORT1_AIN0) | ||
124 | #define LINE_AIN1 PAL_LINE(IOPORT1, IOPORT1_AIN1) | ||
125 | #define LINE_AIN2 PAL_LINE(IOPORT1, IOPORT1_AIN2) | ||
126 | #define LINE_AIN3 PAL_LINE(IOPORT1, IOPORT1_AIN3) | ||
127 | #define LINE_AIN4 PAL_LINE(IOPORT1, IOPORT1_AIN4) | ||
128 | #define LINE_AIN5 PAL_LINE(IOPORT1, IOPORT1_AIN5) | ||
129 | #define LINE_AIN6 PAL_LINE(IOPORT1, IOPORT1_AIN6) | ||
130 | #define LINE_AIN7 PAL_LINE(IOPORT1, IOPORT1_AIN7) | ||
131 | #define LINE_AREF0 PAL_LINE(IOPORT1, IOPORT1_AREF0) | ||
132 | #define LINE_AREF1 PAL_LINE(IOPORT1, IOPORT1_AREF1) | ||
133 | |||
134 | |||
135 | #if !defined(_FROM_ASM_) | ||
136 | #ifdef __cplusplus | ||
137 | extern "C" { | ||
138 | #endif | ||
139 | void boardInit(void); | ||
140 | #ifdef __cplusplus | ||
141 | } | ||
142 | #endif | ||
143 | #endif /* _FROM_ASM_ */ | ||
144 | |||
145 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NRF51-DK/board.mk b/lib/chibios-contrib/os/hal/boards/NRF51-DK/board.mk new file mode 100644 index 000000000..3e3e465f7 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NRF51-DK/board.mk | |||
@@ -0,0 +1,15 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/NRF51-DK/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/NRF51-DK | ||
6 | |||
7 | # Flash | ||
8 | JLINK_DEVICE = nrf51422 | ||
9 | JLINK_PRE_FLASH = w4 4001e504 1 | ||
10 | JLINK_ERASE_ALL = w4 4001e504 2\nw4 4001e50c 1\nsleep 100 | ||
11 | JLINK_PIN_RESET = w4 40000544 1 | ||
12 | |||
13 | # Shared variables | ||
14 | ALLCSRC += $(BOARDSRC) | ||
15 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.c b/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.c new file mode 100644 index 000000000..cfbf24d14 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Stéphane D'Alu | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | |||
21 | /** | ||
22 | * @brief PAL setup. | ||
23 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
24 | * This variable is used by the HAL when initializing the PAL driver. | ||
25 | */ | ||
26 | const PALConfig pal_default_config = | ||
27 | { | ||
28 | .pads = { | ||
29 | PAL_MODE_UNCONNECTED, /* P0.0 : XTAL (32MHz) */ | ||
30 | PAL_MODE_UNCONNECTED, /* P0.1 : XTAL (32MHz) */ | ||
31 | PAL_MODE_UNCONNECTED, /* P0.2 */ | ||
32 | PAL_MODE_UNCONNECTED, /* P0.3 */ | ||
33 | PAL_MODE_UNCONNECTED, /* P0.4 */ | ||
34 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.5 : UART_RTS */ | ||
35 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.6 : UART_TX */ | ||
36 | PAL_MODE_INPUT_PULLUP, /* P0.7 : UART_CTS */ | ||
37 | PAL_MODE_INPUT_PULLUP, /* P0.8 : UART_RX */ | ||
38 | PAL_MODE_UNCONNECTED, /* P0.9 */ | ||
39 | PAL_MODE_UNCONNECTED, /* P0.10 */ | ||
40 | PAL_MODE_UNCONNECTED, /* P0.11 */ | ||
41 | PAL_MODE_UNCONNECTED, /* P0.12 */ | ||
42 | PAL_MODE_INPUT_PULLUP, /* P0.13: BTN1 */ | ||
43 | PAL_MODE_INPUT_PULLUP, /* P0.14: BTN2 */ | ||
44 | PAL_MODE_INPUT_PULLUP, /* P0.15: BTN3 */ | ||
45 | PAL_MODE_INPUT_PULLUP, /* P0.16: BTN4 */ | ||
46 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.17: LED1 */ | ||
47 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.18: LED2 */ | ||
48 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.19: LED3 */ | ||
49 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.20: LED4 */ | ||
50 | PAL_MODE_UNCONNECTED, /* P0.21 */ | ||
51 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.22: SPI_SS */ | ||
52 | PAL_MODE_INPUT_PULLUP, /* P0.23: SPI_MISO */ | ||
53 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.24: SPI_MOSI */ | ||
54 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.25: SPI_SCK */ | ||
55 | PAL_MODE_OUTPUT_OPENDRAIN, /* P0.26: SDA */ | ||
56 | PAL_MODE_OUTPUT_OPENDRAIN, /* P0.27: SCL */ | ||
57 | PAL_MODE_UNCONNECTED, /* P0.28 */ | ||
58 | PAL_MODE_UNCONNECTED, /* P0.29 */ | ||
59 | PAL_MODE_UNCONNECTED, /* P0.30 */ | ||
60 | PAL_MODE_UNCONNECTED, /* P0.31 */ | ||
61 | }, | ||
62 | }; | ||
63 | #endif | ||
64 | |||
65 | /** | ||
66 | * @brief Early initialization code. | ||
67 | * @details This initialization is performed just after reset before BSS and | ||
68 | * DATA segments initialization. | ||
69 | */ | ||
70 | void __early_init(void) | ||
71 | { | ||
72 | } | ||
73 | |||
74 | /** | ||
75 | * @brief Late initialization code. | ||
76 | * @note This initialization is performed after BSS and DATA segments | ||
77 | * initialization and before invoking the main() function. | ||
78 | */ | ||
79 | void boardInit(void) | ||
80 | { | ||
81 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.h b/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.h new file mode 100644 index 000000000..5c7566a93 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.h | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Stephane D'Alu | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* Board identifier. */ | ||
21 | #define BOARD_NRF52_DK | ||
22 | #define BOARD_NAME "nRF52 DK" | ||
23 | |||
24 | /* Board oscillators-related settings. */ | ||
25 | #define NRF5_XTAL_VALUE 32000000 | ||
26 | #define NRF5_LFCLK_SOURCE 1 | ||
27 | |||
28 | /* | ||
29 | * GPIO pins. | ||
30 | */ | ||
31 | /* Defined by board */ | ||
32 | #define BTN1 13U | ||
33 | #define BTN2 14U | ||
34 | #define BTN3 15U | ||
35 | #define BTN4 16U | ||
36 | #define LED1 17U | ||
37 | #define LED2 18U | ||
38 | #define LED3 19U | ||
39 | #define LED4 20U | ||
40 | #define UART_RTS 5U | ||
41 | #define UART_TX 6U | ||
42 | #define UART_CTS 7U | ||
43 | #define UART_RX 8U | ||
44 | #define NFC1 9U | ||
45 | #define NFC2 10U | ||
46 | #define I2C_SCL 27U | ||
47 | #define I2C_SDA 26U | ||
48 | |||
49 | /* Our definitions */ | ||
50 | #define SPI_SCK 25U | ||
51 | #define SPI_MOSI 24U | ||
52 | #define SPI_MISO 23U | ||
53 | #define SPI_SS 22U | ||
54 | |||
55 | /* Analog input */ | ||
56 | #define AIN0 2U | ||
57 | #define AIN1 3U | ||
58 | #define AIN2 4U | ||
59 | #define AIN3 5U | ||
60 | #define AIN4 28U | ||
61 | #define AIN5 29U | ||
62 | #define AIN6 30U | ||
63 | #define AIN7 31U | ||
64 | #define AREF0 AIN0 | ||
65 | #define AREF1 AIN1 | ||
66 | |||
67 | /* | ||
68 | * IO pins assignments. | ||
69 | */ | ||
70 | /* Defined by board */ | ||
71 | #define IOPORT1_BTN1 13U | ||
72 | #define IOPORT1_BTN2 14U | ||
73 | #define IOPORT1_BTN3 15U | ||
74 | #define IOPORT1_BTN4 16U | ||
75 | #define IOPORT1_LED1 17U | ||
76 | #define IOPORT1_LED2 18U | ||
77 | #define IOPORT1_LED3 19U | ||
78 | #define IOPORT1_LED4 20U | ||
79 | #define IOPORT1_UART_RTS 5U | ||
80 | #define IOPORT1_UART_TX 6U | ||
81 | #define IOPORT1_UART_CTS 7U | ||
82 | #define IOPORT1_UART_RX 8U | ||
83 | #define IOPORT1_NFC1 9U | ||
84 | #define IOPORT1_NFC2 10U | ||
85 | #define IOPORT1_I2C_SCL 27U | ||
86 | #define IOPORT1_I2C_SDA 26U | ||
87 | #define IOPORT1_RESET 21U | ||
88 | |||
89 | /* Our definitions */ | ||
90 | #define IOPORT1_SPI_SCK 25U | ||
91 | #define IOPORT1_SPI_MOSI 24U | ||
92 | #define IOPORT1_SPI_MISO 23U | ||
93 | #define IOPORT1_SPI_SS 22U | ||
94 | |||
95 | /* Analog inpupt */ | ||
96 | #define IOPORT1_AIN0 2U | ||
97 | #define IOPORT1_AIN1 3U | ||
98 | #define IOPORT1_AIN2 4U | ||
99 | #define IOPORT1_AIN3 5U | ||
100 | #define IOPORT1_AIN4 28U | ||
101 | #define IOPORT1_AIN5 29U | ||
102 | #define IOPORT1_AIN6 30U | ||
103 | #define IOPORT1_AIN7 31U | ||
104 | #define IOPORT1_AREF0 IOPORT1_AIN0 | ||
105 | #define IOPORT1_AREF1 IOPORT1_AIN1 | ||
106 | |||
107 | /* Arduino naming */ | ||
108 | #define IOPORT1_A0 3U | ||
109 | #define IOPORT1_A1 4U | ||
110 | #define IOPORT1_A2 28U | ||
111 | #define IOPORT1_A3 39U | ||
112 | #define IOPORT1_A4 30U | ||
113 | #define IOPORT1_A5 31U | ||
114 | #define IOPORT1_D0 11U | ||
115 | #define IOPORT1_D1 12U | ||
116 | #define IOPORT1_D2 13U | ||
117 | #define IOPORT1_D3 14U | ||
118 | #define IOPORT1_D4 15U | ||
119 | #define IOPORT1_D5 16U | ||
120 | #define IOPORT1_D6 17U | ||
121 | #define IOPORT1_D7 18U | ||
122 | #define IOPORT1_D8 19U | ||
123 | #define IOPORT1_D9 20U | ||
124 | #define IOPORT1_D10 22U | ||
125 | #define IOPORT1_D11 23U | ||
126 | #define IOPORT1_D12 24U | ||
127 | #define IOPORT1_D13 25U | ||
128 | |||
129 | |||
130 | /* | ||
131 | * IO lines assignments. | ||
132 | */ | ||
133 | /* Board defined */ | ||
134 | #define LINE_BTN1 PAL_LINE(IOPORT1, IOPORT1_BTN1) | ||
135 | #define LINE_BTN2 PAL_LINE(IOPORT1, IOPORT1_BTN2) | ||
136 | #define LINE_BTN3 PAL_LINE(IOPORT1, IOPORT1_BTN3) | ||
137 | #define LINE_BTN4 PAL_LINE(IOPORT1, IOPORT1_BTN4) | ||
138 | #define LINE_LED1 PAL_LINE(IOPORT1, IOPORT1_LED1) | ||
139 | #define LINE_LED2 PAL_LINE(IOPORT1, IOPORT1_LED2) | ||
140 | #define LINE_LED3 PAL_LINE(IOPORT1, IOPORT1_LED3) | ||
141 | #define LINE_LED4 PAL_LINE(IOPORT1, IOPORT1_LED4) | ||
142 | #define LINE_UART_RTS PAL_LINE(IOPORT1, IOPORT1_UART_RTS) | ||
143 | #define LINE_UART_TX PAL_LINE(IOPORT1, IOPORT1_UART_TX) | ||
144 | #define LINE_UART_CTS PAL_LINE(IOPORT1, IOPORT1_UART_CTS) | ||
145 | #define LINE_UART_RX PAL_LINE(IOPORT1, IOPORT1_UART_RX) | ||
146 | #define LINE_NFC1 PAL_LINE(IOPORT1, IOPORT1_NFC1) | ||
147 | #define LINE_NFC2 PAL_LINE(IOPORT1, IOPORT1_NFC2) | ||
148 | #define LINE_I2C_SCL PAL_LINE(IOPORT1, IOPORT1_I2C_SCL) | ||
149 | #define LINE_I2C_SDA PAL_LINE(IOPORT1, IOPORT1_I2C_SDA) | ||
150 | |||
151 | /* Our definitions */ | ||
152 | #define LINE_SPI_SCK PAL_LINE(IOPORT1, IOPORT1_SPI_SCK) | ||
153 | #define LINE_SPI_MOSI PAL_LINE(IOPORT1, IOPORT1_SPI_MOSI) | ||
154 | #define LINE_SPI_MISO PAL_LINE(IOPORT1, IOPORT1_SPI_MISO) | ||
155 | #define LINE_SPI_SS PAL_LINE(IOPORT1, IOPORT1_SPI_SS) | ||
156 | |||
157 | /* Analog line */ | ||
158 | #define LINE_AIN0 PAL_LINE(IOPORT1, IOPORT1_AIN0) | ||
159 | #define LINE_AIN1 PAL_LINE(IOPORT1, IOPORT1_AIN1) | ||
160 | #define LINE_AIN2 PAL_LINE(IOPORT1, IOPORT1_AIN2) | ||
161 | #define LINE_AIN3 PAL_LINE(IOPORT1, IOPORT1_AIN3) | ||
162 | #define LINE_AIN4 PAL_LINE(IOPORT1, IOPORT1_AIN4) | ||
163 | #define LINE_AIN5 PAL_LINE(IOPORT1, IOPORT1_AIN5) | ||
164 | #define LINE_AIN6 PAL_LINE(IOPORT1, IOPORT1_AIN6) | ||
165 | #define LINE_AIN7 PAL_LINE(IOPORT1, IOPORT1_AIN7) | ||
166 | #define LINE_AREF0 PAL_LINE(IOPORT1, IOPORT1_AREF0) | ||
167 | #define LINE_AREF1 PAL_LINE(IOPORT1, IOPORT1_AREF1) | ||
168 | |||
169 | /* Arduino naming */ | ||
170 | #define LINE_A0 PAL_LINE(IOPORT1, IOPORT1_A0) | ||
171 | #define LINE_A1 PAL_LINE(IOPORT1, IOPORT1_A1) | ||
172 | #define LINE_A2 PAL_LINE(IOPORT1, IOPORT1_A2) | ||
173 | #define LINE_A3 PAL_LINE(IOPORT1, IOPORT1_A3) | ||
174 | #define LINE_A4 PAL_LINE(IOPORT1, IOPORT1_A4) | ||
175 | #define LINE_A5 PAL_LINE(IOPORT1, IOPORT1_A5) | ||
176 | #define LINE_D0 PAL_LINE(IOPORT1, IOPORT1_D0) | ||
177 | #define LINE_D1 PAL_LINE(IOPORT1, IOPORT1_D1) | ||
178 | #define LINE_D2 PAL_LINE(IOPORT1, IOPORT1_D2) | ||
179 | #define LINE_D3 PAL_LINE(IOPORT1, IOPORT1_D3) | ||
180 | #define LINE_D4 PAL_LINE(IOPORT1, IOPORT1_D4) | ||
181 | #define LINE_D5 PAL_LINE(IOPORT1, IOPORT1_D5) | ||
182 | #define LINE_D6 PAL_LINE(IOPORT1, IOPORT1_D6) | ||
183 | #define LINE_D7 PAL_LINE(IOPORT1, IOPORT1_D7) | ||
184 | #define LINE_D8 PAL_LINE(IOPORT1, IOPORT1_D8) | ||
185 | #define LINE_D9 PAL_LINE(IOPORT1, IOPORT1_D9) | ||
186 | #define LINE_D10 PAL_LINE(IOPORT1, IOPORT1_D10) | ||
187 | #define LINE_D11 PAL_LINE(IOPORT1, IOPORT1_D11) | ||
188 | #define LINE_D12 PAL_LINE(IOPORT1, IOPORT1_D12) | ||
189 | #define LINE_D13 PAL_LINE(IOPORT1, IOPORT1_D13) | ||
190 | |||
191 | #if !defined(_FROM_ASM_) | ||
192 | #ifdef __cplusplus | ||
193 | extern "C" { | ||
194 | #endif | ||
195 | void boardInit(void); | ||
196 | #ifdef __cplusplus | ||
197 | } | ||
198 | #endif | ||
199 | #endif /* _FROM_ASM_ */ | ||
200 | |||
201 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.mk b/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.mk new file mode 100644 index 000000000..b296d27ba --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NRF52-DK/board.mk | |||
@@ -0,0 +1,15 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/NRF52-DK/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/NRF52-DK | ||
6 | |||
7 | # Flash | ||
8 | JLINK_DEVICE = nrf52 | ||
9 | JLINK_PRE_FLASH = w4 4001e504 1 | ||
10 | #JLINK_ERASE_ALL = w4 4001e504 2\nw4 4001e50c 1\nsleep 100 | ||
11 | JLINK_PIN_RESET = w4 40000544 1 | ||
12 | |||
13 | # Shared variables | ||
14 | ALLCSRC += $(BOARDSRC) | ||
15 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NRF52-E73-2G4M04S/board.c b/lib/chibios-contrib/os/hal/boards/NRF52-E73-2G4M04S/board.c new file mode 100644 index 000000000..adf002d8f --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NRF52-E73-2G4M04S/board.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Stéphane D'Alu | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | |||
21 | /** | ||
22 | * @brief PAL setup. | ||
23 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
24 | * This variable is used by the HAL when initializing the PAL driver. | ||
25 | */ | ||
26 | const PALConfig pal_default_config = | ||
27 | { | ||
28 | .pads = { | ||
29 | PAL_MODE_UNCONNECTED, /* P0.0 : XTAL (32MHz) */ | ||
30 | PAL_MODE_UNCONNECTED, /* P0.1 : XTAL (32MHz) */ | ||
31 | PAL_MODE_UNCONNECTED, /* P0.2 */ | ||
32 | PAL_MODE_UNCONNECTED, /* P0.3 */ | ||
33 | PAL_MODE_UNCONNECTED, /* P0.4 */ | ||
34 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.5 : UART_RTS */ | ||
35 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.6 : UART_TX */ | ||
36 | PAL_MODE_INPUT_PULLUP, /* P0.7 : UART_CTS */ | ||
37 | PAL_MODE_INPUT_PULLUP, /* P0.8 : UART_RX */ | ||
38 | PAL_MODE_UNCONNECTED, /* P0.9 */ | ||
39 | PAL_MODE_UNCONNECTED, /* P0.10 */ | ||
40 | PAL_MODE_UNCONNECTED, /* P0.11 */ | ||
41 | PAL_MODE_UNCONNECTED, /* P0.12 */ | ||
42 | PAL_MODE_INPUT, /* P0.13: BTN1 */ | ||
43 | PAL_MODE_INPUT, /* P0.14: BTN2 */ | ||
44 | PAL_MODE_INPUT_PULLUP, /* P0.15: BTN3 */ | ||
45 | PAL_MODE_INPUT_PULLUP, /* P0.16: BTN4 */ | ||
46 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.17: LED1 */ | ||
47 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.18: LED2 */ | ||
48 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.19: LED3 */ | ||
49 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.20: LED4 */ | ||
50 | PAL_MODE_UNCONNECTED, /* P0.21 */ | ||
51 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.22: SPI_SS */ | ||
52 | PAL_MODE_INPUT_PULLUP, /* P0.23: SPI_MISO */ | ||
53 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.24: SPI_MOSI */ | ||
54 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.25: SPI_SCK */ | ||
55 | PAL_MODE_OUTPUT_OPENDRAIN, /* P0.26: SDA */ | ||
56 | PAL_MODE_OUTPUT_OPENDRAIN, /* P0.27: SCL */ | ||
57 | PAL_MODE_UNCONNECTED, /* P0.28 */ | ||
58 | PAL_MODE_UNCONNECTED, /* P0.29 */ | ||
59 | PAL_MODE_UNCONNECTED, /* P0.30 */ | ||
60 | PAL_MODE_UNCONNECTED, /* P0.31 */ | ||
61 | }, | ||
62 | }; | ||
63 | #endif | ||
64 | |||
65 | /** | ||
66 | * @brief Early initialization code. | ||
67 | * @details This initialization is performed just after reset before BSS and | ||
68 | * DATA segments initialization. | ||
69 | */ | ||
70 | void __early_init(void) | ||
71 | { | ||
72 | } | ||
73 | |||
74 | /** | ||
75 | * @brief Late initialization code. | ||
76 | * @note This initialization is performed after BSS and DATA segments | ||
77 | * initialization and before invoking the main() function. | ||
78 | */ | ||
79 | void boardInit(void) | ||
80 | { | ||
81 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NRF52-E73-2G4M04S/board.h b/lib/chibios-contrib/os/hal/boards/NRF52-E73-2G4M04S/board.h new file mode 100644 index 000000000..c78909f27 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NRF52-E73-2G4M04S/board.h | |||
@@ -0,0 +1,164 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Stephane D'Alu | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* Board identifier. */ | ||
21 | #define BOARD_NRF52_EBYTE_E73 | ||
22 | #define BOARD_NAME "nRF52 EBYTE E73-2G4M04S" | ||
23 | |||
24 | /* Board oscillators-related settings. */ | ||
25 | #define NRF5_XTAL_VALUE 32000000 | ||
26 | #define NRF5_HFCLK_SOURCE NRF5_HFCLK_HFXO | ||
27 | #define NRF5_LFCLK_SOURCE NRF5_LFCLK_XTAL | ||
28 | |||
29 | #define NRF5_HFCLK_HFINT 0 | ||
30 | #define NRF5_HFCLK_HFXO 1 | ||
31 | |||
32 | #define NRF5_LFCLK_RC 0 | ||
33 | #define NRF5_LFCLK_XTAL 1 | ||
34 | #define NRF5_LFCLK_SYNTH 2 | ||
35 | |||
36 | /* | ||
37 | * GPIO pins. | ||
38 | */ | ||
39 | /* Defined by board */ | ||
40 | #define BTN1 13U | ||
41 | #define BTN2 14U | ||
42 | #define BTN3 15U | ||
43 | #define BTN4 16U | ||
44 | #define LED1 17U | ||
45 | #define LED2 18U | ||
46 | #define LED3 19U | ||
47 | #define LED4 20U | ||
48 | #define UART_RTS 5U | ||
49 | #define UART_TX 6U | ||
50 | #define UART_CTS 7U | ||
51 | #define UART_RX 8U | ||
52 | #define NFC1 9U | ||
53 | #define NFC2 10U | ||
54 | #define I2C_SCL 27U | ||
55 | #define I2C_SDA 26U | ||
56 | |||
57 | /* Our definitions */ | ||
58 | #define SPI_SCK 25U | ||
59 | #define SPI_MOSI 24U | ||
60 | #define SPI_MISO 23U | ||
61 | #define SPI_SS 22U | ||
62 | |||
63 | /* Analog input */ | ||
64 | #define AIN0 2U | ||
65 | #define AIN1 3U | ||
66 | #define AIN2 4U | ||
67 | #define AIN3 5U | ||
68 | #define AIN4 28U | ||
69 | #define AIN5 29U | ||
70 | #define AIN6 30U | ||
71 | #define AIN7 31U | ||
72 | #define AREF0 AIN0 | ||
73 | #define AREF1 AIN1 | ||
74 | |||
75 | /* | ||
76 | * IO pins assignments. | ||
77 | */ | ||
78 | /* Defined by board */ | ||
79 | #define IOPORT1_BTN1 13U | ||
80 | #define IOPORT1_BTN2 14U | ||
81 | #define IOPORT1_BTN3 15U | ||
82 | #define IOPORT1_BTN4 16U | ||
83 | #define IOPORT1_LED1 17U | ||
84 | #define IOPORT1_LED2 18U | ||
85 | #define IOPORT1_LED3 19U | ||
86 | #define IOPORT1_LED4 20U | ||
87 | #define IOPORT1_UART_RTS 5U | ||
88 | #define IOPORT1_UART_TX 6U | ||
89 | #define IOPORT1_UART_CTS 7U | ||
90 | #define IOPORT1_UART_RX 8U | ||
91 | #define IOPORT1_NFC1 9U | ||
92 | #define IOPORT1_NFC2 10U | ||
93 | #define IOPORT1_I2C_SCL 27U | ||
94 | #define IOPORT1_I2C_SDA 26U | ||
95 | #define IOPORT1_RESET 21U | ||
96 | |||
97 | /* Our definitions */ | ||
98 | #define IOPORT1_SPI_SCK 25U | ||
99 | #define IOPORT1_SPI_MOSI 24U | ||
100 | #define IOPORT1_SPI_MISO 23U | ||
101 | #define IOPORT1_SPI_SS 22U | ||
102 | |||
103 | /* Analog inpupt */ | ||
104 | #define IOPORT1_AIN0 2U | ||
105 | #define IOPORT1_AIN1 3U | ||
106 | #define IOPORT1_AIN2 4U | ||
107 | #define IOPORT1_AIN3 5U | ||
108 | #define IOPORT1_AIN4 28U | ||
109 | #define IOPORT1_AIN5 29U | ||
110 | #define IOPORT1_AIN6 30U | ||
111 | #define IOPORT1_AIN7 31U | ||
112 | #define IOPORT1_AREF0 IOPORT1_AIN0 | ||
113 | #define IOPORT1_AREF1 IOPORT1_AIN1 | ||
114 | |||
115 | /* | ||
116 | * IO lines assignments. | ||
117 | */ | ||
118 | /* Board defined */ | ||
119 | #define LINE_BTN1 PAL_LINE(IOPORT1, IOPORT1_BTN1) | ||
120 | #define LINE_BTN2 PAL_LINE(IOPORT1, IOPORT1_BTN2) | ||
121 | #define LINE_BTN3 PAL_LINE(IOPORT1, IOPORT1_BTN3) | ||
122 | #define LINE_BTN4 PAL_LINE(IOPORT1, IOPORT1_BTN4) | ||
123 | #define LINE_LED1 PAL_LINE(IOPORT1, IOPORT1_LED1) | ||
124 | #define LINE_LED2 PAL_LINE(IOPORT1, IOPORT1_LED2) | ||
125 | #define LINE_LED3 PAL_LINE(IOPORT1, IOPORT1_LED3) | ||
126 | #define LINE_LED4 PAL_LINE(IOPORT1, IOPORT1_LED4) | ||
127 | #define LINE_UART_RTS PAL_LINE(IOPORT1, IOPORT1_UART_RTS) | ||
128 | #define LINE_UART_TX PAL_LINE(IOPORT1, IOPORT1_UART_TX) | ||
129 | #define LINE_UART_CTS PAL_LINE(IOPORT1, IOPORT1_UART_CTS) | ||
130 | #define LINE_UART_RX PAL_LINE(IOPORT1, IOPORT1_UART_RX) | ||
131 | #define LINE_NFC1 PAL_LINE(IOPORT1, IOPORT1_NFC1) | ||
132 | #define LINE_NFC2 PAL_LINE(IOPORT1, IOPORT1_NFC2) | ||
133 | #define LINE_I2C_SCL PAL_LINE(IOPORT1, IOPORT1_I2C_SCL) | ||
134 | #define LINE_I2C_SDA PAL_LINE(IOPORT1, IOPORT1_I2C_SDA) | ||
135 | |||
136 | /* Our definitions */ | ||
137 | #define LINE_SPI_SCK PAL_LINE(IOPORT1, IOPORT1_SPI_SCK) | ||
138 | #define LINE_SPI_MOSI PAL_LINE(IOPORT1, IOPORT1_SPI_MOSI) | ||
139 | #define LINE_SPI_MISO PAL_LINE(IOPORT1, IOPORT1_SPI_MISO) | ||
140 | #define LINE_SPI_SS PAL_LINE(IOPORT1, IOPORT1_SPI_SS) | ||
141 | |||
142 | /* Analog line */ | ||
143 | #define LINE_AIN0 PAL_LINE(IOPORT1, IOPORT1_AIN0) | ||
144 | #define LINE_AIN1 PAL_LINE(IOPORT1, IOPORT1_AIN1) | ||
145 | #define LINE_AIN2 PAL_LINE(IOPORT1, IOPORT1_AIN2) | ||
146 | #define LINE_AIN3 PAL_LINE(IOPORT1, IOPORT1_AIN3) | ||
147 | #define LINE_AIN4 PAL_LINE(IOPORT1, IOPORT1_AIN4) | ||
148 | #define LINE_AIN5 PAL_LINE(IOPORT1, IOPORT1_AIN5) | ||
149 | #define LINE_AIN6 PAL_LINE(IOPORT1, IOPORT1_AIN6) | ||
150 | #define LINE_AIN7 PAL_LINE(IOPORT1, IOPORT1_AIN7) | ||
151 | #define LINE_AREF0 PAL_LINE(IOPORT1, IOPORT1_AREF0) | ||
152 | #define LINE_AREF1 PAL_LINE(IOPORT1, IOPORT1_AREF1) | ||
153 | |||
154 | #if !defined(_FROM_ASM_) | ||
155 | #ifdef __cplusplus | ||
156 | extern "C" { | ||
157 | #endif | ||
158 | void boardInit(void); | ||
159 | #ifdef __cplusplus | ||
160 | } | ||
161 | #endif | ||
162 | #endif /* _FROM_ASM_ */ | ||
163 | |||
164 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NRF52-E73-2G4M04S/board.mk b/lib/chibios-contrib/os/hal/boards/NRF52-E73-2G4M04S/board.mk new file mode 100644 index 000000000..8876668ec --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NRF52-E73-2G4M04S/board.mk | |||
@@ -0,0 +1,8 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/NRF52-E73-2G4M04S/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/NRF52-E73-2G4M04S | ||
6 | |||
7 | ALLCSRC += $(BOARDSRC) | ||
8 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.c b/lib/chibios-contrib/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.c new file mode 100644 index 000000000..f5aec9885 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.c | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2020 Alex Lewontin | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL | ||
20 | const PALConfig pal_default_config; | ||
21 | #endif | ||
22 | |||
23 | /** | ||
24 | * @brief Board-specific initialization code. | ||
25 | */ | ||
26 | void boardInit(void) | ||
27 | { | ||
28 | #if HAL_USE_PAL | ||
29 | OnboardLED_Init(); | ||
30 | #endif | ||
31 | } | ||
32 | |||
33 | /** | ||
34 | * @brief Early initialization code. | ||
35 | * @details This initialization is performed just after reset before BSS and | ||
36 | * DATA segments initialization. | ||
37 | */ | ||
38 | void __early_init(void) | ||
39 | { | ||
40 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.h b/lib/chibios-contrib/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.h new file mode 100644 index 000000000..9dd49383c --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2020 Alex Lewontin | ||
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 | |||
17 | #ifndef BOARD_H | ||
18 | #define BOARD_H | ||
19 | |||
20 | /* | ||
21 | * Setup for a generic board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define NUC123SD4AN0 | ||
28 | #define BOARD_NAME "NUTINY SDK NUC123 V2.0" | ||
29 | |||
30 | /* | ||
31 | * Board specific settings. | ||
32 | */ | ||
33 | /* | ||
34 | * External XTAL speed. | ||
35 | */ | ||
36 | #define NUC123_HSECLK 12000000UL | ||
37 | |||
38 | /* | ||
39 | * LED macros. | ||
40 | */ | ||
41 | #define ONBOARD_LED_LINE PAL_LINE(GPIOB, 4) | ||
42 | |||
43 | #define OnboardLED_Init() \ | ||
44 | palSetGroupMode(GPIOB, 1, 4, PAL_MODE_OUTPUT_PUSHPULL) | ||
45 | #define OnboardLED_On() palClearLine(ONBOARD_LED_LINE) | ||
46 | #define OnboardLED_Off() palSetLine(ONBOARD_LED_LINE) | ||
47 | #define OnboardLED_Toggle() palToggleLine(ONBOARD_LED_LINE) | ||
48 | |||
49 | #define ONBOARD_SERIAL_DRIVER SD0 | ||
50 | |||
51 | #if !defined(_FROM_ASM_) | ||
52 | #ifdef __cplusplus | ||
53 | extern "C" { | ||
54 | #endif | ||
55 | void boardInit(void); | ||
56 | #ifdef __cplusplus | ||
57 | } | ||
58 | #endif | ||
59 | #endif /* _FROM_ASM_ */ | ||
60 | |||
61 | #endif /* BOARD_H */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.mk b/lib/chibios-contrib/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.mk new file mode 100644 index 000000000..d6c9b105c --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.mk | |||
@@ -0,0 +1,8 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = $(CHIBIOS_CONTRIB)/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = $(CHIBIOS_CONTRIB)/os/hal/boards/NUTINY-SDK-NUC123-V2.0 | ||
6 | |||
7 | ALLCSRC += $(BOARDSRC) | ||
8 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/OSHCHIP_V1.0/board.c b/lib/chibios-contrib/os/hal/boards/OSHCHIP_V1.0/board.c new file mode 100644 index 000000000..85e4486b3 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/OSHCHIP_V1.0/board.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 flabbergast | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | /** | ||
21 | * @brief PAL setup. | ||
22 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
23 | * This variable is used by the HAL when initializing the PAL driver. | ||
24 | */ | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | .pads = { | ||
28 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.0: PIN11 (AREF0) */ | ||
29 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.1: PIN9 (AIN2) */ | ||
30 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.2: PIN10 (AIN3) */ | ||
31 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.3: LED_BLUE */ | ||
32 | PAL_MODE_UNCONNECTED, /* P0.4 */ | ||
33 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.5: LED_GREEN */ | ||
34 | PAL_MODE_UNCONNECTED, /* P0.6 */ | ||
35 | PAL_MODE_UNCONNECTED, /* P0.7 */ | ||
36 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.8: LED_RED */ | ||
37 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.9: PIN7 */ | ||
38 | PAL_MODE_UNCONNECTED, /* P0.10 */ | ||
39 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.11: PIN6 */ | ||
40 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.12: PIN5 */ | ||
41 | PAL_MODE_UNCONNECTED, /* P0.13 */ | ||
42 | PAL_MODE_UNCONNECTED, /* P0.14 */ | ||
43 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.15: PIN4 */ | ||
44 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.16: PIN3 */ | ||
45 | PAL_MODE_UNCONNECTED, /* P0.17 */ | ||
46 | PAL_MODE_INPUT_PULLUP, /* P0.18: PIN2 (RX) */ | ||
47 | PAL_MODE_UNCONNECTED, /* P0.19 */ | ||
48 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.20: PIN1 (TX) */ | ||
49 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.21: PIN15 */ | ||
50 | PAL_MODE_UNCONNECTED, /* P0.22 */ | ||
51 | PAL_MODE_UNCONNECTED, /* P0.23 */ | ||
52 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.24: PIN14 */ | ||
53 | PAL_MODE_UNCONNECTED, /* P0.25 */ | ||
54 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.26: PIN13 (LFXTL) (AIN0) */ | ||
55 | PAL_MODE_OUTPUT_PUSHPULL, /* P0.27: PIN12 (LFXTL) (AIN1) */ | ||
56 | PAL_MODE_UNCONNECTED, /* P0.28 */ | ||
57 | PAL_MODE_UNCONNECTED, /* P0.29 */ | ||
58 | PAL_MODE_UNCONNECTED, /* P0.30 */ | ||
59 | PAL_MODE_UNCONNECTED, /* P0.31 */ | ||
60 | }, | ||
61 | }; | ||
62 | #endif | ||
63 | |||
64 | /** | ||
65 | * @brief Early initialization code. | ||
66 | * @details This initialization is performed just after reset before BSS and | ||
67 | * DATA segments initialization. | ||
68 | */ | ||
69 | void __early_init(void) | ||
70 | { | ||
71 | } | ||
72 | |||
73 | /** | ||
74 | * @brief Late initialization code. | ||
75 | * @note This initialization is performed after BSS and DATA segments | ||
76 | * initialization and before invoking the main() function. | ||
77 | */ | ||
78 | void boardInit(void) | ||
79 | { | ||
80 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/OSHCHIP_V1.0/board.h b/lib/chibios-contrib/os/hal/boards/OSHCHIP_V1.0/board.h new file mode 100644 index 000000000..e3bbb0baa --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/OSHCHIP_V1.0/board.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 flabbergast | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* Board identifier. */ | ||
21 | #define BOARD_OSHCHIP_V10 | ||
22 | #define BOARD_NAME "OSHChip_V1.0" | ||
23 | |||
24 | /* Board oscillators-related settings. */ | ||
25 | #define NRF51_XTAL_VALUE 16000000 | ||
26 | |||
27 | /* Non-header GPIO pins. */ | ||
28 | #define LED_RED 8 | ||
29 | #define LED_GREEN 5 | ||
30 | #define LED_BLUE 3 | ||
31 | |||
32 | /* Common peripheral GPIO pins. */ | ||
33 | #define UART_TX 20 | ||
34 | #define UART_RX 18 | ||
35 | |||
36 | /* GPIO on DIP pins. */ | ||
37 | #define OSHCHIP_PIN1 20 | ||
38 | #define OSHCHIP_PIN2 18 | ||
39 | #define OSHCHIP_PIN3 16 | ||
40 | #define OSHCHIP_PIN4 15 | ||
41 | #define OSHCHIP_PIN5 12 | ||
42 | #define OSHCHIP_PIN6 11 | ||
43 | #define OSHCHIP_PIN7 9 | ||
44 | /* Pin 8 is GND */ | ||
45 | #define OSHCHIP_PIN9 1 | ||
46 | #define OSHCHIP_PIN10 2 | ||
47 | #define OSHCHIP_PIN11 0 | ||
48 | #define OSHCHIP_PIN12 27 | ||
49 | #define OSHCHIP_PIN13 26 | ||
50 | #define OSHCHIP_PIN14 24 | ||
51 | #define OSHCHIP_PIN15 21 | ||
52 | /* Pin 16 is VCC */ | ||
53 | |||
54 | #if !defined(_FROM_ASM_) | ||
55 | #ifdef __cplusplus | ||
56 | extern "C" { | ||
57 | #endif | ||
58 | void boardInit(void); | ||
59 | #ifdef __cplusplus | ||
60 | } | ||
61 | #endif | ||
62 | #endif /* _FROM_ASM_ */ | ||
63 | |||
64 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/OSHCHIP_V1.0/board.mk b/lib/chibios-contrib/os/hal/boards/OSHCHIP_V1.0/board.mk new file mode 100644 index 000000000..de1c59d4d --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/OSHCHIP_V1.0/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/OSHCHIP_V1.0/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/OSHCHIP_V1.0 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3/board.c b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3/board.c new file mode 100644 index 000000000..4b47d15ec --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3/board.c | |||
@@ -0,0 +1,183 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | ||
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 | * 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 | */ | ||
173 | void __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 | */ | ||
182 | void boardInit(void) { | ||
183 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3/board.h b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3/board.h new file mode 100644 index 000000000..16e066620 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3/board.h | |||
@@ -0,0 +1,296 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the PJRC Teensy 3.0 board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_PJRC_TEENSY_3 | ||
28 | #define BOARD_NAME "PJRC Teensy 3.0" | ||
29 | |||
30 | /* External 16 MHz crystal */ | ||
31 | #define KINETIS_XTAL_FREQUENCY 16000000UL | ||
32 | |||
33 | /* Use internal capacitors for the crystal */ | ||
34 | #define KINETIS_BOARD_OSCILLATOR_SETTING OSC_CR_SC8P|OSC_CR_SC2P | ||
35 | |||
36 | /* | ||
37 | * MCU type | ||
38 | */ | ||
39 | #define K20x5 | ||
40 | |||
41 | /* | ||
42 | * IO pins assignments. | ||
43 | */ | ||
44 | #define PORTA_PIN0 0 | ||
45 | #define PORTA_PIN1 1 | ||
46 | #define PORTA_PIN2 2 | ||
47 | #define PORTA_PIN3 3 | ||
48 | #define TEENSY_PIN33 4 | ||
49 | #define TEENSY_PIN24 5 | ||
50 | #define PORTA_PIN6 6 | ||
51 | #define PORTA_PIN7 7 | ||
52 | #define PORTA_PIN8 8 | ||
53 | #define PORTA_PIN9 9 | ||
54 | #define PORTA_PIN10 10 | ||
55 | #define PORTA_PIN11 11 | ||
56 | #define TEENSY_PIN3 12 | ||
57 | #define TEENSY_PIN4 13 | ||
58 | #define PORTA_PIN14 14 | ||
59 | #define PORTA_PIN15 15 | ||
60 | #define PORTA_PIN16 16 | ||
61 | #define PORTA_PIN17 17 | ||
62 | #define PORTA_PIN18 18 | ||
63 | #define PORTA_PIN19 19 | ||
64 | #define PORTA_PIN20 20 | ||
65 | #define PORTA_PIN21 21 | ||
66 | #define PORTA_PIN22 22 | ||
67 | #define PORTA_PIN23 23 | ||
68 | #define PORTA_PIN24 24 | ||
69 | #define PORTA_PIN25 25 | ||
70 | #define PORTA_PIN26 26 | ||
71 | #define PORTA_PIN27 27 | ||
72 | #define PORTA_PIN28 28 | ||
73 | #define PORTA_PIN29 29 | ||
74 | #define PORTA_PIN30 30 | ||
75 | #define PORTA_PIN31 31 | ||
76 | |||
77 | #define TEENSY_PIN3_IOPORT IOPORT1 | ||
78 | #define TEENSY_PIN4_IOPORT IOPORT1 | ||
79 | #define TEENSY_PIN24_IOPORT IOPORT1 | ||
80 | #define TEENSY_PIN33_IOPORT IOPORT1 | ||
81 | |||
82 | #define TEENSY_PIN16 0 | ||
83 | #define TEENSY_PIN17 1 | ||
84 | #define TEENSY_PIN19 2 | ||
85 | #define TEENSY_PIN18 3 | ||
86 | #define PORTB_PIN4 4 | ||
87 | #define PORTB_PIN5 5 | ||
88 | #define PORTB_PIN6 6 | ||
89 | #define PORTB_PIN7 7 | ||
90 | #define PORTB_PIN8 8 | ||
91 | #define PORTB_PIN9 9 | ||
92 | #define PORTB_PIN10 10 | ||
93 | #define PORTB_PIN11 11 | ||
94 | #define PORTB_PIN12 12 | ||
95 | #define PORTB_PIN13 13 | ||
96 | #define PORTB_PIN14 14 | ||
97 | #define PORTB_PIN15 15 | ||
98 | #define TEENSY_PIN0 16 | ||
99 | #define TEENSY_PIN1 17 | ||
100 | #define TEENSY_PIN32 18 | ||
101 | #define TEENSY_PIN25 19 | ||
102 | #define PORTB_PIN20 20 | ||
103 | #define PORTB_PIN21 21 | ||
104 | #define PORTB_PIN22 22 | ||
105 | #define PORTB_PIN23 23 | ||
106 | #define PORTB_PIN24 24 | ||
107 | #define PORTB_PIN25 25 | ||
108 | #define PORTB_PIN26 26 | ||
109 | #define PORTB_PIN27 27 | ||
110 | #define PORTB_PIN28 28 | ||
111 | #define PORTB_PIN29 29 | ||
112 | #define PORTB_PIN30 30 | ||
113 | #define PORTB_PIN31 31 | ||
114 | |||
115 | #define TEENSY_PIN0_IOPORT IOPORT2 | ||
116 | #define TEENSY_PIN1_IOPORT IOPORT2 | ||
117 | #define TEENSY_PIN16_IOPORT IOPORT2 | ||
118 | #define TEENSY_PIN17_IOPORT IOPORT2 | ||
119 | #define TEENSY_PIN18_IOPORT IOPORT2 | ||
120 | #define TEENSY_PIN19_IOPORT IOPORT2 | ||
121 | #define TEENSY_PIN25_IOPORT IOPORT2 | ||
122 | #define TEENSY_PIN32_IOPORT IOPORT2 | ||
123 | |||
124 | #define TEENSY_PIN15 0 | ||
125 | #define TEENSY_PIN22 1 | ||
126 | #define TEENSY_PIN23 2 | ||
127 | #define TEENSY_PIN9 3 | ||
128 | #define TEENSY_PIN10 4 | ||
129 | #define TEENSY_PIN13 5 | ||
130 | #define TEENSY_PIN11 6 | ||
131 | #define TEENSY_PIN12 7 | ||
132 | #define TEENSY_PIN28 8 | ||
133 | #define TEENSY_PIN27 9 | ||
134 | #define TEENSY_PIN29 10 | ||
135 | #define TEENSY_PIN30 11 | ||
136 | #define PORTC_PIN12 12 | ||
137 | #define PORTC_PIN13 13 | ||
138 | #define PORTC_PIN14 14 | ||
139 | #define PORTC_PIN15 15 | ||
140 | #define PORTC_PIN16 16 | ||
141 | #define PORTC_PIN17 17 | ||
142 | #define PORTC_PIN18 18 | ||
143 | #define PORTC_PIN19 19 | ||
144 | #define PORTC_PIN20 20 | ||
145 | #define PORTC_PIN21 21 | ||
146 | #define PORTC_PIN22 22 | ||
147 | #define PORTC_PIN23 23 | ||
148 | #define PORTC_PIN24 24 | ||
149 | #define PORTC_PIN25 25 | ||
150 | #define PORTC_PIN26 26 | ||
151 | #define PORTC_PIN27 27 | ||
152 | #define PORTC_PIN28 28 | ||
153 | #define PORTC_PIN29 29 | ||
154 | #define PORTC_PIN30 30 | ||
155 | #define PORTC_PIN31 31 | ||
156 | |||
157 | #define TEENSY_PIN9_IOPORT IOPORT3 | ||
158 | #define TEENSY_PIN10_IOPORT IOPORT3 | ||
159 | #define TEENSY_PIN11_IOPORT IOPORT3 | ||
160 | #define TEENSY_PIN12_IOPORT IOPORT3 | ||
161 | #define TEENSY_PIN13_IOPORT IOPORT3 | ||
162 | #define TEENSY_PIN15_IOPORT IOPORT3 | ||
163 | #define TEENSY_PIN22_IOPORT IOPORT3 | ||
164 | #define TEENSY_PIN23_IOPORT IOPORT3 | ||
165 | #define TEENSY_PIN27_IOPORT IOPORT3 | ||
166 | #define TEENSY_PIN28_IOPORT IOPORT3 | ||
167 | #define TEENSY_PIN29_IOPORT IOPORT3 | ||
168 | #define TEENSY_PIN30_IOPORT IOPORT3 | ||
169 | |||
170 | #define TEENSY_PIN2 0 | ||
171 | #define TEENSY_PIN14 1 | ||
172 | #define TEENSY_PIN7 2 | ||
173 | #define TEENSY_PIN8 3 | ||
174 | #define TEENSY_PIN6 4 | ||
175 | #define TEENSY_PIN20 5 | ||
176 | #define TEENSY_PIN21 6 | ||
177 | #define TEENSY_PIN5 7 | ||
178 | #define PORTD_PIN8 8 | ||
179 | #define PORTD_PIN9 9 | ||
180 | #define PORTD_PIN10 10 | ||
181 | #define PORTD_PIN11 11 | ||
182 | #define PORTD_PIN12 12 | ||
183 | #define PORTD_PIN13 13 | ||
184 | #define PORTD_PIN14 14 | ||
185 | #define PORTD_PIN15 15 | ||
186 | #define PORTD_PIN16 16 | ||
187 | #define PORTD_PIN17 17 | ||
188 | #define PORTD_PIN18 18 | ||
189 | #define PORTD_PIN19 19 | ||
190 | #define PORTD_PIN20 20 | ||
191 | #define PORTD_PIN21 21 | ||
192 | #define PORTD_PIN22 22 | ||
193 | #define PORTD_PIN23 23 | ||
194 | #define PORTD_PIN24 24 | ||
195 | #define PORTD_PIN25 25 | ||
196 | #define PORTD_PIN26 26 | ||
197 | #define PORTD_PIN27 27 | ||
198 | #define PORTD_PIN28 28 | ||
199 | #define PORTD_PIN29 29 | ||
200 | #define PORTD_PIN30 30 | ||
201 | #define PORTD_PIN31 31 | ||
202 | |||
203 | #define TEENSY_PIN2_IOPORT IOPORT4 | ||
204 | #define TEENSY_PIN5_IOPORT IOPORT4 | ||
205 | #define TEENSY_PIN6_IOPORT IOPORT4 | ||
206 | #define TEENSY_PIN7_IOPORT IOPORT4 | ||
207 | #define TEENSY_PIN8_IOPORT IOPORT4 | ||
208 | #define TEENSY_PIN14_IOPORT IOPORT4 | ||
209 | #define TEENSY_PIN20_IOPORT IOPORT4 | ||
210 | #define TEENSY_PIN21_IOPORT IOPORT4 | ||
211 | |||
212 | #define TEENSY_PIN31 0 | ||
213 | #define TEENSY_PIN26 1 | ||
214 | #define PORTE_PIN2 2 | ||
215 | #define PORTE_PIN3 3 | ||
216 | #define PORTE_PIN4 4 | ||
217 | #define PORTE_PIN5 5 | ||
218 | #define PORTE_PIN6 6 | ||
219 | #define PORTE_PIN7 7 | ||
220 | #define PORTE_PIN8 8 | ||
221 | #define PORTE_PIN9 9 | ||
222 | #define PORTE_PIN10 10 | ||
223 | #define PORTE_PIN11 11 | ||
224 | #define PORTE_PIN12 12 | ||
225 | #define PORTE_PIN13 13 | ||
226 | #define PORTE_PIN14 14 | ||
227 | #define PORTE_PIN15 15 | ||
228 | #define PORTE_PIN16 16 | ||
229 | #define PORTE_PIN17 17 | ||
230 | #define PORTE_PIN18 18 | ||
231 | #define PORTE_PIN19 19 | ||
232 | #define PORTE_PIN20 20 | ||
233 | #define PORTE_PIN21 21 | ||
234 | #define PORTE_PIN22 22 | ||
235 | #define PORTE_PIN23 23 | ||
236 | #define PORTE_PIN24 24 | ||
237 | #define PORTE_PIN25 25 | ||
238 | #define PORTE_PIN26 26 | ||
239 | #define PORTE_PIN27 27 | ||
240 | #define PORTE_PIN28 28 | ||
241 | #define PORTE_PIN29 29 | ||
242 | #define PORTE_PIN30 30 | ||
243 | #define PORTE_PIN31 31 | ||
244 | |||
245 | #define TEENSY_PIN26_IOPORT IOPORT5 | ||
246 | #define TEENSY_PIN31_IOPORT IOPORT5 | ||
247 | |||
248 | #define LINE_PIN0 PAL_LINE(TEENSY_PIN0_IOPORT, TEENSY_PIN0) | ||
249 | #define LINE_PIN1 PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1) | ||
250 | #define LINE_PIN2 PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2) | ||
251 | #define LINE_PIN3 PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3) | ||
252 | #define LINE_PIN4 PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4) | ||
253 | #define LINE_PIN5 PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5) | ||
254 | #define LINE_PIN6 PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6) | ||
255 | #define LINE_PIN7 PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7) | ||
256 | #define LINE_PIN8 PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8) | ||
257 | #define LINE_PIN9 PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9) | ||
258 | #define LINE_PIN10 PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10) | ||
259 | #define LINE_PIN11 PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11) | ||
260 | #define LINE_PIN12 PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12) | ||
261 | #define LINE_PIN13 PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13) | ||
262 | #define LINE_PIN14 PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14) | ||
263 | #define LINE_PIN15 PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15) | ||
264 | #define LINE_PIN16 PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16) | ||
265 | #define LINE_PIN17 PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17) | ||
266 | #define LINE_PIN18 PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18) | ||
267 | #define LINE_PIN19 PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19) | ||
268 | #define LINE_PIN20 PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20) | ||
269 | #define LINE_PIN21 PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21) | ||
270 | #define LINE_PIN22 PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22) | ||
271 | #define LINE_PIN23 PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23) | ||
272 | #define LINE_PIN24 PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24) | ||
273 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
274 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
275 | #define LINE_PIN26 PAL_LINE(TEENSY_PIN26_IOPORT, TEENSY_PIN26) | ||
276 | #define LINE_PIN27 PAL_LINE(TEENSY_PIN27_IOPORT, TEENSY_PIN27) | ||
277 | #define LINE_PIN28 PAL_LINE(TEENSY_PIN28_IOPORT, TEENSY_PIN28) | ||
278 | #define LINE_PIN29 PAL_LINE(TEENSY_PIN29_IOPORT, TEENSY_PIN29) | ||
279 | #define LINE_PIN30 PAL_LINE(TEENSY_PIN30_IOPORT, TEENSY_PIN30) | ||
280 | #define LINE_PIN31 PAL_LINE(TEENSY_PIN31_IOPORT, TEENSY_PIN31) | ||
281 | #define LINE_PIN32 PAL_LINE(TEENSY_PIN32_IOPORT, TEENSY_PIN32) | ||
282 | #define LINE_PIN33 PAL_LINE(TEENSY_PIN33_IOPORT, TEENSY_PIN33) | ||
283 | |||
284 | #define LINE_LED LINE_PIN13 | ||
285 | |||
286 | #if !defined(_FROM_ASM_) | ||
287 | #ifdef __cplusplus | ||
288 | extern "C" { | ||
289 | #endif | ||
290 | void boardInit(void); | ||
291 | #ifdef __cplusplus | ||
292 | } | ||
293 | #endif | ||
294 | #endif /* _FROM_ASM_ */ | ||
295 | |||
296 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3/board.mk b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3/board.mk new file mode 100644 index 000000000..bd284bf0e --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_3/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_3 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
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 | */ | ||
24 | const 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 | */ | ||
173 | void __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 | */ | ||
182 | void boardInit(void) { | ||
183 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.h b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.h new file mode 100644 index 000000000..b40e8ae4b --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.h | |||
@@ -0,0 +1,296 @@ | |||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the PJRC Teensy 3.1 board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_PJRC_TEENSY_3_1 | ||
28 | #define BOARD_NAME "PJRC Teensy 3.1" | ||
29 | |||
30 | /* External 16 MHz crystal */ | ||
31 | #define KINETIS_XTAL_FREQUENCY 16000000UL | ||
32 | |||
33 | /* Use internal capacitors for the crystal */ | ||
34 | #define KINETIS_BOARD_OSCILLATOR_SETTING OSC_CR_SC8P|OSC_CR_SC2P | ||
35 | |||
36 | /* | ||
37 | * MCU type | ||
38 | */ | ||
39 | #define K20x7 | ||
40 | |||
41 | /* | ||
42 | * IO pins assignments. | ||
43 | */ | ||
44 | #define PORTA_PIN0 0 | ||
45 | #define PORTA_PIN1 1 | ||
46 | #define PORTA_PIN2 2 | ||
47 | #define PORTA_PIN3 3 | ||
48 | #define TEENSY_PIN33 4 | ||
49 | #define TEENSY_PIN24 5 | ||
50 | #define PORTA_PIN6 6 | ||
51 | #define PORTA_PIN7 7 | ||
52 | #define PORTA_PIN8 8 | ||
53 | #define PORTA_PIN9 9 | ||
54 | #define PORTA_PIN10 10 | ||
55 | #define PORTA_PIN11 11 | ||
56 | #define TEENSY_PIN3 12 | ||
57 | #define TEENSY_PIN4 13 | ||
58 | #define PORTA_PIN14 14 | ||
59 | #define PORTA_PIN15 15 | ||
60 | #define PORTA_PIN16 16 | ||
61 | #define PORTA_PIN17 17 | ||
62 | #define PORTA_PIN18 18 | ||
63 | #define PORTA_PIN19 19 | ||
64 | #define PORTA_PIN20 20 | ||
65 | #define PORTA_PIN21 21 | ||
66 | #define PORTA_PIN22 22 | ||
67 | #define PORTA_PIN23 23 | ||
68 | #define PORTA_PIN24 24 | ||
69 | #define PORTA_PIN25 25 | ||
70 | #define PORTA_PIN26 26 | ||
71 | #define PORTA_PIN27 27 | ||
72 | #define PORTA_PIN28 28 | ||
73 | #define PORTA_PIN29 29 | ||
74 | #define PORTA_PIN30 30 | ||
75 | #define PORTA_PIN31 31 | ||
76 | |||
77 | #define TEENSY_PIN3_IOPORT IOPORT1 | ||
78 | #define TEENSY_PIN4_IOPORT IOPORT1 | ||
79 | #define TEENSY_PIN24_IOPORT IOPORT1 | ||
80 | #define TEENSY_PIN33_IOPORT IOPORT1 | ||
81 | |||
82 | #define TEENSY_PIN16 0 | ||
83 | #define TEENSY_PIN17 1 | ||
84 | #define TEENSY_PIN19 2 | ||
85 | #define TEENSY_PIN18 3 | ||
86 | #define PORTB_PIN4 4 | ||
87 | #define PORTB_PIN5 5 | ||
88 | #define PORTB_PIN6 6 | ||
89 | #define PORTB_PIN7 7 | ||
90 | #define PORTB_PIN8 8 | ||
91 | #define PORTB_PIN9 9 | ||
92 | #define PORTB_PIN10 10 | ||
93 | #define PORTB_PIN11 11 | ||
94 | #define PORTB_PIN12 12 | ||
95 | #define PORTB_PIN13 13 | ||
96 | #define PORTB_PIN14 14 | ||
97 | #define PORTB_PIN15 15 | ||
98 | #define TEENSY_PIN0 16 | ||
99 | #define TEENSY_PIN1 17 | ||
100 | #define TEENSY_PIN32 18 | ||
101 | #define TEENSY_PIN25 19 | ||
102 | #define PORTB_PIN20 20 | ||
103 | #define PORTB_PIN21 21 | ||
104 | #define PORTB_PIN22 22 | ||
105 | #define PORTB_PIN23 23 | ||
106 | #define PORTB_PIN24 24 | ||
107 | #define PORTB_PIN25 25 | ||
108 | #define PORTB_PIN26 26 | ||
109 | #define PORTB_PIN27 27 | ||
110 | #define PORTB_PIN28 28 | ||
111 | #define PORTB_PIN29 29 | ||
112 | #define PORTB_PIN30 30 | ||
113 | #define PORTB_PIN31 31 | ||
114 | |||
115 | #define TEENSY_PIN0_IOPORT IOPORT2 | ||
116 | #define TEENSY_PIN1_IOPORT IOPORT2 | ||
117 | #define TEENSY_PIN16_IOPORT IOPORT2 | ||
118 | #define TEENSY_PIN17_IOPORT IOPORT2 | ||
119 | #define TEENSY_PIN18_IOPORT IOPORT2 | ||
120 | #define TEENSY_PIN19_IOPORT IOPORT2 | ||
121 | #define TEENSY_PIN25_IOPORT IOPORT2 | ||
122 | #define TEENSY_PIN32_IOPORT IOPORT2 | ||
123 | |||
124 | #define TEENSY_PIN15 0 | ||
125 | #define TEENSY_PIN22 1 | ||
126 | #define TEENSY_PIN23 2 | ||
127 | #define TEENSY_PIN9 3 | ||
128 | #define TEENSY_PIN10 4 | ||
129 | #define TEENSY_PIN13 5 | ||
130 | #define TEENSY_PIN11 6 | ||
131 | #define TEENSY_PIN12 7 | ||
132 | #define TEENSY_PIN28 8 | ||
133 | #define TEENSY_PIN27 9 | ||
134 | #define TEENSY_PIN29 10 | ||
135 | #define TEENSY_PIN30 11 | ||
136 | #define PORTC_PIN12 12 | ||
137 | #define PORTC_PIN13 13 | ||
138 | #define PORTC_PIN14 14 | ||
139 | #define PORTC_PIN15 15 | ||
140 | #define PORTC_PIN16 16 | ||
141 | #define PORTC_PIN17 17 | ||
142 | #define PORTC_PIN18 18 | ||
143 | #define PORTC_PIN19 19 | ||
144 | #define PORTC_PIN20 20 | ||
145 | #define PORTC_PIN21 21 | ||
146 | #define PORTC_PIN22 22 | ||
147 | #define PORTC_PIN23 23 | ||
148 | #define PORTC_PIN24 24 | ||
149 | #define PORTC_PIN25 25 | ||
150 | #define PORTC_PIN26 26 | ||
151 | #define PORTC_PIN27 27 | ||
152 | #define PORTC_PIN28 28 | ||
153 | #define PORTC_PIN29 29 | ||
154 | #define PORTC_PIN30 30 | ||
155 | #define PORTC_PIN31 31 | ||
156 | |||
157 | #define TEENSY_PIN9_IOPORT IOPORT3 | ||
158 | #define TEENSY_PIN10_IOPORT IOPORT3 | ||
159 | #define TEENSY_PIN11_IOPORT IOPORT3 | ||
160 | #define TEENSY_PIN12_IOPORT IOPORT3 | ||
161 | #define TEENSY_PIN13_IOPORT IOPORT3 | ||
162 | #define TEENSY_PIN15_IOPORT IOPORT3 | ||
163 | #define TEENSY_PIN22_IOPORT IOPORT3 | ||
164 | #define TEENSY_PIN23_IOPORT IOPORT3 | ||
165 | #define TEENSY_PIN27_IOPORT IOPORT3 | ||
166 | #define TEENSY_PIN28_IOPORT IOPORT3 | ||
167 | #define TEENSY_PIN29_IOPORT IOPORT3 | ||
168 | #define TEENSY_PIN30_IOPORT IOPORT3 | ||
169 | |||
170 | #define TEENSY_PIN2 0 | ||
171 | #define TEENSY_PIN14 1 | ||
172 | #define TEENSY_PIN7 2 | ||
173 | #define TEENSY_PIN8 3 | ||
174 | #define TEENSY_PIN6 4 | ||
175 | #define TEENSY_PIN20 5 | ||
176 | #define TEENSY_PIN21 6 | ||
177 | #define TEENSY_PIN5 7 | ||
178 | #define PORTD_PIN8 8 | ||
179 | #define PORTD_PIN9 9 | ||
180 | #define PORTD_PIN10 10 | ||
181 | #define PORTD_PIN11 11 | ||
182 | #define PORTD_PIN12 12 | ||
183 | #define PORTD_PIN13 13 | ||
184 | #define PORTD_PIN14 14 | ||
185 | #define PORTD_PIN15 15 | ||
186 | #define PORTD_PIN16 16 | ||
187 | #define PORTD_PIN17 17 | ||
188 | #define PORTD_PIN18 18 | ||
189 | #define PORTD_PIN19 19 | ||
190 | #define PORTD_PIN20 20 | ||
191 | #define PORTD_PIN21 21 | ||
192 | #define PORTD_PIN22 22 | ||
193 | #define PORTD_PIN23 23 | ||
194 | #define PORTD_PIN24 24 | ||
195 | #define PORTD_PIN25 25 | ||
196 | #define PORTD_PIN26 26 | ||
197 | #define PORTD_PIN27 27 | ||
198 | #define PORTD_PIN28 28 | ||
199 | #define PORTD_PIN29 29 | ||
200 | #define PORTD_PIN30 30 | ||
201 | #define PORTD_PIN31 31 | ||
202 | |||
203 | #define TEENSY_PIN2_IOPORT IOPORT4 | ||
204 | #define TEENSY_PIN5_IOPORT IOPORT4 | ||
205 | #define TEENSY_PIN6_IOPORT IOPORT4 | ||
206 | #define TEENSY_PIN7_IOPORT IOPORT4 | ||
207 | #define TEENSY_PIN8_IOPORT IOPORT4 | ||
208 | #define TEENSY_PIN14_IOPORT IOPORT4 | ||
209 | #define TEENSY_PIN20_IOPORT IOPORT4 | ||
210 | #define TEENSY_PIN21_IOPORT IOPORT4 | ||
211 | |||
212 | #define TEENSY_PIN31 0 | ||
213 | #define TEENSY_PIN26 1 | ||
214 | #define PORTE_PIN2 2 | ||
215 | #define PORTE_PIN3 3 | ||
216 | #define PORTE_PIN4 4 | ||
217 | #define PORTE_PIN5 5 | ||
218 | #define PORTE_PIN6 6 | ||
219 | #define PORTE_PIN7 7 | ||
220 | #define PORTE_PIN8 8 | ||
221 | #define PORTE_PIN9 9 | ||
222 | #define PORTE_PIN10 10 | ||
223 | #define PORTE_PIN11 11 | ||
224 | #define PORTE_PIN12 12 | ||
225 | #define PORTE_PIN13 13 | ||
226 | #define PORTE_PIN14 14 | ||
227 | #define PORTE_PIN15 15 | ||
228 | #define PORTE_PIN16 16 | ||
229 | #define PORTE_PIN17 17 | ||
230 | #define PORTE_PIN18 18 | ||
231 | #define PORTE_PIN19 19 | ||
232 | #define PORTE_PIN20 20 | ||
233 | #define PORTE_PIN21 21 | ||
234 | #define PORTE_PIN22 22 | ||
235 | #define PORTE_PIN23 23 | ||
236 | #define PORTE_PIN24 24 | ||
237 | #define PORTE_PIN25 25 | ||
238 | #define PORTE_PIN26 26 | ||
239 | #define PORTE_PIN27 27 | ||
240 | #define PORTE_PIN28 28 | ||
241 | #define PORTE_PIN29 29 | ||
242 | #define PORTE_PIN30 30 | ||
243 | #define PORTE_PIN31 31 | ||
244 | |||
245 | #define TEENSY_PIN26_IOPORT IOPORT5 | ||
246 | #define TEENSY_PIN31_IOPORT IOPORT5 | ||
247 | |||
248 | #define LINE_PIN0 PAL_LINE(TEENSY_PIN0_IOPORT, TEENSY_PIN0) | ||
249 | #define LINE_PIN1 PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1) | ||
250 | #define LINE_PIN2 PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2) | ||
251 | #define LINE_PIN3 PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3) | ||
252 | #define LINE_PIN4 PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4) | ||
253 | #define LINE_PIN5 PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5) | ||
254 | #define LINE_PIN6 PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6) | ||
255 | #define LINE_PIN7 PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7) | ||
256 | #define LINE_PIN8 PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8) | ||
257 | #define LINE_PIN9 PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9) | ||
258 | #define LINE_PIN10 PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10) | ||
259 | #define LINE_PIN11 PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11) | ||
260 | #define LINE_PIN12 PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12) | ||
261 | #define LINE_PIN13 PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13) | ||
262 | #define LINE_PIN14 PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14) | ||
263 | #define LINE_PIN15 PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15) | ||
264 | #define LINE_PIN16 PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16) | ||
265 | #define LINE_PIN17 PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17) | ||
266 | #define LINE_PIN18 PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18) | ||
267 | #define LINE_PIN19 PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19) | ||
268 | #define LINE_PIN20 PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20) | ||
269 | #define LINE_PIN21 PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21) | ||
270 | #define LINE_PIN22 PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22) | ||
271 | #define LINE_PIN23 PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23) | ||
272 | #define LINE_PIN24 PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24) | ||
273 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
274 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
275 | #define LINE_PIN26 PAL_LINE(TEENSY_PIN26_IOPORT, TEENSY_PIN26) | ||
276 | #define LINE_PIN27 PAL_LINE(TEENSY_PIN27_IOPORT, TEENSY_PIN27) | ||
277 | #define LINE_PIN28 PAL_LINE(TEENSY_PIN28_IOPORT, TEENSY_PIN28) | ||
278 | #define LINE_PIN29 PAL_LINE(TEENSY_PIN29_IOPORT, TEENSY_PIN29) | ||
279 | #define LINE_PIN30 PAL_LINE(TEENSY_PIN30_IOPORT, TEENSY_PIN30) | ||
280 | #define LINE_PIN31 PAL_LINE(TEENSY_PIN31_IOPORT, TEENSY_PIN31) | ||
281 | #define LINE_PIN32 PAL_LINE(TEENSY_PIN32_IOPORT, TEENSY_PIN32) | ||
282 | #define LINE_PIN33 PAL_LINE(TEENSY_PIN33_IOPORT, TEENSY_PIN33) | ||
283 | |||
284 | #define LINE_LED LINE_PIN13 | ||
285 | |||
286 | #if !defined(_FROM_ASM_) | ||
287 | #ifdef __cplusplus | ||
288 | extern "C" { | ||
289 | #endif | ||
290 | void boardInit(void); | ||
291 | #ifdef __cplusplus | ||
292 | } | ||
293 | #endif | ||
294 | #endif /* _FROM_ASM_ */ | ||
295 | |||
296 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.mk b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.mk new file mode 100644 index 000000000..985ccbbbc --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_1/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_3_1/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_3_1 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_5/board.c b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_5/board.c new file mode 100644 index 000000000..b081f1404 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_5/board.c | |||
@@ -0,0 +1,218 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2015 RedoX https://github.com/RedoXyde | ||
3 | Copyright (C) 2017 Wim Lewis | ||
4 | |||
5 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | you may not use this file except in compliance with the License. | ||
7 | You may obtain a copy of the License at | ||
8 | |||
9 | http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | |||
11 | Unless required by applicable law or agreed to in writing, software | ||
12 | distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | See the License for the specific language governing permissions and | ||
15 | limitations under the License. | ||
16 | */ | ||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | /** | ||
21 | * @brief PAL setup. | ||
22 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
23 | * This variable is used by the HAL when initializing the PAL driver. | ||
24 | */ | ||
25 | |||
26 | #define SOME_GPIO PAL_MODE_INPUT_PULLUP | ||
27 | |||
28 | const PALConfig pal_default_config = | ||
29 | { | ||
30 | .ports = { | ||
31 | { | ||
32 | /* | ||
33 | * PORTA setup. | ||
34 | * | ||
35 | * PTA0 -PTA3 -- bootloading coprocessor | ||
36 | * PTA5 -- PIN25 | ||
37 | * PTA12-PTA13 -- PIN3-PIN4 | ||
38 | * PTA14-PTA16 -- PIN26-PIN28 | ||
39 | * PTA17 -- PIN39 / A20 | ||
40 | * PTA26 -- PIN42 | ||
41 | * PTA28 -- PIN40 | ||
42 | * PTA29 -- PIN41 | ||
43 | * | ||
44 | * PTA18/19 crystal | ||
45 | */ | ||
46 | .port = IOPORT1, | ||
47 | .pads = { | ||
48 | /* PTA0-PTA3 -- bootloading coprocessor */ | ||
49 | PAL_MODE_ALTERNATIVE_7, PAL_MODE_UNCONNECTED, | ||
50 | PAL_MODE_UNCONNECTED, PAL_MODE_ALTERNATIVE_7, | ||
51 | |||
52 | PAL_MODE_UNCONNECTED, | ||
53 | PAL_MODE_OUTPUT_PUSHPULL, /* PIN25 */ | ||
54 | PAL_MODE_UNCONNECTED, | ||
55 | PAL_MODE_UNCONNECTED, | ||
56 | PAL_MODE_UNCONNECTED, | ||
57 | PAL_MODE_UNCONNECTED, | ||
58 | PAL_MODE_UNCONNECTED, | ||
59 | PAL_MODE_UNCONNECTED, | ||
60 | PAL_MODE_UNCONNECTED, /* PIN3 */ | ||
61 | PAL_MODE_OUTPUT_PUSHPULL, /* PIN4 */ | ||
62 | PAL_MODE_OUTPUT_PUSHPULL, /* PIN26 */ | ||
63 | PAL_MODE_UNCONNECTED, /* PIN27 */ | ||
64 | PAL_MODE_UNCONNECTED, /* PIN28 */ | ||
65 | PAL_MODE_UNCONNECTED, /* PIN39 */ | ||
66 | PAL_MODE_INPUT_ANALOG, /* XTAL0 */ | ||
67 | PAL_MODE_INPUT_ANALOG, /* XTAL0 */ | ||
68 | PAL_MODE_UNCONNECTED, | ||
69 | PAL_MODE_UNCONNECTED, | ||
70 | PAL_MODE_UNCONNECTED, | ||
71 | PAL_MODE_UNCONNECTED, | ||
72 | PAL_MODE_UNCONNECTED, | ||
73 | PAL_MODE_UNCONNECTED, | ||
74 | PAL_MODE_UNCONNECTED, /* PIN42 */ | ||
75 | PAL_MODE_UNCONNECTED, | ||
76 | PAL_MODE_UNCONNECTED, /* PIN40 */ | ||
77 | PAL_MODE_UNCONNECTED, /* PIN41 */ | ||
78 | PAL_MODE_UNCONNECTED, | ||
79 | PAL_MODE_UNCONNECTED, | ||
80 | }, | ||
81 | }, | ||
82 | { | ||
83 | /* | ||
84 | * PORTB setup. | ||
85 | * | ||
86 | * PTB0 - PIN16 | ||
87 | * PTB1 - PIN17 | ||
88 | * PTB2 - PIN19 | ||
89 | * PTB3 - PIN18 | ||
90 | * PTB10 - PIN31 | ||
91 | * PTB11 - PIN32 | ||
92 | * PTB16 - PIN0 - UART0_TX | ||
93 | * PTB17 - PIN1 - UART0_RX | ||
94 | * PTB18 - PIN32 | ||
95 | * PTB19 - PIN25 | ||
96 | */ | ||
97 | .port = IOPORT2, | ||
98 | .pads = { | ||
99 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
100 | PAL_MODE_OUTPUT_PUSHPULL, SOME_GPIO, SOME_GPIO, | ||
101 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
102 | PAL_MODE_UNCONNECTED, SOME_GPIO, SOME_GPIO, | ||
103 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
104 | PAL_MODE_UNCONNECTED, PAL_MODE_ALTERNATIVE_3, PAL_MODE_ALTERNATIVE_3, | ||
105 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, SOME_GPIO, | ||
106 | SOME_GPIO, SOME_GPIO, SOME_GPIO, | ||
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, | ||
110 | }, | ||
111 | }, | ||
112 | { | ||
113 | /* | ||
114 | * PORTC setup. | ||
115 | * | ||
116 | * PTC0 - PIN15 | ||
117 | * PTC1 - PIN22 | ||
118 | * PTC2 - PIN23 | ||
119 | * PTC3 - PIN9 | ||
120 | * PTC4 - PIN10 | ||
121 | * PTC5 - PIN13 | ||
122 | * PTC6 - PIN11 | ||
123 | * PTC7 - PIN12 | ||
124 | * PTC8 - PIN35 | ||
125 | * PTC9 - PIN36 | ||
126 | * PTC10 - PIN37 | ||
127 | * PTC11 - PIN38 | ||
128 | */ | ||
129 | .port = IOPORT3, | ||
130 | .pads = { | ||
131 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
132 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
133 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
134 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
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, PAL_MODE_UNCONNECTED, | ||
140 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
141 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
142 | }, | ||
143 | }, | ||
144 | { | ||
145 | /* | ||
146 | * PORTD setup. | ||
147 | * | ||
148 | * PTD0 - PIN2 | ||
149 | * PTD1 - PIN14 | ||
150 | * PTD2 - PIN7 | ||
151 | * PTD3 - PIN8 | ||
152 | * PTD4 - PIN6 | ||
153 | * PTD5 - PIN20 | ||
154 | * PTD6 - PIN21 | ||
155 | * PTD7 - PIN5 | ||
156 | */ | ||
157 | .port = IOPORT4, | ||
158 | .pads = { | ||
159 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
160 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
161 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, SOME_GPIO, | ||
162 | PAL_MODE_UNCONNECTED, SOME_GPIO, SOME_GPIO, | ||
163 | SOME_GPIO, SOME_GPIO, SOME_GPIO, | ||
164 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
165 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
166 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
167 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
168 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
169 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
170 | }, | ||
171 | }, | ||
172 | { | ||
173 | /* | ||
174 | * PORTE setup. | ||
175 | * | ||
176 | * PTE0 - PTE5 -- SDHC slot | ||
177 | * PTE6 -- USB OTG power switch (Teensy3.6 only) | ||
178 | * PTE10 - PIN56 | ||
179 | * PTE11 - PIN57 | ||
180 | * PTE24 - PIN33 | ||
181 | * PTE25 - PIN34 | ||
182 | * PTE26 - PIN24 | ||
183 | */ | ||
184 | .port = IOPORT5, | ||
185 | .pads = { | ||
186 | PAL_MODE_ALTERNATIVE_4, PAL_MODE_ALTERNATIVE_4, PAL_MODE_ALTERNATIVE_4, | ||
187 | PAL_MODE_ALTERNATIVE_4, PAL_MODE_ALTERNATIVE_4, PAL_MODE_ALTERNATIVE_4, | ||
188 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
189 | PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
190 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
191 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
192 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
193 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
194 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
195 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
196 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
197 | }, | ||
198 | }, | ||
199 | }, | ||
200 | }; | ||
201 | #endif | ||
202 | |||
203 | /** | ||
204 | * @brief Early initialization code. | ||
205 | * @details This initialization must be performed just after stack setup | ||
206 | * and before any other initialization. | ||
207 | */ | ||
208 | void __early_init(void) { | ||
209 | |||
210 | k60x_clock_init(); | ||
211 | } | ||
212 | |||
213 | /** | ||
214 | * @brief Board-specific initialization code. | ||
215 | * @todo Add your board-specific code, if any. | ||
216 | */ | ||
217 | void boardInit(void) { | ||
218 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_5/board.h b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_5/board.h new file mode 100644 index 000000000..7c10831bb --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_5/board.h | |||
@@ -0,0 +1,243 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2017 Wim Lewis | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the PJRC Teensy 3.5 board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier | ||
26 | */ | ||
27 | #define BOARD_PJRC_TEENSY_3_5 | ||
28 | #define BOARD_NAME "PJRC Teensy 3.5" | ||
29 | |||
30 | /* External 16 MHz crystal */ | ||
31 | #define KINETIS_XTAL_FREQUENCY 16000000UL | ||
32 | |||
33 | /* Use internal capacitors for the crystal */ | ||
34 | #define KINETIS_BOARD_OSCILLATOR_SETTING OSC_CR_SC8P|OSC_CR_SC2P | ||
35 | |||
36 | /* | ||
37 | * MCU type | ||
38 | */ | ||
39 | #define K64FX512 | ||
40 | |||
41 | /* | ||
42 | * IO pin assignments | ||
43 | */ | ||
44 | #define TEENSY_PIN25 5 | ||
45 | #define TEENSY_PIN3 12 | ||
46 | #define TEENSY_PIN4 13 | ||
47 | #define TEENSY_PIN26 14 | ||
48 | #define TEENSY_PIN27 15 | ||
49 | #define TEENSY_PIN28 16 | ||
50 | #define TEENSY_PIN39 17 | ||
51 | #define TEENSY_PIN42 26 | ||
52 | #define TEENSY_PIN40 28 | ||
53 | #define TEENSY_PIN41 29 | ||
54 | |||
55 | #define TEENSY_PIN25_IOPORT IOPORT1 | ||
56 | #define TEENSY_PIN3_IOPORT IOPORT1 | ||
57 | #define TEENSY_PIN4_IOPORT IOPORT1 | ||
58 | #define TEENSY_PIN26_IOPORT IOPORT1 | ||
59 | #define TEENSY_PIN27_IOPORT IOPORT1 | ||
60 | #define TEENSY_PIN28_IOPORT IOPORT1 | ||
61 | #define TEENSY_PIN39_IOPORT IOPORT1 | ||
62 | #define TEENSY_PIN42_IOPORT IOPORT1 | ||
63 | #define TEENSY_PIN40_IOPORT IOPORT1 | ||
64 | #define TEENSY_PIN41_IOPORT IOPORT1 | ||
65 | |||
66 | #define TEENSY_PIN16 0 | ||
67 | #define TEENSY_PIN17 1 | ||
68 | #define TEENSY_PIN19 2 | ||
69 | #define TEENSY_PIN18 3 | ||
70 | #define TEENSY_PIN49 4 | ||
71 | #define TEENSY_PIN50 5 | ||
72 | #define TEENSY_PIN31 10 | ||
73 | #define TEENSY_PIN32 11 | ||
74 | #define TEENSY_PIN0 16 | ||
75 | #define TEENSY_PIN1 17 | ||
76 | #define TEENSY_PIN29 18 | ||
77 | #define TEENSY_PIN30 19 | ||
78 | #define TEENSY_PIN43 20 | ||
79 | #define TEENSY_PIN46 21 | ||
80 | #define TEENSY_PIN44 22 | ||
81 | #define TEENSY_PIN45 23 | ||
82 | |||
83 | #define TEENSY_PIN16_IOPORT IOPORT2 | ||
84 | #define TEENSY_PIN17_IOPORT IOPORT2 | ||
85 | #define TEENSY_PIN19_IOPORT IOPORT2 | ||
86 | #define TEENSY_PIN18_IOPORT IOPORT2 | ||
87 | #define TEENSY_PIN49_IOPORT IOPORT2 | ||
88 | #define TEENSY_PIN50_IOPORT IOPORT2 | ||
89 | #define TEENSY_PIN31_IOPORT IOPORT2 | ||
90 | #define TEENSY_PIN32_IOPORT IOPORT2 | ||
91 | #define TEENSY_PIN0_IOPORT IOPORT2 | ||
92 | #define TEENSY_PIN1_IOPORT IOPORT2 | ||
93 | #define TEENSY_PIN29_IOPORT IOPORT2 | ||
94 | #define TEENSY_PIN30_IOPORT IOPORT2 | ||
95 | #define TEENSY_PIN43_IOPORT IOPORT2 | ||
96 | #define TEENSY_PIN46_IOPORT IOPORT2 | ||
97 | #define TEENSY_PIN44_IOPORT IOPORT2 | ||
98 | #define TEENSY_PIN45_IOPORT IOPORT2 | ||
99 | |||
100 | #define TEENSY_PIN15 0 | ||
101 | #define TEENSY_PIN22 1 | ||
102 | #define TEENSY_PIN23 2 | ||
103 | #define TEENSY_PIN9 3 | ||
104 | #define TEENSY_PIN10 4 | ||
105 | #define TEENSY_PIN13 5 | ||
106 | #define TEENSY_PIN11 6 | ||
107 | #define TEENSY_PIN12 7 | ||
108 | #define TEENSY_PIN35 8 | ||
109 | #define TEENSY_PIN36 9 | ||
110 | #define TEENSY_PIN37 10 | ||
111 | #define TEENSY_PIN38 11 | ||
112 | |||
113 | #define TEENSY_PIN15_IOPORT IOPORT3 | ||
114 | #define TEENSY_PIN22_IOPORT IOPORT3 | ||
115 | #define TEENSY_PIN23_IOPORT IOPORT3 | ||
116 | #define TEENSY_PIN9_IOPORT IOPORT3 | ||
117 | #define TEENSY_PIN10_IOPORT IOPORT3 | ||
118 | #define TEENSY_PIN13_IOPORT IOPORT3 | ||
119 | #define TEENSY_PIN11_IOPORT IOPORT3 | ||
120 | #define TEENSY_PIN12_IOPORT IOPORT3 | ||
121 | #define TEENSY_PIN35_IOPORT IOPORT3 | ||
122 | #define TEENSY_PIN36_IOPORT IOPORT3 | ||
123 | #define TEENSY_PIN37_IOPORT IOPORT3 | ||
124 | #define TEENSY_PIN38_IOPORT IOPORT3 | ||
125 | |||
126 | #define TEENSY_PIN2 0 | ||
127 | #define TEENSY_PIN14 1 | ||
128 | #define TEENSY_PIN7 2 | ||
129 | #define TEENSY_PIN8 3 | ||
130 | #define TEENSY_PIN6 4 | ||
131 | #define TEENSY_PIN20 5 | ||
132 | #define TEENSY_PIN21 6 | ||
133 | #define TEENSY_PIN5 7 | ||
134 | #define TEENSY_PIN47 8 | ||
135 | #define TEENSY_PIN48 9 | ||
136 | #define TEENSY_PIN55 11 | ||
137 | #define TEENSY_PIN53 12 | ||
138 | #define TEENSY_PIN52 13 | ||
139 | #define TEENSY_PIN51 14 | ||
140 | #define TEENSY_PIN54 15 | ||
141 | |||
142 | #define TEENSY_PIN2_IOPORT IOPORT4 | ||
143 | #define TEENSY_PIN14_IOPORT IOPORT4 | ||
144 | #define TEENSY_PIN7_IOPORT IOPORT4 | ||
145 | #define TEENSY_PIN8_IOPORT IOPORT4 | ||
146 | #define TEENSY_PIN6_IOPORT IOPORT4 | ||
147 | #define TEENSY_PIN20_IOPORT IOPORT4 | ||
148 | #define TEENSY_PIN21_IOPORT IOPORT4 | ||
149 | #define TEENSY_PIN5_IOPORT IOPORT4 | ||
150 | #define TEENSY_PIN47_IOPORT IOPORT4 | ||
151 | #define TEENSY_PIN48_IOPORT IOPORT4 | ||
152 | #define TEENSY_PIN55_IOPORT IOPORT4 | ||
153 | #define TEENSY_PIN53_IOPORT IOPORT4 | ||
154 | #define TEENSY_PIN52_IOPORT IOPORT4 | ||
155 | #define TEENSY_PIN51_IOPORT IOPORT4 | ||
156 | #define TEENSY_PIN54_IOPORT IOPORT4 | ||
157 | |||
158 | #define TEENSY_PIN56 10 | ||
159 | #define TEENSY_PIN57 11 | ||
160 | #define TEENSY_PIN33 24 | ||
161 | #define TEENSY_PIN34 25 | ||
162 | #define TEENSY_PIN24 26 | ||
163 | |||
164 | #define TEENSY_PIN56_IOPORT IOPORT5 | ||
165 | #define TEENSY_PIN57_IOPORT IOPORT5 | ||
166 | #define TEENSY_PIN33_IOPORT IOPORT5 | ||
167 | #define TEENSY_PIN34_IOPORT IOPORT5 | ||
168 | #define TEENSY_PIN24_IOPORT IOPORT5 | ||
169 | |||
170 | #define LINE_PIN0 PAL_LINE(TEENSY_PIN0_IOPORT, TEENSY_PIN0) | ||
171 | #define LINE_PIN1 PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1) | ||
172 | #define LINE_PIN2 PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2) | ||
173 | #define LINE_PIN3 PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3) | ||
174 | #define LINE_PIN4 PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4) | ||
175 | #define LINE_PIN5 PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5) | ||
176 | #define LINE_PIN6 PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6) | ||
177 | #define LINE_PIN7 PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7) | ||
178 | #define LINE_PIN8 PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8) | ||
179 | #define LINE_PIN9 PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9) | ||
180 | #define LINE_PIN10 PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10) | ||
181 | #define LINE_PIN11 PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11) | ||
182 | #define LINE_PIN12 PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12) | ||
183 | #define LINE_PIN13 PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13) | ||
184 | #define LINE_PIN14 PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14) | ||
185 | #define LINE_PIN15 PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15) | ||
186 | #define LINE_PIN16 PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16) | ||
187 | #define LINE_PIN17 PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17) | ||
188 | #define LINE_PIN18 PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18) | ||
189 | #define LINE_PIN19 PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19) | ||
190 | #define LINE_PIN20 PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20) | ||
191 | #define LINE_PIN21 PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21) | ||
192 | #define LINE_PIN22 PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22) | ||
193 | #define LINE_PIN23 PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23) | ||
194 | #define LINE_PIN24 PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24) | ||
195 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
196 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
197 | #define LINE_PIN26 PAL_LINE(TEENSY_PIN26_IOPORT, TEENSY_PIN26) | ||
198 | #define LINE_PIN27 PAL_LINE(TEENSY_PIN27_IOPORT, TEENSY_PIN27) | ||
199 | #define LINE_PIN28 PAL_LINE(TEENSY_PIN28_IOPORT, TEENSY_PIN28) | ||
200 | #define LINE_PIN29 PAL_LINE(TEENSY_PIN29_IOPORT, TEENSY_PIN29) | ||
201 | #define LINE_PIN30 PAL_LINE(TEENSY_PIN30_IOPORT, TEENSY_PIN30) | ||
202 | #define LINE_PIN31 PAL_LINE(TEENSY_PIN31_IOPORT, TEENSY_PIN31) | ||
203 | #define LINE_PIN32 PAL_LINE(TEENSY_PIN32_IOPORT, TEENSY_PIN32) | ||
204 | #define LINE_PIN33 PAL_LINE(TEENSY_PIN33_IOPORT, TEENSY_PIN33) | ||
205 | #define LINE_PIN34 PAL_LINE(TEENSY_PIN34_IOPORT, TEENSY_PIN34) | ||
206 | #define LINE_PIN35 PAL_LINE(TEENSY_PIN35_IOPORT, TEENSY_PIN35) | ||
207 | #define LINE_PIN36 PAL_LINE(TEENSY_PIN36_IOPORT, TEENSY_PIN36) | ||
208 | #define LINE_PIN37 PAL_LINE(TEENSY_PIN37_IOPORT, TEENSY_PIN37) | ||
209 | #define LINE_PIN38 PAL_LINE(TEENSY_PIN38_IOPORT, TEENSY_PIN38) | ||
210 | #define LINE_PIN39 PAL_LINE(TEENSY_PIN39_IOPORT, TEENSY_PIN39) | ||
211 | #define LINE_PIN40 PAL_LINE(TEENSY_PIN40_IOPORT, TEENSY_PIN40) | ||
212 | #define LINE_PIN41 PAL_LINE(TEENSY_PIN41_IOPORT, TEENSY_PIN41) | ||
213 | #define LINE_PIN42 PAL_LINE(TEENSY_PIN42_IOPORT, TEENSY_PIN42) | ||
214 | #define LINE_PIN43 PAL_LINE(TEENSY_PIN43_IOPORT, TEENSY_PIN43) | ||
215 | #define LINE_PIN44 PAL_LINE(TEENSY_PIN44_IOPORT, TEENSY_PIN44) | ||
216 | #define LINE_PIN45 PAL_LINE(TEENSY_PIN45_IOPORT, TEENSY_PIN45) | ||
217 | #define LINE_PIN46 PAL_LINE(TEENSY_PIN46_IOPORT, TEENSY_PIN46) | ||
218 | #define LINE_PIN47 PAL_LINE(TEENSY_PIN47_IOPORT, TEENSY_PIN47) | ||
219 | #define LINE_PIN48 PAL_LINE(TEENSY_PIN48_IOPORT, TEENSY_PIN48) | ||
220 | #define LINE_PIN49 PAL_LINE(TEENSY_PIN49_IOPORT, TEENSY_PIN49) | ||
221 | #define LINE_PIN50 PAL_LINE(TEENSY_PIN50_IOPORT, TEENSY_PIN50) | ||
222 | #define LINE_PIN51 PAL_LINE(TEENSY_PIN51_IOPORT, TEENSY_PIN51) | ||
223 | #define LINE_PIN52 PAL_LINE(TEENSY_PIN52_IOPORT, TEENSY_PIN52) | ||
224 | #define LINE_PIN53 PAL_LINE(TEENSY_PIN53_IOPORT, TEENSY_PIN53) | ||
225 | #define LINE_PIN54 PAL_LINE(TEENSY_PIN54_IOPORT, TEENSY_PIN54) | ||
226 | #define LINE_PIN55 PAL_LINE(TEENSY_PIN55_IOPORT, TEENSY_PIN55) | ||
227 | #define LINE_PIN56 PAL_LINE(TEENSY_PIN56_IOPORT, TEENSY_PIN56) | ||
228 | #define LINE_PIN57 PAL_LINE(TEENSY_PIN57_IOPORT, TEENSY_PIN57) | ||
229 | |||
230 | #define LINE_LED LINE_PIN13 | ||
231 | |||
232 | #if !defined(_FROM_ASM_) | ||
233 | #ifdef __cplusplus | ||
234 | extern "C" { | ||
235 | #endif | ||
236 | void boardInit(void); | ||
237 | #ifdef __cplusplus | ||
238 | } | ||
239 | #endif | ||
240 | #endif /* _FROM_ASM_ */ | ||
241 | |||
242 | #endif /* _BOARD_H_ */ | ||
243 | |||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_5/board.mk b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_5/board.mk new file mode 100644 index 000000000..e7869a104 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_5/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_3_5/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_3_5 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
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 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.h b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.h new file mode 100644 index 000000000..0607d56f0 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.h | |||
@@ -0,0 +1,345 @@ | |||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the PJRC Teensy 3.6 board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_PJRC_TEENSY_3_6 | ||
28 | #define BOARD_NAME "PJRC Teensy 3.6" | ||
29 | |||
30 | /* External 16 MHz crystal */ | ||
31 | #define KINETIS_XTAL_FREQUENCY 16000000UL | ||
32 | |||
33 | /* Use internal capacitors for the crystal */ | ||
34 | #define KINETIS_BOARD_OSCILLATOR_SETTING OSC0_CR_SC8P_SET(1) | OSC0_CR_SC2P_SET(1) | OSC0_CR_ERCLKEN_SET(1) | ||
35 | |||
36 | /* | ||
37 | * MCU type | ||
38 | */ | ||
39 | #define MK66F18 | ||
40 | |||
41 | /* | ||
42 | * IO pins assignments. | ||
43 | */ | ||
44 | #define PORTA_PIN0 0 | ||
45 | #define PORTA_PIN1 1 | ||
46 | #define PORTA_PIN2 2 | ||
47 | #define PORTA_PIN3 3 | ||
48 | #define PORTA_PIN4 4 | ||
49 | #define TEENSY_PIN25 5 | ||
50 | #define PORTA_PIN6 6 | ||
51 | #define PORTA_PIN7 7 | ||
52 | #define PORTA_PIN8 8 | ||
53 | #define PORTA_PIN9 9 | ||
54 | #define PORTA_PIN10 10 | ||
55 | #define PORTA_PIN11 11 | ||
56 | #define TEENSY_PIN3 12 | ||
57 | #define TEENSY_PIN4 13 | ||
58 | #define TEENSY_PIN26 14 | ||
59 | #define TEENSY_PIN27 15 | ||
60 | #define TEENSY_PIN28 16 | ||
61 | #define TEENSY_PIN39 17 | ||
62 | #define PORTA_PIN18 18 | ||
63 | #define PORTA_PIN19 19 | ||
64 | #define PORTA_PIN20 20 | ||
65 | #define PORTA_PIN21 21 | ||
66 | #define PORTA_PIN22 22 | ||
67 | #define PORTA_PIN23 23 | ||
68 | #define PORTA_PIN24 24 | ||
69 | #define PORTA_PIN25 25 | ||
70 | #define TEENSY_PIN42 26 | ||
71 | #define PORTA_PIN27 27 | ||
72 | #define TEENSY_PIN40 28 | ||
73 | #define TEENSY_PIN41 29 | ||
74 | #define PORTA_PIN30 30 | ||
75 | #define PORTA_PIN31 31 | ||
76 | |||
77 | #define TEENSY_PIN40_IOPORT IOPORT1 | ||
78 | #define TEENSY_PIN41_IOPORT IOPORT1 | ||
79 | #define TEENSY_PIN42_IOPORT IOPORT1 | ||
80 | #define TEENSY_PIN3_IOPORT IOPORT1 | ||
81 | #define TEENSY_PIN4_IOPORT IOPORT1 | ||
82 | #define TEENSY_PIN25_IOPORT IOPORT1 | ||
83 | #define TEENSY_PIN26_IOPORT IOPORT1 | ||
84 | #define TEENSY_PIN27_IOPORT IOPORT1 | ||
85 | #define TEENSY_PIN28_IOPORT IOPORT1 | ||
86 | #define TEENSY_PIN39_IOPORT IOPORT1 | ||
87 | |||
88 | #define TEENSY_PIN16 0 | ||
89 | #define TEENSY_PIN17 1 | ||
90 | #define TEENSY_PIN19 2 | ||
91 | #define TEENSY_PIN18 3 | ||
92 | #define TEENSY_PIN49 4 | ||
93 | #define TEENSY_PIN50 5 | ||
94 | #define PORTB_PIN6 6 | ||
95 | #define PORTB_PIN7 7 | ||
96 | #define PORTB_PIN8 8 | ||
97 | #define PORTB_PIN9 9 | ||
98 | #define TEENSY_PIN31 10 | ||
99 | #define TEENSY_PIN32 11 | ||
100 | #define PORTB_PIN12 12 | ||
101 | #define PORTB_PIN13 13 | ||
102 | #define PORTB_PIN14 14 | ||
103 | #define PORTB_PIN15 15 | ||
104 | #define TEENSY_PIN0 16 | ||
105 | #define TEENSY_PIN1 17 | ||
106 | #define TEENSY_PIN29 18 | ||
107 | #define TEENSY_PIN30 19 | ||
108 | #define TEENSY_PIN43 20 | ||
109 | #define TEENSY_PIN46 21 | ||
110 | #define TEENSY_PIN44 22 | ||
111 | #define TEENSY_PIN45 23 | ||
112 | #define PORTB_PIN24 24 | ||
113 | #define PORTB_PIN25 25 | ||
114 | #define PORTB_PIN26 26 | ||
115 | #define PORTB_PIN27 27 | ||
116 | #define PORTB_PIN28 28 | ||
117 | #define PORTB_PIN29 29 | ||
118 | #define PORTB_PIN30 30 | ||
119 | #define PORTB_PIN31 31 | ||
120 | |||
121 | #define TEENSY_PIN49_IOPORT IOPORT2 | ||
122 | #define TEENSY_PIN50_IOPORT IOPORT2 | ||
123 | #define TEENSY_PIN43_IOPORT IOPORT2 | ||
124 | #define TEENSY_PIN44_IOPORT IOPORT2 | ||
125 | #define TEENSY_PIN45_IOPORT IOPORT2 | ||
126 | #define TEENSY_PIN46_IOPORT IOPORT2 | ||
127 | #define TEENSY_PIN0_IOPORT IOPORT2 | ||
128 | #define TEENSY_PIN1_IOPORT IOPORT2 | ||
129 | #define TEENSY_PIN29_IOPORT IOPORT2 | ||
130 | #define TEENSY_PIN30_IOPORT IOPORT2 | ||
131 | #define TEENSY_PIN31_IOPORT IOPORT2 | ||
132 | #define TEENSY_PIN32_IOPORT IOPORT2 | ||
133 | #define TEENSY_PIN16_IOPORT IOPORT2 | ||
134 | #define TEENSY_PIN17_IOPORT IOPORT2 | ||
135 | #define TEENSY_PIN19_IOPORT IOPORT2 | ||
136 | #define TEENSY_PIN18_IOPORT IOPORT2 | ||
137 | |||
138 | #define TEENSY_PIN15 0 | ||
139 | #define TEENSY_PIN22 1 | ||
140 | #define TEENSY_PIN23 2 | ||
141 | #define TEENSY_PIN9 3 | ||
142 | #define TEENSY_PIN10 4 | ||
143 | #define TEENSY_PIN13 5 | ||
144 | #define TEENSY_PIN11 6 | ||
145 | #define TEENSY_PIN12 7 | ||
146 | #define TEENSY_PIN35 8 | ||
147 | #define TEENSY_PIN36 9 | ||
148 | #define TEENSY_PIN37 10 | ||
149 | #define TEENSY_PIN38 11 | ||
150 | #define PORTC_PIN12 12 | ||
151 | #define PORTC_PIN13 13 | ||
152 | #define PORTC_PIN14 14 | ||
153 | #define PORTC_PIN15 15 | ||
154 | #define PORTC_PIN16 16 | ||
155 | #define PORTC_PIN17 17 | ||
156 | #define PORTC_PIN18 18 | ||
157 | #define PORTC_PIN19 19 | ||
158 | #define PORTC_PIN20 20 | ||
159 | #define PORTC_PIN21 21 | ||
160 | #define PORTC_PIN22 22 | ||
161 | #define PORTC_PIN23 23 | ||
162 | #define PORTC_PIN24 24 | ||
163 | #define PORTC_PIN25 25 | ||
164 | #define PORTC_PIN26 26 | ||
165 | #define PORTC_PIN27 27 | ||
166 | #define PORTC_PIN28 28 | ||
167 | #define PORTC_PIN29 29 | ||
168 | #define PORTC_PIN30 30 | ||
169 | #define PORTC_PIN31 31 | ||
170 | |||
171 | #define TEENSY_PIN9_IOPORT IOPORT3 | ||
172 | #define TEENSY_PIN10_IOPORT IOPORT3 | ||
173 | #define TEENSY_PIN11_IOPORT IOPORT3 | ||
174 | #define TEENSY_PIN12_IOPORT IOPORT3 | ||
175 | #define TEENSY_PIN35_IOPORT IOPORT3 | ||
176 | #define TEENSY_PIN36_IOPORT IOPORT3 | ||
177 | #define TEENSY_PIN37_IOPORT IOPORT3 | ||
178 | #define TEENSY_PIN38_IOPORT IOPORT3 | ||
179 | #define TEENSY_PIN13_IOPORT IOPORT3 | ||
180 | #define TEENSY_PIN15_IOPORT IOPORT3 | ||
181 | #define TEENSY_PIN22_IOPORT IOPORT3 | ||
182 | #define TEENSY_PIN23_IOPORT IOPORT3 | ||
183 | |||
184 | #define TEENSY_PIN2 0 | ||
185 | #define TEENSY_PIN14 1 | ||
186 | #define TEENSY_PIN7 2 | ||
187 | #define TEENSY_PIN8 3 | ||
188 | #define TEENSY_PIN6 4 | ||
189 | #define TEENSY_PIN20 5 | ||
190 | #define TEENSY_PIN21 6 | ||
191 | #define TEENSY_PIN5 7 | ||
192 | #define TEENSY_PIN47 8 | ||
193 | #define TEENSY_PIN48 9 | ||
194 | #define PORTD_PIN10 10 | ||
195 | #define TEENSY_PIN55 11 | ||
196 | #define TEENSY_PIN53 12 | ||
197 | #define TEENSY_PIN52 13 | ||
198 | #define TEENSY_PIN51 14 | ||
199 | #define TEENSY_PIN54 15 | ||
200 | #define PORTD_PIN16 16 | ||
201 | #define PORTD_PIN17 17 | ||
202 | #define PORTD_PIN18 18 | ||
203 | #define PORTD_PIN19 19 | ||
204 | #define PORTD_PIN20 20 | ||
205 | #define PORTD_PIN21 21 | ||
206 | #define PORTD_PIN22 22 | ||
207 | #define PORTD_PIN23 23 | ||
208 | #define PORTD_PIN24 24 | ||
209 | #define PORTD_PIN25 25 | ||
210 | #define PORTD_PIN26 26 | ||
211 | #define PORTD_PIN27 27 | ||
212 | #define PORTD_PIN28 28 | ||
213 | #define PORTD_PIN29 29 | ||
214 | #define PORTD_PIN30 30 | ||
215 | #define PORTD_PIN31 31 | ||
216 | |||
217 | #define TEENSY_PIN51_IOPORT IOPORT4 | ||
218 | #define TEENSY_PIN52_IOPORT IOPORT4 | ||
219 | #define TEENSY_PIN53_IOPORT IOPORT4 | ||
220 | #define TEENSY_PIN54_IOPORT IOPORT4 | ||
221 | #define TEENSY_PIN55_IOPORT IOPORT4 | ||
222 | #define TEENSY_PIN47_IOPORT IOPORT4 | ||
223 | #define TEENSY_PIN48_IOPORT IOPORT4 | ||
224 | #define TEENSY_PIN2_IOPORT IOPORT4 | ||
225 | #define TEENSY_PIN5_IOPORT IOPORT4 | ||
226 | #define TEENSY_PIN6_IOPORT IOPORT4 | ||
227 | #define TEENSY_PIN7_IOPORT IOPORT4 | ||
228 | #define TEENSY_PIN8_IOPORT IOPORT4 | ||
229 | #define TEENSY_PIN14_IOPORT IOPORT4 | ||
230 | #define TEENSY_PIN20_IOPORT IOPORT4 | ||
231 | #define TEENSY_PIN21_IOPORT IOPORT4 | ||
232 | |||
233 | #define PORTE_PIN0 0 | ||
234 | #define PORTE_PIN1 1 | ||
235 | #define PORTE_PIN2 2 | ||
236 | #define PORTE_PIN3 3 | ||
237 | #define PORTE_PIN4 4 | ||
238 | #define PORTE_PIN5 5 | ||
239 | #define PORTE_PIN6 6 | ||
240 | #define PORTE_PIN7 7 | ||
241 | #define PORTE_PIN8 8 | ||
242 | #define PORTE_PIN9 9 | ||
243 | #define TEENSY_PIN56 10 | ||
244 | #define TEENSY_PIN57 11 | ||
245 | #define PORTE_PIN12 12 | ||
246 | #define PORTE_PIN13 13 | ||
247 | #define PORTE_PIN14 14 | ||
248 | #define PORTE_PIN15 15 | ||
249 | #define PORTE_PIN16 16 | ||
250 | #define PORTE_PIN17 17 | ||
251 | #define PORTE_PIN18 18 | ||
252 | #define PORTE_PIN19 19 | ||
253 | #define PORTE_PIN20 20 | ||
254 | #define PORTE_PIN21 21 | ||
255 | #define PORTE_PIN22 22 | ||
256 | #define PORTE_PIN23 23 | ||
257 | #define TEENSY_PIN33 24 | ||
258 | #define TEENSY_PIN34 25 | ||
259 | #define TEENSY_PIN24 26 | ||
260 | #define PORTE_PIN27 27 | ||
261 | #define PORTE_PIN28 28 | ||
262 | #define PORTE_PIN29 29 | ||
263 | #define PORTE_PIN30 30 | ||
264 | #define PORTE_PIN31 31 | ||
265 | |||
266 | #define TEENSY_PIN56_IOPORT IOPORT5 | ||
267 | #define TEENSY_PIN57_IOPORT IOPORT5 | ||
268 | #define TEENSY_PIN24_IOPORT IOPORT5 | ||
269 | #define TEENSY_PIN33_IOPORT IOPORT5 | ||
270 | #define TEENSY_PIN34_IOPORT IOPORT5 | ||
271 | |||
272 | |||
273 | #define LINE_PIN0 PAL_LINE(TEENSY_PIN0_IOPORT, TEENSY_PIN0) | ||
274 | #define LINE_PIN1 PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1) | ||
275 | #define LINE_PIN2 PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2) | ||
276 | #define LINE_PIN3 PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3) | ||
277 | #define LINE_PIN4 PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4) | ||
278 | #define LINE_PIN5 PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5) | ||
279 | #define LINE_PIN6 PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6) | ||
280 | #define LINE_PIN7 PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7) | ||
281 | #define LINE_PIN8 PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8) | ||
282 | #define LINE_PIN9 PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9) | ||
283 | #define LINE_PIN10 PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10) | ||
284 | #define LINE_PIN11 PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11) | ||
285 | #define LINE_PIN12 PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12) | ||
286 | #define LINE_PIN13 PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13) | ||
287 | #define LINE_PIN14 PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14) | ||
288 | #define LINE_PIN15 PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15) | ||
289 | #define LINE_PIN16 PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16) | ||
290 | #define LINE_PIN17 PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17) | ||
291 | #define LINE_PIN18 PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18) | ||
292 | #define LINE_PIN19 PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19) | ||
293 | #define LINE_PIN20 PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20) | ||
294 | #define LINE_PIN21 PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21) | ||
295 | #define LINE_PIN22 PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22) | ||
296 | #define LINE_PIN23 PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23) | ||
297 | #define LINE_PIN24 PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24) | ||
298 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
299 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
300 | #define LINE_PIN26 PAL_LINE(TEENSY_PIN26_IOPORT, TEENSY_PIN26) | ||
301 | #define LINE_PIN27 PAL_LINE(TEENSY_PIN27_IOPORT, TEENSY_PIN27) | ||
302 | #define LINE_PIN28 PAL_LINE(TEENSY_PIN28_IOPORT, TEENSY_PIN28) | ||
303 | #define LINE_PIN29 PAL_LINE(TEENSY_PIN29_IOPORT, TEENSY_PIN29) | ||
304 | #define LINE_PIN30 PAL_LINE(TEENSY_PIN30_IOPORT, TEENSY_PIN30) | ||
305 | #define LINE_PIN31 PAL_LINE(TEENSY_PIN31_IOPORT, TEENSY_PIN31) | ||
306 | #define LINE_PIN32 PAL_LINE(TEENSY_PIN32_IOPORT, TEENSY_PIN32) | ||
307 | #define LINE_PIN33 PAL_LINE(TEENSY_PIN33_IOPORT, TEENSY_PIN33) | ||
308 | #define LINE_PIN34 PAL_LINE(TEENSY_PIN34_IOPORT, TEENSY_PIN34) | ||
309 | #define LINE_PIN35 PAL_LINE(TEENSY_PIN35_IOPORT, TEENSY_PIN35) | ||
310 | #define LINE_PIN36 PAL_LINE(TEENSY_PIN36_IOPORT, TEENSY_PIN36) | ||
311 | #define LINE_PIN37 PAL_LINE(TEENSY_PIN37_IOPORT, TEENSY_PIN37) | ||
312 | #define LINE_PIN38 PAL_LINE(TEENSY_PIN38_IOPORT, TEENSY_PIN38) | ||
313 | #define LINE_PIN39 PAL_LINE(TEENSY_PIN39_IOPORT, TEENSY_PIN39) | ||
314 | #define LINE_PIN40 PAL_LINE(TEENSY_PIN40_IOPORT, TEENSY_PIN40) | ||
315 | #define LINE_PIN41 PAL_LINE(TEENSY_PIN41_IOPORT, TEENSY_PIN41) | ||
316 | #define LINE_PIN42 PAL_LINE(TEENSY_PIN42_IOPORT, TEENSY_PIN42) | ||
317 | #define LINE_PIN43 PAL_LINE(TEENSY_PIN43_IOPORT, TEENSY_PIN43) | ||
318 | #define LINE_PIN44 PAL_LINE(TEENSY_PIN44_IOPORT, TEENSY_PIN44) | ||
319 | #define LINE_PIN45 PAL_LINE(TEENSY_PIN45_IOPORT, TEENSY_PIN45) | ||
320 | #define LINE_PIN46 PAL_LINE(TEENSY_PIN46_IOPORT, TEENSY_PIN46) | ||
321 | #define LINE_PIN47 PAL_LINE(TEENSY_PIN47_IOPORT, TEENSY_PIN47) | ||
322 | #define LINE_PIN48 PAL_LINE(TEENSY_PIN48_IOPORT, TEENSY_PIN48) | ||
323 | #define LINE_PIN49 PAL_LINE(TEENSY_PIN49_IOPORT, TEENSY_PIN49) | ||
324 | #define LINE_PIN50 PAL_LINE(TEENSY_PIN50_IOPORT, TEENSY_PIN50) | ||
325 | #define LINE_PIN51 PAL_LINE(TEENSY_PIN51_IOPORT, TEENSY_PIN50) | ||
326 | #define LINE_PIN52 PAL_LINE(TEENSY_PIN52_IOPORT, TEENSY_PIN52) | ||
327 | #define LINE_PIN53 PAL_LINE(TEENSY_PIN53_IOPORT, TEENSY_PIN53) | ||
328 | #define LINE_PIN54 PAL_LINE(TEENSY_PIN54_IOPORT, TEENSY_PIN54) | ||
329 | #define LINE_PIN55 PAL_LINE(TEENSY_PIN55_IOPORT, TEENSY_PIN55) | ||
330 | #define LINE_PIN56 PAL_LINE(TEENSY_PIN56_IOPORT, TEENSY_PIN56) | ||
331 | #define LINE_PIN57 PAL_LINE(TEENSY_PIN57_IOPORT, TEENSY_PIN57) | ||
332 | |||
333 | #define LINE_LED LINE_PIN13 | ||
334 | |||
335 | #if !defined(_FROM_ASM_) | ||
336 | #ifdef __cplusplus | ||
337 | extern "C" { | ||
338 | #endif | ||
339 | void boardInit(void); | ||
340 | #ifdef __cplusplus | ||
341 | } | ||
342 | #endif | ||
343 | #endif /* _FROM_ASM_ */ | ||
344 | |||
345 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.mk b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.mk new file mode 100644 index 000000000..ba25c8560 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_3_6/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_3_6/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_3_6 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_4_1/board.c b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_4_1/board.c new file mode 100644 index 000000000..3efd66337 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_4_1/board.c | |||
@@ -0,0 +1,47 @@ | |||
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 | }; | ||
27 | #endif | ||
28 | |||
29 | /** | ||
30 | * @brief Early initialization code. | ||
31 | * @details This initialization must be performed just after stack setup | ||
32 | * and before any other initialization. | ||
33 | */ | ||
34 | void __early_init(void) { | ||
35 | } | ||
36 | |||
37 | void __late_init(void) { | ||
38 | MIMXRT1062_clock_init(); | ||
39 | MIMXRT1062_MPU_init(); | ||
40 | } | ||
41 | |||
42 | /** | ||
43 | * @brief Board-specific initialization code. | ||
44 | * @todo Add your board-specific code, if any. | ||
45 | */ | ||
46 | void boardInit(void) { | ||
47 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_4_1/board.h b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_4_1/board.h new file mode 100644 index 000000000..798fd8737 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_4_1/board.h | |||
@@ -0,0 +1,404 @@ | |||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the PJRC Teensy 4.1 board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_PJRC_TEENSY_4_1 | ||
28 | #define BOARD_NAME "PJRC Teensy 4.1" | ||
29 | |||
30 | // TODO: correct clock values | ||
31 | |||
32 | /* External 16 MHz crystal */ | ||
33 | #define KINETIS_XTAL_FREQUENCY 16000000UL | ||
34 | |||
35 | /* Use internal capacitors for the crystal */ | ||
36 | #define KINETIS_BOARD_OSCILLATOR_SETTING OSC0_CR_SC8P_SET(1) | OSC0_CR_SC2P_SET(1) | OSC0_CR_ERCLKEN_SET(1) | ||
37 | |||
38 | /* | ||
39 | * MCU type | ||
40 | */ | ||
41 | #define MIMXRT1062 | ||
42 | |||
43 | /* | ||
44 | * IO pins assignments. | ||
45 | * | ||
46 | * These come from (with light string replacement from CORE_ to TEENSY_ for | ||
47 | * consistency with the Teensy 3.6 port): | ||
48 | * https://github.com/PaulStoffregen/cores/blob/master/teensy4/core_pins.h | ||
49 | * | ||
50 | */ | ||
51 | |||
52 | // We expose teensy pin numbers | ||
53 | #define TEENSY_PIN0 0 | ||
54 | #define TEENSY_PIN1 1 | ||
55 | #define TEENSY_PIN2 2 | ||
56 | #define TEENSY_PIN3 3 | ||
57 | #define TEENSY_PIN4 4 | ||
58 | #define TEENSY_PIN5 5 | ||
59 | #define TEENSY_PIN6 6 | ||
60 | #define TEENSY_PIN7 7 | ||
61 | #define TEENSY_PIN8 8 | ||
62 | #define TEENSY_PIN9 9 | ||
63 | #define TEENSY_PIN10 10 | ||
64 | #define TEENSY_PIN11 11 | ||
65 | #define TEENSY_PIN12 12 | ||
66 | #define TEENSY_PIN13 13 | ||
67 | #define TEENSY_PIN14 14 | ||
68 | #define TEENSY_PIN15 15 | ||
69 | #define TEENSY_PIN16 16 | ||
70 | #define TEENSY_PIN17 17 | ||
71 | #define TEENSY_PIN18 18 | ||
72 | #define TEENSY_PIN19 19 | ||
73 | #define TEENSY_PIN20 20 | ||
74 | #define TEENSY_PIN21 21 | ||
75 | #define TEENSY_PIN22 22 | ||
76 | #define TEENSY_PIN23 23 | ||
77 | #define TEENSY_PIN24 24 | ||
78 | #define TEENSY_PIN25 25 | ||
79 | #define TEENSY_PIN26 26 | ||
80 | #define TEENSY_PIN27 27 | ||
81 | #define TEENSY_PIN28 28 | ||
82 | #define TEENSY_PIN29 29 | ||
83 | #define TEENSY_PIN30 30 | ||
84 | #define TEENSY_PIN31 31 | ||
85 | #define TEENSY_PIN32 32 | ||
86 | #define TEENSY_PIN33 33 | ||
87 | #define TEENSY_PIN34 34 | ||
88 | #define TEENSY_PIN35 35 | ||
89 | #define TEENSY_PIN36 36 | ||
90 | #define TEENSY_PIN37 37 | ||
91 | #define TEENSY_PIN38 38 | ||
92 | #define TEENSY_PIN39 39 | ||
93 | #define TEENSY_PIN40 40 | ||
94 | #define TEENSY_PIN41 41 | ||
95 | #define TEENSY_PIN42 42 | ||
96 | #define TEENSY_PIN43 43 | ||
97 | #define TEENSY_PIN44 44 | ||
98 | #define TEENSY_PIN45 45 | ||
99 | #define TEENSY_PIN46 46 | ||
100 | #define TEENSY_PIN47 47 | ||
101 | #define TEENSY_PIN48 48 | ||
102 | #define TEENSY_PIN49 49 | ||
103 | #define TEENSY_PIN50 50 | ||
104 | #define TEENSY_PIN51 51 | ||
105 | #define TEENSY_PIN52 52 | ||
106 | #define TEENSY_PIN53 53 | ||
107 | #define TEENSY_PIN54 54 | ||
108 | |||
109 | #define TEENSY_PIN0_BIT 3 | ||
110 | #define TEENSY_PIN1_BIT 2 | ||
111 | #define TEENSY_PIN2_BIT 4 | ||
112 | #define TEENSY_PIN3_BIT 5 | ||
113 | #define TEENSY_PIN4_BIT 6 | ||
114 | #define TEENSY_PIN5_BIT 8 | ||
115 | #define TEENSY_PIN6_BIT 10 | ||
116 | #define TEENSY_PIN7_BIT 17 | ||
117 | #define TEENSY_PIN8_BIT 16 | ||
118 | #define TEENSY_PIN9_BIT 11 | ||
119 | #define TEENSY_PIN10_BIT 0 | ||
120 | #define TEENSY_PIN11_BIT 2 | ||
121 | #define TEENSY_PIN12_BIT 1 | ||
122 | #define TEENSY_PIN13_BIT 3 | ||
123 | #define TEENSY_PIN14_BIT 18 | ||
124 | #define TEENSY_PIN15_BIT 19 | ||
125 | #define TEENSY_PIN16_BIT 23 | ||
126 | #define TEENSY_PIN17_BIT 22 | ||
127 | #define TEENSY_PIN18_BIT 17 | ||
128 | #define TEENSY_PIN19_BIT 16 | ||
129 | #define TEENSY_PIN20_BIT 26 | ||
130 | #define TEENSY_PIN21_BIT 27 | ||
131 | #define TEENSY_PIN22_BIT 24 | ||
132 | #define TEENSY_PIN23_BIT 25 | ||
133 | #define TEENSY_PIN24_BIT 12 | ||
134 | #define TEENSY_PIN25_BIT 13 | ||
135 | #define TEENSY_PIN26_BIT 30 | ||
136 | #define TEENSY_PIN27_BIT 31 | ||
137 | #define TEENSY_PIN28_BIT 18 | ||
138 | #define TEENSY_PIN29_BIT 31 | ||
139 | #define TEENSY_PIN30_BIT 23 | ||
140 | #define TEENSY_PIN31_BIT 22 | ||
141 | #define TEENSY_PIN32_BIT 12 | ||
142 | #define TEENSY_PIN33_BIT 7 | ||
143 | #define TEENSY_PIN34_BIT 29 | ||
144 | #define TEENSY_PIN35_BIT 28 | ||
145 | #define TEENSY_PIN36_BIT 18 | ||
146 | #define TEENSY_PIN37_BIT 19 | ||
147 | #define TEENSY_PIN38_BIT 28 | ||
148 | #define TEENSY_PIN39_BIT 29 | ||
149 | #define TEENSY_PIN40_BIT 20 | ||
150 | #define TEENSY_PIN41_BIT 21 | ||
151 | #define TEENSY_PIN42_BIT 15 | ||
152 | #define TEENSY_PIN43_BIT 14 | ||
153 | #define TEENSY_PIN44_BIT 13 | ||
154 | #define TEENSY_PIN45_BIT 12 | ||
155 | #define TEENSY_PIN46_BIT 17 | ||
156 | #define TEENSY_PIN47_BIT 16 | ||
157 | #define TEENSY_PIN48_BIT 24 | ||
158 | #define TEENSY_PIN49_BIT 27 | ||
159 | #define TEENSY_PIN50_BIT 28 | ||
160 | #define TEENSY_PIN51_BIT 22 | ||
161 | #define TEENSY_PIN52_BIT 26 | ||
162 | #define TEENSY_PIN53_BIT 25 | ||
163 | #define TEENSY_PIN54_BIT 29 | ||
164 | |||
165 | #define TEENSY_PIN0_IOPORT GPIO6 | ||
166 | #define TEENSY_PIN1_IOPORT GPIO6 | ||
167 | #define TEENSY_PIN2_IOPORT GPIO9 | ||
168 | #define TEENSY_PIN3_IOPORT GPIO9 | ||
169 | #define TEENSY_PIN4_IOPORT GPIO9 | ||
170 | #define TEENSY_PIN5_IOPORT GPIO9 | ||
171 | #define TEENSY_PIN6_IOPORT GPIO7 | ||
172 | #define TEENSY_PIN7_IOPORT GPIO7 | ||
173 | #define TEENSY_PIN8_IOPORT GPIO7 | ||
174 | #define TEENSY_PIN9_IOPORT GPIO7 | ||
175 | #define TEENSY_PIN10_IOPORT GPIO7 | ||
176 | #define TEENSY_PIN11_IOPORT GPIO7 | ||
177 | #define TEENSY_PIN12_IOPORT GPIO7 | ||
178 | #define TEENSY_PIN13_IOPORT GPIO7 | ||
179 | #define TEENSY_PIN14_IOPORT GPIO6 | ||
180 | #define TEENSY_PIN15_IOPORT GPIO6 | ||
181 | #define TEENSY_PIN16_IOPORT GPIO6 | ||
182 | #define TEENSY_PIN17_IOPORT GPIO6 | ||
183 | #define TEENSY_PIN18_IOPORT GPIO6 | ||
184 | #define TEENSY_PIN19_IOPORT GPIO6 | ||
185 | #define TEENSY_PIN20_IOPORT GPIO6 | ||
186 | #define TEENSY_PIN21_IOPORT GPIO6 | ||
187 | #define TEENSY_PIN22_IOPORT GPIO6 | ||
188 | #define TEENSY_PIN23_IOPORT GPIO6 | ||
189 | #define TEENSY_PIN24_IOPORT GPIO6 | ||
190 | #define TEENSY_PIN25_IOPORT GPIO6 | ||
191 | #define TEENSY_PIN26_IOPORT GPIO6 | ||
192 | #define TEENSY_PIN27_IOPORT GPIO6 | ||
193 | #define TEENSY_PIN28_IOPORT GPIO8 | ||
194 | #define TEENSY_PIN29_IOPORT GPIO9 | ||
195 | #define TEENSY_PIN30_IOPORT GPIO8 | ||
196 | #define TEENSY_PIN31_IOPORT GPIO8 | ||
197 | #define TEENSY_PIN32_IOPORT GPIO7 | ||
198 | #define TEENSY_PIN33_IOPORT GPIO9 | ||
199 | #define TEENSY_PIN34_IOPORT GPIO7 | ||
200 | #define TEENSY_PIN35_IOPORT GPIO7 | ||
201 | #define TEENSY_PIN36_IOPORT GPIO7 | ||
202 | #define TEENSY_PIN37_IOPORT GPIO7 | ||
203 | #define TEENSY_PIN38_IOPORT GPIO6 | ||
204 | #define TEENSY_PIN39_IOPORT GPIO6 | ||
205 | #define TEENSY_PIN40_IOPORT GPIO6 | ||
206 | #define TEENSY_PIN41_IOPORT GPIO6 | ||
207 | #define TEENSY_PIN42_IOPORT GPIO8 | ||
208 | #define TEENSY_PIN43_IOPORT GPIO8 | ||
209 | #define TEENSY_PIN44_IOPORT GPIO8 | ||
210 | #define TEENSY_PIN45_IOPORT GPIO8 | ||
211 | #define TEENSY_PIN46_IOPORT GPIO8 | ||
212 | #define TEENSY_PIN47_IOPORT GPIO8 | ||
213 | #define TEENSY_PIN48_IOPORT GPIO9 | ||
214 | #define TEENSY_PIN49_IOPORT GPIO9 | ||
215 | #define TEENSY_PIN50_IOPORT GPIO9 | ||
216 | #define TEENSY_PIN51_IOPORT GPIO9 | ||
217 | #define TEENSY_PIN52_IOPORT GPIO9 | ||
218 | #define TEENSY_PIN53_IOPORT GPIO9 | ||
219 | #define TEENSY_PIN54_IOPORT GPIO9 | ||
220 | |||
221 | // mux config registers control which peripheral uses the pin | ||
222 | #define TEENSY_PIN0_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_03 | ||
223 | #define TEENSY_PIN1_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_02 | ||
224 | #define TEENSY_PIN2_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_04 | ||
225 | #define TEENSY_PIN3_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_05 | ||
226 | #define TEENSY_PIN4_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_06 | ||
227 | #define TEENSY_PIN5_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_08 | ||
228 | #define TEENSY_PIN6_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B0_10 | ||
229 | #define TEENSY_PIN7_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B1_01 | ||
230 | #define TEENSY_PIN8_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B1_00 | ||
231 | #define TEENSY_PIN9_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B0_11 | ||
232 | #define TEENSY_PIN10_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B0_00 | ||
233 | #define TEENSY_PIN11_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B0_02 | ||
234 | #define TEENSY_PIN12_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B0_01 | ||
235 | #define TEENSY_PIN13_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B0_03 | ||
236 | #define TEENSY_PIN14_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_02 | ||
237 | #define TEENSY_PIN15_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_03 | ||
238 | #define TEENSY_PIN16_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_07 | ||
239 | #define TEENSY_PIN17_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_06 | ||
240 | #define TEENSY_PIN18_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_01 | ||
241 | #define TEENSY_PIN19_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00 | ||
242 | #define TEENSY_PIN20_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_10 | ||
243 | #define TEENSY_PIN21_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_11 | ||
244 | #define TEENSY_PIN22_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_08 | ||
245 | #define TEENSY_PIN23_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_09 | ||
246 | #define TEENSY_PIN24_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_12 | ||
247 | #define TEENSY_PIN25_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_13 | ||
248 | #define TEENSY_PIN26_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_14 | ||
249 | #define TEENSY_PIN27_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_15 | ||
250 | #define TEENSY_PIN28_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_32 | ||
251 | #define TEENSY_PIN29_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_31 | ||
252 | #define TEENSY_PIN30_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_37 | ||
253 | #define TEENSY_PIN31_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_36 | ||
254 | #define TEENSY_PIN32_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B0_12 | ||
255 | #define TEENSY_PIN33_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_07 | ||
256 | #define TEENSY_PIN34_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B1_13 | ||
257 | #define TEENSY_PIN35_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B1_12 | ||
258 | #define TEENSY_PIN36_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B1_02 | ||
259 | #define TEENSY_PIN37_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_B1_03 | ||
260 | #define TEENSY_PIN38_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_12 | ||
261 | #define TEENSY_PIN39_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_13 | ||
262 | #define TEENSY_PIN40_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_04 | ||
263 | #define TEENSY_PIN41_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_05 | ||
264 | #define TEENSY_PIN42_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_03 | ||
265 | #define TEENSY_PIN43_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_02 | ||
266 | #define TEENSY_PIN44_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_01 | ||
267 | #define TEENSY_PIN45_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_00 | ||
268 | #define TEENSY_PIN46_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_05 | ||
269 | #define TEENSY_PIN47_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_04 | ||
270 | #define TEENSY_PIN48_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_24 | ||
271 | #define TEENSY_PIN49_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_27 | ||
272 | #define TEENSY_PIN50_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_28 | ||
273 | #define TEENSY_PIN51_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_22 | ||
274 | #define TEENSY_PIN52_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_26 | ||
275 | #define TEENSY_PIN53_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_25 | ||
276 | #define TEENSY_PIN54_MUX kIOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_29 | ||
277 | |||
278 | // pad config registers control pullup/pulldown/keeper, drive strength, etc | ||
279 | #define TEENSY_PIN0_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_03 | ||
280 | #define TEENSY_PIN1_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_02 | ||
281 | #define TEENSY_PIN2_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_04 | ||
282 | #define TEENSY_PIN3_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_05 | ||
283 | #define TEENSY_PIN4_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_06 | ||
284 | #define TEENSY_PIN5_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_08 | ||
285 | #define TEENSY_PIN6_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B0_10 | ||
286 | #define TEENSY_PIN7_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B1_01 | ||
287 | #define TEENSY_PIN8_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B1_00 | ||
288 | #define TEENSY_PIN9_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B0_11 | ||
289 | #define TEENSY_PIN10_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B0_00 | ||
290 | #define TEENSY_PIN11_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B0_02 | ||
291 | #define TEENSY_PIN12_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B0_01 | ||
292 | #define TEENSY_PIN13_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B0_03 | ||
293 | #define TEENSY_PIN14_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_02 | ||
294 | #define TEENSY_PIN15_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_03 | ||
295 | #define TEENSY_PIN16_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_07 | ||
296 | #define TEENSY_PIN17_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_06 | ||
297 | #define TEENSY_PIN18_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_01 | ||
298 | #define TEENSY_PIN19_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_00 | ||
299 | #define TEENSY_PIN20_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_10 | ||
300 | #define TEENSY_PIN21_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_11 | ||
301 | #define TEENSY_PIN22_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_08 | ||
302 | #define TEENSY_PIN23_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_09 | ||
303 | #define TEENSY_PIN24_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_12 | ||
304 | #define TEENSY_PIN25_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_13 | ||
305 | #define TEENSY_PIN26_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_14 | ||
306 | #define TEENSY_PIN27_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_15 | ||
307 | #define TEENSY_PIN28_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_32 | ||
308 | #define TEENSY_PIN29_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_31 | ||
309 | #define TEENSY_PIN30_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_37 | ||
310 | #define TEENSY_PIN31_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_36 | ||
311 | #define TEENSY_PIN32_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B0_12 | ||
312 | #define TEENSY_PIN33_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_07 | ||
313 | #define TEENSY_PIN34_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B1_13 | ||
314 | #define TEENSY_PIN35_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B1_12 | ||
315 | #define TEENSY_PIN36_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B1_02 | ||
316 | #define TEENSY_PIN37_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_B1_03 | ||
317 | #define TEENSY_PIN38_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_12 | ||
318 | #define TEENSY_PIN39_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_13 | ||
319 | #define TEENSY_PIN40_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_04 | ||
320 | #define TEENSY_PIN41_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_05 | ||
321 | #define TEENSY_PIN42_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_03 | ||
322 | #define TEENSY_PIN43_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_02 | ||
323 | #define TEENSY_PIN44_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_01 | ||
324 | #define TEENSY_PIN45_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_00 | ||
325 | #define TEENSY_PIN46_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_05 | ||
326 | #define TEENSY_PIN47_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_04 | ||
327 | #define TEENSY_PIN48_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_24 | ||
328 | #define TEENSY_PIN49_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_27 | ||
329 | #define TEENSY_PIN50_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_28 | ||
330 | #define TEENSY_PIN51_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_22 | ||
331 | #define TEENSY_PIN52_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_26 | ||
332 | #define TEENSY_PIN53_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_25 | ||
333 | #define TEENSY_PIN54_PAD kIOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_29 | ||
334 | |||
335 | #define LINE_PIN0 PAL_LINE(TEENSY_PIN0_IOPORT, TEENSY_PIN0) | ||
336 | #define LINE_PIN1 PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1) | ||
337 | #define LINE_PIN2 PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2) | ||
338 | #define LINE_PIN3 PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3) | ||
339 | #define LINE_PIN4 PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4) | ||
340 | #define LINE_PIN5 PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5) | ||
341 | #define LINE_PIN6 PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6) | ||
342 | #define LINE_PIN7 PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7) | ||
343 | #define LINE_PIN8 PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8) | ||
344 | #define LINE_PIN9 PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9) | ||
345 | #define LINE_PIN10 PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10) | ||
346 | #define LINE_PIN11 PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11) | ||
347 | #define LINE_PIN12 PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12) | ||
348 | #define LINE_PIN13 PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13) | ||
349 | #define LINE_PIN14 PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14) | ||
350 | #define LINE_PIN15 PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15) | ||
351 | #define LINE_PIN16 PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16) | ||
352 | #define LINE_PIN17 PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17) | ||
353 | #define LINE_PIN18 PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18) | ||
354 | #define LINE_PIN19 PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19) | ||
355 | #define LINE_PIN20 PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20) | ||
356 | #define LINE_PIN21 PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21) | ||
357 | #define LINE_PIN22 PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22) | ||
358 | #define LINE_PIN23 PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23) | ||
359 | #define LINE_PIN24 PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24) | ||
360 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
361 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
362 | #define LINE_PIN26 PAL_LINE(TEENSY_PIN26_IOPORT, TEENSY_PIN26) | ||
363 | #define LINE_PIN27 PAL_LINE(TEENSY_PIN27_IOPORT, TEENSY_PIN27) | ||
364 | #define LINE_PIN28 PAL_LINE(TEENSY_PIN28_IOPORT, TEENSY_PIN28) | ||
365 | #define LINE_PIN29 PAL_LINE(TEENSY_PIN29_IOPORT, TEENSY_PIN29) | ||
366 | #define LINE_PIN30 PAL_LINE(TEENSY_PIN30_IOPORT, TEENSY_PIN30) | ||
367 | #define LINE_PIN31 PAL_LINE(TEENSY_PIN31_IOPORT, TEENSY_PIN31) | ||
368 | #define LINE_PIN32 PAL_LINE(TEENSY_PIN32_IOPORT, TEENSY_PIN32) | ||
369 | #define LINE_PIN33 PAL_LINE(TEENSY_PIN33_IOPORT, TEENSY_PIN33) | ||
370 | #define LINE_PIN34 PAL_LINE(TEENSY_PIN34_IOPORT, TEENSY_PIN34) | ||
371 | #define LINE_PIN35 PAL_LINE(TEENSY_PIN35_IOPORT, TEENSY_PIN35) | ||
372 | #define LINE_PIN36 PAL_LINE(TEENSY_PIN36_IOPORT, TEENSY_PIN36) | ||
373 | #define LINE_PIN37 PAL_LINE(TEENSY_PIN37_IOPORT, TEENSY_PIN37) | ||
374 | #define LINE_PIN38 PAL_LINE(TEENSY_PIN38_IOPORT, TEENSY_PIN38) | ||
375 | #define LINE_PIN39 PAL_LINE(TEENSY_PIN39_IOPORT, TEENSY_PIN39) | ||
376 | #define LINE_PIN40 PAL_LINE(TEENSY_PIN40_IOPORT, TEENSY_PIN40) | ||
377 | #define LINE_PIN41 PAL_LINE(TEENSY_PIN41_IOPORT, TEENSY_PIN41) | ||
378 | #define LINE_PIN42 PAL_LINE(TEENSY_PIN42_IOPORT, TEENSY_PIN42) | ||
379 | #define LINE_PIN43 PAL_LINE(TEENSY_PIN43_IOPORT, TEENSY_PIN43) | ||
380 | #define LINE_PIN44 PAL_LINE(TEENSY_PIN44_IOPORT, TEENSY_PIN44) | ||
381 | #define LINE_PIN45 PAL_LINE(TEENSY_PIN45_IOPORT, TEENSY_PIN45) | ||
382 | #define LINE_PIN46 PAL_LINE(TEENSY_PIN46_IOPORT, TEENSY_PIN46) | ||
383 | #define LINE_PIN47 PAL_LINE(TEENSY_PIN47_IOPORT, TEENSY_PIN47) | ||
384 | #define LINE_PIN48 PAL_LINE(TEENSY_PIN48_IOPORT, TEENSY_PIN48) | ||
385 | #define LINE_PIN49 PAL_LINE(TEENSY_PIN49_IOPORT, TEENSY_PIN49) | ||
386 | #define LINE_PIN50 PAL_LINE(TEENSY_PIN50_IOPORT, TEENSY_PIN50) | ||
387 | #define LINE_PIN51 PAL_LINE(TEENSY_PIN51_IOPORT, TEENSY_PIN50) | ||
388 | #define LINE_PIN52 PAL_LINE(TEENSY_PIN52_IOPORT, TEENSY_PIN52) | ||
389 | #define LINE_PIN53 PAL_LINE(TEENSY_PIN53_IOPORT, TEENSY_PIN53) | ||
390 | #define LINE_PIN54 PAL_LINE(TEENSY_PIN54_IOPORT, TEENSY_PIN54) | ||
391 | |||
392 | #define LINE_LED LINE_PIN13 | ||
393 | |||
394 | #if !defined(_FROM_ASM_) | ||
395 | #ifdef __cplusplus | ||
396 | extern "C" { | ||
397 | #endif | ||
398 | void boardInit(void); | ||
399 | #ifdef __cplusplus | ||
400 | } | ||
401 | #endif | ||
402 | #endif /* _FROM_ASM_ */ | ||
403 | |||
404 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_4_1/board.mk b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_4_1/board.mk new file mode 100644 index 000000000..adfc7a34b --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_4_1/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_4_1/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_4_1 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_LC/board.c b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_LC/board.c new file mode 100644 index 000000000..93444daa3 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_LC/board.c | |||
@@ -0,0 +1,177 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2016 flabbergast <[email protected]> | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | /** | ||
21 | * @brief PAL setup. | ||
22 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
23 | * This variable is used by the HAL when initializing the PAL driver. | ||
24 | */ | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | .ports = { | ||
28 | { | ||
29 | /* | ||
30 | * PORTA setup. | ||
31 | * | ||
32 | * PTA1 - PIN3 | ||
33 | * PTA2 - PIN4 | ||
34 | * | ||
35 | * PTA18/19 crystal | ||
36 | * PTA0/3 SWD | ||
37 | */ | ||
38 | .port = IOPORT1, | ||
39 | .pads = { | ||
40 | PAL_MODE_ALTERNATIVE_7, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
41 | PAL_MODE_ALTERNATIVE_7, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
42 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
43 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
44 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
45 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
46 | PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_ANALOG, PAL_MODE_UNCONNECTED, | ||
47 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, 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, | ||
51 | }, | ||
52 | }, | ||
53 | { | ||
54 | /* | ||
55 | * PORTB setup. | ||
56 | * | ||
57 | * PTB0 - PIN16 | ||
58 | * PTB1 - PIN17 | ||
59 | * PTB2 - PIN19 | ||
60 | * PTB3 - PIN18 | ||
61 | * PTB16 - PIN0 - UART0_TX | ||
62 | * PTB17 - PIN1 - UART0_RX | ||
63 | */ | ||
64 | .port = IOPORT2, | ||
65 | .pads = { | ||
66 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
67 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
68 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
69 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
70 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
71 | PAL_MODE_UNCONNECTED, PAL_MODE_ALTERNATIVE_3, PAL_MODE_ALTERNATIVE_3, | ||
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_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
75 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
76 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
77 | }, | ||
78 | }, | ||
79 | { | ||
80 | /* | ||
81 | * PORTC setup. | ||
82 | * | ||
83 | * PTC0 - PIN15 | ||
84 | * PTC1 - PIN22 | ||
85 | * PTC2 - PIN23 | ||
86 | * PTC3 - PIN9 | ||
87 | * PTC4 - PIN10 | ||
88 | * PTC5 - PIN13 | ||
89 | * PTC6 - PIN11 | ||
90 | * PTC7 - PIN12 | ||
91 | */ | ||
92 | .port = IOPORT3, | ||
93 | .pads = { | ||
94 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
95 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
96 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, | ||
97 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
98 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
99 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
100 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
101 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
102 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
103 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
104 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
105 | }, | ||
106 | }, | ||
107 | { | ||
108 | /* | ||
109 | * PORTD setup. | ||
110 | * | ||
111 | * PTD0 - PIN2 | ||
112 | * PTD1 - PIN14 | ||
113 | * PTD2 - PIN7 | ||
114 | * PTD3 - PIN8 | ||
115 | * PTD4 - PIN6 | ||
116 | * PTD5 - PIN20 | ||
117 | * PTD6 - PIN21 | ||
118 | * PTD7 - PIN5 | ||
119 | */ | ||
120 | .port = IOPORT4, | ||
121 | .pads = { | ||
122 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
123 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, | ||
124 | PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, 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, PAL_MODE_UNCONNECTED, | ||
128 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
129 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
130 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
131 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
132 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
133 | }, | ||
134 | }, | ||
135 | { | ||
136 | /* | ||
137 | * PORTE setup. | ||
138 | * | ||
139 | * PTE20 - PIN24 | ||
140 | * PTE21 - PIN25 | ||
141 | * PTE30 - PIN26 | ||
142 | */ | ||
143 | .port = IOPORT5, | ||
144 | .pads = { | ||
145 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
146 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
147 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
148 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
149 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
150 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, | ||
151 | PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, | ||
152 | PAL_MODE_OUTPUT_PUSHPULL, 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_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, | ||
156 | }, | ||
157 | }, | ||
158 | }, | ||
159 | }; | ||
160 | #endif | ||
161 | |||
162 | /** | ||
163 | * @brief Early initialization code. | ||
164 | * @details This initialization must be performed just after stack setup | ||
165 | * and before any other initialization. | ||
166 | */ | ||
167 | void __early_init(void) { | ||
168 | |||
169 | kl2x_clock_init(); | ||
170 | } | ||
171 | |||
172 | /** | ||
173 | * @brief Board-specific initialization code. | ||
174 | * @todo Add your board-specific code, if any. | ||
175 | */ | ||
176 | void boardInit(void) { | ||
177 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_LC/board.h b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_LC/board.h new file mode 100644 index 000000000..6bfe094ce --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_LC/board.h | |||
@@ -0,0 +1,280 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2016 flabbergast <[email protected]> | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the PJRC Teensy LC board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_PJRC_TEENSY_LC | ||
28 | #define BOARD_NAME "PJRC Teensy LC" | ||
29 | |||
30 | /* External 16 MHz crystal */ | ||
31 | #define KINETIS_XTAL_FREQUENCY 16000000UL | ||
32 | |||
33 | /* Use internal capacitors for the crystal */ | ||
34 | #define KINETIS_BOARD_OSCILLATOR_SETTING OSC_CR_SC8P|OSC_CR_SC2P|OSC_CR_ERCLKEN | ||
35 | |||
36 | /* | ||
37 | * MCU type | ||
38 | */ | ||
39 | #define KL26 | ||
40 | |||
41 | /* | ||
42 | * IO pins assignments. | ||
43 | */ | ||
44 | #define PORTA_PIN0 0 | ||
45 | #define TEENSY_PIN3 1 | ||
46 | #define TEENSY_PIN4 2 | ||
47 | #define PORTA_PIN3 3 | ||
48 | #define PORTA_PIN4 4 | ||
49 | #define PORTA_PIN5 5 | ||
50 | #define PORTA_PIN6 6 | ||
51 | #define PORTA_PIN7 7 | ||
52 | #define PORTA_PIN8 8 | ||
53 | #define PORTA_PIN9 9 | ||
54 | #define PORTA_PIN10 10 | ||
55 | #define PORTA_PIN11 11 | ||
56 | #define PORTA_PIN12 12 | ||
57 | #define PORTA_PIN13 13 | ||
58 | #define PORTA_PIN14 14 | ||
59 | #define PORTA_PIN15 15 | ||
60 | #define PORTA_PIN16 16 | ||
61 | #define PORTA_PIN17 17 | ||
62 | #define PORTA_PIN18 18 | ||
63 | #define PORTA_PIN19 19 | ||
64 | #define PORTA_PIN20 20 | ||
65 | #define PORTA_PIN21 21 | ||
66 | #define PORTA_PIN22 22 | ||
67 | #define PORTA_PIN23 23 | ||
68 | #define PORTA_PIN24 24 | ||
69 | #define PORTA_PIN25 25 | ||
70 | #define PORTA_PIN26 26 | ||
71 | #define PORTA_PIN27 27 | ||
72 | #define PORTA_PIN28 28 | ||
73 | #define PORTA_PIN29 29 | ||
74 | #define PORTA_PIN30 30 | ||
75 | #define PORTA_PIN31 31 | ||
76 | |||
77 | #define TEENSY_PIN3_IOPORT IOPORT1 | ||
78 | #define TEENSY_PIN4_IOPORT IOPORT1 | ||
79 | |||
80 | #define TEENSY_PIN16 0 | ||
81 | #define TEENSY_PIN17 1 | ||
82 | #define TEENSY_PIN19 2 | ||
83 | #define TEENSY_PIN18 3 | ||
84 | #define PORTB_PIN4 4 | ||
85 | #define PORTB_PIN5 5 | ||
86 | #define PORTB_PIN6 6 | ||
87 | #define PORTB_PIN7 7 | ||
88 | #define PORTB_PIN8 8 | ||
89 | #define PORTB_PIN9 9 | ||
90 | #define PORTB_PIN10 10 | ||
91 | #define PORTB_PIN11 11 | ||
92 | #define PORTB_PIN12 12 | ||
93 | #define PORTB_PIN13 13 | ||
94 | #define PORTB_PIN14 14 | ||
95 | #define PORTB_PIN15 15 | ||
96 | #define TEENSY_PIN0 16 | ||
97 | #define TEENSY_PIN1 17 | ||
98 | #define PORTB_PIN18 18 | ||
99 | #define PORTB_PIN19 19 | ||
100 | #define PORTB_PIN20 20 | ||
101 | #define PORTB_PIN21 21 | ||
102 | #define PORTB_PIN22 22 | ||
103 | #define PORTB_PIN23 23 | ||
104 | #define PORTB_PIN24 24 | ||
105 | #define PORTB_PIN25 25 | ||
106 | #define PORTB_PIN26 26 | ||
107 | #define PORTB_PIN27 27 | ||
108 | #define PORTB_PIN28 28 | ||
109 | #define PORTB_PIN29 29 | ||
110 | #define PORTB_PIN30 30 | ||
111 | #define PORTB_PIN31 31 | ||
112 | |||
113 | #define TEENSY_PIN0_IOPORT IOPORT2 | ||
114 | #define TEENSY_PIN1_IOPORT IOPORT2 | ||
115 | #define TEENSY_PIN16_IOPORT IOPORT2 | ||
116 | #define TEENSY_PIN17_IOPORT IOPORT2 | ||
117 | #define TEENSY_PIN18_IOPORT IOPORT2 | ||
118 | #define TEENSY_PIN19_IOPORT IOPORT2 | ||
119 | |||
120 | #define TEENSY_PIN15 0 | ||
121 | #define TEENSY_PIN22 1 | ||
122 | #define TEENSY_PIN23 2 | ||
123 | #define TEENSY_PIN9 3 | ||
124 | #define TEENSY_PIN10 4 | ||
125 | #define TEENSY_PIN13 5 | ||
126 | #define TEENSY_PIN11 6 | ||
127 | #define TEENSY_PIN12 7 | ||
128 | #define PORTC_PIN8 8 | ||
129 | #define PORTC_PIN9 9 | ||
130 | #define PORTC_PIN10 10 | ||
131 | #define PORTC_PIN11 11 | ||
132 | #define PORTC_PIN12 12 | ||
133 | #define PORTC_PIN13 13 | ||
134 | #define PORTC_PIN14 14 | ||
135 | #define PORTC_PIN15 15 | ||
136 | #define PORTC_PIN16 16 | ||
137 | #define PORTC_PIN17 17 | ||
138 | #define PORTC_PIN18 18 | ||
139 | #define PORTC_PIN19 19 | ||
140 | #define PORTC_PIN20 20 | ||
141 | #define PORTC_PIN21 21 | ||
142 | #define PORTC_PIN22 22 | ||
143 | #define PORTC_PIN23 23 | ||
144 | #define PORTC_PIN24 24 | ||
145 | #define PORTC_PIN25 25 | ||
146 | #define PORTC_PIN26 26 | ||
147 | #define PORTC_PIN27 27 | ||
148 | #define PORTC_PIN28 28 | ||
149 | #define PORTC_PIN29 29 | ||
150 | #define PORTC_PIN30 30 | ||
151 | #define PORTC_PIN31 31 | ||
152 | |||
153 | #define TEENSY_PIN9_IOPORT IOPORT3 | ||
154 | #define TEENSY_PIN10_IOPORT IOPORT3 | ||
155 | #define TEENSY_PIN11_IOPORT IOPORT3 | ||
156 | #define TEENSY_PIN12_IOPORT IOPORT3 | ||
157 | #define TEENSY_PIN13_IOPORT IOPORT3 | ||
158 | #define TEENSY_PIN15_IOPORT IOPORT3 | ||
159 | #define TEENSY_PIN22_IOPORT IOPORT3 | ||
160 | #define TEENSY_PIN23_IOPORT IOPORT3 | ||
161 | |||
162 | #define TEENSY_PIN2 0 | ||
163 | #define TEENSY_PIN14 1 | ||
164 | #define TEENSY_PIN7 2 | ||
165 | #define TEENSY_PIN8 3 | ||
166 | #define TEENSY_PIN6 4 | ||
167 | #define TEENSY_PIN20 5 | ||
168 | #define TEENSY_PIN21 6 | ||
169 | #define TEENSY_PIN5 7 | ||
170 | #define PORTD_PIN8 8 | ||
171 | #define PORTD_PIN9 9 | ||
172 | #define PORTD_PIN10 10 | ||
173 | #define PORTD_PIN11 11 | ||
174 | #define PORTD_PIN12 12 | ||
175 | #define PORTD_PIN13 13 | ||
176 | #define PORTD_PIN14 14 | ||
177 | #define PORTD_PIN15 15 | ||
178 | #define PORTD_PIN16 16 | ||
179 | #define PORTD_PIN17 17 | ||
180 | #define PORTD_PIN18 18 | ||
181 | #define PORTD_PIN19 19 | ||
182 | #define PORTD_PIN20 20 | ||
183 | #define PORTD_PIN21 21 | ||
184 | #define PORTD_PIN22 22 | ||
185 | #define PORTD_PIN23 23 | ||
186 | #define PORTD_PIN24 24 | ||
187 | #define PORTD_PIN25 25 | ||
188 | #define PORTD_PIN26 26 | ||
189 | #define PORTD_PIN27 27 | ||
190 | #define PORTD_PIN28 28 | ||
191 | #define PORTD_PIN29 29 | ||
192 | #define PORTD_PIN30 30 | ||
193 | #define PORTD_PIN31 31 | ||
194 | |||
195 | #define TEENSY_PIN2_IOPORT IOPORT4 | ||
196 | #define TEENSY_PIN5_IOPORT IOPORT4 | ||
197 | #define TEENSY_PIN6_IOPORT IOPORT4 | ||
198 | #define TEENSY_PIN7_IOPORT IOPORT4 | ||
199 | #define TEENSY_PIN8_IOPORT IOPORT4 | ||
200 | #define TEENSY_PIN14_IOPORT IOPORT4 | ||
201 | #define TEENSY_PIN20_IOPORT IOPORT4 | ||
202 | #define TEENSY_PIN21_IOPORT IOPORT4 | ||
203 | |||
204 | #define PORTE_PIN0 0 | ||
205 | #define PORTE_PIN1 1 | ||
206 | #define PORTE_PIN2 2 | ||
207 | #define PORTE_PIN3 3 | ||
208 | #define PORTE_PIN4 4 | ||
209 | #define PORTE_PIN5 5 | ||
210 | #define PORTE_PIN6 6 | ||
211 | #define PORTE_PIN7 7 | ||
212 | #define PORTE_PIN8 8 | ||
213 | #define PORTE_PIN9 9 | ||
214 | #define PORTE_PIN10 10 | ||
215 | #define PORTE_PIN11 11 | ||
216 | #define PORTE_PIN12 12 | ||
217 | #define PORTE_PIN13 13 | ||
218 | #define PORTE_PIN14 14 | ||
219 | #define PORTE_PIN15 15 | ||
220 | #define PORTE_PIN16 16 | ||
221 | #define PORTE_PIN17 17 | ||
222 | #define PORTE_PIN18 18 | ||
223 | #define PORTE_PIN19 19 | ||
224 | #define TEENSY_PIN24 20 | ||
225 | #define TEENSY_PIN25 21 | ||
226 | #define PORTE_PIN22 22 | ||
227 | #define PORTE_PIN23 23 | ||
228 | #define PORTE_PIN24 24 | ||
229 | #define PORTE_PIN25 25 | ||
230 | #define PORTE_PIN26 26 | ||
231 | #define PORTE_PIN27 27 | ||
232 | #define PORTE_PIN28 28 | ||
233 | #define PORTE_PIN29 29 | ||
234 | #define TEENSY_PIN26 30 | ||
235 | #define PORTE_PIN31 31 | ||
236 | |||
237 | #define TEENSY_PIN24_IOPORT IOPORT5 | ||
238 | #define TEENSY_PIN25_IOPORT IOPORT5 | ||
239 | #define TEENSY_PIN26_IOPORT IOPORT5 | ||
240 | |||
241 | #define LINE_PIN0 PAL_LINE(TEENSY_PIN0_IOPORT, TEENSY_PIN0) | ||
242 | #define LINE_PIN1 PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1) | ||
243 | #define LINE_PIN2 PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2) | ||
244 | #define LINE_PIN3 PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3) | ||
245 | #define LINE_PIN4 PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4) | ||
246 | #define LINE_PIN5 PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5) | ||
247 | #define LINE_PIN6 PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6) | ||
248 | #define LINE_PIN7 PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7) | ||
249 | #define LINE_PIN8 PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8) | ||
250 | #define LINE_PIN9 PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9) | ||
251 | #define LINE_PIN10 PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10) | ||
252 | #define LINE_PIN11 PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11) | ||
253 | #define LINE_PIN12 PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12) | ||
254 | #define LINE_PIN13 PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13) | ||
255 | #define LINE_PIN14 PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14) | ||
256 | #define LINE_PIN15 PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15) | ||
257 | #define LINE_PIN16 PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16) | ||
258 | #define LINE_PIN17 PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17) | ||
259 | #define LINE_PIN18 PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18) | ||
260 | #define LINE_PIN19 PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19) | ||
261 | #define LINE_PIN20 PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20) | ||
262 | #define LINE_PIN21 PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21) | ||
263 | #define LINE_PIN22 PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22) | ||
264 | #define LINE_PIN23 PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23) | ||
265 | #define LINE_PIN24 PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24) | ||
266 | #define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) | ||
267 | |||
268 | #define LINE_LED LINE_PIN13 | ||
269 | |||
270 | #if !defined(_FROM_ASM_) | ||
271 | #ifdef __cplusplus | ||
272 | extern "C" { | ||
273 | #endif | ||
274 | void boardInit(void); | ||
275 | #ifdef __cplusplus | ||
276 | } | ||
277 | #endif | ||
278 | #endif /* _FROM_ASM_ */ | ||
279 | |||
280 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_LC/board.mk b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_LC/board.mk new file mode 100644 index 000000000..4d7d5a553 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/PJRC_TEENSY_LC/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_LC/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/PJRC_TEENSY_LC | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/SIPEED_LONGAN_NANO/board.c b/lib/chibios-contrib/os/hal/boards/SIPEED_LONGAN_NANO/board.c new file mode 100644 index 000000000..36a27cb58 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/SIPEED_LONGAN_NANO/board.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | ||
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 | |||
17 | #include "hal.h" | ||
18 | |||
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 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, | ||
28 | {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, | ||
29 | {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, | ||
30 | {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, | ||
31 | }; | ||
32 | #endif | ||
33 | |||
34 | /* | ||
35 | * Early initialization code. | ||
36 | * This initialization must be performed just after stack setup and before | ||
37 | * any other initialization. | ||
38 | */ | ||
39 | void __early_init(void) { | ||
40 | gd32_clock_init(); | ||
41 | } | ||
42 | |||
43 | /* | ||
44 | * Board-specific initialization code. | ||
45 | */ | ||
46 | void boardInit(void) { | ||
47 | /* Free B4 pin by disabling JTAG NJTRST. */ | ||
48 | AFIO->PCF0 |= AFIO_PCF0_SWJ_CFG_NOJNTRST; | ||
49 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/SIPEED_LONGAN_NANO/board.h b/lib/chibios-contrib/os/hal/boards/SIPEED_LONGAN_NANO/board.h new file mode 100644 index 000000000..5ce1b8716 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/SIPEED_LONGAN_NANO/board.h | |||
@@ -0,0 +1,140 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for a Generic GD32VF103 board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_GD32VF103 | ||
28 | #define BOARD_NAME "Sipeed Longan Nano GD32VF103CBT6" | ||
29 | #define BOARD_USBFS_NOVBUSSENS | ||
30 | |||
31 | /* | ||
32 | * Board frequencies. | ||
33 | */ | ||
34 | #define GD32_LXTALCLK 32768 | ||
35 | #define GD32_HXTALCLK 8000000 | ||
36 | |||
37 | /* | ||
38 | * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. | ||
39 | */ | ||
40 | #define GD32VF103CB | ||
41 | |||
42 | /* | ||
43 | * IO pins assignments | ||
44 | */ | ||
45 | #define PIN_GREEN_LED 1 | ||
46 | #define PIN_BLUE_LED 2 | ||
47 | #define PIN_RED_LED 13 | ||
48 | |||
49 | #define PIN_DISPLAY_MISO 6 | ||
50 | #define PIN_DISPLAY_MOSI 7 | ||
51 | #define PIN_DISPLAY_SCK 5 | ||
52 | #define PIN_DISPLAY_CS 2 | ||
53 | #define PIN_DISPLAY_DC 0 | ||
54 | #define PIN_DISPLAY_RST 1 | ||
55 | |||
56 | #define LINE_GREEN_LED PAL_LINE(GPIOA, PIN_GREEN_LED) | ||
57 | #define LINE_BLUE_LED PAL_LINE(GPIOA, PIN_BLUE_LED) | ||
58 | #define LINE_RED_LED PAL_LINE(GPIOC, PIN_RED_LED) | ||
59 | |||
60 | #define LINE_DISPLAY_MISO PAL_LINE(GPIOA, PIN_DISPLAY_MISO) | ||
61 | #define LINE_DISPLAY_MOSI PAL_LINE(GPIOA, PIN_DISPLAY_MOSI) | ||
62 | #define LINE_DISPLAY_SCK PAL_LINE(GPIOA, PIN_DISPLAY_SCK) | ||
63 | #define LINE_DISPLAY_CS PAL_LINE(GPIOB, PIN_DISPLAY_CS) | ||
64 | #define LINE_DISPLAY_DC PAL_LINE(GPIOB, PIN_DISPLAY_DC) | ||
65 | #define LINE_DISPLAY_RST PAL_LINE(GPIOB, PIN_DISPLAY_RST) | ||
66 | /* | ||
67 | * I/O ports initial setup, this configuration is established soon after reset | ||
68 | * in the initialization code. | ||
69 | * | ||
70 | * The digits have the following meaning: | ||
71 | * 0 - Analog input. | ||
72 | * 1 - Push Pull output 10MHz. | ||
73 | * 2 - Push Pull output 2MHz. | ||
74 | * 3 - Push Pull output 50MHz. | ||
75 | * 4 - Digital input. | ||
76 | * 5 - Open Drain output 10MHz. | ||
77 | * 6 - Open Drain output 2MHz. | ||
78 | * 7 - Open Drain output 50MHz. | ||
79 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. | ||
80 | * 9 - Alternate Push Pull output 10MHz. | ||
81 | * A - Alternate Push Pull output 2MHz. | ||
82 | * B - Alternate Push Pull output 50MHz. | ||
83 | * C - Reserved. | ||
84 | * D - Alternate Open Drain output 10MHz. | ||
85 | * E - Alternate Open Drain output 2MHz. | ||
86 | * F - Alternate Open Drain output 50MHz. | ||
87 | * Please refer to the STM32 Reference Manual for details. | ||
88 | */ | ||
89 | |||
90 | /* | ||
91 | * Port A setup. | ||
92 | * Everything input with pull-up except: | ||
93 | * A1 - Green LED - Push Pull output 50MHz | ||
94 | * A2 - Blue LED - Push Pull output 50MHz | ||
95 | * A5 - Display SCK - Alternate Push Pull output 50MHz. | ||
96 | * A7 - Display MOSI - Alternate Push Pull output 50MHz. | ||
97 | */ | ||
98 | #define VAL_GPIOACRL 0xB8B88338 /* PA7...PA0 */ | ||
99 | #define VAL_GPIOACRH 0x88888888 /* PA15...PA8 */ | ||
100 | #define VAL_GPIOAODR 0xFFFFFFFF | ||
101 | |||
102 | /* | ||
103 | * Port B setup. | ||
104 | * Everything input with pull-up except: | ||
105 | * B0 - Display DC - Push Pull output 50Mhz. | ||
106 | * B1 - Display RST - Push Pull output 50Mhz. | ||
107 | * B2 - Display CS - Push Pull output 50Mhz. | ||
108 | */ | ||
109 | #define VAL_GPIOBCRL 0x88888333 /* PB7...PB0 */ | ||
110 | #define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */ | ||
111 | #define VAL_GPIOBODR 0xFFFFFFFF | ||
112 | |||
113 | /* | ||
114 | * Port C setup. | ||
115 | * Everything input with pull-up except: | ||
116 | * C13 - RED LED - Push Pull output 50MHz | ||
117 | */ | ||
118 | #define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ | ||
119 | #define VAL_GPIOCCRH 0x88388888 /* PC15...PC8 */ | ||
120 | #define VAL_GPIOCODR 0xFFFFFFFF | ||
121 | |||
122 | /* | ||
123 | * Port D setup. | ||
124 | * Everything input with pull-up except: | ||
125 | */ | ||
126 | #define VAL_GPIODCRL 0x88888888 /* PD7...PD0 */ | ||
127 | #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ | ||
128 | #define VAL_GPIODODR 0xFFFFFFFF | ||
129 | |||
130 | #if !defined(_FROM_ASM_) | ||
131 | #ifdef __cplusplus | ||
132 | extern "C" { | ||
133 | #endif | ||
134 | void boardInit(void); | ||
135 | #ifdef __cplusplus | ||
136 | } | ||
137 | #endif | ||
138 | #endif /* _FROM_ASM_ */ | ||
139 | |||
140 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/SIPEED_LONGAN_NANO/board.mk b/lib/chibios-contrib/os/hal/boards/SIPEED_LONGAN_NANO/board.mk new file mode 100644 index 000000000..960fc2678 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/SIPEED_LONGAN_NANO/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/SIPEED_LONGAN_NANO/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/SIPEED_LONGAN_NANO | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/ST_STM32F0308_DISCOVERY/board.c b/lib/chibios-contrib/os/hal/boards/ST_STM32F0308_DISCOVERY/board.c new file mode 100644 index 000000000..266465a22 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/ST_STM32F0308_DISCOVERY/board.c | |||
@@ -0,0 +1,246 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
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 | |||
17 | /* | ||
18 | * This file has been automatically generated using ChibiStudio board | ||
19 | * generator plugin. Do not edit manually. | ||
20 | */ | ||
21 | |||
22 | #include "hal.h" | ||
23 | #include "stm32_gpio.h" | ||
24 | |||
25 | /*===========================================================================*/ | ||
26 | /* Driver local definitions. */ | ||
27 | /*===========================================================================*/ | ||
28 | |||
29 | /*===========================================================================*/ | ||
30 | /* Driver exported variables. */ | ||
31 | /*===========================================================================*/ | ||
32 | |||
33 | /*===========================================================================*/ | ||
34 | /* Driver local variables and types. */ | ||
35 | /*===========================================================================*/ | ||
36 | |||
37 | /** | ||
38 | * @brief Type of STM32 GPIO port setup. | ||
39 | */ | ||
40 | typedef struct { | ||
41 | uint32_t moder; | ||
42 | uint32_t otyper; | ||
43 | uint32_t ospeedr; | ||
44 | uint32_t pupdr; | ||
45 | uint32_t odr; | ||
46 | uint32_t afrl; | ||
47 | uint32_t afrh; | ||
48 | } gpio_setup_t; | ||
49 | |||
50 | /** | ||
51 | * @brief Type of STM32 GPIO initialization data. | ||
52 | */ | ||
53 | typedef struct { | ||
54 | #if STM32_HAS_GPIOA || defined(__DOXYGEN__) | ||
55 | gpio_setup_t PAData; | ||
56 | #endif | ||
57 | #if STM32_HAS_GPIOB || defined(__DOXYGEN__) | ||
58 | gpio_setup_t PBData; | ||
59 | #endif | ||
60 | #if STM32_HAS_GPIOC || defined(__DOXYGEN__) | ||
61 | gpio_setup_t PCData; | ||
62 | #endif | ||
63 | #if STM32_HAS_GPIOD || defined(__DOXYGEN__) | ||
64 | gpio_setup_t PDData; | ||
65 | #endif | ||
66 | #if STM32_HAS_GPIOE || defined(__DOXYGEN__) | ||
67 | gpio_setup_t PEData; | ||
68 | #endif | ||
69 | #if STM32_HAS_GPIOF || defined(__DOXYGEN__) | ||
70 | gpio_setup_t PFData; | ||
71 | #endif | ||
72 | #if STM32_HAS_GPIOG || defined(__DOXYGEN__) | ||
73 | gpio_setup_t PGData; | ||
74 | #endif | ||
75 | #if STM32_HAS_GPIOH || defined(__DOXYGEN__) | ||
76 | gpio_setup_t PHData; | ||
77 | #endif | ||
78 | #if STM32_HAS_GPIOI || defined(__DOXYGEN__) | ||
79 | gpio_setup_t PIData; | ||
80 | #endif | ||
81 | } gpio_config_t; | ||
82 | |||
83 | /** | ||
84 | * @brief STM32 GPIO static initialization data. | ||
85 | */ | ||
86 | static const gpio_config_t gpio_default_config = { | ||
87 | #if STM32_HAS_GPIOA | ||
88 | {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, | ||
89 | VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, | ||
90 | #endif | ||
91 | #if STM32_HAS_GPIOB | ||
92 | {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, | ||
93 | VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, | ||
94 | #endif | ||
95 | #if STM32_HAS_GPIOC | ||
96 | {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, | ||
97 | VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, | ||
98 | #endif | ||
99 | #if STM32_HAS_GPIOD | ||
100 | {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, | ||
101 | VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, | ||
102 | #endif | ||
103 | #if STM32_HAS_GPIOE | ||
104 | {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, | ||
105 | VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, | ||
106 | #endif | ||
107 | #if STM32_HAS_GPIOF | ||
108 | {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, | ||
109 | VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, | ||
110 | #endif | ||
111 | #if STM32_HAS_GPIOG | ||
112 | {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, | ||
113 | VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, | ||
114 | #endif | ||
115 | #if STM32_HAS_GPIOH | ||
116 | {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, | ||
117 | VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, | ||
118 | #endif | ||
119 | #if STM32_HAS_GPIOI | ||
120 | {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, | ||
121 | VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}, | ||
122 | #endif | ||
123 | }; | ||
124 | |||
125 | /*===========================================================================*/ | ||
126 | /* Driver local functions. */ | ||
127 | /*===========================================================================*/ | ||
128 | |||
129 | static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) { | ||
130 | |||
131 | gpiop->OTYPER = config->otyper; | ||
132 | gpiop->OSPEEDR = config->ospeedr; | ||
133 | gpiop->PUPDR = config->pupdr; | ||
134 | gpiop->ODR = config->odr; | ||
135 | gpiop->AFRL = config->afrl; | ||
136 | gpiop->AFRH = config->afrh; | ||
137 | gpiop->MODER = config->moder; | ||
138 | } | ||
139 | |||
140 | static void stm32_gpio_init(void) { | ||
141 | |||
142 | /* Enabling GPIO-related clocks, the mask comes from the | ||
143 | registry header file.*/ | ||
144 | rccResetAHB(STM32_GPIO_EN_MASK); | ||
145 | rccEnableAHB(STM32_GPIO_EN_MASK, true); | ||
146 | |||
147 | /* Initializing all the defined GPIO ports.*/ | ||
148 | #if STM32_HAS_GPIOA | ||
149 | gpio_init(GPIOA, &gpio_default_config.PAData); | ||
150 | #endif | ||
151 | #if STM32_HAS_GPIOB | ||
152 | gpio_init(GPIOB, &gpio_default_config.PBData); | ||
153 | #endif | ||
154 | #if STM32_HAS_GPIOC | ||
155 | gpio_init(GPIOC, &gpio_default_config.PCData); | ||
156 | #endif | ||
157 | #if STM32_HAS_GPIOD | ||
158 | gpio_init(GPIOD, &gpio_default_config.PDData); | ||
159 | #endif | ||
160 | #if STM32_HAS_GPIOE | ||
161 | gpio_init(GPIOE, &gpio_default_config.PEData); | ||
162 | #endif | ||
163 | #if STM32_HAS_GPIOF | ||
164 | gpio_init(GPIOF, &gpio_default_config.PFData); | ||
165 | #endif | ||
166 | #if STM32_HAS_GPIOG | ||
167 | gpio_init(GPIOG, &gpio_default_config.PGData); | ||
168 | #endif | ||
169 | #if STM32_HAS_GPIOH | ||
170 | gpio_init(GPIOH, &gpio_default_config.PHData); | ||
171 | #endif | ||
172 | #if STM32_HAS_GPIOI | ||
173 | gpio_init(GPIOI, &gpio_default_config.PIData); | ||
174 | #endif | ||
175 | } | ||
176 | |||
177 | /*===========================================================================*/ | ||
178 | /* Driver interrupt handlers. */ | ||
179 | /*===========================================================================*/ | ||
180 | |||
181 | /*===========================================================================*/ | ||
182 | /* Driver exported functions. */ | ||
183 | /*===========================================================================*/ | ||
184 | |||
185 | /** | ||
186 | * @brief Early initialization code. | ||
187 | * @details GPIO ports and system clocks are initialized before everything | ||
188 | * else. | ||
189 | */ | ||
190 | void __early_init(void) { | ||
191 | |||
192 | stm32_gpio_init(); | ||
193 | stm32_clock_init(); | ||
194 | } | ||
195 | |||
196 | #if HAL_USE_SDC || defined(__DOXYGEN__) | ||
197 | /** | ||
198 | * @brief SDC card detection. | ||
199 | */ | ||
200 | bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { | ||
201 | |||
202 | (void)sdcp; | ||
203 | /* TODO: Fill the implementation.*/ | ||
204 | return true; | ||
205 | } | ||
206 | |||
207 | /** | ||
208 | * @brief SDC card write protection detection. | ||
209 | */ | ||
210 | bool sdc_lld_is_write_protected(SDCDriver *sdcp) { | ||
211 | |||
212 | (void)sdcp; | ||
213 | /* TODO: Fill the implementation.*/ | ||
214 | return false; | ||
215 | } | ||
216 | #endif /* HAL_USE_SDC */ | ||
217 | |||
218 | #if HAL_USE_MMC_SPI || defined(__DOXYGEN__) | ||
219 | /** | ||
220 | * @brief MMC_SPI card detection. | ||
221 | */ | ||
222 | bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { | ||
223 | |||
224 | (void)mmcp; | ||
225 | /* TODO: Fill the implementation.*/ | ||
226 | return true; | ||
227 | } | ||
228 | |||
229 | /** | ||
230 | * @brief MMC_SPI card write protection detection. | ||
231 | */ | ||
232 | bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | ||
233 | |||
234 | (void)mmcp; | ||
235 | /* TODO: Fill the implementation.*/ | ||
236 | return false; | ||
237 | } | ||
238 | #endif | ||
239 | |||
240 | /** | ||
241 | * @brief Board-specific initialization code. | ||
242 | * @todo Add your board-specific code, if any. | ||
243 | */ | ||
244 | void boardInit(void) { | ||
245 | |||
246 | } | ||
diff --git a/lib/chibios-contrib/os/hal/boards/ST_STM32F0308_DISCOVERY/board.h b/lib/chibios-contrib/os/hal/boards/ST_STM32F0308_DISCOVERY/board.h new file mode 100644 index 000000000..34eba1739 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/ST_STM32F0308_DISCOVERY/board.h | |||
@@ -0,0 +1,757 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006-2014 Giovanni Di Sirio | ||
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 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for ST STM32F0-Discovery board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_ST_STM32F0308_DISCOVERY | ||
28 | #define BOARD_NAME "ST STM32F0308-Discovery" | ||
29 | |||
30 | /* | ||
31 | * Board oscillators-related settings. | ||
32 | * NOTE: LSE not fitted. | ||
33 | * NOTE: HSE not fitted. | ||
34 | */ | ||
35 | #if !defined(STM32_LSECLK) | ||
36 | #define STM32_LSECLK 0 | ||
37 | #endif | ||
38 | |||
39 | #define STM32_LSEDRV (3 << 3) | ||
40 | |||
41 | #if !defined(STM32_HSECLK) | ||
42 | #define STM32_HSECLK 0 | ||
43 | #endif | ||
44 | |||
45 | #define STM32_HSE_BYPASS | ||
46 | |||
47 | /* | ||
48 | * MCU type as defined in the ST header. | ||
49 | */ | ||
50 | #define STM32F030x8 | ||
51 | |||
52 | /* | ||
53 | * IO pins assignments. | ||
54 | */ | ||
55 | #define GPIOA_BUTTON 0 | ||
56 | #define GPIOA_PIN1 1 | ||
57 | #define GPIOA_PIN2 2 | ||
58 | #define GPIOA_PIN3 3 | ||
59 | #define GPIOA_PIN4 4 | ||
60 | #define GPIOA_PIN5 5 | ||
61 | #define GPIOA_PIN6 6 | ||
62 | #define GPIOA_PIN7 7 | ||
63 | #define GPIOA_PIN8 8 | ||
64 | #define GPIOA_PIN9 9 | ||
65 | #define GPIOA_PIN10 10 | ||
66 | #define GPIOA_PIN11 11 | ||
67 | #define GPIOA_PIN12 12 | ||
68 | #define GPIOA_SWDAT 13 | ||
69 | #define GPIOA_SWCLK 14 | ||
70 | #define GPIOA_PIN15 15 | ||
71 | |||
72 | #define GPIOB_PIN0 0 | ||
73 | #define GPIOB_PIN1 1 | ||
74 | #define GPIOB_PIN2 2 | ||
75 | #define GPIOB_PIN3 3 | ||
76 | #define GPIOB_PIN4 4 | ||
77 | #define GPIOB_PIN5 5 | ||
78 | #define GPIOB_PIN6 6 | ||
79 | #define GPIOB_PIN7 7 | ||
80 | #define GPIOB_PIN8 8 | ||
81 | #define GPIOB_PIN9 9 | ||
82 | #define GPIOB_PIN10 10 | ||
83 | #define GPIOB_PIN11 11 | ||
84 | #define GPIOB_PIN12 12 | ||
85 | #define GPIOB_PIN13 13 | ||
86 | #define GPIOB_PIN14 14 | ||
87 | #define GPIOB_PIN15 15 | ||
88 | |||
89 | #define GPIOC_PIN0 0 | ||
90 | #define GPIOC_PIN1 1 | ||
91 | #define GPIOC_PIN2 2 | ||
92 | #define GPIOC_PIN3 3 | ||
93 | #define GPIOC_PIN4 4 | ||
94 | #define GPIOC_PIN5 5 | ||
95 | #define GPIOC_PIN6 6 | ||
96 | #define GPIOC_PIN7 7 | ||
97 | #define GPIOC_LED4 8 | ||
98 | #define GPIOC_LED3 9 | ||
99 | #define GPIOC_PIN10 10 | ||
100 | #define GPIOC_PIN11 11 | ||
101 | #define GPIOC_PIN12 12 | ||
102 | #define GPIOC_PIN13 13 | ||
103 | #define GPIOC_OSC32_IN 14 | ||
104 | #define GPIOC_OSC32_OUT 15 | ||
105 | |||
106 | #define GPIOD_PIN0 0 | ||
107 | #define GPIOD_PIN1 1 | ||
108 | #define GPIOD_PIN2 2 | ||
109 | #define GPIOD_PIN3 3 | ||
110 | #define GPIOD_PIN4 4 | ||
111 | #define GPIOD_PIN5 5 | ||
112 | #define GPIOD_PIN6 6 | ||
113 | #define GPIOD_PIN7 7 | ||
114 | #define GPIOD_PIN8 8 | ||
115 | #define GPIOD_PIN9 9 | ||
116 | #define GPIOD_PIN10 10 | ||
117 | #define GPIOD_PIN11 11 | ||
118 | #define GPIOD_PIN12 12 | ||
119 | #define GPIOD_PIN13 13 | ||
120 | #define GPIOD_PIN14 14 | ||
121 | #define GPIOD_PIN15 15 | ||
122 | |||
123 | #define GPIOF_OSC_IN 0 | ||
124 | #define GPIOF_OSC_OUT 1 | ||
125 | #define GPIOF_PIN2 2 | ||
126 | #define GPIOF_PIN3 3 | ||
127 | #define GPIOF_PIN4 4 | ||
128 | #define GPIOF_PIN5 5 | ||
129 | #define GPIOF_PIN6 6 | ||
130 | #define GPIOF_PIN7 7 | ||
131 | #define GPIOF_PIN8 8 | ||
132 | #define GPIOF_PIN9 9 | ||
133 | #define GPIOF_PIN10 10 | ||
134 | #define GPIOF_PIN11 11 | ||
135 | #define GPIOF_PIN12 12 | ||
136 | #define GPIOF_PIN13 13 | ||
137 | #define GPIOF_PIN14 14 | ||
138 | #define GPIOF_PIN15 15 | ||
139 | |||
140 | /* | ||
141 | * I/O ports initial setup, this configuration is established soon after reset | ||
142 | * in the initialization code. | ||
143 | * Please refer to the STM32 Reference Manual for details. | ||
144 | */ | ||
145 | #define PIN_MODE_INPUT(n) (0U << ((n) * 2)) | ||
146 | #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2)) | ||
147 | #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2)) | ||
148 | #define PIN_MODE_ANALOG(n) (3U << ((n) * 2)) | ||
149 | #define PIN_ODR_LOW(n) (0U << (n)) | ||
150 | #define PIN_ODR_HIGH(n) (1U << (n)) | ||
151 | #define PIN_OTYPE_PUSHPULL(n) (0U << (n)) | ||
152 | #define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) | ||
153 | #define PIN_OSPEED_2M(n) (0U << ((n) * 2)) | ||
154 | #define PIN_OSPEED_10M(n) (1U << ((n) * 2)) | ||
155 | #define PIN_OSPEED_40M(n) (3U << ((n) * 2)) | ||
156 | #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2)) | ||
157 | #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2)) | ||
158 | #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2)) | ||
159 | #define PIN_AFIO_AF(n, v) ((v##U) << ((n % 8) * 4)) | ||
160 | |||
161 | /* | ||
162 | * GPIOA setup: | ||
163 | * | ||
164 | * PA0 - BUTTON (input floating). | ||
165 | * PA1 - PIN1 (input pullup). | ||
166 | * PA2 - PIN2 (input pullup). | ||
167 | * PA3 - PIN3 (input pullup). | ||
168 | * PA4 - PIN4 (input pullup). | ||
169 | * PA5 - PIN5 (input pullup). | ||
170 | * PA6 - PIN6 (input pullup). | ||
171 | * PA7 - PIN7 (input pullup). | ||
172 | * PA8 - PIN8 (input pullup). | ||
173 | * PA9 - PIN9 (input pullup). | ||
174 | * PA10 - PIN10 (input pullup). | ||
175 | * PA11 - PIN11 (input pullup). | ||
176 | * PA12 - PIN12 (input pullup). | ||
177 | * PA13 - SWDAT (alternate 0). | ||
178 | * PA14 - SWCLK (alternate 0). | ||
179 | * PA15 - PIN15 (input pullup). | ||
180 | */ | ||
181 | #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON) | \ | ||
182 | PIN_MODE_INPUT(GPIOA_PIN1) | \ | ||
183 | PIN_MODE_INPUT(GPIOA_PIN2) | \ | ||
184 | PIN_MODE_INPUT(GPIOA_PIN3) | \ | ||
185 | PIN_MODE_INPUT(GPIOA_PIN4) | \ | ||
186 | PIN_MODE_INPUT(GPIOA_PIN5) | \ | ||
187 | PIN_MODE_INPUT(GPIOA_PIN6) | \ | ||
188 | PIN_MODE_INPUT(GPIOA_PIN7) | \ | ||
189 | PIN_MODE_INPUT(GPIOA_PIN8) | \ | ||
190 | PIN_MODE_INPUT(GPIOA_PIN9) | \ | ||
191 | PIN_MODE_INPUT(GPIOA_PIN10) | \ | ||
192 | PIN_MODE_INPUT(GPIOA_PIN11) | \ | ||
193 | PIN_MODE_INPUT(GPIOA_PIN12) | \ | ||
194 | PIN_MODE_ALTERNATE(GPIOA_SWDAT) | \ | ||
195 | PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \ | ||
196 | PIN_MODE_INPUT(GPIOA_PIN15)) | ||
197 | #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON) | \ | ||
198 | PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \ | ||
199 | PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \ | ||
200 | PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \ | ||
201 | PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \ | ||
202 | PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \ | ||
203 | PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \ | ||
204 | PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \ | ||
205 | PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \ | ||
206 | PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \ | ||
207 | PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \ | ||
208 | PIN_OTYPE_PUSHPULL(GPIOA_PIN11) | \ | ||
209 | PIN_OTYPE_PUSHPULL(GPIOA_PIN12) | \ | ||
210 | PIN_OTYPE_PUSHPULL(GPIOA_SWDAT) | \ | ||
211 | PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \ | ||
212 | PIN_OTYPE_PUSHPULL(GPIOA_PIN15)) | ||
213 | #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_2M(GPIOA_BUTTON) | \ | ||
214 | PIN_OSPEED_2M(GPIOA_PIN1) | \ | ||
215 | PIN_OSPEED_2M(GPIOA_PIN2) | \ | ||
216 | PIN_OSPEED_2M(GPIOA_PIN3) | \ | ||
217 | PIN_OSPEED_2M(GPIOA_PIN4) | \ | ||
218 | PIN_OSPEED_2M(GPIOA_PIN5) | \ | ||
219 | PIN_OSPEED_2M(GPIOA_PIN6) | \ | ||
220 | PIN_OSPEED_2M(GPIOA_PIN7) | \ | ||
221 | PIN_OSPEED_2M(GPIOA_PIN8) | \ | ||
222 | PIN_OSPEED_2M(GPIOA_PIN9) | \ | ||
223 | PIN_OSPEED_2M(GPIOA_PIN10) | \ | ||
224 | PIN_OSPEED_2M(GPIOA_PIN11) | \ | ||
225 | PIN_OSPEED_2M(GPIOA_PIN12) | \ | ||
226 | PIN_OSPEED_40M(GPIOA_SWDAT) | \ | ||
227 | PIN_OSPEED_40M(GPIOA_SWCLK) | \ | ||
228 | PIN_OSPEED_40M(GPIOA_PIN15)) | ||
229 | #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_BUTTON) | \ | ||
230 | PIN_PUPDR_PULLUP(GPIOA_PIN1) | \ | ||
231 | PIN_PUPDR_PULLUP(GPIOA_PIN2) | \ | ||
232 | PIN_PUPDR_PULLUP(GPIOA_PIN3) | \ | ||
233 | PIN_PUPDR_PULLUP(GPIOA_PIN4) | \ | ||
234 | PIN_PUPDR_PULLUP(GPIOA_PIN5) | \ | ||
235 | PIN_PUPDR_PULLUP(GPIOA_PIN6) | \ | ||
236 | PIN_PUPDR_PULLUP(GPIOA_PIN7) | \ | ||
237 | PIN_PUPDR_PULLUP(GPIOA_PIN8) | \ | ||
238 | PIN_PUPDR_PULLUP(GPIOA_PIN9) | \ | ||
239 | PIN_PUPDR_PULLUP(GPIOA_PIN10) | \ | ||
240 | PIN_PUPDR_PULLUP(GPIOA_PIN11) | \ | ||
241 | PIN_PUPDR_PULLUP(GPIOA_PIN12) | \ | ||
242 | PIN_PUPDR_PULLUP(GPIOA_SWDAT) | \ | ||
243 | PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \ | ||
244 | PIN_PUPDR_PULLUP(GPIOA_PIN15)) | ||
245 | #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_BUTTON) | \ | ||
246 | PIN_ODR_HIGH(GPIOA_PIN1) | \ | ||
247 | PIN_ODR_HIGH(GPIOA_PIN2) | \ | ||
248 | PIN_ODR_HIGH(GPIOA_PIN3) | \ | ||
249 | PIN_ODR_HIGH(GPIOA_PIN4) | \ | ||
250 | PIN_ODR_HIGH(GPIOA_PIN5) | \ | ||
251 | PIN_ODR_HIGH(GPIOA_PIN6) | \ | ||
252 | PIN_ODR_HIGH(GPIOA_PIN7) | \ | ||
253 | PIN_ODR_HIGH(GPIOA_PIN8) | \ | ||
254 | PIN_ODR_HIGH(GPIOA_PIN9) | \ | ||
255 | PIN_ODR_HIGH(GPIOA_PIN10) | \ | ||
256 | PIN_ODR_HIGH(GPIOA_PIN11) | \ | ||
257 | PIN_ODR_HIGH(GPIOA_PIN12) | \ | ||
258 | PIN_ODR_HIGH(GPIOA_SWDAT) | \ | ||
259 | PIN_ODR_HIGH(GPIOA_SWCLK) | \ | ||
260 | PIN_ODR_HIGH(GPIOA_PIN15)) | ||
261 | #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_BUTTON, 0) | \ | ||
262 | PIN_AFIO_AF(GPIOA_PIN1, 0) | \ | ||
263 | PIN_AFIO_AF(GPIOA_PIN2, 0) | \ | ||
264 | PIN_AFIO_AF(GPIOA_PIN3, 0) | \ | ||
265 | PIN_AFIO_AF(GPIOA_PIN4, 0) | \ | ||
266 | PIN_AFIO_AF(GPIOA_PIN5, 0) | \ | ||
267 | PIN_AFIO_AF(GPIOA_PIN6, 0) | \ | ||
268 | PIN_AFIO_AF(GPIOA_PIN7, 0)) | ||
269 | #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0) | \ | ||
270 | PIN_AFIO_AF(GPIOA_PIN9, 0) | \ | ||
271 | PIN_AFIO_AF(GPIOA_PIN10, 0) | \ | ||
272 | PIN_AFIO_AF(GPIOA_PIN11, 0) | \ | ||
273 | PIN_AFIO_AF(GPIOA_PIN12, 0) | \ | ||
274 | PIN_AFIO_AF(GPIOA_SWDAT, 0) | \ | ||
275 | PIN_AFIO_AF(GPIOA_SWCLK, 0) | \ | ||
276 | PIN_AFIO_AF(GPIOA_PIN15, 0)) | ||
277 | |||
278 | /* | ||
279 | * GPIOB setup: | ||
280 | * | ||
281 | * PB0 - PIN0 (input pullup). | ||
282 | * PB1 - PIN1 (input pullup). | ||
283 | * PB2 - PIN2 (input pullup). | ||
284 | * PB3 - PIN3 (input pullup). | ||
285 | * PB4 - PIN4 (input pullup). | ||
286 | * PB5 - PIN5 (input pullup). | ||
287 | * PB6 - PIN6 (input pullup). | ||
288 | * PB7 - PIN7 (input pullup). | ||
289 | * PB8 - PIN8 (input pullup). | ||
290 | * PB9 - PIN9 (input pullup). | ||
291 | * PB10 - PIN10 (input pullup). | ||
292 | * PB11 - PIN11 (input pullup). | ||
293 | * PB12 - PIN12 (input pullup). | ||
294 | * PB13 - PIN13 (input pullup). | ||
295 | * PB14 - PIN14 (input pullup). | ||
296 | * PB15 - PIN15 (input pullup). | ||
297 | */ | ||
298 | #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \ | ||
299 | PIN_MODE_INPUT(GPIOB_PIN1) | \ | ||
300 | PIN_MODE_INPUT(GPIOB_PIN2) | \ | ||
301 | PIN_MODE_INPUT(GPIOB_PIN3) | \ | ||
302 | PIN_MODE_INPUT(GPIOB_PIN4) | \ | ||
303 | PIN_MODE_INPUT(GPIOB_PIN5) | \ | ||
304 | PIN_MODE_INPUT(GPIOB_PIN6) | \ | ||
305 | PIN_MODE_INPUT(GPIOB_PIN7) | \ | ||
306 | PIN_MODE_INPUT(GPIOB_PIN8) | \ | ||
307 | PIN_MODE_INPUT(GPIOB_PIN9) | \ | ||
308 | PIN_MODE_INPUT(GPIOB_PIN10) | \ | ||
309 | PIN_MODE_INPUT(GPIOB_PIN11) | \ | ||
310 | PIN_MODE_INPUT(GPIOB_PIN12) | \ | ||
311 | PIN_MODE_INPUT(GPIOB_PIN13) | \ | ||
312 | PIN_MODE_INPUT(GPIOB_PIN14) | \ | ||
313 | PIN_MODE_INPUT(GPIOB_PIN15)) | ||
314 | #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \ | ||
315 | PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \ | ||
316 | PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \ | ||
317 | PIN_OTYPE_PUSHPULL(GPIOB_PIN3) | \ | ||
318 | PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \ | ||
319 | PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \ | ||
320 | PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | \ | ||
321 | PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \ | ||
322 | PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \ | ||
323 | PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \ | ||
324 | PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \ | ||
325 | PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \ | ||
326 | PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \ | ||
327 | PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \ | ||
328 | PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \ | ||
329 | PIN_OTYPE_PUSHPULL(GPIOB_PIN15)) | ||
330 | #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_2M(GPIOB_PIN0) | \ | ||
331 | PIN_OSPEED_2M(GPIOB_PIN1) | \ | ||
332 | PIN_OSPEED_40M(GPIOB_PIN2) | \ | ||
333 | PIN_OSPEED_40M(GPIOB_PIN3) | \ | ||
334 | PIN_OSPEED_40M(GPIOB_PIN4) | \ | ||
335 | PIN_OSPEED_2M(GPIOB_PIN5) | \ | ||
336 | PIN_OSPEED_2M(GPIOB_PIN6) | \ | ||
337 | PIN_OSPEED_2M(GPIOB_PIN7) | \ | ||
338 | PIN_OSPEED_2M(GPIOB_PIN8) | \ | ||
339 | PIN_OSPEED_2M(GPIOB_PIN9) | \ | ||
340 | PIN_OSPEED_2M(GPIOB_PIN10) | \ | ||
341 | PIN_OSPEED_2M(GPIOB_PIN11) | \ | ||
342 | PIN_OSPEED_2M(GPIOB_PIN12) | \ | ||
343 | PIN_OSPEED_2M(GPIOB_PIN13) | \ | ||
344 | PIN_OSPEED_2M(GPIOB_PIN14) | \ | ||
345 | PIN_OSPEED_2M(GPIOB_PIN15)) | ||
346 | #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \ | ||
347 | PIN_PUPDR_PULLUP(GPIOB_PIN1) | \ | ||
348 | PIN_PUPDR_PULLUP(GPIOB_PIN2) | \ | ||
349 | PIN_PUPDR_PULLUP(GPIOB_PIN3) | \ | ||
350 | PIN_PUPDR_PULLUP(GPIOB_PIN4) | \ | ||
351 | PIN_PUPDR_PULLUP(GPIOB_PIN5) | \ | ||
352 | PIN_PUPDR_PULLUP(GPIOB_PIN6) | \ | ||
353 | PIN_PUPDR_PULLUP(GPIOB_PIN7) | \ | ||
354 | PIN_PUPDR_PULLUP(GPIOB_PIN8) | \ | ||
355 | PIN_PUPDR_PULLUP(GPIOB_PIN9) | \ | ||
356 | PIN_PUPDR_PULLUP(GPIOB_PIN10) | \ | ||
357 | PIN_PUPDR_PULLUP(GPIOB_PIN11) | \ | ||
358 | PIN_PUPDR_PULLUP(GPIOB_PIN12) | \ | ||
359 | PIN_PUPDR_PULLUP(GPIOB_PIN13) | \ | ||
360 | PIN_PUPDR_PULLUP(GPIOB_PIN14) | \ | ||
361 | PIN_PUPDR_PULLUP(GPIOB_PIN15)) | ||
362 | #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \ | ||
363 | PIN_ODR_HIGH(GPIOB_PIN1) | \ | ||
364 | PIN_ODR_HIGH(GPIOB_PIN2) | \ | ||
365 | PIN_ODR_HIGH(GPIOB_PIN3) | \ | ||
366 | PIN_ODR_HIGH(GPIOB_PIN4) | \ | ||
367 | PIN_ODR_HIGH(GPIOB_PIN5) | \ | ||
368 | PIN_ODR_HIGH(GPIOB_PIN6) | \ | ||
369 | PIN_ODR_HIGH(GPIOB_PIN7) | \ | ||
370 | PIN_ODR_HIGH(GPIOB_PIN8) | \ | ||
371 | PIN_ODR_HIGH(GPIOB_PIN9) | \ | ||
372 | PIN_ODR_HIGH(GPIOB_PIN10) | \ | ||
373 | PIN_ODR_HIGH(GPIOB_PIN11) | \ | ||
374 | PIN_ODR_HIGH(GPIOB_PIN12) | \ | ||
375 | PIN_ODR_HIGH(GPIOB_PIN13) | \ | ||
376 | PIN_ODR_HIGH(GPIOB_PIN14) | \ | ||
377 | PIN_ODR_HIGH(GPIOB_PIN15)) | ||
378 | #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0) | \ | ||
379 | PIN_AFIO_AF(GPIOB_PIN1, 0) | \ | ||
380 | PIN_AFIO_AF(GPIOB_PIN2, 0) | \ | ||
381 | PIN_AFIO_AF(GPIOB_PIN3, 0) | \ | ||
382 | PIN_AFIO_AF(GPIOB_PIN4, 0) | \ | ||
383 | PIN_AFIO_AF(GPIOB_PIN5, 0) | \ | ||
384 | PIN_AFIO_AF(GPIOB_PIN6, 0) | \ | ||
385 | PIN_AFIO_AF(GPIOB_PIN7, 0)) | ||
386 | #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0) | \ | ||
387 | PIN_AFIO_AF(GPIOB_PIN9, 0) | \ | ||
388 | PIN_AFIO_AF(GPIOB_PIN10, 0) | \ | ||
389 | PIN_AFIO_AF(GPIOB_PIN11, 0) | \ | ||
390 | PIN_AFIO_AF(GPIOB_PIN12, 0) | \ | ||
391 | PIN_AFIO_AF(GPIOB_PIN13, 0) | \ | ||
392 | PIN_AFIO_AF(GPIOB_PIN14, 0) | \ | ||
393 | PIN_AFIO_AF(GPIOB_PIN15, 0)) | ||
394 | |||
395 | /* | ||
396 | * GPIOC setup: | ||
397 | * | ||
398 | * PC0 - PIN0 (input pullup). | ||
399 | * PC1 - PIN1 (input pullup). | ||
400 | * PC2 - PIN2 (input pullup). | ||
401 | * PC3 - PIN3 (input pullup). | ||
402 | * PC4 - PIN4 (input pullup). | ||
403 | * PC5 - PIN5 (input pullup). | ||
404 | * PC6 - PIN6 (input pullup). | ||
405 | * PC7 - PIN7 (input pullup). | ||
406 | * PC8 - LED4 (output pushpull maximum). | ||
407 | * PC9 - LED3 (output pushpull maximum). | ||
408 | * PC10 - PIN10 (input pullup). | ||
409 | * PC11 - PIN11 (input pullup). | ||
410 | * PC12 - PIN12 (input pullup). | ||
411 | * PC13 - PIN13 (input pullup). | ||
412 | * PC14 - OSC32_IN (input floating). | ||
413 | * PC15 - OSC32_OUT (input floating). | ||
414 | */ | ||
415 | #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \ | ||
416 | PIN_MODE_INPUT(GPIOC_PIN1) | \ | ||
417 | PIN_MODE_INPUT(GPIOC_PIN2) | \ | ||
418 | PIN_MODE_INPUT(GPIOC_PIN3) | \ | ||
419 | PIN_MODE_INPUT(GPIOC_PIN4) | \ | ||
420 | PIN_MODE_INPUT(GPIOC_PIN5) | \ | ||
421 | PIN_MODE_INPUT(GPIOC_PIN6) | \ | ||
422 | PIN_MODE_INPUT(GPIOC_PIN7) | \ | ||
423 | PIN_MODE_OUTPUT(GPIOC_LED4) | \ | ||
424 | PIN_MODE_OUTPUT(GPIOC_LED3) | \ | ||
425 | PIN_MODE_INPUT(GPIOC_PIN10) | \ | ||
426 | PIN_MODE_INPUT(GPIOC_PIN11) | \ | ||
427 | PIN_MODE_INPUT(GPIOC_PIN12) | \ | ||
428 | PIN_MODE_INPUT(GPIOC_PIN13) | \ | ||
429 | PIN_MODE_INPUT(GPIOC_OSC32_IN) | \ | ||
430 | PIN_MODE_INPUT(GPIOC_OSC32_OUT)) | ||
431 | #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \ | ||
432 | PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \ | ||
433 | PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \ | ||
434 | PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \ | ||
435 | PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \ | ||
436 | PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \ | ||
437 | PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \ | ||
438 | PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \ | ||
439 | PIN_OTYPE_PUSHPULL(GPIOC_LED4) | \ | ||
440 | PIN_OTYPE_PUSHPULL(GPIOC_LED3) | \ | ||
441 | PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \ | ||
442 | PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \ | ||
443 | PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \ | ||
444 | PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \ | ||
445 | PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \ | ||
446 | PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT)) | ||
447 | #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_2M(GPIOC_PIN0) | \ | ||
448 | PIN_OSPEED_2M(GPIOC_PIN1) | \ | ||
449 | PIN_OSPEED_2M(GPIOC_PIN2) | \ | ||
450 | PIN_OSPEED_2M(GPIOC_PIN3) | \ | ||
451 | PIN_OSPEED_2M(GPIOC_PIN4) | \ | ||
452 | PIN_OSPEED_2M(GPIOC_PIN5) | \ | ||
453 | PIN_OSPEED_2M(GPIOC_PIN6) | \ | ||
454 | PIN_OSPEED_2M(GPIOC_PIN7) | \ | ||
455 | PIN_OSPEED_40M(GPIOC_LED4) | \ | ||
456 | PIN_OSPEED_40M(GPIOC_LED3) | \ | ||
457 | PIN_OSPEED_2M(GPIOC_PIN10) | \ | ||
458 | PIN_OSPEED_2M(GPIOC_PIN11) | \ | ||
459 | PIN_OSPEED_2M(GPIOC_PIN12) | \ | ||
460 | PIN_OSPEED_2M(GPIOC_PIN13) | \ | ||
461 | PIN_OSPEED_40M(GPIOC_OSC32_IN) | \ | ||
462 | PIN_OSPEED_40M(GPIOC_OSC32_OUT)) | ||
463 | #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \ | ||
464 | PIN_PUPDR_PULLUP(GPIOC_PIN1) | \ | ||
465 | PIN_PUPDR_PULLUP(GPIOC_PIN2) | \ | ||
466 | PIN_PUPDR_PULLUP(GPIOC_PIN3) | \ | ||
467 | PIN_PUPDR_PULLUP(GPIOC_PIN4) | \ | ||
468 | PIN_PUPDR_PULLUP(GPIOC_PIN5) | \ | ||
469 | PIN_PUPDR_PULLUP(GPIOC_PIN6) | \ | ||
470 | PIN_PUPDR_PULLUP(GPIOC_PIN7) | \ | ||
471 | PIN_PUPDR_FLOATING(GPIOC_LED4) | \ | ||
472 | PIN_PUPDR_FLOATING(GPIOC_LED3) | \ | ||
473 | PIN_PUPDR_PULLUP(GPIOC_PIN10) | \ | ||
474 | PIN_PUPDR_PULLUP(GPIOC_PIN11) | \ | ||
475 | PIN_PUPDR_PULLUP(GPIOC_PIN12) | \ | ||
476 | PIN_PUPDR_PULLUP(GPIOC_PIN13) | \ | ||
477 | PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \ | ||
478 | PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT)) | ||
479 | #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \ | ||
480 | PIN_ODR_HIGH(GPIOC_PIN1) | \ | ||
481 | PIN_ODR_HIGH(GPIOC_PIN2) | \ | ||
482 | PIN_ODR_HIGH(GPIOC_PIN3) | \ | ||
483 | PIN_ODR_HIGH(GPIOC_PIN4) | \ | ||
484 | PIN_ODR_HIGH(GPIOC_PIN5) | \ | ||
485 | PIN_ODR_HIGH(GPIOC_PIN6) | \ | ||
486 | PIN_ODR_HIGH(GPIOC_PIN7) | \ | ||
487 | PIN_ODR_LOW(GPIOC_LED4) | \ | ||
488 | PIN_ODR_LOW(GPIOC_LED3) | \ | ||
489 | PIN_ODR_HIGH(GPIOC_PIN10) | \ | ||
490 | PIN_ODR_HIGH(GPIOC_PIN11) | \ | ||
491 | PIN_ODR_HIGH(GPIOC_PIN12) | \ | ||
492 | PIN_ODR_HIGH(GPIOC_PIN13) | \ | ||
493 | PIN_ODR_HIGH(GPIOC_OSC32_IN) | \ | ||
494 | PIN_ODR_HIGH(GPIOC_OSC32_OUT)) | ||
495 | #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0) | \ | ||
496 | PIN_AFIO_AF(GPIOC_PIN1, 0) | \ | ||
497 | PIN_AFIO_AF(GPIOC_PIN2, 0) | \ | ||
498 | PIN_AFIO_AF(GPIOC_PIN3, 0) | \ | ||
499 | PIN_AFIO_AF(GPIOC_PIN4, 0) | \ | ||
500 | PIN_AFIO_AF(GPIOC_PIN5, 0) | \ | ||
501 | PIN_AFIO_AF(GPIOC_PIN6, 0) | \ | ||
502 | PIN_AFIO_AF(GPIOC_PIN7, 0)) | ||
503 | #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_LED4, 0) | \ | ||
504 | PIN_AFIO_AF(GPIOC_LED3, 0) | \ | ||
505 | PIN_AFIO_AF(GPIOC_PIN10, 0) | \ | ||
506 | PIN_AFIO_AF(GPIOC_PIN11, 0) | \ | ||
507 | PIN_AFIO_AF(GPIOC_PIN12, 0) | \ | ||
508 | PIN_AFIO_AF(GPIOC_PIN13, 0) | \ | ||
509 | PIN_AFIO_AF(GPIOC_OSC32_IN, 0) | \ | ||
510 | PIN_AFIO_AF(GPIOC_OSC32_OUT, 0)) | ||
511 | |||
512 | /* | ||
513 | * GPIOD setup: | ||
514 | * | ||
515 | * PD0 - PIN0 (input pullup). | ||
516 | * PD1 - PIN1 (input pullup). | ||
517 | * PD2 - PIN2 (input pullup). | ||
518 | * PD3 - PIN3 (input pullup). | ||
519 | * PD4 - PIN4 (input pullup). | ||
520 | * PD5 - PIN5 (input pullup). | ||
521 | * PD6 - PIN6 (input pullup). | ||
522 | * PD7 - PIN7 (input pullup). | ||
523 | * PD8 - PIN8 (input pullup). | ||
524 | * PD9 - PIN9 (input pullup). | ||
525 | * PD10 - PIN10 (input pullup). | ||
526 | * PD11 - PIN11 (input pullup). | ||
527 | * PD12 - PIN12 (input pullup). | ||
528 | * PD13 - PIN13 (input pullup). | ||
529 | * PD14 - PIN14 (input pullup). | ||
530 | * PD15 - PIN15 (input pullup). | ||
531 | */ | ||
532 | #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \ | ||
533 | PIN_MODE_INPUT(GPIOD_PIN1) | \ | ||
534 | PIN_MODE_INPUT(GPIOD_PIN2) | \ | ||
535 | PIN_MODE_INPUT(GPIOD_PIN3) | \ | ||
536 | PIN_MODE_INPUT(GPIOD_PIN4) | \ | ||
537 | PIN_MODE_INPUT(GPIOD_PIN5) | \ | ||
538 | PIN_MODE_INPUT(GPIOD_PIN6) | \ | ||
539 | PIN_MODE_INPUT(GPIOD_PIN7) | \ | ||
540 | PIN_MODE_INPUT(GPIOD_PIN8) | \ | ||
541 | PIN_MODE_INPUT(GPIOD_PIN9) | \ | ||
542 | PIN_MODE_INPUT(GPIOD_PIN10) | \ | ||
543 | PIN_MODE_INPUT(GPIOD_PIN11) | \ | ||
544 | PIN_MODE_INPUT(GPIOD_PIN12) | \ | ||
545 | PIN_MODE_INPUT(GPIOD_PIN13) | \ | ||
546 | PIN_MODE_INPUT(GPIOD_PIN14) | \ | ||
547 | PIN_MODE_INPUT(GPIOD_PIN15)) | ||
548 | #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \ | ||
549 | PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \ | ||
550 | PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \ | ||
551 | PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \ | ||
552 | PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \ | ||
553 | PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \ | ||
554 | PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \ | ||
555 | PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \ | ||
556 | PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \ | ||
557 | PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \ | ||
558 | PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \ | ||
559 | PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \ | ||
560 | PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \ | ||
561 | PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \ | ||
562 | PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \ | ||
563 | PIN_OTYPE_PUSHPULL(GPIOD_PIN15)) | ||
564 | #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_2M(GPIOD_PIN0) | \ | ||
565 | PIN_OSPEED_2M(GPIOD_PIN1) | \ | ||
566 | PIN_OSPEED_2M(GPIOD_PIN2) | \ | ||
567 | PIN_OSPEED_2M(GPIOD_PIN3) | \ | ||
568 | PIN_OSPEED_2M(GPIOD_PIN4) | \ | ||
569 | PIN_OSPEED_2M(GPIOD_PIN5) | \ | ||
570 | PIN_OSPEED_2M(GPIOD_PIN6) | \ | ||
571 | PIN_OSPEED_2M(GPIOD_PIN7) | \ | ||
572 | PIN_OSPEED_2M(GPIOD_PIN8) | \ | ||
573 | PIN_OSPEED_2M(GPIOD_PIN9) | \ | ||
574 | PIN_OSPEED_2M(GPIOD_PIN10) | \ | ||
575 | PIN_OSPEED_2M(GPIOD_PIN11) | \ | ||
576 | PIN_OSPEED_2M(GPIOD_PIN12) | \ | ||
577 | PIN_OSPEED_2M(GPIOD_PIN13) | \ | ||
578 | PIN_OSPEED_2M(GPIOD_PIN14) | \ | ||
579 | PIN_OSPEED_2M(GPIOD_PIN15)) | ||
580 | #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \ | ||
581 | PIN_PUPDR_PULLUP(GPIOD_PIN1) | \ | ||
582 | PIN_PUPDR_PULLUP(GPIOD_PIN2) | \ | ||
583 | PIN_PUPDR_PULLUP(GPIOD_PIN3) | \ | ||
584 | PIN_PUPDR_PULLUP(GPIOD_PIN4) | \ | ||
585 | PIN_PUPDR_PULLUP(GPIOD_PIN5) | \ | ||
586 | PIN_PUPDR_PULLUP(GPIOD_PIN6) | \ | ||
587 | PIN_PUPDR_PULLUP(GPIOD_PIN7) | \ | ||
588 | PIN_PUPDR_PULLUP(GPIOD_PIN8) | \ | ||
589 | PIN_PUPDR_PULLUP(GPIOD_PIN9) | \ | ||
590 | PIN_PUPDR_PULLUP(GPIOD_PIN10) | \ | ||
591 | PIN_PUPDR_PULLUP(GPIOD_PIN11) | \ | ||
592 | PIN_PUPDR_PULLUP(GPIOD_PIN12) | \ | ||
593 | PIN_PUPDR_PULLUP(GPIOD_PIN13) | \ | ||
594 | PIN_PUPDR_PULLUP(GPIOD_PIN14) | \ | ||
595 | PIN_PUPDR_PULLUP(GPIOD_PIN15)) | ||
596 | #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \ | ||
597 | PIN_ODR_HIGH(GPIOD_PIN1) | \ | ||
598 | PIN_ODR_HIGH(GPIOD_PIN2) | \ | ||
599 | PIN_ODR_HIGH(GPIOD_PIN3) | \ | ||
600 | PIN_ODR_HIGH(GPIOD_PIN4) | \ | ||
601 | PIN_ODR_HIGH(GPIOD_PIN5) | \ | ||
602 | PIN_ODR_HIGH(GPIOD_PIN6) | \ | ||
603 | PIN_ODR_HIGH(GPIOD_PIN7) | \ | ||
604 | PIN_ODR_HIGH(GPIOD_PIN8) | \ | ||
605 | PIN_ODR_HIGH(GPIOD_PIN9) | \ | ||
606 | PIN_ODR_HIGH(GPIOD_PIN10) | \ | ||
607 | PIN_ODR_HIGH(GPIOD_PIN11) | \ | ||
608 | PIN_ODR_HIGH(GPIOD_PIN12) | \ | ||
609 | PIN_ODR_HIGH(GPIOD_PIN13) | \ | ||
610 | PIN_ODR_HIGH(GPIOD_PIN14) | \ | ||
611 | PIN_ODR_HIGH(GPIOD_PIN15)) | ||
612 | #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0) | \ | ||
613 | PIN_AFIO_AF(GPIOD_PIN1, 0) | \ | ||
614 | PIN_AFIO_AF(GPIOD_PIN2, 0) | \ | ||
615 | PIN_AFIO_AF(GPIOD_PIN3, 0) | \ | ||
616 | PIN_AFIO_AF(GPIOD_PIN4, 0) | \ | ||
617 | PIN_AFIO_AF(GPIOD_PIN5, 0) | \ | ||
618 | PIN_AFIO_AF(GPIOD_PIN6, 0) | \ | ||
619 | PIN_AFIO_AF(GPIOD_PIN7, 0)) | ||
620 | #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0) | \ | ||
621 | PIN_AFIO_AF(GPIOD_PIN9, 0) | \ | ||
622 | PIN_AFIO_AF(GPIOD_PIN10, 0) | \ | ||
623 | PIN_AFIO_AF(GPIOD_PIN11, 0) | \ | ||
624 | PIN_AFIO_AF(GPIOD_PIN12, 0) | \ | ||
625 | PIN_AFIO_AF(GPIOD_PIN13, 0) | \ | ||
626 | PIN_AFIO_AF(GPIOD_PIN14, 0) | \ | ||
627 | PIN_AFIO_AF(GPIOD_PIN15, 0)) | ||
628 | |||
629 | /* | ||
630 | * GPIOF setup: | ||
631 | * | ||
632 | * PF0 - OSC_IN (input floating). | ||
633 | * PF1 - OSC_OUT (input floating). | ||
634 | * PF2 - PIN2 (input pullup). | ||
635 | * PF3 - PIN3 (input pullup). | ||
636 | * PF4 - PIN4 (input pullup). | ||
637 | * PF5 - PIN5 (input pullup). | ||
638 | * PF6 - PIN6 (input pullup). | ||
639 | * PF7 - PIN7 (input pullup). | ||
640 | * PF8 - PIN8 (input pullup). | ||
641 | * PF9 - PIN9 (input pullup). | ||
642 | * PF10 - PIN10 (input pullup). | ||
643 | * PF11 - PIN11 (input pullup). | ||
644 | * PF12 - PIN12 (input pullup). | ||
645 | * PF13 - PIN13 (input pullup). | ||
646 | * PF14 - PIN14 (input pullup). | ||
647 | * PF15 - PIN15 (input pullup). | ||
648 | */ | ||
649 | #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_OSC_IN) | \ | ||
650 | PIN_MODE_INPUT(GPIOF_OSC_OUT) | \ | ||
651 | PIN_MODE_INPUT(GPIOF_PIN2) | \ | ||
652 | PIN_MODE_INPUT(GPIOF_PIN3) | \ | ||
653 | PIN_MODE_INPUT(GPIOF_PIN4) | \ | ||
654 | PIN_MODE_INPUT(GPIOF_PIN5) | \ | ||
655 | PIN_MODE_INPUT(GPIOF_PIN6) | \ | ||
656 | PIN_MODE_INPUT(GPIOF_PIN7) | \ | ||
657 | PIN_MODE_INPUT(GPIOF_PIN8) | \ | ||
658 | PIN_MODE_INPUT(GPIOF_PIN9) | \ | ||
659 | PIN_MODE_INPUT(GPIOF_PIN10) | \ | ||
660 | PIN_MODE_INPUT(GPIOF_PIN11) | \ | ||
661 | PIN_MODE_INPUT(GPIOF_PIN12) | \ | ||
662 | PIN_MODE_INPUT(GPIOF_PIN13) | \ | ||
663 | PIN_MODE_INPUT(GPIOF_PIN14) | \ | ||
664 | PIN_MODE_INPUT(GPIOF_PIN15)) | ||
665 | #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_OSC_IN) | \ | ||
666 | PIN_OTYPE_PUSHPULL(GPIOF_OSC_OUT) | \ | ||
667 | PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \ | ||
668 | PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \ | ||
669 | PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \ | ||
670 | PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \ | ||
671 | PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \ | ||
672 | PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \ | ||
673 | PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \ | ||
674 | PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \ | ||
675 | PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \ | ||
676 | PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \ | ||
677 | PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \ | ||
678 | PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \ | ||
679 | PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \ | ||
680 | PIN_OTYPE_PUSHPULL(GPIOF_PIN15)) | ||
681 | #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_2M(GPIOF_OSC_IN) | \ | ||
682 | PIN_OSPEED_2M(GPIOF_OSC_OUT) | \ | ||
683 | PIN_OSPEED_2M(GPIOF_PIN2) | \ | ||
684 | PIN_OSPEED_2M(GPIOF_PIN3) | \ | ||
685 | PIN_OSPEED_2M(GPIOF_PIN4) | \ | ||
686 | PIN_OSPEED_2M(GPIOF_PIN5) | \ | ||
687 | PIN_OSPEED_2M(GPIOF_PIN6) | \ | ||
688 | PIN_OSPEED_2M(GPIOF_PIN7) | \ | ||
689 | PIN_OSPEED_2M(GPIOF_PIN8) | \ | ||
690 | PIN_OSPEED_2M(GPIOF_PIN9) | \ | ||
691 | PIN_OSPEED_2M(GPIOF_PIN10) | \ | ||
692 | PIN_OSPEED_2M(GPIOF_PIN11) | \ | ||
693 | PIN_OSPEED_2M(GPIOF_PIN12) | \ | ||
694 | PIN_OSPEED_2M(GPIOF_PIN13) | \ | ||
695 | PIN_OSPEED_2M(GPIOF_PIN14) | \ | ||
696 | PIN_OSPEED_2M(GPIOF_PIN15)) | ||
697 | #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_OSC_IN) | \ | ||
698 | PIN_PUPDR_FLOATING(GPIOF_OSC_OUT) | \ | ||
699 | PIN_PUPDR_PULLUP(GPIOF_PIN2) | \ | ||
700 | PIN_PUPDR_PULLUP(GPIOF_PIN3) | \ | ||
701 | PIN_PUPDR_PULLUP(GPIOF_PIN4) | \ | ||
702 | PIN_PUPDR_PULLUP(GPIOF_PIN5) | \ | ||
703 | PIN_PUPDR_PULLUP(GPIOF_PIN6) | \ | ||
704 | PIN_PUPDR_PULLUP(GPIOF_PIN7) | \ | ||
705 | PIN_PUPDR_PULLUP(GPIOF_PIN8) | \ | ||
706 | PIN_PUPDR_PULLUP(GPIOF_PIN9) | \ | ||
707 | PIN_PUPDR_PULLUP(GPIOF_PIN10) | \ | ||
708 | PIN_PUPDR_PULLUP(GPIOF_PIN11) | \ | ||
709 | PIN_PUPDR_PULLUP(GPIOF_PIN12) | \ | ||
710 | PIN_PUPDR_PULLUP(GPIOF_PIN13) | \ | ||
711 | PIN_PUPDR_PULLUP(GPIOF_PIN14) | \ | ||
712 | PIN_PUPDR_PULLUP(GPIOF_PIN15)) | ||
713 | #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_OSC_IN) | \ | ||
714 | PIN_ODR_HIGH(GPIOF_OSC_OUT) | \ | ||
715 | PIN_ODR_HIGH(GPIOF_PIN2) | \ | ||
716 | PIN_ODR_HIGH(GPIOF_PIN3) | \ | ||
717 | PIN_ODR_HIGH(GPIOF_PIN4) | \ | ||
718 | PIN_ODR_HIGH(GPIOF_PIN5) | \ | ||
719 | PIN_ODR_HIGH(GPIOF_PIN6) | \ | ||
720 | PIN_ODR_HIGH(GPIOF_PIN7) | \ | ||
721 | PIN_ODR_HIGH(GPIOF_PIN8) | \ | ||
722 | PIN_ODR_HIGH(GPIOF_PIN9) | \ | ||
723 | PIN_ODR_HIGH(GPIOF_PIN10) | \ | ||
724 | PIN_ODR_HIGH(GPIOF_PIN11) | \ | ||
725 | PIN_ODR_HIGH(GPIOF_PIN12) | \ | ||
726 | PIN_ODR_HIGH(GPIOF_PIN13) | \ | ||
727 | PIN_ODR_HIGH(GPIOF_PIN14) | \ | ||
728 | PIN_ODR_HIGH(GPIOF_PIN15)) | ||
729 | #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_OSC_IN, 0) | \ | ||
730 | PIN_AFIO_AF(GPIOF_OSC_OUT, 0) | \ | ||
731 | PIN_AFIO_AF(GPIOF_PIN2, 0) | \ | ||
732 | PIN_AFIO_AF(GPIOF_PIN3, 0) | \ | ||
733 | PIN_AFIO_AF(GPIOF_PIN4, 0) | \ | ||
734 | PIN_AFIO_AF(GPIOF_PIN5, 0) | \ | ||
735 | PIN_AFIO_AF(GPIOF_PIN6, 0) | \ | ||
736 | PIN_AFIO_AF(GPIOF_PIN7, 0)) | ||
737 | #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0) | \ | ||
738 | PIN_AFIO_AF(GPIOF_PIN9, 0) | \ | ||
739 | PIN_AFIO_AF(GPIOF_PIN10, 0) | \ | ||
740 | PIN_AFIO_AF(GPIOF_PIN11, 0) | \ | ||
741 | PIN_AFIO_AF(GPIOF_PIN12, 0) | \ | ||
742 | PIN_AFIO_AF(GPIOF_PIN13, 0) | \ | ||
743 | PIN_AFIO_AF(GPIOF_PIN14, 0) | \ | ||
744 | PIN_AFIO_AF(GPIOF_PIN15, 0)) | ||
745 | |||
746 | |||
747 | #if !defined(_FROM_ASM_) | ||
748 | #ifdef __cplusplus | ||
749 | extern "C" { | ||
750 | #endif | ||
751 | void boardInit(void); | ||
752 | #ifdef __cplusplus | ||
753 | } | ||
754 | #endif | ||
755 | #endif /* _FROM_ASM_ */ | ||
756 | |||
757 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/os/hal/boards/ST_STM32F0308_DISCOVERY/board.mk b/lib/chibios-contrib/os/hal/boards/ST_STM32F0308_DISCOVERY/board.mk new file mode 100644 index 000000000..52ac32bbc --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/ST_STM32F0308_DISCOVERY/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS_CONTRIB}/os/hal/boards/ST_STM32F0308_DISCOVERY/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS_CONTRIB}/os/hal/boards/ST_STM32F0308_DISCOVERY | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios-contrib/os/hal/boards/ST_STM32F411_DISCOVERY/board.c b/lib/chibios-contrib/os/hal/boards/ST_STM32F411_DISCOVERY/board.c new file mode 100644 index 000000000..cd9e32ee7 --- /dev/null +++ b/lib/chibios-contrib/os/hal/boards/ST_STM32F411_DISCOVERY/board.c | |||
@@ -0,0 +1,288 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
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 | |||
17 | /* | ||
18 | * This file has been automatically generated using ChibiStudio board | ||
19 | * generator plugin. Do not edit manually. | ||
20 | */ | ||
21 | |||
22 | #include "hal.h" | ||
23 | #include "stm32_gpio.h" | ||
24 | |||
25 | /*===========================================================================*/ | ||
26 | /* Driver local definitions. */ | ||
27 | /*===========================================================================*/ | ||
28 | |||
29 | /*===========================================================================*/ | ||
30 | /* Driver exported variables. */ | ||
31 | /*===========================================================================*/ | ||
32 | |||
33 | /*===========================================================================*/ | ||
34 | /* Driver local variables and types. */ | ||
35 | /*===========================================================================*/ | ||
36 | |||
37 | /** | ||
38 | * @brief Type of STM32 GPIO port setup. | ||
39 | */ | ||
40 | typedef struct { | ||
41 | uint32_t moder; | ||
42 | uint32_t otyper; | ||
43 | uint32_t ospeedr; | ||
44 | uint32_t pupdr; | ||
45 | uint32_t odr; | ||
46 | uint32_t afrl; | ||
47 | uint32_t afrh; | ||
48 | } gpio_setup_t; | ||
49 | |||
50 | /** | ||
51 | * @brief Type of STM32 GPIO initialization data. | ||
52 | */ | ||
53 | typedef struct { | ||
54 | #if STM32_HAS_GPIOA || defined(__DOXYGEN__) | ||
55 | gpio_setup_t PAData; | ||
56 | #endif | ||
57 | #if STM32_HAS_GPIOB || defined(__DOXYGEN__) | ||
58 | gpio_setup_t PBData; | ||
59 | #endif | ||
60 | #if STM32_HAS_GPIOC || defined(__DOXYGEN__) | ||
61 | gpio_setup_t PCData; | ||
62 | #endif | ||
63 | #if STM32_HAS_GPIOD || defined(__DOXYGEN__) | ||
64 | gpio_setup_t PDData; | ||
65 | #endif | ||
66 | #if STM32_HAS_GPIOE || defined(__DOXYGEN__) | ||
67 | gpio_setup_t PEData; | ||
68 | #endif | ||
69 | #if STM32_HAS_GPIOF || defined(__DOXYGEN__) | ||
70 | gpio_setup_t PFData; | ||
71 | #endif | ||
72 | #if STM32_HAS_GPIOG || defined(__DOXYGEN__) | ||
73 | gpio_setup_t PGData; | ||
74 | #endif | ||
75 | #if STM32_HAS_GPIOH || defined(__DOXYGEN__) | ||
76 | gpio_setup_t PHData; | ||
77 | #endif | ||
78 | #if STM32_HAS_GPIOI || defined(__DOXYGEN__) | ||
79 | gpio_setup_t PIData; | ||
80 | #endif | ||
81 | #if STM32_HAS_GPIOJ || defined(__DOXYGEN__) | ||
82 | gpio_setup_t PJData; | ||
83 | #endif | ||