1 /*
2 ** ###################################################################
3 **     Processors:          K32L2B31VFM0A
4 **                          K32L2B31VFT0A
5 **                          K32L2B31VLH0A
6 **                          K32L2B31VMP0A
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:    K32L2B3xRM, Rev.0, July 2019
15 **     Version:             rev. 1.0, 2019-07-30
16 **     Build:               b190925
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-2019 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 (2019-07-30)
34 **         Initial version.
35 **
36 ** ###################################################################
37 */
38 
39 /*!
40  * @file K32L2B31A
41  * @version 1.0
42  * @date 2019-07-30
43  * @brief Device specific configuration file for K32L2B31A (header file)
44  *
45  * Provides a system configuration function and a global variable that contains
46  * the system frequency. It configures the device and initializes the oscillator
47  * (PLL) that is part of the microcontroller device.
48  */
49 
50 #ifndef _SYSTEM_K32L2B31A_H_
51 #define _SYSTEM_K32L2B31A_H_ /**< Symbol preventing repeated inclusion */
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 #include <stdint.h>
58 
59 #ifndef DISABLE_WDOG
60 #define DISABLE_WDOG 1
61 #endif
62 
63 #define ACK_ISOLATION 1
64 
65 /* Define clock source values */
66 
67 #define CPU_XTAL_CLK_HZ 32768u        /* Value of the external crystal or oscillator clock frequency in Hz */
68 #define CPU_INT_FAST_CLK_HZ 48000000u /* Value of the fast internal oscillator clock frequency in Hz  */
69 #define CPU_INT_IRC_CLK_HZ 48000000u  /* Value of the 48M internal oscillator clock frequency in Hz  */
70 
71 /* Low power mode enable */
72 /* SMC_PMPROT: AVLP=1,AVLLS=1 */
73 #define SYSTEM_SMC_PMPROT_VALUE 0x2Au /* SMC_PMPROT */
74 
75 #define DEFAULT_SYSTEM_CLOCK 8000000u /* Default System clock value */
76 #define CPU_INT_SLOW_CLK_HZ 8000000u  /* Value of the slow internal oscillator clock frequency in Hz  */
77 
78 /**
79  * @brief System clock frequency (core clock)
80  *
81  * The system clock frequency supplied to the SysTick timer and the processor
82  * core clock. This variable can be used by the user application to setup the
83  * SysTick timer or configure other parameters. It may also be used by debugger to
84  * query the frequency of the debug timer or configure the trace clock speed
85  * SystemCoreClock is initialized with a correct predefined value.
86  */
87 extern uint32_t SystemCoreClock;
88 
89 /**
90  * @brief Setup the microcontroller system.
91  *
92  * Typically this function configures the oscillator (PLL) that is part of the
93  * microcontroller device. For systems with variable clock speed it also updates
94  * the variable SystemCoreClock. SystemInit is called from startup_device file.
95  */
96 void SystemInit(void);
97 
98 /**
99  * @brief Updates the SystemCoreClock variable.
100  *
101  * It must be called whenever the core clock is changed during program
102  * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
103  * the current core clock.
104  */
105 void SystemCoreClockUpdate(void);
106 
107 /**
108  * @brief SystemInit function hook.
109  *
110  * This weak function allows to call specific initialization code during the
111  * SystemInit() execution.This can be used when an application specific code needs
112  * to be called as close to the reset entry as possible (for example the Multicore
113  * Manager MCMGR_EarlyInit() function call).
114  * NOTE: No global r/w variables can be used in this hook function because the
115  * initialization of these variables happens after this function.
116  */
117 void SystemInitHook(void);
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* _SYSTEM_K32L2B31A_H_ */
124