application.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #include <cp15.h>
  22. /* thread phase init */
  23. static void rt_init_thread_entry(void *parameter)
  24. {
  25. /* do component initialization */
  26. rt_components_init();
  27. rt_kprintf("running on cpu %d\n",
  28. rt_cpu_get_smp_id() & 0x0f);
  29. /* add your initialization here */
  30. }
  31. int rt_application_init()
  32. {
  33. rt_thread_t tid;
  34. tid = rt_thread_create("init", rt_init_thread_entry, RT_NULL, 2048,
  35. RT_THREAD_PRIORITY_MAX/3, 20);
  36. if (tid != RT_NULL)
  37. rt_thread_startup(tid);
  38. return 0;
  39. }