05-27-2012 07:07 PM
I setup ML605_IwIP_AXI reference design for ETHERNET and successfully connected to iperf server.
+++++ lwIP RAW Mode +++++
Board IP: 192.168.1.10
Netmask : 255.255.255.0
Gateway : 192.168.1.1
auto-negotiated link speed: 1000
Server Port Connect With..
-------------------- ------ --------------------
echo server 7 $ telnet <board_ip> 7
rxperf server 5001 $ iperf -c <board ip> -i 5 -t 100
txperf client N/A $ iperf -s -i 5 -t 100 (on host with IP 192.168.1.100)
tftp server 69 $ tftp -i 192.168.1.10 PUT <source-file>
http server 80 Point your web browser to http://192.168.1.10
txperf: Connected to iperf server
Now I need to send data from FPGA to PC.
1) What are the APIs I should use?
2) How to write data to send buffer?
3) Are there any sample codes to do this?
I need to use RAW APIs.
Solved! Go to Solution.
05-29-2012 12:00 AM
OK ... the problem can be solved by following the steps below,
To send data on a TCP connection:
- Call tcp_sent() to specify a callback function for acknowledgements.
- Call tcp_sndbuf() to find the maximum amount of data that can be sent.
- Call tcp_write() to enqueue the data.
- Call tcp_output() to force the data to be sent.
u16_t tcp_sndbuf(struct tcp_pcb * pcb)
Returns the number of bytes of space available in the output queue.
err_t tcp_write(struct tcp_pcb * pcb, void * dataptr, u16_t len, u8_t apiflags)
Enqueues the data pointed to by the argument dataptr. The length of the data is passed as the len parameter.
The apiflags argument can have either of the following bits:
- TCP_WRITE_FLAG_COPY indicates that lwIP should allocate new memory and copy the data into it. If not specified, no new memory should be allocated and the data should only be referenced by pointer.
- TCP_WRITE_FLAG_MORE indicates that the push flag should not be set in the TCP segment.
The tcp_write() function will fail and return ERR_MEM if the length of the data exceeds the current send buffer size or if the length of the queue of outgoing segment is larger than the upper limit defined in lwipopts.h (TCP_SND_QUEUELEN). If the function returns ERR_MEM, the application should wait until some of the currently enqueued data has been successfully received by the other host and try again.
err_t tcp_output(struct tcp_pcb * pcb)
Forces all enqueued data to be sent now.
void tcp_sent(struct tcp_pcb * pcb, err_t (* sent)(void * arg, struct tcp_pcb * tpcb, u16_t len))
Specifies the callback function that should be called when data has been acknowledged by the remote host. The len argument passed to the callback function gives the number of bytes that were acknowledged by the last acknowledgment.
06-06-2013 08:53 PM
Take a look at WebPHY DATABUS www.webphyfpga.com. No software stack, CPU, PHY, DDR or Flash chips are required, everything is contained in one small IP core to allow data read and write to an FPGA from a standard web browser.