board.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2006-2021, 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 "LPC177x_8x.h"
  17. #include "system_LPC177x_8x.h"
  18. #include "sdram.h"
  19. /**
  20. * @addtogroup LPC17xx
  21. */
  22. /*@{*/
  23. /**
  24. * This is the timer interrupt service routine.
  25. *
  26. */
  27. void rt_hw_timer_handler(void)
  28. {
  29. /* enter interrupt */
  30. rt_interrupt_enter();
  31. rt_tick_increase();
  32. /* leave interrupt */
  33. rt_interrupt_leave();
  34. }
  35. void SysTick_Handler(void)
  36. {
  37. rt_hw_timer_handler();
  38. }
  39. /**
  40. * This function will initial LPC17xx board.
  41. */
  42. void rt_hw_board_init()
  43. {
  44. /* NVIC Configuration */
  45. #define NVIC_VTOR_MASK 0x3FFFFF80
  46. #ifdef VECT_TAB_RAM
  47. /* Set the Vector Table base location at 0x10000000 */
  48. SCB->VTOR = (0x10000000 & NVIC_VTOR_MASK);
  49. #else /* VECT_TAB_FLASH */
  50. /* Set the Vector Table base location at 0x00000000 */
  51. SCB->VTOR = (0x00000000 & NVIC_VTOR_MASK);
  52. #endif
  53. /* init systick */
  54. SysTick_Config(SystemCoreClock/RT_TICK_PER_SECOND);
  55. /* set pend exception priority */
  56. NVIC_SetPriority(PendSV_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
  57. rt_hw_uart_init();
  58. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  59. #if LPC_EXT_SDRAM == 1
  60. {
  61. SDRAM_Init();
  62. }
  63. #endif
  64. }
  65. /*@}*/