This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Ethernet application on DM6446 - Da Vinci



Hello everybody,
I am very new on using Da Vinci plataform, and I am full of doubts.
I really need to quickly develop an application that uses the ethernet peripheral to connect to an Cyclone 3 development kit from Altera. Since I am developing on the Embedded Linux on the Da Vinci and I am also new on linux systems I am not familiarized with Linux devices drives. I have already developed an code to use the OSD through its device drive located on /etc/dev/fb/0. It was quietly easy to do that, but when it comes to Ethernet I don't have a clue on where to begin. Is there an specific device drive on the embedded linux on Da Vinci platform where i can just open like in OSD case and perform an ethernet packet transfer? Someone told me Linux has a library already implemented for ethernet called socket.h, how can I use that to build a server client connection? Does anyone has a source code on which I can test and develop an ethernet connection ?

Thanks in advance

  • you are correct, there is a set of socket calls (generally found under <sys/socket.h>).  I would recommend frist trying to find usage information via Linux man pages for the particular distro you are using (e.g. type 'man socket' at Linux command prompt); the man pages should inficate the right header file(s) to include and some usage information similar to what appears here .  Beyond that, you can always search for example source code in the internet or books; this is a pretty standard interface.

    Hope this helps.

  • Thanks for the initial guide Juan, what about the device driver for ethernet on DM6446? is there one like in the OSD case? What I need to do in my project is to check the ethernet peripheral and once a packet is receveid, send that information to the SDRAM or the OSD. Is there a quick way to do that ethernet packet receive part?

  • Network drivers are an special type of drivers in Linux that are not accessed via /dev interface and there are many good reasons for this; just to name a couple, you do not open a device node, but rather connect to a port number allowing several hundred sockets to be multiplexed on the same physical interface; in addition, unlike bock drivers (closest comparison to network drivers) which act upon receiving a request from the kernel, network drivers receives packets from outside...

    your best bet is to create a socket and connect to a port thru which you can transmit and/or receive data; of course certain ports are reserved for special services such as TFTP, NFS, HTTP... hence you cannot choose any artitrary port either. 

    If you need more information on how network drivers work in the Linux stack, you can refer to chapter 7 of the Linux Device Drivers book available for free here

  • Thank you for your support, things are more clear now. I have another two questions if you don't mind to help me.

    Is there a way to find out which port is available to create the connection?

    Is there in DaVinci Kernel the socket.h library so I can use the functions:

                int recv(int s, void *msg, int len, int flags) -> to receive ethernet packets? ; and

                int send(int s, const void *msg, int len, int flags) -> to send ethernet packet?

     

    Best Regards