IRQ enable/disable

u-boot source code is very interesting, take a look on the datasheet and see how to enable/disable interrupt during boostrap:

/* enable IRQ interrupts */
void enable_interrupts(void)
{
        unsigned long temp;
        __asm__ __volatile__("mrs %0, cpsr\n" "bic %0, %0, #0x80\n" "msr cpsr_c, %0":"=r"(temp)
                             ::"memory");
}

/** disable IRQ/FIQ interrupts 
 * returns true if interrupts had been enabled before we disabled them */
int disable_interrupts(void)
{
        unsigned long old, temp;
        __asm__ __volatile__("mrs %0, cpsr\n"
                             "orr %1, %0, #0xc0\n" "msr cpsr_c, %1":"=r"(old), "=r"(temp)
                             ::"memory");
        return (old & 0x80) == 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s