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