application.c 1.2 KB

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