1 /*
2  * Copyright 2020-2023 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef ADC_SAR_IP_TRUSTEDFUNCTIONS_H
8 #define ADC_SAR_IP_TRUSTEDFUNCTIONS_H
9 
10 /**
11 *   @file
12 *
13 *   @addtogroup adc_sar_ip Adc Sar IPL
14 *   @{
15 */
16 
17 #ifdef __cplusplus
18 extern "C"{
19 #endif
20 
21 /*==================================================================================================
22 *                                        INCLUDE FILES
23 * 1) system and project includes
24 * 2) needed interfaces from external units
25 * 3) internal and external interfaces from this unit
26 ==================================================================================================*/
27 #include "Adc_Sar_Ip_CfgDefines.h"
28 
29 /*==================================================================================================
30 *                              SOURCE FILE VERSION INFORMATION
31 ==================================================================================================*/
32 #define ADC_SAR_IP_VENDOR_ID_TRUSTEDFUNCTIONS                      43
33 #define ADC_SAR_IP_AR_RELEASE_MAJOR_VERSION_TRUSTEDFUNCTIONS       4
34 #define ADC_SAR_IP_AR_RELEASE_MINOR_VERSION_TRUSTEDFUNCTIONS       7
35 #define ADC_SAR_IP_AR_RELEASE_REVISION_VERSION_TRUSTEDFUNCTIONS    0
36 #define ADC_SAR_IP_SW_MAJOR_VERSION_TRUSTEDFUNCTIONS               3
37 #define ADC_SAR_IP_SW_MINOR_VERSION_TRUSTEDFUNCTIONS               0
38 #define ADC_SAR_IP_SW_PATCH_VERSION_TRUSTEDFUNCTIONS               0
39 /*==================================================================================================
40 *                                     FILE VERSION CHECKS
41 ==================================================================================================*/
42 /* Check if Adc_Sar_Ip_TrustedFunctions.h file and Adc_Sar_Ip_CfgDefines.h file are of the same vendor */
43 #if (ADC_SAR_IP_VENDOR_ID_TRUSTEDFUNCTIONS != ADC_SAR_IP_VENDOR_ID_CFGDEFINES)
44     #error "Adc_Sar_Ip_TrustedFunctions.h and Adc_Sar_Ip_CfgDefines.h have different vendor ids"
45 #endif
46 
47 /* Check if Adc_Sar_Ip_TrustedFunctions.h file and Adc_Sar_Ip_CfgDefines.h file are of the same Autosar version */
48 #if ((ADC_SAR_IP_AR_RELEASE_MAJOR_VERSION_TRUSTEDFUNCTIONS != ADC_SAR_IP_AR_RELEASE_MAJOR_VERSION_CFGDEFINES) || \
49      (ADC_SAR_IP_AR_RELEASE_MINOR_VERSION_TRUSTEDFUNCTIONS != ADC_SAR_IP_AR_RELEASE_MINOR_VERSION_CFGDEFINES) || \
50      (ADC_SAR_IP_AR_RELEASE_REVISION_VERSION_TRUSTEDFUNCTIONS != ADC_SAR_IP_AR_RELEASE_REVISION_VERSION_CFGDEFINES) \
51     )
52     #error "AutoSar Version Numbers of Adc_Sar_Ip_TrustedFunctions.h and Adc_Sar_Ip_CfgDefines.h are different"
53 #endif
54 
55 /* Check if Adc_Sar_Ip_TrustedFunctions.h file and Adc_Sar_Ip_CfgDefines.h file are of the same Software version */
56 #if ((ADC_SAR_IP_SW_MAJOR_VERSION_TRUSTEDFUNCTIONS != ADC_SAR_IP_SW_MAJOR_VERSION_CFGDEFINES) || \
57      (ADC_SAR_IP_SW_MINOR_VERSION_TRUSTEDFUNCTIONS != ADC_SAR_IP_SW_MINOR_VERSION_CFGDEFINES) || \
58      (ADC_SAR_IP_SW_PATCH_VERSION_TRUSTEDFUNCTIONS != ADC_SAR_IP_SW_PATCH_VERSION_CFGDEFINES) \
59     )
60   #error "Software Version Numbers of Adc_Sar_Ip_TrustedFunctions.h and Adc_Sar_Ip_CfgDefines.h are different"
61 #endif
62 
63 /*==================================================================================================
64 *                                     FUNCTION PROTOTYPES
65 ==================================================================================================*/
66 #define ADC_START_SEC_CODE
67 #include "Adc_MemMap.h"
68 
69 #if (STD_ON == ADC_SAR_IP_ENABLE_USER_MODE_SUPPORT)
70 /**
71 * @brief        Sets the UAA bit in REG_PROT to make the instance accessible in user mode
72 * @details      Sets the UAA bit in REG_PROT to make the instance accessible in user mode
73 *
74 * @param[in]    Instance    Adc instance index
75 * @retval       none
76 *
77 * @pre          The user mode is enabled
78 *
79 */
80 extern void Adc_Sar_Ip_SetUserAccessAllowed(const uint32 Instance);
81 
82 /**
83 * @brief        Clears the UAA bit in REG_PROT to make the instance inaccessible in user mode.
84 * @details      Clears the UAA bit in REG_PROT to make the instance inaccessible in user mode.
85 *
86 * @param[in]    Instance    Adc instance index
87 * @retval       none
88 *
89 * @pre          The user mode is enabled
90 *
91 */
92 extern void Adc_Sar_Ip_ClrUserAccessAllowed(const uint32 Instance);
93 
94 #endif /* (STD_ON == ADC_SAR_IP_ENABLE_USER_MODE_SUPPORT) */
95 
96 #define ADC_STOP_SEC_CODE
97 #include "Adc_MemMap.h"
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 /** @} */
104 
105 #endif /* ADC_SAR_IP_TRUSTEDFUNCTIONS_H */
106