application.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. /* thread phase init */
  29. void rt_init_thread_entry(void *parameter)
  30. {
  31. /* Initialization RT-Thread Components */
  32. #ifdef RT_USING_COMPONENTS_INIT
  33. rt_components_init();
  34. #elif defined(RT_USING_FINSH)
  35. finsh_system_init();
  36. #endif
  37. }
  38. int rt_application_init(void)
  39. {
  40. rt_thread_t tid;
  41. tid = rt_thread_create("init",
  42. rt_init_thread_entry, RT_NULL,
  43. 2048, RT_THREAD_PRIORITY_MAX / 3, 20);
  44. if (tid != RT_NULL) rt_thread_startup(tid);
  45. return 0;
  46. }