board.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. * 2010-05-02 Aozima update CMSIS to 130
  15. */
  16. #include <rthw.h>
  17. #include <rtthread.h>
  18. #include "uart.h"
  19. #include "board.h"
  20. #include "LPC17xx.h"
  21. /**
  22. * @addtogroup LPC17xx
  23. */
  24. /*@{*/
  25. /**
  26. * This is the timer interrupt service routine.
  27. *
  28. */
  29. void rt_hw_timer_handler(void)
  30. {
  31. /* enter interrupt */
  32. rt_interrupt_enter();
  33. rt_tick_increase();
  34. /* leave interrupt */
  35. rt_interrupt_leave();
  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. /* init systick */
  52. SysTick_Config( SystemCoreClock/RT_TICK_PER_SECOND - 1);
  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("uart0");
  58. #endif
  59. rt_kprintf("\r\n\r\nSystemInit......\r\n");
  60. }
  61. /*@}*/