application.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * File : application.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009, 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. * 2010-03-04 Magicoe for LPC1766 version
  14. * 2010-05-02 Aozima add led function
  15. * 2010-05-24 Bernard add filesystem initialization and move led function to led.c
  16. */
  17. #include <rtthread.h>
  18. #include <components_init.h>
  19. /* thread phase init */
  20. void rt_init_thread_entry(void *parameter)
  21. {
  22. /* register Ethernet interface device */
  23. lpc17xx_emac_hw_init();
  24. /* initialization RT-Thread Components */
  25. rt_components_init();
  26. /* Filesystem Initialization */
  27. #ifdef RT_USING_DFS
  28. /* mount sd card fat partition 1 as root directory */
  29. if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
  30. rt_kprintf("File System initialized!\n");
  31. else
  32. rt_kprintf("File System init failed!\n");
  33. #endif
  34. }
  35. int rt_application_init()
  36. {
  37. rt_thread_t tid;
  38. tid = rt_thread_create("init",
  39. rt_init_thread_entry, RT_NULL,
  40. 2048, RT_THREAD_PRIORITY_MAX/3, 20);
  41. if (tid != RT_NULL) rt_thread_startup(tid);
  42. return 0;
  43. }