board.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * File : board.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2013 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. * 2009-01-05 Bernard first implementation
  13. */
  14. #include <rthw.h>
  15. #include <rtthread.h>
  16. #include "board.h"
  17. #include "drv_uart.h"
  18. #ifdef LPC_EXT_SDRAM
  19. #include "drv_sdram.h"
  20. #endif
  21. /**
  22. * This is the timer interrupt service routine.
  23. *
  24. */
  25. void SysTick_Handler(void)
  26. {
  27. /* enter interrupt */
  28. rt_interrupt_enter();
  29. rt_tick_increase();
  30. /* leave interrupt */
  31. rt_interrupt_leave();
  32. }
  33. /**
  34. * This function will initial LPC40xx board.
  35. */
  36. void rt_hw_board_init()
  37. {
  38. /* NVIC Configuration */
  39. #define NVIC_VTOR_MASK 0x3FFFFF80
  40. #ifdef VECT_TAB_RAM
  41. /* Set the Vector Table base location at 0x10000000 */
  42. SCB->VTOR = (0x10000000 & NVIC_VTOR_MASK);
  43. #else /* VECT_TAB_FLASH */
  44. /* Set the Vector Table base location at 0x00000000 */
  45. SCB->VTOR = (0x00000000 & NVIC_VTOR_MASK);
  46. #endif
  47. /* init systick */
  48. SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND - 1);
  49. /* set pend exception priority */
  50. NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
  51. /*init uart device*/
  52. rt_hw_uart_init();
  53. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  54. #ifdef LPC_EXT_SDRAM
  55. rt_kprintf("Initialize SDRAM ...");
  56. lpc_sdram_hw_init();
  57. rt_kprintf("done!\n");
  58. #endif
  59. // rt_components_board_init();
  60. }