application.c 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /******************************************************************//**
  2. * @file application.c
  3. * @brief application tasks
  4. * COPYRIGHT (C) 2009, RT-Thread Development Team
  5. * @author Bernard, onelife
  6. * @version 0.4 beta
  7. **********************************************************************
  8. * @section License
  9. * The license and distribution terms for this file may be found in the file LICENSE in this
  10. * distribution or at http://www.rt-thread.org/license/LICENSE
  11. **********************************************************************
  12. * @section Change Logs
  13. * Date Author Notes
  14. * 2009-01-05 Bernard first version
  15. * 2010-12-29 onelife Modify for EFM32
  16. *********************************************************************/
  17. /******************************************************************//**
  18. * @addtogroup cortex-m3
  19. * @{
  20. *********************************************************************/
  21. /* Includes -------------------------------------------------------------------*/
  22. #include <board.h>
  23. #ifdef RT_USING_DFS
  24. /* dfs init */
  25. #include <dfs_init.h>
  26. /* dfs filesystem:ELM filesystem init */
  27. #include <dfs_elm.h>
  28. /* dfs Filesystem APIs */
  29. #include <dfs_fs.h>
  30. #endif
  31. #ifdef RT_USING_LWIP
  32. #include <lwip/sys.h>
  33. #include <lwip/api.h>
  34. #include <netif/ethernetif.h>
  35. #endif
  36. /* Private typedef -------------------------------------------------------------*/
  37. /* Private define --------------------------------------------------------------*/
  38. /* Private macro --------------------------------------------------------------*/
  39. /* Private variables ------------------------------------------------------------*/
  40. rt_uint32_t rt_system_status = 0;
  41. /* Private function prototypes ---------------------------------------------------*/
  42. /* Private functions ------------------------------------------------------------*/
  43. void rt_led_thread_entry(void* parameter)
  44. {
  45. // rt_uint8_t n = 0;
  46. rt_hw_led_on(0);
  47. rt_hw_led_on(1);
  48. rt_hw_led_on(2);
  49. rt_hw_led_on(3);
  50. // while(1)
  51. // {
  52. /* light on leds for one second */
  53. // rt_hw_led_toggle(n++);
  54. // if (n == 4)
  55. // n =0;
  56. // rt_thread_delay(200);
  57. // }
  58. }
  59. int rt_application_init()
  60. {
  61. rt_thread_t led_thread;
  62. rt_thread_t test_thread;
  63. #if (RT_THREAD_PRIORITY_MAX == 32)
  64. led_thread = rt_thread_create(
  65. "led",
  66. rt_led_thread_entry,
  67. RT_NULL,
  68. 256,
  69. 3,
  70. 20);
  71. #else
  72. #endif
  73. if(led_thread != RT_NULL)
  74. {
  75. rt_kprintf("led sp:%x\n", led_thread->sp);
  76. rt_thread_startup(led_thread);
  77. }
  78. return 0;
  79. }
  80. /******************************************************************//**
  81. * @}
  82. *********************************************************************/