|
做了个程序用来接收TCP数据然后通过DMA发送出去,但是跑个一两天,程序就会进入rt_timer_check中出不来。导致无法正常接收TCP发来的数据。
我看了下while (!rt_list_isempty(&rt_timer_list[RT_TIMER_SKIP_LIST_LEVEL-1]))这个判断导致的。
在这个循环中一直判断if ((current_tick - t->timeout_tick) < RT_TICK_MAX/2) 然后stop timer。
我没太研究过这个函数是做什么的,我想知道造成这样问题的原因是什么,如何解决。
附接收TCP数据函数
while(1)
{
/* accept any icoming connection */
netconn_accept(tcpconn, &newconn);
if(newconn)
{
struct netbuf *inbuf;
char *buf;
u16_t buflen;
while(netconn_err(newconn) == ERR_OK)
{
ad9789_read_block_num_temp = ad9789_read_block_num>>(10-AD9789_CONVERT_MOVE);
ad9789_read_block_num_temp &= 0x3f;
ad9789_write_block_num = ad9789_write_add>>10;
if((ad9789_write_block_num != ad9789_read_block_num_temp)&&(ad9789_write_block_num != ((ad9789_read_block_num_temp-1)&0x3f))&&(ad9789_write_block_num != ((ad9789_read_block_num_temp-2)&0x3f)))
{
/* Read the data from the port, blocking if nothing yet there.
We assume the request (the part we care about) is in one netbuf */
err = netconn_recv(newconn, &inbuf);
if(inbuf != NULL)
{
netbuf_data(inbuf, (void**)&buf, &buflen);
if(((unsigned long)(ad9789_write_add) + buflen) > 0xffff)
{
memcpy(&udp_receive_buffer1_2[ad9789_write_add], buf, (0xffff-ad9789_write_add+1));
memcpy(udp_receive_buffer1_2, &buf[(0xffff-ad9789_write_add+1)], buflen-(0xffff-ad9789_write_add+1));
ad9789_write_add = buflen-(0xffff-ad9789_write_add+1);
}
else
{
memcpy(&udp_receive_buffer1_2[ad9789_write_add], buf, buflen);
ad9789_write_add += buflen;
}
/* Delete the buffer (netconn_recv gives us ownership,
so we have to make sure to deallocate the buffer) */
netbuf_delete(inbuf);
}
}
else
{
delay_ms(5);
}
}
/* Close the connection (server closes in HTTP) */
netconn_close(newconn);
/* delete connection */
netconn_delete(newconn);
}
}
是接收TCP数据然后通过DMA向AD9789发送的函数,我在想是不是因为netconn_recv没有设置超时等待时间导致的……请各位指导。 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
月入3000的是反美的。收入3万是亲美的。收入30万是移民美国的。收入300万是取得绿卡后回国,教唆那些3000来反美的!
|