summaryrefslogtreecommitdiff
path: root/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h')
-rw-r--r--platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h207
1 files changed, 207 insertions, 0 deletions
diff --git a/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h b/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h
new file mode 100644
index 0000000000..c3ade198ba
--- /dev/null
+++ b/platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h
@@ -0,0 +1,207 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3 ChibiOS - Copyright (C) 2023..2024 HorrorTroll
4 ChibiOS - Copyright (C) 2023..2024 Zhaqian
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17*/
18
19#ifndef _BOARD_H_
20#define _BOARD_H_
21
22/*===========================================================================*/
23/* Driver constants. */
24/*===========================================================================*/
25
26/*
27 * Setup for a Generic AT32F415 board.
28 */
29
30/*
31 * Board identifier.
32 */
33#define BOARD_GENERIC_AT32_F415XX
34#define BOARD_NAME "GENERIC AT32F415 board"
35
36/*
37 * Board oscillators-related settings.
38 */
39#if !defined(AT32_LEXTCLK)
40#define AT32_LEXTCLK 32768
41#endif
42
43#if !defined(AT32_HEXTCLK)
44#define AT32_HEXTCLK 8000000
45#endif
46
47/*
48 * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
49 */
50#define AT32F415KB
51
52/*
53 * IO pins assignments.
54 */
55#define GPIOA_PIN0 0U
56#define GPIOA_PIN1 1U
57#define GPIOA_PIN2 2U
58#define GPIOA_PIN3 3U
59#define GPIOA_PIN4 4U
60#define GPIOA_PIN5 5U
61#define GPIOA_PIN6 6U
62#define GPIOA_PIN7 7U
63#define GPIOA_PIN8 8U
64#define GPIOA_PIN9 9U
65#define GPIOA_PIN10 10U
66#define GPIOA_PIN11 11U
67#define GPIOA_PIN12 12U
68#define GPIOA_SWDIO 13U
69#define GPIOA_SWCLK 14U
70#define GPIOA_PIN15 15U
71
72#define GPIOB_PIN0 0U
73#define GPIOB_PIN1 1U
74#define GPIOB_PIN2 2U
75#define GPIOB_PIN3 3U
76#define GPIOB_PIN4 4U
77#define GPIOB_PIN5 5U
78#define GPIOB_PIN6 6U
79#define GPIOB_PIN7 7U
80#define GPIOB_PIN8 8U
81#define GPIOB_PIN9 9U
82#define GPIOB_PIN10 10U
83#define GPIOB_PIN11 11U
84#define GPIOB_PIN12 12U
85#define GPIOB_PIN13 13U
86#define GPIOB_PIN14 14U
87#define GPIOB_PIN15 15U
88
89#define GPIOC_PIN0 0U
90#define GPIOC_PIN1 1U
91#define GPIOC_PIN2 2U
92#define GPIOC_PIN3 3U
93#define GPIOC_PIN4 4U
94#define GPIOC_PIN5 5U
95#define GPIOC_PIN6 6U
96#define GPIOC_PIN7 7U
97#define GPIOC_PIN8 8U
98#define GPIOC_PIN9 9U
99#define GPIOC_PIN10 10U
100#define GPIOC_PIN11 11U
101#define GPIOC_PIN12 12U
102#define GPIOC_PIN13 13U
103#define GPIOC_PIN14 14U
104#define GPIOC_PIN15 15U
105
106#define GPIOD_HEXT_IN 0U
107#define GPIOD_HEXT_OUT 1U
108#define GPIOD_PIN2 2U
109
110#define GPIOF_PIN4 4U
111#define GPIOF_PIN5 5U
112#define GPIOF_PIN6 6U
113#define GPIOF_PIN7 7U
114
115/*===========================================================================*/
116/* Driver pre-compile time settings. */
117/*===========================================================================*/
118
119/*===========================================================================*/
120/* Derived constants and error checks. */
121/*===========================================================================*/
122
123/*===========================================================================*/
124/* Driver data structures and types. */
125/*===========================================================================*/
126
127/*===========================================================================*/
128/* Driver macros. */
129/*===========================================================================*/
130
131/*
132 * I/O ports initial setup, this configuration is established soon after reset
133 * in the initialization code.
134 *
135 * The digits have the following meaning:
136 * 0 - Analog input.
137 * 1 - Push Pull output 10MHz.
138 * 2 - Push Pull output 2MHz.
139 * 3 - Push Pull output 50MHz.
140 * 4 - Digital input.
141 * 5 - Open Drain output 10MHz.
142 * 6 - Open Drain output 2MHz.
143 * 7 - Open Drain output 50MHz.
144 * 8 - Digital input with Pull-Up or Pull-Down resistor depending on ODT.
145 * 9 - Alternate Push Pull output 10MHz.
146 * A - Alternate Push Pull output 2MHz.
147 * B - Alternate Push Pull output 50MHz.
148 * C - Reserved.
149 * D - Alternate Open Drain output 10MHz.
150 * E - Alternate Open Drain output 2MHz.
151 * F - Alternate Open Drain output 50MHz.
152 * Please refer to the AT32 Reference Manual for details.
153 */
154
155/*
156 * Port A setup.
157 */
158#define VAL_GPIOACFGLR 0x88888B88 /* PA7...PA0 */
159#define VAL_GPIOACFGHR 0x888888B8 /* PA15...PA8 */
160#define VAL_GPIOAODT 0xFFFFFFFF
161
162/*
163 * Port B setup.
164 */
165#define VAL_GPIOBCFGLR 0x88888888 /* PB7...PB0 */
166#define VAL_GPIOBCFGHR 0x88888888 /* PB15...PB8 */
167#define VAL_GPIOBODT 0xFFFFFFFF
168
169/*
170 * Port C setup.
171 */
172#define VAL_GPIOCCFGLR 0x88888888 /* PC7...PC0 */
173#define VAL_GPIOCCFGHR 0x88888888 /* PC15...PC8 */
174#define VAL_GPIOCODT 0xFFFFFFFF
175
176/*
177 * Port D setup.
178 * Everything input with pull-up except:
179 * PD0 - Normal input (GPIOD_HEXT_IN).
180 * PD1 - Normal input (GPIOD_HEXT_OUT).
181 */
182#define VAL_GPIODCFGLR 0x88888844 /* PD7...PD0 */
183#define VAL_GPIODCFGHR 0x88888888 /* PD15...PD8 */
184#define VAL_GPIODODT 0xFFFFFFFF
185
186/*
187 * Port F setup.
188 */
189#define VAL_GPIOFCFGLR 0x88888888 /* PF7...PF0 */
190#define VAL_GPIOFCFGHR 0x88888888 /* PF15...PF8 */
191#define VAL_GPIOFODT 0xFFFFFFFF
192
193/*===========================================================================*/
194/* External declarations. */
195/*===========================================================================*/
196
197#if !defined(_FROM_ASM_)
198#ifdef __cplusplus
199extern "C" {
200#endif
201 void boardInit(void);
202#ifdef __cplusplus
203}
204#endif
205#endif /* _FROM_ASM_ */
206
207#endif /* _BOARD_H_ */