This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How ISR interrupt mask value works

Other Parts Discussed in Thread: C2000WARE

looking at the function "F2837xD_SWPrioritizedIsrLevels.h"  ; i have couple questions about  the below code:

#if (INT1PL == 0)
#define MINT1_1PL ~(1 << 0);                                      // MZ: a<<b for integers means "shift left". The bitwise representation of a is shifted left b bits. This is the same as multiplying by (2 to the power of b),                                                                                                                       //   MINT1_1PL=1*2^0=1.
#else
#define MINT1_1PL 0xFFFF
#endif

#if (INT2PL >= INT1PL) || (INT2PL == 0)                      //MZ: if the global interrupt2 priority is greater or equal to global interrupt1 priority or it is equal zero.
#define MINT1_2PL ~(1 << 1)                                      //MZ: the mask of global interrupt #1 its group number 2 interrupt priority level is equal to 2^1; MINT1_2PL = 2
#else
#define MINT1_2PL 0xFFFF
#endif

#if (INT3PL >= INT1PL) || (INT3PL == 0)
#define MINT1_3PL ~(1 << 2)                                            //MZ: the mask of global interrupt #1 its group number 3 interrupt priority level is equal to 2^2; MINT1_3PL = 4
#else
#define MINT1_3PL 0xFFFF

 Questions:

1) what is the purpose of the above code? 

2) is all what we doing in the above code is we are assigning a priority level to an interrupt? in this case we should not list MINTx PL but we should list INTxPL instead.

3) if the goal is to create a mask values that can be used by the CPU within an ISR to allow CPU to interrupt current ISR and service the new higher priority ISR, then why all have the same values; 0xFFFF

Thankyou

  • Hi,

    1. The macros MINT1_1PL to MINT1_16PL are used to create the macro MINT1 in which the bits corresponding to all interrupts which are either disabled or has lower priority than INT1 is set as 0. It is used in the ISR to disable such interrupts and allow nesting for higher priority interrupts

    You may refer to the interrupt prioritization example available in C2000ware driverlib and check the actual values of these macros for better understanding.

    2. Assigning the priorities is done as part of sw_prioritized_isr_levels.h file, where the macros INTxPL and Gx_yPL are configured with the required priorities. The macros you listed here are part of sw_interrupt_prioritization_logic.h which should NOT be updated by the user. As mentioned in 1, this is used to create the macros that can be used in the ISR code, based on the priorities configured by the user

    3. These macros MINT1_1PL to MINT1_16PL sets the individual bits ( eg: for bit 0, it would be FFFF or FFFE and so on) and later is combined using & operator

    One correction in your post :

    #define MINT1_1PL ~(1 << 0);                                      // MZ: a<<b for integers means "shift left". The bitwise representation of a is shifted left b bits. This is the same as multiplying by (2 to the power of b),                                                                                                                       //   MINT1_1PL=1*2^0=1.

    MINT1_1PL would be ~(1) = 0xFFFE

    Regards,

    Veena