board.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. *
  9. */
  10. #include <rthw.h>
  11. #include <rtthread.h>
  12. #include "board.h"
  13. #include "drv_uart.h"
  14. #include "clock_config.h"
  15. /**
  16. * @addtogroup K64
  17. */
  18. /*@{*/
  19. /*******************************************************************************
  20. * Function Name : NVIC_Configuration
  21. * Description : Configures Vector Table base location.
  22. * Input : None
  23. * Output : None
  24. * Return : None
  25. *******************************************************************************/
  26. void NVIC_Configuration(void)
  27. {
  28. }
  29. /*******************************************************************************
  30. * Function Name : SysTick_Configuration
  31. * Description : Configures the SysTick for OS tick.
  32. * Input : None
  33. * Output : None
  34. * Return : None
  35. *******************************************************************************/
  36. void SysTick_Configuration(void)
  37. {
  38. SystemCoreClockUpdate(); /* Update Core Clock Frequency */
  39. SysTick_Config(SystemCoreClock/RT_TICK_PER_SECOND); /* Generate interrupt each 1 ms */
  40. }
  41. /**
  42. * This is the timer interrupt service routine.
  43. *
  44. */
  45. void SysTick_Handler(void)
  46. {
  47. /* enter interrupt */
  48. rt_interrupt_enter();
  49. rt_tick_increase();
  50. /* leave interrupt */
  51. rt_interrupt_leave();
  52. }
  53. /**
  54. * This function will initial Tower board.
  55. */
  56. void rt_hw_board_init()
  57. {
  58. /* NVIC Configuration */
  59. NVIC_Configuration();
  60. BOARD_BootClockRUN();
  61. /* Configure the SysTick */
  62. SysTick_Configuration();
  63. rt_hw_uart_init();
  64. #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
  65. rt_console_set_device(CONSOLE_DEVICE);
  66. #endif
  67. }
  68. /*@}*/