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
+ *
9
3
* \copyright
10
- *
11
- * � 2018, Cypress Semiconductor Corporation
4
+
5
+ * (c) 2018, Cypress Semiconductor Corporation
12
6
* or a subsidiary of Cypress Semiconductor Corporation. All rights
13
7
* reserved.
14
8
*
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
+ */
47
23
48
24
#include "cyprotection.h"
49
25
@@ -311,7 +287,7 @@ cy_en_prot_status_t bus_masters_protect(cy_bus_master_config_t bus_masters_confi
311
287
* none
312
288
*
313
289
* Called by:
314
- * isAccessAlowedSMPU, isAccessAlowedMPU
290
+ * isAccessAllowedSMPU, isAccessAllowedMPU
315
291
*
316
292
* Note:
317
293
*
@@ -359,7 +335,7 @@ static uint8_t isProtRangeMatched(uint32_t startAddrMem, uint32_t memSize, uint3
359
335
}
360
336
361
337
/******************************************************************************
362
- * Function Name: isAccessAlowedFixedRgPPU
338
+ * Function Name: isAccessAllowedFixedRgPPU
363
339
******************************************************************************
364
340
* Summary:
365
341
* 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
379
355
* isProtRangeMatched
380
356
*
381
357
* Called by:
382
- * isPeriferalAccessAllowed
358
+ * isPeripheralAccessAllowed
383
359
*
384
360
* Note:
385
361
*
386
362
*
387
363
*****************************************************************************/
388
- static uint8_t isAccessAlowedFixedRgPPU (uint32_t perStartAddr , uint32_t perSize ,
364
+ static uint8_t isAccessAllowedFixedRgPPU (uint32_t perStartAddr , uint32_t perSize ,
389
365
uint8_t privModeFlag , uint8_t nsecureFlag , enum cy_en_prot_pc_t protectionCtx , cy_en_prot_perm_t accessType )
390
366
{
391
367
uint8_t accessAllowed = 1 ;
@@ -449,7 +425,7 @@ static uint8_t isAccessAlowedFixedRgPPU(uint32_t perStartAddr, uint32_t perSize,
449
425
}
450
426
451
427
/******************************************************************************
452
- * Function Name: isAccessAlowedFixedSlPPU
428
+ * Function Name: isAccessAllowedFixedSlPPU
453
429
******************************************************************************
454
430
* Summary:
455
431
* 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,
469
445
* isProtRangeMatched
470
446
*
471
447
* Called by:
472
- * isPeriferalAccessAllowed
448
+ * isPeripheralAccessAllowed
473
449
*
474
450
* Note:
475
451
*
476
452
*
477
453
*****************************************************************************/
478
- static uint8_t isAccessAlowedFixedSlPPU (uint32_t perStartAddr , uint32_t perSize ,
454
+ static uint8_t isAccessAllowedFixedSlPPU (uint32_t perStartAddr , uint32_t perSize ,
479
455
uint8_t privModeFlag , uint8_t nsecureFlag , enum cy_en_prot_pc_t protectionCtx , cy_en_prot_perm_t accessType )
480
456
{
481
457
uint8_t accessAllowed = 1 ;
@@ -573,7 +549,7 @@ static uint8_t isAccessAlowedFixedSlPPU(uint32_t perStartAddr, uint32_t perSize,
573
549
}
574
550
575
551
/******************************************************************************
576
- * Function Name: isAccessAlowedProgPPU
552
+ * Function Name: isAccessAllowedProgPPU
577
553
******************************************************************************
578
554
* Summary:
579
555
* 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,
593
569
* isProtRangeMatched
594
570
*
595
571
* Called by:
596
- * isPeriferalAccessAllowed
572
+ * isPeripheralAccessAllowed
597
573
*
598
574
* Note:
599
575
*
600
576
*
601
577
*****************************************************************************/
602
- static uint8_t isAccessAlowedProgPPU (uint32_t perStartAddr , uint32_t perSize ,
578
+ static uint8_t isAccessAllowedProgPPU (uint32_t perStartAddr , uint32_t perSize ,
603
579
uint8_t privModeFlag , uint8_t nsecureFlag , enum cy_en_prot_pc_t protectionCtx , cy_en_prot_perm_t accessType )
604
580
{
605
581
uint8_t accessAllowed = 1 ;
@@ -660,7 +636,7 @@ static uint8_t isAccessAlowedProgPPU(uint32_t perStartAddr, uint32_t perSize,
660
636
}
661
637
662
638
/******************************************************************************
663
- * Function Name: isAccessAlowedGrPPU
639
+ * Function Name: isAccessAllowedGrPPU
664
640
******************************************************************************
665
641
* Summary:
666
642
* 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,
680
656
* isProtRangeMatched
681
657
*
682
658
* Called by:
683
- * isPeriferalAccessAllowed
659
+ * isPeripheralAccessAllowed
684
660
*
685
661
* Note:
686
662
*
687
663
*
688
664
*****************************************************************************/
689
- static uint8_t isAccessAlowedGrPPU (uint32_t perStartAddr , uint32_t perSize ,
665
+ static uint8_t isAccessAllowedGrPPU (uint32_t perStartAddr , uint32_t perSize ,
690
666
uint8_t privModeFlag , uint8_t nsecureFlag , enum cy_en_prot_pc_t protectionCtx , cy_en_prot_perm_t accessType )
691
667
{
692
668
uint8_t accessAllowed = 1 ;
@@ -750,7 +726,7 @@ static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
750
726
}
751
727
752
728
/******************************************************************************
753
- * Function Name: isPeriferalAccessAllowed
729
+ * Function Name: isPeripheralAccessAllowed
754
730
******************************************************************************
755
731
* Summary:
756
732
* Checks if the given peripheral region is protected by PPU
@@ -767,7 +743,8 @@ static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
767
743
* uint8_t accessAllowed (values: 0 (no) /1 (yes))
768
744
*
769
745
* Calls:
770
- * isAccessAlowedGrPPU, isAccessAlowedProgPPU, isAccessAlowedFixedPPU, isAccessAlowedRegionPPU
746
+ * isAccessAllowedGrPPU, isAccessAllowedProgPPU, isAccessAllowedFixedPPU,
747
+ * isAccessAllowedRegionPPU
771
748
*
772
749
* Called by:
773
750
* none
@@ -776,30 +753,30 @@ static uint8_t isAccessAlowedGrPPU(uint32_t perStartAddr, uint32_t perSize,
776
753
*
777
754
*
778
755
*****************************************************************************/
779
- uint8_t isPeriferalAccessAllowed (uint32_t perStartAddr , uint32_t perSize ,
756
+ uint8_t isPeripheralAccessAllowed (uint32_t perStartAddr , uint32_t perSize ,
780
757
uint8_t privModeFlag , uint8_t nsecureFlag , enum cy_en_prot_pc_t protectionCtx , cy_en_prot_perm_t accessType )
781
758
{
782
759
uint8_t accessAllowed ;
783
760
784
- accessAllowed = isAccessAlowedGrPPU (perStartAddr , perSize , privModeFlag , nsecureFlag , protectionCtx , accessType );
761
+ accessAllowed = isAccessAllowedGrPPU (perStartAddr , perSize , privModeFlag , nsecureFlag , protectionCtx , accessType );
785
762
if (accessAllowed )
786
763
{
787
- accessAllowed = isAccessAlowedProgPPU (perStartAddr , perSize , privModeFlag , nsecureFlag , protectionCtx , accessType );
764
+ accessAllowed = isAccessAllowedProgPPU (perStartAddr , perSize , privModeFlag , nsecureFlag , protectionCtx , accessType );
788
765
}
789
766
if (accessAllowed )
790
767
{
791
- accessAllowed = isAccessAlowedFixedSlPPU (perStartAddr , perSize , privModeFlag , nsecureFlag , protectionCtx , accessType );
768
+ accessAllowed = isAccessAllowedFixedSlPPU (perStartAddr , perSize , privModeFlag , nsecureFlag , protectionCtx , accessType );
792
769
}
793
770
if (accessAllowed )
794
771
{
795
- accessAllowed = isAccessAlowedFixedRgPPU (perStartAddr , perSize , privModeFlag , nsecureFlag , protectionCtx , accessType );
772
+ accessAllowed = isAccessAllowedFixedRgPPU (perStartAddr , perSize , privModeFlag , nsecureFlag , protectionCtx , accessType );
796
773
}
797
774
798
775
return accessAllowed ;
799
776
}
800
777
801
778
/******************************************************************************
802
- * Function Name: isAccessAlowedSMPU
779
+ * Function Name: isAccessAllowedSMPU
803
780
******************************************************************************
804
781
* Summary:
805
782
* 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,
825
802
*
826
803
*
827
804
*****************************************************************************/
828
- static uint8_t isAccessAlowedSMPU (uint32_t memStartAddr , uint32_t memSize ,
805
+ static uint8_t isAccessAllowedSMPU (uint32_t memStartAddr , uint32_t memSize ,
829
806
uint8_t privModeFlag , uint8_t nsecureFlag , enum cy_en_prot_pc_t protectionCtx , cy_en_prot_perm_t accessType )
830
807
{
831
808
uint8_t accessAllowed = 1 ;
@@ -887,7 +864,7 @@ static uint8_t isAccessAlowedSMPU(uint32_t memStartAddr, uint32_t memSize,
887
864
}
888
865
889
866
/******************************************************************************
890
- * Function Name: isAccessAlowedMPU
867
+ * Function Name: isAccessAllowedMPU
891
868
******************************************************************************
892
869
* Summary:
893
870
* 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,
912
889
*
913
890
*
914
891
*****************************************************************************/
915
- static uint8_t isAccessAlowedMPU (uint32_t memStartAddr , uint32_t memSize ,
892
+ static uint8_t isAccessAllowedMPU (uint32_t memStartAddr , uint32_t memSize ,
916
893
uint8_t privModeFlag , uint8_t nsecureFlag , cy_en_prot_perm_t accessType )
917
894
{
918
895
uint8_t accessAllowed = 1 ;
@@ -982,7 +959,7 @@ static uint8_t isAccessAlowedMPU(uint32_t memStartAddr, uint32_t memSize,
982
959
* uint8_t accessAllowed (values: 0 (no) /1 (yes))
983
960
*
984
961
* Calls:
985
- * CheckEnabledMPUProtection, isAccessAlowedSMPU
962
+ * CheckEnabledMPUProtection, isAccessAllowedSMPU
986
963
*
987
964
* Called by:
988
965
* none
@@ -996,10 +973,10 @@ uint8_t isMemoryAccessAllowed(uint32_t memStartAddr, uint32_t memSize,
996
973
{
997
974
uint8_t accessAllowed ;
998
975
999
- accessAllowed = isAccessAlowedMPU (memStartAddr , memSize , privModeFlag , nsecureFlag , accessType );
976
+ accessAllowed = isAccessAllowedMPU (memStartAddr , memSize , privModeFlag , nsecureFlag , accessType );
1000
977
if (accessAllowed )
1001
978
{
1002
- accessAllowed = isAccessAlowedSMPU (memStartAddr , memSize , privModeFlag , nsecureFlag , protectionCtx , accessType );
979
+ accessAllowed = isAccessAllowedSMPU (memStartAddr , memSize , privModeFlag , nsecureFlag , protectionCtx , accessType );
1003
980
}
1004
981
1005
982
return accessAllowed ;
0 commit comments