PPU Region (RG) v1 Functions

group group_prot_functions_ppu_rg

Functions

cy_en_prot_status_t Cy_Prot_ConfigPpuFixedRgMasterStruct(PERI_GR_PPU_RG_Type *base, const cy_stc_ppu_rg_cfg_t *config)

Configures a Fixed Peripheral Region Protection Unit (PPU RG) master protection struct with its protection attributes.

This function configures the master struct governing the corresponding slave struct pair. It is a mechanism to protect the slave PPU RG struct. Since the memory location of the slave struct is known, the address, regionSize and subregions of the configuration struct are not applicable.

Note that only the user/privileged write permissions are configurable. The read and execute permissions are read-only and cannot be configured.

note

This function is applicable for CPUSS ver_1 only.

Status

Description

CY_PROT_SUCCESS

PPU RG master struct was successfully configured.

CY_PROT_FAILURE

The resource is locked.

CY_PROT_BAD_PARAM

An incorrect/invalid parameter was passed.

CY_PROT_INVALID_STATE

The function was called on the device with an unsupported PERI HW version.

Return

Status of the function call.

Function Usage


    /* Scenario: A bus master must not be able to access the PERI_GR_PPU_RG_IPC_STRUCT0
                 master and slave structs unless operating with PC=0, "secure" and
                 "privileged" access settings. The PERI_GR_PPU_RG_IPC_STRUCT0 slave
                 struct is already configured and enabled. */
    
    cy_stc_ppu_rg_cfg_t rgPpuCfg_m = {
        /*.userPermission =*/ CY_PROT_PERM_R,       /* Read access always available for Master */
        /*.privPermission =*/ CY_PROT_PERM_RW,      /*  Allow read and write privileged mode accesses */
        /*.secure =*/ true,                         /* Only allow "secure" bus masters */
        /*.pcMatch =*/ false,                       /* Perform access evaluation */
        /*.pcMask =*/ (uint16_t)0UL                 /* Only allow PC=0 bus masters */
    };
    
    /* Configure the master struct of PPU Region (RG) governing the IPC_STRUCT0 registers */
    if(CY_PROT_SUCCESS != Cy_Prot_ConfigPpuFixedRgMasterStruct(PERI_GR_PPU_RG_IPC_STRUCT0, &rgPpuCfg_m))
    {
        /* Insert error handling */
    }
    else
    {
        /* Enable the master struct of PPU Region (RG) governing the IPC_STRUCT0 registers */
        if(CY_PROT_SUCCESS != Cy_Prot_EnablePpuFixedRgMasterStruct(PERI_GR_PPU_RG_IPC_STRUCT0))
        {
            /* Insert error handling */
        }
    }

Parameters
  • base: The register base address of the protection struct being configured.

  • config: Initialization structure with all the protection attributes.

cy_en_prot_status_t Cy_Prot_ConfigPpuFixedRgSlaveStruct(PERI_GR_PPU_RG_Type *base, const cy_stc_ppu_rg_cfg_t *config)

Configures a Fixed Peripheral Region Protection Unit (PPU RG) slave protection struct with its protection attributes.

This function configures the slave struct of a PPU RG pair, which can protect specified regions of peripheral instances. For example, individual DW channel structs, SMPU structs, and IPC structs etc.

Each fixed PPU RG is devoted to a defined peripheral region. Hence the address, regionSize and subregions of the configuration struct are not applicable.

Note that the user/privileged execute accesses are read-only and are always enabled.

note

This function is applicable for CPUSS ver_1 only.

Status

Description

CY_PROT_SUCCESS

PPU RG slave struct was successfully configured.

CY_PROT_FAILURE

The resource is locked.

CY_PROT_BAD_PARAM

An incorrect/invalid parameter was passed.

CY_PROT_INVALID_STATE

The function was called on the device with an unsupported PERI HW version.

Return

Status of the function call.

Function Usage


    /* Scenario: A bus master must not be able to access the IPC_STRUCT #0 registers 
                (governed by a dedicated region PPU) unless it has the "secure"
                 attribute and is operating in "privileged" mode at PC=0 or PC=2. */
    
    cy_stc_ppu_rg_cfg_t rgPpuCfg_s = {
        /*.userPermission =*/ CY_PROT_PERM_DISABLED,/* Disallow all user mode accesses */
        /*.privPermission =*/ CY_PROT_PERM_RW,      /* Allow Read and Write privileged mode accesses */
        /*.secure =*/ true,                         /* Only allow "secure" bus masters */
        /*.pcMatch =*/ false,                       /* Perform access evaluation */
        /*.pcMask =*/ (uint16_t)CY_PROT_PCMASK2     /* Allow PC=0 and PC=2 accesses */
    };
    
    /* Configure the slave struct of PPU Region (RG) governing IPC_STRUCT0 */
    if(CY_PROT_SUCCESS != Cy_Prot_ConfigPpuFixedRgSlaveStruct(PERI_GR_PPU_RG_IPC_STRUCT0, &rgPpuCfg_s))
    {
        /* Insert error handling */
    }
    else
    {
        /* Enable the slave struct of PPU Slave (SL) governing IPC_STRUCT0  */
        if(CY_PROT_SUCCESS != Cy_Prot_EnablePpuFixedRgSlaveStruct(PERI_GR_PPU_RG_IPC_STRUCT0))
        {
            /* Insert error handling */
        }
    }

