system_MK24F12.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. ** ###################################################################
  3. ** Processors: MK24FN1M0CAJ12
  4. ** MK24FN1M0VDC12
  5. ** MK24FN1M0VLL12
  6. ** MK24FN1M0VLQ12
  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: K24P144M120SF5RM, Rev.2, January 2014
  15. ** Version: rev. 2.8, 2016-03-21
  16. ** Build: b170713
  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-2017 NXP
  25. ** Redistribution and use in source and binary forms, with or without modification,
  26. ** are permitted provided that the following conditions are met:
  27. **
  28. ** 1. Redistributions of source code must retain the above copyright notice, this list
  29. ** of conditions and the following disclaimer.
  30. **
  31. ** 2. Redistributions in binary form must reproduce the above copyright notice, this
  32. ** list of conditions and the following disclaimer in the documentation and/or
  33. ** other materials provided with the distribution.
  34. **
  35. ** 3. Neither the name of the copyright holder nor the names of its
  36. ** contributors may be used to endorse or promote products derived from this
  37. ** software without specific prior written permission.
  38. **
  39. ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  40. ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  41. ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  42. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  43. ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  44. ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  45. ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  46. ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  47. ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  48. ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  49. **
  50. ** http: www.nxp.com
  51. ** mail: support@nxp.com
  52. **
  53. ** Revisions:
  54. ** - rev. 1.0 (2013-08-12)
  55. ** Initial version.
  56. ** - rev. 2.0 (2013-10-29)
  57. ** Register accessor macros added to the memory map.
  58. ** Symbols for Processor Expert memory map compatibility added to the memory map.
  59. ** Startup file for gcc has been updated according to CMSIS 3.2.
  60. ** System initialization updated.
  61. ** MCG - registers updated.
  62. ** PORTA, PORTB, PORTC, PORTE - registers for digital filter removed.
  63. ** - rev. 2.1 (2013-10-30)
  64. ** Definition of BITBAND macros updated to support peripherals with 32-bit acces disabled.
  65. ** - rev. 2.2 (2013-12-09)
  66. ** DMA - EARS register removed.
  67. ** AIPS0, AIPS1 - MPRA register updated.
  68. ** - rev. 2.3 (2014-01-24)
  69. ** Update according to reference manual rev. 2
  70. ** ENET, MCG, MCM, SIM, USB - registers updated
  71. ** - rev. 2.4 (2014-02-10)
  72. ** The declaration of clock configurations has been moved to separate header file system_MK24F12.h
  73. ** Update of SystemInit() and SystemCoreClockUpdate() functions.
  74. ** Module access macro module_BASES replaced by module_BASE_PTRS.
  75. ** - rev. 2.5 (2014-08-28)
  76. ** Update of system files - default clock configuration changed.
  77. ** Update of startup files - possibility to override DefaultISR added.
  78. ** - rev. 2.6 (2014-10-14)
  79. ** Interrupt INT_LPTimer renamed to INT_LPTMR0, interrupt INT_Watchdog renamed to INT_WDOG_EWM.
  80. ** - rev. 2.7 (2015-02-19)
  81. ** Renamed interrupt vector LLW to LLWU.
  82. ** - rev. 2.8 (2016-03-21)
  83. ** Added MK24FN1M0CAJ12 part.
  84. ** GPIO - renamed port instances: PTx -> GPIOx.
  85. **
  86. ** ###################################################################
  87. */
  88. /*!
  89. * @file MK24F12
  90. * @version 2.8
  91. * @date 2016-03-21
  92. * @brief Device specific configuration file for MK24F12 (header file)
  93. *
  94. * Provides a system configuration function and a global variable that contains
  95. * the system frequency. It configures the device and initializes the oscillator
  96. * (PLL) that is part of the microcontroller device.
  97. */
  98. #ifndef _SYSTEM_MK24F12_H_
  99. #define _SYSTEM_MK24F12_H_ /**< Symbol preventing repeated inclusion */
  100. #ifdef __cplusplus
  101. extern "C" {
  102. #endif
  103. #include <stdint.h>
  104. #ifndef DISABLE_WDOG
  105. #define DISABLE_WDOG 1
  106. #endif
  107. /* Define clock source values */
  108. #define CPU_XTAL_CLK_HZ 50000000u /* Value of the external crystal or oscillator clock frequency in Hz */
  109. #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
  110. #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
  111. #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
  112. #define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
  113. /* RTC oscillator setting */
  114. /* RTC_CR: SC2P=0,SC4P=0,SC8P=0,SC16P=0,CLKO=1,OSCE=1,WPS=0,UM=0,SUP=0,WPE=0,SWR=0 */
  115. #define SYSTEM_RTC_CR_VALUE 0x0300U /* RTC_CR */
  116. /* Low power mode enable */
  117. /* SMC_PMPROT: AVLP=1,ALLS=1,AVLLS=1 */
  118. #define SYSTEM_SMC_PMPROT_VALUE 0x2AU /* SMC_PMPROT */
  119. #define DEFAULT_SYSTEM_CLOCK 20971520u /* Default System clock value */
  120. /**
  121. * @brief System clock frequency (core clock)
  122. *
  123. * The system clock frequency supplied to the SysTick timer and the processor
  124. * core clock. This variable can be used by the user application to setup the
  125. * SysTick timer or configure other parameters. It may also be used by debugger to
  126. * query the frequency of the debug timer or configure the trace clock speed
  127. * SystemCoreClock is initialized with a correct predefined value.
  128. */
  129. extern uint32_t SystemCoreClock;
  130. /**
  131. * @brief Setup the microcontroller system.
  132. *
  133. * Typically this function configures the oscillator (PLL) that is part of the
  134. * microcontroller device. For systems with variable clock speed it also updates
  135. * the variable SystemCoreClock. SystemInit is called from startup_device file.
  136. */
  137. void SystemInit (void);
  138. /**
  139. * @brief Updates the SystemCoreClock variable.
  140. *
  141. * It must be called whenever the core clock is changed during program
  142. * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
  143. * the current core clock.
  144. */
  145. void SystemCoreClockUpdate (void);
  146. #ifdef __cplusplus
  147. }
  148. #endif
  149. #endif /* _SYSTEM_MK24F12_H_ */