PSoC 6 Peripheral Driver Library
PPU Fixed (FIXED) v2 Functions

General Description

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. More...
 
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. More...
 

Function Documentation

◆ Cy_Prot_ConfigPpuFixedMasterAtt()

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.
Parameters
baseThe register base address of the protection structure is being configured.
pcMaskThe 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).
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.
Parameters
userPermissionThe user permission setting. The CY_PROT_PERM_R or CY_PROT_PERM_RW values are valid for the master.
privPermissionThe privileged permission setting. The CY_PROT_PERM_R or CY_PROT_PERM_RW values are valid for the master.
secureThe secure flag.
Returns
The status of the function call.
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.
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 */
}

◆ Cy_Prot_ConfigPpuFixedSlaveAtt()

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.
Parameters
baseThe register base address of the protection structure is being configured.
pcMaskThe 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).
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.
Parameters
userPermissionThe user permission setting.
privPermissionThe privileged permission setting.
secureThe secure flag.
Returns
The status of the function call.
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);