board.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2009-01-05 Bernard first implementation
  9. * 2010-02-04 Magicoe ported to LPC17xx
  10. * 2010-05-02 Aozima update CMSIS to 130
  11. */
  12. #include <rthw.h>
  13. #include <rtthread.h>
  14. #include "uart.h"
  15. #include "board.h"
  16. #include "LPC17xx.h"
  17. /**
  18. * @addtogroup LPC17xx
  19. */
  20. /*@{*/
  21. /**
  22. * This is the timer interrupt service routine.
  23. *
  24. */
  25. void rt_hw_timer_handler(void)
  26. {
  27. /* enter interrupt */
  28. rt_interrupt_enter();
  29. rt_tick_increase();
  30. /* leave interrupt */
  31. rt_interrupt_leave();
  32. }
  33. void SysTick_Handler(void)
  34. {
  35. rt_hw_timer_handler();
  36. }
  37. /**
  38. * This function will initial LPC17xx board.
  39. */
  40. void rt_hw_board_init()
  41. {
  42. /* NVIC Configuration */
  43. #define NVIC_VTOR_MASK 0x3FFFFF80
  44. #ifdef VECT_TAB_RAM
  45. /* Set the Vector Table base location at 0x10000000 */
  46. SCB->VTOR = (0x10000000 & NVIC_VTOR_MASK);
  47. #else /* VECT_TAB_FLASH */
  48. /* Set the Vector Table base location at 0x00000000 */
  49. SCB->VTOR = (0x00000000 & NVIC_VTOR_MASK);
  50. #endif
  51. /* initialize systick */
  52. SysTick_Config( SystemCoreClock/RT_TICK_PER_SECOND);
  53. /* set pend exception priority */
  54. NVIC_SetPriority(PendSV_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
  55. #ifdef RT_USING_UART0
  56. rt_hw_uart_init();
  57. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  58. #endif
  59. }
  60. /*@}*/