diff options
Diffstat (limited to 'lib/chibios/os/hal/ports/STM32/STM32F1xx/hal_lld.h')
-rw-r--r-- | lib/chibios/os/hal/ports/STM32/STM32F1xx/hal_lld.h | 226 |
1 files changed, 226 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/ports/STM32/STM32F1xx/hal_lld.h b/lib/chibios/os/hal/ports/STM32/STM32F1xx/hal_lld.h new file mode 100644 index 000000000..a26c32aeb --- /dev/null +++ b/lib/chibios/os/hal/ports/STM32/STM32F1xx/hal_lld.h | |||
@@ -0,0 +1,226 @@ | |||
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 | * @file STM32F1xx/hal_lld.h | ||
19 | * @brief STM32F1xx HAL subsystem low level driver header. | ||
20 | * @pre This module requires the following macros to be defined in the | ||
21 | * @p board.h file: | ||
22 | * - STM32_LSECLK. | ||
23 | * - STM32_LSE_BYPASS (optionally). | ||
24 | * - STM32_HSECLK. | ||
25 | * - STM32_HSE_BYPASS (optionally). | ||
26 | * . | ||
27 | * One of the following macros must also be defined: | ||
28 | * - STM32F100xB for Value Line Medium Density devices. | ||
29 | * - STM32F100xE for Value Line High Density devices. | ||
30 | * - STM32F101x6, STM32F102x6, STM32F103x6 for Performance | ||
31 | * Low Density devices. | ||
32 | * - STM32F101xB, STM32F102xB, STM32F103xB for Performance | ||
33 | * Medium Density devices. | ||
34 | * - STM32F101xE, STM32F103xE for Performance High Density devices. | ||
35 | * - STM32F101xG, STM32F103xG for Performance eXtra Density devices. | ||
36 | * - STM32F105xC, STM32F107xC for Connectivity Line devices. | ||
37 | * . | ||
38 | * | ||
39 | * @addtogroup HAL | ||
40 | * @{ | ||
41 | */ | ||
42 | |||
43 | #ifndef HAL_LLD_H | ||
44 | #define HAL_LLD_H | ||
45 | |||
46 | #include "stm32_registry.h" | ||
47 | |||
48 | /*===========================================================================*/ | ||
49 | /* Driver constants. */ | ||
50 | /*===========================================================================*/ | ||
51 | |||
52 | /** | ||
53 | * @name Platform identification | ||
54 | * @{ | ||
55 | */ | ||
56 | #if defined(__DOXYGEN__) | ||
57 | #define PLATFORM_NAME "STM32F1xx" | ||
58 | |||
59 | #elif defined(STM32F10X_MD_VL) | ||
60 | #define PLATFORM_NAME "STM32F100 Value Line Medium Density" | ||
61 | |||
62 | #elif defined(STM32F10X_HD_VL) | ||
63 | #define PLATFORM_NAME "STM32F100 Value Line High Density" | ||
64 | |||
65 | #elif defined(STM32F10X_LD) | ||
66 | #define PLATFORM_NAME "STM32F10x Performance Line Low Density" | ||
67 | |||
68 | #elif defined(STM32F10X_MD) | ||
69 | #define PLATFORM_NAME "STM32F10x Performance Line Medium Density" | ||
70 | |||
71 | #elif defined(STM32F10X_HD) | ||
72 | #define PLATFORM_NAME "STM32F10x Performance Line High Density" | ||
73 | |||
74 | #elif defined(STM32F10X_XL) | ||
75 | #define PLATFORM_NAME "STM32F10x Performance Line eXtra Density" | ||
76 | |||
77 | #elif defined(STM32F10X_CL) | ||
78 | #define PLATFORM_NAME "STM32F10x Connectivity Line" | ||
79 | |||
80 | #else | ||
81 | #error "unsupported or unrecognized STM32F1xx member" | ||
82 | #endif | ||
83 | |||
84 | /** | ||
85 | * @brief Sub-family identifier. | ||
86 | */ | ||
87 | #if !defined(STM32F1XX) || defined(__DOXYGEN__) | ||
88 | #define STM32F1XX | ||
89 | #endif | ||
90 | /** @} */ | ||
91 | |||
92 | /** | ||
93 | * @name Internal clock sources | ||
94 | * @{ | ||
95 | */ | ||
96 | #define STM32_HSICLK 8000000 /**< High speed internal clock. */ | ||
97 | #define STM32_LSICLK 40000 /**< Low speed internal clock. */ | ||
98 | /** @} */ | ||
99 | |||
100 | /** | ||
101 | * @name PWR_CR register bits definitions | ||
102 | * @{ | ||
103 | */ | ||
104 | #define STM32_PLS_MASK (7 << 5) /**< PLS bits mask. */ | ||
105 | #define STM32_PLS_LEV0 (0 << 5) /**< PVD level 0. */ | ||
106 | #define STM32_PLS_LEV1 (1 << 5) /**< PVD level 1. */ | ||
107 | #define STM32_PLS_LEV2 (2 << 5) /**< PVD level 2. */ | ||
108 | #define STM32_PLS_LEV3 (3 << 5) /**< PVD level 3. */ | ||
109 | #define STM32_PLS_LEV4 (4 << 5) /**< PVD level 4. */ | ||
110 | #define STM32_PLS_LEV5 (5 << 5) /**< PVD level 5. */ | ||
111 | #define STM32_PLS_LEV6 (6 << 5) /**< PVD level 6. */ | ||
112 | #define STM32_PLS_LEV7 (7 << 5) /**< PVD level 7. */ | ||
113 | /** @} */ | ||
114 | |||
115 | /*===========================================================================*/ | ||
116 | /* Platform capabilities. */ | ||
117 | /*===========================================================================*/ | ||
118 | |||
119 | /*===========================================================================*/ | ||
120 | /* Driver pre-compile time settings. */ | ||
121 | /*===========================================================================*/ | ||
122 | |||
123 | /** | ||
124 | * @name Configuration options | ||
125 | * @{ | ||
126 | */ | ||
127 | /** | ||
128 | * @brief Disables the PWR/RCC initialization in the HAL. | ||
129 | */ | ||
130 | #if !defined(STM32_NO_INIT) || defined(__DOXYGEN__) | ||
131 | #define STM32_NO_INIT FALSE | ||
132 | #endif | ||
133 | |||
134 | /** | ||
135 | * @brief Enables or disables the programmable voltage detector. | ||
136 | */ | ||
137 | #if !defined(STM32_PVD_ENABLE) || defined(__DOXYGEN__) | ||
138 | #define STM32_PVD_ENABLE FALSE | ||
139 | #endif | ||
140 | |||
141 | /** | ||
142 | * @brief Sets voltage level for programmable voltage detector. | ||
143 | */ | ||
144 | #if !defined(STM32_PLS) || defined(__DOXYGEN__) | ||
145 | #define STM32_PLS STM32_PLS_LEV0 | ||
146 | #endif | ||
147 | |||
148 | /** | ||
149 | * @brief Enables or disables the HSI clock source. | ||
150 | */ | ||
151 | #if !defined(STM32_HSI_ENABLED) || defined(__DOXYGEN__) | ||
152 | #define STM32_HSI_ENABLED TRUE | ||
153 | #endif | ||
154 | |||
155 | /** | ||
156 | * @brief Enables or disables the LSI clock source. | ||
157 | */ | ||
158 | #if !defined(STM32_LSI_ENABLED) || defined(__DOXYGEN__) | ||
159 | #define STM32_LSI_ENABLED FALSE | ||
160 | #endif | ||
161 | |||
162 | /** | ||
163 | * @brief Enables or disables the HSE clock source. | ||
164 | */ | ||
165 | #if !defined(STM32_HSE_ENABLED) || defined(__DOXYGEN__) | ||
166 | #define STM32_HSE_ENABLED TRUE | ||
167 | #endif | ||
168 | |||
169 | /** | ||
170 | * @brief Enables or disables the LSE clock source. | ||
171 | */ | ||
172 | #if !defined(STM32_LSE_ENABLED) || defined(__DOXYGEN__) | ||
173 | #define STM32_LSE_ENABLED FALSE | ||
174 | #endif | ||
175 | /** @} */ | ||
176 | |||
177 | /*===========================================================================*/ | ||
178 | /* Derived constants and error checks. */ | ||
179 | /*===========================================================================*/ | ||
180 | |||
181 | #if defined(STM32F10X_MD_VL) || defined(STM32F10X_HD_VL) || \ | ||
182 | defined(__DOXYGEN__) | ||
183 | #include "hal_lld_f100.h" | ||
184 | |||
185 | #elif defined(STM32F10X_LD) || defined(STM32F10X_MD) || \ | ||
186 | defined(STM32F10X_HD) || defined(STM32F10X_XL) || \ | ||
187 | defined(__DOXYGEN__) | ||
188 | #include "hal_lld_f103.h" | ||
189 | |||
190 | #elif defined(STM32F10X_CL) || defined(__DOXYGEN__) | ||
191 | #include "hal_lld_f105_f107.h" | ||
192 | #endif | ||
193 | |||
194 | /*===========================================================================*/ | ||
195 | /* Driver data structures and types. */ | ||
196 | /*===========================================================================*/ | ||
197 | |||
198 | /*===========================================================================*/ | ||
199 | /* Driver macros. */ | ||
200 | /*===========================================================================*/ | ||
201 | |||
202 | /*===========================================================================*/ | ||
203 | /* External declarations. */ | ||
204 | /*===========================================================================*/ | ||
205 | |||
206 | /* Various helpers.*/ | ||
207 | #include "nvic.h" | ||
208 | #include "cache.h" | ||
209 | #include "mpu_v7m.h" | ||
210 | #include "stm32_isr.h" | ||
211 | #include "stm32_dma.h" | ||
212 | #include "stm32_rcc.h" | ||
213 | #include "stm32_tim.h" | ||
214 | |||
215 | #ifdef __cplusplus | ||
216 | extern "C" { | ||
217 | #endif | ||
218 | void hal_lld_init(void); | ||
219 | void stm32_clock_init(void); | ||
220 | #ifdef __cplusplus | ||
221 | } | ||
222 | #endif | ||
223 | |||
224 | #endif /* HAL_LLD_H */ | ||
225 | |||
226 | /** @} */ | ||