1
0

application.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * File : application.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2009-01-05 Bernard the first version
  13. * 2013-11-15 bright add init thread and components initial
  14. */
  15. /**
  16. * @addtogroup STM32
  17. */
  18. /*@{*/
  19. #include <stdio.h>
  20. #include <rthw.h>
  21. #include <rtdevice.h>
  22. #include "board.h"
  23. #include <rtthread.h>
  24. static void rt_init_thread_entry(void* parameter)
  25. {
  26. extern void led_thread_entry(void* parameter);
  27. rt_thread_t thread;
  28. /* Initialization RT-Thread Components */
  29. #ifdef RT_USING_COMPONENTS_INIT
  30. rt_components_init();
  31. #endif
  32. /* Set finsh device */
  33. #ifdef RT_USING_FINSH
  34. finsh_set_device(RT_CONSOLE_DEVICE_NAME);
  35. #endif /* RT_USING_FINSH */
  36. /* Create led thread */
  37. thread = rt_thread_create("led",
  38. led_thread_entry, RT_NULL,
  39. 256, 20, 20);
  40. if(thread != RT_NULL)
  41. rt_thread_startup(thread);
  42. }
  43. int rt_application_init()
  44. {
  45. rt_thread_t init_thread;
  46. #if (RT_THREAD_PRIORITY_MAX == 32)
  47. init_thread = rt_thread_create("init",
  48. rt_init_thread_entry, RT_NULL,
  49. 512, 8, 20);
  50. #else
  51. init_thread = rt_thread_create("init",
  52. rt_init_thread_entry, RT_NULL,
  53. 512, 80, 20);
  54. #endif
  55. if(init_thread != RT_NULL)
  56. rt_thread_startup(init_thread);
  57. return 0;
  58. }
  59. /*@}*/