aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/src/hal.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/src/hal.c')
-rw-r--r--lib/chibios/os/hal/src/hal.c157
1 files changed, 157 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/src/hal.c b/lib/chibios/os/hal/src/hal.c
new file mode 100644
index 000000000..4a270321e
--- /dev/null
+++ b/lib/chibios/os/hal/src/hal.c
@@ -0,0 +1,157 @@
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 hal.c
19 * @brief HAL subsystem code.
20 *
21 * @addtogroup HAL
22 * @{
23 */
24
25#include "hal.h"
26
27/*===========================================================================*/
28/* Driver local definitions. */
29/*===========================================================================*/
30
31/*===========================================================================*/
32/* Driver exported variables. */
33/*===========================================================================*/
34
35/*===========================================================================*/
36/* Driver local variables and types. */
37/*===========================================================================*/
38
39/*===========================================================================*/
40/* Driver local functions. */
41/*===========================================================================*/
42
43/*===========================================================================*/
44/* Driver exported functions. */
45/*===========================================================================*/
46
47/**
48 * @brief HAL initialization.
49 * @details This function invokes the low level initialization code then
50 * initializes all the drivers enabled in the HAL. Finally the
51 * board-specific initialization is performed by invoking
52 * @p boardInit() (usually defined in @p board.c).
53 *
54 * @init
55 */
56void halInit(void) {
57
58 /* Initializes the OS Abstraction Layer.*/
59 osalInit();
60
61 /* Platform low level initializations.*/
62 hal_lld_init();
63
64#if (HAL_USE_PAL == TRUE) || defined(__DOXYGEN__)
65#if defined(PAL_NEW_INIT)
66 palInit();
67#else
68 palInit(&pal_default_config);
69#endif
70#endif
71#if (HAL_USE_ADC == TRUE) || defined(__DOXYGEN__)
72 adcInit();
73#endif
74#if (HAL_USE_CAN == TRUE) || defined(__DOXYGEN__)
75 canInit();
76#endif
77#if (HAL_USE_CRY == TRUE) || defined(__DOXYGEN__)
78 cryInit();
79#endif
80#if (HAL_USE_DAC == TRUE) || defined(__DOXYGEN__)
81 dacInit();
82#endif
83#if (HAL_USE_EFL == TRUE) || defined(__DOXYGEN__)
84 eflInit();
85#endif
86#if (HAL_USE_GPT == TRUE) || defined(__DOXYGEN__)
87 gptInit();
88#endif
89#if (HAL_USE_I2C == TRUE) || defined(__DOXYGEN__)
90 i2cInit();
91#endif
92#if (HAL_USE_I2S == TRUE) || defined(__DOXYGEN__)
93 i2sInit();
94#endif
95#if (HAL_USE_ICU == TRUE) || defined(__DOXYGEN__)
96 icuInit();
97#endif
98#if (HAL_USE_MAC == TRUE) || defined(__DOXYGEN__)
99 macInit();
100#endif
101#if (HAL_USE_PWM == TRUE) || defined(__DOXYGEN__)
102 pwmInit();
103#endif
104#if (HAL_USE_SERIAL == TRUE) || defined(__DOXYGEN__)
105 sdInit();
106#endif
107#if (HAL_USE_SDC == TRUE) || defined(__DOXYGEN__)
108 sdcInit();
109#endif
110#if (HAL_USE_SPI == TRUE) || defined(__DOXYGEN__)
111 spiInit();
112#endif
113#if (HAL_USE_TRNG == TRUE) || defined(__DOXYGEN__)
114 trngInit();
115#endif
116#if (HAL_USE_UART == TRUE) || defined(__DOXYGEN__)
117 uartInit();
118#endif
119#if (HAL_USE_USB == TRUE) || defined(__DOXYGEN__)
120 usbInit();
121#endif
122#if (HAL_USE_MMC_SPI == TRUE) || defined(__DOXYGEN__)
123 mmcInit();
124#endif
125#if (HAL_USE_SERIAL_USB == TRUE) || defined(__DOXYGEN__)
126 sduInit();
127#endif
128#if (HAL_USE_RTC == TRUE) || defined(__DOXYGEN__)
129 rtcInit();
130#endif
131#if (HAL_USE_WDG == TRUE) || defined(__DOXYGEN__)
132 wdgInit();
133#endif
134#if (HAL_USE_WSPI == TRUE) || defined(__DOXYGEN__)
135 wspiInit();
136#endif
137
138 /* Community driver overlay initialization.*/
139#if defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__)
140#if (HAL_USE_COMMUNITY == TRUE) || defined(__DOXYGEN__)
141 halCommunityInit();
142#endif
143#endif
144
145 /* Board specific initialization.*/
146 boardInit();
147
148/*
149 * The ST driver is a special case, it is only initialized if the OSAL is
150 * configured to require it.
151 */
152#if OSAL_ST_MODE != OSAL_ST_MODE_NONE
153 stInit();
154#endif
155}
156
157/** @} */