application.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * COPYRIGHT (C) 2013-2014, Shanghai Real-Thread Technology Co., Ltd
  3. *
  4. * All rights reserved.
  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. #include <rtthread.h>
  21. #ifdef RT_USING_COMPONENTS_INIT
  22. #include <components.h>
  23. #endif
  24. #include <cp15.h>
  25. /* thread phase init */
  26. static void rt_init_thread_entry(void *parameter)
  27. {
  28. /* do component initialization */
  29. rt_components_init();
  30. rt_kprintf("running on cpu %d\n",
  31. rt_cpu_get_smp_id() & 0x0f);
  32. /* add your initialization here */
  33. }
  34. int rt_application_init()
  35. {
  36. rt_thread_t tid;
  37. tid = rt_thread_create("init", rt_init_thread_entry, RT_NULL, 2048,
  38. RT_THREAD_PRIORITY_MAX/3, 20);
  39. if (tid != RT_NULL)
  40. rt_thread_startup(tid);
  41. return 0;
  42. }