application.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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-06-29 lgnq the first version
  14. *
  15. * For : NEC V850E
  16. * Toolchain : IAR Embedded Workbench for V850 v3.71
  17. */
  18. #include <rtthread.h>
  19. #include "board.h"
  20. #include "CG_macrodriver.h"
  21. #include "CG_system.h"
  22. #include "CG_port.h"
  23. #include "CG_timer.h"
  24. /* Start user code for include. Do not edit comment generated here */
  25. /* End user code. Do not edit comment generated here */
  26. #include "CG_userdefine.h"
  27. static struct rt_thread led;
  28. ALIGN(RT_ALIGN_SIZE)
  29. static rt_uint8_t led_stack[256];
  30. static void rt_thread_entry_led(void *parameter)
  31. {
  32. while (1)
  33. {
  34. led_off();
  35. rt_thread_delay(20);
  36. led_on();
  37. rt_thread_delay(40);
  38. }
  39. }
  40. int rt_application_init(void)
  41. {
  42. rt_err_t result;
  43. result = rt_thread_init(&led,
  44. "led",
  45. rt_thread_entry_led,
  46. RT_NULL,
  47. &led_stack[0],
  48. sizeof(led_stack),
  49. RT_THREAD_PRIORITY_MAX / 2,
  50. 32);
  51. if (result == RT_EOK)
  52. rt_thread_startup(&led);
  53. return 0;
  54. }