This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: connect problem in lwip


vikal jain wrote:
I am using lwip in eCOS on linux synthetic target.
I am getting problem in "connect" socket call while
using LOOPBACK addresses.Connect calls eth_drv_write.
It crashes in eth_drv_write.
****************************************************
struct eth_drv_sg sg_list[MAX_ETH_DRV_SG];
struct eth_drv_sc *sc = __local_enet_sc;
int sg_len = 1;

while (!(sc->funs->can_send)(sc)) {
  	cyg_thread_delay(1);
    }
****************************************************
__local_ernet_sc turns out to be NULL, which should be
initialized by eth_drv_init, but eth_drv_init is never
called.

I have following doubts:

1. Why is eth_drv_write called in case of LOOPBACK?
2. When is eth_drv_init called ?
For the normal BSD stack, cyg_net_init() calls each hardware driver's init function (i.e. in devs/eth/....). Each hardware driver has this set up with a NETDEVTAB_ENTRY.

The hardware driver init function then calls the io/eth level driver so it can initialize:

// Initialize upper level driver
(sc->funs->eth_drv->init)(sc, cpd->esa);

This is a function pointer to eth_drv_init (set up via the ETH_DRV_SC macro).

So in the lwIP case, if eth_drv_init isn't being called, that means the device init isn't being called which may mean you haven't got your eth device properly included. Or io/eth/current/src/lwip/eth_drv.c has the function init_hw_drivers():
//Called from lwIP init code to init the hw devices
//and pass the lwip input callback address
void init_hw_drivers(unsigned char *hw_addr,lwip_input_t input)
{
...

So perhaps _that_ isn't being called from lwIP. I don't know about how lwip gets started to know what's meant to happen here, but presumably there has to be something in lwip you are meant to call to get everything going.

3. Is it necessary to call
init_all_network_interfaces" in lwip?
init_all_network_interfaces() is specific to the BSD net stacks.

Jifl
--
eCosCentric       http://www.eCosCentric.com/       <info@eCosCentric.com>
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]