application.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #include <netif/ethernetif.h>
  32. #include "sam7x_emac.h"
  33. #endif
  34. #ifdef RT_USING_RTGUI
  35. #include <rtgui/rtgui.h>
  36. #endif
  37. /* thread phase init */
  38. void rt_init_thread_entry(void *parameter)
  39. {
  40. /* Filesystem Initialization */
  41. #ifdef RT_USING_DFS
  42. {
  43. /* init the device filesystem */
  44. dfs_init();
  45. /* init the efsl filesystam*/
  46. efsl_init();
  47. /* mount sd card fat partition 1 as root directory */
  48. if (dfs_mount("sd0", "/", "efs", 0, 0) == 0)
  49. rt_kprintf("File System initialized!\n");
  50. else
  51. rt_kprintf("File System init failed!\n");
  52. }
  53. #endif
  54. /* LwIP Initialization */
  55. #ifdef RT_USING_LWIP
  56. {
  57. extern void lwip_sys_init(void);
  58. eth_system_device_init();
  59. /* register AT91 EMAC device */
  60. sam7xether_register("E0");
  61. /* init lwip system */
  62. lwip_sys_init();
  63. rt_kprintf("TCP/IP initialized!\n");
  64. }
  65. #endif
  66. }
  67. int rt_application_init()
  68. {
  69. rt_thread_t init_thread;
  70. init_thread = rt_thread_create("init",
  71. rt_init_thread_entry, RT_NULL,
  72. 1024, 8, 5);
  73. rt_thread_startup(init_thread);
  74. rt_kprintf("enter list() to get function list!\n");
  75. return 0;
  76. }
  77. /*@}*/