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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM7_STR75x_IAR/] [STLibrary/] [inc/] [75x_mrcc.h] - Blame information for rev 609

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

Line No. Rev Author Line
1 577 jeremybenn
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
2
* File Name          : 75x_mrcc.h
3
* Author             : MCD Application Team
4
* Date First Issued  : 03/10/2006
5
* Description        : This file contains all the functions prototypes for the
6
*                      MRCC software library.
7
********************************************************************************
8
* History:
9
* 07/17/2006 : V1.0
10
* 03/10/2006 : V0.1
11
********************************************************************************
12
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
14
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
15
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
16
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
17
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18
*******************************************************************************/
19
 
20
/* Define to prevent recursive inclusion -------------------------------------*/
21
#ifndef __75x_MRCC_H
22
#define __75x_MRCC_H
23
 
24
/* Includes ------------------------------------------------------------------*/
25
#include "75x_map.h"
26
 
27
/* Exported types ------------------------------------------------------------*/
28
/* MRCC Buck-up registers */
29
typedef enum
30
{
31
  MRCC_BKP0,
32
  MRCC_BKP1
33
}MRCC_BKPReg;
34
 
35
typedef enum
36
{
37
  FREEOSC,
38
  OSC4MPLL,
39
  OSC4M,
40
  CKRTC,
41
  Disabled,
42
  OSC4M_Div128,
43
  LPOSC,
44
  OSC32K,
45
  Internal,
46
  External,
47
  ON,
48
  OFF
49
}CLKSourceTypeDef;
50
 
51
 
52
typedef struct
53
{
54
  CLKSourceTypeDef CKSYS_Source;  /* FREEOSC, OSC4MPLL, OSC4M, CKRTC */
55
  CLKSourceTypeDef CKRTC_Source;  /* Disabled, OSC4M_Div128, OSC32K, LPOSC */
56
  CLKSourceTypeDef CKUSB_Source;  /* Disabled, Internal, External */
57
  CLKSourceTypeDef PLL_Status;    /* ON, OFF */
58
  CLKSourceTypeDef OSC4M_Status;  /* ON, OFF */
59
  CLKSourceTypeDef LPOSC_Status;  /* ON, OFF */
60
  CLKSourceTypeDef OSC32K_Status; /* ON, OFF */
61
  u32 CKSYS_Frequency;
62
  u32 HCLK_Frequency;
63
  u32 CKTIM_Frequency;
64
  u32 PCLK_Frequency;
65
}MRCC_ClocksTypeDef;
66
 
67
/* Exported constants --------------------------------------------------------*/
68
/* Oscillator divider by 2 */
69
#define MRCC_XTDIV2_Disable    0xFFFF7FFF
70
#define MRCC_XTDIV2_Enable     0x00008000
71
 
72
/* System clock source */
73
#define MRCC_CKSYS_FREEOSC     0x01
74
#define MRCC_CKSYS_OSC4M       0x02
75
#define MRCC_CKSYS_OSC4MPLL    0x03
76
#define MRCC_CKSYS_RTC         0x04
77
 
78
/* PLL multiplication factors */
79
#define MRCC_PLL_Disabled    0xFEFFFFFF
80
#define MRCC_PLL_NoChange    0x00000001
81
#define MRCC_PLL_Mul_12      0x18000000
82
#define MRCC_PLL_Mul_14      0x10000000
83
#define MRCC_PLL_Mul_15      0x08000000
84
#define MRCC_PLL_Mul_16      0x00000000
85
 
86
/* AHB clock source */
87
#define MRCC_CKSYS_Div1    0x00000000
88
#define MRCC_CKSYS_Div2    0x00000008
89
#define MRCC_CKSYS_Div4    0x00000010
90
#define MRCC_CKSYS_Div8    0x00000018
91
 
92
/* TIM clock source */
93
#define MRCC_HCLK_Div1    0x00000000
94
#define MRCC_HCLK_Div2    0x00000001
95
#define MRCC_HCLK_Div4    0x00000002
96
#define MRCC_HCLK_Div8    0x00000003
97
 
98
/* APB clock source */
99
#define MRCC_CKTIM_Div1    0xFFFFFFFB
100
#define MRCC_CKTIM_Div2    0x00000004
101
 
