board.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. * 2009-01-05 Bernard first implementation
  13. * 2010-02-04 Magicoe ported to LPC17xx
  14. */
  15. #include <rthw.h>
  16. #include <rtthread.h>
  17. #include "uart.h"
  18. #include "board.h"
  19. #include "CMSIS/LPC17xx.h"
  20. /**
  21. * @addtogroup LPC17xx
  22. */
  23. /*@{*/
  24. /**
  25. * This is the timer interrupt service routine.
  26. *
  27. */
  28. void rt_hw_timer_handler(void)
  29. {
  30. /* enter interrupt */
  31. rt_interrupt_enter();
  32. rt_tick_increase();
  33. /* leave interrupt */
  34. rt_interrupt_leave();
  35. }
  36. /**
  37. * This function will initial LPC17xx board.
  38. */
  39. void rt_hw_board_init()
  40. {
  41. /* NVIC Configuration */
  42. #define NVIC_VTOR_MASK 0x3FFFFF80
  43. #ifdef VECT_TAB_RAM
  44. /* Set the Vector Table base location at 0x10000000 */
  45. SCB->VTOR = (0x10000000 & NVIC_VTOR_MASK);
  46. #else /* VECT_TAB_FLASH */
  47. /* Set the Vector Table base location at 0x00000000 */
  48. SCB->VTOR = (0x00000000 & NVIC_VTOR_MASK);
  49. #endif
  50. /* init systick */
  51. SysTick_Config(SystemFrequency/RT_TICK_PER_SECOND - 1);
  52. /* set pend exception priority */
  53. NVIC_SetPriority(PendSV_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
  54. #ifdef RT_USING_UART0
  55. rt_hw_uart_init();
  56. rt_console_set_device("uart0");
  57. #endif
  58. rt_kprintf("\r\n\r\nSystemInit......\r\n");
  59. }
  60. /*@}*/