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