1 /* 2 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /****************************************************************************** 18 * @file system_PHOBOS.c 19 * @brief CSI Device System Source File for PHOBOS 20 * @version V1.0 21 * @date 02. June 2017 22 ******************************************************************************/ 23 24 #include "soc.h" 25 #include "csi_core.h" 26 #include "config.h" 27 28 /*---------------------------------------------------------------------------- 29 Define clocks 30 *----------------------------------------------------------------------------*/ 31 32 /*---------------------------------------------------------------------------- 33 System Core Clock Variable 34 *----------------------------------------------------------------------------*/ 35 int SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */ 36 37 extern int __Vectors; 38 SystemCoreClockUpdate(void)39void SystemCoreClockUpdate(void) 40 { 41 SystemCoreClock = SYSTEM_CLOCK; 42 } 43 44 /** 45 * @brief initialize the system 46 * Initialize the psr and vbr. 47 * @param None 48 * @return None 49 */ SystemInit(void)50void SystemInit(void) 51 { 52 /* Here we may setting exception vector, MGU, cache, and so on. */ 53 #ifdef CONFIG_SYSTEM_SECURE 54 __set_PSR(0xc0000140); 55 #else 56 __set_PSR(0x80000140); 57 #endif 58 __set_VBR((uint32_t) & (__Vectors)); 59 60 drv_coret_config(200 * 1000, CORET_IRQn); //10ms 61 drv_nvic_enable_irq(CORET_IRQn); 62 63 SystemCoreClock = SYSTEM_CLOCK; 64 } 65