-
Notifications
You must be signed in to change notification settings - Fork 32
/
tm_stm32_rcc.h
147 lines (129 loc) · 3.63 KB
/
tm_stm32_rcc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/**
* @author Tilen MAJERLE
* @email [email protected]
* @website http://stm32f4-discovery.com
* @link http://stm32f4-discovery.com/2015/07/hal-library-01-rcc-for-stm32fxxx/
* @version v1.1
* @ide Keil uVision
* @license MIT
* @brief RCC Library for STM32F4xx and STM32F7xx devices
*
\verbatim
----------------------------------------------------------------------
Copyright (c) 2020 Tilen MAJERLE
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------
\endverbatim
*/
#ifndef TM_RCC_H
#define TM_RCC_H 110
/* C++ detection */
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup TM_STM32Fxxx_HAL_Libraries
* @{
*/
/**
* @defgroup TM_RCC
* @brief RCC Library for STM32Fxxx - http://stm32f4-discovery.com/2015/07/hal-library-01-rcc-for-stm32fxxx/
* @{
*
* RCC library provides initialization of clock at the beginning. Function @ref TM_RCC_InitSystem should be called at beginning of @ref main function to initialize system.
*
* @note In case of STM32F7xx is used, this library also enables CACHE for Instructions and Data.
*
* \par Changelog
*
\verbatim
Version 1.0
- Initial release
Version 1.1
- October 10, 2015
- Added support for STM32F469 devices
\endverbatim
*
* \par Dependencies
*
\verbatim
- STM32Fxxx HAL
- defines.h
\endverbatim
*/
#include "stm32fxxx_hal.h"
#include "defines.h"
/**
* @defgroup TM_RCC_Macros
* @brief RCC Library macros
* @{
*/
/* Set default values if not defined by user */
#if !defined(RCC_OSCILLATORTYPE) || !defined(RCC_PLLM) || !defined(RCC_PLLN) || !defined(RCC_PLLP) || !defined(RCC_PLLQ)
#define RCC_OSCILLATORTYPE RCC_OSCILLATORTYPE_HSE
#define RCC_PLLM 8
#define RCC_PLLN 360
#define RCC_PLLP 2
#define RCC_PLLQ 7
#endif
/**
* @}
*/
/**
* @defgroup TM_RCC_Typedefs
* @brief RCC Typedefs used for RCC library for initialization purposes
* @{
*/
/**
* @brief RCC result enumeration
*/
typedef enum {
TM_RCC_Result_Ok = 0x00, /*!< Everything OK */
TM_RCC_Result_Error /*!< An error occurred */
} TM_RCC_Result_t;
/**
* @} TM_RCC_Typedefs
*/
/**
* @defgroup TM_RCC_Functions
* @brief RCC Functions
* @{
*/
/**
* @brief Initializes system clocks
* @note This function should be called on the start of main program
* @note When STM32F7xx target is used, D and I caches are also enabled with this function
* @param None
* @retval RCC System status
*/
TM_RCC_Result_t TM_RCC_InitSystem(void);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/* C++ detection */
#ifdef __cplusplus
}
#endif
#endif