HPM SDK
HPMicro Software Development Kit
hpm_pmp_drv.c File Reference
#include "hpm_pmp_drv.h"
#include "hpm_csr_drv.h"

Macros

#define PMP_ENTRY_MAX   16
 
#define PMA_ENTRY_MAX   16
 

Functions

uint32_t read_pmp_cfg (uint32_t idx)
 Read PMP configuration. More...
 
void write_pmp_cfg (uint32_t value, uint32_t idx)
 Write PMP Configuration to corresponding PMP_CFG register. More...
 
void write_pmp_addr (uint32_t value, uint32_t idx)
 Write PMP address to corresponding PMP_ADDR register. More...
 
uint32_t read_pmp_addr (uint32_t idx)
 Read PMP address entry. More...
 
hpm_stat_t pmp_config_attributes (const pmp_attr_t *attrs, uint32_t num_of_entries)
 Configure PMP Attributes (including PMPi_CFG and PMPADDRi) More...
 
hpm_stat_t pmp_lock_pmp_entry (uint32_t pmp_index)
 Lock the specified PMP entry. More...
 
uint32_t read_pma_cfg (uint32_t idx)
 Read PMA configuration. More...
 
void write_pma_cfg (uint32_t value, uint32_t idx)
 Write PMA Configuration to corresponding PMA_CFG register. More...
 
void write_pma_addr (uint32_t value, uint32_t idx)
 Write PMA address to corresponding PMA_ADDR register. More...
 
uint32_t read_pma_addr (uint32_t idx)
 Read PMA address entry. More...
 
hpm_stat_t pma_config_attributes (const pma_attr_t *attrs, uint32_t num_of_entries)
 Configure PMA Attributes (including PMAiCFG and PMAADDRi) More...
 
hpm_stat_t pmp_config_entry (const pmp_entry_t *entry, uint32_t entry_index)
 Configure PMP and PMA for specified PMP/PMA entry. More...
 
hpm_stat_t pmp_config (const pmp_entry_t *entry, uint32_t num_of_entries)
 Configure PMP and PMA based on the PMP entry list. More...
 
void pmp_disable (void)
 Disable PMP and PMA. More...
 
uint32_t pmp_get_aligned_len (uint32_t len)
 Get the aligned length of the PMP/PMA entry, the length is round up to next power of 2. More...
 

Macro Definition Documentation

◆ PMA_ENTRY_MAX

#define PMA_ENTRY_MAX   16

◆ PMP_ENTRY_MAX

#define PMP_ENTRY_MAX   16

Function Documentation

◆ pma_config_attributes()

hpm_stat_t pma_config_attributes ( const pma_attr_t attrs,
uint32_t  num_of_entries 
)

Configure PMA Attributes (including PMAiCFG and PMAADDRi)

Parameters
attrspointer to the array of PMA attributes
num_of_entriesNumber of entries in PMA attribute array
Return values
status_successif no errors happened
status_invalid_argumentInvalid argument(s) detected

◆ pmp_config()

hpm_stat_t pmp_config ( const pmp_entry_t entry,
uint32_t  num_of_entries 
)

Configure PMP and PMA based on the PMP entry list.

Deprecated:
This API will be dropped in future release, please use the pmp_config_attributes and pma_config_attributes instead
Parameters
entrystart of the PMP entry list
num_of_entriesNumber of entries in the PMP entry list
Return values
status_invalid_argumentInvalid Arguments were detected
status_successConfiguration completed without errors

◆ pmp_config_attributes()

hpm_stat_t pmp_config_attributes ( const pmp_attr_t attrs,
uint32_t  num_of_entries 
)

Configure PMP Attributes (including PMPi_CFG and PMPADDRi)

Parameters
[in]attrspointer to the array of PMP attributes
[in]num_of_entriesNumber of entries in PMP attribute array
Return values
status_successif no errors happened
status_invalid_argumentInvalid argument(s) detected

◆ pmp_config_entry()

hpm_stat_t pmp_config_entry ( const pmp_entry_t entry,
uint32_t  entry_index 
)

Configure PMP and PMA for specified PMP/PMA entry.

Deprecated:
This API will be dropped in future release, please use the pmp_config_attributes and pma_config_attributes instead
Parameters
[in]entryPMP entry
[in]entry_indexPMP/PMA entry index
Return values
status_invalid_argumentInvalid Arguments were detected
status_successConfiguration completed without errors

◆ pmp_disable()

void pmp_disable ( void  )

Disable PMP and PMA.

◆ pmp_get_aligned_len()

uint32_t pmp_get_aligned_len ( uint32_t  len)

Get the aligned length of the PMP/PMA entry, the length is round up to next power of 2.

Parameters
[in]lenThe length of the PMP/PMA entry
Returns
The aligned length of the PMP/PMA entry

◆ pmp_lock_pmp_entry()

hpm_stat_t pmp_lock_pmp_entry ( uint32_t  pmp_index)

Lock the specified PMP entry.

Note
Once the PMP entry is locked, it cannot be modified until system reset
Parameters
[in]pmp_indexPMP index
Return values
status_successNo error happened
status_failPMP entry has been locked already
status_invalid_argumentthe pmp_index is out of range

◆ read_pma_addr()

uint32_t read_pma_addr ( uint32_t  idx)

Read PMA address entry.

Parameters
[in]idxPMA address entry index, valid value is 0-15
Returns
PMA address

◆ read_pma_cfg()

uint32_t read_pma_cfg ( uint32_t  idx)

Read PMA configuration.

Parameters
[in]idxPMA entry index
Returns
PMA configuration

◆ read_pmp_addr()

uint32_t read_pmp_addr ( uint32_t  idx)

Read PMP address entry.

Parameters
[in]idxPMP address entry index
Returns
PMP address

◆ read_pmp_cfg()

uint32_t read_pmp_cfg ( uint32_t  idx)

Read PMP configuration.

Parameters
[in]idxPMP entry index
Returns
PMP configuration

◆ write_pma_addr()

void write_pma_addr ( uint32_t  value,
uint32_t  idx 
)

Write PMA address to corresponding PMA_ADDR register.

Parameters
[in]valuePMA address
[in]idxPMA address entry index, valid value is 0-15

◆ write_pma_cfg()

void write_pma_cfg ( uint32_t  value,
uint32_t  idx 
)

Write PMA Configuration to corresponding PMA_CFG register.

Parameters
[in]valuePMA configuration
[in]idxPMA entry index, valid value is 0-15

◆ write_pmp_addr()

void write_pmp_addr ( uint32_t  value,
uint32_t  idx 
)

Write PMP address to corresponding PMP_ADDR register.

Parameters
[in]valuePMP address
[in]idxPMP address entry index, valid value is 0-15

◆ write_pmp_cfg()

void write_pmp_cfg ( uint32_t  value,
uint32_t  idx 
)

Write PMP Configuration to corresponding PMP_CFG register.

Parameters
[in]valuePMP configuration
[in]idxPMP entry index, valid value is 0-15