1 /* 2 ** ################################################################### 3 ** Processors: MK24FN1M0CAJ12 4 ** MK24FN1M0VDC12 5 ** MK24FN1M0VLL12 6 ** MK24FN1M0VLQ12 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: K24P144M120SF5RM, Rev.2, January 2014 15 ** Version: rev. 2.8, 2016-03-21 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-08-12) 34 ** Initial version. 35 ** - rev. 2.0 (2013-10-29) 36 ** Register accessor macros added to the memory map. 37 ** Symbols for Processor Expert memory map compatibility added to the memory map. 38 ** Startup file for gcc has been updated according to CMSIS 3.2. 39 ** System initialization updated. 40 ** MCG - registers updated. 41 ** PORTA, PORTB, PORTC, PORTE - registers for digital filter removed. 42 ** - rev. 2.1 (2013-10-30) 43 ** Definition of BITBAND macros updated to support peripherals with 32-bit acces disabled. 44 ** - rev. 2.2 (2013-12-09) 45 ** DMA - EARS register removed. 46 ** AIPS0, AIPS1 - MPRA register updated. 47 ** - rev. 2.3 (2014-01-24) 48 ** Update according to reference manual rev. 2 49 ** ENET, MCG, MCM, SIM, USB - registers updated 50 ** - rev. 2.4 (2014-02-10) 51 ** The declaration of clock configurations has been moved to separate header file system_MK24F12.h 52 ** Update of SystemInit() and SystemCoreClockUpdate() functions. 53 ** Module access macro module_BASES replaced by module_BASE_PTRS. 54 ** - rev. 2.5 (2014-08-28) 55 ** Update of system files - default clock configuration changed. 56 ** Update of startup files - possibility to override DefaultISR added. 57 ** - rev. 2.6 (2014-10-14) 58 ** Interrupt INT_LPTimer renamed to INT_LPTMR0, interrupt INT_Watchdog renamed to INT_WDOG_EWM. 59 ** - rev. 2.7 (2015-02-19) 60 ** Renamed interrupt vector LLW to LLWU. 61 ** - rev. 2.8 (2016-03-21) 62 ** Added MK24FN1M0CAJ12 part. 63 ** GPIO - renamed port instances: PTx -> GPIOx. 64 ** 65 ** ################################################################### 66 */ 67 68 /*! 69 * @file MK24F12 70 * @version 2.8 71 * @date 2016-03-21 72 * @brief Device specific configuration file for MK24F12 (header file) 73 * 74 * Provides a system configuration function and a global variable that contains 75 * the system frequency. It configures the device and initializes the oscillator 76 * (PLL) that is part of the microcontroller device. 77 */ 78 79 #ifndef _SYSTEM_MK24F12_H_ 80 #define _SYSTEM_MK24F12_H_ /**< Symbol preventing repeated inclusion */ 81 82 #ifdef __cplusplus 83 extern "C" { 84 #endif 85 86 #include <stdint.h> 87 88 89 #ifndef DISABLE_WDOG 90 #define DISABLE_WDOG 1 91 #endif 92 93 /* Define clock source values */ 94 95 #define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */ 96 #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */ 97 #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */ 98 #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */ 99 #define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */ 100 101 /* RTC oscillator setting */ 102 /* RTC_CR: SC2P=0,SC4P=0,SC8P=0,SC16P=0,CLKO=1,OSCE=1,WPS=0,UM=0,SUP=0,WPE=0,SWR=0 */ 103 #define SYSTEM_RTC_CR_VALUE 0x0300U /* RTC_CR */ 104 105 /* Low power mode enable */ 106 /* SMC_PMPROT: AVLP=1,ALLS=1,AVLLS=1 */ 107 #define SYSTEM_SMC_PMPROT_VALUE 0x2AU /* SMC_PMPROT */ 108 109 #define DEFAULT_SYSTEM_CLOCK 20971520u /* Default System clock value */ 110 111 112 /** 113 * @brief System clock frequency (core clock) 114 * 115 * The system clock frequency supplied to the SysTick timer and the processor 116 * core clock. This variable can be used by the user application to setup the 117 * SysTick timer or configure other parameters. It may also be used by debugger to 118 * query the frequency of the debug timer or configure the trace clock speed 119 * SystemCoreClock is initialized with a correct predefined value. 120 */ 121 extern uint32_t SystemCoreClock; 122 123 /** 124 * @brief Setup the microcontroller system. 125 * 126 * Typically this function configures the oscillator (PLL) that is part of the 127 * microcontroller device. For systems with variable clock speed it also updates 128 * the variable SystemCoreClock. SystemInit is called from startup_device file. 129 */ 130 void SystemInit (void); 131 132 /** 133 * @brief Updates the SystemCoreClock variable. 134 * 135 * It must be called whenever the core clock is changed during program 136 * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates 137 * the current core clock. 138 */ 139 void SystemCoreClockUpdate (void); 140 141 /** 142 * @brief SystemInit function hook. 143 * 144 * This weak function allows to call specific initialization code during the 145 * SystemInit() execution.This can be used when an application specific code needs 146 * to be called as close to the reset entry as possible (for example the Multicore 147 * Manager MCMGR_EarlyInit() function call). 148 * NOTE: No global r/w variables can be used in this hook function because the 149 * initialization of these variables happens after this function. 150 */ 151 void SystemInitHook (void); 152 153 #ifdef __cplusplus 154 } 155 #endif 156 157 #endif /* _SYSTEM_MK24F12_H_ */ 158