This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: How to get Ethernet link status?
On 2008-12-16, Jay Foster <jay@systech.com> wrote:
> I had to modify the ethernet driver to use the Generic PHY
> Package. I made it conditional on the presence of the Generic
> PHY Package (CYGPKG_DEVS_ETH_PHY) so the driver could still be
> built without it.
>
> Basically you will create a set of functions in your ethernet
> driver (XXX_eth_phy_put_reg(), XXX_eth_phy_get_reg(),
> XXX_ETH_phy_noop()), and instantiate a eth_phy_access_t
> object. Then call _eth_phy_init() from your ethernet driver
> initialization code someplace. The calls to _eth_phy_state()
> will then call the appropriate XXX_eth_phy_put_reg(),
> XXX_eth_phy_get_reg() functions in your ethernet driver via
> the eth_phy_access_t object. Essentially, instead of the
> ethernet driver accessing the PHY directly, it does so
> indirectly through the Generic PHY API. The code that
> actually talks with the PHY is still in the ethernet driver,
> probably the same or very similar to what is there already.
>
> It's a bit of work to do, so unless you have a compelling
> reason to, you might not bother. For me, I needed the ability
> to work with multiple PHYs at run-time, depending on which one
> was installed, so it was worth it.
OK, that provides a extra API layer between the Ethernet driver
and the PHY. It still doesn't provide a way to retreive the
link status information that's kept in the Ethernet driver. I
don't really want the application code making calls that read
PHY registers -- that's going to involve mutexes and a lot more
overhead than just reading a couple flags sitting in RAM.
For the application to use the generic PHY stuff, it also
appears to require that the application know which PHY is
present. I don't want that information to be needed at the
application level.
--
Grant Edwards grante Yow! I want another
at RE-WRITE on my CEASAR
visi.com SALAD!!
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss