Skip to content

Commit b2d2cae

Browse files
author
Oren Cohen
committed
License
1 parent f1d3eb9 commit b2d2cae

File tree

3 files changed

+539
-609
lines changed

3 files changed

+539
-609
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_FUTURE_SEQUANA_M0_PSA/cyprotection.c

Lines changed: 46 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,25 @@
1-
/***************************************************************************//**
2-
* \file cyprotection.c
3-
* \version 1.0
4-
*
5-
* \brief
6-
* This is the source code for the protection unit config functions wrappers.
7-
*
8-
********************************************************************************
1+
/* mbed Microcontroller Library
2+
*
93
* \copyright
10-
*
11-
* 2018, Cypress Semiconductor Corporation
4+
5+
* (c) 2018, Cypress Semiconductor Corporation
126
* or a subsidiary of Cypress Semiconductor Corporation. All rights
137
* reserved.
148
*
15-
* This software, including source code, documentation and related
16-
* materials (�Software�), is owned by Cypress Semiconductor
17-
* Corporation or one of its subsidiaries (�Cypress�) and is protected by
18-
* and subject to worldwide patent protection (United States and foreign),
19-
* United States copyright laws and international treaty provisions.
20-
* Therefore, you may use this Software only as provided in the license
21-
* agreement accompanying the software package from which you
22-
* obtained this Software (�EULA�).
23-
*
24-
* If no EULA applies, Cypress hereby grants you a personal, non-
25-
* exclusive, non-transferable license to copy, modify, and compile the
26-
* Software source code solely for use in connection with Cypress�s
27-
* integrated circuit products. Any reproduction, modification, translation,
28-
* compilation, or representation of this Software except as specified
29-
* above is prohibited without the express written permission of Cypress.
30-
*
31-
* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO
32-
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING,
33-
* BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
34-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
35-
* PARTICULAR PURPOSE. Cypress reserves the right to make
36-
* changes to the Software without notice. Cypress does not assume any
37-
* liability arising out of the application or use of the Software or any
38-
* product or circuit described in the Software. Cypress does not
39-
* authorize its products for use in any products where a malfunction or
40-
* failure of the Cypress product may reasonably be expected to result in
41-
* significant property damage, injury or death (�High Risk Product�). By
42-
* including Cypress�s product in a High Risk Product, the manufacturer
43-
* of such system or application assumes all risk of such use and in doing
44-
* so agrees to indemnify Cypress against all liability.
45-
*
46-
******************************************************************************/
9+
* SPDX-License-Identifier: Apache-2.0
10+
*
11+
* Licensed under the Apache License, Version 2.0 (the "License");
12+
* you may not use this file except in compliance with the License.
13+
* You may obtain a copy of the License at
14+
*
15+
* http://www.apache.org/licenses/LICENSE-2.0
16+
*
17+
* Unless required by applicable law or agreed to in writing, software
18+
* distributed under the License is distributed on an "AS IS" BASIS,
19+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20+
* See the License for the specific language governing permissions and
21+
* limitations under the License.
22+
*/
4723

4824
#include "cyprotection.h"
4925

