board.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #include "clock_config.h"
  19. /**
  20. * @addtogroup K64
  21. */
  22. /*@{*/
  23. /*******************************************************************************
  24. * Function Name : NVIC_Configuration
  25. * Description : Configures Vector Table base location.
  26. * Input : None
  27. * Output : None
  28. * Return : None
  29. *******************************************************************************/
  30. void NVIC_Configuration(void)
  31. {
  32. }
  33. /*******************************************************************************
  34. * Function Name : SysTick_Configuration
  35. * Description : Configures the SysTick for OS tick.
  36. * Input : None
  37. * Output : None
  38. * Return : None
  39. *******************************************************************************/
  40. void SysTick_Configuration(void)
  41. {
  42. SystemCoreClockUpdate(); /* Update Core Clock Frequency */
  43. SysTick_Config(SystemCoreClock/RT_TICK_PER_SECOND); /* Generate interrupt each 1 ms */
  44. }
  45. /**
  46. * This is the timer interrupt service routine.
  47. *
  48. */
  49. void SysTick_Handler(void)
  50. {
  51. /* enter interrupt */
  52. rt_interrupt_enter();
  53. rt_tick_increase();
  54. /* leave interrupt */
  55. rt_interrupt_leave();
  56. }
  57. /**
  58. * This function will initial Tower board.
  59. */
  60. void rt_hw_board_init()
  61. {
  62. /* NVIC Configuration */
  63. NVIC_Configuration();
  64. BOARD_BootClockRUN();
  65. /* Configure the SysTick */
  66. SysTick_Configuration();
  67. rt_hw_uart_init();
  68. #ifdef RT_USING_CONSOLE
  69. rt_console_set_device(CONSOLE_DEVICE);
  70. #endif
  71. }
  72. /*@}*/