1 /*
2 ** ###################################################################
3 **     Processors:          MKV31F256VLH12
4 **                          MKV31F256VLL12
5 **
6 **     Compilers:           Freescale C/C++ for Embedded ARM
7 **                          GNU C Compiler
8 **                          IAR ANSI C/C++ Compiler for ARM
9 **                          Keil ARM C/C++ Compiler
10 **                          MCUXpresso Compiler
11 **
12 **     Reference manual:    KV31P100M120SF8RM, Rev. 1, March 24, 2014
13 **     Version:             rev. 1.7, 2015-02-19
14 **     Build:               b181105
15 **
16 **     Abstract:
17 **         Provides a system configuration function and a global variable that
18 **         contains the system frequency. It configures the device and initializes
19 **         the oscillator (PLL) that is part of the microcontroller device.
20 **
21 **     Copyright 2016 Freescale Semiconductor, Inc.
22 **     Copyright 2016-2018 NXP
23 **     All rights reserved.
24 **
25 **     SPDX-License-Identifier: BSD-3-Clause
26 **
27 **     http:                 www.nxp.com
28 **     mail:                 support@nxp.com
29 **
30 **     Revisions:
31 **     - rev. 1.0 (2013-11-01)
32 **         Initial version.
33 **     - rev. 1.1 (2013-12-20)
34 **         Update according to reference manual rev. 0.6,
35 **     - rev. 1.2 (2014-02-06)
36 **         Update according to reference manual rev. 0.61,
37 **     - rev. 1.3 (2014-02-10)
38 **         The declaration of clock configurations has been moved to separate header file system_MKV31F25612.h
39 **     - rev. 1.4 (2014-04-30)
40 **         Update of MCM module according to the RM rev. 1.
41 **         Update of system and startup files.
42 **         Module access macro module_BASES replaced by module_BASE_PTRS.
43 **     - rev. 1.5 (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.6 (2014-10-14)
47 **         Interrupt INT_LPTimer renamed to INT_LPTMR0, interrupt INT_Watchdog renamed to INT_WDOG_EWM.
48 **     - rev. 1.7 (2015-02-19)
49 **         Renamed interrupt vector LLW to LLWU.
50 **
51 ** ###################################################################
52 */
53 
54 /*!
55  * @file MKV31F25612
56  * @version 1.7
57  * @date 2015-02-19
58  * @brief Device specific configuration file for MKV31F25612 (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_MKV31F25612_H_
66 #define _SYSTEM_MKV31F25612_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             0u                  /* No RTC clock available */
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 
89 /* Low power mode enable */
90 /* SMC_PMPROT: AHSRUN=1,AVLP=1,ALLS=1,AVLLS=1 */
91 #define SYSTEM_SMC_PMPROT_VALUE        0xAAU               /* SMC_PMPROT */
92 
93 #define DEFAULT_SYSTEM_CLOCK           20971520u           /* Default System clock value */
94 
95 
96 /**
97  * @brief System clock frequency (core clock)
98  *
99  * The system clock frequency supplied to the SysTick timer and the processor
100  * core clock. This variable can be used by the user application to setup the
101  * SysTick timer or configure other parameters. It may also be used by debugger to
102  * query the frequency of the debug timer or configure the trace clock speed
103  * SystemCoreClock is initialized with a correct predefined value.
104  */
105 extern uint32_t SystemCoreClock;
106 
107 /**
108  * @brief Setup the microcontroller system.
109  *
110  * Typically this function configures the oscillator (PLL) that is part of the
111  * microcontroller device. For systems with variable clock speed it also updates
112  * the variable SystemCoreClock. SystemInit is called from startup_device file.
113  */
114 void SystemInit (void);
115 
116 /**
117  * @brief Updates the SystemCoreClock variable.
118  *
119  * It must be called whenever the core clock is changed during program
120  * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
121  * the current core clock.
122  */
123 void SystemCoreClockUpdate (void);
124 
125 /**
126  * @brief SystemInit function hook.
127  *
128  * This weak function allows to call specific initialization code during the
129  * SystemInit() execution.This can be used when an application specific code needs
130  * to be called as close to the reset entry as possible (for example the Multicore
131  * Manager MCMGR_EarlyInit() function call).
132  * NOTE: No global r/w variables can be used in this hook function because the
133  * initialization of these variables happens after this function.
134  */
135 void SystemInitHook (void);
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif  /* _SYSTEM_MKV31F25612_H_ */
142