|
void telnet_thread(void *arg)
{
#if OS_CRITICAL_METHOD == 3
OS_CPU_SR cpu_sr = 0;
#endif
struct netconn *conn, *newconn;
struct ip_addr l_ip;
err_t err;
char strbuf[64], cmdbuf[30];
u16_t strlen;
s8_t cmd_c;
IP4_ADDR(&l_ip, 192,168,1,60);
/* Create a new connection identifier. */
conn = netconn_new(NETCONN_TCP);
/* Bind connection to well known port number 7. */
netconn_bind(conn, &l_ip, 150);
/* Tell connection to go into listening mode. */
netconn_listen(conn);
while(1)
{ struct netbuf *buf;
extern OS_EVENT *Send_Flag;
extern uint8 Send_buf1[];
extern uint8 Flag;
newconn = netconn_accept(conn);
if(newconn != NULL)
{ while(1)
{
OSSemPend(Send_Flag,0,&err); 等待串口发送的信号量
strlen = sprintf(strbuf, Send_buf1);
netconn_write(newconn, strbuf, strlen, NETCONN_NOCOPY);
Uart1_Init(4800,1); 开串口中断
}
}
}
}
以上lwip的一个任务,现在就是想只要我tcp一连接上,就不停的收到数据,改数据是串口接受到的,现在问题是为什么发送几帧数据后就进入不了这个lwip的线程,我等待不用信号量的话,用全局变量来进行判断就可以。这个是什么原因呢? |
阿莫论坛20周年了!感谢大家的支持与爱护!!
月入3000的是反美的。收入3万是亲美的。收入30万是移民美国的。收入300万是取得绿卡后回国,教唆那些3000来反美的!
|