board.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * File : board.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009 RT-Thread Develop Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. *
  13. */
  14. #include <rthw.h>
  15. #include <rtthread.h>
  16. #include "board.h"
  17. #include "drv_uart.h"
  18. /**
  19. * @addtogroup K64
  20. */
  21. /*@{*/
  22. /*******************************************************************************
  23. * Function Name : NVIC_Configuration
  24. * Description : Configures Vector Table base location.
  25. * Input : None
  26. * Output : None
  27. * Return : None
  28. *******************************************************************************/
  29. void NVIC_Configuration(void)
  30. {
  31. }
  32. /*******************************************************************************
  33. * Function Name : SysTick_Configuration
  34. * Description : Configures the SysTick for OS tick.
  35. * Input : None
  36. * Output : None
  37. * Return : None
  38. *******************************************************************************/
  39. void SysTick_Configuration(void)
  40. {
  41. SystemCoreClockUpdate(); /* Update Core Clock Frequency */
  42. SysTick_Config(SystemCoreClock/RT_TICK_PER_SECOND); /* Generate interrupt each 1 ms */
  43. }
  44. /**
  45. * This is the timer interrupt service routine.
  46. *
  47. */
  48. void SysTick_Handler(void)
  49. {
  50. /* enter interrupt */
  51. rt_interrupt_enter();
  52. rt_tick_increase();
  53. /* leave interrupt */
  54. rt_interrupt_leave();
  55. }
  56. /**
  57. * This function will initial Tower board.
  58. */
  59. void rt_hw_board_init()
  60. {
  61. /* NVIC Configuration */
  62. NVIC_Configuration();
  63. /* Configure the SysTick */
  64. SysTick_Configuration();
  65. rt_hw_uart_init();
  66. #ifdef RT_USING_CONSOLE
  67. rt_console_set_device(CONSOLE_DEVICE);
  68. #endif
  69. }
  70. /*@}*/