[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] how to set the link up
From: |
massimiliano cialdi |
Subject: |
Re: [lwip-users] how to set the link up |
Date: |
Fri, 7 Jul 2017 18:51:16 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 |
On 07/07/2017 18:04, Noam Weissman wrote:
Speed, duplex, link etc... is low level handling and the TCP stack is
not aware of that.
This is why you call the set_link_up/down in your task, informing the
stack !.
Yes, of course
The MDIO interface between your micro and PHY has no relation with
netif so why do you
pass it as argument ?
because, in our implementation (NXP), netif->state is pointer to
structure containing information to interface with PHY.
You several options to get the link state. You can connect the link
led in the ETH connector
to your micro and read it as a simple IO.
If your PHY supports MII and it is connected as an MII you can hook an
interrupt to the link line.
We are compliant to RMII, except interrupt signal that is not routed, so
we have to poll PHY.
The third option is what I suggested to read the PHY basic register
and check for the link bit.
Is what I do.
Your link task should not only check if link is up or down but also
know if it has changed !!. In your
code is constantly calling the netifapi functions unless I missed
something ?
Yes, I have further modified the task:
static void PhyStatus_Task( struct netif *netif )
{
enum { link_up, link_down } linkstatus = link_down;
phy_speed_t physpeed;
phy_duplex_t phyduplex;
bool link;
status_t result;
ETHSPDOFF();
netifapi_netif_set_link_down(netif);
while(1)
{
result = ethernetif_GetLinkStatus(netif, &link);
if(result == kStatus_Success)
{
switch(linkstatus)
{
case link_down:
if(true == link)
{
linkstatus = link_up;
netifapi_netif_set_link_up(netif);
}
break;
case link_up:
if(false == link)
{
linkstatus = link_down;
netifapi_netif_set_link_down(netif);
ETHSPDOFF();
}
else
{
result = ethernetif_GetLinkSpeedDuplex(netif,
&physpeed, &phyduplex);
if(result == kStatus_Success)
{
ETHSPD(physpeed);
}
}
break;
}
}
vTaskDelay(100);
}
}
I have investigated the problems: netifapi_netif_set_link_up() is called
and it cause call to link callback, in this function I call another
function in netifapi (netifapi_dhcp_start()), so I have a deadlock.
best regards
Max
- Re: [lwip-users] how to set the link up, (continued)
- Re: [lwip-users] how to set the link up, Sylvain Rochet, 2017/07/05
- Re: [lwip-users] how to set the link up, Noam Weissman, 2017/07/05
- Re: [lwip-users] how to set the link up, Sylvain Rochet, 2017/07/05
- Re: [lwip-users] how to set the link up, massimiliano cialdi, 2017/07/05
- Re: [lwip-users] how to set the link up, Noam Weissman, 2017/07/05
- Re: [lwip-users] how to set the link up, Sylvain Rochet, 2017/07/05
- Re: [lwip-users] how to set the link up, Noam Weissman, 2017/07/05
- Re: [lwip-users] how to set the link up, massimiliano cialdi, 2017/07/07
- Re: [lwip-users] how to set the link up, massimiliano cialdi, 2017/07/07
- Re: [lwip-users] how to set the link up, Noam Weissman, 2017/07/07
- Re: [lwip-users] how to set the link up,
massimiliano cialdi <=
- Re: [lwip-users] how to set the link up, Krzysztof WesoĊowski, 2017/07/07
- Re: [lwip-users] how to set the link up, Noam Weissman, 2017/07/09
- Re: [lwip-users] how to set the link up, massimiliano cialdi, 2017/07/10
- Re: [lwip-users] how to set the link up, massimiliano cialdi, 2017/07/06
- Re: [lwip-users] how to set the link up, Dirk Ziegelmeier, 2017/07/06
- Re: [lwip-users] how to set the link up, massimiliano cialdi, 2017/07/06
- Re: [lwip-users] how to set the link up, address@hidden, 2017/07/06
- Re: [lwip-users] how to set the link up, Noam Weissman, 2017/07/06
- Re: [lwip-users] how to set the link up, address@hidden, 2017/07/06
- Re: [lwip-users] how to set the link up, Noam Weissman, 2017/07/06