mpu_pal.c
Go to the documentation of this file.
1 /*
2  * Copyright 2017-2018 NXP
3  * All rights reserved.
4  *
5  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
6  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
7  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
8  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
9  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
10  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
11  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
12  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
13  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
14  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
15  * THE POSSIBILITY OF SUCH DAMAGE.
16  */
17 
53 #include "mpu_pal.h"
54 #include <stddef.h>
55 
56 /*******************************************************************************
57  * Privates
58  ******************************************************************************/
59 #if defined(MPU_OVER_MPU)
60 /*FUNCTION**********************************************************************
61  *
62  * Function Name : MPU_ConvertMpuErrorConfig
63  * Description : Converts MPU error structure.
64  *
65  *END**************************************************************************/
66 static void MPU_ConvertMpuErrorConfig(const mpu_access_err_info_t * mpuErrPtr,
67  mpu_error_info_t * errResult)
68 {
69  /* Converts error information */
70  errResult->master = mpuErrPtr->master;
71  errResult->overrun = false;
72  errResult->attributes = (mpu_error_attributes_t)mpuErrPtr->attributes;
73  errResult->accessType = (mpu_error_access_type_t)mpuErrPtr->accessType;
74  errResult->accessCtr = mpuErrPtr->accessCtr;
75  errResult->addr = mpuErrPtr->addr;
76 #if FEATURE_MPU_HAS_PROCESS_IDENTIFIER
77  errResult->processId = mpuErrPtr->processorIdentification;
78 #endif /* FEATURE_MPU_HAS_PROCESS_IDENTIFIER */
79 }
80 
81 /*FUNCTION**********************************************************************
82  *
83  * Function Name : MPU_ConvertMpuMasterStruct
84  * Description : Converts MPU region structure.
85  *
86  *END**************************************************************************/
87 static void MPU_ConvertMpuRegionConfig(const mpu_region_config_t * regionConfig,
88  mpu_master_access_right_t * masterAccessRight,
89  mpu_user_config_t * configResult)
90 {
91  uint8_t masterIdx = 0U;
92  mpu_master_access_permission_t masterPrivilegeRight;
93 
94  /* Allocates region address */
95  configResult->startAddr = regionConfig->startAddr;
96  configResult->endAddr = regionConfig->endAddr;
97 
98  /* Allocates access rights for all masters */
99  for (masterIdx = 0U; masterIdx < FEATURE_MPU_MASTER_COUNT; masterIdx++)
100  {
101  masterPrivilegeRight = regionConfig->masterAccRight[masterIdx];
102 
103  /* Allocates master number */
104  masterAccessRight[masterIdx].masterNum = masterPrivilegeRight.masterNum;
105  /* Allocates access rights */
106  masterAccessRight[masterIdx].accessRight = (mpu_access_rights_t)masterPrivilegeRight.accessRight;
108  /* Allocates process identifier */
109  masterAccessRight[masterIdx].processIdentifierEnable = ((regionConfig->processIdEnable
110  & (1UL << masterPrivilegeRight.masterNum))
111  != 0U);
112  #endif /* FEATURE_MPU_HAS_PROCESS_IDENTIFIER */
113  }
114 
115  /* Allocates master configuration in region */
116  configResult->masterAccRight = masterAccessRight;
117 
118 #if FEATURE_MPU_HAS_PROCESS_IDENTIFIER
119  /* Allocates process identifier */
120  configResult->processIdentifier = regionConfig->processIdentifier;
121  configResult->processIdMask = regionConfig->processIdMask;
122 #endif /* FEATURE_MPU_HAS_PROCESS_IDENTIFIER */
123 }
124 #elif defined(MPU_OVER_SMPU)
125 /*FUNCTION**********************************************************************
126  *
127  * Function Name : MPU_ConvertSmpuErrorConfig
128  * Description : Converts SMPU error structure.
129  *
130  *END**************************************************************************/
131 static void MPU_ConvertSmpuErrorConfig(const smpu_access_err_info_t * smpuErrPtr,
132  mpu_error_info_t * errResult)
133 {
134  /* Converts error information */
135  errResult->master = smpuErrPtr->master;
136  errResult->overrun = smpuErrPtr->Overrun;
137  errResult->attributes = (mpu_error_attributes_t)smpuErrPtr->attributes;
138  errResult->accessType = (mpu_error_access_type_t)smpuErrPtr->accessType;
139  errResult->accessCtr = smpuErrPtr->accessCtr;
140  errResult->addr = smpuErrPtr->addr;
141 #if FEATURE_SMPU_HAS_PROCESS_IDENTIFIER
142  errResult->processId = smpuErrPtr->processorIdentification;
143 #endif /* FEATURE_SMPU_HAS_PROCESS_IDENTIFIER */
144 }
145 
146 /*FUNCTION**********************************************************************
147  *
148  * Function Name : MPU_ConvertSmpuRegionConfig
149  * Description : Converts SMPU region structure.
150  *
151  *END**************************************************************************/
152 static void MPU_ConvertSmpuRegionConfig(const mpu_region_config_t * regionConfig,
153  smpu_master_access_right_t * masterAccessRight,
154  smpu_user_config_t * configResult)
155 {
156  uint8_t masterIdx = 0U;
157  mpu_master_access_permission_t masterPrivilegeRight;
158 
159  /* Allocates region address */
160  configResult->startAddr = regionConfig->startAddr;
161  configResult->endAddr = regionConfig->endAddr;
162 
163  /* Allocates access rights for masters */
164  for (masterIdx = 0U; masterIdx < FEATURE_SMPU_MASTER_COUNT; masterIdx++)
165  {
166  masterPrivilegeRight = regionConfig->masterAccRight[masterIdx];
167 
168  /* Allocates master number */
169  masterAccessRight[masterIdx].masterNum = masterPrivilegeRight.masterNum;
170  /* Allocates access rights */
171  masterAccessRight[masterIdx].accessRight = (smpu_access_rights_t)masterPrivilegeRight.accessRight;
172  }
173 
174  /* Allocates master configuration in region */
175  configResult->masterAccRight = masterAccessRight;
176 
177 #if FEATURE_SMPU_HAS_PROCESS_IDENTIFIER
178  /* Allocates process identifier */
179  configResult->processIdEnable = (regionConfig->processIdEnable != 0U);
180  configResult->processIdentifier = regionConfig->processIdentifier;
181  configResult->processIdMask = regionConfig->processIdMask;
182 #endif /* FEATURE_SMPU_HAS_PROCESS_IDENTIFIER */
183 
184  if (regionConfig->extension != NULL)
185  {
186  #if (FEATURE_SMPU_HAS_SPECIFIC_ACCESS_RIGHT_COUNT != 0U)
187  configResult->specAccessEnable = ((mpu_extension_smpu_region_t *)regionConfig->extension)->specAccessEnable;
188  configResult->specAccessSet = (smpu_specific_access_rights_t *)((mpu_extension_smpu_region_t *)regionConfig->extension)->specAccessSet;
189  #endif
190  configResult->cacheInhibitEnable = ((mpu_extension_smpu_region_t *)regionConfig->extension)->cacheInhibitEnable;
191  configResult->lockConfig = (smpu_lock_t)((mpu_extension_smpu_region_t *)regionConfig->extension)->lockConfig;
192  }
193  else
194  {
195  #if (FEATURE_SMPU_HAS_SPECIFIC_ACCESS_RIGHT_COUNT != 0U)
196  configResult->specAccessEnable = false;
197  configResult->specAccessSet = NULL;
198  #endif
199  configResult->cacheInhibitEnable = true;
200  configResult->lockConfig = SMPU_UNLOCK;
201  }
202 }
203 #endif /* defined(MPU_OVER_MPU) & defined(MPU_OVER_SMPU) */
204 
205 /*******************************************************************************
206  * Code
207  ******************************************************************************/
208 /*FUNCTION**********************************************************************
209  *
210  * Function Name : MPU_Init
211  * Description : Initializes memory protection unit by allocating regions
212  * and granting access rights for masters.
213  *
214  * Implements : MPU_Init_Activity
215  *END**************************************************************************/
216 status_t MPU_Init(const mpu_instance_t * const instance,
217  uint8_t regionCnt,
218  const mpu_region_config_t * configPtr)
219 {
220  DEV_ASSERT(instance != NULL);
221  DEV_ASSERT(configPtr != NULL);
222  DEV_ASSERT(regionCnt > 0U);
223 
224  status_t status = STATUS_UNSUPPORTED;
225  uint8_t regionIdx = 0U;
226 
227 #if defined(MPU_OVER_MPU)
228  if (instance->instType == MPU_INST_TYPE_MPU)
229  {
230  DEV_ASSERT(regionCnt <= MPU_RGD_COUNT);
231 
232  mpu_user_config_t mpuConfig[MPU_RGD_COUNT];
234 
235  /* Allocates all region configuration */
236  for (regionIdx = 0U; regionIdx < regionCnt; regionIdx++)
237  {
238  MPU_ConvertMpuRegionConfig(&configPtr[regionIdx],
239  &mpuMasterConfig[regionIdx * FEATURE_MPU_MASTER_COUNT],
240  &mpuConfig[regionIdx]);
241  }
242  /* Initializes MPU module */
243  status = MPU_DRV_Init(instance->instIdx, regionCnt, mpuConfig);
244  }
245 #endif /* defined(MPU_OVER_MPU) */
246 
247 #if defined(MPU_OVER_SMPU)
248  if (instance->instType == MPU_INST_TYPE_SMPU)
249  {
250  DEV_ASSERT(regionCnt <= SMPU_RGD_COUNT);
251 
252  smpu_user_config_t smpuConfig[SMPU_RGD_COUNT];
253  smpu_master_access_right_t smpuMasterConfig[SMPU_RGD_COUNT * FEATURE_SMPU_MASTER_COUNT];
254 
255  /* Allocates all region configuration */
256  for (regionIdx = 0U; regionIdx < regionCnt; regionIdx++)
257  {
258  MPU_ConvertSmpuRegionConfig(&configPtr[regionIdx],
259  &smpuMasterConfig[regionIdx * FEATURE_SMPU_MASTER_COUNT],
260  &smpuConfig[regionIdx]);
261  }
262  /* Initializes SMPU module */
263  status = SMPU_DRV_Init(instance->instIdx, regionCnt, smpuConfig);
264  }
265 #endif /* defined(MPU_OVER_SMPU) */
266 
267  (void)regionIdx;
268  return status;
269 }
270 
271 /*FUNCTION**********************************************************************
272  *
273  * Function Name : MPU_Deinit
274  * Description : De-initializes memory protection unit by reseting all regions
275  * and masters to default and disable module.
276  *
277  * Implements : MPU_Deinit_Activity
278  *END**************************************************************************/
279 status_t MPU_Deinit(const mpu_instance_t * const instance)
280 {
281  DEV_ASSERT(instance != NULL);
282 
283  status_t status = STATUS_UNSUPPORTED;
284 
285 #if defined(MPU_OVER_MPU)
286  if (instance->instType == MPU_INST_TYPE_MPU)
287  {
288  /* De-initializes MPU module */
289  MPU_DRV_Deinit(instance->instIdx);
290  status = STATUS_SUCCESS;
291  }
292 #endif /* defined(MPU_OVER_MPU) */
293 
294 #if defined(MPU_OVER_SMPU)
295  if (instance->instType == MPU_INST_TYPE_SMPU)
296  {
297  /* De-initializes SMPU module */
298  status = SMPU_DRV_Deinit(instance->instIdx);
299  }
300 #endif /* defined(MPU_OVER_SMPU) */
301 
302  return status;
303 }
304 
305 /*FUNCTION**********************************************************************
306  *
307  * Function Name : MPU_GetDefautRegionConfig
308  * Description : Gets default region configuration. Grants all access rights for masters;
309  * disable PID and cache inhibit; unlock region descriptor.
310  * Please note that the length of master array should be defined by number of masters supported by hardware.
311  *
312  * Implements : MPU_GetDefautRegionConfig_Activity
313  *END**************************************************************************/
315  mpu_master_access_permission_t * masterAccRight,
316  mpu_region_config_t * regionConfig)
317 {
318  DEV_ASSERT(masterAccRight != NULL);
319  DEV_ASSERT(regionConfig != NULL);
320 
321  status_t status = STATUS_UNSUPPORTED;
322  uint8_t masterIdx = 0U;
323 
324 #if defined(MPU_OVER_MPU)
325  if (instance->instType == MPU_INST_TYPE_MPU)
326  {
327  uint8_t mpuMasterNum[FEATURE_MPU_MASTER_COUNT] = FEATURE_MPU_MASTER;
328 
329  /* Gets default access rights for all masters */
330  for (masterIdx = 0U; masterIdx < FEATURE_MPU_MASTER_COUNT; masterIdx++)
331  {
332  masterAccRight[masterIdx].masterNum = mpuMasterNum[masterIdx];
333  if (mpuMasterNum[masterIdx] <= FEATURE_MPU_MAX_LOW_MASTER_NUMBER)
334  {
335  masterAccRight[masterIdx].accessRight = MPU_SUPERVISOR_RWX_USER_RWX;
336  }
337  else
338  {
339  masterAccRight[masterIdx].accessRight = MPU_RW;
340  }
341  }
342 
343  status = STATUS_SUCCESS;
344  }
345 #endif /* defined(MPU_OVER_MPU) */
346 
347 #if defined(MPU_OVER_SMPU)
348  if (instance->instType == MPU_INST_TYPE_SMPU)
349  {
350  uint8_t smpuMasterNum[FEATURE_SMPU_MASTER_COUNT] = FEATURE_SMPU_MASTER;
351 
352  /* Gets default access rights for all masters */
353  for (masterIdx = 0U; masterIdx < FEATURE_SMPU_MASTER_COUNT; masterIdx++)
354  {
355  masterAccRight[masterIdx].masterNum = smpuMasterNum[masterIdx];
356  masterAccRight[masterIdx].accessRight = MPU_RW_OR_SET_3;
357  }
358 
359  status = STATUS_SUCCESS;
360  }
361 #endif /* defined(MPU_OVER_SMPU) */
362 
363  /* Gets default region configuration */
364  regionConfig->startAddr = 0U;
365  regionConfig->endAddr = 0xFFFFFFFFU;
366  regionConfig->masterAccRight = masterAccRight;
367  regionConfig->processIdEnable = 0U;
368  regionConfig->processIdentifier = 0U;
369  regionConfig->processIdMask = 0U;
370  regionConfig->extension = NULL;
371 
372  (void)masterIdx;
373  return status;
374 }
375 
376 /*FUNCTION**********************************************************************
377  *
378  * Function Name : MPU_UpdateRegion
379  * Description : Updates region configuration.
380  *
381  * Implements : MPU_UpdateRegion_Activity
382  *END**************************************************************************/
383 status_t MPU_UpdateRegion(const mpu_instance_t * const instance,
384  uint8_t regionNum,
385  const mpu_region_config_t * configPtr)
386 {
387  DEV_ASSERT(instance != NULL);
388  DEV_ASSERT(configPtr != NULL);
389 
390  status_t status = STATUS_UNSUPPORTED;
391 
392 #if defined(MPU_OVER_MPU)
393  if (instance->instType == MPU_INST_TYPE_MPU)
394  {
395  mpu_user_config_t mpuConfig;
397 
398  /* Allocates region configuration */
399  MPU_ConvertMpuRegionConfig(configPtr, mpuMasterConfig, &mpuConfig);
400  /* Updates region configuration */
401  status = MPU_DRV_SetRegionConfig(instance->instIdx, regionNum, &mpuConfig);
402  }
403 #endif /* defined(MPU_OVER_MPU) */
404 
405 #if defined(MPU_OVER_SMPU)
406  if (instance->instType == MPU_INST_TYPE_SMPU)
407  {
408  smpu_user_config_t smpuConfig;
409  smpu_master_access_right_t smpuMasterConfig[FEATURE_SMPU_MASTER_COUNT];
410 
411  /* Allocates region configuration */
412  MPU_ConvertSmpuRegionConfig(configPtr, smpuMasterConfig, &smpuConfig);
413  /* Updates region configuration */
414  status = SMPU_DRV_SetRegionConfig(instance->instIdx, regionNum, &smpuConfig);
415  }
416 #endif /* defined(MPU_OVER_SMPU) */
417 
418  return status;
419 }
420 
421 /*FUNCTION**********************************************************************
422  *
423  * Function Name : MPU_EnableRegion
424  * Description : Enables or disables an exist region configuration.
425  *
426  * Implements : MPU_EnableRegion_Activity
427  *END**************************************************************************/
428 status_t MPU_EnableRegion(const mpu_instance_t * const instance,
429  uint8_t regionNum,
430  bool enable)
431 {
432  DEV_ASSERT(instance != NULL);
433 
434  status_t status = STATUS_UNSUPPORTED;
435 
436 #if defined(MPU_OVER_MPU)
437  if (instance->instType == MPU_INST_TYPE_MPU)
438  {
439  /* Enables region */
440  MPU_DRV_EnableRegion(instance->instIdx, regionNum, enable);
441  status = STATUS_SUCCESS;
442  }
443 
444 #endif /* defined(MPU_OVER_MPU) */
445 
446 #if defined(MPU_OVER_SMPU)
447  if (instance->instType == MPU_INST_TYPE_SMPU)
448  {
449  /* Enables region */
450  status = SMPU_DRV_EnableRegion(instance->instIdx, regionNum, enable);
451  }
452 #endif /* defined(MPU_OVER_SMPU) */
453 
454  return status;
455 }
456 
457 /*FUNCTION**********************************************************************
458  *
459  * Function Name : MPU_GetError
460  * Description : Checks and gets the access error detail information
461  * then clear error flag if the error caused by a master.
462  *
463  * Implements : MPU_GetError_Activity
464  *END**************************************************************************/
465 bool MPU_GetError(const mpu_instance_t * const instance,
466  uint8_t channel,
467  mpu_error_info_t * errPtr)
468 {
469  DEV_ASSERT(instance != NULL);
470  DEV_ASSERT(errPtr != NULL);
471 
472  bool status = false;
473 
474 #if defined(MPU_OVER_MPU)
475  if (instance->instType == MPU_INST_TYPE_MPU)
476  {
477  mpu_access_err_info_t mpuErrPtr;
478 
479  /* Gets detail error information */
480  status = MPU_DRV_GetDetailErrorAccessInfo(instance->instIdx, channel, &mpuErrPtr);
481 
482  if (status)
483  {
484  MPU_ConvertMpuErrorConfig(&mpuErrPtr, errPtr);
485  }
486  }
487 #endif /* defined(MPU_OVER_MPU) */
488 
489 #if defined(MPU_OVER_SMPU)
490  if (instance->instType == MPU_INST_TYPE_SMPU)
491  {
492  smpu_access_err_info_t smpuErrPtr;
493 
494  /* Gets detail error information */
495  status = SMPU_DRV_GetDetailErrorInfo(instance->instIdx, channel, &smpuErrPtr);
496 
497  if (status)
498  {
499  MPU_ConvertSmpuErrorConfig(&smpuErrPtr, errPtr);
500  }
501  }
502 #endif /* defined(MPU_OVER_SMPU) */
503 
504  return status;
505 }
506 
507 #if defined(MPU_OVER_SMPU)
508 /*FUNCTION**********************************************************************
509  *
510  * Function Name : MPU_UpdateRegionLock
511  * Description : Updates lock configuration on a region.
512  *
513  * Implements : MPU_UpdateRegionLock_Activity
514  *END**************************************************************************/
515 status_t MPU_UpdateRegionLock(const mpu_instance_t * const instance,
516  uint8_t regionNum,
517  mpu_lock_t lockConfig)
518 {
519  DEV_ASSERT(instance != NULL);
520 
521  status_t status = STATUS_UNSUPPORTED;
522 
523  if (instance->instType == MPU_INST_TYPE_SMPU)
524  {
525  /* Sets region lock configuration */
526  status = SMPU_DRV_SetRegionLockConfig(instance->instIdx, regionNum, (smpu_lock_t)lockConfig);
527  }
528 
529  return status;
530 }
531 
532 /*FUNCTION**********************************************************************
533  *
534  * Function Name : MPU_GetRegionLockInfo
535  * Description : Reports lock status on a region.
536  *
537  * Implements : MPU_GetRegionLockInfo_Activity
538  *END**************************************************************************/
539 status_t MPU_GetRegionLockInfo(const mpu_instance_t * const instance,
540  uint8_t regionNum,
541  mpu_region_lock_t * regionLock)
542 {
543  DEV_ASSERT(instance != NULL);
544  DEV_ASSERT(regionLock != NULL);
545 
546  status_t status = STATUS_UNSUPPORTED;
547 
548  if (instance->instType == MPU_INST_TYPE_SMPU)
549  {
550  smpu_region_lock_t smpuRegionLock;
551 
552  /* Gets region lock status */
553  smpuRegionLock = SMPU_DRV_GetRegionLockInfo(instance->instIdx, regionNum);
554 
555  /* Converts to MPU region lock status structure */
556  regionLock->regionNum = smpuRegionLock.regionNum;
557  #if FEATURE_SMPU_HAS_OWNER_LOCK
558  regionLock->masterOwner = smpuRegionLock.masterOwner;
559  #endif /* FEATURE_SMPU_HAS_OWNER_LOCK */
560  regionLock->lockConfig = (mpu_lock_t)smpuRegionLock.lockConfig;
561 
562  status = STATUS_SUCCESS;
563  }
564 
565  return status;
566 
567 }
568 #endif /* defined(MPU_OVER_SMPU) */
569 
570 /*******************************************************************************
571  * EOF
572  ******************************************************************************/
uint8_t processIdentifier
Definition: mpu_pal.h:162
MPU master access rights. Implements : mpu_master_access_right_t_Class.
Definition: mpu_driver.h:176
uint32_t endAddr
Definition: mpu_pal.h:157
MPU master access permission. Implements : mpu_master_access_permission_t_Class.
Definition: mpu_pal.h:144
uint8_t processIdMask
Definition: mpu_driver.h:197
Structure storing PAL instance information.
const mpu_master_access_right_t * masterAccRight
Definition: mpu_driver.h:194
uint8_t processIdEnable
Definition: mpu_pal.h:159
mpu_access_permission_t accessRight
Definition: mpu_pal.h:147
void MPU_DRV_Deinit(uint32_t instance)
De-initializes the MPU region by resetting and disabling MPU module.
Definition: mpu_driver.c:105
uint32_t startAddr
Definition: mpu_driver.h:192
uint32_t addr
Definition: mpu_pal.h:77
mpu_inst_type_t instType
uint32_t endAddr
Definition: mpu_driver.h:193
mpu_err_access_type_t accessType
Definition: mpu_driver.h:70
status_t MPU_Init(const mpu_instance_t *const instance, uint8_t regionCnt, const mpu_region_config_t *configPtr)
Initializes memory protection unit by allocating regions and granting access rights for masters...
Definition: mpu_pal.c:216
bool MPU_DRV_GetDetailErrorAccessInfo(uint32_t instance, uint8_t slavePortNum, mpu_access_err_info_t *errInfoPtr)
Checks and gets the MPU access error detail information for a slave port.
Definition: mpu_driver.c:254
status_t MPU_Deinit(const mpu_instance_t *const instance)
De-initializes memory protection unit by reseting all regions and masters to default and disable modu...
Definition: mpu_pal.c:279
mpu_access_rights_t
MPU access rights. Code Supervisor User Description MPU_SUPERVISOR_RWX_USER_NONE r w x - - - Allow R...
Definition: mpu_driver.h:124
uint8_t processId
Definition: mpu_pal.h:78
status_t MPU_DRV_Init(uint32_t instance, uint8_t regionCnt, const mpu_user_config_t *userConfigArr)
The function sets the MPU regions according to user input and then enables the MPU. Please note that access rights for region 0 will always be configured and regionCnt takes values between 1 and the maximum region count supported by the hardware. e.g. In S32K144 the number of supported regions is 8. The user must make sure that the clock is enabled.
Definition: mpu_driver.c:63
#define DEV_ASSERT(x)
Definition: devassert.h:77
uint8_t processorIdentification
Definition: mpu_driver.h:74
uint8_t processIdentifier
Definition: mpu_driver.h:196
status_t MPU_UpdateRegion(const mpu_instance_t *const instance, uint8_t regionNum, const mpu_region_config_t *configPtr)
Updates region configuration.
Definition: mpu_pal.c:383
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
Definition: status.h:44
status_t MPU_GetDefautRegionConfig(const mpu_instance_t *const instance, mpu_master_access_permission_t *masterAccRight, mpu_region_config_t *regionConfig)
Gets default region configuration. Grants all access rights for masters; disable PID and cache; unloc...
Definition: mpu_pal.c:314
uint32_t startAddr
Definition: mpu_pal.h:156
MPU detail error access info Implements : mpu_error_info_t_Class.
Definition: mpu_pal.h:70
#define MPU_RGD_COUNT
Definition: S32K118.h:7286
MPU user region configuration structure. This structure is used when calling the MPU_DRV_Init functio...
Definition: mpu_driver.h:190
uint32_t accessCtr
Definition: mpu_pal.h:76
#define FEATURE_MPU_HAS_PROCESS_IDENTIFIER
mpu_err_attributes_t attributes
Definition: mpu_driver.h:69
MPU detail error access info Implements : mpu_access_err_info_t_Class.
Definition: mpu_driver.h:66
mpu_access_rights_t accessRight
Definition: mpu_driver.h:179
status_t MPU_DRV_SetRegionConfig(uint32_t instance, uint8_t regionNum, const mpu_user_config_t *userConfigPtr)
Sets the region configuration.
Definition: mpu_driver.c:162
mpu_error_access_type_t
MPU access error Implements : mpu_error_access_type_t_Class.
Definition: mpu_pal.h:48
mpu_error_attributes_t attributes
Definition: mpu_pal.h:74
mpu_error_access_type_t accessType
Definition: mpu_pal.h:75
uint8_t processIdMask
Definition: mpu_pal.h:163
#define FEATURE_MPU_MASTER
const mpu_master_access_permission_t * masterAccRight
Definition: mpu_pal.h:158
status_t MPU_EnableRegion(const mpu_instance_t *const instance, uint8_t regionNum, bool enable)
Enables or disables an exist region configuration.
Definition: mpu_pal.c:428
void MPU_DRV_EnableRegion(uint32_t instance, uint8_t regionNum, bool enable)
Enables/Disables region descriptor. Please note that region 0 should not be disabled.
Definition: mpu_driver.c:323
#define FEATURE_MPU_MAX_LOW_MASTER_NUMBER
mpu_error_attributes_t
MPU access error attributes Implements : mpu_error_attributes_t_Class.
Definition: mpu_pal.h:58
uint8_t master
Definition: mpu_pal.h:72
#define FEATURE_MPU_MASTER_COUNT
MPU region configuration structure. Implements : mpu_region_config_t_Class.
Definition: mpu_pal.h:154
bool MPU_GetError(const mpu_instance_t *const instance, uint8_t channel, mpu_error_info_t *errPtr)
Checks and gets the access error detail information then clear error flag if the error caused by a ma...
Definition: mpu_pal.c:465