I need to transfer the data from the kc705 board to the PC using LWIP Echo Server.
Design Flow as follows as below:
1. Counter data from Kintex DAQ board (Part Number : XC7k160tffg676-2) is passing to the KINTEX KC705 board through optical cable [Completed]
2. KINTEX KC705 board Should pass the data to PC through LWIP Echo server [Unable to pass the received data to TCP].
I am new to Ethernet Design [Network] so apology me for asking silly question. For me doubt in Echo Coding part.
/////////////////////Function to receive Data in KC705 from DAQ board //////////////
int RxReceive (XLlFifo *InstancePtr, u32* DestinationAddr)
{
int i;
//int Status;
u32 RxWord;
static u32 ReceiveLength;
ReceiveLength = (XLlFifo_iRxGetLen(InstancePtr))/WORD_SIZE;
/* Start Receiving */
if(ReceiveLength>0)
{
//xil_printf("@@@@@@@@@ ");
for ( i=0; i < ReceiveLength; i++)
{
RxWord = 0;
RxWord = XLlFifo_RxGetWord(InstancePtr);
*(DestinationAddr+i) = RxWord;
//*(DestinationAddr+i) = 10;
xil_printf("received data : %d\n\r",*(DestinationAddr+i));
}
}
return XST_SUCCESS;
}
How to pass that received data into TCP [tcp_write() function]. I have coded Please correct if i am wrong.
extern u32 DestinationBuffer[1024]; // Globally Declared : Counter Values are stored in destination buffer. Those values i am passing to tx_func. That function is called in recv_callback.
extern void tx_func(struct tcp_pcb *tpcb)
{
int i,Status;
Status=aurora_rx_main();
for(i=0;i<1024;i++)
{
xil_printf("%d,",DestinationBuffer[i]);
}
tcp_write(tpcb, DestinationBuffer, 1024, 0); //////////////// tcp_write Function getting data from DestinationBuffer
}
err_t recv_callback(void *arg, struct tcp_pcb *tpcb,
struct pbuf *p, err_t err)
{
/* do not read the packet if we are not in ESTABLISHED state */
if (!p) {
tcp_close(tpcb);
tcp_recv(tpcb, NULL);
return ERR_OK;
}
/* indicate that the packet has been received */
tcp_recved(tpcb, p->len);
/* echo back the payload */
/* in this case, we assume that the payload is < TCP_SND_BUF */
tcp_recved(tpcb, p->len);
{
tx_func(tcp_pcb)
} else
xil_printf("no space in tcp_sndbuf\n\r");
/* free the received pbuf */
pbuf_free(p);
return ERR_OK;
}
Question
Thausikan
I need to transfer the data from the kc705 board to the PC using LWIP Echo Server.
Design Flow as follows as below:
1. Counter data from Kintex DAQ board (Part Number : XC7k160tffg676-2) is passing to the KINTEX KC705 board through optical cable [Completed]
2. KINTEX KC705 board Should pass the data to PC through LWIP Echo server [Unable to pass the received data to TCP].
I am new to Ethernet Design [Network] so apology me for asking silly question. For me doubt in Echo Coding part.
/////////////////////Function to receive Data in KC705 from DAQ board ////////////// int RxReceive (XLlFifo *InstancePtr, u32* DestinationAddr) { int i; //int Status; u32 RxWord; static u32 ReceiveLength; ReceiveLength = (XLlFifo_iRxGetLen(InstancePtr))/WORD_SIZE; /* Start Receiving */ if(ReceiveLength>0) { //xil_printf("@@@@@@@@@ "); for ( i=0; i < ReceiveLength; i++) { RxWord = 0; RxWord = XLlFifo_RxGetWord(InstancePtr); *(DestinationAddr+i) = RxWord; //*(DestinationAddr+i) = 10; xil_printf("received data : %d\n\r",*(DestinationAddr+i)); } } return XST_SUCCESS; }
How to pass that received data into TCP [tcp_write() function]. I have coded Please correct if i am wrong.
extern u32 DestinationBuffer[1024]; // Globally Declared : Counter Values are stored in destination buffer. Those values i am passing to tx_func. That function is called in recv_callback. extern void tx_func(struct tcp_pcb *tpcb) { int i,Status; Status=aurora_rx_main(); for(i=0;i<1024;i++) { xil_printf("%d,",DestinationBuffer[i]); } tcp_write(tpcb, DestinationBuffer, 1024, 0); //////////////// tcp_write Function getting data from DestinationBuffer } err_t recv_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) { /* do not read the packet if we are not in ESTABLISHED state */ if (!p) { tcp_close(tpcb); tcp_recv(tpcb, NULL); return ERR_OK; } /* indicate that the packet has been received */ tcp_recved(tpcb, p->len); /* echo back the payload */ /* in this case, we assume that the payload is < TCP_SND_BUF */ tcp_recved(tpcb, p->len); { tx_func(tcp_pcb) } else xil_printf("no space in tcp_sndbuf\n\r"); /* free the received pbuf */ pbuf_free(p); return ERR_OK; }
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.