PSoC 6 Peripheral Driver Library
Bus Master and PC Functions

General Description

Functions

cy_en_prot_status_t Cy_Prot_ConfigBusMaster (en_prot_master_t busMaster, bool privileged, bool secure, uint32_t pcMask)
 Configures the allowed protection contexts, security (secure/non-secure) and privilege level of the bus transaction created by the specified master. More...
 
cy_en_prot_status_t Cy_Prot_SetActivePC (en_prot_master_t busMaster, uint32_t pc)
 Sets the current/active protection context of the specified bus master. More...
 
uint32_t Cy_Prot_GetActivePC (en_prot_master_t busMaster)
 

Function Documentation

◆ Cy_Prot_ConfigBusMaster()

cy_en_prot_status_t Cy_Prot_ConfigBusMaster ( en_prot_master_t  busMaster,
bool  privileged,
bool  secure,
uint32_t  pcMask 
)

Configures the allowed protection contexts, security (secure/non-secure) and privilege level of the bus transaction created by the specified master.

Note
This function is applicable for both CPUSS ver_1 and ver_2.
Parameters
busMasterIndicates which master needs to be configured. Refer to the CPUSS_MS_ID_X defines in the device config header file.
privilegedBoolean to define the privilege level of all subsequent bus transfers. True - privileged, False - not privileged. Note that this is an inherited value. If not inherited, then this bit will be used.
secureSecurity setting for the master. True - Secure, False - Not secure.
pcMaskThis is a 16 bit value of the allowed contexts, it is an OR'ed (|) field of the provided defines in cy_prot.h. 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.
Returns
Status of the function call.
Status Description
CY_PROT_SUCCESS The function completed successfully.
CY_PROT_FAILURE The resource is locked.
Function Usage
/* Scenario: CM0+ needs to be able to access resources protected with privileged,
secure and set PC value (PC=0, PC=1 or PC=2) access settings */
/* Configure the CM0+ bus master - privileged, secure, allow setting PC to PC=1 and PC=2 */
{
/* Insert error handling */
}

◆ Cy_Prot_SetActivePC()

cy_en_prot_status_t Cy_Prot_SetActivePC ( en_prot_master_t  busMaster,
uint32_t  pc 
)

Sets the current/active protection context of the specified bus master.

Allowed PC values are 1-15. If this value is not inherited from another bus master, the value set through this function is used.

Note
This function is applicable for both CPUSS ver_1 and ver_2.
The function does not have access and returns an error for the secure CYB06xx7 devices.
Parameters
busMasterThe bus master to configure. Refer to the CPUSS_MS_ID_X defines in the device config header file.
pcActive protection context of the specified master cy_en_prot_pc_t.
Note
that only those protection contexts allowed by the pcMask (which was configured in Cy_Prot_ConfigBusMaster) will take effect.
The function accepts pcMask values from CY_PROT_PC1 to CY_PROT_PC15. But each device has its own number of available protection contexts. That number is defined by PERI_PC_NR in the config file.
Returns
Status of the function call.
Status Description
CY_PROT_SUCCESS The function completed successfully.
CY_PROT_FAILURE The resource is locked.
Function Usage
/* Scenario: CM0+ needs to access a protected resources that requires PC=1 attribute */
/* Configure the bus master to allow setting PC to PC=1 and PC=2 */
Cy_Prot_ConfigBusMaster(CPUSS_MS_ID_CM0, true, true, CY_PROT_PCMASK1 | CY_PROT_PCMASK2);
/* Get the active PC value of CM0+ */
if(CY_PROT_PC1 != Cy_Prot_GetActivePC(CPUSS_MS_ID_CM0))
{
/* Set the CM0+ PC value to 1 */
{
/* Insert error handling */
}
}

◆ Cy_Prot_GetActivePC()

uint32_t Cy_Prot_GetActivePC ( en_prot_master_t  busMaster)
Note
This function is applicable for both CPUSS ver_1 and ver_2.

Returns the active protection context of a master.

Parameters
busMasterThe bus master, whose protection context is being read. Refer to the CPUSS_MS_ID_X defines in the device config header file.
Returns
Active protection context of the master cy_en_prot_pc_t.
Function Usage
/* Scenario: CM0+ needs to access a protected resources that requires PC=1 attribute */
/* Configure the bus master to allow setting PC to PC=1 and PC=2 */
Cy_Prot_ConfigBusMaster(CPUSS_MS_ID_CM0, true, true, CY_PROT_PCMASK1 | CY_PROT_PCMASK2);
/* Get the active PC value of CM0+ */
if(CY_PROT_PC1 != Cy_Prot_GetActivePC(CPUSS_MS_ID_CM0))
{
/* Set the CM0+ PC value to 1 */
{
/* Insert error handling */
}
}