NVIC management (porting from Codewarrior)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NVIC management (porting from Codewarrior)

867 Views
rosigna
Contributor I

Hello,

 

I'm porting a project for KL26Z128 from Codewarrior to MCUxpresso IDE. The old project was not created by me, so I was not concerned about some choices made about low level configuration.

Now I'm trying to port the following instructions:

 tInterruptStatus = NVIC_ISER;
NVIC_ICER = 0xFFFFFFFF;


[some instructions here]

while(NVIC_ISER != tInterruptStatus)
{
  NVIC_ISER = tInterruptStatus;
}


I guess that code executed in [some instructions here] must be executed being sure that no interrupt occurs.

I only found in core_cm0plus.h (and fsl_common.h) utilities to enable/disable one interrupt (IRQ and/or "pending" IRQ at a time), there is no intermediate utility to access directly the whole NVIC_ISER/NVIC_ICER register.

Could I introduce an utility to reproduce the same behaviour from my original source code or I have to proceed one interrupt at a time using the disableIrq/enableIrq available functions?

Or do you have any different advice to manage this?

Thank you very much! 

0 Kudos
Reply
2 Replies

857 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello

 

The available functions to disable the interruptions are: DisableIRQ() and DisableGlobalIRQ().

 

In DisableGlobalIRQ() all the interruptions are disabled while in DisableIRQ() you need to specify which interruption you want to disable.

Out of this functions there are any other function available, for you purpose I think that DisableIRQ() is a good option.

 

Let me know if this is helpful, if you have more questions do not hesitate to ask me.

Best regards,

Omar

0 Kudos
Reply

829 Views
rosigna
Contributor I

Hello,

 

Thank you. Your advice confirms my understanding, so I will do as you suggest.

I guess that I could introduce a local bitmask to control which interrupt are enabled/disabled time by time, in order to have a local copy of the low level mask.

Could this be a good compromise between old and new source code?

 

Thank you!

 Rosa

0 Kudos
Reply