application.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. eth_system_device_init();
  57. /* register AT91 EMAC device */
  58. sam7xether_register("E0");
  59. /* init lwip system */
  60. lwip_sys_init();
  61. rt_kprintf("TCP/IP initialized!\n");
  62. }
  63. #endif
  64. }
  65. int rt_application_init()
  66. {
  67. rt_thread_t init_thread;
  68. init_thread = rt_thread_create("init",
  69. rt_init_thread_entry, RT_NULL,
  70. 1024, 8, 5);
  71. rt_thread_startup(init_thread);
  72. rt_kprintf("enter list() to get function list!\n");
  73. return 0;
  74. }
  75. /*@}*/