File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,32 @@ pmp_config_t *pmp_get_config(void)
195195 return & pmp_global_config ;
196196}
197197
198+ int32_t pmp_init (pmp_config_t * config )
199+ {
200+ if (!config )
201+ return ERR_PMP_INVALID_REGION ;
202+
203+ /* Clear all PMP regions in hardware and shadow configuration */
204+ for (uint8_t i = 0 ; i < PMP_MAX_REGIONS ; i ++ ) {
205+ write_pmpaddr (i , 0 );
206+ if (i % 4 == 0 )
207+ write_pmpcfg (i / 4 , 0 );
208+
209+ config -> regions [i ].addr_start = 0 ;
210+ config -> regions [i ].addr_end = 0 ;
211+ config -> regions [i ].permissions = 0 ;
212+ config -> regions [i ].priority = PMP_PRIORITY_TEMPORARY ;
213+ config -> regions [i ].region_id = i ;
214+ config -> regions [i ].locked = 0 ;
215+ }
216+
217+ config -> region_count = 0 ;
218+ config -> next_region_idx = 0 ;
219+ config -> initialized = 1 ;
220+
221+ return ERR_OK ;
222+ }
223+
198224int32_t pmp_init_pools (pmp_config_t * config ,
199225 const mempool_t * pools ,
200226 size_t count )
You can’t perform that action at this time.
0 commit comments