1 /*
2 ** ###################################################################
3 **     Processors:          MK82FN256CAx15
4 **                          MK82FN256VDC15
5 **                          MK82FN256VLL15
6 **                          MK82FN256VLQ15
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:    K82P121M150SF5RM, Rev. 0, May 2015
15 **     Version:             rev. 1.2, 2015-07-29
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 (2015-04-09)
34 **         Initial version
35 **     - rev. 1.1 (2015-05-28)
36 **         Update according to the reference manual Rev. 0.
37 **     - rev. 1.2 (2015-07-29)
38 **         Correction of backward compatibility.
39 **
40 ** ###################################################################
41 */
42 
43 /*!
44  * @file MK82F25615
45  * @version 1.2
46  * @date 2015-07-29
47  * @brief Device specific configuration file for MK82F25615 (header file)
48  *
49  * Provides a system configuration function and a global variable that contains
50  * the system frequency. It configures the device and initializes the oscillator
51  * (PLL) that is part of the microcontroller device.
52  */
53 
54 #ifndef _SYSTEM_MK82F25615_H_
55 #define _SYSTEM_MK82F25615_H_                    /**< Symbol preventing repeated inclusion */
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 #include <stdint.h>
62 
63 
64 #ifndef DISABLE_WDOG
65   #define DISABLE_WDOG                 1
66 #endif
67 
68 /* Define clock source values */
69 
70 #define CPU_XTAL_CLK_HZ                12000000U           /* Value of the external crystal or oscillator clock frequency of the system oscillator (OSC) in Hz */
71 #define CPU_XTAL32k_CLK_HZ             32768U              /* Value of the external 32k crystal or oscillator clock frequency of the RTC in Hz */
72 #define CPU_INT_SLOW_CLK_HZ            32768U              /* Value of the slow internal oscillator clock frequency in Hz */
73 #define CPU_INT_FAST_CLK_HZ            4000000U            /* Value of the fast internal oscillator clock frequency in Hz */
74 #define CPU_INT_IRC_CLK_HZ             48000000U           /* Value of the 48M internal oscillator clock frequency in Hz */
75 
76 /* RTC oscillator setting */
77 /* RTC_CR: SC2P=0,SC4P=0,SC8P=0,SC16P=0,CLKO=1,OSCE=1,WPS=0,UM=0,SUP=0,WPE=0,SWR=0 */
78 #define SYSTEM_RTC_CR_VALUE            0x0300U             /* RTC_CR */
79 
80 /* Low power mode enable */
81 /* SMC_PMPROT: AHSRUN=1,AVLP=1,ALLS=1,AVLLS=1 */
82 #define SYSTEM_SMC_PMPROT_VALUE        0xAAU               /* SMC_PMPROT */
83 
84 #define DEFAULT_SYSTEM_CLOCK           20971520u
85 
86 
87 /**
88  * @brief System clock frequency (core clock)
89  *
90  * The system clock frequency supplied to the SysTick timer and the processor
91  * core clock. This variable can be used by the user application to setup the
92  * SysTick timer or configure other parameters. It may also be used by debugger to
93  * query the frequency of the debug timer or configure the trace clock speed
94  * SystemCoreClock is initialized with a correct predefined value.
95  */
96 extern uint32_t SystemCoreClock;
97 
98 /**
99  * @brief Setup the microcontroller system.
100  *
101  * Typically this function configures the oscillator (PLL) that is part of the
102  * microcontroller device. For systems with variable clock speed it also updates
103  * the variable SystemCoreClock. SystemInit is called from startup_device file.
104  */
105 void SystemInit (void);
106 
107 /**
108  * @brief Updates the SystemCoreClock variable.
109  *
110  * It must be called whenever the core clock is changed during program
111  * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
112  * the current core clock.
113  */
114 void SystemCoreClockUpdate (void);
115 
116 /**
117  * @brief SystemInit function hook.
118  *
119  * This weak function allows to call specific initialization code during the
120  * SystemInit() execution.This can be used when an application specific code needs
121  * to be called as close to the reset entry as possible (for example the Multicore
122  * Manager MCMGR_EarlyInit() function call).
123  * NOTE: No global r/w variables can be used in this hook function because the
124  * initialization of these variables happens after this function.
125  */
126 void SystemInitHook (void);
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif  /* _SYSTEM_MK82F25615_H_ */
133