Forum Discussion

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

Stand alone lwIP

Hi all,

I downloaded and installed the stand alone lwIP from the 'Tested IP'.

There is a code named 'lan91c111if.c' and I tried to understand line by line of the code.

In the function low_level_input(struct netif *netif), there is a line like below,

buf = dev->ethernet_dev_list.dev.read_routine(dev, if_getbuf); --- A

It seems like, but I'm not sure that 'if_getbuf()' is called by 'read_routine', but I coudn't find any line which shows that read_routine() calles 'if_getbuf()'.

There is only a structure defined in 'alt_ethernet_dev.h' as follows,

struct alt_ethernet_dev

{

void* network;

const char* name;

int (*init_routine)(); /* low level initialization */

void (*rx_routine)(); /* low level device service */

void* (*read_routine)(); /* low level input */ --- B

int (*write_routine)(); /* low level output */

};

It is just a function pointer[void* (*read_routine)()] right?

But I coundn't find any assignment for this pointer to point a function. I mean I don't understand the relationship between line ---A and ---B. How is the function 'if_getbuf()' called?

Thank you.
No RepliesBe the first to reply