board.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * File : board.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, 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. * 2010-01-25 Bernard first version
  13. */
  14. #include <rtthread.h>
  15. #include <rthw.h>
  16. #include "board.h"
  17. #include "uart.h"
  18. #include <CMSIS/LPC122x.h>
  19. #include <CMSIS/core_cm0.h>
  20. #define SYSTICK_DELAY 0x0007A11F
  21. /**
  22. * @addtogroup LPC122x
  23. */
  24. /*@{*/
  25. /**
  26. * This is the timer interrupt service routine.
  27. */
  28. void rt_hw_timer_handler()
  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 sam7s64 board.
  38. */
  39. void rt_hw_board_init()
  40. {
  41. SystemInit();
  42. /* init systick */
  43. SysTick_Config( SYSTICK_DELAY );
  44. /* set pend exception priority */
  45. NVIC_SetPriority(PendSV_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
  46. #ifdef RT_USING_UART
  47. /* init hardware UART device */
  48. rt_hw_uart_init();
  49. #endif
  50. #ifdef RT_USING_CONSOLE
  51. /* set console device */
  52. rt_console_set_device("uart0");
  53. #endif
  54. }
  55. /*@}*/