OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [CORTEX_STM32F103_IAR/] [STM32F10xFWLib/] [inc/] [stm32f10x_rcc.h] - Blame information for rev 596

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 582 jeremybenn
/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
2
* File Name          : stm32f10x_rcc.h
3
* Author             : MCD Application Team
4
* Date First Issued  : 09/29/2006
5
* Description        : This file contains all the functions prototypes for the
6
*                      RCC firmware library.
7
********************************************************************************
8
* History:
9
* 04/02/2007: V0.2
10
* 02/05/2007: V0.1
11
* 09/29/2006: V0.01
12
********************************************************************************
13
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
14
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
15
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
16
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
17
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
18
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19
*******************************************************************************/
20
 
21
/* Define to prevent recursive inclusion -------------------------------------*/
22
#ifndef __STM32F10x_RCC_H
23
#define __STM32F10x_RCC_H
24
 
25
/* Includes ------------------------------------------------------------------*/
26
#include "stm32f10x_map.h"
27
 
28
/* Exported types ------------------------------------------------------------*/
29
typedef struct
30
{
31
  u32 SYSCLK_Frequency;
32
  u32 HCLK_Frequency;
33
  u32 PCLK1_Frequency;
34
  u32 PCLK2_Frequency;
35
  u32 ADCCLK_Frequency;
36
}RCC_ClocksTypeDef;
37
 
38
/* Exported constants --------------------------------------------------------*/
39
/* HSE configuration */
40
#define RCC_HSE_OFF                      ((u32)0x00000000)
41
#define RCC_HSE_ON                       ((u32)0x00010000)
42
#define RCC_HSE_Bypass                   ((u32)0x00040000)
43
 
44
#define IS_RCC_HSE(HSE) ((HSE == RCC_HSE_OFF) || (HSE == RCC_HSE_ON) || \
45
                         (HSE == RCC_HSE_Bypass))
46
 
47
/* PLL entry clock source */
48
#define RCC_PLLSource_HSI_Div2           ((u32)0x00000000)
49
#define RCC_PLLSource_HSE_Div1           ((u32)0x00010000)
50
#define RCC_PLLSource_HSE_Div2           ((u32)0x00030000)
51
 
52
#define IS_RCC_PLL_SOURCE(SOURCE) ((SOURCE == RCC_PLLSource_HSI_Div2) || \
53
                                   (SOURCE == RCC_PLLSource_HSE_Div1) || \
54
                                   (SOURCE == RCC_PLLSource_HSE_Div2))
55
 
56
/* PLL multiplication factor */
57
#define RCC_PLLMul_2                     ((u32)0x00000000)
58
#define RCC_PLLMul_3                     ((u32)0x00040000)
59
#define RCC_PLLMul_4                     ((u32)0x00080000)
60
#define RCC_PLLMul_5                     ((u32)0x000C0000)
61
#define RCC_PLLMul_6                     ((u32)0x00100000)
62
#define RCC_PLLMul_7                     ((u32)0x00140000)
63
#define RCC_PLLMul_8                     ((u32)0x00180000)
64
#define RCC_PLLMul_9                     ((u32)0x001C0000)
65
#define RCC_PLLMul_10                    ((u32)0x00200000)
66
#define RCC_PLLMul_11                    ((u32)0x00240000)
67
#define RCC_PLLMul_12                    ((u32)0x00280000)
68
#define RCC_PLLMul_13                    ((u32)0x002C0000)
69
#define RCC_PLLMul_14                    ((u32)0x00300000)
70
#define RCC_PLLMul_15                    ((u32)0x00340000)
71
#define RCC_PLLMul_16                    ((u32)0x00380000)
72
 
73
#define IS_RCC_PLL_MUL(MUL) ((MUL == RCC_PLLMul_2) || (MUL == RCC_PLLMul_3)   ||\
74
                             (MUL == RCC_PLLMul_4) || (MUL == RCC_PLLMul_5)   ||\
75
                             (MUL == RCC_PLLMul_6) || (MUL == RCC_PLLMul_7)   ||\
76
                             (MUL == RCC_PLLMul_8) || (MUL == RCC_PLLMul_9)   ||\
77
                             (MUL == RCC_PLLMul_10) || (MUL == RCC_PLLMul_11) ||\
78
                             (MUL == RCC_PLLMul_12) || (MUL == RCC_PLLMul_13) ||\
79
                             (MUL == RCC_PLLMul_14) || (MUL == RCC_PLLMul_15) ||\
80
                             (MUL == RCC_PLLMul_16))
81
 
82
/* System clock source */
83
#define RCC_SYSCLKSource_HSI             ((u32)0x00000000)
84
#define RCC_SYSCLKSource_HSE             ((u32)0x00000001)
85
#define RCC_SYSCLKSource_PLLCLK          ((u32)0x00000002)
86
 
