mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/hal/TARGET_Freescale/TARGET_KSDK_MCUS/TARGET_K64F/device/MK64F12/system_MK64F12.h@146:f64d43ff0c18, 2014-04-02 (annotated)
- Committer:
- mbed_official
- Date:
- Wed Apr 02 21:00:08 2014 +0100
- Revision:
- 146:f64d43ff0c18
Synchronized with git revision d537c51d26da35e031d537f7fc90380fc74cb207
Full URL: https://github.com/mbedmicro/mbed/commit/d537c51d26da35e031d537f7fc90380fc74cb207/
target K64F
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 146:f64d43ff0c18 | 1 | /* |
mbed_official | 146:f64d43ff0c18 | 2 | ** ################################################################### |
mbed_official | 146:f64d43ff0c18 | 3 | ** Processor: MK64FN1M0VMD12 |
mbed_official | 146:f64d43ff0c18 | 4 | ** Compilers: ARM Compiler |
mbed_official | 146:f64d43ff0c18 | 5 | ** Freescale C/C++ for Embedded ARM |
mbed_official | 146:f64d43ff0c18 | 6 | ** GNU C Compiler |
mbed_official | 146:f64d43ff0c18 | 7 | ** GNU C Compiler - CodeSourcery Sourcery G++ |
mbed_official | 146:f64d43ff0c18 | 8 | ** IAR ANSI C/C++ Compiler for ARM |
mbed_official | 146:f64d43ff0c18 | 9 | ** |
mbed_official | 146:f64d43ff0c18 | 10 | ** Reference manual: K64P144M120SF5RM, Rev.2, January 2014 |
mbed_official | 146:f64d43ff0c18 | 11 | ** Version: rev. 2.3, 2014-01-24 |
mbed_official | 146:f64d43ff0c18 | 12 | ** |
mbed_official | 146:f64d43ff0c18 | 13 | ** Abstract: |
mbed_official | 146:f64d43ff0c18 | 14 | ** Provides a system configuration function and a global variable that |
mbed_official | 146:f64d43ff0c18 | 15 | ** contains the system frequency. It configures the device and initializes |
mbed_official | 146:f64d43ff0c18 | 16 | ** the oscillator (PLL) that is part of the microcontroller device. |
mbed_official | 146:f64d43ff0c18 | 17 | ** |
mbed_official | 146:f64d43ff0c18 | 18 | ** Copyright: 2014 Freescale, Inc. All Rights Reserved. |
mbed_official | 146:f64d43ff0c18 | 19 | ** |
mbed_official | 146:f64d43ff0c18 | 20 | ** http: www.freescale.com |
mbed_official | 146:f64d43ff0c18 | 21 | ** mail: support@freescale.com |
mbed_official | 146:f64d43ff0c18 | 22 | ** |
mbed_official | 146:f64d43ff0c18 | 23 | ** Revisions: |
mbed_official | 146:f64d43ff0c18 | 24 | ** - rev. 1.0 (2013-08-12) |
mbed_official | 146:f64d43ff0c18 | 25 | ** Initial version. |
mbed_official | 146:f64d43ff0c18 | 26 | ** - rev. 2.0 (2013-10-29) |
mbed_official | 146:f64d43ff0c18 | 27 | ** Register accessor macros added to the memory map. |
mbed_official | 146:f64d43ff0c18 | 28 | ** Symbols for Processor Expert memory map compatibility added to the memory map. |
mbed_official | 146:f64d43ff0c18 | 29 | ** Startup file for gcc has been updated according to CMSIS 3.2. |
mbed_official | 146:f64d43ff0c18 | 30 | ** System initialization updated. |
mbed_official | 146:f64d43ff0c18 | 31 | ** MCG - registers updated. |
mbed_official | 146:f64d43ff0c18 | 32 | ** PORTA, PORTB, PORTC, PORTE - registers for digital filter removed. |
mbed_official | 146:f64d43ff0c18 | 33 | ** - rev. 2.1 (2013-10-29) |
mbed_official | 146:f64d43ff0c18 | 34 | ** Definition of BITBAND macros updated to support peripherals with 32-bit acces disabled. |
mbed_official | 146:f64d43ff0c18 | 35 | ** - rev. 2.2 (2013-12-09) |
mbed_official | 146:f64d43ff0c18 | 36 | ** DMA - EARS register removed. |
mbed_official | 146:f64d43ff0c18 | 37 | ** AIPS0, AIPS1 - MPRA register updated. |
mbed_official | 146:f64d43ff0c18 | 38 | ** - rev. 2.3 (2014-01-24) |
mbed_official | 146:f64d43ff0c18 | 39 | ** Update according to reference manual rev. 2 |
mbed_official | 146:f64d43ff0c18 | 40 | ** ENET, MCG, MCM, SIM, USB - registers updated |
mbed_official | 146:f64d43ff0c18 | 41 | ** |
mbed_official | 146:f64d43ff0c18 | 42 | ** ################################################################### |
mbed_official | 146:f64d43ff0c18 | 43 | */ |
mbed_official | 146:f64d43ff0c18 | 44 | |
mbed_official | 146:f64d43ff0c18 | 45 | /*! |
mbed_official | 146:f64d43ff0c18 | 46 | * @file MK64F12 |
mbed_official | 146:f64d43ff0c18 | 47 | * @version 2.3 |
mbed_official | 146:f64d43ff0c18 | 48 | * @date 2014-01-24 |
mbed_official | 146:f64d43ff0c18 | 49 | * @brief Device specific configuration file for MK64F12 (header file) |
mbed_official | 146:f64d43ff0c18 | 50 | * |
mbed_official | 146:f64d43ff0c18 | 51 | * Provides a system configuration function and a global variable that contains |
mbed_official | 146:f64d43ff0c18 | 52 | * the system frequency. It configures the device and initializes the oscillator |
mbed_official | 146:f64d43ff0c18 | 53 | * (PLL) that is part of the microcontroller device. |
mbed_official | 146:f64d43ff0c18 | 54 | */ |
mbed_official | 146:f64d43ff0c18 | 55 | |
mbed_official | 146:f64d43ff0c18 | 56 | #ifndef SYSTEM_MK64F12_H_ |
mbed_official | 146:f64d43ff0c18 | 57 | #define SYSTEM_MK64F12_H_ /**< Symbol preventing repeated inclusion */ |
mbed_official | 146:f64d43ff0c18 | 58 | |
mbed_official | 146:f64d43ff0c18 | 59 | #ifdef __cplusplus |
mbed_official | 146:f64d43ff0c18 | 60 | extern "C" { |
mbed_official | 146:f64d43ff0c18 | 61 | #endif |
mbed_official | 146:f64d43ff0c18 | 62 | |
mbed_official | 146:f64d43ff0c18 | 63 | #include <stdint.h> |
mbed_official | 146:f64d43ff0c18 | 64 | |
mbed_official | 146:f64d43ff0c18 | 65 | #define DISABLE_WDOG 1 |
mbed_official | 146:f64d43ff0c18 | 66 | |
mbed_official | 146:f64d43ff0c18 | 67 | #ifndef CLOCK_SETUP |
mbed_official | 146:f64d43ff0c18 | 68 | #define CLOCK_SETUP 4 |
mbed_official | 146:f64d43ff0c18 | 69 | #endif |
mbed_official | 146:f64d43ff0c18 | 70 | /* Predefined clock setups |
mbed_official | 146:f64d43ff0c18 | 71 | 0 ... Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode |
mbed_official | 146:f64d43ff0c18 | 72 | Default part configuration. |
mbed_official | 146:f64d43ff0c18 | 73 | Reference clock source for MCG module is the slow internal clock source 32.768kHz |
mbed_official | 146:f64d43ff0c18 | 74 | Core clock = 20.97MHz, BusClock = 20.97MHz |
mbed_official | 146:f64d43ff0c18 | 75 | 1 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode |
mbed_official | 146:f64d43ff0c18 | 76 | Maximum achievable clock frequency configuration. |
mbed_official | 146:f64d43ff0c18 | 77 | Reference clock source for MCG module is an external clock source 50MHz |
mbed_official | 146:f64d43ff0c18 | 78 | Core clock = 120MHz, BusClock = 60MHz |
mbed_official | 146:f64d43ff0c18 | 79 | 2 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power Internal (BLPI) mode |
mbed_official | 146:f64d43ff0c18 | 80 | Core clock/Bus clock derived directly from an fast internal clock 4MHz with no multiplication |
mbed_official | 146:f64d43ff0c18 | 81 | The clock settings is ready for Very Low Power Run mode. |
mbed_official | 146:f64d43ff0c18 | 82 | Core clock = 4MHz, BusClock = 4MHz |
mbed_official | 146:f64d43ff0c18 | 83 | 3 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power External (BLPE) mode |
mbed_official | 146:f64d43ff0c18 | 84 | Core clock/Bus clock derived directly from the RTC oscillator clock source 32.768kHz |
mbed_official | 146:f64d43ff0c18 | 85 | The clock settings is ready for Very Low Power Run mode. |
mbed_official | 146:f64d43ff0c18 | 86 | Core clock = 32.768kHz, BusClock = 32.768kHz |
mbed_official | 146:f64d43ff0c18 | 87 | 4 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode |
mbed_official | 146:f64d43ff0c18 | 88 | USB clock setup |
mbed_official | 146:f64d43ff0c18 | 89 | USB clock divider is set for USB to receive 48MHz input clock. |
mbed_official | 146:f64d43ff0c18 | 90 | Reference clock source for MCG module is an external clock source 50MHz |
mbed_official | 146:f64d43ff0c18 | 91 | USB clock divider is set for USB to receive 48MHz input clock. |
mbed_official | 146:f64d43ff0c18 | 92 | Core clock = 120MHz, BusClock = 60MHz |
mbed_official | 146:f64d43ff0c18 | 93 | */ |
mbed_official | 146:f64d43ff0c18 | 94 | |
mbed_official | 146:f64d43ff0c18 | 95 | /*---------------------------------------------------------------------------- |
mbed_official | 146:f64d43ff0c18 | 96 | Define clock source values |
mbed_official | 146:f64d43ff0c18 | 97 | *----------------------------------------------------------------------------*/ |
mbed_official | 146:f64d43ff0c18 | 98 | #if (CLOCK_SETUP == 0) |
mbed_official | 146:f64d43ff0c18 | 99 | #define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 100 | #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 101 | #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 102 | #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 103 | #define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 104 | #define DEFAULT_SYSTEM_CLOCK 20485760u /* Default System clock value */ |
mbed_official | 146:f64d43ff0c18 | 105 | #elif (CLOCK_SETUP == 1) |
mbed_official | 146:f64d43ff0c18 | 106 | #define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 107 | #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 108 | #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 109 | #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 110 | #define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 111 | #define DEFAULT_SYSTEM_CLOCK 120000000u /* Default System clock value */ |
mbed_official | 146:f64d43ff0c18 | 112 | #elif (CLOCK_SETUP == 2) |
mbed_official | 146:f64d43ff0c18 | 113 | #define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 114 | #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 115 | #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 116 | #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 117 | #define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 118 | #define DEFAULT_SYSTEM_CLOCK 4000000u /* Default System clock value */ |
mbed_official | 146:f64d43ff0c18 | 119 | #elif (CLOCK_SETUP == 3) |
mbed_official | 146:f64d43ff0c18 | 120 | #define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 121 | #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 122 | #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 123 | #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 124 | #define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 125 | #define DEFAULT_SYSTEM_CLOCK 32768u /* Default System clock value */ |
mbed_official | 146:f64d43ff0c18 | 126 | #elif (CLOCK_SETUP == 4) |
mbed_official | 146:f64d43ff0c18 | 127 | #define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 128 | #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 129 | #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 130 | #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 131 | #define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */ |
mbed_official | 146:f64d43ff0c18 | 132 | #define DEFAULT_SYSTEM_CLOCK 120000000u /* Default System clock value */ |
mbed_official | 146:f64d43ff0c18 | 133 | #endif /* (CLOCK_SETUP == 4) */ |
mbed_official | 146:f64d43ff0c18 | 134 | |
mbed_official | 146:f64d43ff0c18 | 135 | |
mbed_official | 146:f64d43ff0c18 | 136 | /** |
mbed_official | 146:f64d43ff0c18 | 137 | * @brief System clock frequency (core clock) |
mbed_official | 146:f64d43ff0c18 | 138 | * |
mbed_official | 146:f64d43ff0c18 | 139 | * The system clock frequency supplied to the SysTick timer and the processor |
mbed_official | 146:f64d43ff0c18 | 140 | * core clock. This variable can be used by the user application to setup the |
mbed_official | 146:f64d43ff0c18 | 141 | * SysTick timer or configure other parameters. It may also be used by debugger to |
mbed_official | 146:f64d43ff0c18 | 142 | * query the frequency of the debug timer or configure the trace clock speed |
mbed_official | 146:f64d43ff0c18 | 143 | * SystemCoreClock is initialized with a correct predefined value. |
mbed_official | 146:f64d43ff0c18 | 144 | */ |
mbed_official | 146:f64d43ff0c18 | 145 | extern uint32_t SystemCoreClock; |
mbed_official | 146:f64d43ff0c18 | 146 | |
mbed_official | 146:f64d43ff0c18 | 147 | /** |
mbed_official | 146:f64d43ff0c18 | 148 | * @brief Setup the microcontroller system. |
mbed_official | 146:f64d43ff0c18 | 149 | * |
mbed_official | 146:f64d43ff0c18 | 150 | * Typically this function configures the oscillator (PLL) that is part of the |
mbed_official | 146:f64d43ff0c18 | 151 | * microcontroller device. For systems with variable clock speed it also updates |
mbed_official | 146:f64d43ff0c18 | 152 | * the variable SystemCoreClock. SystemInit is called from startup_device file. |
mbed_official | 146:f64d43ff0c18 | 153 | */ |
mbed_official | 146:f64d43ff0c18 | 154 | void SystemInit (void); |
mbed_official | 146:f64d43ff0c18 | 155 | |
mbed_official | 146:f64d43ff0c18 | 156 | /** |
mbed_official | 146:f64d43ff0c18 | 157 | * @brief Updates the SystemCoreClock variable. |
mbed_official | 146:f64d43ff0c18 | 158 | * |
mbed_official | 146:f64d43ff0c18 | 159 | * It must be called whenever the core clock is changed during program |
mbed_official | 146:f64d43ff0c18 | 160 | * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates |
mbed_official | 146:f64d43ff0c18 | 161 | * the current core clock. |
mbed_official | 146:f64d43ff0c18 | 162 | */ |
mbed_official | 146:f64d43ff0c18 | 163 | void SystemCoreClockUpdate (void); |
mbed_official | 146:f64d43ff0c18 | 164 | |
mbed_official | 146:f64d43ff0c18 | 165 | #ifdef __cplusplus |
mbed_official | 146:f64d43ff0c18 | 166 | } |
mbed_official | 146:f64d43ff0c18 | 167 | #endif |
mbed_official | 146:f64d43ff0c18 | 168 | |
mbed_official | 146:f64d43ff0c18 | 169 | #endif /* #if !defined(SYSTEM_MK64F12_H_) */ |