2022-03-28 17:19:25 +08:00

55 lines
1.5 KiB
C

/*
* Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/******************************************************************************
* @file system.c
* @brief CSI Device System Source File
* @version V1.0
* @date 02. June 2017
******************************************************************************/
#include <csi_config.h>
#include "csi_core.h"
/**
* @brief initialize the system
* Initialize the psr and vbr.
* @param None
* @return None
*/
void SystemInit(void)
{
__set_VBR((uint32_t) & (irq_vectors));
#if defined(CONFIG_SEPARATE_IRQ_SP) && !defined(CONFIG_KERNEL_NONE)
/* 801 not supported */
extern int32_t g_top_irqstack;
__set_Int_SP((uint32_t)&g_top_irqstack);
__set_CHR(__get_CHR() | CHR_ISE_Msk);
VIC->TSPR = 0xFF;
#endif
__set_CHR(__get_CHR() | CHR_IAE_Msk);
/* Clear active and pending IRQ */
VIC->IABR[0] = 0x0;
VIC->ICPR[0] = 0xFFFFFFFF;
#ifdef CONFIG_KERNEL_NONE
__enable_excp_irq();
#endif
}