1 /* 2 ** ################################################################### 3 ** Processors: MK22FN128VDC10 4 ** MK22FN128VLH10 5 ** MK22FN128VLL10 6 ** MK22FN128VMP10 7 ** 8 ** Compilers: Freescale C/C++ for Embedded ARM 9 ** GNU C Compiler 10 ** IAR ANSI C/C++ Compiler for ARM 11 ** Keil ARM C/C++ Compiler 12 ** MCUXpresso Compiler 13 ** 14 ** Reference manual: K22P121M100SF9RM, Rev. 1, April 25, 2014 15 ** Version: rev. 1.6, 2015-02-19 16 ** Build: b181105 17 ** 18 ** Abstract: 19 ** Provides a system configuration function and a global variable that 20 ** contains the system frequency. It configures the device and initializes 21 ** the oscillator (PLL) that is part of the microcontroller device. 22 ** 23 ** Copyright 2016 Freescale Semiconductor, Inc. 24 ** Copyright 2016-2018 NXP 25 ** All rights reserved. 26 ** 27 ** SPDX-License-Identifier: BSD-3-Clause 28 ** 29 ** http: www.nxp.com 30 ** mail: support@nxp.com 31 ** 32 ** Revisions: 33 ** - rev. 1.0 (2013-11-01) 34 ** Initial version. 35 ** - rev. 1.1 (2013-12-20) 36 ** Update according to reference manual rev. 0.1, 37 ** - rev. 1.2 (2014-02-10) 38 ** The declaration of clock configurations has been moved to separate header file system_MK22F12810.h 39 ** - rev. 1.3 (2014-05-06) 40 ** Update according to reference manual rev. 1.0, 41 ** Update of system and startup files. 42 ** Module access macro module_BASES replaced by module_BASE_PTRS. 43 ** - rev. 1.4 (2014-08-28) 44 ** Update of system files - default clock configuration changed. 45 ** Update of startup files - possibility to override DefaultISR added. 46 ** - rev. 1.5 (2014-10-14) 47 ** Interrupt INT_LPTimer renamed to INT_LPTMR0, interrupt INT_Watchdog renamed to INT_WDOG_EWM. 48 ** - rev. 1.6 (2015-02-19) 49 ** Renamed interrupt vector LLW to LLWU. 50 ** 51 ** ################################################################### 52 */ 53 54 /*! 55 * @file MK22F12810 56 * @version 1.6 57 * @date 2015-02-19 58 * @brief Device specific configuration file for MK22F12810 (header file) 59 * 60 * Provides a system configuration function and a global variable that contains 61 * the system frequency. It configures the device and initializes the oscillator 62 * (PLL) that is part of the microcontroller device. 63 */ 64 65 #ifndef _SYSTEM_MK22F12810_H_ 66 #define _SYSTEM_MK22F12810_H_ /**< Symbol preventing repeated inclusion */ 67 68 #ifdef __cplusplus 69 extern "C" { 70 #endif 71 72 #include <stdint.h> 73 74 75 #ifndef DISABLE_WDOG 76 #define DISABLE_WDOG 1 77 #endif 78 79 /* Define clock source values */ 80 81 #define CPU_XTAL_CLK_HZ 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */ 82 #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */ 83 #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */ 84 #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */ 85 #define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */ 86 87 /* RTC oscillator setting */ 88 /* RTC_CR: SC2P=0,SC4P=0,SC8P=0,SC16P=0,CLKO=1,OSCE=1,WPS=0,UM=0,SUP=0,WPE=0,SWR=0 */ 89 #define SYSTEM_RTC_CR_VALUE 0x0300U /* RTC_CR */ 90 91 /* Low power mode enable */ 92 /* SMC_PMPROT: AHSRUN=1,AVLP=1,ALLS=1,AVLLS=1 */ 93 #define SYSTEM_SMC_PMPROT_VALUE 0xAAU /* SMC_PMPROT */ 94 95 #define DEFAULT_SYSTEM_CLOCK 20971520u /* Default System clock value */ 96 97 98 /** 99 * @brief System clock frequency (core clock) 100 * 101 * The system clock frequency supplied to the SysTick timer and the processor 102 * core clock. This variable can be used by the user application to setup the 103 * SysTick timer or configure other parameters. It may also be used by debugger to 104 * query the frequency of the debug timer or configure the trace clock speed 105 * SystemCoreClock is initialized with a correct predefined value. 106 */ 107 extern uint32_t SystemCoreClock; 108 109 /** 110 * @brief Setup the microcontroller system. 111 * 112 * Typically this function configures the oscillator (PLL) that is part of the 113 * microcontroller device. For systems with variable clock speed it also updates 114 * the variable SystemCoreClock. SystemInit is called from startup_device file. 115 */ 116 void SystemInit (void); 117 118 /** 119 * @brief Updates the SystemCoreClock variable. 120 * 121 * It must be called whenever the core clock is changed during program 122 * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates 123 * the current core clock. 124 */ 125 void SystemCoreClockUpdate (void); 126 127 /** 128 * @brief SystemInit function hook. 129 * 130 * This weak function allows to call specific initialization code during the 131 * SystemInit() execution.This can be used when an application specific code needs 132 * to be called as close to the reset entry as possible (for example the Multicore 133 * Manager MCMGR_EarlyInit() function call). 134 * NOTE: No global r/w variables can be used in this hook function because the 135 * initialization of these variables happens after this function. 136 */ 137 void SystemInitHook (void); 138 139 #ifdef __cplusplus 140 } 141 #endif 142 143 #endif /* _SYSTEM_MK22F12810_H_ */ 144