application.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2009-01-05 Bernard the first version
  9. */
  10. /**
  11. * @addtogroup LM3S
  12. */
  13. /*@{*/
  14. #include <rthw.h>
  15. #include <rtthread.h>
  16. #ifdef RT_USING_DFS
  17. /* dfs init */
  18. #include <dfs.h>
  19. /* dfs filesystem:ELM FatFs filesystem init */
  20. #include <dfs_elm.h>
  21. /* dfs Filesystem APIs */
  22. #include <dfs_fs.h>
  23. #endif
  24. #ifdef RT_USING_LWIP
  25. #include <lwip/sys.h>
  26. #include <lwip/api.h>
  27. #endif
  28. /* thread phase init */
  29. void rt_init_thread_entry(void *parameter)
  30. {
  31. /* Filesystem Initialization */
  32. #ifdef RT_USING_DFS
  33. {
  34. /* init the device filesystem */
  35. dfs_init();
  36. #ifdef RT_USING_DFS_ELMFAT
  37. /* init the elm chan FatFs filesystam*/
  38. elm_init();
  39. /* mount sd card fat partition 1 as root directory */
  40. if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
  41. {
  42. rt_kprintf("File System initialized!\n");
  43. }
  44. else
  45. rt_kprintf("File System initialzation failed!\n");
  46. #endif
  47. }
  48. #endif
  49. /* LwIP Initialization */
  50. #ifdef RT_USING_LWIP
  51. {
  52. extern void lwip_sys_init(void);
  53. /* init lwip system */
  54. lwip_sys_init();
  55. rt_kprintf("TCP/IP initialized!\n");
  56. }
  57. #endif
  58. }
  59. int rt_application_init()
  60. {
  61. rt_thread_t init_thread;
  62. init_thread = rt_thread_create("init",
  63. rt_init_thread_entry, RT_NULL,
  64. 1024, 21, 20);
  65. rt_thread_startup(init_thread);
  66. return 0;
  67. }
  68. /*@}*/