application.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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_COMPONENTS_INIT
  22. #include <components_init.h>
  23. #endif
  24. #ifdef RT_USING_DFS
  25. /* dfs init */
  26. #include <dfs_init.h>
  27. /* dfs filesystem:ELM filesystem init */
  28. #include <dfs_elm.h>
  29. /* dfs Filesystem APIs */
  30. #include <dfs_fs.h>
  31. #endif
  32. void rt_init_thread_entry(void *parameter)
  33. {
  34. /* LED Initialization */
  35. rt_hw_led_init();
  36. #ifdef RT_USING_COMPONENTS_INIT
  37. /* initialization RT-Thread Components */
  38. rt_components_init();
  39. #endif
  40. /* Filesystem Initialization */
  41. #ifdef RT_USING_DFS
  42. /* mount nand fat partition 1 as root directory */
  43. if (dfs_mount("nand", "/", "elm", 0, 0) == 0)
  44. rt_kprintf("File System initialized!\n");
  45. else
  46. rt_kprintf("File System init failed!\n");
  47. #endif
  48. }
  49. int rt_application_init(void)
  50. {
  51. rt_thread_t tid;
  52. tid = rt_thread_create("init",
  53. rt_init_thread_entry, RT_NULL,
  54. 2048, RT_THREAD_PRIORITY_MAX/3, 20);
  55. if (tid != RT_NULL)
  56. rt_thread_startup(tid);
  57. return 0;
  58. }
  59. /*@}*/