#include "main.h" #include "os-app.h" #include #include #include #include "usart-board.h" #if !defined(LOG_TAG) #define LOG_TAG "dtu2" #endif #include ALIGN (RT_ALIGN_SIZE) static char thread_stack[2048]; static struct rt_thread dtu2_thread; static enum { netDrvInit = 0, // 初始化网络驱动 netDrvJoin = 1, // 等待网络注册成功 netDrvSend = 2, // 发送数据 netDrvRecv = 3, // 读取数据 netDrvIdle = 4, // 读取数据 } eDrvStatus; static void net_data_rxdone(void) { rt_event_send(gUartEvents,EVENT_UART_ETH2_RX); //rt_kprintf("net_data_rxdone\r\n"); } static void thread_entry (void * argument) { // eDrvStatus = netDrvInit; rt_kprintf ("%s was start!\r\n", __FILE__); g_ETH2Drv.rxdone = net_data_rxdone; MX_UART_Init(&g_ETH2Drv); // // 注册网络驱动 // 注册网络驱动 while (1) { //MX_UART_PutBuffer(&g_ETH1Drv,"20140524",8); if( RT_EOK == rt_event_recv( gUartEvents, EVENT_UART_ETH1_RX,RT_EVENT_FLAG_AND | RT_EVENT_FLAG_CLEAR, RT_WAITING_NO, RT_NULL )) { rt_kprintf("<<<<<<<<<<<<<<<<<<<