1 /*
2  * Copyright 2021-2024 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef EMIOS_ICU_IP_DEFINES_H
8 #define EMIOS_ICU_IP_DEFINES_H
9 
10 /**
11  *   @file
12  *   @implements Emios_Icu_Ip_Defines.h_Artifact
13  *   @addtogroup emios_icu_ip EMIOS 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 "Std_Types.h"
28 /* Include platform header file. */
29 #include "S32Z2_EMIOS.h"
30 
31 /*==================================================================================================
32  *                              SOURCE FILE VERSION INFORMATION
33  *================================================================================================*/
34 #define EMIOS_ICU_IP_DEFINES_VENDOR_ID                       43
35 #define EMIOS_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION        4
36 #define EMIOS_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION        7
37 #define EMIOS_ICU_IP_DEFINES_AR_RELEASE_REVISION_VERSION     0
38 #define EMIOS_ICU_IP_DEFINES_SW_MAJOR_VERSION                2
39 #define EMIOS_ICU_IP_DEFINES_SW_MINOR_VERSION                0
40 #define EMIOS_ICU_IP_DEFINES_SW_PATCH_VERSION                0
41 
42 /*==================================================================================================
43 *                                       FILE VERSION CHECKS
44 ==================================================================================================*/
45 /* Check if header file and Std_Types.h file are of the same Autosar version */
46 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
47     #if ((EMIOS_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
48          (EMIOS_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
49         #error "AutoSar Version Numbers of Emios_Icu_Ip_Defines.h and Std_Types.h are different"
50     #endif
51 #endif
52 
53 /*==================================================================================================
54 *                                            CONSTANTS
55 ==================================================================================================*/
56 
57 /*==================================================================================================
58 *                                       DEFINES AND MACROS
59 ==================================================================================================*/
60 
61 #define EMIOS_ICU_IP_USED                        (STD_ON)
62 
63 #if (STD_ON == EMIOS_ICU_IP_USED)
64 
65 #define EMIOS_ICU_IP_CHANNEL_24_USED              (STD_ON)
66 
67 /** @brief The number of EMIOS instances available on platform */
68 #define EMIOS_ICU_IP_INSTANCE_COUNT               (2U)
69 
70 /** @brief The number of channels available on each EMIOS instance */
71 #define EMIOS_ICU_IP_NUM_OF_CHANNELS              (32U)
72 
73 /** @brief The number of eMios channels are used in configuration */
74 #define EMIOS_ICU_IP_NUM_OF_CHANNELS_USED         ((uint8)48U)
75 
76 #define EMIOS_ICU_IP_CHANNEL_NOT_USED             ((uint8)0xFF)
77 
78 #define EMIOS_ICU_IP_MASTERBUS_CHANNEL_USED       ((uint8)0xFE)
79 
80 /** @brief Switches the Development Error Detection and Notification on or off.  */
81 #define EMIOS_ICU_IP_DEV_ERROR_DETECT             (STD_OFF)
82 #define EMIOS_ICU_IP_VALIDATE_GLOBAL_CALL         (EMIOS_ICU_IP_DEV_ERROR_DETECT)
83 
84 
85 /** @brief Adds or removes all services related to the timestamp functionality. */
86 #define EMIOS_ICU_IP_TIMESTAMP_API                (STD_ON)
87 /** @brief Adds or removes all services related to the edge detect functionality. */
88 #define EMIOS_ICU_IP_EDGE_DETECT_API              (STD_ON)
89 /** @brief Adds or removes all services related to the signal mesurement functionality. */
90 #define EMIOS_ICU_IP_SIGNAL_MEASUREMENT_API       (STD_ON)
91 /** @brief Adds or removes all services related to the input level. */
92 #define EMIOS_ICU_IP_GET_INPUT_LEVEL_API          (STD_ON)
93 /** @brief Adds or removes all services related to the deinitialization functionality. */
94 #define EMIOS_ICU_IP_DEINIT_API                   (STD_ON)
95 /** @brief Adds or removes all services related to edge count functionality. */
96 #define EMIOS_ICU_IP_EDGE_COUNT_API               (STD_ON)
97 
98 #define EMIOS_ICU_IP_CAPTURERGISTER_API           (STD_ON)
99 
100 /** @brief Adds or Removes the code related to overflow notification */
101 #define EMIOS_ICU_IP_OVERFLOW_NOTIFICATION_API    (STD_ON)
102 
103 /** @brief Define if global variables need to be placed in non-cache area or not */
104 #define EMIOS_ICU_IP_NO_CACHE_USED                (STD_OFF)
105 
106 /** @brief define SAIC mode if any channels not supporting IPWM or IPM mode is configured. */
107 #define EMIOS_ICU_IP_SIGNAL_MEASUREMENT_USES_SAIC_MODE  (STD_ON)
108 
109 /** @brief Adds or removes the service set Max Counter for eMios. */
110 #define EMIOS_ICU_IP_SET_MAX_COUNTER              (STD_ON)
111 
112 /** @brief Adds or removes the service set Initial Counter for eMios. */
113 #define EMIOS_ICU_IP_SET_INITIAL_COUNTER          (STD_ON)
114 
115 /** @brief Adds or removes all services related to mode set functionality. */
116 #define EMIOS_ICU_IP_SET_MODE_API                 (STD_OFF)
117 
118 /** @brief Adds or removes all services related to input state functionality. */
119 #define EMIOS_ICU_IP_GET_INPUT_STATE_API          (STD_ON)
120 
121 /** @brief Adds or removes all services related to dual clock edge functionality. */
122 #define EMIOS_ICU_IP_DUAL_CLOCK_MODE_API          (STD_ON)
123 
124 /** @brief Adds or removes the support measurement with DMA. */
125 #define EMIOS_ICU_IP_SIGNALMEASUREMENT_USES_DMA   (STD_OFF)
126 #define EMIOS_ICU_IP_TIMESTAMP_USES_DMA           (STD_OFF)
127 
128 /** @brief Adds or removes the support measurement with DMA in IPL */
129 #define EMIOS_ICU_IP_SIGNALMEASUREMENT_USES_DMA_IPL   (STD_OFF)
130 #define EMIOS_ICU_IP_DMA_MAJORLOOP_COUNT              (2U)
131 #define EMIOS_ICU_IP_TIMESTAMP_USES_DMA_IPL           (STD_OFF)
132 
133 #define EMIOS_ICU_IP_GET_PULSE_WIDTH_API          (STD_ON)
134     #define EMIOS_ICU_IP_WSC_SUPPORT                  (STD_ON)
135 
136 #if (STD_ON == EMIOS_ICU_IP_WSC_SUPPORT)
137 #define EMIOS_ICU_IP_WSC_CHANNEL_OFFSET           (4U)
138 
139 #define EMIOS_ICU_IP_WSC_NUM_OF_CHANNELS          (4U)
140 #endif
141 
142 /** @brief Support for User mode.
143  *  If this parameter has been configured to STD_ON, the EMIOS driver code
144  *  can be executed from both supervisor and user mode. */
145 #define EMIOS_ICU_IP_ENABLE_USER_MODE_SUPPORT     (STD_OFF)
146 
147 /* Verification for user mode support. */
148 #ifndef MCAL_ENABLE_USER_MODE_SUPPORT
149     #if (defined (EMIOS_ICU_IP_ENABLE_USER_MODE_SUPPORT) && (STD_ON == EMIOS_ICU_IP_ENABLE_USER_MODE_SUPPORT))
150         #error MCAL_ENABLE_USER_MODE_SUPPORT is not enabled. For running Icu in user mode the MCAL_ENABLE_USER_MODE_SUPPORT needs to be defined
151     #endif
152 #endif
153 
154 #define EMIOS_ICU_USES_MCL_DRIVER          (STD_OFF)
155 
156 #if ((EMIOS_ICU_IP_EDGE_COUNT_API == STD_ON) || (EMIOS_ICU_IP_SIGNAL_MEASUREMENT_API == STD_ON) || (EMIOS_ICU_IP_TIMESTAMP_API == STD_ON))
157 #define EMIOS_ICU_IP_COUNTER_MASK              ((uint32)16777215)
158 #endif
159 
160 #define EMIOS_ICU_IP_INITIAL_INDEX_OF_CHANNELS \
161     { \
162         {0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U, 255U, 255U, 255U, 255U, 255U, 255U, 255U, 255U, 8U, 9U, 10U, 11U, 12U, 13U, 14U, 15U, 16U, 17U, 18U, 19U, 20U, 21U, 22U, 23U}, \
163         {24U, 25U, 26U, 27U, 28U, 29U, 30U, 31U, 255U, 255U, 255U, 255U, 255U, 255U, 255U, 255U, 32U, 33U, 34U, 35U, 36U, 37U, 38U, 39U, 40U, 41U, 42U, 43U, 44U, 45U, 46U, 47U} \
164     } \
165 
166 /*==================================================================================================
167 *                                              ENUMS
168 ==================================================================================================*/
169 
170 /*==================================================================================================
171 *                                  STRUCTURES AND OTHER TYPEDEFS
172 ==================================================================================================*/
173 /**
174 *   @brief Implementation specific. This type shall be chosen in order to have the most efficient
175 *       implementation on a specific microcontroller platform.
176 *       Range: 0  to width of the timer register.
177 *       Description: Width of the buffer for timestamp ticks and measured elapsed timeticks
178 */
179 typedef uint32 eMios_Icu_ValueType;
180 
181 /*==================================================================================================
182 *                                  GLOBAL VARIABLE DECLARATIONS
183 ==================================================================================================*/
184 
185 /*==================================================================================================
186 *                                       FUNCTION PROTOTYPES
187 ==================================================================================================*/
188 
189 
190 #endif  /* EMIOS_ICU_IP_USED */
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 /** @} */
197 
198 #endif  /* EMIOS_ICU_IP_DEFINES_H */
199 
200