@@ -311,7 +287,7 @@ cy_en_prot_status_t bus_masters_protect(cy_bus_master_config_t bus_masters_confi
311287
* none
312288
*
313289
* Called by:
314-
* isAccessAlowedSMPU, isAccessAlowedMPU
290+
* isAccessAllowedSMPU, isAccessAllowedMPU
315291
*
316292
* Note:
317293
*
@@ -359,7 +335,7 @@ static uint8_t isProtRangeMatched(uint32_t startAddrMem, uint32_t memSize, uint3
359335
}
360336

361337
/******************************************************************************
362-
* Function Name: isAccessAlowedFixedRgPPU
338+
* Function Name: isAccessAllowedFixedRgPPU
363339
******************************************************************************
364340
* Summary:
365341
* 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
379355
* isProtRangeMatched
380356
*
381357
* Called by:
382-
* isPeriferalAccessAllowed
358+
* isPeripheralAccessAllowed
383359
*
384360
* Note:
385361
*
386362
*
387363
*****************************************************************************/
388-
static uint8_t isAccessAlowedFixedRgPPU(uint32_t perStartAddr, uint32_t perSize,
364+
static uint8_t isAccessAllowedFixedRgPPU(uint32_t perStartAddr, uint32_t perSize,
389365
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
390366
{
391367
uint8_t accessAllowed = 1;
@@ -449,7 +425,7 @@ static uint8_t isAccessAlowedFixedRgPPU(uint32_t perStartAddr, uint32_t perSize,
449425
}
450426

451427
/******************************************************************************
452-
* Function Name: isAccessAlowedFixedSlPPU
428+
* Function Name: isAccessAllowedFixedSlPPU
453429
******************************************************************************
454430
* Summary:
455431
* 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,
469445
* isProtRangeMatched
470446
*
471447
* Called by:
472-
* isPeriferalAccessAllowed
448+
* isPeripheralAccessAllowed
473449
*
474450
* Note:
475451
*
476452
*
477453
*****************************************************************************/
478-
static uint8_t isAccessAlowedFixedSlPPU(uint32_t perStartAddr, uint32_t perSize,
454+
static uint8_t isAccessAllowedFixedSlPPU(uint32_t perStartAddr, uint32_t perSize,
479455
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
480456
{
481457
uint8_t accessAllowed = 1;
@@ -573,7 +549,7 @@ static uint8_t isAccessAlowedFixedSlPPU(uint32_t perStartAddr, uint32_t perSize,
573549
}
574550

575551
/******************************************************************************
576-
* Function Name: isAccessAlowedProgPPU
552+
* Function Name: isAccessAllowedProgPPU
577553
******************************************************************************
578554
* Summary:
579555
* 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,
593569
* isProtRangeMatched
594570
*
595571
* Called by:
596-
* isPeriferalAccessAllowed
572+
* isPeripheralAccessAllowed
597573
*
598574
* Note:
599575
*
600576
*
601577
*****************************************************************************/
602-
static uint8_t isAccessAlowedProgPPU(uint32_t perStartAddr, uint32_t perSize,
578+
static uint8_t isAccessAllowedProgPPU(uint32_t perStartAddr, uint32_t perSize,
603579
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
604580
{
605581
uint8_t accessAllowed = 1;
@@ -660,7 +636,7 @@ static uint8_t isAccessAlowedProgPPU(uint32_t perStartAddr, uint32_t perSize,
660636
}
661637

662638
/******************************************************************************
663-
* Function Name: isAccessAlowedGrPPU
639+
* Function Name: isAccessAllowedGrPPU
664640
******************************************************************************
665641
* Summary:
666642
* 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,
680656
* isProtRangeMatched
681657
*
682658
* Called by:
683-
* isPeriferalAccessAllowed
659+
* isPeripheralAccessAllowed
684660
*
685661
* Note:
686662
*
687663
*
688664
*****************************************************************************/
689-
static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
665+
static uint8_t isAccessAllowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
690666
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
691667
{
692668
uint8_t accessAllowed = 1;
@@ -750,7 +726,7 @@ static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
750726
}
751727

752728
/******************************************************************************
753-
* Function Name: isPeriferalAccessAllowed
729+
* Function Name: isPeripheralAccessAllowed
754730
******************************************************************************
755731
* Summary:
756732
* Checks if the given peripheral region is protected by PPU
@@ -767,7 +743,8 @@ static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
767743
* uint8_t accessAllowed (values: 0 (no) /1 (yes))
768744
*
769745
* Calls:
770-
* isAccessAlowedGrPPU, isAccessAlowedProgPPU, isAccessAlowedFixedPPU, isAccessAlowedRegionPPU
746+
* isAccessAllowedGrPPU, isAccessAllowedProgPPU, isAccessAllowedFixedPPU,
747+
* isAccessAllowedRegionPPU
771748
*
772749
* Called by:
773750
* none
@@ -776,30 +753,30 @@ static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
776753
*
777754
*
778755
*****************************************************************************/
779-
uint8_t isPeriferalAccessAllowed(uint32_t perStartAddr, uint32_t perSize,
756+
uint8_t isPeripheralAccessAllowed(uint32_t perStartAddr, uint32_t perSize,
780757
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
781758
{
782759
uint8_t accessAllowed;
783760

784-
accessAllowed = isAccessAlowedGrPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
761+
accessAllowed = isAccessAllowedGrPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
785762
if (accessAllowed)
786763
{
787-
accessAllowed = isAccessAlowedProgPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
764+
accessAllowed = isAccessAllowedProgPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
788765
}
789766
if (accessAllowed)
790767
{
791-
accessAllowed = isAccessAlowedFixedSlPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
768+
accessAllowed = isAccessAllowedFixedSlPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
792769
}
793770
if (accessAllowed)
794771
{
795-
accessAllowed = isAccessAlowedFixedRgPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
772+
accessAllowed = isAccessAllowedFixedRgPPU(perStartAddr, perSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
796773
}
797774

798775
return accessAllowed;
799776
}
800777

801778
/******************************************************************************
802-
* Function Name: isAccessAlowedSMPU
779+
* Function Name: isAccessAllowedSMPU
803780
******************************************************************************
804781
* Summary:
805782
* 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,
825802
*
826803
*
827804
*****************************************************************************/
828-
static uint8_t isAccessAlowedSMPU(uint32_t memStartAddr, uint32_t memSize,
805+
static uint8_t isAccessAllowedSMPU(uint32_t memStartAddr, uint32_t memSize,
829806
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType)
830807
{
831808
uint8_t accessAllowed = 1;
@@ -887,7 +864,7 @@ static uint8_t isAccessAlowedSMPU(uint32_t memStartAddr, uint32_t memSize,
887864
}
888865

889866
/******************************************************************************
890-
* Function Name: isAccessAlowedMPU
867+
* Function Name: isAccessAllowedMPU
891868
******************************************************************************
892869
* Summary:
893870
* 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,
912889
*
913890
*
914891
*****************************************************************************/
915-
static uint8_t isAccessAlowedMPU(uint32_t memStartAddr, uint32_t memSize,
892+
static uint8_t isAccessAllowedMPU(uint32_t memStartAddr, uint32_t memSize,
916893
uint8_t privModeFlag, uint8_t nsecureFlag, cy_en_prot_perm_t accessType)
917894
{
918895
uint8_t accessAllowed = 1;
@@ -982,7 +959,7 @@ static uint8_t isAccessAlowedMPU(uint32_t memStartAddr, uint32_t memSize,
982959
* uint8_t accessAllowed (values: 0 (no) /1 (yes))
983960
*
984961
* Calls:
985-
* CheckEnabledMPUProtection, isAccessAlowedSMPU
962+
* CheckEnabledMPUProtection, isAccessAllowedSMPU
986963
*
987964
* Called by:
988965
* none
@@ -996,10 +973,10 @@ uint8_t isMemoryAccessAllowed(uint32_t memStartAddr, uint32_t memSize,
996973
{
997974
uint8_t accessAllowed;
998975

999-
accessAllowed = isAccessAlowedMPU(memStartAddr, memSize, privModeFlag, nsecureFlag, accessType);
976+
accessAllowed = isAccessAllowedMPU(memStartAddr, memSize, privModeFlag, nsecureFlag, accessType);
1000977
if (accessAllowed)
1001978
{
1002-
accessAllowed = isAccessAlowedSMPU(memStartAddr, memSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
979+
accessAllowed = isAccessAllowedSMPU(memStartAddr, memSize, privModeFlag, nsecureFlag, protectionCtx, accessType);
1003980
}
1004981

1005982
return accessAllowed;

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_FUTURE_SEQUANA_M0_PSA/cyprotection.h

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,25 @@
1-
/***************************************************************************//**
2-
* \file cyprotection.h
3-
* \version 1.0
4-
*
5-
* \brief
6-
* This is the header file for the protection configuration structures
7-
* and functions.
8-
*
9-
********************************************************************************
1+
/* mbed Microcontroller Library
2+
*
103
* \copyright
11-
*
12-
* 2018, Cypress Semiconductor Corporation
4+
5+
* (c) 2018, Cypress Semiconductor Corporation
136
* or a subsidiary of Cypress Semiconductor Corporation. All rights
147
* reserved.
158
*
16-
* This software, including source code, documentation and related
17-
* materials (�Software�), is owned by Cypress Semiconductor
18-
* Corporation or one of its subsidiaries (�Cypress�) and is protected by
19-
* and subject to worldwide patent protection (United States and foreign),
20-
* United States copyright laws and international treaty provisions.
21-
* Therefore, you may use this Software only as provided in the license
22-
* agreement accompanying the software package from which you
23-
* obtained this Software (�EULA�).
9+
* SPDX-License-Identifier: Apache-2.0
2410
*
25-
* If no EULA applies, Cypress hereby grants you a personal, non-
26-
* exclusive, non-transferable license to copy, modify, and compile the
27-
* Software source code solely for use in connection with Cypress�s
28-
* integrated circuit products. Any reproduction, modification, translation,
29-
* compilation, or representation of this Software except as specified
30-
* above is prohibited without the express written permission of Cypress.
11+
* Licensed under the Apache License, Version 2.0 (the "License");
12+
* you may not use this file except in compliance with the License.
13+
* You may obtain a copy of the License at
3114
*
32-
* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO
33-
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING,
34-
* BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
35-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
36-
* PARTICULAR PURPOSE. Cypress reserves the right to make
37-
* changes to the Software without notice. Cypress does not assume any
38-
* liability arising out of the application or use of the Software or any
39-
* product or circuit described in the Software. Cypress does not
40-
* authorize its products for use in any products where a malfunction or
41-
* failure of the Cypress product may reasonably be expected to result in
42-
* significant property damage, injury or death (�High Risk Product�). By
43-
* including Cypress�s product in a High Risk Product, the manufacturer
44-
* of such system or application assumes all risk of such use and in doing
45-
* so agrees to indemnify Cypress against all liability.
15+
* http://www.apache.org/licenses/LICENSE-2.0
4616
*
47-
******************************************************************************/
17+
* Unless required by applicable law or agreed to in writing, software
18+
* distributed under the License is distributed on an "AS IS" BASIS,
19+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20+
* See the License for the specific language governing permissions and
21+
* limitations under the License.
22+
*/
4823

4924
#ifndef _CYPROTECTION_H_
5025
#define _CYPROTECTION_H_
@@ -181,7 +156,7 @@ cy_en_prot_status_t ppu_prog_protect(cy_ppu_prog_cfg_t ppu_config_arr[], uint32_
181156
cy_en_prot_status_t ppu_fixed_gr_protect(cy_ppu_fixed_gr_cfg_t ppu_config_arr[], uint32_t arr_length);
182157
cy_en_prot_status_t bus_masters_protect(cy_bus_master_config_t bus_masters_config_arr[], uint32_t arr_length);
183158

184-
uint8_t isPeriferalAccessAllowed(uint32_t perStartAddr, uint32_t perSize,
159+
uint8_t isPeripheralAccessAllowed(uint32_t perStartAddr, uint32_t perSize,
185160
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType);
186161
uint8_t isMemoryAccessAllowed(uint32_t memStartAddr, uint32_t memSize,
187162
uint8_t privModeFlag, uint8_t nsecureFlag, enum cy_en_prot_pc_t protectionCtx, cy_en_prot_perm_t accessType);

0 commit comments

Comments
 (0)