application.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. * 2018-02-08 sundm75 modified for Loongson LS1C SmartLoongV3
  16. */
  17. #include <rtthread.h>
  18. #include "net/synopGMAC.h"
  19. #include <lwip/api.h>
  20. void rt_init_thread_entry(void *parameter)
  21. {
  22. #ifdef RT_USING_COMPONENTS_INIT
  23. /* initialization RT-Thread Components */
  24. rt_components_init();
  25. #endif
  26. #if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
  27. /* mount sd card fat partition 1 as root directory */
  28. if( dfs_mount("sd0", "/", "elm", 0, 0) == 0)
  29. {
  30. rt_kprintf("File System initialized!\n");
  31. }
  32. else
  33. {
  34. rt_kprintf("File System initialzation failed!\n");
  35. }
  36. #endif /* RT_USING_DFS && RT_USING_DFS_ELMFAT */
  37. /*网口EMAC初始化*/
  38. rt_hw_eth_init();
  39. #if defined(RT_USING_RTGUI)
  40. /*触摸屏使用SPI总线SPI1 CS0 初始化*/
  41. rtgui_touch_hw_init("spi10");
  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, RT_THREAD_PRIORITY_MAX/3, 20);
  51. if (tid != RT_NULL)
  52. rt_thread_startup(tid);
  53. return 0;
  54. }