File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -320,3 +320,27 @@ int32_t pmp_lock_region(pmp_config_t *config, uint8_t region_idx)
320320
321321 return ERR_OK ;
322322}
323+
324+ int32_t pmp_get_region (const pmp_config_t * config , uint8_t region_idx ,
325+ pmp_region_t * region )
326+ {
327+ if (!config || !region )
328+ return ERR_PMP_INVALID_REGION ;
329+
330+ /* Validate region index is within bounds */
331+ if (region_idx >= PMP_MAX_REGIONS )
332+ return ERR_PMP_INVALID_REGION ;
333+
334+ uint8_t pmpcfg_idx , pmpcfg_offset ;
335+ pmp_get_cfg_indices (region_idx , & pmpcfg_idx , & pmpcfg_offset );
336+
337+ /* Read the address and configuration from shadow configuration */
338+ region -> addr_start = config -> regions [region_idx ].addr_start ;
339+ region -> addr_end = config -> regions [region_idx ].addr_end ;
340+ region -> permissions = config -> regions [region_idx ].permissions ;
341+ region -> priority = config -> regions [region_idx ].priority ;
342+ region -> region_id = region_idx ;
343+ region -> locked = config -> regions [region_idx ].locked ;
344+
345+ return ERR_OK ;
346+ }
You can’t perform that action at this time.
0 commit comments