added prescaler for 16 bit pwm in LPC1347 target

Fork of mbed-dev by mbed official

Committer:
mbed_official
Date:
Tue May 03 00:15:16 2016 +0100
Revision:
121:7f86b4238bec
Parent:
0:9b334a45a8ff
Child:
144:ef7eb2e8f9f7
Synchronized with git revision 9cef243de23875778f461bbe9a8c1bc47e65212b

Full URL: https://github.com/mbedmicro/mbed/commit/9cef243de23875778f461bbe9a8c1bc47e65212b/

Switch to KSDK 2.0

Who changed what in which revision?

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