system_MK82F25615.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. ** ###################################################################
  3. ** Processors: MK82FN256CAx15
  4. ** MK82FN256VDC15
  5. ** MK82FN256VLL15
  6. ** MK82FN256VLQ15
  7. **
  8. ** Compilers: Keil ARM C/C++ Compiler
  9. ** Freescale C/C++ for Embedded ARM
  10. ** GNU C Compiler
  11. ** IAR ANSI C/C++ Compiler for ARM
  12. ** MCUXpresso Compiler
  13. **
  14. ** Reference manual: K82P121M150SF5RM, Rev. 0, May 2015
  15. ** Version: rev. 1.2, 2015-07-29
  16. ** Build: b171226
  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. ** The Clear BSD License
  24. ** Copyright 2016 Freescale Semiconductor, Inc.
  25. ** Copyright 2016-2017 NXP
  26. ** All rights reserved.
  27. **
  28. ** Redistribution and use in source and binary forms, with or without
  29. ** modification, are permitted (subject to the limitations in the
  30. ** disclaimer below) provided that the following conditions are met:
  31. **
  32. ** * Redistributions of source code must retain the above copyright
  33. ** notice, this list of conditions and the following disclaimer.
  34. **
  35. ** * Redistributions in binary form must reproduce the above copyright
  36. ** notice, this list of conditions and the following disclaimer in the
  37. ** documentation and/or other materials provided with the distribution.
  38. **
  39. ** * Neither the name of the copyright holder nor the names of its
  40. ** contributors may be used to endorse or promote products derived from
  41. ** this software without specific prior written permission.
  42. **
  43. ** NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  44. ** GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
  45. ** HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
  46. ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  47. ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  48. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  49. ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  50. ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  51. ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  52. ** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  53. ** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  54. ** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  55. ** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  56. **
  57. ** http: www.nxp.com
  58. ** mail: support@nxp.com
  59. **
  60. ** Revisions:
  61. ** - rev. 1.0 (2015-04-09)
  62. ** Initial version
  63. ** - rev. 1.1 (2015-05-28)
  64. ** Update according to the reference manual Rev. 0.
  65. ** - rev. 1.2 (2015-07-29)
  66. ** Correction of backward compatibility.
  67. **
  68. ** ###################################################################
  69. */
  70. /*!
  71. * @file MK82F25615
  72. * @version 1.2
  73. * @date 2015-07-29
  74. * @brief Device specific configuration file for MK82F25615 (header file)
  75. *
  76. * Provides a system configuration function and a global variable that contains
  77. * the system frequency. It configures the device and initializes the oscillator
  78. * (PLL) that is part of the microcontroller device.
  79. */
  80. #ifndef _SYSTEM_MK82F25615_H_
  81. #define _SYSTEM_MK82F25615_H_ /**< Symbol preventing repeated inclusion */
  82. #ifdef __cplusplus
  83. extern "C" {
  84. #endif
  85. #include <stdint.h>
  86. #ifndef DISABLE_WDOG
  87. #define DISABLE_WDOG 1
  88. #endif
  89. /* Define clock source values */
  90. #define CPU_XTAL_CLK_HZ 12000000U /* Value of the external crystal or oscillator clock frequency of the system oscillator (OSC) in Hz */
  91. #define CPU_XTAL32k_CLK_HZ 32768U /* Value of the external 32k crystal or oscillator clock frequency of the RTC in Hz */
  92. #define CPU_INT_SLOW_CLK_HZ 32768U /* Value of the slow internal oscillator clock frequency in Hz */
  93. #define CPU_INT_FAST_CLK_HZ 4000000U /* Value of the fast internal oscillator clock frequency in Hz */
  94. #define CPU_INT_IRC_CLK_HZ 48000000U /* Value of the 48M internal oscillator clock frequency in Hz */
  95. /* RTC oscillator setting */
  96. /* RTC_CR: SC2P=0,SC4P=0,SC8P=0,SC16P=0,CLKO=1,OSCE=1,WPS=0,UM=0,SUP=0,WPE=0,SWR=0 */
  97. #define SYSTEM_RTC_CR_VALUE 0x0300U /* RTC_CR */
  98. /* Low power mode enable */
  99. /* SMC_PMPROT: AHSRUN=1,AVLP=1,ALLS=1,AVLLS=1 */
  100. #define SYSTEM_SMC_PMPROT_VALUE 0xAAU /* SMC_PMPROT */
  101. #define DEFAULT_SYSTEM_CLOCK 20971520u
  102. /**
  103. * @brief System clock frequency (core clock)
  104. *
  105. * The system clock frequency supplied to the SysTick timer and the processor
  106. * core clock. This variable can be used by the user application to setup the
  107. * SysTick timer or configure other parameters. It may also be used by debugger to
  108. * query the frequency of the debug timer or configure the trace clock speed
  109. * SystemCoreClock is initialized with a correct predefined value.
  110. */
  111. extern uint32_t SystemCoreClock;
  112. /**
  113. * @brief Setup the microcontroller system.
  114. *
  115. * Typically this function configures the oscillator (PLL) that is part of the
  116. * microcontroller device. For systems with variable clock speed it also updates
  117. * the variable SystemCoreClock. SystemInit is called from startup_device file.
  118. */
  119. void SystemInit (void);
  120. /**
  121. * @brief Updates the SystemCoreClock variable.
  122. *
  123. * It must be called whenever the core clock is changed during program
  124. * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
  125. * the current core clock.
  126. */
  127. void SystemCoreClockUpdate (void);
  128. /**
  129. * @brief SystemInit function hook.
  130. *
  131. * This weak function allows to call specific initialization code during the
  132. * SystemInit() execution.This can be used when an application specific code needs
  133. * to be called as close to the reset entry as possible (for example the Multicore
  134. * Manager MCMGR_EarlyInit() function call).
  135. * NOTE: No global r/w variables can be used in this hook function because the
  136. * initialization of these variables happens after this function.
  137. */
  138. void SystemInitHook (void);
  139. #ifdef __cplusplus
  140. }
  141. #endif
  142. #endif /* _SYSTEM_MK82F25615_H_ */