application.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * File : application.c
  3. * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. *
  19. * Change Logs:
  20. * Date Author Notes
  21. * 2017-08-08 Yang the first version
  22. */
  23. #include <rtthread.h>
  24. #ifdef RT_USING_FINSH
  25. #include <shell.h>
  26. #include <finsh.h>
  27. #endif
  28. #ifdef RT_USING_COMPONENTS_INIT
  29. #include <components.h>
  30. #endif
  31. /* thread phase init */
  32. void rt_init_thread_entry(void *parameter)
  33. {
  34. /* Initialization RT-Thread Components */
  35. #ifdef RT_USING_COMPONENTS_INIT
  36. rt_components_init();
  37. #elif defined(RT_USING_FINSH)
  38. finsh_system_init();
  39. #endif
  40. }
  41. int rt_application_init(void)
  42. {
  43. rt_thread_t tid;
  44. tid = rt_thread_create("init",
  45. rt_init_thread_entry, RT_NULL,
  46. 2048, RT_THREAD_PRIORITY_MAX / 3, 20);
  47. if (tid != RT_NULL) rt_thread_startup(tid);
  48. return 0;
  49. }