1 /*
2 ** ###################################################################
3 **     Processors:          MKL27Z32VDA4
4 **                          MKL27Z32VFM4
5 **                          MKL27Z32VFT4
6 **                          MKL27Z32VLH4
7 **                          MKL27Z32VMP4
8 **                          MKL27Z64VDA4
9 **                          MKL27Z64VFM4
10 **                          MKL27Z64VFT4
11 **                          MKL27Z64VLH4
12 **                          MKL27Z64VMP4
13 **
14 **     Compilers:           Keil ARM C/C++ Compiler
15 **                          Freescale C/C++ for Embedded ARM
16 **                          GNU C Compiler
17 **                          IAR ANSI C/C++ Compiler for ARM
18 **                          MCUXpresso Compiler
19 **
20 **     Reference manual:    KL27P64M48SF2RM, Rev. 1, Sep 2014
21 **     Version:             rev. 1.6, 2016-06-24
22 **     Build:               b180801
23 **
24 **     Abstract:
25 **         Provides a system configuration function and a global variable that
26 **         contains the system frequency. It configures the device and initializes
27 **         the oscillator (PLL) that is part of the microcontroller device.
28 **
29 **     Copyright 2016 Freescale Semiconductor, Inc.
30 **     Copyright 2016-2018 NXP
31 **
32 **     SPDX-License-Identifier: BSD-3-Clause
33 **
34 **     http:                 www.nxp.com
35 **     mail:                 support@nxp.com
36 **
37 **     Revisions:
38 **     - rev. 1.0 (2014-05-12)
39 **         Initial version.
40 **     - rev. 1.1 (2014-07-10)
41 **         UART0 - UART0 module renamed to UART2.
42 **     - rev. 1.2 (2014-08-12)
43 **         CRC - CRC register renamed to DATA.
44 **     - rev. 1.3 (2014-09-02)
45 **         USB - USB0_CTL0 was renamed to USB0_OTGCTL register.
46 **         USB - USB0_CTL1 was renamed to USB0_CTL register.
47 **         USB - Two new bitfields (STOP_ACK_DLY_EN, AHB_DLY_EN) was added to the USB0_KEEP_ALIVE_CTRL register.
48 **     - rev. 1.4 (2014-09-22)
49 **         FLEXIO - Offsets of the SHIFTBUFBIS registers were interchanged with offsets of the SHIFTBUFBBS registers.
50 **         SIM - Changed bitfield value MCGIRCLK to LIRC_CLK of bitfield CLKOUTSEL in SOPT2 register.
51 **         SIM - Removed bitfield DIEID in SDID register.
52 **         UART2 - Removed ED register.
53 **         UART2 - Removed MODEM register.
54 **         UART2 - Removed IR register.
55 **         UART2 - Removed PFIFO register.
56 **         UART2 - Removed CFIFO register.
57 **         UART2 - Removed SFIFO register.
58 **         UART2 - Removed TWFIFO register.
59 **         UART2 - Removed TCFIFO register.
60 **         UART2 - Removed RWFIFO register.
61 **         UART2 - Removed RCFIFO register.
62 **         USB - Removed bitfield REG_EN in CLK_RECOVER_IRC_EN register.
63 **         USB - Renamed USBEN bitfield of USB0_CTL was renamed to USBENSOFEN.
64 **     - rev. 1.5 (2016-02-02)
65 **         FGPIO - Add FGPIO registers.
66 **     - rev. 1.6 (2016-06-24)
67 **         USB - OTGCTL register was removed.
68 **         USB - Bit RESUME was added in CTL register.
69 **
70 ** ###################################################################
71 */
72 
73 /*!
74  * @file MKL27Z644
75  * @version 1.6
76  * @date 2016-06-24
77  * @brief Device specific configuration file for MKL27Z644 (header file)
78  *
79  * Provides a system configuration function and a global variable that contains
80  * the system frequency. It configures the device and initializes the oscillator
81  * (PLL) that is part of the microcontroller device.
82  */
83 
84 #ifndef _SYSTEM_MKL27Z644_H_
85 #define _SYSTEM_MKL27Z644_H_                     /**< Symbol preventing repeated inclusion */
86 
87 #ifdef __cplusplus
88 extern "C" {
89 #endif
90 
91 #include <stdint.h>
92 
93 
94 #ifndef DISABLE_WDOG
95   #define DISABLE_WDOG  1
96 #endif
97 
98 #ifndef ACK_ISOLATION
99   #define ACK_ISOLATION   1
100 #endif
101 
102 /* Define clock source values */
103 
104 #define CPU_XTAL_CLK_HZ                32768u              /* Value of the external crystal or oscillator clock frequency in Hz */
105 #define CPU_INT_FAST_CLK_HZ            48000000u           /* Value of the fast internal oscillator clock frequency in Hz  */
106 #define CPU_INT_IRC_CLK_HZ             48000000u           /* Value of the 48M internal oscillator clock frequency in Hz  */
107 
108 /* Low power mode enable */
109 /* SMC_PMPROT: AVLP=1,AVLLS=1 */
110 #define SYSTEM_SMC_PMPROT_VALUE        0x2Au               /* SMC_PMPROT */
111 
112 #define DEFAULT_SYSTEM_CLOCK           8000000u            /* Default System clock value */
113 #define CPU_INT_SLOW_CLK_HZ            8000000u            /* Value of the slow internal oscillator clock frequency in Hz  */
114 
115 
116 /**
117  * @brief System clock frequency (core clock)
118  *
119  * The system clock frequency supplied to the SysTick timer and the processor
120  * core clock. This variable can be used by the user application to setup the
121  * SysTick timer or configure other parameters. It may also be used by debugger to
122  * query the frequency of the debug timer or configure the trace clock speed
123  * SystemCoreClock is initialized with a correct predefined value.
124  */
125 extern uint32_t SystemCoreClock;
126 
127 /**
128  * @brief Setup the microcontroller system.
129  *
130  * Typically this function configures the oscillator (PLL) that is part of the
131  * microcontroller device. For systems with variable clock speed it also updates
132  * the variable SystemCoreClock. SystemInit is called from startup_device file.
133  */
134 void SystemInit (void);
135 
136 /**
137  * @brief Updates the SystemCoreClock variable.
138  *
139  * It must be called whenever the core clock is changed during program
140  * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
141  * the current core clock.
142  */
143 void SystemCoreClockUpdate (void);
144 
145 /**
146  * @brief SystemInit function hook.
147  *
148  * This weak function allows to call specific initialization code during the
149  * SystemInit() execution.This can be used when an application specific code needs
150  * to be called as close to the reset entry as possible (for example the Multicore
151  * Manager MCMGR_EarlyInit() function call).
152  * NOTE: No global r/w variables can be used in this hook function because the
153  * initialization of these variables happens after this function.
154  */
155 void SystemInitHook (void);
156 
157 #ifdef __cplusplus
158 }
159 #endif
160 
161 #endif  /* _SYSTEM_MKL27Z644_H_ */
162