application.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * File : application.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2017-11-20 tanek first implementation
  23. */
  24. #include <board.h>
  25. #include <rtthread.h>
  26. #include <drivers/mtd_nand.h>
  27. #include "finsh.h"
  28. #include "time.h"
  29. #ifdef RT_USING_DFS
  30. /* dfs init */
  31. #include <dfs.h>
  32. /* dfs filesystem:ELM filesystem init */
  33. #include <dfs_elm.h>
  34. /* dfs Filesystem APIs */
  35. #include <dfs_fs.h>
  36. #include <dfs_posix.h>
  37. #endif
  38. #ifdef RT_USING_LWIP
  39. #include <lwip/sys.h>
  40. #include <lwip/api.h>
  41. #include <netif/ethernetif.h>
  42. #include "drv_eth.h"
  43. #endif
  44. #ifdef RT_USING_GDB
  45. #include <gdb_stub.h>
  46. #endif
  47. #ifdef RT_USING_GUIENGINE
  48. #include "rtgui_demo.h"
  49. #include <rtgui/driver.h>
  50. #endif
  51. extern void rt_hw_userled_init(void);
  52. void rt_init_thread_entry(void* parameter)
  53. {
  54. /* initialization RT-Thread Components */
  55. #ifdef RT_USING_COMPONENTS_INIT
  56. rt_components_init();
  57. #endif
  58. rt_hw_userled_init();
  59. }
  60. int rt_application_init()
  61. {
  62. rt_thread_t tid;
  63. tid = rt_thread_create("init",
  64. rt_init_thread_entry, RT_NULL,
  65. 2048, RT_THREAD_PRIORITY_MAX/3, 20);
  66. if (tid != RT_NULL)
  67. rt_thread_startup(tid);
  68. return 0;
  69. }