PPU Fixed (FIXED) v2 Functions¶
-
group
group_prot_functions_ppu_fixed_v2
Functions
-
cy_en_prot_status_t
Cy_Prot_ConfigPpuFixedMasterAtt
(PERI_MS_PPU_FX_Type *base, uint16_t pcMask, cy_en_prot_perm_t userPermission, cy_en_prot_perm_t privPermission, bool secure) Configures the protection structure with its protection attributes of the Fixed Peripheral Protection Unit (PPU FIXED) master.
This function configures the master structure governing the corresponding slave structure pair. It is a mechanism to protect the slave PPU FIXED structure. The memory location of the slave structure is known, so the address, region size and sub-regions of the configuration structure are not applicable.
note
This function is applicable for CPUSS ver_2 only.
note
The function accepts pcMask values from CY_PROT_PCMASK1 to CY_PROT_PCMASK15. But each device has its own number of available protection contexts. That number is defined by PERI_PC_NR in the config file. If pcMask is passed beyond the range of available protection context, the bits above PERI_PC_NR will be ignored.
Status
Description
CY_PROT_SUCCESS
The attributes were set up.
CY_PROT_FAILURE
The attributes were not setup and the structure is possibly locked.
CY_PROT_INVALID_STATE
The function was called on the device with an unsupported PERI HW version.
note
Only the user/privileged write permissions are configurable. The read permissions are read-only and cannot be configured.
note
PC0 accesses are read-only and are always enabled.
- Function Usage
/* Scenario: A bus master must not be able to access the PERI_MS_PPU_FX_HSIOM_PRT1_PRT slave struct unless operating with PC=0, "secure" and "privileged" access settings. The PERI_MS_PPU_FX_HSIOM_PRT1_PRT slave attributes are already configured. */ if(CY_PROT_SUCCESS != Cy_Prot_ConfigPpuFixedMasterAtt(PERI_MS_PPU_FX_HSIOM_PRT1_PRT, (uint16_t)0U, /* Only allow PC=0 bus masters */ CY_PROT_PERM_R, /* Read access always available for Master */ CY_PROT_PERM_RW, /* Allow read and write privileged mode accesses */ true)) /* Only allow "secure" bus masters */ { /* Insert error handling */ }
- Parameters
base – The register base address of the protection structure is being configured.
pcMask – The protection context mask. It specifies the protection context or a set of multiple protection contexts to be configured. It is a value of OR’d (|) items of cy_en_prot_pcmask_t.
userPermission – The user permission setting. The CY_PROT_PERM_R or CY_PROT_PERM_RW values are valid for the master.
privPermission – The privileged permission setting. The CY_PROT_PERM_R or CY_PROT_PERM_RW values are valid for the master.
secure – The secure flag.
- Returns
The status of the function call.
-
cy_en_prot_status_t
Cy_Prot_ConfigPpuFixedSlaveAtt
(PERI_MS_PPU_FX_Type *base, uint16_t pcMask, cy_en_prot_perm_t userPermission, cy_en_prot_perm_t privPermission, bool secure) Configures the protection structure with its protection attributes of the Fixed Peripheral Protection Unit (PPU FIXED) slave.
This function configures the slave structure of the PPU FIXED pair, which can protect any peripheral memory region in a device from invalid bus-master access.
note
This function is applicable for CPUSS ver_2 only.
note
The function accepts pcMask values from CY_PROT_PCMASK1 to CY_PROT_PCMASK15. But each device has its own number of available protection contexts. That number is defined by PERI_PC_NR in the config file.
Status
Description
CY_PROT_SUCCESS
The attributes were set up.
CY_PROT_FAILURE
The attributes were not setup and the structure is possibly locked.
CY_PROT_INVALID_STATE
The function was called on the device with an unsupported PERI HW version.
note
PC0 accesses are read-only and are always enabled.
- Function Usage
/* Scenario: Disallow a bus master on the CM4 core to change the HSIOM settings of port 1 but allow reading the HSIOM settings */ /* Configure the CM4 bus master - privileged, secure, allow setting PC to PC=1 */ Cy_Prot_ConfigBusMaster(CPUSS_MS_ID_CM4, /* Bus Master is the CM4 core */ true, /* Set the privilege level to Bus Master */ true, /* Set secure mode to Bus Master */ CY_PROT_PCMASK1); /* Allow setting PC to PC=1 only */ /* Configure slave attributes for PC=1 which allow reading the HSIOM settings of port 1 in privileged mode accesses for secure bus masters */ if(CY_PROT_SUCCESS != Cy_Prot_ConfigPpuFixedSlaveAtt(PERI_MS_PPU_FX_HSIOM_PRT1_PRT, (uint16_t)CY_PROT_PCMASK1, /* Allow PC=0 and PC=1 accesses */ CY_PROT_PERM_DISABLED, /* Disallow all user mode accesses */ CY_PROT_PERM_R, /* Allow Read privileged mode accesses */ true)) /* Only allow "secure" bus masters */ { /* Insert error handling */ } /* CM4 needs to access a protected resources that require PC=1 attribute */ Cy_Prot_SetActivePC(CPUSS_MS_ID_CM4, CY_PROT_PC1);
- Parameters
base – The register base address of the protection structure is being configured.
pcMask – The protection context mask. It specifies the protection context or a set of multiple protection contexts to be configured. It is a value of OR’d (|) items of cy_en_prot_pcmask_t. For example: (CY_PROT_PCMASK1 | CY_PROT_PCMASK3 | CY_PROT_PCMASK4).
userPermission – The user permission setting.
privPermission – The privileged permission setting.
secure – The secure flag.
- Returns
The status of the function call.
-
cy_en_prot_status_t