程序跑进rt_timer_check函数中出不来了
做了个程序用来接收TCP数据然后通过DMA发送出去,但是跑个一两天,程序就会进入rt_timer_check中出不来。导致无法正常接收TCP发来的数据。我看了下while (!rt_list_isempty(&rt_timer_list))这个判断导致的。
在这个循环中一直判断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, 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, 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没有设置超时等待时间导致的……请各位指导。{:smile:}
页:
[1]