我已经在论坛中搜索过,但没有找到解决问题的方法,因为它是我在这里写的...
我已使用LWIP Echo服务器模板将数据从Board传输到PC。 我只是简要介绍一下我的设计流程:
通过光缆将数据从DAQ传输到KINTEX
缓冲区大小:u32 DestinationBuffer [1024];
KINTEX-通过FIFO接收数据
enter code here
#include "xparameters.h"
#include "xil_exception.h"
#include "xstreamer.h"
#include "xil_cache.h"
#include "xllfifo.h"
#include "xstatus.h"
#include "xil_printf.h"
#include "ar_rx.h"
#undef DEBUG
XLlFifo FifoInstance;
int aurora_rx_main()
{
u32 RxWord;
int Status;
//xil_printf("Entering RX loop\r\n");
//while(1)
{
Status = XLlFiforx(&FifoInstance, FIFO_DEV_ID);
if (Status != XST_SUCCESS)
{
xil_printf("Axi Streaming FIFO Test Failed\n\r");
return XST_FAILURE;
}
xil_printf("Successfully ran Axi Streaming FIFO \n\r");
}
return XST_SUCCESS;
}
int XLlFiforx(XLlFifo *InstancePtr, u16 DeviceId)
{
XLlFifo_Config *Config;
int Status,n=0;
Status = XST_SUCCESS;
/* Initialize the Device Configuration Interface driver */
Config = XLlFfio_LookupConfig(DeviceId);
if (!Config)
{
xil_printf("No config found for %d\r\n", DeviceId);
return XST_FAILURE;
}
Status = XLlFifo_CfgInitialize(InstancePtr, Config, Config->BaseAddress);
if (Status != XST_SUCCESS)
{
xil_printf("Initialization failed\n\r");
return Status;
}
while(n<100)
{
Status = RxReceive(InstancePtr, DestinationBuffer);
if (Status != XST_SUCCESS)
{
xil_printf("Receiving data failed");
return XST_FAILURE;
}
n++;
}
return Status;
}
int RxReceive (XLlFifo *InstancePtr, u32* DestinationAddr)
{
int i;
u32 RxWord;
static u32 ReceiveLength;
ReceiveLength = (XLlFifo_iRxGetLen(InstancePtr))/WORD_SIZE;
/* Start Receiving */
if(ReceiveLength>0)
{
for ( i=0; i < ReceiveLength; i++)
{
RxWord = 0;
RxWord = XLlFifo_RxGetWord(InstancePtr);
*(DestinationAddr+i) = RxWord;
xil_printf("received data : %d\n\r",*(DestinationAddr+i));
}
}
return XST_SUCCESS;
}
我的需要是
KINTEX中接收到的数据应通过Ethernetlite传输到PC。我在KINTEX和XSDK上的RAW模式下使用LWIP
问题是我想通过网络连接发送大量数据。如何设置我的tcp_recv回调函数,使其返回一定数量的数据
tcp_recv回调函数
err_t recv_callback(void *arg, struct tcp_pcb *tpcb,
struct pbuf *p, err_t err)
{
int i,Status;
Status=aurora_rx_main();
for(i=0;i<10;i++)
{
xil_printf("%d,",DestinationBuffer[i]);
}
xil_printf("\n");
if (!p)
{
tcp_close(tpcb);
tcp_recv(tpcb, NULL);
return ERR_OK;
}
/* indicate that the packet has been received */
tcp_recved(tpcb, p->len);
if (tcp_sndbuf(tpcb) > 10) {
err = tcp_write(tpcb, DestinationBuffer, 10, 1);
} else
xil_printf("no space in tcp_sndbuf\n\r");
/* free the received pbuf */
pbuf_free(p);
return ERR_OK;
}
请任何人告诉我如何将数据传递到tcp_recv回调函数,以便我可以将数据传递到PC。谢谢