Parameters
  • base: The register base address of the protection structure being configured.

  • config: Initialization structure with all the protection attributes.

cy_en_prot_status_t Cy_Prot_EnablePpuFixedRgMasterStruct(PERI_GR_PPU_RG_Type *base)

Enables the Master PPU RG structure.

This is a PPU RG master struct enable function. The PPU RG protection settings will take effect after successful completion of this function call.

note

This function is applicable for CPUSS ver_1 only.

Status

Description

CY_PROT_SUCCESS

The Master PU struct was enabled.

CY_PROT_FAILURE

The Master PU struct is disabled and possibly locked.

CY_PROT_INVALID_STATE

The function was called on the device with an unsupported PERI HW version.

Return

Status of the function call.

Function Usage


    /* Scenario: The master struct of PERI_GR_PPU_RG_IPC_STRUCT0 is configured 
                 to protect its slave struct and needs to be enabled. */
    
    if(CY_PROT_SUCCESS != Cy_Prot_EnablePpuFixedRgMasterStruct(PERI_GR_PPU_RG_IPC_STRUCT0))
    {
        /* Insert error handling */
    }

Parameters
  • base: The base address for the protection unit structure being configured.

cy_en_prot_status_t Cy_Prot_DisablePpuFixedRgMasterStruct(PERI_GR_PPU_RG_Type *base)

Disables the Master PPU RG structure.

This is a PPU RG master struct disable function. The PPU RG protection settings will seize to take effect after successful completion of this function call.

note

This function is applicable for CPUSS ver_1 only.

Status

Description

CY_PROT_SUCCESS

The Master PU struct was disabled.

CY_PROT_FAILURE

The Master PU struct is enabled and possibly locked.

CY_PROT_INVALID_STATE

The function was called on the device with an unsupported PERI HW version.

Return

Status of the function call.

Function Usage

    
    /* Scenario: The master struct of PERI_GR_PPU_RG_IPC_STRUCT0 needs to be disabled.
                 Or it needs to be reconfigured and hence must first be disabled. */
    
    if(CY_PROT_SUCCESS != Cy_Prot_DisablePpuFixedRgMasterStruct(PERI_GR_PPU_RG_IPC_STRUCT0))
    {
        /* Insert error handling */
    }

Parameters
  • base: The base address for the protection unit structure being configured.

cy_en_prot_status_t Cy_Prot_EnablePpuFixedRgSlaveStruct(PERI_GR_PPU_RG_Type *base)

Enables the Slave PPU RG structure.

This is a PPU RG slave struct enable function. The PPU RG protection settings will take effect after successful completion of this function call.

note

This function is applicable for CPUSS ver_1 only.

Status

Description

CY_PROT_SUCCESS

The Slave PU struct was enabled.

CY_PROT_FAILURE

The Slave PU struct is disabled and possibly locked.

CY_PROT_INVALID_STATE

The function was called on the device with an unsupported PERI HW version.

Return

Status of the function call.

Function Usage


    /* Scenario: The slave struct of PERI_GR_PPU_RG_IPC_STRUCT0 is configured 
                 to protect the IPC_STRUCT0 registers and needs to be enabled. */
    
    if(CY_PROT_SUCCESS != Cy_Prot_EnablePpuFixedRgSlaveStruct(PERI_GR_PPU_RG_IPC_STRUCT0))
    {
        /* Insert error handling */
    }

Parameters
  • base: The base address for the protection unit structure being configured.

cy_en_prot_status_t Cy_Prot_DisablePpuFixedRgSlaveStruct(PERI_GR_PPU_RG_Type *base)

Disables the Slave PPU RG structure.

This is a PPU RG slave struct disable function. The PPU RG protection settings will seize to take effect after successful completion of this function call.

note

This function is applicable for CPUSS ver_1 only.

Status

Description

CY_PROT_SUCCESS

The Slave PU struct was disabled.

CY_PROT_FAILURE

The Slave PU struct is enabled and possibly locked.

CY_PROT_INVALID_STATE

The function was called on the device with an unsupported PERI HW version.

Return

Status of the function call.

Function Usage


    /* Scenario: The slave struct of PERI_GR_PPU_RG_IPC_STRUCT0 needs to be disabled.
                 Or it needs to be reconfigured and hence must first be disabled. */
    
    if(CY_PROT_SUCCESS != Cy_Prot_DisablePpuFixedRgSlaveStruct(PERI_GR_PPU_RG_IPC_STRUCT0))
    {
        /* Insert error handling */
    }

Parameters
  • base: The base address for the protection unit structure being configured.