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