added prescaler for 16 bit pwm in LPC1347 target

Fork of mbed-dev by mbed official

Committer:
JojoS
Date:
Sat Sep 10 15:32:04 2016 +0000
Revision:
147:ba84b7dc41a7
Parent:
121:7f86b4238bec
added prescaler for 16 bit timers (solution as in LPC11xx), default prescaler 31 for max 28 ms period time

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 121:7f86b4238bec 1 /*
mbed_official 121:7f86b4238bec 2 ** ###################################################################
mbed_official 121:7f86b4238bec 3 ** Processors: MKL27Z32VDA4
mbed_official 121:7f86b4238bec 4 ** MKL27Z32VFM4
mbed_official 121:7f86b4238bec 5 ** MKL27Z32VFT4
mbed_official 121:7f86b4238bec 6 ** MKL27Z32VLH4
mbed_official 121:7f86b4238bec 7 ** MKL27Z32VMP4
mbed_official 121:7f86b4238bec 8 ** MKL27Z64VDA4
mbed_official 121:7f86b4238bec 9 ** MKL27Z64VFM4
mbed_official 121:7f86b4238bec 10 ** MKL27Z64VFT4
mbed_official 121:7f86b4238bec 11 ** MKL27Z64VLH4
mbed_official 121:7f86b4238bec 12 ** MKL27Z64VMP4
mbed_official 121:7f86b4238bec 13 **
mbed_official 121:7f86b4238bec 14 ** Compilers: Keil ARM C/C++ Compiler
mbed_official 121:7f86b4238bec 15 ** Freescale C/C++ for Embedded ARM
mbed_official 121:7f86b4238bec 16 ** GNU C Compiler
mbed_official 121:7f86b4238bec 17 ** IAR ANSI C/C++ Compiler for ARM
mbed_official 121:7f86b4238bec 18 **
mbed_official 121:7f86b4238bec 19 ** Reference manual: KL27P64M48SF2RM, Rev. 1, Sep 2014
mbed_official 121:7f86b4238bec 20 ** Version: rev. 1.4, 2014-09-22
mbed_official 121:7f86b4238bec 21 ** Build: b151217
mbed_official 121:7f86b4238bec 22 **
mbed_official 121:7f86b4238bec 23 ** Abstract:
mbed_official 121:7f86b4238bec 24 ** Provides a system configuration function and a global variable that
mbed_official 121:7f86b4238bec 25 ** contains the system frequency. It configures the device and initializes
mbed_official 121:7f86b4238bec 26 ** the oscillator (PLL) that is part of the microcontroller device.
mbed_official 121:7f86b4238bec 27 **
mbed_official 121:7f86b4238bec 28 ** Copyright (c) 2015 Freescale Semiconductor, Inc.
mbed_official 121:7f86b4238bec 29 ** All rights reserved.
mbed_official 121:7f86b4238bec 30 **
mbed_official 121:7f86b4238bec 31 ** Redistribution and use in source and binary forms, with or without modification,
mbed_official 121:7f86b4238bec 32 ** are permitted provided that the following conditions are met:
mbed_official 121:7f86b4238bec 33 **
mbed_official 121:7f86b4238bec 34 ** o Redistributions of source code must retain the above copyright notice, this list
mbed_official 121:7f86b4238bec 35 ** of conditions and the following disclaimer.
mbed_official 121:7f86b4238bec 36 **
mbed_official 121:7f86b4238bec 37 ** o Redistributions in binary form must reproduce the above copyright notice, this
mbed_official 121:7f86b4238bec 38 ** list of conditions and the following disclaimer in the documentation and/or
mbed_official 121:7f86b4238bec 39 ** other materials provided with the distribution.
mbed_official 121:7f86b4238bec 40 **
mbed_official 121:7f86b4238bec 41 ** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
mbed_official 121:7f86b4238bec 42 ** contributors may be used to endorse or promote products derived from this
mbed_official 121:7f86b4238bec 43 ** software without specific prior written permission.
mbed_official 121:7f86b4238bec 44 **
mbed_official 121:7f86b4238bec 45 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
mbed_official 121:7f86b4238bec 46 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
mbed_official 121:7f86b4238bec 47 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 121:7f86b4238bec 48 ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
mbed_official 121:7f86b4238bec 49 ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
mbed_official 121:7f86b4238bec 50 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
mbed_official 121:7f86b4238bec 51 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
mbed_official 121:7f86b4238bec 52 ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mbed_official 121:7f86b4238bec 53 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
mbed_official 121:7f86b4238bec 54 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 121:7f86b4238bec 55 **
mbed_official 121:7f86b4238bec 56 ** http: www.freescale.com
mbed_official 121:7f86b4238bec 57 ** mail: support@freescale.com
mbed_official 121:7f86b4238bec 58 **
mbed_official 121:7f86b4238bec 59 ** Revisions:
mbed_official 121:7f86b4238bec 60 ** - rev. 1.0 (2014-05-12)
mbed_official 121:7f86b4238bec 61 ** Initial version.
mbed_official 121:7f86b4238bec 62 ** - rev. 1.1 (2014-07-10)
mbed_official 121:7f86b4238bec 63 ** UART0 - UART0 module renamed to UART2.
mbed_official 121:7f86b4238bec 64 ** - rev. 1.2 (2014-08-12)
mbed_official 121:7f86b4238bec 65 ** CRC - CRC register renamed to DATA.
mbed_official 121:7f86b4238bec 66 ** - rev. 1.3 (2014-09-02)
mbed_official 121:7f86b4238bec 67 ** USB - USB0_CTL0 was renamed to USB0_OTGCTL register.
mbed_official 121:7f86b4238bec 68 ** USB - USB0_CTL1 was renamed to USB0_CTL register.
mbed_official 121:7f86b4238bec 69 ** USB - Two new bitfields (STOP_ACK_DLY_EN, AHB_DLY_EN) was added to the USB0_KEEP_ALIVE_CTRL register.
mbed_official 121:7f86b4238bec 70 ** - rev. 1.4 (2014-09-22)
mbed_official 121:7f86b4238bec 71 ** FLEXIO - Offsets of the SHIFTBUFBIS registers were interchanged with offsets of the SHIFTBUFBBS registers.
mbed_official 121:7f86b4238bec 72 ** SIM - Changed bitfield value MCGIRCLK to LIRC_CLK of bitfield CLKOUTSEL in SOPT2 register.
mbed_official 121:7f86b4238bec 73 ** SIM - Removed bitfield DIEID in SDID register.
mbed_official 121:7f86b4238bec 74 ** UART2 - Removed ED register.
mbed_official 121:7f86b4238bec 75 ** UART2 - Removed MODEM register.
mbed_official 121:7f86b4238bec 76 ** UART2 - Removed IR register.
mbed_official 121:7f86b4238bec 77 ** UART2 - Removed PFIFO register.
mbed_official 121:7f86b4238bec 78 ** UART2 - Removed CFIFO register.
mbed_official 121:7f86b4238bec 79 ** UART2 - Removed SFIFO register.
mbed_official 121:7f86b4238bec 80 ** UART2 - Removed TWFIFO register.
mbed_official 121:7f86b4238bec 81 ** UART2 - Removed TCFIFO register.
mbed_official 121:7f86b4238bec 82 ** UART2 - Removed RWFIFO register.
mbed_official 121:7f86b4238bec 83 ** UART2 - Removed RCFIFO register.
mbed_official 121:7f86b4238bec 84 ** USB - Removed bitfield REG_EN in CLK_RECOVER_IRC_EN register.
mbed_official 121:7f86b4238bec 85 ** USB - Renamed USBEN bitfield of USB0_CTL was renamed to USBENSOFEN.
mbed_official 121:7f86b4238bec 86 **
mbed_official 121:7f86b4238bec 87 ** ###################################################################
mbed_official 121:7f86b4238bec 88 */
mbed_official 121:7f86b4238bec 89
mbed_official 121:7f86b4238bec 90 /*!
mbed_official 121:7f86b4238bec 91 * @file MKL27Z644
mbed_official 121:7f86b4238bec 92 * @version 1.4
mbed_official 121:7f86b4238bec 93 * @date 2014-09-22
mbed_official 121:7f86b4238bec 94 * @brief Device specific configuration file for MKL27Z644 (header file)
mbed_official 121:7f86b4238bec 95 *
mbed_official 121:7f86b4238bec 96 * Provides a system configuration function and a global variable that contains
mbed_official 121:7f86b4238bec 97 * the system frequency. It configures the device and initializes the oscillator
mbed_official 121:7f86b4238bec 98 * (PLL) that is part of the microcontroller device.
mbed_official 121:7f86b4238bec 99 */
mbed_official 121:7f86b4238bec 100
mbed_official 121:7f86b4238bec 101 #ifndef _SYSTEM_MKL27Z644_H_
mbed_official 121:7f86b4238bec 102 #define _SYSTEM_MKL27Z644_H_ /**< Symbol preventing repeated inclusion */
mbed_official 121:7f86b4238bec 103
mbed_official 121:7f86b4238bec 104 #ifdef __cplusplus
mbed_official 121:7f86b4238bec 105 extern "C" {
mbed_official 121:7f86b4238bec 106 #endif
mbed_official 121:7f86b4238bec 107
mbed_official 121:7f86b4238bec 108 #include <stdint.h>
mbed_official 121:7f86b4238bec 109
mbed_official 121:7f86b4238bec 110
mbed_official 121:7f86b4238bec 111 #ifndef DISABLE_WDOG
mbed_official 121:7f86b4238bec 112 #define DISABLE_WDOG 1
mbed_official 121:7f86b4238bec 113 #endif
mbed_official 121:7f86b4238bec 114
mbed_official 121:7f86b4238bec 115 #ifndef ACK_ISOLATION
mbed_official 121:7f86b4238bec 116 #define ACK_ISOLATION 1
mbed_official 121:7f86b4238bec 117 #endif
mbed_official 121:7f86b4238bec 118
mbed_official 121:7f86b4238bec 119 /* Define clock source values */
mbed_official 121:7f86b4238bec 120
mbed_official 121:7f86b4238bec 121 #define CPU_XTAL_CLK_HZ 32768u /* Value of the external crystal or oscillator clock frequency in Hz */
mbed_official 121:7f86b4238bec 122 #define CPU_INT_FAST_CLK_HZ 48000000u /* Value of the fast internal oscillator clock frequency in Hz */
mbed_official 121:7f86b4238bec 123 #define CPU_INT_IRC_CLK_HZ 48000000u /* Value of the 48M internal oscillator clock frequency in Hz */
mbed_official 121:7f86b4238bec 124
mbed_official 121:7f86b4238bec 125 /* Low power mode enable */
mbed_official 121:7f86b4238bec 126 /* SMC_PMPROT: AVLP=1,AVLLS=1 */
mbed_official 121:7f86b4238bec 127 #define SYSTEM_SMC_PMPROT_VALUE 0x2Au /* SMC_PMPROT */
mbed_official 121:7f86b4238bec 128
mbed_official 121:7f86b4238bec 129 #define DEFAULT_SYSTEM_CLOCK 8000000u /* Default System clock value */
mbed_official 121:7f86b4238bec 130 #define CPU_INT_SLOW_CLK_HZ 8000000u /* Value of the slow internal oscillator clock frequency in Hz */
mbed_official 121:7f86b4238bec 131
mbed_official 121:7f86b4238bec 132
mbed_official 121:7f86b4238bec 133 /**
mbed_official 121:7f86b4238bec 134 * @brief System clock frequency (core clock)
mbed_official 121:7f86b4238bec 135 *
mbed_official 121:7f86b4238bec 136 * The system clock frequency supplied to the SysTick timer and the processor
mbed_official 121:7f86b4238bec 137 * core clock. This variable can be used by the user application to setup the
mbed_official 121:7f86b4238bec 138 * SysTick timer or configure other parameters. It may also be used by debugger to
mbed_official 121:7f86b4238bec 139 * query the frequency of the debug timer or configure the trace clock speed
mbed_official 121:7f86b4238bec 140 * SystemCoreClock is initialized with a correct predefined value.
mbed_official 121:7f86b4238bec 141 */
mbed_official 121:7f86b4238bec 142 extern uint32_t SystemCoreClock;
mbed_official 121:7f86b4238bec 143
mbed_official 121:7f86b4238bec 144 /**
mbed_official 121:7f86b4238bec 145 * @brief Setup the microcontroller system.
mbed_official 121:7f86b4238bec 146 *
mbed_official 121:7f86b4238bec 147 * Typically this function configures the oscillator (PLL) that is part of the
mbed_official 121:7f86b4238bec 148 * microcontroller device. For systems with variable clock speed it also updates
mbed_official 121:7f86b4238bec 149 * the variable SystemCoreClock. SystemInit is called from startup_device file.
mbed_official 121:7f86b4238bec 150 */
mbed_official 121:7f86b4238bec 151 void SystemInit (void);
mbed_official 121:7f86b4238bec 152
mbed_official 121:7f86b4238bec 153 /**
mbed_official 121:7f86b4238bec 154 * @brief Updates the SystemCoreClock variable.
mbed_official 121:7f86b4238bec 155 *
mbed_official 121:7f86b4238bec 156 * It must be called whenever the core clock is changed during program
mbed_official 121:7f86b4238bec 157 * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
mbed_official 121:7f86b4238bec 158 * the current core clock.
mbed_official 121:7f86b4238bec 159 */
mbed_official 121:7f86b4238bec 160 void SystemCoreClockUpdate (void);
mbed_official 121:7f86b4238bec 161
mbed_official 121:7f86b4238bec 162 #ifdef __cplusplus
mbed_official 121:7f86b4238bec 163 }
mbed_official 121:7f86b4238bec 164 #endif
mbed_official 121:7f86b4238bec 165
mbed_official 121:7f86b4238bec 166 #endif /* _SYSTEM_MKL27Z644_H_ */