Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 1 | /** |
| 2 | * \file |
| 3 | * |
| 4 | * \brief Low-level initialization functions called upon chip startup. |
| 5 | * |
| 6 | * Copyright (c) 2018 Microchip Technology Inc. |
| 7 | * |
| 8 | * \asf_license_start |
| 9 | * |
| 10 | * \page License |
| 11 | * |
| 12 | * SPDX-License-Identifier: Apache-2.0 |
| 13 | * |
| 14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 15 | * not use this file except in compliance with the License. |
| 16 | * You may obtain a copy of the Licence at |
| 17 | * |
| 18 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 19 | * |
| 20 | * Unless required by applicable law or agreed to in writing, software |
| 21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 23 | * See the License for the specific language governing permissions and |
| 24 | * limitations under the License. |
| 25 | * |
| 26 | * \asf_license_stop |
| 27 | * |
| 28 | */ |
| 29 | |
| 30 | #include "same54.h" |
Harald Welte | 3450fec | 2019-05-17 20:31:31 +0200 | [diff] [blame] | 31 | #include "peripheral_clk_config.h" |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Initial system clock frequency. The System RC Oscillator (RCSYS) provides |
| 35 | * the source for the main clock at chip startup. |
| 36 | */ |
Harald Welte | 3450fec | 2019-05-17 20:31:31 +0200 | [diff] [blame] | 37 | #define __SYSTEM_CLOCK CONF_CPU_FREQUENCY |
Kévin Redon | 69b92d9 | 2019-01-24 16:39:20 +0100 | [diff] [blame] | 38 | |
| 39 | uint32_t SystemCoreClock = __SYSTEM_CLOCK; /*!< System Clock Frequency (Core Clock)*/ |
| 40 | |
| 41 | /** |
| 42 | * Initialize the system |
| 43 | * |
| 44 | * @brief Setup the microcontroller system. |
| 45 | * Initialize the System and update the SystemCoreClock variable. |
| 46 | */ |
| 47 | void SystemInit(void) |
| 48 | { |
| 49 | // Keep the default device state after reset |
| 50 | SystemCoreClock = __SYSTEM_CLOCK; |
| 51 | return; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Update SystemCoreClock variable |
| 56 | * |
| 57 | * @brief Updates the SystemCoreClock with current core Clock |
| 58 | * retrieved from cpu registers. |
| 59 | */ |
| 60 | void SystemCoreClockUpdate(void) |
| 61 | { |
| 62 | // Not implemented |
| 63 | SystemCoreClock = __SYSTEM_CLOCK; |
| 64 | return; |
| 65 | } |