File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -400,3 +400,28 @@ int32_t pmp_lock_region(pmp_config_t *config, uint8_t region_idx)
400400
401401 return ERR_OK ;
402402}
403+
404+ int32_t pmp_get_region (const pmp_config_t * config ,
405+ uint8_t region_idx ,
406+ pmp_region_t * region )
407+ {
408+ if (!config || !region )
409+ return ERR_PMP_INVALID_REGION ;
410+
411+ /* Validate region index is within bounds */
412+ if (region_idx >= PMP_MAX_REGIONS )
413+ return ERR_PMP_INVALID_REGION ;
414+
415+ uint8_t pmpcfg_idx , pmpcfg_offset ;
416+ pmp_get_cfg_indices (region_idx , & pmpcfg_idx , & pmpcfg_offset );
417+
418+ /* Read the address and configuration from shadow configuration */
419+ region -> addr_start = config -> regions [region_idx ].addr_start ;
420+ region -> addr_end = config -> regions [region_idx ].addr_end ;
421+ region -> permissions = config -> regions [region_idx ].permissions ;
422+ region -> priority = config -> regions [region_idx ].priority ;
423+ region -> region_id = region_idx ;
424+ region -> locked = config -> regions [region_idx ].locked ;
425+
426+ return ERR_OK ;
427+ }
You can’t perform that action at this time.
0 commit comments