Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

lwIP and new Ethernet MAC Device

Hello,

I am using a development board from Altera with a stratixs_2s60 FPGA on it.

A Nios II processor system and the MicroC/OS II are running on it.

My boss has written a virtual Ethernet MAC, called rtmac_0, that can be manipulated through a register-interface like a normal Ethernet MAC and basically consists of a single FIFO. A packet can be send to it and has to be received directly afterwards.

I wrote an Ethernet device driver for this virtual MAC (i.e. rtmac_0), based on the altera_avalon_lan91c111 and a simple application programm that sends a packet to the lwIP stack and receives it directly afterwards.

To tell the lwIP stack to use the virtual MAC (i.e. rtmac_0) instead of the lan91c111 I changed the following line in lwipopts.h:

before:# define LWIP_DEFAULT_DEV "/dev/"LWIP_DEFAULT_IF

after:# define LWIP_DEFAULT_DEV "/dev/rtmac_0"

I did this because the rtmac_0 was not selectable in the System Properties GUI in the Nios IDE and the Nios II Software Developer's Handbook mentioned in chapter 9 that the GUI changes the settings in the lwipopts.h File.

Although the netconn_send(conn) Funktion of the lwIP stack executes without an error, the device driver for the rtmac_0 is not called, nor is the device driver for the lan91c111.

Does anybody know how I can make the lwIP stack work together with the new Ethernet MAC interface (i.e. rtmac_0)?

I would be very happy about any answer!

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I can't give you an exact answer, but I can tell you what my experience has been in working with custom drivers.

    Your problem may have something to do with the HAL. In every Altera Component directory, there is a makefile of some sort that compiles the device drivers for that component, along with a component.mk. You need to have these present. When these are present, the Altera HAL will automatically register your driver as an Ethernet driver by calling it's init functiion. You should basically copy all the files from the LAn91C directory and modify them accordingly. Be sure to look in the header files, because some structures in there are responsible for calling the init functions. I know some function adds the ethernet device to a linked list, and then sets up a bunch of function pointers for rx, tx , interrupt etc...

    Hope this points you at least in the right direction!!!