application.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. * 2014-04-27 Bernard make code cleanup.
  14. */
  15. #include <board.h>
  16. #include <rtthread.h>
  17. #ifdef RT_USING_LWIP
  18. #include <lwip/sys.h>
  19. #include <lwip/api.h>
  20. #include <netif/ethernetif.h>
  21. #include "stm32_eth.h"
  22. #endif
  23. void rt_init_thread_entry(void* parameter)
  24. {
  25. /* LwIP Initialization */
  26. #ifdef RT_USING_LWIP
  27. {
  28. extern void lwip_sys_init(void);
  29. /* register ethernetif device */
  30. eth_system_device_init();
  31. rt_hw_stm32_eth_init();
  32. /* re-init device driver */
  33. rt_device_init_all();
  34. /* init lwip system */
  35. lwip_sys_init();
  36. rt_kprintf("TCP/IP initialized!\n");
  37. }
  38. #endif
  39. }
  40. int rt_application_init()
  41. {
  42. rt_thread_t tid;
  43. tid = rt_thread_create("init",
  44. rt_init_thread_entry, RT_NULL,
  45. 2048, RT_THREAD_PRIORITY_MAX/3, 20);
  46. if (tid != RT_NULL)
  47. rt_thread_startup(tid);
  48. return 0;
  49. }
  50. /*@}*/