application.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * File : application.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009 - 2012, 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. * 2010-04-09 fify modified for M16C
  14. *
  15. * For : Renesas M16C
  16. * Toolchain : IAR's EW for M16C v3.401
  17. */
  18. #include <rtthread.h>
  19. #include "bsp.h"
  20. static struct rt_thread led;
  21. ALIGN(RT_ALIGN_SIZE)
  22. static rt_uint8_t led_stack[256];
  23. static void rt_thread_entry_led(void *parameter)
  24. {
  25. while (1)
  26. {
  27. led_off();
  28. rt_thread_delay(100);
  29. led_on();
  30. rt_thread_delay(100);
  31. }
  32. }
  33. int rt_application_init(void)
  34. {
  35. rt_err_t result;
  36. /* create led thread */
  37. result = rt_thread_init(&led,
  38. "led",
  39. rt_thread_entry_led,
  40. RT_NULL,
  41. &led_stack[0],
  42. sizeof(led_stack),
  43. RT_THREAD_PRIORITY_MAX / 2,
  44. 32);
  45. if (result == RT_EOK)
  46. rt_thread_startup(&led);
  47. return 0;
  48. }