This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

call function from a ISR

Hello,

At the moment, I'm working with the ethernet MAC interface and I'm now able to get a interrupt, when I receive a new frame from the PHY. But I'm not totally sure, how I have to configure the ISR.

void Emac_interrupt(void) __irq
{
        unsigned int status;
        AT91PS_EMAC pEmac = AT91C_BASE_EMAC;


        //MAC interrupt status register indicates what interrupts are pending
        //automatically cleared once read
        status = pEmac->EMAC_ISR;


        if (status & AT91C_EMAC_RCOM)               /* Receive complete */
        {
                printf("RCOM\n");
                receive_frame();                                /* function */

        }
        // clear statistics
        pEmac->EMAC_CTL = 0x1 << 5;
        AT91C_BASE_AIC->AIC_EOICR = 0;
}

I want to use this ISR to figure out which interrupt of the MAC occured - e.g. receive complete, transmit complete and so on... after that I call the next function (e.g. receive_frame()) where I find out which protocol is received (arp or ip).... everthing ok, but I don't know where I have to close the ISR, so that I'm able to receive another interrupt... I want to close the ISR and open the next function (e.g. receive_frame() at the same time... is that possible? Or what is the best way to do that?

Is it a good solution, to say:

if (status & AT91C_EMAC_RCOM)          /* Receive complete */
        {
                printf("RCOM\n");
                return (receive_frame());                               /* function */

Or is that not possible?

best regards
Bernd

0