78 lines
1.7 KiB
C
78 lines
1.7 KiB
C
/*
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Change Logs:
|
|
* Date Author Notes
|
|
* 2023-07-15 yby the first version
|
|
*/
|
|
|
|
#include "board.h"
|
|
|
|
void uart_hw_config(void)
|
|
{
|
|
#ifdef BSP_USING_UART0
|
|
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
|
|
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
|
|
GPIOPinConfigure(GPIO_PA0_U0RX);
|
|
GPIOPinConfigure(GPIO_PA1_U0TX);
|
|
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
|
|
#endif
|
|
}
|
|
|
|
/* this funtion set the Systick and enable systick int */
|
|
void SystemClock_Config()
|
|
{
|
|
/* System Clock Update */
|
|
SystemCoreClockUpdate();
|
|
|
|
SysTickDisable();
|
|
SysTickPeriodSet(SystemCoreClock / RT_TICK_PER_SECOND);
|
|
SysTickIntEnable();
|
|
SysTickEnable();
|
|
}
|
|
|
|
/**
|
|
* This function will initial your board.
|
|
*/
|
|
void rt_hw_board_init()
|
|
{
|
|
/* System clock initialization */
|
|
SystemClock_Config();
|
|
|
|
/* Heap initialization */
|
|
#if defined(RT_USING_HEAP)
|
|
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
|
|
#endif
|
|
|
|
/* Pin driver initialization is open by default */
|
|
#ifdef RT_USING_PIN
|
|
rt_hw_pin_init();
|
|
#endif
|
|
|
|
/* USART driver initialization is open by default */
|
|
#ifdef RT_USING_SERIAL
|
|
rt_hw_usart_init();
|
|
#endif
|
|
|
|
/* Set the shell console output device */
|
|
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
|
|
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
|
#endif
|
|
|
|
/* Board underlying hardware initialization */
|
|
#ifdef RT_USING_COMPONENTS_INIT
|
|
rt_components_board_init();
|
|
#endif
|
|
}
|
|
|
|
void SysTick_Handler(void)
|
|
{
|
|
/* enter interrupt */
|
|
rt_interrupt_enter();
|
|
rt_tick_increase();
|
|
/* leave interrupt */
|
|
rt_interrupt_leave();
|
|
}
|