application.c 1.8 KB

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