1. 配置
// file xemacpsif_hw.c
void init_emacps(xemacpspif_s *xemacps, struct netif *netif){
......
+ XEmacPs_SetOptions(xemacps, XEMACPS_PROMICS_OPTION); // 看这里
+ printf("XEmacPs_SetOptions XEMACPS_PROMICS_OPTION\n");
}
2. 验证
能收到 非广播包,非本地包,即ok
// file xemacpsif.c
s32_t xemacpsif_input(struct netif *netif)
{
+ static uint32_t nlNums = 0;
......
/* full packet send to tcpip_thread to process */
+ if( !eth_addr_cmp(ðhdr->dest, ðlocal) ){ // dst mac addr not local
+ if( !eth_addr_cmp(ðhdr->dest, ðbroadcast) ){ // dst mac addr not broadcast
+ nlNums++;
+ printf("dst mac, not broadcast mac and not local mac [%d][%x %x %x %x %x %x] \n"
+ ,nlNums
+ ,ethhdr->dest.addr[0]
+ ,ethhdr->dest.addr[1]
+ ,ethhdr->dest.addr[2]
+ ,ethhdr->dest.addr[3]
+ ,ethhdr->dest.addr[4]
+ ,ethhdr->dest.addr[5]
+ );
+ pbuf_free(p);
+ p = NULL;
+ break;
+ }
+ }
if (netif->input(p, netif) != ERR_OK){
......
pbuf_free(p);
p = NULL;
}
break;
......
return 1;
}