5.35 Configuring individual IRQs

Each IRQ has an individual enable bit in the Interrupt Set Enable Registers, part of the NVIC registers. To enable or disable an IRQ, you must set the corresponding enable bit to either 1 or 0 respectively.

See the reference manual for the device you are using for specific information about the Interrupt Set Enable Register.

The following example shows a typical function that enables an IRQ for an SCS structure.

IRQ Enable Function

void NVIC_enableISR(unsigned isr)
{
    /* The isr argument is the number of the interrupt to enable. */
    SCS.NVIC.Enable[ (isr/32) ] = 1<<(isr % 32);
}

Note:

Some registers in the NVIC region can only be accessed from Privileged mode.

You can assign a priority level to each individual interrupt using the Interrupt Priority Registers apart from Hard Fault, Non Maskable Interrupt (NMI), and reset which have fixed priorities.

Non-ConfidentialPDF file icon PDF versionARM DUI0471M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.