1.用了米联客的核心板和例程"CH28 利用 LWIP 实现 ADC DAQ7606 数据采集",例程中的AD为16位200K的采样率,PS 的 dma 数据接收采用了乒乓操作的模式,两个缓冲区交替进行数据接收。现在用在100M的采集卡上,收到的数总是不对不知道是不是因为采样率太高和传输速率不匹配才会产生的这个问题?
2.还有关于pingpang操作的问题,一般pingpang操作都是用在FPGA端因为FPGA的并行处理能力,不知道在PS端用的pingpang操作是否达到真正pingpang操作的效果?程序如下:
void send_received_data()
{
err_t err;
int Status;
struct tcp_pcb *tpcb = connected_pcb;
/*initial the first axidma transmission, only excuse once*/
if(!first_trans_start)//第一次传输
{
Status = XAxiDma_SimpleTransfer(&AxiDma, (u32)RxBufferPtr[0] + HEADER_SIZE,
(u32)(ADC_PACKET_LENGTH), XAXIDMA_DEVICE_TO_DMA);//第一个buffer进行DMA传输
if (Status != XST_SUCCESS)
{
xil_printf("axi dma failed! 0 %d\r\n", Status);
return;
}
/*set the flag, so this part of code will not excuse again*/
first_trans_start = 1;//第一次传输完成标志
//xil_printf("first trans\r\n");
}
/*if the last axidma transmission is done, the interrupt triggered, then start TCP transmission*/
if(packet_trans_done )//&& tcp_trans_done//网络传输部分
{
if (!connected_pcb)
return;
/* if tcp send buffer has enough space to hold the data we want to transmit from PL, then start tcp transmission*/
if (tcp_sndbuf(tpcb) > TCP_PACKET_SIZE )//&& tcp_sndqueuelen(tpcb) == 0
{
//tcp_trans_done = 0;
header_p = (packet_header *)RxBufferPtr[packet_index & 1];
header_p->ID0 = HEADER_ID0;
header_p->ID1 = HEADER_ID1;
header_p->frame_cnt = packet_index;
header_p->length = ADC_PACKET_LENGTH;
Xil_DCacheInvalidateRange((u32)RxBufferPtr[packet_index & 1] + HEADER_SIZE, ADC_PACKET_LENGTH);
/*transmit received data through TCP*/
err = tcp_write(tpcb, RxBufferPtr[packet_index & 1], TCP_PACKET_SIZE, TCP_WRITE_FLAG_COPY & (~TCP_WRITE_FLAG_MORE));
if (err != ERR_OK) {
xil_printf("txperf: Error on tcp_write: %d\r\n", err);
connected_pcb = NULL;
return;
}
err = tcp_output(tpcb);
if (err != ERR_OK) {
xil_printf("txperf: Error on tcp_output: %d\r\n",err);
return;
}
packet_index++;
/*clear the axidma done flag*/
packet_trans_done = 0;
/*initial the other axidma transmission when the current transmission is done*/
Status = XAxiDma_SimpleTransfer(&AxiDma, (u32)RxBufferPtr[packet_index & 1] + HEADER_SIZE,
(u32)(ADC_PACKET_LENGTH), XAXIDMA_DEVICE_TO_DMA);
if (Status != XST_SUCCESS)
{
xil_printf("axi dma %d failed! %d \r\n", packet_index, Status);
return;
}
}
}
}