1 /* 2 * Copyright 2021-2024 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef EMIOS_ICU_IP_TYPES_H 8 #define EMIOS_ICU_IP_TYPES_H 9 10 /** 11 * @file Emios_Icu_Ip_[!IF "var:defined('postBuildVariant')"!][!"$postBuildVariant"!]_[!ENDIF!]PBcfg.c 12 * @version 2.0.0 13 * 14 * @brief AUTOSAR Icu - contains the data exported by the Icu module 15 * @details Contains the information that will be exported by the module, as requested by AUTOSAR. 16 * 17 * @addtogroup emios_icu_ip EMIOS IPL 18 * @{ 19 */ 20 21 #ifdef __cplusplus 22 extern "C"{ 23 #endif 24 25 /*================================================================================================== 26 INCLUDE FILES 27 1) system and project includes 28 2) needed interfaces from external units 29 3) internal and external interfaces from this unit 30 ==================================================================================================*/ 31 #include "Emios_Icu_Ip_Defines.h" 32 33 /*================================================================================================== 34 SOURCE FILE VERSION INFORMATION 35 ==================================================================================================*/ 36 #define EMIOS_ICU_IP_TYPES_VENDOR_ID 43 37 #define EMIOS_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION 4 38 #define EMIOS_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION 7 39 #define EMIOS_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION 0 40 #define EMIOS_ICU_IP_TYPES_SW_MAJOR_VERSION 2 41 #define EMIOS_ICU_IP_TYPES_SW_MINOR_VERSION 0 42 #define EMIOS_ICU_IP_TYPES_SW_PATCH_VERSION 0 43 44 /*================================================================================================== 45 FILE VERSION CHECKS 46 ==================================================================================================*/ 47 #if (EMIOS_ICU_IP_TYPES_VENDOR_ID != EMIOS_ICU_IP_DEFINES_VENDOR_ID) 48 #error "Emios_Icu_Ip_Types.h and Emios_Icu_Ip_Defines.h have different vendor ids" 49 #endif 50 51 /* Check if header file and Emios_Icu_Ip_Defines.h file are of the same Autosar version */ 52 #if ((EMIOS_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION != EMIOS_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION) || \ 53 (EMIOS_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION != EMIOS_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION) || \ 54 (EMIOS_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION != EMIOS_ICU_IP_DEFINES_AR_RELEASE_REVISION_VERSION)) 55 #error "AutoSar Version Numbers of Emios_Icu_Ip_Types.h and Emios_Icu_Ip_Defines.h are different" 56 #endif 57 58 /* Check if header file and Emios_Icu_Ip_Defines.h file are of the same Software version */ 59 #if ((EMIOS_ICU_IP_TYPES_SW_MAJOR_VERSION != EMIOS_ICU_IP_DEFINES_SW_MAJOR_VERSION) || \ 60 (EMIOS_ICU_IP_TYPES_SW_MINOR_VERSION != EMIOS_ICU_IP_DEFINES_SW_MINOR_VERSION) || \ 61 (EMIOS_ICU_IP_TYPES_SW_PATCH_VERSION != EMIOS_ICU_IP_DEFINES_SW_PATCH_VERSION)) 62 #error "Software Version Numbers of Emios_Icu_Ip_Types.h and Emios_Icu_Ip_Defines.h are different" 63 #endif 64 65 /*================================================================================================== 66 CONSTANTS 67 ==================================================================================================*/ 68 69 /*================================================================================================== 70 DEFINES AND MACROS 71 ==================================================================================================*/ 72 #if (STD_ON == EMIOS_ICU_IP_USED) 73 /** 74 * @brief EMIOS Channels defines 75 */ 76 #define EMIOS_ICU_IP_CB_NONE ((uint8)0xFF) 77 #define EMIOS_ICU_IP_CB_DIVERSE ((uint8)0x07) 78 #define EMIOS_ICU_IP_CHANNEL_0 ((uint8)0x00) 79 #define EMIOS_ICU_IP_CHANNEL_7 ((uint8)0x07) 80 #define EMIOS_ICU_IP_CHANNEL_8 ((uint8)0x08) 81 #define EMIOS_ICU_IP_CHANNEL_15 ((uint8)0x0F) 82 #define EMIOS_ICU_IP_CHANNEL_16 ((uint8)0x10) 83 #define EMIOS_ICU_IP_CHANNEL_22 ((uint8)0x16) 84 #define EMIOS_ICU_IP_CHANNEL_23 ((uint8)0x17) 85 #define EMIOS_ICU_IP_CHANNEL_24 ((uint8)0x18) 86 87 #if (STD_ON == EMIOS_ICU_IP_CHANNEL_24_USED) 88 #define EMIOS_ICU_IP_CHANNEL_31 ((uint8)0x1F) 89 #endif 90 91 #define EMIOS_ICU_IP_MCB_INT_CLOCK_U32 ((uint32)(0x50U)) 92 #if (EMIOS_ICU_IP_EDGE_COUNT_API == STD_ON) 93 #define EMIOS_ICU_IP_MCB_EXT_CLOCK_U32 ((uint32)(0x51U)) 94 #endif 95 96 #define EMIOS_ICU_IP_CCR_CLEAR_U32 ((uint32)(0x0U)) 97 #define EMIOS_ICU_IP_CSR_CLEAR_U32 ((uint32)(0xFFFFFFFFU)) 98 99 #if ((EMIOS_ICU_IP_EDGE_COUNT_API == STD_ON) || (EMIOS_ICU_IP_SIGNAL_MEASUREMENT_API == STD_ON) || (EMIOS_ICU_IP_TIMESTAMP_API == STD_ON)) 100 #define EMIOS_ICU_IP_INIT_CCNTR_U32 (0x00000000U) 101 #define EMIOS_ICU_IP_INIT_CADR_U32 ((uint32)EMIOS_ICU_IP_COUNTER_MASK) 102 #endif 103 104 #define EMIOS_ICU_IP_CCR_MODE_GPI_U32 ((uint32)(0x00)) 105 #define EMIOS_ICU_IP_CCR_MODE_SAIC_U32 ((uint32)(0x02)) 106 107 #if (EMIOS_ICU_IP_SIGNAL_MEASUREMENT_API == STD_ON) 108 #define EMIOS_ICU_IP_CCR_MODE_IPWM_U32 ((uint32)(0x04)) 109 #define EMIOS_ICU_IP_CCR_MODE_IPM_U32 ((uint32)(0x05)) 110 #endif 111 112 /*================================================================================================== 113 ENUMS 114 ==================================================================================================*/ 115 116 /** 117 * @brief eMIOS_Activation EDGE 118 * @details Indicates the channel activation type(Rising, Falling, Both Edges or Opposite Edges). 119 */ 120 typedef enum 121 { 122 /** @brief No trigger. */ 123 EMIOS_ICU_NO_PIN_CONTROL = 0x0U, 124 /** @brief Rising edge trigger. */ 125 EMIOS_ICU_RISING_EDGE = 0x1U, 126 /** @brief Rising edge trigger. */ 127 EMIOS_ICU_FALLING_EDGE = 0x2U, 128 /** @brief Rising and falling edge trigger */ 129 EMIOS_ICU_BOTH_EDGES = 0x3U 130 #if (STD_ON == EMIOS_ICU_IP_SIGNAL_MEASUREMENT_USES_SAIC_MODE) 131 /** @brief EMIOS_OPPOSITE_EDGES = An appropriate action shall be executed when either a falling or rising edge occur on the ICU input signal. */ 132 ,EMIOS_OPPOSITE_EDGES = 0x4U 133 #endif /* STD_ON == EMIOS_ICU_IP_SIGNAL_MEASUREMENT_USES_SAIC_MODE */ 134 } eMios_Icu_Ip_EdgeType; 135 136 /** @brief Operation mode for ICU driver. */ 137 typedef enum 138 { 139 /** @brief No measurement mode. */ 140 EMIOS_ICU_MODE_NO_MEASUREMENT = 0x0U, 141 /** @brief Signal edge detect measurement mode. */ 142 EMIOS_ICU_MODE_SIGNAL_EDGE_DETECT = 0x1U, 143 /** @brief Signal measurement mode.*/ 144 EMIOS_ICU_MODE_SIGNAL_MEASUREMENT = 0x2U, 145 /** @brief Timestamp measurement mode.*/ 146 EMIOS_ICU_MODE_TIMESTAMP = 0x4U, 147 /** @brief Edge counter measurement mode.*/ 148 EMIOS_ICU_MODE_EDGE_COUNTER = 0x8U 149 } eMios_Icu_Ip_ModeType; 150 151 /** @brief Enable/disable DMA support for timestamp. */ 152 typedef enum 153 { 154 /* Disable DMA support. */ 155 EMIOS_ICU_MODE_WITHOUT_DMA = 0U, 156 /* Enable DMA support. */ 157 EMIOS_ICU_MODE_WITH_DMA = 1U 158 } eMios_Icu_Ip_SubModeType; 159 160 /** @brief Stores the state in which a signal measurement is. */ 161 typedef enum 162 { 163 /* This is the initial state of measurement */ 164 EMIOS_ICU_MEASUREMENT_PENDING = 0U, 165 /* First edge has triggered - measuring duty cycle */ 166 EMIOS_ICU_MEASUREMENT_DUTY = 1U, 167 /* Second edge has triggered - measuring period */ 168 EMIOS_ICU_MEASUREMENT_PERIOD = 2U 169 } eMios_Icu_Ip_MeasStatusType; 170 171 /** @brief Type of operation for signal measurement. */ 172 typedef enum 173 { 174 /** @brief No measurement. */ 175 EMIOS_ICU_NO_MEASUREMENT = 0U, 176 /** @brief The time measurement for OFF period. */ 177 EMIOS_ICU_LOW_TIME = 1U, 178 /** @brief The time measurement for ON period. */ 179 EMIOS_ICU_HIGH_TIME = 2U, 180 /** @brief Period measurement between two consecutive falling/raising edges. */ 181 EMIOS_ICU_PERIOD_TIME = 4U, 182 /** @brief The fraction of active period. */ 183 EMIOS_ICU_DUTY_CYCLE = 8U 184 } eMios_Icu_Ip_MeasType; 185 186 #if (EMIOS_ICU_IP_TIMESTAMP_API == STD_ON) 187 /** @brief Type of operation for timestamp. */ 188 typedef enum 189 { 190 /** @brief No timestamp. */ 191 EMIOS_ICU_NO_TIMESTAMP = 0U, 192 /** @brief The timestamp with circular buffer . */ 193 EMIOS_ICU_CIRCULAR_BUFFER = 1U, 194 /** @brief The timestamp with linear buffer . */ 195 EMIOS_ICU_LINEAR_BUFFER = 2U 196 } eMios_Icu_Ip_TimestampBufferType; 197 #endif 198 199 #if (STD_ON == EMIOS_ICU_IP_GET_INPUT_LEVEL_API) 200 /** @brief Enumeration used for returning the level of input pin. */ 201 typedef enum 202 { 203 /** @brief Low level state. */ 204 EMIOS_ICU_LEVEL_LOW = 0x0U, 205 /** @brief High level state. */ 206 EMIOS_ICU_LEVEL_HIGH = 0x1U 207 } eMios_Icu_Ip_LevelType; 208 #endif 209 #if (EMIOS_ICU_IP_DUAL_CLOCK_MODE_API == STD_ON) 210 /** @brief Definition of prescaler type (Normal or Alternate) */ 211 typedef enum 212 { 213 EMIOS_ICU_NORMAL_CLK = 0x0U, /**< @brief Normal prescaler */ 214 EMIOS_ICU_ALTERNATE_CLK = 0x1U /**< @brief Alternate prescaler */ 215 } eMios_Icu_Ip_ClockModeType; 216 #endif 217 218 /** @brief Definition of master bus type */ 219 typedef enum 220 { 221 EMIOS_ICU_BUS_A = 0x0U, /**< @brief Bus A */ 222 EMIOS_ICU_BUS_DIVERSE = 0x1U, /**< @brief Bus diverse */ 223 EMIOS_ICU_BUS_F = 0x2U, /**< @brief Bus F */ 224 EMIOS_ICU_BUS_INTERNAL_COUNTER = 0x3U /**< @brief Internal counter */ 225 } eMios_Icu_Ip_BusType; 226 227 /** @brief Generic error codes. */ 228 typedef enum 229 { 230 /** @brief Generic operation success status. */ 231 EMIOS_IP_STATUS_SUCCESS = 0x00U, 232 /** @brief Generic operation failure status. */ 233 EMIOS_IP_STATUS_ERROR = 0x01U 234 } eMios_Icu_Ip_StatusType; 235 236 /** @brief Selection of the signal measurement mode when IcuSignalMeasurementProperty is ICU_DUTY_CYCLE. */ 237 typedef enum 238 { 239 /** @brief un-initialized. */ 240 EMIOS_ICU_UNINIT = 0x00U, 241 /** @brief SAIC mode. */ 242 EMIOS_ICU_SAIC = 0x01U, 243 /** @brief IPWM mode. */ 244 EMIOS_ICU_IPM = 0x02U, 245 /** @brief IPWM mode. */ 246 EMIOS_ICU_IPWM = 0x03U 247 } eMios_Icu_Ip_UCModeType; 248 249 250 /** @brief Selects the clock divider value for the UC internal prescaler. */ 251 typedef enum 252 { 253 /** @brief EMIOS_PRESCALER_DIVIDE_1. */ 254 EMIOS_PRESCALER_DIVIDE_1 = 0x00U, 255 /** @brief EMIOS_PRESCALER_DIVIDE_2. */ 256 EMIOS_PRESCALER_DIVIDE_2 = 0x01U, 257 /** @brief EMIOS_PRESCALER_DIVIDE_3. */ 258 EMIOS_PRESCALER_DIVIDE_3 = 0x02U, 259 /** @brief EMIOS_PRESCALER_DIVIDE_4. */ 260 EMIOS_PRESCALER_DIVIDE_4 = 0x03U, 261 /** @brief EMIOS_PRESCALER_DIVIDE_5. */ 262 EMIOS_PRESCALER_DIVIDE_5 = 0x04U, 263 /** @brief EMIOS_PRESCALER_DIVIDE_6. */ 264 EMIOS_PRESCALER_DIVIDE_6 = 0x05U, 265 /** @brief EMIOS_PRESCALER_DIVIDE_7. */ 266 EMIOS_PRESCALER_DIVIDE_7 = 0x06U, 267 /** @brief EMIOS_PRESCALER_DIVIDE_8. */ 268 EMIOS_PRESCALER_DIVIDE_8 = 0x07U, 269 /** @brief EMIOS_PRESCALER_DIVIDE_9. */ 270 EMIOS_PRESCALER_DIVIDE_9 = 0x08U, 271 /** @brief EMIOS_PRESCALER_DIVIDE_10. */ 272 EMIOS_PRESCALER_DIVIDE_10 = 0x09U, 273 /** @brief EMIOS_PRESCALER_DIVIDE_11. */ 274 EMIOS_PRESCALER_DIVIDE_11 = 0x0AU, 275 /** @brief EMIOS_PRESCALER_DIVIDE_12. */ 276 EMIOS_PRESCALER_DIVIDE_12 = 0x0BU, 277 /** @brief EMIOS_PRESCALER_DIVIDE_13. */ 278 EMIOS_PRESCALER_DIVIDE_13 = 0x0CU, 279 /** @brief EMIOS_PRESCALER_DIVIDE_14. */ 280 EMIOS_PRESCALER_DIVIDE_14 = 0x0DU, 281 /** @brief EMIOS_PRESCALER_DIVIDE_15. */ 282 EMIOS_PRESCALER_DIVIDE_15 = 0x0EU, 283 /** @brief EMIOS_PRESCALER_DIVIDE_16. */ 284 EMIOS_PRESCALER_DIVIDE_16 = 0x0FU 285 } eMios_Icu_Ip_PrescalerType; 286 287 /** @brief Selects the the input filter. */ 288 typedef enum 289 { 290 /** @brief EMIOS_DIGITAL_FILTER_BYPASSED. */ 291 EMIOS_DIGITAL_FILTER_BYPASSED = 0x00U, 292 /** @brief EMIOS_DIGITAL_FILTER_02. */ 293 EMIOS_DIGITAL_FILTER_02 = 0x01U, 294 /** @brief EMIOS_DIGITAL_FILTER_04. */ 295 EMIOS_DIGITAL_FILTER_04 = 0x02U, 296 /** @brief EMIOS_DIGITAL_FILTER_08. */ 297 EMIOS_DIGITAL_FILTER_08 = 0x04U, 298 /** @brief EMIOS_DIGITAL_FILTER_16. */ 299 EMIOS_DIGITAL_FILTER_16 = 0x08U 300 } eMios_Icu_Ip_FilterType; 301 302 /*================================================================================================== 303 STRUCTURES AND OTHER TYPEDEFS 304 ==================================================================================================*/ 305 /** @brief The notification functions shall have no parameters and no return value.*/ 306 typedef void (*eMios_Icu_Ip_NotifyType)(void); 307 308 /** 309 * @brief Structure that contains ICU Duty cycle parameters. It contains the values needed for 310 * calculating duty cycles i.e Period time value and active time value. 311 * @implements eMios_Icu_Ip_DutyCycleType_struct 312 */ 313 typedef struct 314 { 315 eMios_Icu_ValueType ActiveTime; /**< @brief Low or High time value. */ 316 eMios_Icu_ValueType PeriodTime; /**< @brief Period time value. */ 317 } eMios_Icu_Ip_DutyCycleType; 318 319 #if (defined EMIOS_ICU_IP_WSC_SUPPORT) 320 #if (EMIOS_ICU_IP_WSC_SUPPORT == STD_ON) 321 /** 322 * @brief Structure that contains eMios Wheel Speet Fifo data parameters. It contains 323 * the FIFO data value, Number of data entries currently contained in the FIFO, 324 * Pointer write and Pointer read. 325 * @implements eMios_Icu_Ip_WscFifoType_struct 326 */ 327 typedef struct 328 { 329 uint32 FifoData; /**< FIFO data value */ 330 uint8 FifoCounter; /**< Number of data entries currently contained in the FIFO */ 331 uint8 pWrite; /**< Pointer write */ 332 uint8 pRead; /**< Pointer read */ 333 } eMios_Icu_Ip_WscFifoType; 334 #endif /* EMIOS_ICU_IP_WSC_SUPPORT */ 335 #endif /* defined EMIOS_ICU_IP_WSC_SUPPORT */ 336 337 /** @brief HLD Callback type for each channel reporting events or events and overflow . */ 338 typedef void (*eMios_Icu_Ip_CallbackType)(uint16 callbackParam1, boolean callbackParam2); 339 340 /** @brief Callback type for each channel. */ 341 typedef void (*eMios_Icu_Ip_LogicChStateCbType)(uint16 logicChannel, uint8 mask, boolean set); 342 343 typedef struct 344 { 345 uint8 hwChannel; /*!< Channel Id */ 346 eMios_Icu_Ip_UCModeType ucMode; /*!< eMios UC mode of operation */ 347 boolean FreezeEn; /*!< Freeze enable for UC */ 348 eMios_Icu_Ip_PrescalerType Prescaler; /*!< Channel Prescaler */ 349 eMios_Icu_Ip_PrescalerType AltPrescaler; /*!< Channel Alternate Prescaler */ 350 eMios_Icu_Ip_BusType CntBus; /*!< Channel Counter bus selection */ 351 eMios_Icu_Ip_ModeType chMode; /*!< eMios module ICU mode of operation */ 352 eMios_Icu_Ip_SubModeType chSubMode; /*!< eMios ICU mode with or without DMA */ 353 eMios_Icu_Ip_MeasType measurementMode; /*!< subMode selection for Signal Measurement*/ 354 eMios_Icu_Ip_EdgeType edgeAlignement; /*!< Edge alignment for measurement */ 355 eMios_Icu_Ip_FilterType Filter; /*!< Channel Digital Input Filter */ 356 eMios_Icu_Ip_CallbackType callback; /*!< The HLD callback function for channels events */ 357 eMios_Icu_Ip_LogicChStateCbType logicChStateCallback; /*!< The HLD callback function for changing logic channels status */ 358 uint8 callbackParams; /*!< The HLD logical channel serviced */ 359 boolean bWithoutInterrupt; /*!< Measurement of ICU signal property without using interrupt */ 360 #if (EMIOS_ICU_IP_TIMESTAMP_API == STD_ON) 361 eMios_Icu_Ip_TimestampBufferType timestampBufferType; /*!< Timestamp buffer type for timestamp mode*/ 362 #endif 363 #if ((STD_ON == EMIOS_ICU_IP_SIGNALMEASUREMENT_USES_DMA_IPL) || (STD_ON == EMIOS_ICU_IP_TIMESTAMP_USES_DMA_IPL)) 364 /** @brief Dma Channel Id. */ 365 uint8 dmaChannel; 366 #endif /* ((STD_ON == EMIOS_ICU_IP_SIGNALMEASUREMENT_USES_DMA_IPL) || (STD_ON == EMIOS_ICU_IP_TIMESTAMP_USES_DMA_IPL)) */ 367 eMios_Icu_Ip_NotifyType eMiosChannelNotification; /*!< The notification and overflow have no parameters and no return value and are generated */ 368 eMios_Icu_Ip_NotifyType eMiosOverflowNotification; /*!< based on channel run environment - HLD or IPL - statically,precompile configured*/ 369 } eMios_Icu_Ip_ChannelConfigType; 370 371 #ifdef EMIOS_ICU_IP_WSC_SUPPORT 372 #if (EMIOS_ICU_IP_WSC_SUPPORT == STD_ON) 373 /** @brief Selects the the input filter for WSC */ 374 typedef enum 375 { 376 /** @brief bypass the filter. */ 377 EMIOS_INPUT_FILTER_BYPASSED = 0x00U, 378 /** @brief 2 clock cycles */ 379 EMIOS_INPUT_FILTER_02 = 0x01U, 380 /** @brief 4 clock cycles */ 381 EMIOS_INPUT_FILTER_04 = 0x02U, 382 /** @brief 8 clock cycles */ 383 EMIOS_INPUT_FILTER_08 = 0x04U, 384 /** @brief 16 clock cycles */ 385 EMIOS_INPUT_FILTER_16 = 0x08U, 386 /** @brief 32 clock cycles */ 387 EMIOS_INPUT_FILTER_32 = 0x10U, 388 /** @brief 64 clock cycles */ 389 EMIOS_INPUT_FILTER_64 = 0x20U, 390 /** @brief 128 clock cycles. */ 391 EMIOS_INPUT_FILTER_128 = 0x40U, 392 /** @brief 256 clock cycles */ 393 EMIOS_INPUT_FILTER_256 = 0x80U 394 } eMios_Icu_Ip_WscFilterType; 395 396 /** @brief Selects the the type of interrupt for WSC */ 397 typedef enum 398 { 399 400 EMIOS_FLAG_NONE = 0x00U, /*!< No interrupt source */ 401 EMIOS_FLAGCE_OVRCE_DETECT = 0x01U, /*!< Compare event overflow or overrun */ 402 EMIOS_FLAGECO_OVRECO_DETECT = 0x02U, /*!< Event counter overflow or overrun */ 403 EMIOS_FLAGPW_OVRPW_DETECT = 0x04U, /*!< Pulse width capture event overflow or overrun */ 404 EMIOS_FLAGCAP_OVRCAP_DETECT = 0x08U, /*!< Capture event overflow or overrun */ 405 EMIOS_FLAGPWO_OVRPWO_DETECT = 0x10U, /*!< T16PWCNT Pulse width counter overflow or overrun */ 406 EMIOS_FLAGFF_OVERRUN_DETECT = 0x20U /*!< FIFO status full or not */ 407 } eMios_Icu_Ip_WscIsrSourceType; 408 409 /* 410 * @brief Edges trigger the capture : rising edge, falling edge, both of them or none edge 411 */ 412 typedef enum 413 { 414 EMIOS_ICU_IP_FALLING_EDGE = 0x00U, /*!< Falling edge */ 415 EMIOS_ICU_IP_RISING_EDGE = 0x01U, /*!< Rising edge */ 416 EMIOS_ICU_IP_BOTH_EDGES = 0x02U, /*!< Rising and falling edge */ 417 EMIOS_ICU_IP_NONE_TRIGGER = 0x03U /*!< No edge */ 418 } eMios_Icu_Ip_WscTriggerModeType; 419 420 /* 421 * @brief EMIOS Wheel Speed channel modes operation 422 */ 423 typedef enum 424 { 425 EMIOS_WHEEL_SPEED_MODE = 0x70U, /*!< Wheel Speed mode */ 426 EMIOS_SENT_MODE = 0x78U /*!< SENT mode */ 427 } eMios_Icu_Ip_WsChannelModeType; 428 429 /* 430 * @brief WSC configuration parameters structure 431 */ 432 typedef struct 433 { 434 uint8 HwWsChannel; /*!< Wheel Speed Channel Id */ 435 eMios_Icu_Ip_WsChannelModeType WsChannelMode; /*!< Wheel Speed Channel mode of operation */ 436 boolean FreezeEn; /*!< Freeze enable for Wheel Speed Channel */ 437 boolean FiFoOverwrite; /*!< Overwrite data in FIFO */ 438 boolean FilterClockScr; /*!< Selects the clock source for the PIF */ 439 eMios_Icu_Ip_WscFilterType WscInputFilter; /*!< Input Filter for Wheel Speed Channel */ 440 eMios_Icu_Ip_BusType WscBusSelect; /*!< The counter bus used by the WSC. */ 441 eMios_Icu_Ip_WscTriggerModeType CapEdgeDetect; /*!< Capture edge detection selection */ 442 eMios_Icu_Ip_NotifyType WsCAPNotification; /*!< The notification function for Capture Event in WSC */ 443 uint8 WscNumEvent; /*!< The number of WSC events */ 444 eMios_Icu_Ip_NotifyType WsCENotification; /*!< The notification function for Compare Event in WSC */ 445 eMios_Icu_Ip_NotifyType WsCEONotification; /*!< The notification function for Event Counter Overflow in WSC */ 446 eMios_Icu_Ip_WscTriggerModeType PwEdgeDetect; /*!< Edges trigger the capture of the pulse width counter*/ 447 boolean IntPrescalerMode; /*!< Selects the width and application of the WSC internal prescaler. */ 448 uint16 IntPrescaler; /*!< Selects the clock divider for the WSC internal prescaler. */ 449 boolean ResetCnt; /*!< Reset of the pulse width counter on a event */ 450 eMios_Icu_Ip_NotifyType WsPWONotification; /*!< The notification function for Pulse Width Overrun in WSC */ 451 eMios_Icu_Ip_NotifyType WsPWNotification; /*!< The notification function for Pulse Width Capture Event in WSC */ 452 } eMios_Icu_Ip_WsChannelConfigType; 453 454 /** @brief This structure is used by the IPL driver for internal logic. */ 455 typedef struct 456 { 457 /** @brief The notification function for Capture Event in WSC. */ 458 eMios_Icu_Ip_NotifyType WsCAPNotification; 459 /** @brief The notification function for Compare Event in WSC. */ 460 eMios_Icu_Ip_NotifyType WsCENotification; 461 /** @brief The notification function for Event Counter Overflow in WSC. */ 462 eMios_Icu_Ip_NotifyType WsCEONotification; 463 /** @brief The notification function for Pulse Width Overrun in WSC. */ 464 eMios_Icu_Ip_NotifyType WsPWONotification; 465 /** @brief The notification function for Pulse Width Capture Event in WSC. */ 466 eMios_Icu_Ip_NotifyType WsPWNotification; 467 /** @brief Set enable interrupt status. */ 468 uint8 EnableInterruptStatus; 469 } eMios_Icu_Ip_WsChStateType; 470 #endif 471 #endif /* EMIOS_ICU_IP_WSC_SUPPORT */ 472 473 /** 474 * @brief eTimer IP specific configuration structure type 475 */ 476 typedef struct 477 { 478 #ifdef EMIOS_ICU_IP_WSC_SUPPORT 479 #if (EMIOS_ICU_IP_WSC_SUPPORT == STD_ON) 480 /** @brief Number of eMios Wheel speed channels in the Icu configuration */ 481 uint8 nNumWsChannels; 482 /** @brief Pointer to the configured channels for eMios wheel speed channel */ 483 const eMios_Icu_Ip_WsChannelConfigType (*pWSChannelsConfig)[]; 484 #endif 485 #endif /* EMIOS_ICU_IP_WSC_SUPPORT */ 486 /** @brief Number of eMios channels in the Icu configuration */ 487 uint8 nNumChannels; 488 /** @brief Pointer to the configured channels for eMios */ 489 const eMios_Icu_Ip_ChannelConfigType (*pChannelsConfig)[]; 490 } eMios_Icu_Ip_ConfigType; 491 492 493 /** @brief This structure is used by the IPL driver for internal logic. */ 494 typedef struct 495 { 496 /** @brief eMios UC mode of operation. */ 497 eMios_Icu_Ip_UCModeType operationMode; 498 /** @brief Master bus selection. */ 499 eMios_Icu_Ip_BusType BusSelected; 500 /** @brief EMIOS channel mode. */ 501 eMios_Icu_Ip_ModeType channelMode; 502 /** @brief Support DMA or not. */ 503 eMios_Icu_Ip_SubModeType dmaMode; 504 /** @brief Type of edge used for activation. */ 505 eMios_Icu_Ip_EdgeType edgeTrigger; 506 /** @brief Calback for other types of measurement.*/ 507 eMios_Icu_Ip_CallbackType callback; 508 /** @brief Calback for HLD logic channel status changes */ 509 eMios_Icu_Ip_LogicChStateCbType logicChStateCallback; 510 /** @brief Logic channel for which callback is executed. */ 511 uint16 callbackParam; 512 /** @brief Measurement of ICU signal property without using interrupt. */ 513 boolean msWithoutInterrupt; 514 #if (STD_ON == EMIOS_ICU_IP_TIMESTAMP_API) 515 /** @brief Timestamp buffer type for timestamp mode. */ 516 eMios_Icu_Ip_TimestampBufferType timestampBufferType; 517 /** @brief Pointer to the buffer-array where the timestamp values shall be placed. */ 518 eMios_Icu_ValueType *eMios_Icu_Ip_aBuffer; 519 /** @brief Variable for saving the size of the external buffer (number of entries). */ 520 uint16 eMios_Icu_Ip_aBufferSize; 521 /** @brief Variable for saving Notification interval (number of events). */ 522 uint16 eMios_Icu_Ip_aBufferNotify; 523 /** @brief Variable for saving the number of notify counts. */ 524 uint16 eMios_Icu_Ip_aNotifyCount; 525 /** @brief Variable for saving the time stamp index. */ 526 uint16 eMios_Icu_Ip_aBufferIndex; 527 #endif /* (STD_ON == EMIOS_ICU_IP_TIMESTAMP_API) */ 528 #if (defined(EMIOS_ICU_IP_SIGNAL_MEASUREMENT_API) && (STD_ON == EMIOS_ICU_IP_SIGNAL_MEASUREMENT_API)) 529 /** @brief Store the status of the first measurement. */ 530 boolean firstEdge; 531 /** @brief Signal measurement mode. */ 532 eMios_Icu_Ip_MeasType measurement; 533 /** @brief Variable for saving the period. */ 534 eMios_Icu_ValueType eMios_Icu_Ip_aPeriod; 535 /** @brief Variable for saving the pulse width of active time. */ 536 eMios_Icu_ValueType eMios_Icu_Ip_aActivePulseWidth; 537 #endif /* (defined(EMIOS_ICU_IP_SIGNAL_MEASUREMENT_API) && (STD_ON == EMIOS_ICU_IP_SIGNAL_MEASUREMENT_API)) */ 538 #if ((STD_ON == EMIOS_ICU_IP_SIGNALMEASUREMENT_USES_DMA_IPL) || (STD_ON == EMIOS_ICU_IP_TIMESTAMP_USES_DMA_IPL)) 539 /** @brief Dma Channel Id. */ 540 uint8 dmaChannel; 541 #endif /* ((STD_ON == EMIOS_ICU_IP_SIGNALMEASUREMENT_USES_DMA_IPL) || (STD_ON == EMIOS_ICU_IP_TIMESTAMP_USES_DMA_IPL)) */ 542 #if (defined(EMIOS_ICU_IP_EDGE_COUNT_API) && (STD_ON == EMIOS_ICU_IP_EDGE_COUNT_API)) 543 /** @brief Logic variable to count edges. */ 544 uint16 edgeNumbers; 545 546 #if (STD_ON == EMIOS_ICU_IP_SET_MAX_COUNTER) 547 /** @brief Logic variable to count edges. */ 548 uint32 maxCounterValue; 549 #endif /* STD_ON == EMIOS_ICU_IP_SET_MAX_COUNTER */ 550 #endif /* (defined(EMIOS_ICU_IP_EDGE_COUNT_API) && (STD_ON == EMIOS_ICU_IP_EDGE_COUNT_API)) */ 551 /** @brief The notification functions for TIME_STAMP or SIGNAL_EDGE_DETECT mode. */ 552 eMios_Icu_Ip_NotifyType eMiosChannelNotification; 553 /** @brief The notification functions for TIME_STAMP or SIGNAL_EDGE_DETECT mode. */ 554 eMios_Icu_Ip_NotifyType eMiosOverflowNotification; 555 /** @brief Enables or disables the user notification call */ 556 boolean notificationEnable; 557 /* State of initialized EMIOS modules. */ 558 boolean channelsInitState; 559 } eMios_Icu_Ip_ChStateType; 560 561 #endif /* EMIOS_ICU_IP_USED */ 562 563 /*================================================================================================== 564 GLOBAL VARIABLE DECLARATIONS 565 ==================================================================================================*/ 566 567 /*================================================================================================== 568 FUNCTION PROTOTYPES 569 ==================================================================================================*/ 570 571 #ifdef __cplusplus 572 } 573 #endif 574 575 /** @} */ 576 577 #endif /* EMIOS_ICU_IP_TYPES_H */ 578