102
/* RTC clock sources */
103
#define MRCC_CKRTC_OSC4M_Div128    0x01000000
104
#define MRCC_CKRTC_OSC32K          0x02000000
105
#define MRCC_CKRTC_LPOSC           0x03000000
106
 
107
/* USB clock sources */
108
#define MRCC_CKUSB_Internal    0xFFBFFFFF
109
#define MRCC_CKUSB_External    0x00400000
110
 
111
/* MRCC Interrupts */
112
#define MRCC_IT_LOCK    0x40000000
113
#define MRCC_IT_NCKD    0x00080000
114
 
115
/* Peripheral Clock */
116
#define MRCC_Peripheral_ALL      0x1975623F
117
#define MRCC_Peripheral_EXTIT    0x10000000
118
#define MRCC_Peripheral_RTC      0x08000000
119
#define MRCC_Peripheral_GPIO     0x01000000
120
#define MRCC_Peripheral_UART2    0x00400000
121
#define MRCC_Peripheral_UART1    0x00200000
122
#define MRCC_Peripheral_UART0    0x00100000
123
#define MRCC_Peripheral_I2C      0x00040000
124
#define MRCC_Peripheral_CAN      0x00010000
125
#define MRCC_Peripheral_SSP1     0x00004000
126
#define MRCC_Peripheral_SSP0     0x00002000
127
#define MRCC_Peripheral_USB      0x00000200
128
#define MRCC_Peripheral_PWM      0x00000020
129
#define MRCC_Peripheral_TIM2     0x00000010
130
#define MRCC_Peripheral_TIM1     0x00000008
131
#define MRCC_Peripheral_TIM0     0x00000004
132
#define MRCC_Peripheral_TB       0x00000002
133
#define MRCC_Peripheral_ADC      0x00000001
134
 
135
/* Clock sources to measure theire frequency */
136
#define MRCC_ClockSource_CKSYS    0x01
137
#define MRCC_ClockSource_HCLK     0x02
138
#define MRCC_ClockSource_PCLK     0x03
139
#define MRCC_ClockSource_CKTIM    0x04
140
 
141
/* Low Power Debug Mode */
142
#define MRCC_LPDM_Disable    0xFFFFFFF7
143
#define MRCC_LPDM_Enable     0x00000008
144
 
145
/* WFI Mode parameters */
146
#define MRCC_WFIParam_FLASHPowerDown    0x00000000
147
#define MRCC_WFIParam_FLASHOn           0x00000010
148
#define MRCC_WFIParam_FLASHOff          0x00004000
149
 
150
/* STOP Mode parameters */
151
#define MRCC_STOPParam_Default     0x00000000
152
#define MRCC_STOPParam_OSC4MOff    0x00008000
153
#define MRCC_STOPParam_FLASHOff    0x00004000
154
#define MRCC_STOPParam_MVREGOff    0x00002000
155
 
156
/* I/O Pins voltage range */
157
#define MRCC_IOVoltageRange_5V     0xFFFEFFFF
158
#define MRCC_IOVoltageRange_3V3    0x00010000
159
 
160
/* Clock sources to output on MCO pin */
161
#define MRCC_MCO_HCLK          0x00000000
162
#define MRCC_MCO_PCLK          0x00000040
163
#define MRCC_MCO_OSC4M         0x00000080
164
#define MRCC_MCO_CKPLL2        0x000000C0
165
#define MRCC_MCOPrescaler_1    0xFFFFFFDF
166
#define MRCC_MCOPrescaler_2    0x00000020
167
 
168
/* 4MHz main oscillator configuration */
169
#define MRCC_OSC4M_Default    0xFFFCFFFF
170
#define MRCC_OSC4M_Disable    0x00020000
171
#define MRCC_OSC4M_Bypass     0x00010000
172
 
173
/* OSC32K oscillator configuration */
174
#define MRCC_OSC32K_Disable          0xDFFFFFFF
175
#define MRCC_OSC32K_Enable           0x20000000
176
#define MRCC_OSC32KBypass_Disable    0xBFFFFFFF
177
#define MRCC_OSC32KBypass_Enable     0x40000000
178
 
179
/* LPOSC oscillator configuration */
180
#define MRCC_LPOSC_Disable    0xEFFFFFFF
181
#define MRCC_LPOSC_Enable     0x10000000
182
 
