Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed-dev/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z/device/system_MKW41Z4.h@18:6a4db94011d3, 2017-05-14 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sun May 14 23:18:57 2017 +0000
- Revision:
- 18:6a4db94011d3
Publishing again
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /* |
sahilmgandhi | 18:6a4db94011d3 | 2 | ** ################################################################### |
sahilmgandhi | 18:6a4db94011d3 | 3 | ** Processors: MKW41Z256VHT4 |
sahilmgandhi | 18:6a4db94011d3 | 4 | ** MKW41Z512VHT4 |
sahilmgandhi | 18:6a4db94011d3 | 5 | ** |
sahilmgandhi | 18:6a4db94011d3 | 6 | ** Compilers: Keil ARM C/C++ Compiler |
sahilmgandhi | 18:6a4db94011d3 | 7 | ** GNU C Compiler |
sahilmgandhi | 18:6a4db94011d3 | 8 | ** IAR ANSI C/C++ Compiler for ARM |
sahilmgandhi | 18:6a4db94011d3 | 9 | ** |
sahilmgandhi | 18:6a4db94011d3 | 10 | ** Reference manual: MKW41Z512RM Rev. 0.1, 04/2016 |
sahilmgandhi | 18:6a4db94011d3 | 11 | ** Version: rev. 1.0, 2015-09-23 |
sahilmgandhi | 18:6a4db94011d3 | 12 | ** Build: b160720 |
sahilmgandhi | 18:6a4db94011d3 | 13 | ** |
sahilmgandhi | 18:6a4db94011d3 | 14 | ** Abstract: |
sahilmgandhi | 18:6a4db94011d3 | 15 | ** Provides a system configuration function and a global variable that |
sahilmgandhi | 18:6a4db94011d3 | 16 | ** contains the system frequency. It configures the device and initializes |
sahilmgandhi | 18:6a4db94011d3 | 17 | ** the oscillator (PLL) that is part of the microcontroller device. |
sahilmgandhi | 18:6a4db94011d3 | 18 | ** |
sahilmgandhi | 18:6a4db94011d3 | 19 | ** Copyright (c) 2016 Freescale Semiconductor, Inc. |
sahilmgandhi | 18:6a4db94011d3 | 20 | ** All rights reserved. |
sahilmgandhi | 18:6a4db94011d3 | 21 | ** |
sahilmgandhi | 18:6a4db94011d3 | 22 | ** Redistribution and use in source and binary forms, with or without modification, |
sahilmgandhi | 18:6a4db94011d3 | 23 | ** are permitted provided that the following conditions are met: |
sahilmgandhi | 18:6a4db94011d3 | 24 | ** |
sahilmgandhi | 18:6a4db94011d3 | 25 | ** o Redistributions of source code must retain the above copyright notice, this list |
sahilmgandhi | 18:6a4db94011d3 | 26 | ** of conditions and the following disclaimer. |
sahilmgandhi | 18:6a4db94011d3 | 27 | ** |
sahilmgandhi | 18:6a4db94011d3 | 28 | ** o Redistributions in binary form must reproduce the above copyright notice, this |
sahilmgandhi | 18:6a4db94011d3 | 29 | ** list of conditions and the following disclaimer in the documentation and/or |
sahilmgandhi | 18:6a4db94011d3 | 30 | ** other materials provided with the distribution. |
sahilmgandhi | 18:6a4db94011d3 | 31 | ** |
sahilmgandhi | 18:6a4db94011d3 | 32 | ** o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
sahilmgandhi | 18:6a4db94011d3 | 33 | ** contributors may be used to endorse or promote products derived from this |
sahilmgandhi | 18:6a4db94011d3 | 34 | ** software without specific prior written permission. |
sahilmgandhi | 18:6a4db94011d3 | 35 | ** |
sahilmgandhi | 18:6a4db94011d3 | 36 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
sahilmgandhi | 18:6a4db94011d3 | 37 | ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
sahilmgandhi | 18:6a4db94011d3 | 38 | ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
sahilmgandhi | 18:6a4db94011d3 | 39 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
sahilmgandhi | 18:6a4db94011d3 | 40 | ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
sahilmgandhi | 18:6a4db94011d3 | 41 | ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
sahilmgandhi | 18:6a4db94011d3 | 42 | ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
sahilmgandhi | 18:6a4db94011d3 | 43 | ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
sahilmgandhi | 18:6a4db94011d3 | 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
sahilmgandhi | 18:6a4db94011d3 | 45 | ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
sahilmgandhi | 18:6a4db94011d3 | 46 | ** |
sahilmgandhi | 18:6a4db94011d3 | 47 | ** http: www.freescale.com |
sahilmgandhi | 18:6a4db94011d3 | 48 | ** mail: support@freescale.com |
sahilmgandhi | 18:6a4db94011d3 | 49 | ** |
sahilmgandhi | 18:6a4db94011d3 | 50 | ** Revisions: |
sahilmgandhi | 18:6a4db94011d3 | 51 | ** - rev. 1.0 (2015-09-23) |
sahilmgandhi | 18:6a4db94011d3 | 52 | ** Initial version. |
sahilmgandhi | 18:6a4db94011d3 | 53 | ** |
sahilmgandhi | 18:6a4db94011d3 | 54 | ** ################################################################### |
sahilmgandhi | 18:6a4db94011d3 | 55 | */ |
sahilmgandhi | 18:6a4db94011d3 | 56 | |
sahilmgandhi | 18:6a4db94011d3 | 57 | /*! |
sahilmgandhi | 18:6a4db94011d3 | 58 | * @file MKW41Z4 |
sahilmgandhi | 18:6a4db94011d3 | 59 | * @version 1.0 |
sahilmgandhi | 18:6a4db94011d3 | 60 | * @date 2015-09-23 |
sahilmgandhi | 18:6a4db94011d3 | 61 | * @brief Device specific configuration file for MKW41Z4 (header file) |
sahilmgandhi | 18:6a4db94011d3 | 62 | * |
sahilmgandhi | 18:6a4db94011d3 | 63 | * Provides a system configuration function and a global variable that contains |
sahilmgandhi | 18:6a4db94011d3 | 64 | * the system frequency. It configures the device and initializes the oscillator |
sahilmgandhi | 18:6a4db94011d3 | 65 | * (PLL) that is part of the microcontroller device. |
sahilmgandhi | 18:6a4db94011d3 | 66 | */ |
sahilmgandhi | 18:6a4db94011d3 | 67 | |
sahilmgandhi | 18:6a4db94011d3 | 68 | #ifndef _SYSTEM_MKW41Z4_H_ |
sahilmgandhi | 18:6a4db94011d3 | 69 | #define _SYSTEM_MKW41Z4_H_ /**< Symbol preventing repeated inclusion */ |
sahilmgandhi | 18:6a4db94011d3 | 70 | |
sahilmgandhi | 18:6a4db94011d3 | 71 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 72 | extern "C" { |
sahilmgandhi | 18:6a4db94011d3 | 73 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 74 | |
sahilmgandhi | 18:6a4db94011d3 | 75 | #include <stdint.h> |
sahilmgandhi | 18:6a4db94011d3 | 76 | |
sahilmgandhi | 18:6a4db94011d3 | 77 | |
sahilmgandhi | 18:6a4db94011d3 | 78 | #ifndef DISABLE_WDOG |
sahilmgandhi | 18:6a4db94011d3 | 79 | #define DISABLE_WDOG 1 |
sahilmgandhi | 18:6a4db94011d3 | 80 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 81 | |
sahilmgandhi | 18:6a4db94011d3 | 82 | /* Define clock source values */ |
sahilmgandhi | 18:6a4db94011d3 | 83 | |
sahilmgandhi | 18:6a4db94011d3 | 84 | #define CPU_XTAL_CLK_HZ 32000000u /* Value of the external crystal or oscillator clock frequency in Hz */ |
sahilmgandhi | 18:6a4db94011d3 | 85 | #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */ |
sahilmgandhi | 18:6a4db94011d3 | 86 | #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */ |
sahilmgandhi | 18:6a4db94011d3 | 87 | #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */ |
sahilmgandhi | 18:6a4db94011d3 | 88 | |
sahilmgandhi | 18:6a4db94011d3 | 89 | /* RF oscillator setting */ |
sahilmgandhi | 18:6a4db94011d3 | 90 | #define SYSTEM_RSIM_CONTROL_VALUE 0xC00100U /* Enable RF oscillator in Run/Wait mode */ |
sahilmgandhi | 18:6a4db94011d3 | 91 | |
sahilmgandhi | 18:6a4db94011d3 | 92 | /* Low power mode enable */ |
sahilmgandhi | 18:6a4db94011d3 | 93 | |
sahilmgandhi | 18:6a4db94011d3 | 94 | /* SMC_PMPROT: ?=0,?=0,AVLP=1,?=0,?=0,?=0,AVLLS=1,?=0 */ |
sahilmgandhi | 18:6a4db94011d3 | 95 | #define SYSTEM_SMC_PMPROT_VALUE (SMC_PMPROT_AVLP_MASK | SMC_PMPROT_ALLS_MASK | SMC_PMPROT_AVLLS_MASK) /* Mask of allowed low power modes used to initialize power modes protection register */ |
sahilmgandhi | 18:6a4db94011d3 | 96 | |
sahilmgandhi | 18:6a4db94011d3 | 97 | #define DEFAULT_SYSTEM_CLOCK 20971520U /* Default System clock value */ |
sahilmgandhi | 18:6a4db94011d3 | 98 | |
sahilmgandhi | 18:6a4db94011d3 | 99 | |
sahilmgandhi | 18:6a4db94011d3 | 100 | /** |
sahilmgandhi | 18:6a4db94011d3 | 101 | * @brief System clock frequency (core clock) |
sahilmgandhi | 18:6a4db94011d3 | 102 | * |
sahilmgandhi | 18:6a4db94011d3 | 103 | * The system clock frequency supplied to the SysTick timer and the processor |
sahilmgandhi | 18:6a4db94011d3 | 104 | * core clock. This variable can be used by the user application to setup the |
sahilmgandhi | 18:6a4db94011d3 | 105 | * SysTick timer or configure other parameters. It may also be used by debugger to |
sahilmgandhi | 18:6a4db94011d3 | 106 | * query the frequency of the debug timer or configure the trace clock speed |
sahilmgandhi | 18:6a4db94011d3 | 107 | * SystemCoreClock is initialized with a correct predefined value. |
sahilmgandhi | 18:6a4db94011d3 | 108 | */ |
sahilmgandhi | 18:6a4db94011d3 | 109 | extern uint32_t SystemCoreClock; |
sahilmgandhi | 18:6a4db94011d3 | 110 | |
sahilmgandhi | 18:6a4db94011d3 | 111 | /** |
sahilmgandhi | 18:6a4db94011d3 | 112 | * @brief Setup the microcontroller system. |
sahilmgandhi | 18:6a4db94011d3 | 113 | * |
sahilmgandhi | 18:6a4db94011d3 | 114 | * Typically this function configures the oscillator (PLL) that is part of the |
sahilmgandhi | 18:6a4db94011d3 | 115 | * microcontroller device. For systems with variable clock speed it also updates |
sahilmgandhi | 18:6a4db94011d3 | 116 | * the variable SystemCoreClock. SystemInit is called from startup_device file. |
sahilmgandhi | 18:6a4db94011d3 | 117 | */ |
sahilmgandhi | 18:6a4db94011d3 | 118 | void SystemInit (void); |
sahilmgandhi | 18:6a4db94011d3 | 119 | |
sahilmgandhi | 18:6a4db94011d3 | 120 | /** |
sahilmgandhi | 18:6a4db94011d3 | 121 | * @brief Updates the SystemCoreClock variable. |
sahilmgandhi | 18:6a4db94011d3 | 122 | * |
sahilmgandhi | 18:6a4db94011d3 | 123 | * It must be called whenever the core clock is changed during program |
sahilmgandhi | 18:6a4db94011d3 | 124 | * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates |
sahilmgandhi | 18:6a4db94011d3 | 125 | * the current core clock. |
sahilmgandhi | 18:6a4db94011d3 | 126 | */ |
sahilmgandhi | 18:6a4db94011d3 | 127 | void SystemCoreClockUpdate (void); |
sahilmgandhi | 18:6a4db94011d3 | 128 | |
sahilmgandhi | 18:6a4db94011d3 | 129 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 130 | } |
sahilmgandhi | 18:6a4db94011d3 | 131 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 132 | |
sahilmgandhi | 18:6a4db94011d3 | 133 | #endif /* _SYSTEM_MKW41Z4_H_ */ |