Hi Martin, I am misunderstanding your requirements. Why do you need a callback function and to where?
To me, the current eCos flow is as following: 1. Ethernet driver initialization: eth_drv_funs.(*init)(struct eth_drv_sc *sc, unsigned char *enaddr) 2. In the eth init function, call _eth_phy_init() which will initialize the PHY interface and probe for matching PHY id. 3. In the eth init function, call _eth_phy_state() which will report the current link state 4. Configure the MAC according to the link state In this case there is no need for callback function. This flow only works well for auto-negotiated link. If I would require to configure the PHY for different link mode or board specific configuration, I would just add a new field to the PHY entry: struct _eth_phy_dev_entry { char *name; unsigned long id; bool (*stat)(eth_phy_access_t *f, int *stat); bool (*cfg)(eth_phy_access_t *f, int mode); } CYG_HAL_TABLE_TYPE; The declaration of the PHY would require to be extended with the new field. _eth_phy_dev("IC+ IP101A", 0x02430c54, ip101a_stat, my_ip101a_cfg) Finally you can update _eth_phy_cfg to call the PHY specific configuration routine. my_ip101a_cfg can be a generic routing (part of the PHY file) for the particular PHY (for setting link mode) our could be board specific if you require to configure some additional registers ( clock alignment, LEDs etc. ). externC int _eth_phy_cfg(eth_phy_access_t *f, int mode) { if(f->dev->cfg) return (f->dev-> cfg)(f, mode) ... In the previous flow, I would replace #3 with _eth_phy_cfg which also return the state of the link. Not a perfect solution but should work fine. Christophe -----Original Message----- From: ecos-discuss-ow...@ecos.sourceware.org [mailto:ecos-discuss-ow...@ecos.sourceware.org] On Behalf Of Martin Laabs Sent: 1. mars 2011 13:29 To: ecos-discuss@ecos.sourceware.org Subject: Re: [ECOS] Ethernet PHY board specific configuration Hello Christophe, On 03/01/11 11:36, Christophe Coutand wrote: > My experience is that the PHY API of eCos only let you retrieve the PHY > state (Link Mode) using _eth_phy_state() which you can further use for > setting your MAC layer. If you should handle any specific link > configuration or act on link mode change (from interrupt), you must > write you own configuration function. _eth_phy_cfg seems to be a generic > function which should be propagated to _eth_phy_dev_entry to have more > flexibility. Thank you for this information. I already thought I have to change the _eth_phy_dev entry. However it will be somewhat tricky to implement a real callback to the board specific code. Thank you, Martin L. > > Christophe > > -----Original Message----- > From: ecos-discuss-ow...@ecos.sourceware.org > [mailto:ecos-discuss-ow...@ecos.sourceware.org] On Behalf Of Martin > Laabs > Sent: 28. februar 2011 12:37 > To: ecos-discuss@ecos.sourceware.org > Subject: [ECOS] Ethernet PHY board specific configuration > > Hello, > > my eCos port to the AT91SAM9 family is mostly done. Now I want to > configure > the ethernet phy after it is recognized by ecos and before the MAC > begins > transmitting data. The cause is to configure the auto-negotiation mode > and > LED settings. > As far as I know there is no such macro or callback defined yet. Is this > > correct and where should I add such a macro? > > Thank you, > Martin Laabs > > -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss