/** * \brief Update MPU regions. * * \return Unused (ANSI-C compatibility). */ void MPU_UpdateRegions( uint32_t dwRegionNum, uint32_t dwRegionBaseAddr, uint32_t dwRegionAttr) { /* Raise privilege, the MPU register could be set only in privilege mode */ asm volatile(" swi 0x00 "); while (!dwRaisePriDone); dwRaisePriDone = 0; /* Disable interrupt */ __disable_irq(); /* Clean up data and instruction buffer */ __DSB(); __ISB(); /* Set active region */ MPU_SetRegionNum(dwRegionNum); /* Disable region */ MPU_DisableRegion(); /* Update region attribute */ MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr); /* Clean up data and instruction buffer to make the new region taking effect at once */ __DSB(); __ISB(); /* Enable the interrupt */ __enable_irq(); /* Reset to thread mode */ __set_CONTROL(USER_MODE); }
/** * \brief Update MPU regions. * * \return Unused (ANSI-C compatibility). */ void MPU_UpdateRegions(uint32_t dwRegionNum, uint32_t dwRegionBaseAddr, uint32_t dwRegionAttr) { /* Disable interrupt */ __disable_irq(); /* Clean up data and instruction buffer */ __DSB(); __ISB(); /* Set active region */ MPU_SetRegionNum(dwRegionNum); /* Disable region */ MPU_DisableRegion(); /* Update region attribute */ MPU_SetRegion(dwRegionBaseAddr, dwRegionAttr); /* Clean up data and instruction buffer to make the new region taking effect at once */ __DSB(); __ISB(); /* Enable the interrupt */ __enable_irq(); }