application.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. /* initialization RT-Thread Components */
  23. rt_components_init();
  24. #if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
  25. /* initialize the device file system */
  26. dfs_init();
  27. /* initialize the elm chan FatFS file system*/
  28. elm_init();
  29. /* mount sd card fat partition 1 as root directory */
  30. if( dfs_mount("sd0", "/", "elm", 0, 0) == 0)
  31. {
  32. rt_kprintf("File System initialized!\n");
  33. }
  34. else
  35. {
  36. rt_kprintf("File System initialzation failed!\n");
  37. }
  38. #endif /* RT_USING_DFS && RT_USING_DFS_ELMFAT */
  39. /*网口EMAC初始化*/
  40. rt_hw_eth_init();
  41. #if defined(RT_USING_RTGUI)
  42. /*触摸屏使用SPI总线SPI1 CS0 初始化*/
  43. rtgui_touch_hw_init("spi10");
  44. #endif
  45. }
  46. int rt_application_init(void)
  47. {
  48. rt_thread_t tid;
  49. /* create initialization thread */
  50. tid = rt_thread_create("init",
  51. rt_init_thread_entry, RT_NULL,
  52. 4096, RT_THREAD_PRIORITY_MAX/3, 20);
  53. if (tid != RT_NULL)
  54. rt_thread_startup(tid);
  55. return 0;
  56. }