87
#define IS_RCC_SYSCLK_SOURCE(SOURCE) ((SOURCE == RCC_SYSCLKSource_HSI) || \
88
                                      (SOURCE == RCC_SYSCLKSource_HSE) || \
89
                                      (SOURCE == RCC_SYSCLKSource_PLLCLK))
90
 
91
/* AHB clock source */
92
#define RCC_SYSCLK_Div1                  ((u32)0x00000000)
93
#define RCC_SYSCLK_Div2                  ((u32)0x00000080)
94
#define RCC_SYSCLK_Div4                  ((u32)0x00000090)
95
#define RCC_SYSCLK_Div8                  ((u32)0x000000A0)
96
#define RCC_SYSCLK_Div16                 ((u32)0x000000B0)
97
#define RCC_SYSCLK_Div64                 ((u32)0x000000C0)
98
#define RCC_SYSCLK_Div128                ((u32)0x000000D0)
99
#define RCC_SYSCLK_Div256                ((u32)0x000000E0)
100
#define RCC_SYSCLK_Div512                ((u32)0x000000F0)
101
 
102
#define IS_RCC_HCLK(HCLK) ((HCLK == RCC_SYSCLK_Div1) || (HCLK == RCC_SYSCLK_Div2) || \
103
                           (HCLK == RCC_SYSCLK_Div4) || (HCLK == RCC_SYSCLK_Div8) || \
104
                           (HCLK == RCC_SYSCLK_Div16) || (HCLK == RCC_SYSCLK_Div64) || \
105
                           (HCLK == RCC_SYSCLK_Div128) || (HCLK == RCC_SYSCLK_Div256) || \
106
                           (HCLK == RCC_SYSCLK_Div512))
107
 
108
/* APB1/APB2 clock source */
109
#define RCC_HCLK_Div1                    ((u32)0x00000000)
110
#define RCC_HCLK_Div2                    ((u32)0x00000400)
111
#define RCC_HCLK_Div4                    ((u32)0x00000500)
112
#define RCC_HCLK_Div8                    ((u32)0x00000600)
113
#define RCC_HCLK_Div16                   ((u32)0x00000700)
114
 
115
#define IS_RCC_PCLK(PCLK) ((PCLK == RCC_HCLK_Div1) || (PCLK == RCC_HCLK_Div2) || \
116
                           (PCLK == RCC_HCLK_Div4) || (PCLK == RCC_HCLK_Div8) || \
117
                           (PCLK == RCC_HCLK_Div16))
118
 
119
/* RCC Interrupt source */
120
#define RCC_IT_LSIRDY                    ((u8)0x01)
121
#define RCC_IT_LSERDY                    ((u8)0x02)
122
#define RCC_IT_HSIRDY                    ((u8)0x04)
123
#define RCC_IT_HSERDY                    ((u8)0x08)
124
#define RCC_IT_PLLRDY                    ((u8)0x10)
125
#define RCC_IT_CSS                       ((u8)0x80)
126
 
127
#define IS_RCC_IT(IT) (((IT & (u8)0xE0) == 0x00) && (IT != 0x00))
128
#define IS_RCC_GET_IT(IT) ((IT == RCC_IT_LSIRDY) || (IT == RCC_IT_LSERDY) || \
129
                           (IT == RCC_IT_HSIRDY) || (IT == RCC_IT_HSERDY) || \
130
                           (IT == RCC_IT_PLLRDY) || (IT == RCC_IT_CSS))
131
#define IS_RCC_CLEAR_IT(IT) (((IT & (u8)0x60) == 0x00) && (IT != 0x00))
132
 
133
/* USB clock source */
134
#define RCC_USBCLKSource_PLLCLK_1Div5    ((u8)0x00)
135
#define RCC_USBCLKSource_PLLCLK_Div1     ((u8)0x01)
136
 
137
#define IS_RCC_USBCLK_SOURCE(SOURCE) ((SOURCE == RCC_USBCLKSource_PLLCLK_1Div5) || \
138
                                      (SOURCE == RCC_USBCLKSource_PLLCLK_Div1))
139
 
140
/* ADC clock source */
141
#define RCC_PCLK2_Div2                   ((u32)0x00000000)
142
#define RCC_PCLK2_Div4                   ((u32)0x00004000)
143
#define RCC_PCLK2_Div6                   ((u32)0x00008000)
144
#define RCC_PCLK2_Div8                   ((u32)0x0000C000)
145
 
