mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_ARM_SSG/TARGET_MPS2_BEID/system_CMSDK_BEID.c@624:83778a75d1b4, 2015-09-25 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Sep 25 11:45:09 2015 +0100
- Revision:
- 624:83778a75d1b4
Synchronized with git revision b290644b9cdd33d24fc3f629368795b3d9c386fe
Full URL: https://github.com/mbedmicro/mbed/commit/b290644b9cdd33d24fc3f629368795b3d9c386fe/
changes for adding IoT Subsystem for Cortex-M target
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 624:83778a75d1b4 | 1 | /**************************************************************************//** |
mbed_official | 624:83778a75d1b4 | 2 | * @file system_CMSDK_BEID.c |
mbed_official | 624:83778a75d1b4 | 3 | * @brief CMSIS Device System Source File for |
mbed_official | 624:83778a75d1b4 | 4 | * CMSDK_M3 Device |
mbed_official | 624:83778a75d1b4 | 5 | * @version V3.02 |
mbed_official | 624:83778a75d1b4 | 6 | * @date 15. November 2013 |
mbed_official | 624:83778a75d1b4 | 7 | * |
mbed_official | 624:83778a75d1b4 | 8 | * @note |
mbed_official | 624:83778a75d1b4 | 9 | * |
mbed_official | 624:83778a75d1b4 | 10 | ******************************************************************************/ |
mbed_official | 624:83778a75d1b4 | 11 | /* Copyright (c) 2011 - 2013 ARM LIMITED |
mbed_official | 624:83778a75d1b4 | 12 | |
mbed_official | 624:83778a75d1b4 | 13 | All rights reserved. |
mbed_official | 624:83778a75d1b4 | 14 | Redistribution and use in source and binary forms, with or without |
mbed_official | 624:83778a75d1b4 | 15 | modification, are permitted provided that the following conditions are met: |
mbed_official | 624:83778a75d1b4 | 16 | - Redistributions of source code must retain the above copyright |
mbed_official | 624:83778a75d1b4 | 17 | notice, this list of conditions and the following disclaimer. |
mbed_official | 624:83778a75d1b4 | 18 | - Redistributions in binary form must reproduce the above copyright |
mbed_official | 624:83778a75d1b4 | 19 | notice, this list of conditions and the following disclaimer in the |
mbed_official | 624:83778a75d1b4 | 20 | documentation and/or other materials provided with the distribution. |
mbed_official | 624:83778a75d1b4 | 21 | - Neither the name of ARM nor the names of its contributors may be used |
mbed_official | 624:83778a75d1b4 | 22 | to endorse or promote products derived from this software without |
mbed_official | 624:83778a75d1b4 | 23 | specific prior written permission. |
mbed_official | 624:83778a75d1b4 | 24 | * |
mbed_official | 624:83778a75d1b4 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 624:83778a75d1b4 | 26 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 624:83778a75d1b4 | 27 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
mbed_official | 624:83778a75d1b4 | 28 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
mbed_official | 624:83778a75d1b4 | 29 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
mbed_official | 624:83778a75d1b4 | 30 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
mbed_official | 624:83778a75d1b4 | 31 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
mbed_official | 624:83778a75d1b4 | 32 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
mbed_official | 624:83778a75d1b4 | 33 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
mbed_official | 624:83778a75d1b4 | 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
mbed_official | 624:83778a75d1b4 | 35 | POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 624:83778a75d1b4 | 36 | ---------------------------------------------------------------------------*/ |
mbed_official | 624:83778a75d1b4 | 37 | |
mbed_official | 624:83778a75d1b4 | 38 | |
mbed_official | 624:83778a75d1b4 | 39 | #include "CMSDK_BEID.h" |
mbed_official | 624:83778a75d1b4 | 40 | |
mbed_official | 624:83778a75d1b4 | 41 | /*---------------------------------------------------------------------------- |
mbed_official | 624:83778a75d1b4 | 42 | Define clocks |
mbed_official | 624:83778a75d1b4 | 43 | *----------------------------------------------------------------------------*/ |
mbed_official | 624:83778a75d1b4 | 44 | #define __XTAL (50000000UL) /* Oscillator frequency */ |
mbed_official | 624:83778a75d1b4 | 45 | |
mbed_official | 624:83778a75d1b4 | 46 | #define __SYSTEM_CLOCK (__XTAL / 2) |
mbed_official | 624:83778a75d1b4 | 47 | |
mbed_official | 624:83778a75d1b4 | 48 | |
mbed_official | 624:83778a75d1b4 | 49 | /*---------------------------------------------------------------------------- |
mbed_official | 624:83778a75d1b4 | 50 | Clock Variable definitions |
mbed_official | 624:83778a75d1b4 | 51 | *----------------------------------------------------------------------------*/ |
mbed_official | 624:83778a75d1b4 | 52 | uint32_t SystemCoreClock = __SYSTEM_CLOCK;/*!< System Clock Frequency (Core Clock)*/ |
mbed_official | 624:83778a75d1b4 | 53 | |
mbed_official | 624:83778a75d1b4 | 54 | |
mbed_official | 624:83778a75d1b4 | 55 | /*---------------------------------------------------------------------------- |
mbed_official | 624:83778a75d1b4 | 56 | Clock functions |
mbed_official | 624:83778a75d1b4 | 57 | *----------------------------------------------------------------------------*/ |
mbed_official | 624:83778a75d1b4 | 58 | /** |
mbed_official | 624:83778a75d1b4 | 59 | * Update SystemCoreClock variable |
mbed_official | 624:83778a75d1b4 | 60 | * |
mbed_official | 624:83778a75d1b4 | 61 | * @param none |
mbed_official | 624:83778a75d1b4 | 62 | * @return none |
mbed_official | 624:83778a75d1b4 | 63 | * |
mbed_official | 624:83778a75d1b4 | 64 | * @brief Updates the SystemCoreClock with current core Clock |
mbed_official | 624:83778a75d1b4 | 65 | * retrieved from cpu registers. |
mbed_official | 624:83778a75d1b4 | 66 | */ |
mbed_official | 624:83778a75d1b4 | 67 | void SystemCoreClockUpdate (void) |
mbed_official | 624:83778a75d1b4 | 68 | { |
mbed_official | 624:83778a75d1b4 | 69 | |
mbed_official | 624:83778a75d1b4 | 70 | SystemCoreClock = __SYSTEM_CLOCK; |
mbed_official | 624:83778a75d1b4 | 71 | |
mbed_official | 624:83778a75d1b4 | 72 | } |
mbed_official | 624:83778a75d1b4 | 73 | |
mbed_official | 624:83778a75d1b4 | 74 | /** |
mbed_official | 624:83778a75d1b4 | 75 | * Initialize the system |
mbed_official | 624:83778a75d1b4 | 76 | * |
mbed_official | 624:83778a75d1b4 | 77 | * @param none |
mbed_official | 624:83778a75d1b4 | 78 | * @return none |
mbed_official | 624:83778a75d1b4 | 79 | * |
mbed_official | 624:83778a75d1b4 | 80 | * @brief Setup the microcontroller system. |
mbed_official | 624:83778a75d1b4 | 81 | * Initialize the System. |
mbed_official | 624:83778a75d1b4 | 82 | */ |
mbed_official | 624:83778a75d1b4 | 83 | void SystemInit (void) |
mbed_official | 624:83778a75d1b4 | 84 | { |
mbed_official | 624:83778a75d1b4 | 85 | |
mbed_official | 624:83778a75d1b4 | 86 | #ifdef UNALIGNED_SUPPORT_DISABLE |
mbed_official | 624:83778a75d1b4 | 87 | SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; |
mbed_official | 624:83778a75d1b4 | 88 | #endif |
mbed_official | 624:83778a75d1b4 | 89 | |
mbed_official | 624:83778a75d1b4 | 90 | SystemCoreClock = __SYSTEM_CLOCK; |
mbed_official | 624:83778a75d1b4 | 91 | |
mbed_official | 624:83778a75d1b4 | 92 | // Enable AHB and APB clock |
mbed_official | 624:83778a75d1b4 | 93 | CMSDK_SYSCON->AHBCLKCFG0SET = 0xF; // GPIO |
mbed_official | 624:83778a75d1b4 | 94 | CMSDK_SYSCON->APBCLKCFG0SET = 0x37; // UART0, UART1, TIMER0, TIMER1, DUAL TIMER |
mbed_official | 624:83778a75d1b4 | 95 | } |