board.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. * 2011-08-06 Magicoe PK40X256VLQ100 version
  14. */
  15. #include <rtthread.h>
  16. #include <rthw.h>
  17. #include "board.h"
  18. #include "uart.h"
  19. #include "PK40X256VLQ100.h"
  20. #include "core_cm4.h"
  21. #include "SLCD_Driver.h"
  22. /**
  23. * @addtogroup PK40X256VLQ100
  24. */
  25. /*@{*/
  26. /**
  27. * This is the timer interrupt service routine.
  28. */
  29. void rt_hw_timer_handler()
  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 sam7s64 board.
  39. */
  40. void rt_hw_board_init()
  41. {
  42. rt_uint8_t *dispchar = {"RTINIT"};
  43. /* Get Core Clock Frequency */
  44. SystemCoreClockUpdate(); /* Get Core Clock Frequency */
  45. /* init systick */
  46. SysTick_Config( SystemCoreClock/1000 ); /* Generate interrupt each 1 ms */
  47. SLCD_Configuration();
  48. SLCD_SegmentsAllOff ();
  49. SLCD_PrintString(dispchar, 0);
  50. /* set pend exception priority */
  51. // NVIC_SetPriority(PendSV_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
  52. #ifdef RT_USING_UART
  53. /* init hardware UART device */
  54. rt_hw_uart_init();
  55. #endif
  56. #ifdef RT_USING_CONSOLE
  57. /* set console device */
  58. rt_console_set_device("uart0");
  59. #endif
  60. SLCD_PrintString(dispchar, 0);
  61. }
  62. /*@}*/