146
#define IS_RCC_ADCCLK(ADCCLK) ((ADCCLK == RCC_PCLK2_Div2) || (ADCCLK == RCC_PCLK2_Div4) || \
147
                               (ADCCLK == RCC_PCLK2_Div6) || (ADCCLK == RCC_PCLK2_Div8))
148
 
149
/* LSE configuration */
150
#define RCC_LSE_OFF                      ((u8)0x00)
151
#define RCC_LSE_ON                       ((u8)0x01)
152
#define RCC_LSE_Bypass                   ((u8)0x04)
153
 
154
#define IS_RCC_LSE(LSE) ((LSE == RCC_LSE_OFF) || (LSE == RCC_LSE_ON) || \
155
                         (LSE == RCC_LSE_Bypass))
156
 
157
/* RTC clock source */
158
#define RCC_RTCCLKSource_LSE             ((u32)0x00000100)
159
#define RCC_RTCCLKSource_LSI             ((u32)0x00000200)
160
#define RCC_RTCCLKSource_HSE_Div128      ((u32)0x00000300)
161
 
162
#define IS_RCC_RTCCLK_SOURCE(SOURCE) ((SOURCE == RCC_RTCCLKSource_LSE) || \
163
                                      (SOURCE == RCC_RTCCLKSource_LSI) || \
164
                                      (SOURCE == RCC_RTCCLKSource_HSE_Div128))
165
 
166
/* AHB peripheral */
167
#define RCC_AHBPeriph_DMA                ((u32)0x00000001)
168
#define RCC_AHBPeriph_SRAM               ((u32)0x00000004)
169
#define RCC_AHBPeriph_FLITF              ((u32)0x00000010)
170
 
171
#define IS_RCC_AHB_PERIPH(PERIPH) (((PERIPH & 0xFFFFFFEA) == 0x00) && (PERIPH != 0x00))
172
 
173
/* APB2 peripheral */
174
#define RCC_APB2Periph_AFIO              ((u32)0x00000001)
175
#define RCC_APB2Periph_GPIOA             ((u32)0x00000004)
176
#define RCC_APB2Periph_GPIOB             ((u32)0x00000008)
177
#define RCC_APB2Periph_GPIOC             ((u32)0x00000010)
178
#define RCC_APB2Periph_GPIOD             ((u32)0x00000020)
179
#define RCC_APB2Periph_GPIOE             ((u32)0x00000040)
180
#define RCC_APB2Periph_ADC1              ((u32)0x00000200)
181
#define RCC_APB2Periph_ADC2              ((u32)0x00000400)
182
#define RCC_APB2Periph_TIM1              ((u32)0x00000800)
183
#define RCC_APB2Periph_SPI1              ((u32)0x00001000)
184
#define RCC_APB2Periph_USART1            ((u32)0x00004000)
185
#define RCC_APB2Periph_ALL               ((u32)0x00005E7D)
186
 
187
#define IS_RCC_APB2_PERIPH(PERIPH) (((PERIPH & 0xFFFFA182) == 0x00) && (PERIPH != 0x00))
188
 
189
/* APB1 peripheral */
190
#define RCC_APB1Periph_TIM2              ((u32)0x00000001)
191
#define RCC_APB1Periph_TIM3              ((u32)0x00000002)
192
#define RCC_APB1Periph_TIM4              ((u32)0x00000004)
193
#define RCC_APB1Periph_WWDG              ((u32)0x00000800)
194
#define RCC_APB1Periph_SPI2              ((u32)0x00004000)
195
#define RCC_APB1Periph_USART2            ((u32)0x00020000)
196
#define RCC_APB1Periph_USART3            ((u32)0x00040000)
197
#define RCC_APB1Periph_I2C1              ((u32)0x00200000)
198
#define RCC_APB1Periph_I2C2              ((u32)0x00400000)
199
#define RCC_APB1Periph_USB               ((u32)0x00800000)
200
#define RCC_APB1Periph_CAN               ((u32)0x02000000)
201
#define RCC_APB1Periph_BKP               ((u32)0x08000000)
202
#define RCC_APB1Periph_PWR               ((u32)0x10000000)
203
#define RCC_APB1Periph_ALL               ((u32)0x1AE64807)
204
 
205
#define IS_RCC_APB1_PERIPH(PERIPH) (((PERIPH & 0xE519B7F8) == 0x00) && (PERIPH != 0x00))
206
 
207
/* Clock source to output on MCO pin */
208
#define RCC_MCO_NoClock                  ((u8)0x00)
209
#define RCC_MCO_SYSCLK                   ((u8)0x04)
210
#define RCC_MCO_HSI                      ((u8)0x05)
211
#define RCC_MCO_HSE                      ((u8)0x06)
212
#define RCC_MCO_PLLCLK_Div2              ((u8)0x07)
213
 
