application.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * File : application.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2013, 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. * 2013-7-14 Peng Fan Simple application
  23. */
  24. /**
  25. * @addtogroup sep6200
  26. */
  27. /*@{*/
  28. #include "board.h"
  29. #include <rtthread.h>
  30. #define RT_INIT_THREAD_STACK_SIZE (2*1024)
  31. void rt_init_thread_entry(void *parameter)
  32. {
  33. while(1){
  34. rt_thread_sleep(200);
  35. rt_hw_console_output("init thread\n");
  36. }
  37. }
  38. void rt_test1_thread_entry(void *parameter)
  39. {
  40. while(1){
  41. rt_thread_sleep(800);
  42. rt_hw_console_output("test1 thread\n");
  43. }
  44. }
  45. void rt_test2_thread_entry(void *parameter)
  46. {
  47. while(1){
  48. rt_thread_sleep(300);
  49. rt_hw_console_output("test2 thread\n");
  50. }
  51. }
  52. int rt_application_init(void)
  53. {
  54. rt_thread_t init_thread;
  55. rt_thread_t test1_thread;
  56. rt_thread_t test2_thread;
  57. init_thread = rt_thread_create("init",
  58. rt_init_thread_entry, RT_NULL,
  59. RT_INIT_THREAD_STACK_SIZE, 8, 20);
  60. test1_thread = rt_thread_create("test1",
  61. rt_test1_thread_entry, RT_NULL,
  62. 512, 200, 20);
  63. test2_thread = rt_thread_create("test2",
  64. rt_test2_thread_entry, RT_NULL,
  65. 512, 200, 20);
  66. if (init_thread != RT_NULL)
  67. rt_thread_startup(init_thread);
  68. if (test1_thread != RT_NULL)
  69. rt_thread_startup(test1_thread);
  70. if (test2_thread != RT_NULL)
  71. rt_thread_startup(test2_thread);
  72. return 0;
  73. }
  74. /*@}*/