application.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. */
  15. #include <rtthread.h>
  16. #include <ls1b.h>
  17. #ifdef RT_USING_COMPONENTS_INIT
  18. #include <components.h>
  19. #endif
  20. #ifdef RT_USING_RTGUI
  21. #include <rtgui/rtgui.h>
  22. extern void rt_hw_dc_init(void);
  23. #endif
  24. void rt_init_thread_entry(void *parameter)
  25. {
  26. #ifdef RT_USING_RTGUI
  27. {
  28. rt_device_t dc;
  29. /* init Display Controller */
  30. rt_hw_dc_init();
  31. /* find Display Controller device */
  32. dc = rt_device_find("dc");
  33. /* set Display Controller device as rtgui graphic driver */
  34. rtgui_graphic_set_device(dc);
  35. }
  36. #endif
  37. #ifdef RT_USING_COMPONENTS_INIT
  38. /* initialization RT-Thread Components */
  39. rt_components_init();
  40. #endif
  41. }
  42. int rt_application_init(void)
  43. {
  44. rt_thread_t tid;
  45. /* create initialization thread */
  46. tid = rt_thread_create("init",
  47. rt_init_thread_entry, RT_NULL,
  48. 4096, 8, 20);
  49. if (tid != RT_NULL)
  50. rt_thread_startup(tid);
  51. return 0;
  52. }