mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Fri Aug 19 10:17:11 2016 +0100
Revision:
124:2241e3a39974
Parent:
90:cb3d968589d8
Release 124 of the mbed library

Changes:

- new targets - KL27Z, K66F
- deprecate macro - add since argument
- override new and delete operators to trap errors
- Maxim - i2c and dac bugfixes
- STM - STM32F4 - serial flow enablement, enable async serial
- pwm and analog definition clean-up
- Nordic - NRF51 - fix for overflow in the ticket

Who changed what in which revision?

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