application.c 1.5 KB

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