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. */
  15. #include <rtthread.h>
  16. #include <ls1b.h>
  17. #ifdef RT_USING_COMPONENTS_INIT
  18. #include <components_init.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. /* re-init device driver */
  32. rt_device_init_all();
  33. /* find Display Controller device */
  34. dc = rt_device_find("dc");
  35. /* set Display Controller device as rtgui graphic driver */
  36. rtgui_graphic_set_device(dc);
  37. }
  38. #endif
  39. #ifdef RT_USING_COMPONENTS_INIT
  40. /* initialization RT-Thread Components */
  41. rt_components_init();
  42. #endif
  43. }
  44. int rt_application_init(void)
  45. {
  46. rt_thread_t tid;
  47. /* create initialization thread */
  48. tid = rt_thread_create("init",
  49. rt_init_thread_entry, RT_NULL,
  50. 4096, 8, 20);
  51. if (tid != RT_NULL)
  52. rt_thread_startup(tid);
  53. return 0;
  54. }