"Roggey" writes: |> I have to make an connection to a FPGA-borad. |> |>
formatting link
|> |> This board only supports ethernet communication with the mac-layer. Now |> I have to build an app that can send data(in my case images) to the |> board. |> |> My question is now how can i send data using the mac-layer only from a |> c++ programm.
How to sent UDP packets or establish a TCP connection from C++ depends entirely on your operating system. Under Unix/Linux, you may want to start on the "man 2 socket" manual page and related tutorials. On MacOS, it's probably the same.
On the FPGA side:
If you have a way to upload a microcontroller into the FPGA, or it has already a built-in processor, and you have a C compiler for it, you can install either a bare-boned TCP/IP stack such as
formatting link
which also supports ARP and DHCP, or even a full embedded operating system such as Linux or Windows CE. Thats the most flexible and luxurious approach.
If you want to avoid using a processor, then you can probably forget about using TCP. But decoding UDP packets in hardware may still be very feasible.
If your Ethernet it is a point-to-point link, you may want to try sending out UDP packets to IP broadcast addresses. This should be translated into MAC broadcasts and therefore bypasss the entire address-resolution protocol (ARP) mechanism in which your FPGA will not participate. On the decoding end, you will have to hope that the IP packets arrive unfragmented and with constant-length headers (i.e., no options), which is normally the case for UDP packets shorter than ~1.5 kB.
Of course all this is a real hack and may fail as soon as anything else gets connected to the same network. But as long as you do not expect Ethernet to run will all the features with which it is used normally, it can be used almost as easily as any other type of serial port.
Markus