/* This function is used to get the number of regions that are supported by the MPU. This is the total number that are supported, including regions that are already programmed. */
unsigned long MPURegionCountGet(void)
/* This function is used to get the number of regions that are supported by the MPU. This is the total number that are supported, including regions that are already programmed. */
unsigned long MPURegionCountGet(void)
{
    return((HWREG(NVIC_MPU_TYPE) & NVIC_MPU_TYPE_DREGION_M)
            >> NVIC_MPU_TYPE_DREGION_S);
}