PSoC 6 Peripheral Driver Library
PPU Programmable (PROG) v2 Functions

General Description

Functions

cy_en_prot_status_t Cy_Prot_ConfigPpuProgMasterAtt (PERI_MS_PPU_PR_Type *base, uint16_t pcMask, cy_en_prot_perm_t userPermission, cy_en_prot_perm_t privPermission, bool secure)
 Configures the protection-structure attributes of the Programmable Peripheral Protection Unit (PPU PROG) master. More...
 
cy_en_prot_status_t Cy_Prot_ConfigPpuProgSlaveAddr (PERI_MS_PPU_PR_Type *base, uint32_t address, cy_en_prot_size_t regionSize)
 Configures the protection-structure address settings of the Programmable Peripheral Protection Unit (PPU PROG) slave. More...
 
cy_en_prot_status_t Cy_Prot_ConfigPpuProgSlaveAtt (PERI_MS_PPU_PR_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 Programmable Peripheral Protection Unit (PPU PROG) slave. More...
 
cy_en_prot_status_t Cy_Prot_EnablePpuProgSlaveRegion (PERI_MS_PPU_PR_Type *base)
 Enables the Slave PPU PROG structure. More...
 
cy_en_prot_status_t Cy_Prot_DisablePpuProgSlaveRegion (PERI_MS_PPU_PR_Type *base)
 Disables the Slave PPU PROG structure. More...
 

Function Documentation

◆ Cy_Prot_ConfigPpuProgMasterAtt()

cy_en_prot_status_t Cy_Prot_ConfigPpuProgMasterAtt ( PERI_MS_PPU_PR_Type *  base,
uint16_t  pcMask,
cy_en_prot_perm_t  userPermission,
cy_en_prot_perm_t  privPermission,
bool  secure 
)

Configures the protection-structure attributes of the Programmable Peripheral Protection Unit (PPU PROG) master.

This function configures the master structure governing the corresponding slave structure pair. It is a mechanism to protect the slave PPU PROG structure. The memory location of the slave structure is known, so the address, regionSize, 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. 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 set up because 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's/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 is forbidden to have access to the PERI_MS_PPU_PR4 master
and slave attributes when it is operating with PC=0, "secure",
and "privileged" access settings. The PERI_MS_PPU_PR4 slave attributes
and address are already configured and enabled. */
if(CY_PROT_SUCCESS != Cy_Prot_ConfigPpuProgMasterAtt(PERI_MS_PPU_PR4, /* Programmable protection structure pair 4 base */
(uint16_t)0UL, /* 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_ConfigPpuProgSlaveAddr()

cy_en_prot_status_t Cy_Prot_ConfigPpuProgSlaveAddr ( PERI_MS_PPU_PR_Type *  base,
uint32_t  address,
cy_en_prot_size_t  regionSize 
)

Configures the protection-structure address settings of the Programmable Peripheral Protection Unit (PPU PROG) slave.

This function configures the slave structure of the PPU PROG pair, which can protect any peripheral memory region in a device from an 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.
addressThe address.
regionSizeThe region size.
Returns
The status of the function call.
Status Description
CY_PROT_SUCCESS The address settings were set up.
CY_PROT_FAILURE The address settings were not set up because 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
Cy_Prot_ConfigPpuProgSlaveAtt

◆ Cy_Prot_ConfigPpuProgSlaveAtt()

cy_en_prot_status_t Cy_Prot_ConfigPpuProgSlaveAtt ( PERI_MS_PPU_PR_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 Programmable Peripheral Protection Unit (PPU PROG) slave.

This function configures the slave structure of the PPU PROG 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 set up because 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: A bus master is forbidden to have access to the GPIO port 0 registers
(0x40310000 ~ 0x4031007F) when it has the "secure" attribute
and is operating at PC=3. */
/* Configure the attributes settings */
if(CY_PROT_SUCCESS != Cy_Prot_ConfigPpuProgSlaveAtt(PERI_MS_PPU_PR4, /* Programmable protection structure pair 4 base */
(uint16_t)CY_PROT_PCMASK3, /* Allow PC=0 and PC=3 accesses */
CY_PROT_PERM_RW, /* Allow Read and Write user mode accesses */
CY_PROT_PERM_RW, /* Allow Read and Write privileged mode accesses */
true)) /* Only allow "secure" bus masters */
{
/* Insert error handling */
}
/* Configure the address settings */
if(CY_PROT_SUCCESS != Cy_Prot_ConfigPpuProgSlaveAddr(PERI_MS_PPU_PR4, /* Programmable protection structure pair 4 base */
(uint32_t)GPIO_PRT0, /* Starting address at GPIO port 0 base */
CY_PROT_SIZE_256B)) /* Protect block of 256 Bytes */
{
/* Insert error handling */
}
/* Enables the Slave PPU PROG structure */

◆ Cy_Prot_EnablePpuProgSlaveRegion()

cy_en_prot_status_t Cy_Prot_EnablePpuProgSlaveRegion ( PERI_MS_PPU_PR_Type *  base)

Enables the Slave PPU PROG structure.

This is the PPU PROG slave-structure enable function. The PPU PROG protection settings will take effect after a successful completion of this function call.

Note
This function is applicable for CPUSS ver_2 only.
Parameters
baseThe base address for the protection unit structure is being configured.
Returns
The status of the function call.
Status Description
CY_PROT_SUCCESS The structure was enabled.
CY_PROT_FAILURE The structure is disabled and possibly locked.
CY_PROT_INVALID_STATE The function was called on the device with an unsupported PERI HW version.
Function Usage
Cy_Prot_ConfigPpuProgSlaveAtt

◆ Cy_Prot_DisablePpuProgSlaveRegion()

cy_en_prot_status_t Cy_Prot_DisablePpuProgSlaveRegion ( PERI_MS_PPU_PR_Type *  base)

Disables the Slave PPU PROG structure.

This is the PPU PROG slave-structure disable function. The PPU PROG protection settings will seize to take effect after successful completion of this function call.

Note
This function is applicable for CPUSS ver_2 only.
Parameters
baseThe base address for the protection unit structure is being configured.
Returns
The status of the function call.
Status Description
CY_PROT_SUCCESS The slave PPU PROG structure was disabled.
CY_PROT_FAILURE The structure is enabled and possibly locked.
CY_PROT_INVALID_STATE The function was called on the device with an unsupported PERI HW version.
Function Usage
/* Scenario: The slave struct of PERI_MS_PPU_PR4 needs to be disabled. Or it
needs to be reconfigured and hence must first be disabled. */
{
/* Insert error handling */
}