application.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * File : application.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://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2009-01-05 Bernard the first version
  13. */
  14. /**
  15. * @addtogroup STM32
  16. */
  17. /*@{*/
  18. #include <rtthread.h>
  19. #include <finsh.h>
  20. #ifdef RT_USING_DFS
  21. /* dfs init */
  22. #include <dfs_init.h>
  23. /* dfs filesystem:FAT filesystem init */
  24. #include <dfs_fat.h>
  25. /* dfs filesystem:EFS filesystem init */
  26. #include <dfs_efs.h>
  27. /* dfs Filesystem APIs */
  28. #include <dfs_fs.h>
  29. #endif
  30. #ifdef RT_USING_LWIP
  31. #include <lwip/sys.h>
  32. #include <lwip/api.h>
  33. #endif
  34. /* thread phase init */
  35. void rt_init_thread_entry(void *parameter)
  36. {
  37. /* Filesystem Initialization */
  38. #ifdef RT_USING_DFS
  39. {
  40. /* init the device filesystem */
  41. dfs_init();
  42. /* init the efsl filesystam*/
  43. efsl_init();
  44. /* mount sd card fat partition 1 as root directory */
  45. if (dfs_mount("sd0", "/", "efs", 0, 0) == 0)
  46. rt_kprintf("File System initialized!\n");
  47. else
  48. rt_kprintf("File System init failed!\n");
  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. 2048, 80, 20);
  67. rt_thread_startup(init_thread);
  68. return 0;
  69. }
  70. /*@}*/