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 @@ -118,6 +118,32 @@ pmp_config_t *pmp_get_config(void)
118118 return & pmp_global_config ;
119119}
120120
121+ int32_t pmp_init (pmp_config_t * config )
122+ {
123+ if (!config )
124+ return ERR_PMP_INVALID_REGION ;
125+
126+ /* Clear all PMP regions in hardware and shadow configuration */
127+ for (uint8_t i = 0 ; i < PMP_MAX_REGIONS ; i ++ ) {
128+ write_pmpaddr (i , 0 );
129+ if (i % 4 == 0 )
130+ write_pmpcfg (i / 4 , 0 );
131+
132+ config -> regions [i ].addr_start = 0 ;
133+ config -> regions [i ].addr_end = 0 ;
134+ config -> regions [i ].permissions = 0 ;
135+ config -> regions [i ].priority = PMP_PRIORITY_TEMPORARY ;
136+ config -> regions [i ].region_id = i ;
137+ config -> regions [i ].locked = 0 ;
138+ }
139+
140+ config -> region_count = 0 ;
141+ config -> next_region_idx = 0 ;
142+ config -> initialized = 1 ;
143+
144+ return ERR_OK ;
145+ }
146+
121147int32_t pmp_init_pools (pmp_config_t * config , const mempool_t * pools ,
122148 size_t count )
123149{
You can’t perform that action at this time.
0 commit comments