ChibiOS  21.6.0
hal_lld.h
Go to the documentation of this file.
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_lld.h
19  * @brief PLATFORM HAL subsystem low level driver header.
20  *
21  * @addtogroup HAL
22  * @{
23  */
24 
25 #ifndef _HAL_LLD_H_
26 #define _HAL_LLD_H_
27 
28 /*===========================================================================*/
29 /* Driver constants. */
30 /*===========================================================================*/
31 
32 /**
33  * @brief Specifies implementation of dynamic clock management.
34  */
35 #define HAL_LLD_USE_CLOCK_MANAGEMENT
36 
37 /**
38  * @name Platform identification macros
39  * @{
40  */
41 #define PLATFORM_NAME "templates"
42 /** @} */
43 
44 /*===========================================================================*/
45 /* Driver pre-compile time settings. */
46 /*===========================================================================*/
47 
48 /**
49  * @name PLATFORM configuration options
50  * @{
51  */
52 /** @} */
53 
54 /*===========================================================================*/
55 /* Derived constants and error checks. */
56 /*===========================================================================*/
57 
58 /*
59  * Configuration-related checks.
60  */
61 #if !defined(PLATFORM_MCUCONF)
62 #error "Using a wrong mcuconf.h file, PLATFORM_MCUCONF not defined"
63 #endif
64 
65 /*===========================================================================*/
66 /* Driver data structures and types. */
67 /*===========================================================================*/
68 
69 /**
70  * @brief Type of a clock point identifier.
71  */
72 typedef unsigned halclkpt_t;
73 
74 #if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) || defined(__DOXYGEN__)
75 /**
76  * @brief Type of a clock point frequency in Hz.
77  */
78 typedef uint32_t halfreq_t;
79 
80 /**
81  * @brief Type of a clock configuration structure.
82  */
83 typedef struct {
84  uint32_t dummy;
85 } halclkcfg_t;
86 #endif /* defined(HAL_LLD_USE_CLOCK_MANAGEMENT) */
87 
88 /*===========================================================================*/
89 /* Driver macros. */
90 /*===========================================================================*/
91 
92 /*===========================================================================*/
93 /* External declarations. */
94 /*===========================================================================*/
95 
96 #if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) && !defined(__DOXYGEN__)
97 extern const halclkcfg_t hal_clkcfg_reset;
98 extern const halclkcfg_t hal_clkcfg_default;
99 #endif
100 
101 #ifdef __cplusplus
102 extern "C" {
103 #endif
104  void hal_lld_init(void);
105 #if defined(HAL_LLD_USE_CLOCK_MANAGEMENT) || defined(__DOXYGEN__)
106  bool hal_lld_clock_switch_mode(const halclkcfg_t *ccp);
108 #endif /* defined(HAL_LLD_USE_CLOCK_MANAGEMENT) */
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif /* _HAL_LLD_H_ */
114 
115 /** @} */
hal_lld_get_clock_point
halfreq_t hal_lld_get_clock_point(halclkpt_t clkpt)
Returns the frequency of a clock point in Hz.
Definition: hal_lld.c:103
halfreq_t
uint32_t halfreq_t
Type of a clock point frequency in Hz.
Definition: hal_lld.h:78
hal_lld_clock_switch_mode
bool hal_lld_clock_switch_mode(const halclkcfg_t *ccp)
Switches to a different clock configuration.
Definition: hal_lld.c:87
hal_lld_init
void hal_lld_init(void)
Low level HAL driver initialization.
Definition: hal_lld.c:72
halclkcfg_t
Type of a clock configuration structure.
Definition: hal_lld.h:83
halclkpt_t
unsigned halclkpt_t
Type of a clock point identifier.
Definition: hal_lld.h:72