pang jiyao

Bug in MCF54452 FEC broadcast reject function?

Discussion created by pang jiyao on Apr 3, 2012
Latest reply on Apr 3, 2012 by TomE

Hello everyone,the following is my problem during MCF54452 FEC:

 

I need to reject broadcast frame accord to the flux of broadcast to avoid broadcast storm.So, I enable fec accept broadcast in one millisecond and reject in next milliseond.At the same time,I  test fec with PING request  and UDP broadcast packet, soon later fec stop and never trigger RXF interrupt and also MIB conunter stop,I read the MCF54452 manual carefully,no register can flag the fec stop.How can I monitor the activity of FEC  and restart FEC ? My sample code as follows:

 

/********************************************************************/

 unsigned long nld_rx_count=0;
int slt0_interrupt_handler (void* arg1, void* arg2) //slt0 trigger interrupt every one millisecond
{
 (void)arg1;(void)arg2; 
    MCF_PIT_PCSR(0)|=MCF_PIT_PCSR_PIF; 
        int mResult=0;  
    
    static unsigned bkt_enable=0;///////////for test

 nld_rx_count=MCF_FEC_RMON_R_OCTETS(0);  //accept broadcast frame
 if(bkt_enable)
 {
   bkt_enable=0;
   MCF_FEC_RCR(0)&=~MCF_FEC_RCR_BC_REJ; //reject broadcast frame
    
 }
 else
 {
   bkt_enable=1;
  
   MCF_FEC_RCR(0)|=MCF_FEC_RCR_BC_REJ;
  }

    return mResult;   
}

 /********************************************************************/

////interrupt handler for FEC isr

int nld_fec_isr(void* arg1,void* arg2)
{
 (void)arg1;(void)arg2;
  unsigned char ch; 
  unsigned long mEvent;

 
  NLD_FEC_DEV_PTR uptr=(NLD_FEC_DEV_PTR)arg1; //retrieve fec from arg1
   ch=(unsigned char)uptr->tag;//we use ch to select fec module,0-fec0 1-fec1
    mEvent=MCF_FEC_EIR(ch);
    ///////
    MCF_FEC_EIR(ch)=mEvent;
    if(mEvent&MCF_FEC_EIR_RXF)   
    {
        uptr->fec_statics.rxf_ints++;
        //we check for data receive 
        nld_fec_rcv(uptr); 
    }

}

Outcomes