application.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * File : application.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006-2012, 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-06-25 Bernard first version
  13. * 2011-08-08 lgnq modified for Loongson LS1B
  14. * 2015-07-06 chinesebear modified for Loongson LS1C
  15. */
  16. #include <rtthread.h>
  17. #include <ls1c.h>
  18. #ifdef RT_USING_COMPONENTS_INIT
  19. #include <components.h>
  20. #endif
  21. #ifdef RT_USING_RTGUI
  22. #include <rtgui/rtgui.h>
  23. extern void rt_hw_dc_init(void);
  24. #endif
  25. void rt_init_thread_entry(void *parameter)
  26. {
  27. #ifdef RT_USING_RTGUI
  28. {
  29. rt_device_t dc;
  30. /* init Display Controller */
  31. rt_hw_dc_init();
  32. /* find Display Controller device */
  33. dc = rt_device_find("dc");
  34. /* set Display Controller device as rtgui graphic driver */
  35. rtgui_graphic_set_device(dc);
  36. }
  37. #endif
  38. #ifdef RT_USING_COMPONENTS_INIT
  39. /* initialization RT-Thread Components */
  40. rt_components_init();
  41. #endif
  42. }
  43. int rt_application_init(void)
  44. {
  45. rt_thread_t tid;
  46. /* create initialization thread */
  47. tid = rt_thread_create("init",
  48. rt_init_thread_entry, RT_NULL,
  49. 4096, 8, 20);
  50. if (tid != RT_NULL)
  51. rt_thread_startup(tid);
  52. return 0;
  53. }