-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclock_efm32gg_ext.h
70 lines (60 loc) · 3.1 KB
/
clock_efm32gg_ext.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
#ifndef SYSTEM_EFM32GG_EXT_H
#define SYSTEM_EFM32GG_EXT_H
/** ***************************************************************************
* @file system_efm32gg-ext.h
* @brief Additional CMSIS-like routines for Cortex-M3 System Layer for
* EFM32GG devices.
* @version 1.0
* @author Hans
*
*****************************************************************************/
/**
* @brief Clock Source
*
* @note Used by SystemCoreClockSet and ClockGetConfiguration
*/
typedef enum { CLOCK_NONE=0,
CLOCK_LFXO, ///< Low Frequency Crystal Oscillator: 32768 Hz
CLOCK_LFRCO, ///< Low Frequency Internal RC Oscillator: 32768 Hz
CLOCK_HFRCO_1MHZ, ///< High Frequency Internal RC Oscillator: 1 MHz
CLOCK_HFRCO_7MHZ, ///< High Frequency Internal RC Oscillator: 7 or 6.6 MHz
CLOCK_HFRCO_11MHZ, ///< High Frequency Internal RC Oscillator: 11 MHz
CLOCK_HFRCO_14MHZ, ///< High Frequency Internal RC Oscillator: 14 MHz (default)
CLOCK_HFRCO_21MHZ, ///< High Frequency Internal RC Oscillator: 21 MHz
CLOCK_HFRCO_28MHZ, ///< High Frequency Internal RC Oscillator: 28 MHz
CLOCK_HFXO, ///< High Frequency Crystall Oscillator: 48 MHz (STK3700)
// Below only for Low Frequency Clock A and B
CLOCK_ULFRCO, ///< Ultra Low Frequency
CLOCK_HFCORECLOCK_2 ///< HF Core Clock divided by 2
} ClockSource_t;
/**
* @brief Clock Configuration Structure
*
* @note Used by ClockGetConfiguration
* @note Will be used by ClockSetConfiguration
*/
typedef struct {
///@{
/* Configuration info. Used by ClockSetConfiguration */
ClockSource_t source; ///< HFCLK clock source
uint32_t basefreq; ///< Base frequency of clock source
uint32_t hclkdiv; ///< Divisor of base frequency to generate HFCLK
uint32_t corediv; ///< Divisor of HFCLK to generate Core Clock
uint32_t perdiv; ///< Divisor of HFCLK to generate Peripheral Clock
///@}
///@{
/* For info only. Not used by ClockSetConfiguration */
uint32_t hclkfreq; ///@< =HFCLK/hclkdiv
uint32_t corefreq; ///@< =HFCLK/hclkdiv/corediv
uint32_t perfreq; ///@< =HFCLK/hclkdiv/perdiv
///@}
} ClockConfiguration_t;
/* CMSIS Like */
uint32_t SystemCoreClockSet(ClockSource_t source, uint32_t hclkdiv, uint32_t corediv);
uint32_t ClockGetConfiguration(ClockConfiguration_t *p);
uint32_t ClockConfigureForFrequency(uint32_t freq);
uint32_t ClockSetHFClockDivisor(uint32_t div);
uint32_t ClockSetPrescalers(uint32_t corediv, uint32_t perdiv);
uint32_t ClockGetPeripheralClockFrequency(void);
uint32_t ClockGetCoreClockFrequency(void);
#endif //SYSTEM_EFM32GG_EXT_H