application.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * File : application.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009 - 2012, 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. * 2011-05-24 Bernard the first version
  13. */
  14. /**
  15. * @addtogroup FM3
  16. */
  17. /*@{*/
  18. #include <rtthread.h>
  19. #include "board.h"
  20. #include "led.h"
  21. #ifdef RT_USING_DFS
  22. /* dfs init */
  23. #include <dfs.h>
  24. /* dfs filesystem:ELM filesystem init */
  25. #include <dfs_elm.h>
  26. /* dfs Filesystem APIs */
  27. #include <dfs_fs.h>
  28. #endif
  29. void rt_init_thread_entry(void *parameter)
  30. {
  31. /* LED Initialization */
  32. rt_hw_led_init();
  33. #ifdef RT_USING_COMPONENTS_INIT
  34. /* initialization RT-Thread Components */
  35. rt_components_init();
  36. #endif
  37. /* Filesystem Initialization */
  38. #ifdef RT_USING_DFS
  39. /* mount nand fat partition 1 as root directory */
  40. if (dfs_mount("nand", "/", "elm", 0, 0) == 0)
  41. rt_kprintf("File System initialized!\n");
  42. else
  43. rt_kprintf("File System init failed!\n");
  44. #endif
  45. }
  46. int rt_application_init(void)
  47. {
  48. rt_thread_t tid;
  49. tid = rt_thread_create("init",
  50. rt_init_thread_entry, RT_NULL,
  51. 2048, RT_THREAD_PRIORITY_MAX/3, 20);
  52. if (tid != RT_NULL)
  53. rt_thread_startup(tid);
  54. return 0;
  55. }
  56. /*@}*/