Modifying the BASEPRI core register

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I'm trying to mask out / disable all interrupts at certain levels. I believe that the core register called BASEPRI is made for this. However, I have seen two different versions of ASM code to modify the register, but none of them works. The function __set_basepri() exists, but how do I include it? I have tried to copy the code, but that doesn't work.

 

Does anyone have a working BASEPRI modifying ASM code?

 

Running on SAM L10, but this should not be a big deal.

 

Thanks, Mike

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It should be part of the ARM core CMSIS definitions.   Um.   My install seems to have capitalization complications.  In CMSIS/4.5.0/CMSIS/Include/cmsis_armcc.h there is:

 

/**
  \brief   Set Base Priority
  \details Assigns the given value to the Base Priority register.
  \param [in]    basePri  Base Priority value to set
 */
__STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
{
  register uint32_t __regBasePri         __ASM("basepri");
  __regBasePri = (basePri & 0xFFU);
}

The (ARM) Archiecture reference manual says "Software can access these registers using the MRS and MSR instructions"  (that's for ARMv7m, and I think the L10 is an ARMv8?)