application.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2006-06-05 Bernard the first version
  13. */
  14. /**
  15. * @addtogroup sam7x
  16. */
  17. /*@{*/
  18. #include <rtthread.h>
  19. #ifdef RT_USING_DFS
  20. /* dfs init */
  21. #include <dfs_init.h>
  22. /* dfs filesystem:FAT filesystem init */
  23. #include <dfs_fat.h>
  24. /* dfs filesystem:EFS filesystem init */
  25. #include <dfs_efs.h>
  26. /* dfs Filesystem APIs */
  27. #include <dfs_fs.h>
  28. #endif
  29. #ifdef RT_USING_LWIP
  30. #include <lwip/sys.h>
  31. #endif
  32. #ifdef RT_USING_RTGUI
  33. #include <rtgui/rtgui.h>
  34. #endif
  35. /* thread phase init */
  36. void rt_init_thread_entry(void *parameter)
  37. {
  38. /* Filesystem Initialization */
  39. #ifdef RT_USING_DFS
  40. {
  41. /* init the device filesystem */
  42. dfs_init();
  43. /* init the efsl filesystam*/
  44. efsl_init();
  45. /* mount sd card fat partition 1 as root directory */
  46. if (dfs_mount("sd0", "/", "efs", 0, 0) == 0)
  47. rt_kprintf("File System initialized!\n");
  48. else
  49. rt_kprintf("File System init failed!\n");
  50. }
  51. #endif
  52. /* LwIP Initialization */
  53. #ifdef RT_USING_LWIP
  54. {
  55. extern void lwip_sys_init(void);
  56. /* init lwip system */
  57. lwip_sys_init();
  58. rt_kprintf("TCP/IP initialized!\n");
  59. }
  60. #endif
  61. }
  62. int rt_application_init()
  63. {
  64. rt_thread_t init_thread;
  65. init_thread = rt_thread_create("init",
  66. rt_init_thread_entry, RT_NULL,
  67. 1024, 8, 5);
  68. rt_thread_startup(init_thread);
  69. rt_kprintf("enter list() to get function list!\n");
  70. return 0;
  71. }
  72. /*@}*/