214
#define IS_RCC_MCO(MCO) ((MCO == RCC_MCO_NoClock) || (MCO == RCC_MCO_HSI) || \
215
                         (MCO == RCC_MCO_SYSCLK)  || (MCO == RCC_MCO_HSE) || \
216
                         (MCO == RCC_MCO_PLLCLK_Div2))
217
 
218
/* RCC Flag */
219
#define RCC_FLAG_HSIRDY                  ((u8)0x20)
220
#define RCC_FLAG_HSERDY                  ((u8)0x31)
221
#define RCC_FLAG_PLLRDY                  ((u8)0x39)
222
#define RCC_FLAG_LSERDY                  ((u8)0x41)
223
#define RCC_FLAG_LSIRDY                  ((u8)0x61)
224
#define RCC_FLAG_PINRST                  ((u8)0x7A)
225
#define RCC_FLAG_PORRST                  ((u8)0x7B)
226
#define RCC_FLAG_SFTRST                  ((u8)0x7C)
227
#define RCC_FLAG_IWDGRST                 ((u8)0x7D)
228
#define RCC_FLAG_WWDGRST                 ((u8)0x7E)
229
#define RCC_FLAG_LPWRRST                 ((u8)0x7F)
230
 
231
#define IS_RCC_FLAG(FLAG) ((FLAG == RCC_FLAG_HSIRDY) || (FLAG == RCC_FLAG_HSERDY) || \
232
                           (FLAG == RCC_FLAG_PLLRDY) || (FLAG == RCC_FLAG_LSERDY) || \
233
                           (FLAG == RCC_FLAG_LSIRDY) || (FLAG == RCC_FLAG_PINRST) || \
234
                           (FLAG == RCC_FLAG_PORRST) || (FLAG == RCC_FLAG_SFTRST) || \
235
                           (FLAG == RCC_FLAG_IWDGRST)|| (FLAG == RCC_FLAG_WWDGRST)|| \
236
                           (FLAG == RCC_FLAG_LPWRRST))
237
 
238
#define IS_RCC_CALIBRATION_VALUE(VALUE) (VALUE <= 0x1F)
239
 
240
/* Exported macro ------------------------------------------------------------*/
241
/* Exported functions ------------------------------------------------------- */
242
void RCC_DeInit(void);
243
void RCC_HSEConfig(u32 RCC_HSE);
244
void RCC_AdjustHSICalibrationValue(u8 HSICalibrationValue);
245
void RCC_HSICmd(FunctionalState NewState);
246
void RCC_PLLConfig(u32 RCC_PLLSource, u32 RCC_PLLMul);
247
void RCC_PLLCmd(FunctionalState NewState);
248
void RCC_SYSCLKConfig(u32 RCC_SYSCLKSource);
249
u8 RCC_GetSYSCLKSource(void);
250
void RCC_HCLKConfig(u32 RCC_HCLK);
251
void RCC_PCLK1Config(u32 RCC_PCLK1);
252
void RCC_PCLK2Config(u32 RCC_PCLK2);
253
void RCC_ITConfig(u8 RCC_IT, FunctionalState NewState);
254
void RCC_USBCLKConfig(u32 RCC_USBCLKSource);
255
void RCC_ADCCLKConfig(u32 RCC_ADCCLK);
256
void RCC_LSEConfig(u32 RCC_LSE);
257
void RCC_LSICmd(FunctionalState NewState);
258
void RCC_RTCCLKConfig(u32 RCC_RTCCLKSource);
259
void RCC_RTCCLKCmd(FunctionalState NewState);
260
void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks);
261
void RCC_AHBPeriphClockCmd(u32 RCC_AHBPeriph, FunctionalState NewState);
262
void RCC_APB2PeriphClockCmd(u32 RCC_APB2Periph, FunctionalState NewState);
263
void RCC_APB1PeriphClockCmd(u32 RCC_APB1Periph, FunctionalState NewState);
264
void RCC_APB2PeriphResetCmd(u32 RCC_APB2Periph, FunctionalState NewState);
265
void RCC_APB1PeriphResetCmd(u32 RCC_APB1Periph, FunctionalState NewState);
266
void RCC_BackupResetCmd(FunctionalState NewState);
267
void RCC_ClockSecuritySystemCmd(FunctionalState NewState);
268
void RCC_MCOConfig(u8 RCC_MCO);
269
FlagStatus RCC_GetFlagStatus(u8 RCC_FLAG);
270
void RCC_ClearFlag(void);
271
ITStatus RCC_GetITStatus(u8 RCC_IT);
272
void RCC_ClearITPendingBit(u8 RCC_IT);
273
 
274
#endif /* __STM32F10x_RCC_H */
275
 
276
/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.