183
/* RTC measurement configuration */
184
#define MRCC_RTCM_Disable    0xFBFFFFFF
185
#define MRCC_RTCM_Enable     0x04000000
186
 
187
/* MRCC Flags */
188
#define MRCC_FLAG_LOCK         0x3F
189
#define MRCC_FLAG_LOCKIF       0x3D
190
#define MRCC_FLAG_CKSEL        0x37
191
#define MRCC_FLAG_CKOSCSEL     0x35
192
#define MRCC_FLAG_NCKD         0x32
193
#define MRCC_FLAG_SWR          0x5D
194
#define MRCC_FLAG_WDGR         0x5C
195
#define MRCC_FLAG_EXTR         0x5B
196
#define MRCC_FLAG_WKP          0x5A
197
#define MRCC_FLAG_STDB         0x59
198
#define MRCC_FLAG_BCOUNT       0x58
199
#define MRCC_FLAG_OSC32KRDY    0x7F
200
#define MRCC_FLAG_CKRTCOK      0x7B
201
#define MRCC_FLAG_LPDONE       0x67
202
#define MRCC_FLAG_LP           0x60
203
 
204
/* Exported macro ------------------------------------------------------------*/
205
/* Exported functions ------------------------------------------------------- */
206
void MRCC_DeInit(void);
207
void MRCC_XTDIV2Config(u32 MRCC_XTDIV2);
208
ErrorStatus MRCC_CKSYSConfig(u32 MRCC_CKSYS, u32 MRCC_PLL);
209
void MRCC_HCLKConfig(u32 MRCC_HCLK);
210
void MRCC_CKTIMConfig(u32 MRCC_CKTIM);
211
void MRCC_PCLKConfig(u32 MRCC_PCLK);
212
ErrorStatus MRCC_CKRTCConfig(u32 MRCC_CKRTC);
213
ErrorStatus MRCC_CKUSBConfig(u32 MRCC_CKUSB);
214
void MRCC_ITConfig(u32 MRCC_IT, FunctionalState NewState);
215
void MRCC_PeripheralClockConfig(u32 MRCC_Peripheral, FunctionalState NewState);
216
void MRCC_PeripheralSWResetConfig(u32 MRCC_Peripheral, FunctionalState NewState);
217
void MRCC_GetClocksStatus(MRCC_ClocksTypeDef*  MRCC_ClocksStatus);
218
void MRCC_LPMC_DBGConfig(u32 MRCC_LPDM);
219
void MRCC_EnterWFIMode(u32 MRCC_WFIParam);
220
void MRCC_EnterSTOPMode(u32 MRCC_STOPParam);
221
void MRCC_EnterSTANDBYMode(void);
222
void MRCC_GenerateSWReset(void);
223
void MRCC_WriteBackupRegister(MRCC_BKPReg MRCC_BKP, u32 Data);
224
u32 MRCC_ReadBackupRegister(MRCC_BKPReg MRCC_BKP);
225
void MRCC_IOVoltageRangeConfig(u32 MRCC_IOVoltageRange);
226
void MRCC_MCOConfig(u32 MRCC_MCO, u32 MCO_MCOPrescaler);
227
ErrorStatus MRCC_OSC4MConfig(u32 MRCC_OSC4M);
228
ErrorStatus MRCC_OSC32KConfig(u32 MRCC_OSC32K, u32 MRCC_OSC32KBypass);
229
ErrorStatus MRCC_LPOSCConfig(u32 MRCC_LPOSC);
230
void MRCC_RTCMConfig(u32 MRCC_RTCM);
231
void MRCC_SetBuilderCounter(u8 BuilderCounter);
232
u16 MRCC_GetCKSYSCounter(void);
233
FlagStatus MRCC_GetFlagStatus(u8 MRCC_FLAG);
234
void MRCC_ClearFlag(u8 MRCC_FLAG);
235
ITStatus MRCC_GetITStatus(u32 MRCC_IT);
236
void MRCC_ClearITPendingBit(u32 MRCC_IT);
237
ErrorStatus MRCC_WaitForOSC4MStartUp(void);
238
 
239
#endif /* __75x_MRCC_H */
240
 
241
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/

powered by: WebSVN 2.1.0

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