1 /*
2 ** ###################################################################
3 **     Processors:          MKE16Z32VLD4
4 **                          MKE16Z32VLF4
5 **                          MKE16Z64VLD4
6 **                          MKE16Z64VLF4
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:    KE1xZP48M48SF0RM, Rev. 1, Sep. 2018
15 **     Version:             rev. 3.0, 2020-01-22
16 **     Build:               b200122
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-2020 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 (2018-05-09)
34 **         Initial version.
35 **     - rev. 2.0 (2018-09-17)
36 **         Based on rev1 RM.
37 **     - rev. 3.0 (2020-01-22)
38 **         Add 40 pins part numbers.
39 **
40 ** ###################################################################
41 */
42 
43 /*!
44  * @file MKE16Z4
45  * @version 3.0
46  * @date 2020-01-22
47  * @brief Device specific configuration file for MKE16Z4 (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_MKE16Z4_H_
55 #define _SYSTEM_MKE16Z4_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                8000000u            /* Value of the external crystal or oscillator clock frequency in Hz */
71 #define CPU_INT_FAST_CLK_HZ            48000000u           /* Value of the fast internal oscillator clock frequency in Hz  */
72 #define CPU_INT_IRC_CLK_HZ             48000000u           /* Value of the 48M internal oscillator clock frequency in Hz  */
73 
74 /* Low power mode enable */
75 /* SMC_PMPROT: AVLP=1 */
76 #define SYSTEM_SMC_PMPROT_VALUE        0x20u               /* SMC_PMPROT */
77 #define SYSTEM_SMC_PMCTRL_VALUE        0x0u                /* SMC_PMCTRL */
78 
79 #define DEFAULT_SYSTEM_CLOCK           48000000u           /* Default System clock value */
80 #define CPU_INT_SLOW_CLK_HZ            8000000u            /* Value of the slow internal oscillator clock frequency in Hz  */
81 
82 
83 /**
84  * @brief System clock frequency (core clock)
85  *
86  * The system clock frequency supplied to the SysTick timer and the processor
87  * core clock. This variable can be used by the user application to setup the
88  * SysTick timer or configure other parameters. It may also be used by debugger to
89  * query the frequency of the debug timer or configure the trace clock speed
90  * SystemCoreClock is initialized with a correct predefined value.
91  */
92 extern uint32_t SystemCoreClock;
93 
94 /**
95  * @brief Setup the microcontroller system.
96  *
97  * Typically this function configures the oscillator (PLL) that is part of the
98  * microcontroller device. For systems with variable clock speed it also updates
99  * the variable SystemCoreClock. SystemInit is called from startup_device file.
100  */
101 void SystemInit (void);
102 
103 /**
104  * @brief Updates the SystemCoreClock variable.
105  *
106  * It must be called whenever the core clock is changed during program
107  * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
108  * the current core clock.
109  */
110 void SystemCoreClockUpdate (void);
111 
112 /**
113  * @brief SystemInit function hook.
114  *
115  * This weak function allows to call specific initialization code during the
116  * SystemInit() execution.This can be used when an application specific code needs
117  * to be called as close to the reset entry as possible (for example the Multicore
118  * Manager MCMGR_EarlyInit() function call).
119  * NOTE: No global r/w variables can be used in this hook function because the
120  * initialization of these variables happens after this function.
121  */
122 void SystemInitHook (void);
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif  /* _SYSTEM_MKE16Z4_H_ */
129