mirror of https://github.com/ARMmbed/mbed-os.git
License
parent
b4a77f6ead
commit
dc71ec4a81
|
@ -1,49 +1,25 @@
|
||||||
/***************************************************************************//**
|
/* mbed Microcontroller Library
|
||||||
* \file cyprotection.c
|
|
||||||
* \version 1.0
|
|
||||||
*
|
*
|
||||||
* \brief
|
|
||||||
* This is the source code for the protection unit config functions wrappers.
|
|
||||||
*
|
|
||||||
********************************************************************************
|
|
||||||
* \copyright
|
* \copyright
|
||||||
*
|
|
||||||
* <EFBFBD> 2018, Cypress Semiconductor Corporation
|
* (c) 2018, Cypress Semiconductor Corporation
|
||||||
* or a subsidiary of Cypress Semiconductor Corporation. All rights
|
* or a subsidiary of Cypress Semiconductor Corporation. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
*
|
*
|
||||||
* This software, including source code, documentation and related
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* materials (<EFBFBD>Software<EFBFBD>), is owned by Cypress Semiconductor
|
|
||||||
* Corporation or one of its subsidiaries (<EFBFBD>Cypress<EFBFBD>) and is protected by
|
|
||||||
* and subject to worldwide patent protection (United States and foreign),
|
|
||||||
* United States copyright laws and international treaty provisions.
|
|
||||||
* Therefore, you may use this Software only as provided in the license
|
|
||||||
* agreement accompanying the software package from which you
|
|
||||||
* obtained this Software (<EFBFBD>EULA<EFBFBD>).
|
|
||||||
*
|
*
|
||||||
* If no EULA applies, Cypress hereby grants you a personal, non-
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* exclusive, non-transferable license to copy, modify, and compile the
|
* you may not use this file except in compliance with the License.
|
||||||
* Software source code solely for use in connection with Cypress<EFBFBD>s
|
* You may obtain a copy of the License at
|
||||||
* integrated circuit products. Any reproduction, modification, translation,
|
|
||||||
* compilation, or representation of this Software except as specified
|
|
||||||
* above is prohibited without the express written permission of Cypress.
|
|
||||||
*
|
*
|
||||||
* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE. Cypress reserves the right to make
|
|
||||||
* changes to the Software without notice. Cypress does not assume any
|
|
||||||
* liability arising out of the application or use of the Software or any
|
|
||||||
* product or circuit described in the Software. Cypress does not
|
|
||||||
* authorize its products for use in any products where a malfunction or
|
|
||||||
* failure of the Cypress product may reasonably be expected to result in
|
|
||||||
* significant property damage, injury or death (<EFBFBD>High Risk Product<EFBFBD>). By
|
|
||||||
* including Cypress<EFBFBD>s product in a High Risk Product, the manufacturer
|
|
||||||
* of such system or application assumes all risk of such use and in doing
|
|
||||||
* so agrees to indemnify Cypress against all liability.
|
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "cyprotection.h"
|
#include "cyprotection.h"
|
||||||
|
|
||||||
|
@ -311,7 +287,7 @@ cy_en_prot_status_t bus_masters_protect(cy_bus_master_config_t bus_masters_confi
|
||||||
* none
|
* none
|
||||||
*
|
*
|
||||||
* Called by:
|
* Called by:
|
||||||
* isAccessAlowedSMPU, isAccessAlowedMPU
|
* isAccessAllowedSMPU, isAccessAllowedMPU
|
||||||
*
|
*
|
||||||
* Note:
|
* Note:
|
||||||
*
|
*
|
||||||
|
@ -359,7 +335,7 @@ static uint8_t isProtRangeMatched(uint32_t startAddrMem, uint32_t memSize, uint3
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Function Name: isAccessAlowedFixedRgPPU
|
* Function Name: isAccessAllowedFixedRgPPU
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* Summary:
|
* Summary:
|
||||||
* The function checks whether a peripheral region is closed by Fixed Region PPU
|
* The function checks whether a peripheral region is closed by Fixed Region PPU
|
||||||
|
@ -379,13 +355,13 @@ static uint8_t isProtRangeMatched(uint32_t startAddrMem, uint32_t memSize, uint3
|
||||||
* isProtRangeMatched
|
* isProtRangeMatched
|
||||||
*
|
*
|
||||||
* Called by:
|
* Called by:
|
||||||
* isPeriferalAccessAllowed
|
* isPeripheralAccessAllowed
|
||||||
*
|
*
|
||||||
* Note:
|
* Note:
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static uint8_t isAccessAlowedFixedRgPPU(uint32_t perStartAddr, uint32_t perSize,
|
static uint8_t isAccessAllowedFixedRgPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
||||||
{
|
{
|
||||||
uint8_t accessAllowed = 1;
|
uint8_t accessAllowed = 1;
|
||||||
|
@ -449,7 +425,7 @@ static uint8_t isAccessAlowedFixedRgPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Function Name: isAccessAlowedFixedSlPPU
|
* Function Name: isAccessAllowedFixedSlPPU
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* Summary:
|
* Summary:
|
||||||
* The function checks whether a peripheral region is closed by Fixed Slave PPU
|
* The function checks whether a peripheral region is closed by Fixed Slave PPU
|
||||||
|
@ -469,13 +445,13 @@ static uint8_t isAccessAlowedFixedRgPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
* isProtRangeMatched
|
* isProtRangeMatched
|
||||||
*
|
*
|
||||||
* Called by:
|
* Called by:
|
||||||
* isPeriferalAccessAllowed
|
* isPeripheralAccessAllowed
|
||||||
*
|
*
|
||||||
* Note:
|
* Note:
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static uint8_t isAccessAlowedFixedSlPPU(uint32_t perStartAddr, uint32_t perSize,
|
static uint8_t isAccessAllowedFixedSlPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
||||||
{
|
{
|
||||||
uint8_t accessAllowed = 1;
|
uint8_t accessAllowed = 1;
|
||||||
|
@ -573,7 +549,7 @@ static uint8_t isAccessAlowedFixedSlPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Function Name: isAccessAlowedProgPPU
|
* Function Name: isAccessAllowedProgPPU
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* Summary:
|
* Summary:
|
||||||
* The function checks whether a peripheral region is closed by Programmable PPU
|
* The function checks whether a peripheral region is closed by Programmable PPU
|
||||||
|
@ -593,13 +569,13 @@ static uint8_t isAccessAlowedFixedSlPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
* isProtRangeMatched
|
* isProtRangeMatched
|
||||||
*
|
*
|
||||||
* Called by:
|
* Called by:
|
||||||
* isPeriferalAccessAllowed
|
* isPeripheralAccessAllowed
|
||||||
*
|
*
|
||||||
* Note:
|
* Note:
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static uint8_t isAccessAlowedProgPPU(uint32_t perStartAddr, uint32_t perSize,
|
static uint8_t isAccessAllowedProgPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
||||||
{
|
{
|
||||||
uint8_t accessAllowed = 1;
|
uint8_t accessAllowed = 1;
|
||||||
|
@ -660,7 +636,7 @@ static uint8_t isAccessAlowedProgPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Function Name: isAccessAlowedGrPPU
|
* Function Name: isAccessAllowedGrPPU
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* Summary:
|
* Summary:
|
||||||
* The function checks whether a peripheral region is closed by Group PPU
|
* The function checks whether a peripheral region is closed by Group PPU
|
||||||
|
@ -680,13 +656,13 @@ static uint8_t isAccessAlowedProgPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
* isProtRangeMatched
|
* isProtRangeMatched
|
||||||
*
|
*
|
||||||
* Called by:
|
* Called by:
|
||||||
* isPeriferalAccessAllowed
|
* isPeripheralAccessAllowed
|
||||||
*
|
*
|
||||||
* Note:
|
* Note:
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
|
static uint8_t isAccessAllowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
||||||
{
|
{
|
||||||
uint8_t accessAllowed = 1;
|
uint8_t accessAllowed = 1;
|
||||||
|
@ -750,7 +726,7 @@ static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Function Name: isPeriferalAccessAllowed
|
* Function Name: isPeripheralAccessAllowed
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* Summary:
|
* Summary:
|
||||||
* Checks if the given peripheral region is protected by PPU
|
* Checks if the given peripheral region is protected by PPU
|
||||||
|
@ -767,7 +743,8 @@ static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
* uint8_t accessAllowed (values: 0 (no) /1 (yes))
|
* uint8_t accessAllowed (values: 0 (no) /1 (yes))
|
||||||
*
|
*
|
||||||
* Calls:
|
* Calls:
|
||||||
* isAccessAlowedGrPPU, isAccessAlowedProgPPU, isAccessAlowedFixedPPU, isAccessAlowedRegionPPU
|
* isAccessAllowedGrPPU, isAccessAllowedProgPPU, isAccessAllowedFixedPPU,
|
||||||
|
* isAccessAllowedRegionPPU
|
||||||
*
|
*
|
||||||
* Called by:
|
* Called by:
|
||||||
* none
|
* none
|
||||||
|
@ -776,30 +753,30 @@ static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
uint8_t isPeriferalAccessAllowed(uint32_t perStartAddr, uint32_t perSize,
|
uint8_t isPeripheralAccessAllowed(uint32_t perStartAddr, uint32_t perSize,
|
||||||
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
||||||
{
|
{
|
||||||
uint8_t accessAllowed;
|
uint8_t accessAllowed;
|
||||||
|
|
||||||
accessAllowed = isAccessAlowedGrPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
|
accessAllowed = isAccessAllowedGrPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
|
||||||
if (accessAllowed)
|
if (accessAllowed)
|
||||||
{
|
{
|
||||||
accessAllowed = isAccessAlowedProgPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
|
accessAllowed = isAccessAllowedProgPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
|
||||||
}
|
}
|
||||||
if (accessAllowed)
|
if (accessAllowed)
|
||||||
{
|
{
|
||||||
accessAllowed = isAccessAlowedFixedSlPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
|
accessAllowed = isAccessAllowedFixedSlPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
|
||||||
}
|
}
|
||||||
if (accessAllowed)
|
if (accessAllowed)
|
||||||
{
|
{
|
||||||
accessAllowed = isAccessAlowedFixedRgPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
|
accessAllowed = isAccessAllowedFixedRgPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return accessAllowed;
|
return accessAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Function Name: isAccessAlowedSMPU
|
* Function Name: isAccessAllowedSMPU
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* Summary:
|
* Summary:
|
||||||
* The function checks whether a memory region is closed by SMPU for a master
|
* The function checks whether a memory region is closed by SMPU for a master
|
||||||
|
@ -825,7 +802,7 @@ uint8_t isPeriferalAccessAllowed(uint32_t perStartAddr, uint32_t perSize,
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static uint8_t isAccessAlowedSMPU(uint32_t memStartAddr, uint32_t memSize,
|
static uint8_t isAccessAllowedSMPU(uint32_t memStartAddr, uint32_t memSize,
|
||||||
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
|
||||||
{
|
{
|
||||||
uint8_t accessAllowed = 1;
|
uint8_t accessAllowed = 1;
|
||||||
|
@ -887,7 +864,7 @@ static uint8_t isAccessAlowedSMPU(uint32_t memStartAddr, uint32_t memSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Function Name: isAccessAlowedMPU
|
* Function Name: isAccessAllowedMPU
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* Summary:
|
* Summary:
|
||||||
* The function checks whether a memory region is closed by MPU for a master
|
* The function checks whether a memory region is closed by MPU for a master
|
||||||
|
@ -912,7 +889,7 @@ static uint8_t isAccessAlowedSMPU(uint32_t memStartAddr, uint32_t memSize,
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static uint8_t isAccessAlowedMPU(uint32_t memStartAddr, uint32_t memSize,
|
static uint8_t isAccessAllowedMPU(uint32_t memStartAddr, uint32_t memSize,
|
||||||
uint8_t privModeFlag, uint8_t nsecureFlag, cy_en_prot_perm_t accessType)
|
uint8_t privModeFlag, uint8_t nsecureFlag, cy_en_prot_perm_t accessType)
|
||||||
{
|
{
|
||||||
uint8_t accessAllowed = 1;
|
uint8_t accessAllowed = 1;
|
||||||
|
@ -982,7 +959,7 @@ static uint8_t isAccessAlowedMPU(uint32_t memStartAddr, uint32_t memSize,
|
||||||
* uint8_t accessAllowed (values: 0 (no) /1 (yes))
|
* uint8_t accessAllowed (values: 0 (no) /1 (yes))
|
||||||
*
|
*
|
||||||
* Calls:
|
* Calls:
|
||||||
* CheckEnabledMPUProtection, isAccessAlowedSMPU
|
* CheckEnabledMPUProtection, isAccessAllowedSMPU
|
||||||
*
|
*
|
||||||
* Called by:
|
* Called by:
|
||||||
* none
|
* none
|
||||||
|
@ -996,10 +973,10 @@ uint8_t isMemoryAccessAllowed(uint32_t memStartAddr, uint32_t memSize,
|
||||||
{
|
{
|
||||||
uint8_t accessAllowed;
|
uint8_t accessAllowed;
|
||||||
|
|
||||||
accessAllowed = isAccessAlowedMPU(memStartAddr, memSize, privModeFlag, nsecureFlag, accessType);
|
accessAllowed = isAccessAllowedMPU(memStartAddr, memSize, privModeFlag, nsecureFlag, accessType);
|
||||||
if (accessAllowed)
|
if (accessAllowed)
|
||||||
{
|
{
|
||||||
accessAllowed = isAccessAlowedSMPU(memStartAddr, memSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
|
accessAllowed = isAccessAllowedSMPU(memStartAddr, memSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return accessAllowed;
|
return accessAllowed;
|
||||||
|
|
|
@ -1,50 +1,25 @@
|
||||||
/***************************************************************************//**
|
/* mbed Microcontroller Library
|
||||||
* \file cyprotection.h
|
|
||||||
* \version 1.0
|
|
||||||
*
|
*
|
||||||
* \brief
|
|
||||||
* This is the header file for the protection configuration structures
|
|
||||||
* and functions.
|
|
||||||
*
|
|
||||||
********************************************************************************
|
|
||||||
* \copyright
|
* \copyright
|
||||||
*
|
|
||||||
* <EFBFBD> 2018, Cypress Semiconductor Corporation
|
* (c) 2018, Cypress Semiconductor Corporation
|
||||||
* or a subsidiary of Cypress Semiconductor Corporation. All rights
|
* or a subsidiary of Cypress Semiconductor Corporation. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
*
|
*
|
||||||
* This software, including source code, documentation and related
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* materials (<EFBFBD>Software<EFBFBD>), is owned by Cypress Semiconductor
|
|
||||||
* Corporation or one of its subsidiaries (<EFBFBD>Cypress<EFBFBD>) and is protected by
|
|
||||||
* and subject to worldwide patent protection (United States and foreign),
|
|
||||||
* United States copyright laws and international treaty provisions.
|
|
||||||
* Therefore, you may use this Software only as provided in the license
|
|
||||||
* agreement accompanying the software package from which you
|
|
||||||
* obtained this Software (<EFBFBD>EULA<EFBFBD>).
|
|
||||||
*
|
*
|
||||||
* If no EULA applies, Cypress hereby grants you a personal, non-
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* exclusive, non-transferable license to copy, modify, and compile the
|
* you may not use this file except in compliance with the License.
|
||||||
* Software source code solely for use in connection with Cypress<EFBFBD>s
|
* You may obtain a copy of the License at
|
||||||
* integrated circuit products. Any reproduction, modification, translation,
|
|
||||||
* compilation, or representation of this Software except as specified
|
|
||||||
* above is prohibited without the express written permission of Cypress.
|
|
||||||
*
|
*
|
||||||
* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE. Cypress reserves the right to make
|
|
||||||
* changes to the Software without notice. Cypress does not assume any
|
|
||||||
* liability arising out of the application or use of the Software or any
|
|
||||||
* product or circuit described in the Software. Cypress does not
|
|
||||||
* authorize its products for use in any products where a malfunction or
|
|
||||||
* failure of the Cypress product may reasonably be expected to result in
|
|
||||||
* significant property damage, injury or death (<EFBFBD>High Risk Product<EFBFBD>). By
|
|
||||||
* including Cypress<EFBFBD>s product in a High Risk Product, the manufacturer
|
|
||||||
* of such system or application assumes all risk of such use and in doing
|
|
||||||
* so agrees to indemnify Cypress against all liability.
|
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _CYPROTECTION_H_
|
#ifndef _CYPROTECTION_H_
|
||||||
#define _CYPROTECTION_H_
|
#define _CYPROTECTION_H_
|
||||||
|
@ -181,7 +156,7 @@ cy_en_prot_status_t ppu_prog_protect(cy_ppu_prog_cfg_t ppu_config_arr[], uint32_
|
||||||
cy_en_prot_status_t ppu_fixed_gr_protect(cy_ppu_fixed_gr_cfg_t ppu_config_arr[], uint32_t arr_length);
|
cy_en_prot_status_t ppu_fixed_gr_protect(cy_ppu_fixed_gr_cfg_t ppu_config_arr[], uint32_t arr_length);
|
||||||
cy_en_prot_status_t bus_masters_protect(cy_bus_master_config_t bus_masters_config_arr[], uint32_t arr_length);
|
cy_en_prot_status_t bus_masters_protect(cy_bus_master_config_t bus_masters_config_arr[], uint32_t arr_length);
|
||||||
|
|
||||||
uint8_t isPeriferalAccessAllowed(uint32_t perStartAddr, uint32_t perSize,
|
uint8_t isPeripheralAccessAllowed(uint32_t perStartAddr, uint32_t perSize,
|
||||||
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType);
|
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType);
|
||||||
uint8_t isMemoryAccessAllowed(uint32_t memStartAddr, uint32_t memSize,
|
uint8_t isMemoryAccessAllowed(uint32_t memStartAddr, uint32_t memSize,
|
||||||
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType);
|
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType);
|
||||||
|
|
|
@ -1,49 +1,25 @@
|
||||||
/***************************************************************************//**
|
/* mbed Microcontroller Library
|
||||||
* \file cyprotection_config.h
|
|
||||||
* \version 1.0
|
|
||||||
*
|
*
|
||||||
* \brief
|
|
||||||
* This is the header with protection configurations defines.
|
|
||||||
*
|
|
||||||
********************************************************************************
|
|
||||||
* \copyright
|
* \copyright
|
||||||
*
|
|
||||||
* © 2018, Cypress Semiconductor Corporation
|
* (c) 2018, Cypress Semiconductor Corporation
|
||||||
* or a subsidiary of Cypress Semiconductor Corporation. All rights
|
* or a subsidiary of Cypress Semiconductor Corporation. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
*
|
*
|
||||||
* This software, including source code, documentation and related
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* materials (“Software”), is owned by Cypress Semiconductor
|
|
||||||
* Corporation or one of its subsidiaries (“Cypress”) and is protected by
|
|
||||||
* and subject to worldwide patent protection (United States and foreign),
|
|
||||||
* United States copyright laws and international treaty provisions.
|
|
||||||
* Therefore, you may use this Software only as provided in the license
|
|
||||||
* agreement accompanying the software package from which you
|
|
||||||
* obtained this Software (“EULA”).
|
|
||||||
*
|
*
|
||||||
* If no EULA applies, Cypress hereby grants you a personal, non-
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* exclusive, non-transferable license to copy, modify, and compile the
|
* you may not use this file except in compliance with the License.
|
||||||
* Software source code solely for use in connection with Cypress’s
|
* You may obtain a copy of the License at
|
||||||
* integrated circuit products. Any reproduction, modification, translation,
|
|
||||||
* compilation, or representation of this Software except as specified
|
|
||||||
* above is prohibited without the express written permission of Cypress.
|
|
||||||
*
|
*
|
||||||
* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
||||||
* PARTICULAR PURPOSE. Cypress reserves the right to make
|
|
||||||
* changes to the Software without notice. Cypress does not assume any
|
|
||||||
* liability arising out of the application or use of the Software or any
|
|
||||||
* product or circuit described in the Software. Cypress does not
|
|
||||||
* authorize its products for use in any products where a malfunction or
|
|
||||||
* failure of the Cypress product may reasonably be expected to result in
|
|
||||||
* significant property damage, injury or death (“High Risk Product”). By
|
|
||||||
* including Cypress’s product in a High Risk Product, the manufacturer
|
|
||||||
* of such system or application assumes all risk of such use and in doing
|
|
||||||
* so agrees to indemnify Cypress against all liability.
|
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _CYPROTECTION_CONFIG_H_
|
#ifndef _CYPROTECTION_CONFIG_H_
|
||||||
#define _CYPROTECTION_CONFIG_H_
|
#define _CYPROTECTION_CONFIG_H_
|
||||||
|
@ -59,8 +35,6 @@ CY_PROT_PCMASK3 + CY_PROT_PCMASK4)
|
||||||
|
|
||||||
#define ALL_SUBREGIONS (0x0)
|
#define ALL_SUBREGIONS (0x0)
|
||||||
|
|
||||||
/* !!! regionSize must power be power of 2 !!! */
|
|
||||||
|
|
||||||
const cy_smpu_region_config_t flash_spm_smpu_config[] = {
|
const cy_smpu_region_config_t flash_spm_smpu_config[] = {
|
||||||
/* FLASH_PC1_SPM */
|
/* FLASH_PC1_SPM */
|
||||||
{
|
{
|
||||||
|
@ -68,6 +42,7 @@ const cy_smpu_region_config_t flash_spm_smpu_config[] = {
|
||||||
.regionSize = CY_PROT_SIZE_512KB,
|
.regionSize = CY_PROT_SIZE_512KB,
|
||||||
.subregions = ALL_SUBREGIONS,
|
.subregions = ALL_SUBREGIONS,
|
||||||
.userPermission = CY_PROT_PERM_RX,
|
.userPermission = CY_PROT_PERM_RX,
|
||||||
|
/*.privPermission = CY_PROT_PERM_RX,*/
|
||||||
.privPermission = CY_PROT_PERM_RWX,
|
.privPermission = CY_PROT_PERM_RWX,
|
||||||
.secure = true,
|
.secure = true,
|
||||||
.pcMatch = false,
|
.pcMatch = false,
|
||||||
|
@ -85,6 +60,7 @@ const cy_smpu_region_config_t sram_spm_smpu_config[] = {
|
||||||
.regionSize = CY_PROT_SIZE_64KB,
|
.regionSize = CY_PROT_SIZE_64KB,
|
||||||
.subregions = ALL_SUBREGIONS,
|
.subregions = ALL_SUBREGIONS,
|
||||||
.userPermission = CY_PROT_PERM_DISABLED,
|
.userPermission = CY_PROT_PERM_DISABLED,
|
||||||
|
/*.privPermission = CY_PROT_PERM_RW,*/
|
||||||
.privPermission = CY_PROT_PERM_RWX,
|
.privPermission = CY_PROT_PERM_RWX,
|
||||||
.secure = true,
|
.secure = true,
|
||||||
.pcMatch = false,
|
.pcMatch = false,
|
||||||
|
@ -164,6 +140,7 @@ const cy_ppu_fixed_rg_cfg_t fixed_rg_spm_ppu_config[] = {
|
||||||
.privPermission = CY_PROT_PERM_RW,
|
.privPermission = CY_PROT_PERM_RW,
|
||||||
.secure = false,
|
.secure = false,
|
||||||
.pcMatch = false,
|
.pcMatch = false,
|
||||||
|
/*.pcMask = CY_PROT_PCMASK7,*/
|
||||||
.pcMask = ALL_PROTECTION_CONTEXTS_MASK - CY_PROT_PCMASK7,
|
.pcMask = ALL_PROTECTION_CONTEXTS_MASK - CY_PROT_PCMASK7,
|
||||||
.userMstPermission = CY_PROT_PERM_R,
|
.userMstPermission = CY_PROT_PERM_R,
|
||||||
.privMstPermission = CY_PROT_PERM_RW,
|
.privMstPermission = CY_PROT_PERM_RW,
|
||||||
|
@ -188,6 +165,7 @@ const cy_ppu_fixed_rg_cfg_t fixed_rg_spm_ppu_config[] = {
|
||||||
.privPermission = CY_PROT_PERM_RW,
|
.privPermission = CY_PROT_PERM_RW,
|
||||||
.secure = false,
|
.secure = false,
|
||||||
.pcMatch = false,
|
.pcMatch = false,
|
||||||
|
/*.pcMask = CY_PROT_PCMASK7,*/
|
||||||
.pcMask = ALL_PROTECTION_CONTEXTS_MASK - CY_PROT_PCMASK7,
|
.pcMask = ALL_PROTECTION_CONTEXTS_MASK - CY_PROT_PCMASK7,
|
||||||
.userMstPermission = CY_PROT_PERM_R,
|
.userMstPermission = CY_PROT_PERM_R,
|
||||||
.privMstPermission = CY_PROT_PERM_RW,
|
.privMstPermission = CY_PROT_PERM_RW,
|
||||||
|
@ -478,6 +456,8 @@ const cy_ppu_fixed_sl_cfg_t fixed_sl_pc0_ppu_config[] = {
|
||||||
.pPpuStr = PERI_GR_PPU_SL_PERI_GR2,
|
.pPpuStr = PERI_GR_PPU_SL_PERI_GR2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
/*.userPermission = CY_PROT_PERM_DISABLED,
|
||||||
|
.privPermission = CY_PROT_PERM_DISABLED,*/
|
||||||
.userPermission = CY_PROT_PERM_RW,
|
.userPermission = CY_PROT_PERM_RW,
|
||||||
.privPermission = CY_PROT_PERM_RW,
|
.privPermission = CY_PROT_PERM_RW,
|
||||||
.secure = false,
|
.secure = false,
|
||||||
|
@ -577,6 +557,11 @@ const cy_ppu_fixed_sl_cfg_t fixed_sl_spm_ppu_config[] = {
|
||||||
.pPpuStr = PERI_GR_PPU_SL_CRYPTO,
|
.pPpuStr = PERI_GR_PPU_SL_CRYPTO,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
.userPermission = CY_PROT_PERM_RW,
|
||||||
|
.privPermission = CY_PROT_PERM_RW,
|
||||||
|
.secure = false,
|
||||||
|
.pcMatch = false,
|
||||||
|
.pcMask = ALL_PROTECTION_CONTEXTS_MASK,
|
||||||
/*
|
/*
|
||||||
.userPermission = CY_PROT_PERM_DISABLED,
|
.userPermission = CY_PROT_PERM_DISABLED,
|
||||||
.privPermission = CY_PROT_PERM_RW,
|
.privPermission = CY_PROT_PERM_RW,
|
||||||
|
@ -584,12 +569,6 @@ const cy_ppu_fixed_sl_cfg_t fixed_sl_spm_ppu_config[] = {
|
||||||
.pcMatch = false,
|
.pcMatch = false,
|
||||||
.pcMask = SECURE_CONTEXTS_MASK,
|
.pcMask = SECURE_CONTEXTS_MASK,
|
||||||
*/
|
*/
|
||||||
.userPermission = CY_PROT_PERM_RW,
|
|
||||||
.privPermission = CY_PROT_PERM_RW,
|
|
||||||
.secure = false,
|
|
||||||
.pcMatch = false,
|
|
||||||
.pcMask = ALL_PROTECTION_CONTEXTS_MASK,
|
|
||||||
/* Used less secure option to have CM4 working */
|
|
||||||
.userMstPermission = CY_PROT_PERM_R,
|
.userMstPermission = CY_PROT_PERM_R,
|
||||||
.privMstPermission = CY_PROT_PERM_RW,
|
.privMstPermission = CY_PROT_PERM_RW,
|
||||||
.secureMst = true,
|
.secureMst = true,
|
||||||
|
@ -621,6 +600,11 @@ const cy_ppu_fixed_sl_cfg_t fixed_sl_spm_ppu_config[] = {
|
||||||
.pPpuStr = PERI_GR_PPU_SL_PROT,
|
.pPpuStr = PERI_GR_PPU_SL_PROT,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
.userPermission = CY_PROT_PERM_RW,
|
||||||
|
.privPermission = CY_PROT_PERM_RW,
|
||||||
|
.secure = false,
|
||||||
|
.pcMatch = false,
|
||||||
|
.pcMask = ALL_PROTECTION_CONTEXTS_MASK,
|
||||||
/*
|
/*
|
||||||
.userPermission = CY_PROT_PERM_DISABLED,
|
.userPermission = CY_PROT_PERM_DISABLED,
|
||||||
.privPermission = CY_PROT_PERM_RW,
|
.privPermission = CY_PROT_PERM_RW,
|
||||||
|
@ -628,12 +612,6 @@ const cy_ppu_fixed_sl_cfg_t fixed_sl_spm_ppu_config[] = {
|
||||||
.pcMatch = false,
|
.pcMatch = false,
|
||||||
.pcMask = SECURE_CONTEXTS_MASK,
|
.pcMask = SECURE_CONTEXTS_MASK,
|
||||||
*/
|
*/
|
||||||
.userPermission = CY_PROT_PERM_RW,
|
|
||||||
.privPermission = CY_PROT_PERM_RW,
|
|
||||||
.secure = false,
|
|
||||||
.pcMatch = false,
|
|
||||||
.pcMask = ALL_PROTECTION_CONTEXTS_MASK,
|
|
||||||
/* Used less secure option to have CM4 working */
|
|
||||||
.userMstPermission = CY_PROT_PERM_R,
|
.userMstPermission = CY_PROT_PERM_R,
|
||||||
.privMstPermission = CY_PROT_PERM_RW,
|
.privMstPermission = CY_PROT_PERM_RW,
|
||||||
.secureMst = true,
|
.secureMst = true,
|
||||||
|
@ -1198,10 +1176,10 @@ const cy_bus_master_config_t bus_masters_config[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.busMaster = CPUSS_MS_ID_TC,
|
.busMaster = CPUSS_MS_ID_TC,
|
||||||
.privileged = true,
|
.privileged = false,
|
||||||
.secure = false,
|
.secure = false,
|
||||||
.pcMask = CY_PROT_PCMASK1 + CY_PROT_PCMASK6,
|
.pcMask = CY_PROT_PCMASK7,
|
||||||
.act_pc = CY_PROT_PC1,
|
.act_pc = CY_PROT_PC7,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.busMaster = CPUSS_MS_ID_CRYPTO,
|
.busMaster = CPUSS_MS_ID_CRYPTO,
|
||||||
|
|
Loading…
Reference in New Issue