rt-thread/bsp/Vango_V85xx/drivers/board.c

79 lines
1.6 KiB
C
Raw Normal View History

2021-09-07 20:08:26 +08:00
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-01-04 iysheng first version
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <target.h>
#include <board.h>
#include <drv_usart.h>
/*
* System Clock Configuration
*/
void SystemClock_Config(void)
{
// SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
NVIC_SetPriority(SysTick_IRQn, 0);
CLK_InitTypeDef CLK_Struct;
CLK_Struct.ClockType = CLK_TYPE_AHBSRC \
|CLK_TYPE_PLLL \
|CLK_TYPE_HCLK \
|CLK_TYPE_PCLK;
CLK_Struct.AHBSource = CLK_AHBSEL_LSPLL;
CLK_Struct.PLLL.Frequency = CLK_PLLL_26_2144MHz;
CLK_Struct.PLLL.Source = CLK_PLLLSRC_XTALL;
CLK_Struct.PLLL.State = CLK_PLLL_ON;
CLK_Struct.HCLK.Divider = 1;
CLK_Struct.PCLK.Divider = 2;
CLK_ClockConfig(&CLK_Struct);
}
/*
* This is the timer interrupt service routine.
*/
void SysTick_Handler(void)
{
/* enter interrupt */
rt_interrupt_enter();
rt_tick_increase();
/* leave interrupt */
rt_interrupt_leave();
}
/**
* This function will initial V85xx board.
*/
void rt_hw_board_init()
{
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef BSP_USING_SDRAM
rt_system_heap_init((void *)EXT_SDRAM_BEGIN, (void *)EXT_SDRAM_END);
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
}
/*@}*/