Example #1
0
/****************************************************************************
 * Function:        TcpIpEthIsr
 *
 * PreCondition:    TCPIPInit, PIC32MACEventSetNotifyEvents should have been called.
 *
 * Input:           p - PIC32 MAC descriptor pointer
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        This function processes the Ethernet interrupts and reports the events back to the user.
 *
 * Note:            None
 ******************************************************************************/
static void TcpIpEthIsr(void* p)
{
    eEthEvents          currEthEvents, currGroupEvents;
    PIC32_EV_GROUP_DCPT* pDcpt;
    int                 grpIx;
    PIC32_EMB_MAC_DCPT* pMacD = (PIC32_EMB_MAC_DCPT*)p;

    currEthEvents = EthEventsGet();

    // process per group
    pDcpt = pMacD->mData._pic32_ev_group_dcpt;
    for(grpIx = 0; grpIx < sizeof(pMacD->mData._pic32_ev_group_dcpt)/sizeof(*pMacD->mData._pic32_ev_group_dcpt); grpIx++)
    {
        currGroupEvents = currEthEvents & pDcpt->_EthEnabledEvents;     //  keep just the relevant ones
        if(currGroupEvents)
        {
            pDcpt->_EthPendingEvents |= currGroupEvents;                    // add the new events
            pDcpt->_TcpPendingEvents |= _XtlEventsEth2Tcp(currGroupEvents);

            EthEventsEnableClr(currGroupEvents);         // these will get reported; disable them until ack is received back
            EthEventsClr(currGroupEvents);               // acknowledge the ETHC
            if(pDcpt->_TcpNotifyFnc)
            {
                (*pDcpt->_TcpNotifyFnc)(pDcpt->_TcpNotifyParam, pDcpt->_TcpPendingEvents);     // let the user know
            }
        }
        pDcpt++;
    }



    SYS_INT_SourceStatusClear(pMacD->mData._macIntSrc);         // acknowledge the int Controller
}
/****************************************************************************
 * Function:        _TcpIpEthIsr
 *
 * PreCondition:    TCPIPInit, TCPIPEventSetNotifyEvents should have been called.
 *
 * Input:           None
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        This function processes the Ethernet interrupts and reports the events back to the user.
 *
 * Note:            None
 ******************************************************************************/
void __attribute__((vector(_ETH_VECTOR), interrupt, nomips16, weak)) _TcpIpEthIsr(void)
{
	eEthEvents	currEvents;

	currEvents=EthEventsGet()&_TcpEnabledEvents;	// keep just those that are relevant
	_TcpPendingEvents|=currEvents;			// add the new events

	EthEventsEnableClr(currEvents);			// these will get reported; disable them until ack is received back
	
	EthEventsClr(currEvents);			// acknowledge the ETHC

	if(_TcpNotifyFnc)
	{
		(*_TcpNotifyFnc)(_XtlEventsEth2Tcp(_TcpPendingEvents));		// let the user know
	}

	INTClearFlag(INT_ETHERNET);			// acknowledge the INTC
}