I have an ethernet driver that does implement these, but I don't
actually use it. Generally, what your driver needs to do is setup the
CAM registers and modes appropriately. For my driver, CAM entry 0 is
always the station address, and the other addresses are used for
multicast addresses. For example:
#ifdef ETH_DRV_SET_MC_LIST
case ETH_DRV_SET_MC_LIST: {
struct eth_drv_mc_list *mcl = (struct eth_drv_mc_list *)data;
cyg_uint8 *src = (cyg_uint8 *)&mcl->addrs[0];
int i;
/* Multicast addresses go into CAM address 1-ETH_DRV_MAX_MC.
* CAM address 0 is always our station address.
*/
debug1_printf("ks32c5000_eth_control: ETH_DRV_SET_MC_LIST
(%d).\n",
mcl->len);
CAMEnableVar &= 0x0001; /* Remove any previous MC list. */
if (mcl->len == 0)
{
/* The MC_LIST is empty, so ks32c5000_CAM_addr_set() will
not be
* called (below) to update the CAMEN register. Do that
* here explicitely.
*/
CAMEN = CAMEnableVar;
}
for (i=0; i<mcl->len; i++)
{
ks32c5000_CAM_addr_set((i+1), src);
src += ETHER_ADDR_LEN;
}
/* Update the CAM registers. */
CAMConfigVar &= ~(CAMCON_GROUP_ACC);
CAMConfigVar |= CAMCON_COMP_EN; /* Should always be on. */
CAMCON = CAMConfigVar;
return 0;
}
#endif /* ETH_DRV_SET_MC_LIST */
#ifdef ETH_DRV_SET_MC_ALL
case ETH_DRV_SET_MC_ALL: {
/* Multicast addresses go into CAM address 1-ETH_DRV_MAX_MC.
* CAM address 0 is always our station address.
*/
debug1_printf("ks32c5000_eth_control: ETH_DRV_SET_MC_ALL.\n");
CAMConfigVar |= CAMCON_GROUP_ACC;
CAMEnableVar &= 0x0001; /* Disable any previous MC list
addrs. */
/* Update the CAM registers. */
CAMCON = CAMConfigVar;
CAMEN = CAMEnableVar;
return 0;
}
#endif /* ETH_DRV_SET_MC_ALL */
Jay
On 9/24/2010 8:21 AM, Grant Edwards wrote:
I'm investigating what it would take to get my platform to
join a multicast group and receive multicast UDP packets.
I see that one of the interface values for Ethernet drivers is
CYGINT_IO_ETH_MULTICAST. My Ethernet driver doesn't implement that,
so I assume receiving UDP multicast won't work.
Can anybody loan me a clue what "implementing" that implies for an
Ethernet driver? I assumed it mean that the driver supported one or
both of ETH_DRV_SET_MC_ALL, ETH_DRV_SET_MC_LIST.
But when I looked at a driver that "implement[s] CYGINT_IO_ETH_MULTICAST"
I find that the body of ppc405_eth_control() consists of
os_printf("%s.%d\n", __FUNCTION__, __LINE__);
return 1;
If an ethernet driver doesn't have to to handle ETH_DRV_SET_MC_ALL and
ETH_DRV_SET_MC_LIST to claim it "implements CYGINT_IO_ETH_MULTICAST",
what exactly does a driver have to do?
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss