Просмотр исходного кода

重卡项目测试-编译完成

LAPTOP-KB7QFH2U\ChenJie-PC 2 лет назад
Родитель
Сommit
272f980683
100 измененных файлов с 22142 добавлено и 1240 удалено
  1. 228 0
      RTD/include/Cmp_Ip.h
  2. 296 0
      RTD/include/Cmp_Ip_Types.h
  3. 496 0
      RTD/include/Ftm_Icu_Ip.h
  4. 479 0
      RTD/include/Ftm_Icu_Ip_Irq.h
  5. 387 0
      RTD/include/Ftm_Icu_Ip_Types.h
  6. 1250 0
      RTD/include/Icu.h
  7. 101 0
      RTD/include/Icu_EnvCfg.h
  8. 440 0
      RTD/include/Icu_Ipw.h
  9. 170 0
      RTD/include/Icu_Ipw_Irq.h
  10. 281 0
      RTD/include/Icu_Ipw_Types.h
  11. 159 0
      RTD/include/Icu_Irq.h
  12. 288 0
      RTD/include/Icu_Types.h
  13. 258 0
      RTD/include/Lpit_Icu_Ip.h
  14. 159 0
      RTD/include/Lpit_Icu_Ip_Irq.h
  15. 180 0
      RTD/include/Lpit_Icu_Ip_Types.h
  16. 257 0
      RTD/include/Lptmr_Icu_Ip.h
  17. 150 0
      RTD/include/Lptmr_Icu_Ip_Irq.h
  18. 230 0
      RTD/include/Lptmr_Icu_Ip_Types.h
  19. 191 0
      RTD/include/Port_Ci_Icu_Ip.h
  20. 269 0
      RTD/include/Port_Ci_Icu_Ip_Irq.h
  21. 178 0
      RTD/include/Port_Ci_Icu_Ip_Types.h
  22. 796 0
      RTD/src/Cmp_Ip.c
  23. 1281 0
      RTD/src/Ftm_Icu_Ip.c
  24. 1153 0
      RTD/src/Ftm_Icu_Ip_Irq.c
  25. 2895 0
      RTD/src/Icu.c
  26. 1091 0
      RTD/src/Icu_Ipw.c
  27. 363 0
      RTD/src/Lpit_Icu_Ip.c
  28. 378 0
      RTD/src/Lpit_Icu_Ip_Irq.c
  29. 623 0
      RTD/src/Lptmr_Icu_Ip.c
  30. 227 0
      RTD/src/Lptmr_Icu_Ip_Irq.c
  31. 460 0
      RTD/src/Port_Ci_Icu_Ip.c
  32. 536 0
      RTD/src/Port_Ci_Icu_Ip_Irq.c
  33. 272 75
      code/app/AppGlobalVar.c
  34. 275 77
      code/app/AppGlobalVar.h
  35. 945 197
      code/app/AppTaskCan.c
  36. 2 0
      code/app/AppTaskCan.h
  37. 1 1
      code/app/AppTaskGps.c
  38. 62 20
      code/app/AppTaskMain.c
  39. 4 246
      code/app/AppTaskUart0.c
  40. 333 327
      code/app/AppTaskUart1.c
  41. 19 14
      code/app/AppTaskUart1.h
  42. 1 1
      code/app/UDSTask.h
  43. 5 0
      code/hal/Hal_Wdg.c
  44. 1 0
      code/hal/Hal_Wdg.h
  45. 208 18
      code/hal/hal_adapter.c
  46. 23 6
      code/hal/hal_adapter.h
  47. 126 97
      code/main.c
  48. 86 0
      generate/include/Cmp_Ip_Cfg.h
  49. 94 0
      generate/include/Cmp_Ip_Defines.h
  50. 90 0
      generate/include/Cmp_Ip_VS_0_PBcfg.h
  51. 4 10
      generate/include/EcuM_Cfg.h
  52. 1 1
      generate/include/Eep_Cfg.h
  53. 1 1
      generate/include/FlexCAN_Ip_Cfg.h
  54. 1 1
      generate/include/Flexio_Spi_Ip_Cfg.h
  55. 2 2
      generate/include/Flexio_Uart_Ip_Defines.h
  56. 1 1
      generate/include/Ftfc_Eep_Ip_Cfg.h
  57. 98 0
      generate/include/Ftm_Icu_Ip_Cfg.h
  58. 162 0
      generate/include/Ftm_Icu_Ip_Defines.h
  59. 97 0
      generate/include/Ftm_Icu_Ip_VS_0_PBcfg.h
  60. 413 0
      generate/include/Icu_Cfg.h
  61. 108 0
      generate/include/Icu_Ipw_Cfg.h
  62. 84 0
      generate/include/Icu_Ipw_VS_0_PBcfg.h
  63. 74 0
      generate/include/Icu_VS_0_PBcfg.h
  64. 1 0
      generate/include/IntCtrl_Ip_Cfg.h
  65. 93 0
      generate/include/Lpit_Icu_Ip_Cfg.h
  66. 115 0
      generate/include/Lpit_Icu_Ip_Defines.h
  67. 92 0
      generate/include/Lpit_Icu_Ip_VS_0_PBcfg.h
  68. 1 1
      generate/include/Lpspi_Ip_Cfg.h
  69. 3 2
      generate/include/Lptmr_Gpt_Ip_Cfg_Defines.h
  70. 105 0
      generate/include/Lptmr_Icu_Ip_Cfg.h
  71. 142 0
      generate/include/Lptmr_Icu_Ip_Defines.h
  72. 97 0
      generate/include/Lptmr_Icu_Ip_VS_0_PBcfg.h
  73. 3 3
      generate/include/Lpuart_Uart_Ip_Defines.h
  74. 18 3
      generate/include/Mcu_Cfg.h
  75. 1 1
      generate/include/OsIf_Cfg.h
  76. 3 2
      generate/include/Os_cfg.h
  77. 2 2
      generate/include/Port_Cfg.h
  78. 103 0
      generate/include/Port_Ci_Icu_Ip_Cfg.h
  79. 135 0
      generate/include/Port_Ci_Icu_Ip_Defines.h
  80. 96 0
      generate/include/Port_Ci_Icu_Ip_VS_0_PBcfg.h
  81. 1 1
      generate/include/Port_Ci_Port_Ip_Defines.h
  82. 3 3
      generate/include/Power_Ip_Cfg_Defines.h
  83. 2 2
      generate/include/Uart_Defines.h
  84. 2 2
      generate/include/Wdg_Cfg_Defines.h
  85. 3 3
      generate/include/Wdg_Ipw_Cfg_Defines.h
  86. 1 1
      generate/include/modules.h
  87. 141 0
      generate/src/Cmp_Ip_VS_0_PBcfg.c
  88. 2 2
      generate/src/Ewm_Ip_VS_0_PBcfg.c
  89. 0 108
      generate/src/Ftfc_Fls_Ip_PBcfg.c
  90. 5 5
      generate/src/Ftfc_Fls_Ip_VS_0_PBcfg.c
  91. 137 0
      generate/src/Ftm_Icu_Ip_VS_0_PBcfg.c
  92. 115 0
      generate/src/Icu_Cfg.c
  93. 116 0
      generate/src/Icu_DmaNotification.c
  94. 272 0
      generate/src/Icu_Ipw_VS_0_PBcfg.c
  95. 241 0
      generate/src/Icu_VS_0_PBcfg.c
  96. 2 2
      generate/src/IntCtrl_Ip_Cfg.c
  97. 1 1
      generate/src/LPit_Gpt_Ip_VS_0_PBcfg.c
  98. 111 0
      generate/src/Lpit_Icu_Ip_VS_0_PBcfg.c
  99. 133 0
      generate/src/Lptmr_Icu_Ip_VS_0_PBcfg.c
  100. 1 1
      generate/src/Mcu_VS_0_PBcfg.c

+ 228 - 0
RTD/include/Cmp_Ip.h

@@ -0,0 +1,228 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef CMP_IP_H
+#define CMP_IP_H
+
+/**
+ *     @file
+ *
+ *     @addtogroup cmp_icu_ip CMP IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+==================================================================================================*/
+#include "Cmp_Ip_Types.h"
+#include "Cmp_Ip_Cfg.h"
+#include "OsIf.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define CMP_IP_VENDOR_ID                      43
+#define CMP_IP_AR_RELEASE_MAJOR_VERSION       4
+#define CMP_IP_AR_RELEASE_MINOR_VERSION       4
+#define CMP_IP_AR_RELEASE_REVISION_VERSION    0
+#define CMP_IP_SW_MAJOR_VERSION               1
+#define CMP_IP_SW_MINOR_VERSION               0
+#define CMP_IP_SW_PATCH_VERSION               0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (CMP_IP_VENDOR_ID != CMP_IP_TYPES_VENDOR_ID)
+    #error "Cmp_Ip.h and Cmp_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((CMP_IP_AR_RELEASE_MAJOR_VERSION  != CMP_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (CMP_IP_AR_RELEASE_MINOR_VERSION  != CMP_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (CMP_IP_AR_RELEASE_REVISION_VERSION   != CMP_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Cmp_Ip.h and Cmp_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((CMP_IP_SW_MAJOR_VERSION  != CMP_IP_TYPES_SW_MAJOR_VERSION) || \
+     (CMP_IP_SW_MINOR_VERSION  != CMP_IP_TYPES_SW_MINOR_VERSION) || \
+     (CMP_IP_SW_PATCH_VERSION  != CMP_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Cmp_Ip.h and Cmp_Ip_Types.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (CMP_IP_VENDOR_ID != CMP_IP_CFG_VENDOR_ID)
+    #error "Cmp_Ip.h and Cmp_Ip_Cfg.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((CMP_IP_AR_RELEASE_MAJOR_VERSION  != CMP_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (CMP_IP_AR_RELEASE_MINOR_VERSION  != CMP_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (CMP_IP_AR_RELEASE_REVISION_VERSION   != CMP_IP_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Cmp_Ip.h and Cmp_Ip_Cfg.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((CMP_IP_SW_MAJOR_VERSION  != CMP_IP_CFG_SW_MAJOR_VERSION) || \
+     (CMP_IP_SW_MINOR_VERSION  != CMP_IP_CFG_SW_MINOR_VERSION) || \
+     (CMP_IP_SW_PATCH_VERSION  != CMP_IP_CFG_SW_PATCH_VERSION))
+#error "Software Version Numbers of Cmp_Ip.h and Cmp_Ip_Cfg.h are different"
+#endif
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+#if (defined CMP_CONFIG_EXT)
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/* Macro used to import WKPU generated configurations. */
+CMP_CONFIG_EXT
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+#endif
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+/**
+ * @brief Configure all comparator features with the given configuration structure
+ *
+ * This function configures the comparator module with the options
+ * provided in the config structure.
+ *
+ * @param instance - instance number
+ * @param config - the configuration structure
+ * @return 
+ *        - CMP_IP_STATUS_SUCCESS : Completed successfully.
+ *        - CMP_IP_STATUS_ERROR : Error occurred.
+ */
+Cmp_Ip_StatusType Cmp_Ip_Init(uint8 instance, const Cmp_Ip_ConfigType* userConfig);
+
+/**
+ * @brief Reset all register used by ICU driver on current CMP instance.  
+ * 
+ * @param Instance - The number instance to be deinitialize.
+ * @return Cmp_Ip_StatusType 
+ */
+Cmp_Ip_StatusType Cmp_Ip_Deinit(uint8 instance);
+
+/**
+ * @brief Enable CMP notification.
+ * 
+ * @param Instance The number of instance for which the notifcation will be enabled.
+ */
+void Cmp_Ip_EnableNotification(uint8 instance);
+
+/**
+ * @brief Disable CMP notification.
+ * 
+ * @param Instance The number of instance for which the notifcation will be enabled.
+ */
+void Cmp_Ip_DisableNotification(uint8 instance);
+
+/**
+ * @brief Set the type of activation for interrupt.
+ * 
+ * @param Instance The number of instance for which the interrupt activation will be set.
+ * @param Edge 
+ */
+void Cmp_Ip_SetInterruptActivation(uint8 instance, Cmp_Ip_OutputInterruptTriggerType Edge);
+
+/**
+ * @brief Enable CMP interrupt.
+ * 
+ * @param Instance The number of instance for which the interrupt will be enabled.
+ */
+void Cmp_Ip_EnableInterrupt(uint8 instance);
+
+/**
+ * @brief Disable CMP interrupt.
+ * 
+ * @param Instance The number of instance for which the interrupt will be disable.
+ */
+void Cmp_Ip_DisableInterrupt(uint8 instance);
+
+#if (CMP_ICU_GET_INPUT_STATE_API == STD_ON)
+/**
+ * @brief Get instance status.
+ * 
+ * @param Instance The number of instace to get the status.
+ * @return boolean 
+ */
+boolean Cmp_Ip_GetStatus(uint8 instance);
+#endif
+
+#if (defined(ICU_CMP_0_ISR_USED))
+/**
+ * @brief     Interrupt handler for CMP 0.
+ * @details   Process the interrupt of instance 0.
+ *
+ * @remarks   This will be defined only if CMP 0 is configured.
+ */
+ISR(CMP_0_ISR);
+
+#endif
+
+#if (defined(ICU_CMP_1_ISR_USED))
+/**
+ * @brief     Interrupt handler for CMP 1.
+ * @details   Process the interrupt of instance 1.
+ *
+ * @remarks   This will be defined only if CMP 1 is configured.
+ */
+ISR(CMP_1_ISR);
+
+#endif
+
+#if (defined(ICU_CMP_2_ISR_USED))
+/**
+ * @brief     Interrupt handler for CMP 2.
+ * @details   Process the interrupt of instance 2.
+ *
+ * @remarks   This will be defined only if CMP 2 is configured.
+ */
+ISR(CMP_2_ISR);
+
+#endif
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* WKPU_ICU_IP_H */

+ 296 - 0
RTD/include/Cmp_Ip_Types.h

@@ -0,0 +1,296 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef CMP_IP_TYPES_H
+#define CMP_IP_TYPES_H
+
+/**
+ *     @file
+ * 
+ *     @addtogroup cmp_icu_ip CMP IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+                                         INCLUDE FILES
+==================================================================================================*/
+#include "StandardTypes.h"
+#include "Cmp_Ip_Defines.h"
+/*==================================================================================================
+                               SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define CMP_IP_TYPES_VENDOR_ID                     43
+#define CMP_IP_TYPES_AR_RELEASE_MAJOR_VERSION      4
+#define CMP_IP_TYPES_AR_RELEASE_MINOR_VERSION      4
+#define CMP_IP_TYPES_AR_RELEASE_REVISION_VERSION   0
+#define CMP_IP_TYPES_SW_MAJOR_VERSION              1
+#define CMP_IP_TYPES_SW_MINOR_VERSION              0
+#define CMP_IP_TYPES_SW_PATCH_VERSION              0
+
+/*==================================================================================================
+                                      FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and StandardTypes.h file are of the same Autosar version */
+    #if ((CMP_IP_TYPES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (CMP_IP_TYPES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Cmp_Ip_Types.h and StandardTypes.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (CMP_IP_TYPES_VENDOR_ID != CMP_IP_DEFINES_VENDOR_ID)
+    #error "Cmp_Ip_Types.h and Cmp_Ip_Defines.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((CMP_IP_TYPES_AR_RELEASE_MAJOR_VERSION != CMP_IP_DEFINES_AR_RELEASE_MAJOR_VERSION) || \
+     (CMP_IP_TYPES_AR_RELEASE_MINOR_VERSION != CMP_IP_DEFINES_AR_RELEASE_MINOR_VERSION) || \
+     (CMP_IP_TYPES_AR_RELEASE_REVISION_VERSION != CMP_IP_DEFINES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Cmp_Ip_Types.h and Cmp_Ip_Defines.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((CMP_IP_TYPES_SW_MAJOR_VERSION != CMP_IP_DEFINES_SW_MAJOR_VERSION) || \
+     (CMP_IP_TYPES_SW_MINOR_VERSION != CMP_IP_DEFINES_SW_MINOR_VERSION) || \
+     (CMP_IP_TYPES_SW_PATCH_VERSION != CMP_IP_DEFINES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Cmp_Ip_Types.h and Cmp_Ip_Defines.h are different"
+#endif
+
+/*==================================================================================================
+                                           CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+                                 GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+/*==================================================================================================
+                                       DEFINES AND MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+                                             ENUMS
+==================================================================================================*/
+typedef enum
+{
+    CMP_IP_STATUS_SUCCESS,
+    CMP_IP_STATUS_ERROR
+} Cmp_Ip_StatusType;
+
+typedef enum {
+    CMP_IP_FUNCTIONALMODE_DISABLED,
+    CMP_IP_FUNCTIONALMODE_CONTINUOUS,
+    CMP_IP_FUNCTIONALMODE_SAMPLED_NONFILTERED_INT_CLK,
+    CMP_IP_FUNCTIONALMODE_SAMPLED_NONFILTERED_EXT_CLK,
+    CMP_IP_FUNCTIONALMODE_SAMPLED_FILTERED_INT_CLK,
+    CMP_IP_FUNCTIONALMODE_SAMPLED_FILTERED_EXT_CLK,
+    CMP_IP_FUNCTIONALMODE_WINDOWED,
+    CMP_IP_FUNCTIONALMODE_WINDOWED_RESAMPLED,
+    CMP_IP_FUNCTIONALMODE_WINDOWED_FILTERED
+} Cmp_Ip_FunctionalModeType;
+
+typedef enum {
+    CMP_IP_HYSTERESISLEVEL_0 = 0u,
+    CMP_IP_HYSTERESISLEVEL_1 = 1u,
+    CMP_IP_HYSTERESISLEVEL_2 = 2u,
+    CMP_IP_HYSTERESISLEVEL_3 = 3u,
+} Cmp_Ip_HysteresisLevelType;
+
+typedef enum {
+    CMP_IP_OFFSETLEVEL_0 = 0x00u,
+    CMP_IP_OFFSETLEVEL_1 = 0x01u,
+} Cmp_Ip_OffsetLevelType;
+
+typedef enum {
+    CMP_IP_INPUTMUX_IN0 = 0x00u, /* INxSEL = 0x01. xSEL=0 */
+    CMP_IP_INPUTMUX_IN1 = 0x01u, /* INxSEL = 0x01. xSEL=1 */
+    CMP_IP_INPUTMUX_IN2 = 0x02u,
+    CMP_IP_INPUTMUX_IN3 = 0x03u,
+    CMP_IP_INPUTMUX_IN4 = 0x04u,
+    CMP_IP_INPUTMUX_IN5 = 0x05u,
+    CMP_IP_INPUTMUX_IN6 = 0x06u,
+    CMP_IP_INPUTMUX_IN7 = 0x07u,
+    CMP_IP_INPUTMUX_DAC = 0x80u, /* INxSEL = 0x00. xSEL=0 */
+} Cmp_Ip_InputMuxType;
+
+typedef enum {
+    CMP_IP_INTTRIG_NONE         = 0x00u,
+    CMP_IP_INTTRIG_FALLING_EDGE = 0x01u,
+    CMP_IP_INTTRIG_RISING_EDGE  = 0x02u,
+    CMP_IP_INTTRIG_BOTH_EDGES   = 0x03u,
+} Cmp_Ip_OutputInterruptTriggerType;
+
+typedef enum {
+    CMP_IP_OUTPUTSELECT_COUT    = 0x00u,
+    CMP_IP_OUTPUTSELECT_COUTA   = 0x01u,
+} Cmp_Ip_OutputSelectType;
+
+typedef enum {
+    CMP_IP_WINDOWCLOSEOUTPUTOVERWRITE_DISABLED  = 0x00u,
+    CMP_IP_WINDOWCLOSEOUTPUTOVERWRITE_LOW       = 0x01u,
+    CMP_IP_WINDOWCLOSEOUTPUTOVERWRITE_HIGH      = 0x02u,
+} Cmp_Ip_WindowCloseOutputOverwriteType;
+
+typedef enum {
+    CMP_IP_WINDOWCLOSEEVENT_RISING  = 0x00u,
+    CMP_IP_WINDOWCLOSEEVENT_FALLING = 0x01u,
+    CMP_IP_WINDOWCLOSEEVENT_BOTH    = 0x02u,
+    CMP_IP_WINDOWCLOSEEVENT_NONE    = 0x04u,
+} Cmp_Ip_WindowCloseEventType;
+
+typedef enum {
+    CMP_IP_VOLTAGEREFSOURCE_VREF0 = 0x00u,
+    CMP_IP_VOLTAGEREFSOURCE_VREF1 = 0x01u,
+} Cmp_Ip_VoltageRefSourceType;
+
+typedef enum {
+    CMP_IP_DACPOWERSTATE_DISABLED   = 0x00u, /*< DAC disabled */
+    CMP_IP_DACPOWERSTATE_ENABLED    = 0x01u, /*< DAC enabled */
+    CMP_IP_DACPOWERSTATE_LINKED     = 0x02u, /*< DAC enablement linked to comparator */
+} Cmp_Ip_DacPowerStateType;
+
+typedef enum {
+    CMP_IP_SAMPLEDELAY_0_CYCLES = 0x00u,
+    CMP_IP_SAMPLEDELAY_1_CYCLES = 0x01u,
+    CMP_IP_SAMPLEDELAY_2_CYCLES = 0x02u,
+    CMP_IP_SAMPLEDELAY_3_CYCLES = 0x03u,
+} Cmp_Ip_SampleDelayType;
+
+typedef enum {
+    CMP_IP_FIXEDCHANNEL_0 = 0x00u,
+    CMP_IP_FIXEDCHANNEL_1 = 0x01u,
+    CMP_IP_FIXEDCHANNEL_2 = 0x02u,
+    CMP_IP_FIXEDCHANNEL_3 = 0x03u,
+    CMP_IP_FIXEDCHANNEL_4 = 0x04u,
+    CMP_IP_FIXEDCHANNEL_5 = 0x05u,
+    CMP_IP_FIXEDCHANNEL_6 = 0x06u,
+    CMP_IP_FIXEDCHANNEL_7 = 0x07u,
+} Cmp_Ip_FixedChannelType;
+
+typedef enum {
+    CMP_IP_FIXEDPORT_PLUS  = 0x00u,
+    CMP_IP_FIXEDPORT_MINUS = 0x01u,
+} Cmp_Ip_FixedPortType;
+
+/** @brief    CMP initialization status */
+typedef enum
+{
+    ICU_CMP_IP_UNINIT,
+    ICU_CMP_IP_INIT
+} Cmp_Ip_StateEType;
+
+/*==================================================================================================
+                                 STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+/* Callback type for each channel */
+typedef void (*Cmp_Ip_TriggerNotificationType) (uint16 CallbackParam1, boolean CallbackParam2);
+typedef void (*Cmp_Ip_ComparatorNotificationType) (uint16 CallbackParam1, boolean CallbackParam2);
+
+/**
+ * @brief    CMP IP state structure.
+ * @details  This structure is used by the IPL driver for internal logic.
+ *           The content is populated at initialization time.
+ */
+typedef struct
+{
+    Cmp_Ip_StateEType                   State;
+    Cmp_Ip_OutputInterruptTriggerType   CmpInterruptEdge;
+    boolean                             NotificationEnabled;
+    boolean                             EnRoundRobinInterrupt;    
+    Cmp_Ip_TriggerNotificationType      TriggerNotification;
+    Cmp_Ip_ComparatorNotificationType   ComparatorNotification;
+    uint16                              CallbackParam1;    
+} Cmp_Ip_StateType;
+
+
+typedef struct 
+{
+    Cmp_Ip_FunctionalModeType               FunctionalMode;
+    Cmp_Ip_HysteresisLevelType              HysteresisLevel;
+    Cmp_Ip_OffsetLevelType                  OffsetLevel;
+    boolean                                 EnablePinOutput;
+    boolean                                 EnableInverter;
+    boolean                                 EnableComparatorInvert;
+    boolean                                 EnableHighPowerMode;
+    uint8                                   FilterSamplePeriod;
+    uint8                                   FilterSampleCount;
+    boolean                                 EnableDma;
+    Cmp_Ip_InputMuxType                     NegativeInputMux;
+    Cmp_Ip_InputMuxType                     PositiveInputMux;
+    Cmp_Ip_OutputInterruptTriggerType       OutputInterruptTrigger;     /* this is mapped to IcuDefaultStartEdge */  
+#ifdef CMP_ICU_SUPPORT_LOWPOWER
+    Cmp_Ip_WindowCloseOutputOverwriteType   WindowCloseOutputOverwrite;
+    Cmp_Ip_WindowCloseEventType             WindowCloseEvent;
+    boolean                                 EnableInStop;
+#endif
+    Cmp_Ip_OutputSelectType                 OutputSelect;
+} Cmp_Ip_ComparatorConfigType;
+
+typedef struct 
+{
+    uint8                       VoltageLevel;
+    Cmp_Ip_VoltageRefSourceType VoltageRefSource;
+    Cmp_Ip_DacPowerStateType    PowerState;
+
+} Cmp_Ip_DacConfigType;
+
+typedef struct
+{
+    uint8                   RoundRobinEnChannelMask;
+#ifdef CMP_ICU_SUPPORT_LOWPOWER
+    uint8                   PrepgmStateChannelMask;
+#endif
+    uint8                   InitDelayValue;
+    Cmp_Ip_SampleDelayType  SampleDelay;
+    Cmp_Ip_FixedChannelType FixedChannel;
+    Cmp_Ip_FixedPortType    FixedPort;
+    boolean                 EnableRoundRobinInterrupt;
+    boolean                 EnableRoundRobin;
+} Cmp_Ip_TriggerConfigType;
+
+typedef struct 
+{
+    uint8                               Instance;
+    Cmp_Ip_ComparatorConfigType         Comparator;
+    Cmp_Ip_DacConfigType                Dac;
+    Cmp_Ip_TriggerConfigType            Trigger;
+    Cmp_Ip_TriggerNotificationType      TriggerNotification;
+    Cmp_Ip_ComparatorNotificationType   ComparatorNotification;
+    uint16                              CallbackParam1;
+} Cmp_Ip_ConfigType;
+
+/*==================================================================================================
+                                     FUNCTION PROTOTYPES
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/**@}*/
+
+#endif  /* CMP_IP_TYPES_H */

+ 496 - 0
RTD/include/Ftm_Icu_Ip.h

@@ -0,0 +1,496 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef FTM_ICU_IP_H
+#define FTM_ICU_IP_H
+
+/**
+ *     @file       Ftm_Icu_Ip.h 
+ *     @brief      Header file of Flextimer module.
+ *     @details    This file contains signatures for all the functions which are related to FTM 
+ *                 module.
+ *     @addtogroup ftm_icu_ip FTM IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Ftm_Icu_Ip_Types.h"
+#include "Ftm_Icu_Ip_Cfg.h"
+
+#if (FTM_ICU_ENABLE_USER_MODE_SUPPORT == STD_ON)
+    #include "Reg_eSys.h"
+#endif
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define FTM_ICU_IP_VENDOR_ID                    43
+#define FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION     4
+#define FTM_ICU_IP_AR_RELEASE_MINOR_VERSION     4
+#define FTM_ICU_IP_AR_RELEASE_REVISION_VERSION  0
+#define FTM_ICU_IP_SW_MAJOR_VERSION             1
+#define FTM_ICU_IP_SW_MINOR_VERSION             0
+#define FTM_ICU_IP_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (FTM_ICU_IP_VENDOR_ID != FTM_ICU_IP_TYPES_VENDOR_ID)
+    #error "Ftm_Icu_Ip.h and Ftm_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION != FTM_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_AR_RELEASE_MINOR_VERSION != FTM_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_AR_RELEASE_REVISION_VERSION != FTM_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Ftm_Icu_Ip.h and Ftm_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((FTM_ICU_IP_SW_MAJOR_VERSION != FTM_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_SW_MINOR_VERSION != FTM_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_SW_PATCH_VERSION != FTM_ICU_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Ftm_Icu_Ip.h and Ftm_Icu_Ip_Types.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (FTM_ICU_IP_VENDOR_ID != FTM_ICU_IP_CFG_VENDOR_ID)
+    #error "Ftm_Icu_Ip.h and Ftm_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION != FTM_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_AR_RELEASE_MINOR_VERSION != FTM_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_AR_RELEASE_REVISION_VERSION != FTM_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Ftm_Icu_Ip.h and Ftm_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((FTM_ICU_IP_SW_MAJOR_VERSION != FTM_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_SW_MINOR_VERSION != FTM_ICU_IP_CFG_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_SW_PATCH_VERSION != FTM_ICU_IP_CFG_SW_PATCH_VERSION))
+#error "Software Version Numbers of Ftm_Icu_Ip.h and Ftm_Icu_Ip_Cfg.h are different"
+#endif
+
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if (FTM_ICU_ENABLE_USER_MODE_SUPPORT == STD_ON)
+    /* Check if header file and Reg_eSys.h file are of the same Autosar version */
+        #if ((FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION != REG_ESYS_AR_RELEASE_MAJOR_VERSION) || \
+             (FTM_ICU_IP_AR_RELEASE_MINOR_VERSION != REG_ESYS_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Ftm_Icu_Ip.h and Reg_eSys.h are different"
+        #endif
+    #endif
+#endif
+/*===============================================================================================
+*                                       DEFINES AND MACROS
+===============================================================================================*/
+
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+#define ICU_START_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/* Array with FTM modules base addresses. */
+extern Ftm_Icu_Ip_BaseType * const ftmIcuBase[];
+
+#define ICU_STOP_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#if (defined FTM_ICU_CONFIG_EXT)
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/* Macro used to import FTM generated configurations. */
+FTM_ICU_CONFIG_EXT
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+#endif
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+/**
+ * @details This function configures the channel in the Input Capture mode for either getting
+ * time-stamps on edge detection or on signal measurement. When the edge specified in the captureMode
+ * argument occurs on the channel and then the FTM counter is captured into the CnV register.
+ * The user have to read the CnV register separately to get this value. The filter
+ * function is disabled if the filterVal argument passed as 0. The filter feature.
+ * is available only on channels 0,1,2,3.
+ * 
+ * @param[in] instance  Hardware instance of FTM used.
+ * @param[in] userConfig     Configuration of the input capture channel.
+ * @return Ftm_Icu_Ip_StatusType
+ *        - FTM_IP_STATUS_SUCCESS : Completed successfully.
+ *        - FTM_IP_STATUS_ERROR : Error occurred.
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_Init (uint8 instance, const  Ftm_Icu_Ip_ConfigType *userConfig);
+
+#if (STD_ON == FTM_ICU_DEINIT_API)
+/**
+ * @brief     Disables input capture mode and clears FTM timer configuration
+ * 
+ * @param[in] instance  Hardware instance of FTM used.
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_DeInit (uint8 instance);
+#endif /* STD_ON == FTM_ICU_DEINIT_API */
+
+#if (STD_ON == FTM_ICU_SET_MODE_API)
+/**
+ * @brief      Driver function sets FTM hardware channel into SLEEP mode.
+ *
+ * @param[in]  instance  Hardware instance of FTM used. 
+ * @param[in]  hwChannel Hardware channel of FTM used.
+ * @return     void
+ */
+void Ftm_Icu_Ip_SetSleepMode(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief      Driver function sets FTM hardware channel into NORMAL mode.
+ *
+ * @param[in]  instance  Hardware instance of FTM used. 
+ * @param[in]  hwChannel Hardware channel of FTM used.
+ * @return     void
+ */
+void Ftm_Icu_Ip_SetNormalMode(uint8 instance, uint8 hwChannel);
+#endif  /* STD_ON == FTM_ICU_SET_MODE_API */
+
+#if (FTM_ICU_CAPTURERGISTER_API == STD_ON)
+/**
+ * @brief      Capture the value of counter register for a specified channel.
+ * 
+ * @details   The API shall return the value stored in capture register.
+ *            The API is the equivalent of AUTOSAR API GetCaptureRegisterValue.
+ * 
+ * @param[in]  instance  Hardware instance of FTM used. 
+ * @param[in]  hwChannel Hardware channel of FTM used.
+ * @return     uint32  Value of the register captured.
+ */
+uint32 Ftm_Icu_Ip_GetCaptureRegisterValue(uint8 instance, uint8 hwChannel);
+#endif
+/**
+ * @details   This function enables the requested activation condition(rising, falling or both
+ *            edges) for corresponding FTM channels.
+ * 
+ * @param[in] instance     Hardware instance of FTM used. 
+ * @param[in] hwChannel    Hardware channel of FTM used.
+ * @param[in] activation Edge activation type used.
+ * @return    void
+ */
+void Ftm_Icu_Ip_SetActivationCondition (uint8 instance, uint8 hwChannel, Ftm_Icu_Ip_EdgeType activation);
+
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+/**
+ * @brief FTM IP layer function which starts timestamp measure mode.
+ * 
+ * @param[in] instance      Hardware instance of FTM used. 
+ * @param[in] hwChannel   Hardware channel of FTM used.
+ * @param[in] bufferPtr                buffer pointer for results
+ * @param[in] bufferSize              size of buffer results
+ * @param[in] notifyInterval       interval for calling notification
+ * @return    void
+ */
+void Ftm_Icu_Ip_StartTimestamp
+(
+    uint8 instance,
+    uint8 hwChannel,
+    uint16 * bufferPtr,
+    uint16 bufferSize,
+    uint16 notifyInterval
+);
+
+/**
+ * @brief FTM IP layer function which stops timestamp measure mode for a given instance and channel.
+ * 
+ * @param[in] instance  Hardware instance of FTM used. 
+ * @param[in] hwChannel Hardware channel of FTM used.
+ * @return    void
+ */
+void Ftm_Icu_Ip_StopTimestamp(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief   This function reads the timestamp index of the given channel.
+ * @details The API shall return the index to be used for next timestamp measurement to be stored.
+ * 
+ * @param[in] instance  Hardware instance of FTM used. 
+ * @param[in] channel   Hardware channel of FTM used.
+ *
+ * @return     uint16 - Timestamp index of the given channel, next index to be used for storring timestamps.
+ * @pre        Ftm_Icu_Ip_Init must be called before. Icu_StartTimestamp must be called before.
+ */
+uint16 Ftm_Icu_Ip_GetTimestampIndex(uint8 instance, uint8 hwChannel);
+
+#if (STD_ON == FTM_ICU_TIMESTAMP_USES_DMA)
+/**
+ * @brief FTM IP layer function which get address of CVn register.
+ * 
+ * @param[in] instance  Hardware instance of FTM used. 
+ * @param[in] hwChannel Hardware channel of FTM used.
+ * @return    void
+ */
+uint32 Ftm_Icu_Ip_GetStartAddress(uint8 instance, uint8 hwChannel);
+#endif
+
+#endif /* STD_ON == FTM_ICU_TIMESTAMP_API */
+
+#if (STD_ON == FTM_ICU_EDGE_DETECT_API)
+/**
+ * @brief FTM IP layer function which enable edge detection measure mode for a given instance and channel.
+ * 
+ * @param[in] instance  Hardware instance of FTM used. 
+ * @param[in] hwChannel Hardware channel of FTM used.
+ * @return    Ftm_Icu_Ip_StatusType
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_EnableEdgeDetection(uint8 instance, uint8 hwChannel);
+#endif /* STD_ON == ICU_EDGE_DETECT_API */
+
+#if (STD_ON == FTM_ICU_EDGE_DETECT_API)
+/**
+ * @brief FTM IP layer function which disable edge detection measure mode for a given instance and channel.
+ * 
+ * @param[in] instance  Hardware instance of FTM used. 
+ * @param[in] hwChannel Hardware channel of FTM used.
+ * @return    Ftm_Icu_Ip_StatusType
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_DisableEdgeDetection(uint8 instance, uint8 hwChannel);
+#endif /* STD_ON == ICU_EDGE_DETECT_API */
+
+#if (STD_ON == FTM_ICU_EDGE_COUNT_API)
+/**
+ * @brief FTM IP layer function which reset edge count measure mode for a given instance and channel.
+ * 
+ * @param[in] instance  Hardware instance of FTM used. 
+ * @param[in] hwChannel Hardware channel of FTM used.
+ * @return    void
+ */
+void Ftm_Icu_Ip_ResetEdgeCount(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief FTM IP layer function which enable edge count measure mode for a given instance and channel.
+ * 
+ * @param[in] instance  module instance number 
+ * @param[in] hwChannel Hardware channel of FTM used.
+ * @return    Ftm_Icu_Ip_StatusType
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_EnableEdgeCount(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief FTM IP layer function which disable edge count measure mode for a given instance and channel.
+ * 
+ * @param[in] instance  Hardware instance of FTM used. 
+ * @param[in] hwChannel Hardware channel of FTM used.
+ * @return    Ftm_Icu_Ip_StatusType
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_DisableEdgeCount(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief FTM IP layer function which gets the number of edges for a given instance and channel.
+ * 
+ * @param[in] instance  Hardware instance of FTM used. 
+ * @param[in] hwChannel Hardware channel of FTM used.
+ * @return    uint16  Number of edges counted.
+ */
+uint16 Ftm_Icu_Ip_GetEdgeNumbers(uint8 instance, uint8 hwChannel);
+#endif /* STD_ON == FTM_ICU_EDGE_COUNT_API */
+
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+/**
+ * @brief FTM IP layer function which starts signal measurement mode for a given instance and channel.
+ * 
+ * @param[in] instance  Hardware instance of FTM used. 
+ * @param[in] hwChannel Hardware channel of FTM used.
+ * @return    void
+ */
+void Ftm_Icu_Ip_StartSignalMeasurement(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief FTM IP layer function which stops signal measurement mode for a given instance and channel.
+ * 
+ * @param[in] instance  Hardware instance of FTM used. 
+ * @param[in] hwChannel Hardware channel of FTM used.
+ * @return    void
+ */
+void Ftm_Icu_Ip_StopSignalMeasurement(uint8 instance,uint8 hwChannel);
+
+/**
+ * @brief   This function reads the elapsed Signal Low, High or Period Time for the given channel.
+ * @details This service is reentrant and reads the elapsed Signal Low Time for the given channel
+ *          that is configured  in Measurement Mode Signal Measurement, Signal Low Time.
+ *          The elapsed time is measured between a falling edge and the consecutive rising edge of
+ *          the channel.
+ *          This service reads the elapsed Signal High Time for the given channel that is configured
+ *          in Measurement Mode Signal Measurement,Signal High Time.The elapsed time is measured
+ *          between a rising edge and the consecutive falling edge of the channel.
+ *          This service reads the elapsed Signal Period Time for the given channel that is
+ *          configured in Measurement Mode Signal Measurement,  Signal Period Time.The elapsed time
+ *          is measured between consecutive  rising (or falling) edges  of the  channel. The  period
+ *          start edge is
+ *
+ *          configurable.
+ *
+ * @param[in]  instance   Hardware instance of FTM used.
+ * @param[in]  hwChannel  Hardware channel of FTM used.
+ *
+ * @return     uint16 -  the elapsed Signal Low Time for the given channel that is configured in
+ *             Measurement Mode Signal Measurement, Signal Low Time
+ * @pre        Ftm_Icu_Ip_Init must be called before. The channel must be configured in Measurement Mode Signal
+ *             Measurement.
+ */
+uint16 Ftm_Icu_Ip_GetTimeElapsed(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief   This function reads the coherent active time and period time for the given ICU Channel.
+ * @details The function is reentrant and reads the coherent active time and period time for
+ *          the given ICU Channel, if it is configured in Measurement Mode Signal Measurement, Duty
+ *          Cycle Values.
+ *
+ * @param[in]  instance   Hardware instance of FTM used.
+ * @param[in]  hwChannel  Hardware channel of FTM used.
+ * @param[out] dutyCycleValues  structure where duty cycle values are stored 
+ *
+ * @return     void
+ * @pre        Ftm_Icu_Ip_Init must be called before. The given channel must be configured in Measurement Mode
+ *             Signal Measurement, Duty Cycle Values.
+ */
+void Ftm_Icu_Ip_GetDutyCycleValues(uint8 instance,
+                                   uint8 hwChannel,
+                                   Ftm_Icu_Ip_DutyCycleType* dutyCycleValues);
+
+/**
+ * @brief Ftm_Icu_Ip_GetPWandPeriod
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @param activePulseWidth 
+ * @param period 
+ */
+void Ftm_Icu_Ip_GetPWandPeriod(uint8 instance,
+                               uint8 hwChannel,
+                               uint16* activePulseWidth,
+                               uint16* period);
+
+#endif /* STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API */
+
+#if (STD_ON == FTM_ICU_DUAL_CLOCK_MODE_API)
+/**
+ * @brief FTM IP layer that sets the prescaler value for a given instance.
+ * 
+ * @param[in] instance     Hardware instance of FTM used. 
+ * @param[in] prescaler  Value of the prescaler.
+ */
+void Ftm_Icu_Ip_SetPrescaler(uint8 instance, Ftm_Icu_Ip_ClockModeType selectPrescaler);
+#endif /* STD_ON == FTM_ICU_DUAL_CLOCK_MODE_API */
+
+#if ((FTM_ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (FTM_ICU_IP_DEV_ERROR_DETECT == STD_ON))
+#if ((FTM_ICU_EDGE_COUNT_API == STD_ON) || (FTM_ICU_TIMESTAMP_API == STD_ON) || \
+     (FTM_ICU_GET_TIME_ELAPSED_API == STD_ON) || (FTM_ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON))
+/**
+ * @brief FTM IP function that get the state of the overflow flag
+ * 
+ * @param[in] instance     Hardware instance of FTM used. 
+ * @return    boolean    State of the overflow flag.
+ * @retval    TRUE       The overflow flag is set.
+ * @retval    FALSE      The overflow flag is not set.
+ */
+boolean Ftm_Icu_Ip_GetOverflow(uint8 instance);
+#endif
+#endif /* (FTM_ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (FTM_ICU_IP_DEV_ERROR_DETECT == STD_ON) */
+
+#if (STD_ON == FTM_ICU_GET_INPUT_LEVEL_API)
+/**
+ * @brief The API shall return the input read value for the selected pin, if hardware support the functionality.
+ * 
+ * @param[in] instance                Hardware instance of FTM used. 
+ * @param[in] hwChannel               Hardware channel of FTM used.
+ * @return    Ftm_Icu_Ip_LevelType  - Level detected at this time on the input pin
+ */
+Ftm_Icu_Ip_LevelType Ftm_Icu_Ip_GetInputLevel(uint8 instance, uint8 hwChannel);
+#endif
+
+#if (STD_ON == FTM_ICU_GET_INPUT_STATE_API)
+/**
+ * @brief Return input state of the channel.
+ * 
+ * @param[in] instance   Hardware instance of FTM used. 
+ * @param[in] hwChannel  Hardware channel of FTM used.
+ * @return    boolean  Channel level type.
+ */
+boolean Ftm_Icu_Ip_GetInputState(uint8 instance, uint8 hwChannel);
+#endif
+
+/**
+ * @brief Enable channel interrupt.
+ * 
+ * @param[in] instance   Hardware instance of FTM used. 
+ * @param[in] hwChannel  Hardware channel of FTM used.
+ * @return   void.
+ */
+void Ftm_Icu_Ip_EnableInterrupt(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief Disable channel interrupt.
+ * 
+ * @param[in] instance   Hardware instance of FTM used. 
+ * @param[in] hwChannel  Hardware channel of FTM used.
+ * @return   void.
+ */
+void Ftm_Icu_Ip_DisableInterrupt(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief      Driver function Enable Notification for timestamp.
+ *
+ * @param[in]  instance  Hardware instance of FTM used. 
+ * @param[in]  hwChannel Hardware channel of FTM used.
+ * @return     void
+ */
+void Ftm_Icu_Ip_EnableNotification(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief      Driver function Disable Notification for timestamp.
+ *
+ * @param[in]  instance  Hardware instance of FTM used. 
+ * @param[in]  hwChannel Hardware channel of FTM used.
+ * @return     void
+ */
+void Ftm_Icu_Ip_DisableNotification(uint8 instance, uint8 hwChannel);
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#if defined(__cplusplus)
+}
+#endif
+
+/** @} */
+
+#endif /* FTM_ICU_IP_H */

+ 479 - 0
RTD/include/Ftm_Icu_Ip_Irq.h

@@ -0,0 +1,479 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef FTM_ICU_IP_IRQ_H
+#define FTM_ICU_IP_IRQ_H
+
+/**
+ *   @file       Interrupt functions description.
+ *   @details    This file contains the signature of interrups functions that can be used on the 
+ *               FTM module.
+ *   @addtogroup ftm_icu_ip FTM IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "OsIf.h"
+#include "Ftm_Icu_Ip_Cfg.h"
+#include "Ftm_Icu_Ip_Types.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+
+#define FTM_ICU_IP_IRQ_VENDOR_ID                       43
+#define FTM_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION        4
+#define FTM_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION        4
+#define FTM_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION     0
+#define FTM_ICU_IP_IRQ_SW_MAJOR_VERSION                1
+#define FTM_ICU_IP_IRQ_SW_MINOR_VERSION                0
+#define FTM_ICU_IP_IRQ_SW_PATCH_VERSION                0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and OsIf.h file are of the same Autosar version */
+    #if ((FTM_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION != OSIF_AR_RELEASE_MAJOR_VERSION) || \
+         (FTM_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION != OSIF_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Ftm_Icu_Ip_Irq.h and OsIf.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (FTM_ICU_IP_IRQ_VENDOR_ID != FTM_ICU_IP_CFG_VENDOR_ID)
+    #error "Ftm_Icu_Ip_Irq.h and Ftm_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((FTM_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION != FTM_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION != FTM_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION != FTM_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Ftm_Icu_Ip_Irq.h and Ftm_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((FTM_ICU_IP_IRQ_SW_MAJOR_VERSION != FTM_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_SW_MINOR_VERSION != FTM_ICU_IP_CFG_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_SW_PATCH_VERSION != FTM_ICU_IP_CFG_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Ftm_Icu_Ip_Irq.h and Ftm_Icu_Ip_Cfg.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (FTM_ICU_IP_IRQ_VENDOR_ID !=  FTM_ICU_IP_TYPES_VENDOR_ID)
+    #error "Ftm_Icu_Ip_Irq.h and Ftm_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((FTM_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION !=  FTM_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION !=  FTM_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION !=  FTM_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Ftm_Icu_Ip_Irq.h and Ftm_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((FTM_ICU_IP_IRQ_SW_MAJOR_VERSION !=  FTM_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_SW_MINOR_VERSION !=  FTM_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_SW_PATCH_VERSION !=  FTM_ICU_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Ftm_Icu_Ip_Irq.h and Ftm_Icu_Ip_Types.h are different"
+#endif
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+#if (defined FTM_ICU_0_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 0.
+ */
+ISR(FTM_0_ISR);
+#endif
+
+#if (defined FTM_ICU_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 1.
+ */
+ISR(FTM_1_ISR);
+#endif
+
+
+
+#if (defined FTM_ICU_0_CH_0_CH_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 0 channel 0 - channel 1.
+ */
+ISR(FTM_0_CH_0_CH_1_ISR);
+#endif
+
+#if (defined FTM_ICU_0_CH_2_CH_3_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 0 channel 2 - channel 3.
+ */
+ISR(FTM_0_CH_2_CH_3_ISR);
+#endif
+
+#if (defined FTM_ICU_0_CH_4_CH_5_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 0 channel 4 - channel 5.
+ */
+ISR(FTM_0_CH_4_CH_5_ISR);
+#endif
+
+#if (defined FTM_ICU_0_CH_6_CH_7_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 0 channel 6 - channel 7.
+ */
+ISR(FTM_0_CH_6_CH_7_ISR);
+#endif
+
+#if (defined FTM_ICU_1_CH_0_CH_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 1 channel 0 - channel 1.
+ */
+ISR(FTM_1_CH_0_CH_1_ISR);
+#endif
+
+#if (defined FTM_ICU_1_CH_2_CH_3_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 1 channel 2 - channel 3.
+ */
+ISR(FTM_1_CH_2_CH_3_ISR);
+#endif
+
+#if (defined FTM_ICU_1_CH_4_CH_5_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 1 channel 4 - channel 5.
+ */
+ISR(FTM_1_CH_4_CH_5_ISR);
+#endif
+
+#if (defined FTM_ICU_1_CH_6_CH_7_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 1 channel 6 - channel 7.
+ */
+ISR(FTM_1_CH_6_CH_7_ISR);
+#endif
+
+#if (defined FTM_ICU_2_CH_0_CH_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 2 channel 0 - channel 1.
+ */
+ISR(FTM_2_CH_0_CH_1_ISR);
+#endif
+
+#if (defined FTM_ICU_2_CH_2_CH_3_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 2 channel 2 - channel 3.
+ */
+ISR(FTM_2_CH_2_CH_3_ISR);
+#endif
+
+#if (defined FTM_ICU_2_CH_4_CH_5_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 2 channel 4 - channel 5.
+ */
+ISR(FTM_2_CH_4_CH_5_ISR);
+#endif
+
+#if (defined FTM_ICU_2_CH_6_CH_7_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 2 channel 6 - channel 7.
+ */
+ISR(FTM_2_CH_6_CH_7_ISR);
+#endif
+
+#if (defined FTM_ICU_3_CH_0_CH_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 3 channel 0 - channel 1.
+ */
+ISR(FTM_3_CH_0_CH_1_ISR);
+#endif
+
+#if (defined FTM_ICU_3_CH_2_CH_3_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 3 channel 2 - channel 3.
+ */
+ISR(FTM_3_CH_2_CH_3_ISR);
+#endif
+
+#if (defined FTM_ICU_3_CH_4_CH_5_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 3 channel 4 - channel 5.
+ */
+ISR(FTM_3_CH_4_CH_5_ISR);
+#endif
+
+#if (defined FTM_ICU_3_CH_6_CH_7_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 3 channel 6 - channel 7.
+ */
+ISR(FTM_3_CH_6_CH_7_ISR);
+#endif
+
+#if (defined FTM_ICU_4_CH_0_CH_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 4 channel 0 - channel 1.
+ */
+ISR(FTM_4_CH_0_CH_1_ISR);
+#endif
+
+#if (defined FTM_ICU_4_CH_2_CH_3_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 4 channel 2 - channel 3.
+ */
+ISR(FTM_4_CH_2_CH_3_ISR);
+#endif
+
+#if (defined FTM_ICU_4_CH_4_CH_5_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 4 channel 4 - channel 5.
+ */
+ISR(FTM_4_CH_4_CH_5_ISR);
+#endif
+
+#if (defined FTM_ICU_4_CH_6_CH_7_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 4 channel 6 - channel 7.
+ */
+ISR(FTM_4_CH_6_CH_7_ISR);
+#endif
+
+#if (defined FTM_ICU_5_CH_0_CH_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 5 channel 0 - channel 1.
+ */
+ISR(FTM_5_CH_0_CH_1_ISR);
+#endif
+
+#if (defined FTM_ICU_5_CH_2_CH_3_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 5 channel 2 - channel 3.
+ */
+ISR(FTM_5_CH_2_CH_3_ISR);
+#endif
+
+#if (defined FTM_ICU_5_CH_4_CH_5_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 5 channel 4 - channel 5.
+ */
+ISR(FTM_5_CH_4_CH_5_ISR);
+#endif
+
+#if (defined FTM_ICU_5_CH_6_CH_7_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 5 channel 6 - channel 7.
+ */
+ISR(FTM_5_CH_6_CH_7_ISR);
+#endif
+
+#if (defined FTM_ICU_6_CH_0_CH_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 6 channel 0 - channel 1.
+ */
+ISR(FTM_6_CH_0_CH_1_ISR);
+#endif
+
+#if (defined FTM_ICU_6_CH_2_CH_3_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 6 channel 2 - channel 3.
+ */
+ISR(FTM_6_CH_2_CH_3_ISR);
+#endif
+
+#if (defined FTM_ICU_6_CH_4_CH_5_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 6 channel 4 - channel 5.
+ */
+ISR(FTM_6_CH_4_CH_5_ISR);
+#endif
+
+#if (defined FTM_ICU_6_CH_6_CH_7_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 6 channel 6 - channel 7.
+ */
+ISR(FTM_6_CH_6_CH_7_ISR);
+#endif
+
+#if (defined FTM_ICU_7_CH_0_CH_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 7 channel 0 - channel 1.
+ */
+ISR(FTM_7_CH_0_CH_1_ISR);
+#endif
+
+#if (defined FTM_ICU_7_CH_2_CH_3_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 7 channel 2 - channel 3.
+ */
+ISR(FTM_7_CH_2_CH_3_ISR);
+#endif
+
+#if (defined FTM_ICU_7_CH_4_CH_5_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 7 channel 4 - channel 5.
+ */
+ISR(FTM_7_CH_4_CH_5_ISR);
+#endif
+
+#if (defined FTM_ICU_7_CH_6_CH_7_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 7 channel 6 - channel 7.
+ */
+ISR(FTM_7_CH_6_CH_7_ISR);
+#endif
+
+#if (defined FTM_ICU_0_OVF_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 0 overflow.
+ */
+ISR(FTM_0_OVF_ISR);
+#endif
+
+#if (defined FTM_ICU_1_OVF_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 1 overflow.
+ */
+ISR(FTM_1_OVF_ISR);
+#endif
+
+#if (defined FTM_ICU_2_OVF_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 2 overflow.
+ */
+ISR(FTM_2_OVF_ISR);
+#endif
+
+#if (defined FTM_ICU_3_OVF_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 3 overflow.
+ */
+ISR(FTM_3_OVF_ISR);
+#endif
+
+#if (defined FTM_ICU_4_OVF_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 4 overflow.
+ */
+ISR(FTM_4_OVF_ISR);
+#endif
+
+#if (defined FTM_ICU_5_OVF_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 5 overflow.
+ */
+ISR(FTM_5_OVF_ISR);
+#endif
+
+#if (defined FTM_ICU_6_OVF_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 6 overflow.
+ */
+ISR(FTM_6_OVF_ISR);
+#endif
+
+#if (defined FTM_ICU_7_OVF_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 7 overflow.
+ */
+ISR(FTM_7_OVF_ISR);
+#endif
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* FTM_ICU_IP_IRQ_H */

+ 387 - 0
RTD/include/Ftm_Icu_Ip_Types.h

@@ -0,0 +1,387 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef FTM_ICU_IP_TYPES_H
+#define FTM_ICU_IP_TYPES_H
+
+/**
+ *   @file       Ftm_Icu_Ip_[!IF "var:defined('postBuildVariant')"!][!"$postBuildVariant"!]_[!ENDIF!]PBcfg.c
+ *   @version    1.0.0
+ *
+ *   @brief      AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details    Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup ftm_icu_ip FTM IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Ftm_Icu_Ip_Defines.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define FTM_ICU_IP_TYPES_VENDOR_ID                     43
+#define FTM_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION      4
+#define FTM_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION      4
+#define FTM_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION   0
+#define FTM_ICU_IP_TYPES_SW_MAJOR_VERSION              1
+#define FTM_ICU_IP_TYPES_SW_MINOR_VERSION              0
+#define FTM_ICU_IP_TYPES_SW_PATCH_VERSION              0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if header file and Std_Types.h file are of the same Autosar version */
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((FTM_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (FTM_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Ftm_Icu_Ip_Types.h and Std_Types.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (FTM_ICU_IP_TYPES_VENDOR_ID != FTM_ICU_IP_DEFINES_VENDOR_ID)
+    #error "Ftm_Icu_Ip_Types.h and Ftm_Icu_Ip_Defines.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((FTM_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION != FTM_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION != FTM_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION != FTM_ICU_IP_DEFINES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Ftm_Icu_Ip_Types.h and Ftm_Icu_Ip_Defines.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((FTM_ICU_IP_TYPES_SW_MAJOR_VERSION != FTM_ICU_IP_DEFINES_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_TYPES_SW_MINOR_VERSION != FTM_ICU_IP_DEFINES_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_TYPES_SW_PATCH_VERSION != FTM_ICU_IP_DEFINES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Ftm_Icu_Ip_Types.h and Ftm_Icu_Ip_Defines.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+/** @brief Channel number for CHAN0 */
+#define CHAN0_IDX (0U)
+/** @brief Channel number for CHAN1 */
+#define CHAN1_IDX (1U)
+/** @brief Channel number for CHAN2 */
+#define CHAN2_IDX (2U)
+/** @brief Channel number for CHAN3 */
+#define CHAN3_IDX (3U)
+/** @brief Channel number for CHAN4 */
+#define CHAN4_IDX (4U)
+
+/** @brief Maximum value of FTM counter. */
+#define FTM_MAX_VAL_COUNTER                 (0xFFFFUL)
+
+
+/** @brief Set flag COMINEx for specified pair: 0, 1, 2. */
+#define FTM_COMBINE_COMBINEx_SHIFT(u8ChannelIdx)        ((uint32)(((((uint32)u8ChannelIdx) >> (uint32)1U) * (uint32)8U) + (uint32)0U))
+#define FTM_COMBINE_COMBINEx_MASK_U32(u8ChannelIdx)     ((uint32)((uint32)1U << FTM_COMBINE_COMBINEx_SHIFT(u8ChannelIdx)))
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+
+/** @brief FTM clock source selection. */
+typedef enum
+{
+    /** @brief No clock selected. This in effect disables the FTM counter. */
+    FTM_NO_CLOCK_SELECTED     = 0U,
+    /** @brief FTM input clock. */
+    FTM_SYSTEM_CLOCK          = 1U,
+    /** @brief Fixed frequency clock. */
+    FTM_FIXED_FREQUENCY_CLOCK = 2U,
+    /** @brief External clock. */
+    FTM_EXTERNAL_CLOCK        = 3U
+} Ftm_Icu_Ip_ClockSourceType;
+
+/** @brief FTM debug modes of operation. */
+typedef enum
+{
+    /** @brief FTM counter - stopped. */ 
+    MODE_0 = 0U,
+    /** @brief FTM counter - stopped. */ 
+    MODE_1 = 1U,
+    /** @brief FTM counter - stopped. */ 
+    MODE_2 = 2U,
+    /** @brief FTM counter - functional mode. */ 
+    MODE_3 = 3U
+} Ftm_Icu_Ip_DebugModeType;
+
+/** @brief Activation condition for the measurement - selecting edge type. */
+typedef enum
+{
+    /** @brief No trigger. */
+    FTM_ICU_NO_PIN_CONTROL          = 0x00U,
+    /** @brief Rising edge trigger. */
+    FTM_ICU_RISING_EDGE             = 0x01U,
+    /** @brief Falling edge trigger. */
+    FTM_ICU_FALLING_EDGE            = 0x02U,
+    /** @brief Rising and falling edge trigger */
+    FTM_ICU_BOTH_EDGES              = 0x03U
+} Ftm_Icu_Ip_EdgeType; 
+
+/** @brief Operation mode for ICU driver. */
+typedef enum
+{
+    /** @brief No measurement mode. */
+    FTM_ICU_MODE_NO_MEASUREMENT      = 0x0U,
+    /** @brief Signal edge detect measurement mode. */
+    FTM_ICU_MODE_SIGNAL_EDGE_DETECT  = 0x1U,
+    /** @brief Signal measurement mode.*/
+    FTM_ICU_MODE_SIGNAL_MEASUREMENT  = 0x2U,
+    /** @brief Timestamp measurement mode.*/
+    FTM_ICU_MODE_TIMESTAMP           = 0x4U,
+    /** @brief Edge counter measurement mode.*/
+    FTM_ICU_MODE_EDGE_COUNTER        = 0x8U
+} Ftm_Icu_Ip_ModeType; 
+
+/** @brief Enable/disable DMA support for timestamp. */
+typedef enum
+{
+    /* Disable DMA support. */
+    FTM_ICU_MODE_WITHOUT_DMA = 0U,
+    /* Enable DMA support. */
+    FTM_ICU_MODE_WITH_DMA    = 1U
+} Ftm_Icu_Ip_SubModeType;
+
+/** @brief Type of operation for signal measurement. */
+typedef enum
+{
+    /** @brief No measurement. */
+    FTM_ICU_NO_MEASUREMENT = 0U,
+    /** @brief The time measurement for OFF period. */ 
+    FTM_ICU_LOW_TIME       = 1U,
+    /** @brief The time measurement for ON period. */ 
+    FTM_ICU_HIGH_TIME      = 2U,
+    /** @brief Period measurement between two consecutive falling/raising edges. */
+    FTM_ICU_PERIOD_TIME    = 4U,
+    /** @brief The fraction of active period. */
+    FTM_ICU_DUTY_CYCLE     = 8U
+} Ftm_Icu_Ip_MeasType; 
+
+
+#if (STD_ON == FTM_ICU_GET_INPUT_LEVEL_API)
+/** @brief Enumeration used for returning the level of input pin. */
+typedef enum
+{
+    /** @brief Low level state.  */
+    FTM_ICU_LEVEL_LOW   = 0x0U,
+    /** @brief High level state. */
+    FTM_ICU_LEVEL_HIGH  = 0x1U
+} Ftm_Icu_Ip_LevelType;
+#endif
+
+/* #if (defined(ICU_DUAL_CLOCK_MODE_API) && (ICU_DUAL_CLOCK_MODE_API == STD_ON)) */
+/** @brief Definition of prescaler type (Normal or Alternate) */
+typedef enum
+{
+    FTM_ICU_NORMAL_CLK        = 0x0U,  /**< @brief Normal prescaler         */
+    FTM_ICU_ALTERNATE_CLK     = 0x1U   /**< @brief Alternate prescaler      */
+} Ftm_Icu_Ip_ClockModeType;
+/* #endif */
+
+/** @brief Generic error codes. */
+typedef enum
+{
+    /** @brief Generic operation success status. */
+    FTM_IP_STATUS_SUCCESS                         = 0x00U,
+    /** @brief Generic operation failure status. */
+    FTM_IP_STATUS_ERROR                           = 0x01U
+} Ftm_Icu_Ip_StatusType;
+
+
+#if (FTM_ICU_TIMESTAMP_API == STD_ON)
+/** @brief Type of operation for timestamp. */
+typedef enum
+{
+    /** @brief No timestamp. */
+    FTM_ICU_NO_TIMESTAMP = 0U,
+    /** @brief The timestamp with circular buffer . */ 
+    FTM_ICU_CIRCULAR_BUFFER       = 1U,
+    /** @brief The timestamp with linear buffer . */ 
+    FTM_ICU_LINEAR_BUFFER      = 2U
+} Ftm_Icu_Ip_TimestampBufferType; 
+#endif
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+/** @brief The notification functions shall have no parameters and no return value.*/
+typedef void                             (*Ftm_Icu_Ip_NotifyType)(void);
+
+/** @brief Structure that contains ICU Duty cycle parameters. It contains the values needed for
+ *         calculating duty cycles i.e Period time value and active time value.
+ */
+typedef struct
+{
+    uint16 ActiveTime;         /**< @brief Low or High time value. */
+    uint16 PeriodTime;         /**< @brief Period time value. */
+} Ftm_Icu_Ip_DutyCycleType;
+
+/** @brief Callback type for each channel. */
+typedef void (*Ftm_Icu_Ip_CallbackType)(uint16 callbackParam1, boolean callbackParam2);
+
+/** @brief Callback type for each channel. */
+typedef void (*Ftm_Icu_Ip_LogicChState)(uint16 logicChannel, uint8 mask, boolean set);
+
+/** @brief FlexTimer driver Input capture parameters for each channel. */
+typedef struct
+{
+    uint8                          hwChannel;                  /*!< Physical hardware channel ID*/
+    Ftm_Icu_Ip_ModeType            chMode;                     /*!< FlexTimer module mode of operation  */
+    Ftm_Icu_Ip_SubModeType         chSubMode;                  /*!< FlexTimer specific name of operation to execute  */
+    Ftm_Icu_Ip_MeasType            measurementMode;            /*!< Measurement Mode for signal measurement*/
+    Ftm_Icu_Ip_EdgeType            edgeAlignement;             /*!< Edge alignment Mode for signal measurement*/
+    boolean                        continuouseEn;              /*!< Continuous measurement state */
+    uint8                          filterValue;                /*!< Filter Value */
+    Ftm_Icu_Ip_CallbackType        callback;                   /*!< The callback function for channels edge detect events */
+    uint8                          callbackParams;             /*!< The parameters of callback functions for channels events */
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+    Ftm_Icu_Ip_TimestampBufferType timestampBufferType;        /*!< Timestamp buffer type for timestamp mode*/
+#endif
+    Ftm_Icu_Ip_LogicChState        logicChStateCallback;       /*!< Store address of function used to change the logic state of the channel in HLD. */
+    boolean                        initNotificationEnable;     /*!< Store the initialization state that determines whether Notifications are enabled, it is always TRUE with standalone IPL and FALSE with AUTOSAR mode. */
+    Ftm_Icu_Ip_NotifyType          ftmChannelNotification;     /*!< The notification functions shall have no parameters and no return value.*/
+    Ftm_Icu_Ip_NotifyType          ftmOverflowNotification;    /*!< The overflow notification functions shall have no parameters and no return value.*/
+} Ftm_Icu_Ip_ChannelConfigType;
+
+/** @brief FTM IP layer module configuration. */
+typedef struct
+{
+    /** @brief Type of clock source used. */
+    Ftm_Icu_Ip_ClockSourceType cfgClkSrc;
+    /** @brief Prescaler value. */
+    uint8                      cfgPrescaler;
+#if (FTM_ICU_DUAL_CLOCK_MODE_API == STD_ON)
+    /** @brief Alternant prescaler value. */
+    uint8                      cfgAltPrescaler;
+#endif
+    /** @brief Debug mode. */
+    Ftm_Icu_Ip_DebugModeType   debugMode;
+    /** @brief Maximum counter value. Minimum value is 0. */
+    uint16                     maxCountValue;
+} Ftm_Icu_Ip_InstanceConfigType;
+
+/** @brief FTM driver input capture parameters. */
+typedef struct
+{
+    /** @brief Number of input capture channel used. */
+    uint8                                   nNumChannels;
+    /** @brief Input capture instance configuration. */
+    const Ftm_Icu_Ip_InstanceConfigType     *pInstanceConfig;
+    /** @brief Input capture channels configuration. */
+    const Ftm_Icu_Ip_ChannelConfigType      (*pChannelsConfig)[];
+} Ftm_Icu_Ip_ConfigType;
+
+
+/** @brief This structure is used by the IPL driver for internal logic. */
+typedef struct
+{
+#if (defined(FTM_ICU_SIGNAL_MEASUREMENT_API) && (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API))
+    /** @brief Store the status of the first measurement. */
+    boolean                                     firstEdge;
+    /** @brief Store the first edge come to measurement in BOTH_EDGE mode. */
+    boolean                                     firstEdgePolarity;
+    /** @brief Signal measurement mode. */
+    Ftm_Icu_Ip_MeasType                         measurement;
+    /** @brief Variable for saving the period. */
+    uint16                                      ftm_Icu_Ip_aPeriod;
+    /** @brief Variable for saving the pulse width of active time. */
+    uint16                                      ftm_Icu_Ip_aActivePulseWidth;
+#endif
+    /** @brief The notification functions for TIME_STAMP or SIGNAL_EDGE_DETECT mode. */
+    Ftm_Icu_Ip_NotifyType                       ftmChannelNotification;
+    /** @brief The overflow notification functions. */
+    Ftm_Icu_Ip_NotifyType                       ftmOverflowNotification;
+#if (defined(FTM_ICU_EDGE_COUNT_API) && (STD_ON == FTM_ICU_EDGE_COUNT_API))
+    /** @brief Logic variable to count edges. */
+    uint16                                      edgeNumbers;
+#endif
+    /** @brief FTM channel mode. */
+    Ftm_Icu_Ip_ModeType                         channelMode;
+    /** @brief Type of edge used for activation. */
+    Ftm_Icu_Ip_EdgeType                         edgeTrigger;
+    /** @brief Support DMA or not. */
+    Ftm_Icu_Ip_SubModeType                      dmaMode;
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+    /** @brief Pointer to the buffer-array where the timestamp values shall be placed. */
+    uint16*                                     ftm_Icu_Ip_aBuffer;
+    /** @brief Variable for saving the size of the external buffer (number of entries). */
+    uint16                                      ftm_Icu_Ip_aBufferSize;
+    /** @brief Variable for saving Notification interval (number of events). */
+    uint16                                      ftm_Icu_Ip_aBufferNotify;
+    /** @brief Variable for saving the number of notify counts. */
+    uint16                                      ftm_Icu_Ip_aNotifyCount;
+    /** @brief Variable for saving the time stamp index. */
+    uint16                                      ftm_Icu_Ip_aBufferIndex;
+    /** @brief Timestamp buffer type for timestamp mode. */
+    Ftm_Icu_Ip_TimestampBufferType              timestampBufferType;
+#endif /* STD_ON == FTM_ICU_TIMESTAMP_API */
+    Ftm_Icu_Ip_LogicChState                     logicChStateCallback;       /*!< Store address of function used to change the logic state of the channel in HLD. */
+    /** @brief Calback for other types of measurement.*/
+    Ftm_Icu_Ip_CallbackType                     callback;
+    /** @brief Logic channel for which callback is executed. */
+    uint16                                      callbackParam;
+    /** @brief Store the state determines whether Notifications are enabled or not. */
+    boolean                                     notificationEnable;
+} Ftm_Icu_Ip_ChStateType;
+
+/** @brief  This structure is used by the IPL driver for internal logic. */
+typedef struct
+{
+    /** @brief Module initialization state. */
+    boolean    instInit;
+    /** @brief Module prescaler value. */
+    uint8      prescaler;
+    /** @brief Module alternate prescaler value. */
+    uint8      prescalerAlternate;
+    uint8   spuriousMask;     /* Mask with channels not verified for spurious interrupt.*/  
+} Ftm_Icu_Ip_InstStateType;
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* FTM_ICU_IP_TYPES_H */

+ 1250 - 0
RTD/include/Icu.h

@@ -0,0 +1,1250 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_H
+#define ICU_H
+
+/**
+ *     @file
+ *
+ *     @addtogroup icu Icu Driver
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Mcal.h"
+#include "StandardTypes.h"
+#include "Icu_Cfg.h"
+#include "Icu_Irq.h"
+#include "Icu_Types.h"
+#include "Icu_Ipw_Types.h"
+
+#if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
+#include "EcuM_Externals.h"
+#endif
+
+#if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
+#include "CDD_Mcl.h"
+#endif
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_VENDOR_ID                       43
+#define ICU_MODULE_ID                       122
+#define ICU_AR_RELEASE_MAJOR_VERSION        4
+#define ICU_AR_RELEASE_MINOR_VERSION        4
+#define ICU_AR_RELEASE_REVISION_VERSION     0
+#define ICU_SW_MAJOR_VERSION                1
+#define ICU_SW_MINOR_VERSION                0
+#define ICU_SW_PATCH_VERSION                0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+
+/* Check if header file and StandardTypes.h file are of the same Autosar version */
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((ICU_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (ICU_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+    #error "AutoSar Version Numbers of Icu.h and StandardTypes.h are different"
+    #endif
+    
+    #if ((ICU_AR_RELEASE_MAJOR_VERSION != MCAL_AR_RELEASE_MAJOR_VERSION) || \
+         (ICU_AR_RELEASE_MINOR_VERSION != MCAL_AR_RELEASE_MINOR_VERSION))
+    #error "AutoSar Version Numbers of Icu.h and Mcal.h are different"
+    #endif
+
+#if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))    
+    /* Check Icu_Cfg.c against CDD_Mcl.h file versions */
+    #if ((ICU_AR_RELEASE_MAJOR_VERSION != CDD_MCL_AR_RELEASE_MAJOR_VERSION_H) || \
+         (ICU_AR_RELEASE_MINOR_VERSION != CDD_MCL_AR_RELEASE_MINOR_VERSION_H))
+        #error "AutoSar Version Numbers of Icu.h and CDD_Mcl.h are different"
+    #endif
+#endif
+#endif
+
+/* Check if source file and ICU configuration header file are of the same vendor */
+#if (ICU_VENDOR_ID != ICU_CFG_VENDOR_ID)
+    #error "Icu.h and Icu_Cfg.h have different vendor IDs"
+#endif
+    /* Check if header file and ICU configuration header file are of the same Autosar version */
+#if ((ICU_AR_RELEASE_MAJOR_VERSION != ICU_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION != ICU_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION != ICU_CFG_AR_RELEASE_REVISION_VERSION))
+#error "AutoSar Version Numbers of Icu.h and Icu_Cfg.h are different"
+#endif
+/* Check if header file and ICU configuration header file are of the same software version */
+#if ((ICU_SW_MAJOR_VERSION != ICU_CFG_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION != ICU_CFG_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION != ICU_CFG_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu.h and Icu_Cfg.h are different"
+#endif
+
+/* Check if source file and ICU types header file are of the same vendor */
+#if (ICU_VENDOR_ID != ICU_IRQ_VENDOR_ID)
+    #error "Icu.h and Icu_Irq.h have different vendor IDs"
+#endif
+    /* Check if header file and ICU types header file are of the same Autosar version */
+#if ((ICU_AR_RELEASE_MAJOR_VERSION != ICU_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION != ICU_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION != ICU_IRQ_AR_RELEASE_REVISION_VERSION))
+#error "AutoSar Version Numbers of Icu.h and Icu_Irq.h are different"
+#endif
+/* Check if header file and ICU types header file are of the same software version */
+#if ((ICU_SW_MAJOR_VERSION != ICU_IRQ_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION != ICU_IRQ_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION != ICU_IRQ_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu.h and Icu_Irq.h are different"
+#endif
+
+/* Check if source file and ICU types header file are of the same vendor */
+#if (ICU_VENDOR_ID != ICU_TYPES_VENDOR_ID)
+    #error "Icu.h and Icu_Types.h have different vendor IDs"
+#endif
+    /* Check if header file and ICU types header file are of the same Autosar version */
+#if ((ICU_AR_RELEASE_MAJOR_VERSION != ICU_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION != ICU_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION != ICU_TYPES_AR_RELEASE_REVISION_VERSION))
+#error "AutoSar Version Numbers of Icu.h and Icu_Types.h are different"
+#endif
+/* Check if header file and ICU types header file are of the same software version */
+#if ((ICU_SW_MAJOR_VERSION != ICU_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION != ICU_TYPES_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION != ICU_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu.h and Icu_Types.h are different"
+#endif
+
+/* Check if source file and ICU types header file are of the same vendor */
+#if (ICU_VENDOR_ID != ICU_IPW_TYPES_VENDOR_ID)
+    #error "Icu.h and Icu_Ipw_Types.h have different vendor IDs"
+#endif
+    /* Check if header file and ICU types header file are of the same Autosar version */
+#if ((ICU_AR_RELEASE_MAJOR_VERSION != ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION != ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION != ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION))
+#error "AutoSar Version Numbers of Icu.h and Icu_Ipw_Types.h are different"
+#endif
+/* Check if header file and ICU types header file are of the same software version */
+#if ((ICU_SW_MAJOR_VERSION != ICU_IPW_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION != ICU_IPW_TYPES_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION != ICU_IPW_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu.h and Icu_Ipw_Types.h are different"
+#endif
+
+#if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
+    #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+        /* Check if header file and EcuM_Cbk.h file are of the same Autosar version */
+        #if ((ICU_AR_RELEASE_MAJOR_VERSION != ECUM_CBK_AR_RELEASE_MAJOR_VERSION) || \
+             (ICU_AR_RELEASE_MINOR_VERSION != ECUM_CBK_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Icu.h and EcuM_Cbk.h are different"
+        #endif
+    #endif
+#endif  /* ICU_REPORT_WAKEUP_SOURCE */
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+/**
+* @brief   API service used with a value is not in range
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_PARAM_CONFIG             ((uint8)0x09)
+
+/**
+* @brief   API Icu_Init service called with wrong parameter
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_INIT_FAILED               ((uint8)0x0D)
+
+/**
+* @brief   API service used with an invalid channel identifier or channel was not configured for
+*          the functionality of the calling API
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_PARAM_CHANNEL             ((uint8)0x0B)
+
+/**
+* @brief   API service used with an invalid or not feasible activation
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_PARAM_ACTIVATION          ((uint8)0x0C)
+
+/**
+* @brief   API service used with an invalid application-buffer pointer
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_PARAM_POINTER             ((uint8)0x0A)
+
+/**
+* @brief   API service used with an invalid buffer size
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_PARAM_BUFFER_SIZE         ((uint8)0x0E)
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_SET_MODE_API == STD_ON))
+/**
+* @brief   API service Icu_SetMode used with an invalid mode
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_PARAM_MODE                ((uint8)0x0F)
+#endif
+
+/**
+* @brief   API service used without module initialization
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_UNINIT                    ((uint8)0x14)
+
+#if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) && (ICU_SET_MODE_API == STD_ON))
+/**
+* @brief   API service Icu_SetMode is called while a running operation
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_BUSY_OPERATION            ((uint8)0x16)
+#endif
+
+/**
+* @brief   API Icu_Init service called when the ICU driver and the Hardware
+*          are already initialized
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_ALREADY_INITIALIZED       ((uint8)0x17)
+
+/**
+* @brief   API Icu_StartTimeStamp is called and the parameter NotifyInterval is invalid (e.g. 0,
+*           NotifyInterval < 1)
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_PARAM_NOTIFY_INTERVAL     ((uint8)0x18)
+
+/**
+* @brief   API Icu_GetVersionInfo is called and the parameter versioninfo is is invalid
+*          ( e.g. NULL )
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_PARAM_VINFO               ((uint8)0x19)
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_DUAL_CLOCK_MODE_API == STD_ON))
+/**
+* @brief    API Icu_SetClockMode service called with wrong parameter
+* @implements Icu_ErrorCodes_define
+*/
+#define ICU_E_PARAM_CLOCK_MODE          ((uint8)0x7AU)
+#endif
+
+#if ((ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (ICU_VALIDATE_PARAMS == STD_ON))
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+/**
+* @brief   API Icu_GetEdgeNumbers service called when the Counter rolls over
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_EDGECOUNTING_OVERFLOW     ((uint8)0xD0)
+#endif
+
+#if (ICU_TIMESTAMP_API == STD_ON)
+/**
+* @brief   API Icu_GetTimestampIndex service called when the Time stamp count overflows
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_TIMESTAMP_OVERFLOW        ((uint8)0xD1)
+#endif
+
+#if ((ICU_OVERFLOW_NOTIFICATION_API == STD_OFF)&&((ICU_GET_TIME_ELAPSED_API== STD_ON) || (ICU_GET_DUTY_CYCLE_VALUES_API== STD_ON)))
+/**
+* @brief   API Icu_GetTimeElapsed service called when the Time elapsed overflows
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_MEASUREMENT_OVERFLOW      ((uint8)0xD2)
+#endif
+#endif
+
+/**
+* @brief   API Check mode before set up feature for channel
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_FORBIDEN_MODE             ((uint8)0xD4)
+
+/**
+* @brief API service ID for Icu_Init function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_INIT_ID                     ((uint8)0x00)
+/**
+* @brief API service ID for Icu_DeInit function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_DEINIT_ID                   ((uint8)0x01)
+
+#if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) && (ICU_SET_MODE_API == STD_ON))
+/**
+* @brief API service ID for Icu_SetMode function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_SETMODE_ID                  ((uint8)0x02)
+#endif
+
+#if (ICU_DISABLE_WAKEUP_API == STD_ON)
+#if ((ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON) || (ICU_VALIDATE_PARAMS == STD_ON))
+/**
+* @brief API service ID for Icu_DisableWakeup function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_DISABLEWAKEUP_ID            ((uint8)0x03)
+
+#endif
+#endif
+
+#if (ICU_ENABLE_WAKEUP_API == STD_ON)
+#if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) || (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON) || (ICU_VALIDATE_PARAMS == STD_ON))
+
+/**
+* @brief API service ID for Icu_EnableWakeup function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_ENABLEWAKEUP_ID             ((uint8)0x04)
+
+#endif
+#endif
+
+/**
+* @brief API service ID for Icu_SetActivationCondition function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_SETACTIVATIONCONDITION_ID   ((uint8)0x05)
+
+/**
+* @brief API service ID for Icu_DisableNotification function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_DISABLENOTIFICATION_ID      ((uint8)0x06)
+
+/**
+* @brief API service ID for Icu_EnableNotification function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_ENABLENOTIFICATION_ID       ((uint8)0x07)
+
+#if ((ICU_GET_INPUT_STATE_API == STD_ON) && (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON))
+/**
+* @brief API service ID for Icu_GetInputState function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_GETINPUTSTATE_ID            ((uint8)0x08)
+#endif
+
+/**
+* @brief API service ID for Icu_StartTimestamp function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_STARTTIMESTAMP_ID           ((uint8)0x09)
+
+/**
+* @brief API service ID for Icu_GetTimestampIndex function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_GETTIMESTAMPINDEX_ID        ((uint8)0x0B)
+
+/**
+* @brief API service ID for Icu_ResetEdgeCount function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_RESETEDGECOUNT_ID           ((uint8)0x0C)
+
+/**
+* @brief API service ID for Icu_EnableEdgeCount function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_ENABLEEDGECOUNT_ID          ((uint8)0x0D)
+
+/**
+* @brief API service ID for Icu_DisableEdgeCount function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_DISABLEEDGECOUNT_ID         ((uint8)0x0E)
+
+/**
+* @brief API service ID for Icu_GetEdgeNumbers function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_GETEDGENUMBERS_ID           ((uint8)0x0F)
+
+/**
+* @brief API service ID for Icu_GetTimeElapsed function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_GETTIMEELAPSED_ID           ((uint8)0x10)
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON))
+/**
+* @brief API service ID for Icu_GetDutyCycleValues function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_GETDUTYCYCLEVALUES_ID       ((uint8)0x11)
+#endif
+
+/**
+* @brief API service ID for Icu_GetVersionInfo function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_GETVERSIONINFO_ID           ((uint8)0x12)
+
+/**
+* @brief API service ID for Icu_StartSignalMeasurement function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_STARTSIGNALMEASUREMENT_ID   ((uint8)0x13)
+
+/**
+* @brief API service ID for Icu_StopSignalMeasurement function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_STOPSIGNALMEASUREMENT_ID    ((uint8)0x14)
+
+#if ((ICU_WAKEUP_FUNCTIONALITY_API == STD_ON) && (ICU_VALIDATE_GLOBAL_CALL == STD_ON))
+/**
+* @brief API service ID for Icu_CheckWakeup function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_CHECKWAKEUP_ID              ((uint8)0x15)
+#endif
+
+/**
+* @brief API service ID for Icu_EnableEdgeDetection function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_ENABLEEDGEDETECTION_ID      ((uint8)0x16)
+
+/**
+* @brief API service ID for Icu_DisableEdgeDetection function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_DISABLEEDGEDETECTION_ID     ((uint8)0x17)
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_DUAL_CLOCK_MODE_API == STD_ON))
+/**
+* @brief   API service ID for Icu_SetClockMode function
+* @details Parameters used when raising an error/exception
+*/
+#define ICU_SET_CLOCK_MODE_ID           ((uint8)0x7BU)
+#endif
+
+#if ((ICU_CAPTURERGISTER_API == STD_ON) && ((ICU_SIGNAL_MEASUREMENT_API == STD_ON) || (ICU_TIMESTAMP_API == STD_ON)))
+/**
+* @brief   API service ID for Icu_GetCaptureRegisterValue function
+* @details Parameters used when raising an error/exception
+*/
+#define ICU_GET_CAPTURE_REGISTER_VALUE_ID           ((uint8)0x19U)
+#endif
+
+#if ((ICU_GET_PULSE_WIDTH_API == STD_ON) && (ICU_SIGNAL_MEASUREMENT_API == STD_ON))
+/**
+* @brief   API service ID for Icu_GetPulseWidth function
+* @details Parameters used when raising an error/exception
+*/
+#define ICU_GET_PULSE_WIDTH_ID                      ((uint8)0x1AU)
+#endif
+
+#if (ICU_GET_INPUT_LEVEL_API == STD_ON)
+/**
+ * @brief   API service ID for Icu_GetInputLevel function
+ * @details Parameters used when raising an error/exception
+ * */
+ #define ICU_GET_INPUT_LEVEL_ID          ((uint8)0x7CU)
+#endif /* ICU_GET_INPUT_LEVEL_API */
+#endif
+
+#if (ICU_TIMESTAMP_API == STD_ON)
+/**
+* @brief API service ID for Icu_StopTimestamp function
+* @details Parameters used when raising an error/exception
+* */
+#define ICU_STOPTIMESTAMP_ID            ((uint8)0x0A)
+
+/**
+* @brief   API service Icu_StopTimestamp called on a channel which was not
+*          started or already stopped
+* @implements Icu_ErrorCodes_define
+* */
+#define ICU_E_NOT_STARTED               ((uint8)0x15)
+#endif
+
+/*================================================================================================*/
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+#if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
+/** @brief Typedef for Mcl_ChannelType.  */
+typedef uint8 Mcl_ChannelType;
+#endif
+
+/**
+ * @brief    Structure that contains ICU channel configuration.
+ * @details  It contains the information like Icu Channel Mode, Channel Notification function,
+ *           overflow Notification function.
+ * @implements Icu_ChannelConfigType_struct
+ * */
+typedef struct
+{
+    /** @brief Channel wakeup capability enable. */
+    boolean                     Icu_WakeupCapabile;
+    /** @brief RISING_EDGE, FALLING_EDGE or BOTH_EDGES for EDGE_COUNTER. */
+    Icu_ActivationType          Icu_ActivEdge;
+    /** @brief EDGE_DETECT, TIME_STAMP, SIGNAL_MEASUREMENT or EDGE_COUNTER. */
+    Icu_MeasurementModeType     Icu_ChannelMode;
+    /** @brief CIRCULAR_BUFFER or LINEAR_BUFFER for TIME_STAMP, DUTY_CYCLE, HIGH_TIME, LOW_TIME
+     *         or PERIOD_TIME for SIGNAL_MEASUREMENT and RISING_EDGE, FALLING_EDGE or
+     *         BOTH_EDGES for EDGE_COUNTER. */
+    Icu_MeasurementSubModeType  Icu_ChannelProperty;
+    /** @brief Icu Channel Notification function for TIME_STAMP or EDGE_COUNTER mode. */
+    Icu_NotifyType              Icu_ChannelNotification;
+#if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
+    /** @brief Mcl_DmaChannel Id. */
+    Mcl_ChannelType             Mcl_DmaChannel;
+#endif
+#if defined(ICU_OVERFLOW_NOTIFICATION_API) && (ICU_OVERFLOW_NOTIFICATION_API == STD_ON)
+    /** @brief  Icu Channel Overflow Notification function. */
+    Icu_NotifyType              Icu_ChOverflowNotification;
+#endif  /* ICU_OVERFLOW_NOTIFICATION_API */
+#if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
+    Icu_WakeupValueType         Icu_Channel_WakeupValue;           /**< @brief EcuM wakeup source Id. */
+#endif  /* ICU_REPORT_WAKEUP_SOURCE == STD_ON */
+    /** @brief Pointer to the ipw channel pointer configuration */
+    const Icu_Ipw_ChannelConfigType   (*Icu_IpwChannelConfigPtr);
+} Icu_ChannelConfigType;
+
+/**
+ * @brief This type contains initialization data.
+ * @details he notification functions shall be configurable
+ *         as function pointers within the initialization data structure (Icu_ConfigType).
+ *         This type of the external data structure shall contain the
+ *         initialization data for the ICU driver. It shall contain:
+ *         - Wakeup Module Info (in case the wakeup-capability is true)
+ *         - ICU dependent properties for used HW units
+ *         - Clock source with optional prescaler (if provided by HW)
+ * @implements Icu_ConfigType_struct
+ * */
+typedef struct
+{
+    /** @brief The number of configured logical channels. */
+    uint8                       nNumChannels;
+
+    /** @brief Pointer to the list of Icu configured channels */
+    const Icu_ChannelConfigType       (*Icu_ChannelConfigPtr)[];
+
+    /** @brief The number of IP instances configured */
+    uint8                       nNumInstances;
+
+    /** @brief Pointer to the list of Icu configured channels */
+    const Icu_Ipw_IpConfigType  (*Icu_IpConfigPtr)[];
+    
+    /** @brief channel index in each partition map table*/
+    const uint8                 (*Icu_IndexChannelMap)[];
+
+    /** @brief Core index*/
+    uint8                       u32CoreId;
+} Icu_ConfigType;
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+#ifndef ICU_PRECOMPILE_SUPPORT
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+ICU_CONFIG_EXT
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#endif /* #ifndef ICU_PRECOMPILE_SUPPORT */
+
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+/**
+ * @brief Pointer initialized during init with the address of the received configuration structure.
+ * @details Will be used by all functions to access the configuration data.
+ **/
+extern const Icu_ConfigType           *Icu_pCfgPtr[ICU_MAX_PARTITIONS];
+
+
+/**
+ * @brief Saves the current Icu mode
+ **/
+extern Icu_ModeType             Icu_CurrentMode;
+
+
+/**
+ * @brief   Stores actual state and configuration of ICU Channels
+ **/
+extern volatile Icu_ChannelStateType    Icu_aChannelState[ICU_MAX_CHANNEL];
+
+#if (ICU_TIMESTAMP_API == STD_ON)
+/** @brief Pointer to the buffer-array where the timestamp values shall be placed. */
+extern Icu_ValueType            *Icu_aBuffer[ICU_MAX_CHANNEL];
+
+
+/**
+ * @brief Array for saving the size of the external buffer (number of entries)
+ **/
+extern Icu_ValueType            Icu_aBufferSize[ICU_MAX_CHANNEL];
+
+
+/**
+ * @brief Array for saving Notification interval (number of events).
+ **/
+extern Icu_ValueType            Icu_aBufferNotify[ICU_MAX_CHANNEL];
+
+
+/**
+ * @brief Array for saving the number of notify counts
+ **/
+extern volatile  Icu_ValueType  Icu_aNotifyCount[ICU_MAX_CHANNEL];
+
+
+/**
+ * @brief Array for saving the time stamp index
+ **/
+extern volatile  Icu_IndexType  Icu_aBufferIndex[ICU_MAX_CHANNEL];
+
+#endif /* ICU_TIMESTAMP_API */
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+/**
+* @brief          This function initializes the driver.
+* @details        This service is a non reentrant function used for driver initialization.
+*        The  Initialization function  shall initialize  all relevant  registers of  the configured
+*        hardware with the  values of the  structure referenced by  the parameter ConfigPtr.
+*        If  the  hardware  allows  for   only  one  usage   of  the  register,   the  driver
+*        module implementing that functionality is responsible for initializing the register.
+*        The initialization function of this module shall always have a pointer as a parameter,
+*        even though for Variant PC no configuration set shall be given.
+*        Instead a NULL pointer shall be passed to the initialization function.
+*        The Icu  module environment  shall not  call Icu_Init  during a  running operation (e. g.
+*        timestamp measurement or edge counting).
+*
+* @param[in]         ConfigPtr        Pointer to a selected configuration structure.
+*
+* @return             void
+**/
+void Icu_Init(const Icu_ConfigType* ConfigPtr);
+
+#if (ICU_DE_INIT_API == STD_ON)
+/**
+* @brief   This function de-initializes the ICU module.
+* @details This service is a Non reentrant function used for ICU De-Initialization
+*        After the call of this service, the state of the peripherals used by configuration shall be
+*        the  same as  after power  on reset.  Values of  registers which  are not  writable  are
+*        excluded.
+*        This service shall disable all used interrupts and notifications.
+*        The Icu module environment shall not  call Icu_DeInit during a running  operation  (e. g.
+*        timestamp measurement or edge counting)
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before.
+* @implements Icu_DeInit_Activity
+*
+**/
+void Icu_DeInit(void);
+#endif /* ICU_DE_INIT_API */
+
+
+#if (ICU_SET_MODE_API == STD_ON)
+/**
+* @brief           This function sets the ICU mode.
+* @details     This service is a non reentrant function used for ICU mode  selection.
+*       This service shall  set the  operation mode  to the given mode parameter.
+*       This service  can be  called during  running operations.  If so,  an ongoing operation that
+*       generates interrupts on a wakeup capable  channel like e.g. time stamping or  edge counting
+*       might lead to the  ICU module not being  able to properly enter sleep  mode. This is then a
+*       system or ECU configuration issue not a problem of this specification.
+*
+* @param[in]   Mode        Specifies the operation mode
+* @return         void
+*
+* @pre         Icu_Init must be called before.
+* @implements     Icu_SetMode_Activity
+*
+* @api
+*
+**/
+void Icu_SetMode(Icu_ModeType Mode);
+#endif /* ICU_SET_MODE_API */
+
+
+#if (ICU_DISABLE_WAKEUP_API == STD_ON)
+/**
+* @brief   This function disables the wakeup capability of a single ICU channel.
+* @details This service is reentrant function and shall disable  the wakeup capability of
+*          a single ICU channel.This  service is only feasible for ICU channels configured
+*          statically as wakeup capable true.
+*          The  function  Icu_DisableWakeup shall  be  pre compile  time  configurable On,Off by
+*          the configuration parameter IcuDisableWakeupApi.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before.
+* @implements Icu_DisableWakeup_Activity
+*
+**/
+void Icu_DisableWakeup(Icu_ChannelType Channel);
+#endif /* ICU_DISABLE_WAKEUP_API */
+
+
+#if (ICU_ENABLE_WAKEUP_API == STD_ON)
+/**
+* @brief   This function (re-)enables the wakeup capability of the given ICU channel.
+* @details The function is reentrant and re-enable the wake-up capability of a single ICU channel.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before. The channel must be configured as wakeup capable.
+* @implements Icu_EnableWakeup_Activity
+*
+**/
+void Icu_EnableWakeup(Icu_ChannelType Channel);
+#endif /* ICU_ENABLE_WAKEUP_API */
+
+
+#if (ICU_WAKEUP_FUNCTIONALITY_API == STD_ON)
+/**
+* @brief  Checks if a wakeup capable ICU channel is the source for a wakeup event.
+* @details The function calls the ECU state manager service EcuM_SetWakeupEvent
+* in case of a valid ICU channel wakeup event.
+*
+* @param[in]     WakeupSource          Information on wakeup source to be checked.
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before. The channel must be configured as wakeup capable.
+*
+* @implements Icu_CheckWakeup_Activity
+*
+**/
+void Icu_CheckWakeup(EcuM_WakeupSourceType WakeupSource);
+#endif /* ICU_WAKEUP_FUNCTIONALITY_API */
+
+/**
+* @brief   This function sets the activation-edge for the given channel.
+* @details This service  is reentrant and shall set  the  activation-edge according to Activation
+*          parameter for the given channel.
+*          This service shall support channels which are configured
+*          for  the following Icu_MeasurementMode:
+*          - ICU_MODE_SIGNAL_EDGE_DETECT
+*          - ICU_MODE_TIMESTAMP
+*          - ICU_MODE_EDGE_COUNTER
+*
+* @param[in]     Channel          Logical number of the ICU channel
+* @param[in]     Activation       Type of activation.
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before. The channel must be properly configured
+*      (ICU_MODE_SIGNAL_EDGE_DETECT, ICU_MODE_TIMESTAMP, ICU_MODE_EDGE_COUNTER).
+*
+* @implements Icu_SetActivationCondition_Activity
+*
+**/
+void Icu_SetActivationCondition(Icu_ChannelType Channel, Icu_ActivationType Activation);
+
+/**
+* @brief   This function disables the notification of a channel.
+*
+* @details This function is reentrant and disables the notification of a channel.
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before.
+*
+* @implements Icu_DisableNotification_Activity
+*
+**/
+void Icu_DisableNotification(Icu_ChannelType Channel);
+
+/**
+* @brief   This function enables the notification on the given channel.
+* @details This function is reentrant and enables the notification on the given channel. The
+*          notification  will be reported only when the channel measurement property is enabled or
+*          started
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before.
+*
+* @implements Icu_EnableNotification_Activity
+*
+**/
+void Icu_EnableNotification(Icu_ChannelType Channel);
+
+#if (ICU_GET_INPUT_STATE_API == STD_ON)
+/**
+* @brief   This function returns the status of the ICU input.
+* @details This service is reentrant shall return the status of  the ICU input.
+*          Only channels which are configured for the following Icu_MeasurementMode shall be
+*          supported:
+*          - ICU_MODE_SIGNAL_EDGE_DETECT,
+*          - ICU_MODE_SIGNAL_MEASUREMENT.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return Icu_InputStateType
+* @retval  ICU_ACTIVE     An activation edge has been detected
+* @retval  ICU_IDLE       No activation edge has been detected since the last call of
+* Icu_GetInputState() or Icu_Init().
+*
+* @api
+*
+* @pre Icu_Init must be called before.
+*
+* @implements Icu_GetInputState_Activity
+*
+**/
+Icu_InputStateType Icu_GetInputState(Icu_ChannelType Channel);
+#endif /* ICU_GET_INPUT_STATE_API */
+
+
+#if (STD_ON == ICU_TIMESTAMP_API)
+/**
+ * @brief   This function starts the capturing of timer values on the edges.
+ * @details This function is reentrant and starts the capturing of timer values on the edges
+ *          activated by the service Icu_SetActivationCondition() to an external buffer.
+ *
+ * @param[in]     Channel          Logical number of the ICU channel
+ * @param[in]     BufferPtr        Pointer to the buffer-array where the timestamp values shall be
+ *                                 placed.
+ * @param[in]     BufferSize       Size of the external buffer (number of entries)
+ * @param[in]     NotifyInterval   Notification interval (number of events).
+ * 
+ * @return void
+ *
+ * @api
+ *
+ * @pre Icu_Init must be called before.
+ */
+void Icu_StartTimestamp(Icu_ChannelType Channel, Icu_ValueType* BufferPtr, uint16 BufferSize, uint16 NotifyInterval);
+
+/**
+* @brief   This function stops the timestamp measurement of the given channel.
+* @details This function is reentrant and stops the timestamp measurement of the given channel.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @pre Icu_Init must be called before.
+**/
+void Icu_StopTimestamp(Icu_ChannelType Channel);
+
+/**
+ * @brief   This function reads the elapsed Signal Low, High or Period Time for the given channel.
+ * @details This service is reentrant and reads the elapsed Signal Low Time for the given channel
+ *          that is configured  in Measurement Mode Signal Measurement, Signal Low Time.
+ *          The elapsed time is measured between a falling edge and the consecutive rising edge of
+ *          the channel.
+ *          This service reads the elapsed Signal High Time for the given channel that is configured
+ *          in Measurement Mode Signal Measurement,Signal High Time.The elapsed time is measured
+ *          between a rising edge and the consecutive falling edge of the channel.
+ *          This service reads the elapsed Signal Period Time for the given channel that is
+ *          configured in Measurement Mode Signal Measurement,  Signal Period Time.The elapsed time
+ *          is measured between consecutive  rising (or falling) edges  of the  channel. The  period
+ *          start edge is
+ *
+ *          configurable.
+ *
+ * @param[in]  Channel          Logical number of the ICU channel
+ *
+ * @return     Icu_ValueType -  the elapsed Signal Low Time for the given channel that is configured in
+ *             Measurement Mode Signal Measurement, Signal Low Time
+ * @pre        Icu_Init must be called before. The channel must be configured in Measurement Mode Signal
+ *             Measurement.
+ */
+Icu_IndexType Icu_GetTimestampIndex(Icu_ChannelType Channel);
+
+#endif /* ICU_TIMESTAMP_API */
+
+
+#if (ICU_EDGE_COUNT_API == STD_ON)
+/**
+* @brief   This function resets the value of the counted edges to zero.
+* @details This function is reentrant and resets the value of the counted edges to zero.
+*
+* @param[in]     Channel          Logical number of the ICU channel.
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before.
+*
+* @implements Icu_ResetEdgeCount_Activity
+*
+**/
+void Icu_ResetEdgeCount(Icu_ChannelType Channel);
+#endif /* ICU_EDGE_COUNT_API */
+
+
+#if (ICU_EDGE_COUNT_API == STD_ON)
+/**
+* @brief   This function enables the counting of edges of the given channel.
+* @details This service is reentrant and shall enable the counting of  edges of the given channel.
+*          Note: This  service doesnot do the real counting itself. This is done by the hardware
+*          (capture unit). Only the configured edges shall be counted (rising edge, falling edge or
+*           both edges).
+*
+*          Configuration  of  the  edge  is  done  in  Icu_Init  or  Icu_SetActivationCondition.The
+*          configured edge can be  changed during runtime using  Icu_SetActivationCondition.
+*          Interrupts are not required for edge counting.If interrupts are enabled, the interrupt
+*          service routine
+*          will set the overflow flag if more than 0xFFFFFF edges are measured.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before. The given channel must be configured in Measurement Mode
+*      Edge Counter.
+* @implements Icu_EnableEdgeCount_Activity
+*
+**/
+void Icu_EnableEdgeCount(Icu_ChannelType Channel);
+#endif /* ICU_EDGE_COUNT_API */
+
+
+#if (ICU_EDGE_COUNT_API == STD_ON)
+/**
+* @brief   This function disables the counting of edges of the given channel.
+* @details This function is reentrant and disables the counting of edges of the given channel.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before.The given channel must be configured in Measurement
+*      Mode Edge Counter.
+*
+* @implements Icu_DisableEdgeCount_Activity
+*
+**/
+void Icu_DisableEdgeCount(Icu_ChannelType Channel);
+#endif /* ICU_EDGE_COUNT_API */
+
+
+#if (ICU_EDGE_COUNT_API == STD_ON)
+/**
+* @brief   This function reads the number of counted edges.
+* @details This function is reentrant reads the number of counted edges after the last call
+*          of Icu_ResetEdgeCount().
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return Icu_EdgeNumberType - Number of the counted edges.
+*
+* @api
+*
+* @pre Icu_Init must be called before. The given channel must be configured in Measurement
+*      Mode Edge Counter.
+*
+* @implements Icu_GetEdgeNumbers_Activity
+**/
+Icu_EdgeNumberType Icu_GetEdgeNumbers(Icu_ChannelType Channel);
+#endif /* ICU_EDGE_COUNT_API */
+
+
+#if (ICU_EDGE_DETECT_API == STD_ON)
+/**
+* @brief   This function enables or re-enables the detection of edges of the given channel.
+* @details This function is reentrant enables or re-enables the detection of edges of the given
+*          channel.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before. The channel must be configured in Measurement Mode Edge
+*      Counter
+*
+* @implements Icu_EnableEdgeDetection_Activity
+**/
+void Icu_EnableEdgeDetection(Icu_ChannelType Channel);
+#endif /* ICU_EDGE_DETECT_API */
+
+
+#if (ICU_EDGE_DETECT_API == STD_ON)
+/**
+* @brief   This function disables the detection of edges of the given channel.
+* @details This function is reentrant and disables the detection of edges of the given channel.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before. The channel must be configured in Measurement Mode Edge
+*      Detection.
+*
+* @implements Icu_DisableEdgeDetection_Activity
+*
+**/
+void Icu_DisableEdgeDetection(Icu_ChannelType Channel);
+#endif /* ICU_EDGE_DETECT_API */
+
+
+#if (ICU_GET_TIME_ELAPSED_API== STD_ON)
+/**
+* @brief   This function reads the elapsed Signal Low, High or Period Time for the given channel.
+* @details This service is reentrant and reads the elapsed Signal Low Time for the given channel
+*          that is configured  in Measurement Mode Signal Measurement, Signal Low Time.
+*          The elapsed time is measured between a falling edge and the consecutive rising edge of
+*          the channel.
+*          This service reads the elapsed Signal High Time for the given channel that is configured
+*          in Measurement Mode Signal Measurement,Signal High Time.The elapsed time is measured
+*          between a rising edge and the consecutive falling edge of the channel.
+*          This service reads the elapsed Signal Period Time for the given channel that is
+*          configured in Measurement Mode Signal Measurement,  Signal Period Time.The elapsed time
+*          is measured between consecutive  rising (or falling) edges  of the  channel. The  period
+*          start edge is
+*
+*          configurable.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return Icu_ValueType -  the elapsed Signal Low Time for the given channel that is configured in
+*          Measurement Mode Signal Measurement, Signal Low Time
+*
+* @api
+*
+* @pre Icu_Init must be called before. The channel must be configured in Measurement Mode Signal
+*      Measurement.
+*
+* @implements Icu_GetTimeElapsed_Activity
+*
+**/
+Icu_ValueType Icu_GetTimeElapsed(Icu_ChannelType Channel);
+#endif /* ICU_GET_TIME_ELAPSED_API */
+
+
+#if (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON)
+/**
+ * @brief   This function reads the coherent active time and period time for the given ICU Channel.
+ * @details The function is reentrant and reads the coherent active time and period time for
+ *          the given ICU Channel, if it is configured in Measurement Mode Signal Measurement, Duty
+ *          Cycle Values.
+ *
+ * @param[in]     Channel          Logical number of the ICU channel
+ * @param[out]    DutyCycleValues  Pointer to a buffer where the results (high time and period time)
+ *                                 shall be placed.
+ *
+ * @return     void
+ * @pre        Icu_Init must be called before. The given channel must be configured in Measurement Mode
+ *             Signal Measurement, Duty Cycle Values.
+ */
+void Icu_GetDutyCycleValues(Icu_ChannelType Channel, Icu_DutyCycleType* DutyCycleValues);
+
+#endif /* ICU_GET_DUTY_CYCLE_VALUES_API */
+
+#if (ICU_SIGNAL_MEASUREMENT_API == STD_ON)
+/**
+* @brief   This function starts the measurement of signals.
+* @details This service is reentrant and starts the measurement of signals beginning with the
+*          configured default start edge which occurs first after the call of this service.
+*          This service shall only be available in Measurement Mode ICU_MODE_SIGNAL_MEASUREMENT.
+*          This service shall reset the state for the given channel to ICU_IDLE.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @api
+*
+* @pre Icu_Init must be called before. The channel must be configured in Measurement Mode Signal
+*      Measurement.
+*
+* @implements Icu_StartSignalMeasurement_Activity
+*
+**/
+void Icu_StartSignalMeasurement(Icu_ChannelType Channel);
+
+/**
+ * @brief      This function stops the measurement of signals of the given channel.
+ * @details    This function is reentrant and stops the measurement of signals of the given channel.
+ * 
+ * @param[in]  Channel - Logical number of the ICU channel
+ * @return     void
+ * 
+ * @pre        Icu_Init must be called before. The channel must be configured in Measurement Mode 
+ *             Signal Measurement.
+ */
+void Icu_StopSignalMeasurement(Icu_ChannelType Channel);
+#endif /* ICU_SIGNAL_MEASUREMENT_API */
+
+
+#if (ICU_GET_VERSION_INFO_API == STD_ON)
+/**
+* @brief   This service returns the version information of this module.
+* @details This  service is Non reentrant and returns the version information of this module.
+*          The version information includes:
+*          - Module Id
+*          - Vendor Id
+*          - Vendor specific version numbers
+*          If source code for caller and callee of this function is available this function should
+*          be realized as a macro. The macro should be defined in the modules header file.
+*
+* @param[out]    versioninfo      Pointer to location to store version info
+*
+* @return void
+*
+* @api
+*
+* @implements Icu_GetVersionInfo_Activity
+**/
+void Icu_GetVersionInfo(Std_VersionInfoType* versioninfo);
+#endif  /* ICU_GET_VERSION_INFO_API == STD_ON */
+
+#if (ICU_DUAL_CLOCK_MODE_API == STD_ON)
+/**
+ * @brief This function sets all channels prescalers based on the input mode.
+ * 
+ * @param   selectPrescaler Select the used prescaler: prescaler/alternatePresclaer.
+ * @return  void
+ * @pre     Icu_Init must be called before.
+ */
+void Icu_SetClockMode(Icu_SelectPrescalerType selectPrescaler);
+#endif  /* ICU_DUAL_CLOCK_MODE_API == STD_ON */
+
+
+#if (ICU_GET_INPUT_LEVEL_API == STD_ON)
+/**
+* @brief      This function returns the actual status of PIN.
+*
+* @details    This function returns the actual status of PIN.
+*
+* @param[in]     Channel    Logical number of the ICU channel
+*
+* @return  Icu_LevelType
+*
+* @pre        Icu_Init must be called before.
+*
+* @implements Icu_GetInputLevel_Activity
+*
+**/
+Icu_LevelType Icu_GetInputLevel(Icu_ChannelType Channel);
+#endif
+
+#if ((ICU_CAPTURERGISTER_API == STD_ON) && ((ICU_SIGNAL_MEASUREMENT_API == STD_ON) || \
+                                                                    (ICU_TIMESTAMP_API == STD_ON)))
+/**
+* @brief   This function starts the measurement of signals.
+* @details. This service returns the value of Capture register.
+*   This API is used to measure the time difference  between 2 different timer channels.
+*
+* @param[in]    Channel     Logical number of the ICU channel
+*
+* @return Icu_ValueType     Value of Capture register
+* @api
+* @pre Icu_Init must be called before.
+* @pre The given channel must be configured in SignalMeasurement or in Timestamp mode
+* @implements Icu_GetCaptureRegisterValue_Activity
+*
+**/
+Icu_ValueType Icu_GetCaptureRegisterValue(Icu_ChannelType Channel);
+#endif
+
+#if ((ICU_GET_PULSE_WIDTH_API == STD_ON) && (ICU_SIGNAL_MEASUREMENT_API == STD_ON))
+/**
+* @brief      This function returns the signals High time, Low time and Period without using the
+*             channel interrupt.
+* @details    This function returns the signals High time, Low time and Period without using the
+*             channel interrupt.
+* @param[in]  Channel       Logical number of the ICU channel
+* @pre        Icu_Init must be called before.
+*
+**/
+void Icu_GetPulseWidth(Icu_ChannelType Channel);
+#endif
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* ICU_H */

+ 101 - 0
RTD/include/Icu_EnvCfg.h

@@ -0,0 +1,101 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_ENVCFG_H
+#define ICU_ENVCFG_H
+
+/**
+*   @file
+*
+*   @addtogroup icu Icu Driver
+*   @{
+*/
+
+#ifdef __cplusplus
+extern "C"{
+#endif 
+
+
+/*==================================================================================================
+                                         INCLUDE FILES
+ 1) system and project includes
+ 2) needed interfaces from external units
+ 3) internal and external interfaces from this unit
+==================================================================================================*/
+
+/*==================================================================================================
+                               SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_ENVCFG_VENDOR_ID                        43
+
+#define ICU_ENVCFG_AR_RELEASE_MAJOR_VERSION         4
+#define ICU_ENVCFG_AR_RELEASE_MINOR_VERSION         4
+#define ICU_ENVCFG_AR_RELEASE_REVISION_VERSION      0
+
+#define ICU_ENVCFG_SW_MAJOR_VERSION                 1
+#define ICU_ENVCFG_SW_MINOR_VERSION                 0
+#define ICU_ENVCFG_SW_PATCH_VERSION                 0
+/*==================================================================================================
+                                      FILE VERSION CHECKS
+==================================================================================================*/
+
+
+/*==================================================================================================
+                                           CONSTANTS
+==================================================================================================*/
+
+
+/*==================================================================================================
+                                       DEFINES AND MACROS
+==================================================================================================*/
+#define ICU_VALIDATE_GLOBAL_CALL         (ICU_DEV_ERROR_DETECT)
+#define ICU_VALIDATE_CALL_AND_CHANNEL    (ICU_DEV_ERROR_DETECT)
+#define ICU_VALIDATE_PARAMS              (ICU_DEV_ERROR_DETECT)
+
+/*==================================================================================================
+*                                             ENUMS
+==================================================================================================*/
+
+
+/*==================================================================================================
+*                                STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+
+/*==================================================================================================
+*                                GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+
+/*==================================================================================================
+*                                    FUNCTION PROTOTYPES
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* ICU_ENVCFG_H */

+ 440 - 0
RTD/include/Icu_Ipw.h

@@ -0,0 +1,440 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_IPW_H
+#define ICU_IPW_H
+
+/**
+ *     @file
+ *     @internal
+ *     @addtogroup icu_ipw Icu_Ipw Driver
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Icu_Cfg.h"
+#include "Icu_Types.h"
+#include "Icu_Ipw_Types.h"
+#include "Icu_Ipw_Cfg.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_IPW_VENDOR_ID                       43
+#define ICU_IPW_AR_RELEASE_MAJOR_VERSION        4
+#define ICU_IPW_AR_RELEASE_MINOR_VERSION        4
+#define ICU_IPW_AR_RELEASE_REVISION_VERSION     0
+#define ICU_IPW_SW_MAJOR_VERSION                1
+#define ICU_IPW_SW_MINOR_VERSION                0
+#define ICU_IPW_SW_PATCH_VERSION                0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if current file and ICU header file are of the same vendor */
+#if (ICU_IPW_VENDOR_ID != ICU_CFG_VENDOR_ID)
+    #error "Icu_Ipw.h and Icu_Cfg.h have different vendor IDs"
+#endif
+/* Check if current file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_AR_RELEASE_MAJOR_VERSION    != ICU_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_MINOR_VERSION    != ICU_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_REVISION_VERSION != ICU_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw.h and Icu_Cfg.h are different"
+#endif
+/* Check if current file and ICU header file are of the same Software version */
+#if ((ICU_IPW_SW_MAJOR_VERSION != ICU_CFG_SW_MAJOR_VERSION) || \
+     (ICU_IPW_SW_MINOR_VERSION != ICU_CFG_SW_MINOR_VERSION) || \
+     (ICU_IPW_SW_PATCH_VERSION != ICU_CFG_SW_PATCH_VERSION))
+     #error "Software Version Numbers of Icu_Ipw.h and Icu_Cfg.h are different"
+#endif
+
+/* Check if current file and ICU header file are of the same vendor */
+#if (ICU_IPW_VENDOR_ID != ICU_TYPES_VENDOR_ID)
+    #error "Icu_Ipw.h and Icu_Types.h have different vendor IDs"
+#endif
+/* Check if current file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_AR_RELEASE_MAJOR_VERSION    != ICU_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_MINOR_VERSION    != ICU_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_REVISION_VERSION != ICU_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw.h and Icu_Types.h are different"
+#endif
+/* Check if current file and ICU header file are of the same Software version */
+#if ((ICU_IPW_SW_MAJOR_VERSION != ICU_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_IPW_SW_MINOR_VERSION != ICU_TYPES_SW_MINOR_VERSION) || \
+     (ICU_IPW_SW_PATCH_VERSION != ICU_TYPES_SW_PATCH_VERSION))
+     #error "Software Version Numbers of Icu_Ipw.h and Icu_Types.h are different"
+#endif
+
+/* Check if current file and ICU header file are of the same vendor */
+#if (ICU_IPW_VENDOR_ID != ICU_IPW_TYPES_VENDOR_ID)
+    #error "Icu_Ipw.h and Icu_Ipw_Types.h have different vendor IDs"
+#endif
+/* Check if current file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_AR_RELEASE_MAJOR_VERSION    != ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_MINOR_VERSION    != ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_REVISION_VERSION != ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw.h and Icu_Ipw_Types.h are different"
+#endif
+/* Check if current file and ICU header file are of the same Software version */
+#if ((ICU_IPW_SW_MAJOR_VERSION != ICU_IPW_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_IPW_SW_MINOR_VERSION != ICU_IPW_TYPES_SW_MINOR_VERSION) || \
+     (ICU_IPW_SW_PATCH_VERSION != ICU_IPW_TYPES_SW_PATCH_VERSION))
+     #error "Software Version Numbers of Icu_Ipw.h and Icu_Ipw_Types.h are different"
+#endif
+
+/* Check if current file and ICU IPW header file are of the same vendor */
+#if (ICU_IPW_VENDOR_ID != ICU_IPW_CFG_VENDOR_ID)
+    #error "Icu_Ipw.h and Icu_Ipw_Cfg.h have different vendor IDs"
+#endif
+/* Check if current file and ICU IPW header file are of the same AutoSar version */
+#if ((ICU_IPW_AR_RELEASE_MAJOR_VERSION    != ICU_IPW_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_MINOR_VERSION    != ICU_IPW_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_REVISION_VERSION != ICU_IPW_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw.h and Icu_Ipw_Cfg.h are different"
+#endif
+/* Check if current file and ICU IPW header file are of the same Software version */
+#if ((ICU_IPW_SW_MAJOR_VERSION != ICU_IPW_CFG_SW_MAJOR_VERSION) || \
+     (ICU_IPW_SW_MINOR_VERSION != ICU_IPW_CFG_SW_MINOR_VERSION) || \
+     (ICU_IPW_SW_PATCH_VERSION != ICU_IPW_CFG_SW_PATCH_VERSION))
+     #error "Software Version Numbers of Icu_Ipw.h and Icu_Ipw_Cfg.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+/**
+ * @internal
+ * @brief   Icu_Ipw_Init
+ * @details Initialize a hardware Icu IP Instance
+ *
+ * @param[in] count - Number of IPs instances to be configured.
+ * @param[in] pIpConfig         - Pointer to an array of Icu_Ipw_IpConfigType structures that contains
+ *                                IP specific configuration data for the entire ICU driver.
+ * @return void
+ *
+ * @pre Icu_DeInit must be called before.
+ */
+void Icu_Ipw_Init(uint8 count, const Icu_Ipw_IpConfigType (*pIpConfig)[]);
+
+#if (ICU_DE_INIT_API == STD_ON)
+/**
+* @brief              Icu_Ipw_DeInit
+* @details            De-initialize ICU hardware channel
+*
+* @param[in]          pIpConfig - Pointer to ICU top configuration structure
+*
+* @internal
+* @return void
+*
+* @pre                Icu_Init must be called before.
+*
+*/
+void Icu_Ipw_DeInit(uint8 count, const Icu_Ipw_IpConfigType (*pIpConfig)[]);
+#endif
+
+#if (ICU_SET_MODE_API == STD_ON)
+/**
+ * @brief Put the channel in a reduce power state.
+ * 
+ * @internal
+ * @param channelConfig - configuration of the channel
+ */
+void Icu_Ipw_SetSleepMode(const Icu_Ipw_ChannelConfigType * ChannelConfig);
+
+/**
+ * @brief Set the channel to run again.
+ * 
+ * @internal
+ * @param channelConfig - configuration of the channel
+ */
+void Icu_Ipw_SetNormalMode(const Icu_Ipw_ChannelConfigType * ChannelConfig);
+#endif  /* ICU_SET_MODE_API == STD_ON */
+
+/**
+* @brief      Icu_Ipw_SetActivationCondition
+* @details
+*
+* @param[in]      activation    - the type of activation for the ICU channel.
+* @param[in]      ChannelConfig            - the measurement mode of the channel
+*
+* @internal
+* @return void
+*
+*/
+void Icu_Ipw_SetActivationCondition(Icu_ActivationType activation,
+                                    const Icu_Ipw_ChannelConfigType* ChannelConfig);
+
+#if (ICU_GET_INPUT_STATE_API == STD_ON)
+/**
+* @brief      Icu_Ipw_GetInputState
+* @details    Service that returns the state of the ICU driver
+*
+* @param[in]      ChannelConfig - The current channel configuration structure
+*
+* @internal
+* @return Icu_InputStateType
+* @retval   ICU_ACTIVE          An active edge has been detected
+* @retval   ICU_IDLE            No active edge has been detected since the cast call to
+*                               Icu_Ipw_Init or Icu_Ipw_GetInputState
+*/
+boolean Icu_Ipw_GetInputState (const Icu_Ipw_ChannelConfigType *ChannelConfig);
+#endif  /* ICU_GET_INPUT_STATE_API == STD_ON */
+
+#if (STD_ON == ICU_TIMESTAMP_API)
+/**
+ * @brief 
+ * @internal
+ * @param channelConfig 
+ * @param bDmaSupport 
+ */
+void Icu_Ipw_StartTimestamp(const Icu_Ipw_ChannelConfigType* channelConfig,
+                            uint16* bufferPtr,
+                            uint16  bufferSize,
+                            uint16  notifyInterval);
+
+/**
+ * @brief 
+ * @internal
+ * @param channelConfig 
+ */
+void Icu_Ipw_StopTimestamp(const Icu_Ipw_ChannelConfigType *channelConfig);
+
+/**
+ * @brief 
+ * 
+ * @param channelConfig 
+ * @return uint16 
+ */
+uint16 Icu_Ipw_GetTimestampIndex(const Icu_Ipw_ChannelConfigType* channelConfig);
+
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+uint32 Icu_Ipw_GetStartAddress(const Icu_Ipw_ChannelConfigType *ChannelConfig);
+#endif  /* ICU_TIMESTAMP_USES_DMA == STD_ON */
+#endif  /* ICU_TIMESTAMP_API == STD_ON */
+
+
+#if (STD_ON == ICU_EDGE_COUNT_API)
+/**
+ * @brief
+ * @internal
+ * @param ChannelConfig 
+ */
+void Icu_Ipw_ResetEdgeCount(const Icu_Ipw_ChannelConfigType *ChannelConfig);
+
+/**
+ * @brief 
+ * @internal
+ * @param ChannelConfig 
+ */
+void Icu_Ipw_EnableEdgeCount(const Icu_Ipw_ChannelConfigType *ChannelConfig);
+
+/**
+ * @brief 
+ * @internal
+ * @param ChannelConfig 
+ */
+void Icu_Ipw_DisableEdgeCount(const Icu_Ipw_ChannelConfigType *ChannelConfig);
+
+/**
+ * @brief 
+ * @internal
+ * @param ChannelConfig 
+ * @return uint16 
+ */
+uint16 Icu_Ipw_GetEdgeNumbers(const Icu_Ipw_ChannelConfigType *ChannelConfig);
+#endif  /* STD_ON == ICU_EDGE_COUNT_API */
+
+
+#if (STD_ON == ICU_EDGE_DETECT_API)
+void Icu_Ipw_EnableEdgeDetection(const Icu_Ipw_ChannelConfigType * ChannelConfig);
+void Icu_Ipw_DisableEdgeDetection(const Icu_Ipw_ChannelConfigType* ChannelConfig);
+#endif
+
+#if ((ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (ICU_VALIDATE_PARAMS == STD_ON))
+#if ((ICU_EDGE_COUNT_API == STD_ON) || (ICU_TIMESTAMP_API == STD_ON) || \
+     (ICU_GET_TIME_ELAPSED_API == STD_ON) || (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON))
+/**
+ * @brief The function get the state of the overflow flag
+ * @internal
+ * @param ChannelConfig      Channel configuration pointer
+ * @return      boolean      the state of the overflow flag
+ * @retval      TRUE         the overflow flag is set
+ * @retval      FALSE        the overflow flag is not set
+ */
+boolean Icu_Ipw_Get_Overflow(const Icu_Ipw_ChannelConfigType* ChannelConfig);
+#endif
+#endif /* (ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (ICU_VALIDATE_PARAMS == STD_ON) */
+
+#if ((ICU_CAPTURERGISTER_API == STD_ON) && ((ICU_SIGNAL_MEASUREMENT_API == STD_ON) || (ICU_TIMESTAMP_API == STD_ON)))/**
+ * @brief      Capture the value of counter register for a specified channel.
+ * 
+ * @details   The API shall return the value stored in capture register.
+ *            The API is the equivalent of AUTOSAR API GetCaptureRegisterValue.
+ * 
+ * @param ChannelConfig      Channel configuration pointer
+ * @return     uint32  Value of the register captured.
+ */
+Icu_ValueType Icu_Ipw_GetCaptureRegisterValue(const Icu_Ipw_ChannelConfigType* ChannelConfig);
+#endif
+
+#if (STD_ON == ICU_SIGNAL_MEASUREMENT_API)
+/**
+ * @brief
+ * @internal
+ * @param channelConfig 
+ */
+void Icu_Ipw_StartSignalMeasurement(const Icu_Ipw_ChannelConfigType *ChannelConfig);
+
+/**
+ * @brief 
+ * @internal
+ * @param channelConfig 
+ */
+void Icu_Ipw_StopSignalMeasurement(const Icu_Ipw_ChannelConfigType * ChannelConfig);
+
+
+void Icu_Ipw_GetPWandPeriod(const Icu_Ipw_ChannelConfigType* channelConfig, \
+                            Icu_ValueType* Icu_aActivePulseWidth, \
+                            Icu_ValueType* Icu_aPeriod);
+
+#endif /* STD_ON == ICU_SIGNAL_MEASUREMENT_API */
+
+#if (STD_ON == ICU_DUAL_CLOCK_MODE_API)
+/**
+ * @brief 
+ * @internal
+ * @param moduleConfig 
+ * @param selectPrescaler 
+ * @param modulesNumber 
+ */
+void Icu_Ipw_SetClockMode(const Icu_Ipw_IpConfigType (*moduleConfig)[], Icu_SelectPrescalerType selectPrescaler, 
+                          uint8 modulesNumber);
+#endif /* STD_ON == ICU_DUAL_CLOCK_MODE_API */
+
+#if (STD_ON == ICU_GET_INPUT_LEVEL_API)
+/**
+ * @brief Mapping macro between IP input level functionality and HL function.
+ * @internal
+ * @param channelConfig 
+ * @return Icu_LevelType 
+ */
+Icu_LevelType Icu_Ipw_GetInputLevel(const Icu_Ipw_ChannelConfigType * ChannelConfig);
+#endif   /* STD_ON == ICU_GET_INPUT_LEVEL_API */
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_INPUT_LEVEL_API == STD_ON))
+/**
+ * @brief 
+ * @internal
+ * @param channelConfig 
+ * @return Icu_Ipw_StatusType 
+ */
+Icu_Ipw_StatusType Icu_Ipw_ValidateGetInputLevel(const Icu_Ipw_ChannelConfigType * ChannelConfig);
+#endif
+
+#if (STD_ON == ICU_GET_DUTY_CYCLE_VALUES_API)
+/**
+ * @brief 
+ * 
+ * @param channelConfig 
+ * @param DutyCycleValues 
+ * @internal
+ */
+void Icu_Ipw_GetDutyCycleValues(const Icu_Ipw_ChannelConfigType* channelConfig,
+                                Icu_DutyCycleType* DutyCycleValues);
+#endif /* STD_ON == ICU_GET_DUTY_CYCLE_VALUES_API */
+
+#if (STD_ON == ICU_GET_TIME_ELAPSED_API)
+/**
+ * @brief 
+ * 
+ * @param channelConfig 
+ * @return Icu_ValueType 
+ * @internal
+ */
+Icu_ValueType Icu_Ipw_GetTimeElapsed(const Icu_Ipw_ChannelConfigType* channelConfig);
+#endif /* STD_ON == ICU_GET_TIME_ELAPSED_API */
+
+/**
+ * @brief      Icu_Ipw_EnableNotification
+ * @details    Enable Notification for timestamp
+ *
+ * @param[in]  ChannelConfig - The index of ICU channel for current configuration structure
+ *
+ * @return void
+ * @internal
+ */
+void Icu_Ipw_EnableNotification(const Icu_Ipw_ChannelConfigType* ChannelConfig);
+
+/**
+ * @brief      Icu_Ipw_DisableNotification
+ * @details    Disable Notification for timestamp
+ *
+ * @param[in]  ChannelConfig - The index of ICU channel for current configuration structure
+ *
+ * @return void
+ * @internal
+ */
+void Icu_Ipw_DisableNotification(const Icu_Ipw_ChannelConfigType* ChannelConfig);
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* ICU_IPW_H */

+ 170 - 0
RTD/include/Icu_Ipw_Irq.h

@@ -0,0 +1,170 @@
+
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_IPW_IRQ_H
+#define ICU_IPW_IRQ_H
+
+/**
+ *     @file
+ *     @internal
+ *     @addtogroup icu_ipw Icu_Ipw Driver
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Ftm_Icu_Ip_Irq.h"
+#include "Lpit_Icu_Ip_Irq.h"
+#include "Lptmr_Icu_Ip_Irq.h"
+#include "Port_Ci_Icu_Ip_Irq.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_IPW_IRQ_VENDOR_ID                   43
+#define ICU_IPW_IRQ_AR_RELEASE_MAJOR_VERSION    4
+#define ICU_IPW_IRQ_AR_RELEASE_MINOR_VERSION    4
+#define ICU_IPW_IRQ_AR_RELEASE_REVISION_VERSION 0
+#define ICU_IPW_IRQ_SW_MAJOR_VERSION            1
+#define ICU_IPW_IRQ_SW_MINOR_VERSION            0
+#define ICU_IPW_IRQ_SW_PATCH_VERSION            0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_IRQ_VENDOR_ID != FTM_ICU_IP_IRQ_VENDOR_ID)
+    #error "Icu_Ipw_Irq.h and Ftm_Icu_Ip_Irq.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_IRQ_AR_RELEASE_MAJOR_VERSION    != FTM_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_IRQ_AR_RELEASE_MINOR_VERSION    != FTM_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_IRQ_AR_RELEASE_REVISION_VERSION != FTM_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_Irq.h and Ftm_Icu_Ip_Irq.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_IRQ_SW_MAJOR_VERSION != FTM_ICU_IP_IRQ_SW_MAJOR_VERSION) || \
+     (ICU_IPW_IRQ_SW_MINOR_VERSION != FTM_ICU_IP_IRQ_SW_MINOR_VERSION) || \
+     (ICU_IPW_IRQ_SW_PATCH_VERSION != FTM_ICU_IP_IRQ_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Irq.h and Ftm_Icu_Ip_Irq.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_IRQ_VENDOR_ID != LPIT_ICU_IP_IRQ_VENDOR_ID)
+    #error "Icu_Ipw_Irq.h and Lpit_Icu_Ip_Irq.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_IRQ_AR_RELEASE_MAJOR_VERSION    != LPIT_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_IRQ_AR_RELEASE_MINOR_VERSION    != LPIT_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_IRQ_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_Irq.h and Lpit_Icu_Ip_Irq.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_IRQ_SW_MAJOR_VERSION != LPIT_ICU_IP_IRQ_SW_MAJOR_VERSION) || \
+     (ICU_IPW_IRQ_SW_MINOR_VERSION != LPIT_ICU_IP_IRQ_SW_MINOR_VERSION) || \
+     (ICU_IPW_IRQ_SW_PATCH_VERSION != LPIT_ICU_IP_IRQ_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Irq.h and Lpit_Icu_Ip_Irq.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_IRQ_VENDOR_ID != LPTMR_ICU_IP_IRQ_VENDOR_ID)
+    #error "Icu_Ipw_Irq.h and Lptmr_Icu_Ip_Irq.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_IRQ_AR_RELEASE_MAJOR_VERSION  != LPTMR_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_IRQ_AR_RELEASE_MINOR_VERSION  != LPTMR_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_IRQ_AR_RELEASE_REVISION_VERSION   != LPTMR_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_Irq.h and Lptmr_Icu_Ip_Irq.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_IRQ_SW_MAJOR_VERSION  != LPTMR_ICU_IP_IRQ_SW_MAJOR_VERSION) || \
+     (ICU_IPW_IRQ_SW_MINOR_VERSION  != LPTMR_ICU_IP_IRQ_SW_MINOR_VERSION) || \
+     (ICU_IPW_IRQ_SW_PATCH_VERSION  != LPTMR_ICU_IP_IRQ_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Irq.h and Lptmr_Icu_Ip_Irq.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_IRQ_VENDOR_ID != PORT_CI_ICU_IP_IRQ_VENDOR_ID)
+    #error "Icu_Ipw_Irq.h and Port_Ci_Icu_Ip_Irq.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_IRQ_AR_RELEASE_MAJOR_VERSION    != PORT_CI_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_IRQ_AR_RELEASE_MINOR_VERSION    != PORT_CI_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_IRQ_AR_RELEASE_REVISION_VERSION != PORT_CI_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_Irq.h and Port_Ci_Icu_Ip_Irq.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_IRQ_SW_MAJOR_VERSION != PORT_CI_ICU_IP_IRQ_SW_MAJOR_VERSION) || \
+     (ICU_IPW_IRQ_SW_MINOR_VERSION != PORT_CI_ICU_IP_IRQ_SW_MINOR_VERSION) || \
+     (ICU_IPW_IRQ_SW_PATCH_VERSION != PORT_CI_ICU_IP_IRQ_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Irq.h and Port_Ci_Icu_Ip_Irq.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* ICU_IPW_IRQ_H */

+ 281 - 0
RTD/include/Icu_Ipw_Types.h

@@ -0,0 +1,281 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_IPW_TYPES_H
+#define ICU_IPW_TYPES_H
+
+/**
+ *     @file
+ *
+ *     @internal
+ *     @addtogroup icu_ipw Icu_Ipw Driver
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+/* Supported platforms includes. */
+#include "Ftm_Icu_Ip_Types.h"
+#include "Lpit_Icu_Ip_Types.h"
+#include "Lptmr_Icu_Ip_Types.h"
+#include "Port_Ci_Icu_Ip_Types.h"
+#include "Cmp_Ip_Types.h"
+
+#include "Icu_Cfg.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_IPW_TYPES_VENDOR_ID                    43
+#define ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION     4
+#define ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION     4
+#define ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION  0
+#define ICU_IPW_TYPES_SW_MAJOR_VERSION             1
+#define ICU_IPW_TYPES_SW_MINOR_VERSION             0
+#define ICU_IPW_TYPES_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_TYPES_VENDOR_ID != FTM_ICU_IP_TYPES_VENDOR_ID)
+    #error "Icu_Ipw_Types.h and Ftm_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION    != FTM_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION    != FTM_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION != FTM_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_Types.h and Ftm_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_TYPES_SW_MAJOR_VERSION != FTM_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_MINOR_VERSION != FTM_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_PATCH_VERSION != FTM_ICU_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Types.h and Ftm_Icu_Ip_Types.h are different"
+#endif
+
+/* Check if header file and ICU Lpit_Icu_Ip_Types.h header file are of the same vendor. */
+#if (ICU_IPW_TYPES_VENDOR_ID != LPIT_ICU_IP_TYPES_VENDOR_ID)
+    #error "Icu_Ipw_Types.h and Lpit_Icu_Ip_Types.h have different vendor IDs!"
+#endif
+/* Check if header file and ICU Lpit_Icu_Ip_Types.h header file are of the same AutoSar version */
+#if ((ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION    != LPIT_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION    != LPIT_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_Types.h and Lpit_Icu_Ip_Types.h are different!"
+#endif
+/* Check if heder file and ICU Lpit_Icu_Ip_Types.h header file are of the same Software version */
+#if ((ICU_IPW_TYPES_SW_MAJOR_VERSION != LPIT_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_MINOR_VERSION != LPIT_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_PATCH_VERSION != LPIT_ICU_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Types.h and Lpit_Icu_Ip_Types.h are different!"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_TYPES_VENDOR_ID != LPTMR_ICU_IP_TYPES_VENDOR_ID)
+    #error "Icu_Ipw_Types.h and Lptmr_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION    != LPTMR_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION    != LPTMR_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION != LPTMR_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_Types.h and Lptmr_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_TYPES_SW_MAJOR_VERSION != LPTMR_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_MINOR_VERSION != LPTMR_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_PATCH_VERSION != LPTMR_ICU_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Types.h and Lptmr_Icu_Ip_Types.h are different"
+#endif
+
+#if (ICU_IPW_TYPES_VENDOR_ID != PORT_CI_ICU_IP_TYPES_VENDOR_ID)
+    #error "Icu_Ipw_Types.h and Port_Ci_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION    != PORT_CI_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION    != PORT_CI_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION != PORT_CI_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_Types.h and Port_Ci_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_TYPES_SW_MAJOR_VERSION != PORT_CI_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_MINOR_VERSION != PORT_CI_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_PATCH_VERSION != PORT_CI_ICU_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Types.h and Port_Ci_Icu_Ip_Types.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_TYPES_SW_MAJOR_VERSION != CMP_IP_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_MINOR_VERSION != CMP_IP_TYPES_SW_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_PATCH_VERSION != CMP_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Types.h and Cmp_Ip_Types.h are different"
+#endif
+
+/* Check if source file and Icu_Cfg.h header file are of the same vendor */
+#if (ICU_IPW_TYPES_VENDOR_ID != ICU_CFG_VENDOR_ID)
+    #error "Icu_Ipw_Types.h and Icu_Cfg.h have different vendor IDs"
+#endif
+/* Check if source file and Icu_Cfg.h header file are of the same AutoSar version */
+#if ((ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION    != ICU_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION    != ICU_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION != ICU_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_Types.h and Icu_Cfg.h are different"
+#endif
+/* Check if source file and Icu_Cfg.h header file are of the same Software version */
+#if ((ICU_IPW_TYPES_SW_MAJOR_VERSION != ICU_CFG_SW_MAJOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_MINOR_VERSION != ICU_CFG_SW_MINOR_VERSION) || \
+     (ICU_IPW_TYPES_SW_PATCH_VERSION != ICU_CFG_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Types.h and Icu_Cfg.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+/**
+* @brief Wakeup feature is currently enabled
+*/
+#define ICU_CHANNEL_STATE_WKUP                  (1U)
+
+/**
+* @brief The current channel status - IDLE / ACTIVE
+*/
+#define ICU_CHANNEL_STATE_IDLE                  (1U<<1)
+
+/**
+* @brief Notification is enabled
+*/
+#define ICU_CHANNEL_STATE_NOTIFICATION          (1U<<2)
+
+/**
+* @brief The current channel state
+*/
+#define ICU_CHANNEL_STATE_RUNNING               (1U<<3)
+
+/**
+* @brief Overflow flag
+*/
+#define ICU_CHANNEL_STATE_OVERFLOW              (1U<<4)
+
+/**
+* @brief Wakeup source
+*/
+#define ICU_CHANNEL_IS_WAKEUP_SOURCE            (1U<<7)
+
+
+#if (ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON)
+/**
+ * @brief  Definition majorloop count for dma
+ */
+#define ICU_DMA_MAJORLOOP_COUNT    ((uint32)2U)
+
+/**
+ * @brief  Definition majorloop count for dma
+ */
+#define ICU_DMA_MAJORLOOP_FIRST_COUNT    ((uint32)1U)
+#endif
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+#if ((ICU_DEV_ERROR_DETECT == STD_ON) && (ICU_GET_INPUT_LEVEL_API == STD_ON))
+/**
+ * @internal
+ * @brief       Icu_Ipw_StatusType
+ * @details     This indicates the operation success or fail
+ */
+typedef enum
+{
+    ICU_IPW_SUCCESS     = 0x0U,
+    ICU_IPW_ERROR       = 0x1U
+}Icu_Ipw_StatusType;
+#endif
+
+typedef enum
+{
+    ICU_FTM_MODULE      = 0U,
+    ICU_LPIT_MODULE     = 1U,
+    ICU_LPTMR_MODULE    = 2U,
+    ICU_PORT_CI_MODULE  = 3U,
+    ICU_CMP_MODULE      = 4U
+} Icu_Ipw_ModuleType;
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+/** 
+ * @internal
+ * @brief Icu channel low level configuration mapping.
+ *        Members aligned to respect MISRA 11.5 
+ */
+typedef struct
+{
+    Icu_Ipw_ModuleType                      channelIp;           /** @brief The IP used to implement this specific Icu channel */
+    uint8                                   instanceNo;          /** @brief The instance index used for the configuration of channel */
+    const Ftm_Icu_Ip_ChannelConfigType*     pFtmHwChannelConfig; /** @brief FTM channels configuration for current instance. */
+    const Lpit_Icu_Ip_ChannelConfigType*    pLpitHwChannelConfig; /** @brief LPIT channels configuration for current instance. */
+    const Lptmr_Icu_Ip_ChannelConfigType*   pLptmrHwChannelConfig;
+    const Port_Ci_Icu_Ip_ChannelConfigType* pPortCiHwChannelConfig;
+    const Cmp_Ip_ConfigType*                pCmpHwChannelConfig; /** @brief CMP channels configuration for current instance. */
+    uint8                                   index;               /** @brief Index in the Ip configuration array */  
+} Icu_Ipw_ChannelConfigType;
+
+/** 
+ * @internal
+ * @brief      Icu instance low level configuration mapping.
+ *             Members aligned to respect MISRA 11.5 
+ */
+typedef struct
+{
+    Icu_Ipw_ModuleType                      instanceIp;           /** @brief The IP type used. */
+    uint8                                   instanceNo;           /** @brief The instance number used. */
+    const Ftm_Icu_Ip_ConfigType*            pFtmHwIpConfig;       /** @brief Pointer to FTM instance specific configuration. */
+    const Lpit_Icu_Ip_ConfigType*           pLpitHwInstanceConfig; /** @brief Pointer to LPIT instance specific configuration. */
+    const Lptmr_Icu_Ip_ConfigType*          pLptmrHwIpConfig;     /** @brief Pointer to Lptmr IP specific configuration */    
+    const Port_Ci_Icu_Ip_ConfigType*        pPortCiHwIpConfig;    /** @brief Pointer to Port Ci IP specific configuration */
+    const Cmp_Ip_ConfigType*                pCmpHwIpConfig;       /** @brief Pointer to Cmp IP specific configuration */
+} Icu_Ipw_IpConfigType;
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* ICU_IPW_TYPES_H */

+ 159 - 0
RTD/include/Icu_Irq.h

@@ -0,0 +1,159 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_IRQ_H
+#define ICU_IRQ_H
+
+/**
+*     @file
+*
+*     @addtogroup icu Icu Driver
+*     @{
+*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Icu_Types.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_IRQ_VENDOR_ID                       43
+#define ICU_IRQ_AR_RELEASE_MAJOR_VERSION        4
+#define ICU_IRQ_AR_RELEASE_MINOR_VERSION        4
+#define ICU_IRQ_AR_RELEASE_REVISION_VERSION     0
+#define ICU_IRQ_SW_MAJOR_VERSION                1
+#define ICU_IRQ_SW_MINOR_VERSION                0
+#define ICU_IRQ_SW_PATCH_VERSION                0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IRQ_VENDOR_ID != ICU_TYPES_VENDOR_ID)
+    #error "Icu_Irq.h and Icu_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IRQ_AR_RELEASE_MAJOR_VERSION != ICU_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IRQ_AR_RELEASE_MINOR_VERSION != ICU_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IRQ_AR_RELEASE_REVISION_VERSION != ICU_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Irq.h and Icu_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IRQ_SW_MAJOR_VERSION != ICU_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_IRQ_SW_MINOR_VERSION != ICU_TYPES_SW_MINOR_VERSION) || \
+     (ICU_IRQ_SW_PATCH_VERSION != ICU_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Irq.h and Icu_Types.h are different"
+#endif
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+/**
+* @brief      This function reports the wakeup and overflow events, if available.
+* @details    This function reports the wakeup and overflow events, if available.
+*             Called from hardware interrupt routine and route to user overflow handler
+*
+* @param[in]  Channel        Hardware number identifier of the ICU channel
+* @param[in]  bOverflow        Parameter that indicates the source of report is an overflow
+*
+* @return     void
+* @pre        Icu_Init must be called before.
+*
+* @implements Icu_ReportWakeupAndOverflow_Activity
+**/
+void Icu_ReportWakeupAndOverflow(uint16 Channel, boolean bOverflow);
+                                 
+/**
+ * @brief     This function reports the wakeup event, overflow event and notification, if available
+ * @details   This function reports the wakeup event, overflow event and notification, if available
+ *
+ * @param[in]    Channel          Harware number identifier of the ICU channel
+ * @param[in]    overflow           Parameter that indicates the source of report is an overflow
+ *
+ * @return      void
+ * @pre        Icu_Init must be called before.
+ *
+ * @implements Icu_ReportEvents_Activity
+ */
+void Icu_ReportEvents(uint16 Channel, boolean bOverflow);
+
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+/**
+* @brief      This function saves the value of timestamps in the internal buffer
+* @details    This function saves the value of timestamps in the internal buffer
+*
+* @param[in]  Channel   Logical number of the ICU channel
+*
+* @return     void
+* @pre        Icu_Init must be called before.
+* @implements Icu_TimestampDmaProcessing_Activity
+**/
+void Icu_TimestampDmaProcessing(Icu_ChannelType Channel);
+#endif
+
+#if (ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON)
+/**
+* @brief      This function saves the value of timestamps in the internal buffer
+* @details    This function saves the value of timestamps in the internal buffer
+*
+* @param[in]  Channel   Logical number of the ICU channel
+* @return     void
+* @pre        Icu_Init must be called before.
+*
+* @implements Icu_TimestampDmaProcessing_Activity
+**/
+void Icu_SignalMeasurementDmaProcessing(Icu_ChannelType Channel);
+#endif
+
+/**
+ * @brief Signature of change logic channel state callback function.
+ * 
+ * @param logicChannel    Logical number of the ICU channel
+ * @param mask            Bit mark
+ * @param set             Set value
+ */
+void Icu_LogicChStateCallback(uint16 logicChannel, uint8 mask, boolean set);
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* ICU_IRQ_H */

+ 288 - 0
RTD/include/Icu_Types.h

@@ -0,0 +1,288 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_TYPES_H
+#define ICU_TYPES_H
+
+/**
+ *     @file
+ *
+ *     @addtogroup icu Icu Driver
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "StandardTypes.h"
+#include "Icu_Cfg.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_TYPES_VENDOR_ID                       43
+#define ICU_TYPES_AR_RELEASE_MAJOR_VERSION        4
+#define ICU_TYPES_AR_RELEASE_MINOR_VERSION        4
+#define ICU_TYPES_AR_RELEASE_REVISION_VERSION     0
+#define ICU_TYPES_SW_MAJOR_VERSION                1
+#define ICU_TYPES_SW_MINOR_VERSION                0
+#define ICU_TYPES_SW_PATCH_VERSION                0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((ICU_TYPES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (ICU_TYPES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+    #error "AutoSar Version Numbers of Icu_Types.h and StandardTypes.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_TYPES_VENDOR_ID != ICU_CFG_VENDOR_ID)
+    #error "Icu_Types.h and Icu_Cfg.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_TYPES_AR_RELEASE_MAJOR_VERSION != ICU_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_TYPES_AR_RELEASE_MINOR_VERSION != ICU_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_TYPES_AR_RELEASE_REVISION_VERSION != ICU_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Types.h and Icu_Cfg.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_TYPES_SW_MAJOR_VERSION != ICU_CFG_SW_MAJOR_VERSION) || \
+     (ICU_TYPES_SW_MINOR_VERSION != ICU_CFG_SW_MINOR_VERSION) || \
+     (ICU_TYPES_SW_PATCH_VERSION != ICU_CFG_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu_Types.h and Icu_Cfg.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+
+/**
+* @brief Allow enabling or disabling of all interrupts which are not required for the ECU wakeup
+* @implements Icu_ModeType_enum
+*/
+typedef enum
+{
+    ICU_MODE_NORMAL = 0U,     /**< @brief Normal operation, all used interrupts are enabled
+                               *          according to the notification requests. */
+    ICU_MODE_SLEEP            /**< @brief Reduced power operation. In sleep mode only those
+                               *          notifications are available which are configured as wakeup
+                               *          capable. */
+} Icu_ModeType;
+
+#if (ICU_GET_INPUT_STATE_API == STD_ON)
+/**
+* @brief          Input state of an ICU channel.
+* @implements     Icu_InputStateType_enum
+*/
+typedef enum
+{
+    ICU_IDLE = 0U,         /**< @brief No activation edge has been detected since the last call of
+                            *  Icu_GetInputState() or Icu_Init(). */
+    ICU_ACTIVE             /**< @brief An activation edge has been detected. */
+} Icu_InputStateType;
+#endif
+
+/**
+* @brief Definition of the measurement mode type.
+* @implements Icu_MeasurementModeType_enum
+*/
+typedef enum
+{
+    ICU_MODE_SIGNAL_EDGE_DETECT = 0x01U,   /**< @brief Mode for detecting edges */
+    ICU_MODE_SIGNAL_MEASUREMENT = 0x02U,   /**< @brief Mode for measuring different times between
+                                            *         various configurable edges */
+    ICU_MODE_TIMESTAMP          = 0x04U,   /**< @brief Mode for capturing timer values on
+                                            *         configurable edges */
+    ICU_MODE_EDGE_COUNTER       = 0x08U    /**< @brief Mode for counting edges on configurable
+                                            *         edges*/
+} Icu_MeasurementModeType;
+
+
+#if ((ICU_GET_TIME_ELAPSED_API == STD_ON) || (ICU_SIGNAL_MEASUREMENT_API == STD_ON))
+/**
+* @brief Definition of the measurement property type.
+* @implements Icu_SignalMeasurementPropertyType_enum
+*/
+typedef enum
+{
+    ICU_LOW_TIME    = 0x01U,            /**< @brief The channel is configured for reading the
+                                         *          elapsed Signal Low Time. */
+    ICU_HIGH_TIME   = 0x02U,            /**< @brief The channel is configured for reading the
+                                         *          elapsed Signal High Time. */                              
+    ICU_PERIOD_TIME = 0x04U,            /**< @brief The channel is configured for reading the
+                                         *          elapsed Signal Period Time. */
+    ICU_DUTY_CYCLE  = 0x08U             /**< @brief The channel is configured to read values which
+                                         *          are needed for calculating the duty cycle
+                                         *          (coherent Active and Period Time). */
+} Icu_SignalMeasurementPropertyType;
+#endif
+
+/**
+* @brief Definition of the timestamp measurement property type.
+* @implements Icu_TimestampBufferType_enum
+*/
+typedef enum
+{
+    ICU_LINEAR_BUFFER = 0U,     /**< @brief The buffer will just be filled once. */
+    ICU_CIRCULAR_BUFFER         /**< @brief After reaching the end of the buffer, the driver
+                                 *          restarts at the beginning of the buffer. */
+} Icu_TimestampBufferType;
+
+
+/** @brief Definition of the type of activation of an ICU channel.
+* @implements Icu_ActivationType_enum
+*/
+typedef enum
+{
+    ICU_RISING_EDGE  = 1U,     /**< @brief An appropriate action shall be executed when a rising
+                                  *          edge occurs on the ICU input signal */
+    ICU_FALLING_EDGE = 2U,     /**< @brief An appropriate action shall be executed when a falling
+                                  *          edge occurs on the ICU input signal. */
+    ICU_BOTH_EDGES   = 3U      /**< @brief An appropriate action shall be executed when either a
+                                  *         rising or falling edge occur on the ICU input signal. */
+} Icu_ActivationType;
+
+
+#if (ICU_GET_INPUT_LEVEL_API == STD_ON)
+/**
+* @brief   Return the status of the pin.
+* @details Enumeration of to check the status of pin.
+*/
+typedef enum
+{
+    /** @brief Default Input PIN Status */
+    ICU_LEVEL_LOW    = 0x0U,
+    /** @brief As Icu_GetInputState do not give the Actual PIN status user can call the Non Autosar API
+        Icu_GetInputLevel to get the Actual status of PIN*/
+    ICU_LEVEL_HIGH = 0x1U
+} Icu_LevelType;
+
+#endif /* ICU_GET_INPUT_LEVEL_API */
+
+
+#if (ICU_DUAL_CLOCK_MODE_API == STD_ON)
+/**
+* @brief   Definition of prescaler type.
+*
+*/
+typedef enum
+{
+    ICU_NORMAL_CLOCK_MODE    = 0x0U,           /**< @brief Default channel prescaler. */
+    ICU_ALTERNATE_CLOCK_MODE  = 0x1U                 /**< @brief Alternate channel prescaler mode */
+} Icu_SelectPrescalerType;
+
+#endif /* ICU_DUAL_CLOCK_MODE_API */
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+/** @brief ICU Channel state type. */
+typedef uint8                           Icu_ChannelStateType;
+
+/** @brief This gives the numeric ID (hardware channel number) of an ICU channel
+* @implements Icu_ChannelType_typedef
+*/
+typedef uint16                          Icu_ChannelType;
+
+/** @brief Type for saving the timer register width value. 
+* @implements Icu_ValueType_typedef
+*/
+typedef Icu_TimerRegisterWidthType      Icu_ValueType;
+
+/**
+* @brief          Type for saving the ICU Hardware specific index
+* @implements     Icu_IndexType_typedef
+*/
+typedef Icu_HwSpecificIndexType         Icu_IndexType;
+
+/** @brief          Type for saving hardware specific edge number
+* @implements     Icu_EdgeNumberType_typedef
+*/
+typedef Icu_HwSpecificEdgeNumberType    Icu_EdgeNumberType;
+
+#if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
+/**
+* @brief          Type for saving the Wakeup value
+*/
+typedef uint32                          Icu_WakeupValueType;
+#endif 
+
+/**
+* @brief          Type for saving the ICU measurement submode type
+*
+*/
+typedef uint16                           Icu_MeasurementSubModeType;
+
+/** @brief The notification functions shall have no parameters and no return value.
+* @implements     Icu_NotifyType_typedef
+*/
+typedef void                             (*Icu_NotifyType)(void);
+
+#if (ICU_GET_DUTY_CYCLE_VALUES_API== STD_ON)
+/**
+* @brief Structure that contains ICU Duty cycle parameters. It contains the values needed for
+*        calculating duty cycles i.e Period time value and active time value.
+* @implements Icu_DutyCycleType_struct
+*/
+typedef struct
+{
+    Icu_ValueType ActiveTime;         /**< @brief Low or High time value. */
+    Icu_ValueType PeriodTime;         /**< @brief Period time value. */
+} Icu_DutyCycleType;
+#endif
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* ICU_TYPES_H */

+ 258 - 0
RTD/include/Lpit_Icu_Ip.h

@@ -0,0 +1,258 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPIT_ICU_IP_H
+#define LPIT_ICU_IP_H
+
+/**
+ *     @file       Lpit_Icu_Ip.h 
+ *     @brief      Header file of LPIT module.
+ *     @details    This file contains signatures for all the functions which are related to LPIT 
+ *                 module.
+ *     @addtogroup lpit_icu_ip LPIT IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lpit_Icu_Ip_Types.h"
+#include "Lpit_Icu_Ip_Cfg.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPIT_ICU_IP_VENDOR_ID                    43
+#define LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION     4
+#define LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION     4
+#define LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION  0
+#define LPIT_ICU_IP_SW_MAJOR_VERSION             1
+#define LPIT_ICU_IP_SW_MINOR_VERSION             0
+#define LPIT_ICU_IP_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if header file and Lpit_Icu_Ip_Types.h header file are of the same vendor */
+#if (LPIT_ICU_IP_VENDOR_ID != LPIT_ICU_IP_TYPES_VENDOR_ID)
+    #error "Lpit_Icu_Ip.h and Lpit_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if header file and Lpit_Icu_Ip_Types.h header file are of the same AUTOSAR version */
+#if ((LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION    != LPIT_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION    != LPIT_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lpit_Icu_Ip.h and Lpit_Icu_Ip_Types.h are different"
+#endif
+/* Check if header file and Lpit_Icu_Ip_Types.h header file are of the same software version */
+#if ((LPIT_ICU_IP_SW_MAJOR_VERSION != LPIT_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_SW_MINOR_VERSION != LPIT_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (LPIT_ICU_IP_SW_PATCH_VERSION != LPIT_ICU_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Lpit_Icu_Ip.h and Lpit_Icu_Ip_Types.h are different"
+#endif
+
+/* Check if header file and ICU Lpit_Icu_Ip_Cfg.h header file are of the same vendor */
+#if (LPIT_ICU_IP_VENDOR_ID != LPIT_ICU_IP_CFG_VENDOR_ID)
+    #error "Lpit_Icu_Ip.h and Lpit_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+/* Check if header file and ICU Lpit_Icu_Ip_Cfg.h header file are of the same AutoSar version */
+#if ((LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION    != LPIT_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION    != LPIT_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lpit_Icu_Ip.h and Lpit_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if header file and ICU Lpit_Icu_Ip_Cfg.h header file are of the same Software version */
+#if ((LPIT_ICU_IP_SW_MAJOR_VERSION != LPIT_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_SW_MINOR_VERSION != LPIT_ICU_IP_CFG_SW_MINOR_VERSION) || \
+     (LPIT_ICU_IP_SW_PATCH_VERSION != LPIT_ICU_IP_CFG_SW_PATCH_VERSION))
+#error "Software Version Numbers of Lpit_Icu_Ip.h and Lpit_Icu_Ip_Cfg.h are different"
+#endif
+
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+#if (defined LPIT_ICU_CONFIG_EXT)
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/* Macro used to import LPIT generated configurations. */
+LPIT_ICU_CONFIG_EXT
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+#endif /* LPIT_ICU_CONFIG_EXT */
+
+#define ICU_START_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+/* Table of base addresses for LPIT instances. */
+extern LPIT_Type* const lpitBase[];
+
+#define ICU_STOP_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+/**
+ * @brief   LPIT driver initialization function for LPIT module.
+ * @details This function is called separately for each LPIT instace and will do the following:
+ *          - enables the LPIT module
+ *          - configures the debug mode (enabled or disabled)
+ *          - disable the IRQ correpsonding to the LPIT channel
+ *          - clears the (pending) interrupt flag corresponding to LPIT channel
+ *          - enable channel interrupts
+ *          - Set Trigger Input Capture Mode
+ *
+ * @param[in] instance     - hardware instance to be configured
+ * @param[in] userConfig - configuration of the instance that will be intialized
+ * @return Lpit_Icu_Ip_StatusType
+ */
+Lpit_Icu_Ip_StatusType Lpit_Icu_Ip_Init (uint8 instance, const Lpit_Icu_Ip_ConfigType * userConfig);
+
+#if (LPIT_ICU_DEINIT_API == STD_ON)
+/**
+ * @brief   LPIT driver deinitialization function for LPIT module.
+ * @details This function is called separately for each LPIT instace and will do the following:
+ *          - disables the LPIT channel
+ *          - disables the debug mode
+ *          - disables IRQ corresponding to LPit channel
+ *          - clears the (pending) interrupt flag corresponding to LPIT channel
+ *
+ * @param[in] instance  - hardware instance of the module
+ * @return Lpit_Icu_Ip_StatusType
+ */
+Lpit_Icu_Ip_StatusType Lpit_Icu_Ip_Deinit(uint8 instance);
+#endif /* LPIT_ICU_DEINIT_API */
+
+/**
+ * @brief   LPIT driver function that enables interrupts on a LPIT channel.
+ * @details This function enables LPIT channel interrupt.
+ * 
+ * @param[in] instance  - hardware instance of the module
+ * @param[in] hwChannel - channel instance of the module
+ */
+void Lpit_Icu_Ip_EnableInterrupt(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief   LPIT driver function that disables interrupts on a LPIT channel.
+ * @details This function disables LPIT channel interrupt.
+ * 
+ * @param[in] instance  - hardware instance of the module
+ * @param[in] hwChannel - channel instance of the module
+ */
+void Lpit_Icu_Ip_DisableInterrupt(uint8 instance, uint8 hwChannel);
+
+#if (LPIT_ICU_EDGE_DETECT_API == STD_ON)
+/**
+ * @brief LPIT IP layer function that enables edge detection measure mode for a given module and channel.
+ * 
+ * @param[in] instance  - hardware instance of the module
+ * @param[in] hwChannel - channel instance of the module
+ */
+void Lpit_Icu_Ip_EnableEdgeDetection(uint8 instance, uint8 hwChannel);
+#endif /* LPIT_ICU_EDGE_DETECT_API */
+
+#if ((LPIT_ICU_EDGE_DETECT_API == STD_ON) || (LPIT_ICU_TIMESTAMP_API == STD_ON))
+/**
+ * @brief LPIT IP layer function that disable all measure modes for a given module and channel.
+ * 
+ * @param[in] instance  - hardware instance of the module
+ * @param[in] hwChannel - channel instance of the module
+ */
+void Lpit_Icu_Ip_DisableDetectionMode(uint8 instance, uint8 hwChannel);
+#endif /* (LPIT_ICU_EDGE_DETECT_API == STD_ON) || (LPIT_ICU_TIMESTAMP_API == STD_ON) */
+
+#if (LPIT_ICU_GET_INPUT_STATE_API == STD_ON)
+/**
+ * @brief 
+ * 
+ * @param instance        module instance number
+ * @param hwChannel       channel number
+ * @return boolean 
+ */
+boolean Lpit_Icu_Ip_GetInputState(uint8 instance, uint8 hwChannel);
+#endif /* LPIT_ICU_GET_INPUT_STATE_API */
+
+#if (STD_ON == LPIT_ICU_TIMESTAMP_API)
+/**
+ * @brief 
+ * 
+ * @param instance  LPIT module on which the current channel is located.
+ * @param hwChannel   LPIT hardware channel used.
+ * @param bufferPtr 
+ * @param bufferSize 
+ * @param notifyInterval 
+ */
+void Lpit_Icu_Ip_StartTimestamp(uint8 instance,
+                                uint8 hwChannel,
+                                uint16 *bufferPtr,
+                                uint16 bufferSize,
+                                uint16 notifyInterval);
+#endif /* STD_ON == LPIT_ICU_TIMESTAMP_API */
+
+/**
+ * @brief      Driver function Enable Notification for timestamp.
+ *
+ * @param[in]  instance  Hardware instance of FTM used. 
+ * @param[in]  hwChannel Hardware channel of FTM used.
+ * @return     void
+ */
+void Lpit_Icu_Ip_EnableNotification(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief      Driver function Disable Notification for timestamp.
+ *
+ * @param[in]  instance  Hardware instance of FTM used. 
+ * @param[in]  hwChannel Hardware channel of FTM used.
+ * @return     void
+ */
+void Lpit_Icu_Ip_DisableNotification(uint8 instance, uint8 hwChannel);
+
+/**
+ * @brief      Get timestamp index for timestamp mode.
+ *
+ * @param[in]  instance  Hardware instance of FTM used. 
+ * @param[in]  hwChannel Hardware channel of FTM used.
+ * @return     uint16
+ */
+uint16 Lpit_Icu_Ip_GetTimestampIndex(uint8 instance, uint8 channel);
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+/** @} */
+
+#endif /* LPIT_ICU_IP_H */

+ 159 - 0
RTD/include/Lpit_Icu_Ip_Irq.h

@@ -0,0 +1,159 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPIT_ICU_IP_IRQ_H
+#define LPIT_ICU_IP_IRQ_H
+
+/**
+ *   @file       Interrupt functions description.
+ *   @details    This file contains the signature of interrups functions that can be used on the 
+ *               LPIT module.
+ *   @addtogroup lpit_icu_ip LPIT IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "OsIf.h"
+#include "Lpit_Icu_Ip_Cfg.h"
+#include "Lpit_Icu_Ip_Types.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPIT_ICU_IP_IRQ_VENDOR_ID                   43
+#define LPIT_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION    4
+#define LPIT_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION    4
+#define LPIT_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION 0
+#define LPIT_ICU_IP_IRQ_SW_MAJOR_VERSION            1
+#define LPIT_ICU_IP_IRQ_SW_MINOR_VERSION            0
+#define LPIT_ICU_IP_IRQ_SW_PATCH_VERSION            0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and OsIf.h file are of the same Autosar version */
+    #if ((LPIT_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION != OSIF_AR_RELEASE_MAJOR_VERSION) || \
+         (LPIT_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION != OSIF_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Lpit_Icu_Ip_Irq.h and OsIf.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (LPIT_ICU_IP_IRQ_VENDOR_ID != LPIT_ICU_IP_CFG_VENDOR_ID)
+    #error "Lpit_Icu_Ip_Irq.h and Lpit_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((LPIT_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION    != LPIT_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION    != LPIT_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lpit_Icu_Ip_Irq.h and Lpit_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((LPIT_ICU_IP_IRQ_SW_MAJOR_VERSION != LPIT_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_SW_MINOR_VERSION != LPIT_ICU_IP_CFG_SW_MINOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_SW_PATCH_VERSION != LPIT_ICU_IP_CFG_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Lpit_Icu_Ip_Irq.h and Lpit_Icu_Ip_Cfg.h are different"
+#endif
+
+/* Check if header file and Lpit_Icu_Ip_Types.h header file are of the same vendor */
+#if (LPIT_ICU_IP_IRQ_VENDOR_ID != LPIT_ICU_IP_TYPES_VENDOR_ID)
+    #error "Lpit_Icu_Ip_Irq.h and Lpit_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if header file and Lpit_Icu_Ip_Types.h header file are of the same AutoSar version */
+#if ((LPIT_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION    != LPIT_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION    != LPIT_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lpit_Icu_Ip_Irq.h and Lpit_Icu_Ip_Types.h are different"
+#endif
+/* Check if header file and Lpit_Icu_Ip_Types.h header file file are of the same Software version */
+#if ((LPIT_ICU_IP_IRQ_SW_MAJOR_VERSION != LPIT_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_SW_MINOR_VERSION != LPIT_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_SW_PATCH_VERSION != LPIT_ICU_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Lpit_Icu_Ip_Irq.h and Lpit_Icu_Ip_Types.h are different"
+#endif
+
+/*==================================================================================================
+*                                        LOCAL CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
+#include "Icu_MemMap.h"
+
+extern Lpit_Icu_Ip_ChannelsStateType channelsState[LPIT_INSTANCE_COUNT][LPIT_TMR_COUNT];
+
+#if (STD_ON == LPIT_ICU_TIMESTAMP_API)
+extern Lpit_Icu_Ip_TimestampType timestampState[LPIT_INSTANCE_COUNT][LPIT_TMR_COUNT];
+#endif
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+/**
+ * @brief LPIT_0 independent ISR declarations
+*/
+#if (defined LPIT_ICU_0_CH_0_ISR_USED)
+ISR(LPIT_0_CH_0_ISR);
+#endif
+#if (defined LPIT_ICU_0_CH_1_ISR_USED)
+ISR(LPIT_0_CH_1_ISR);
+#endif
+#if (defined LPIT_ICU_0_CH_2_ISR_USED)
+ISR(LPIT_0_CH_2_ISR);
+#endif
+#if (defined LPIT_ICU_0_CH_3_ISR_USED)
+ISR(LPIT_0_CH_3_ISR);
+#endif
+#if (defined LPIT_ICU_0_ISR_USED)
+ISR(LPIT_0_ISR);
+#endif
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* LPIT_ICU_IP_IRQ_H */

+ 180 - 0
RTD/include/Lpit_Icu_Ip_Types.h

@@ -0,0 +1,180 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPIT_ICU_TYPES
+#define LPIT_ICU_TYPES
+
+/**
+ * @file       Lpit_Icu_Ip_Types.h
+ * @details    This header contains all the types used by ICU driver for CMP IP.
+ *
+ * @addtogroup lpit_icu_ip LPIT IPL
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                         INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lpit_Icu_Ip_Defines.h"
+
+/*==================================================================================================
+*                              SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPIT_ICU_IP_TYPES_VENDOR_ID                    43
+#define LPIT_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION     4
+#define LPIT_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION     4
+#define LPIT_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION  0
+#define LPIT_ICU_IP_TYPES_SW_MAJOR_VERSION             1
+#define LPIT_ICU_IP_TYPES_SW_MINOR_VERSION             0
+#define LPIT_ICU_IP_TYPES_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+===================================================================================================*/
+/* Check if header file and Lpit_Icu_Ip_Defines.h header file are of the same vendor */
+#if (LPIT_ICU_IP_TYPES_VENDOR_ID != LPIT_ICU_IP_DEFINES_VENDOR_ID)
+    #error "Vendor IDs of Lpit_Icu_Ip_Types.h and Lpit_Icu_Ip_Defines.h are different."
+#endif
+
+/* Check if header file and Lpit_Icu_Ip_Defines.h header file are of the same AUTOSAR version */
+#if ((LPIT_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION    != LPIT_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION    != LPIT_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_DEFINES_AR_RELEASE_REVISION_VERSION))
+    #error "AUTOSAR version numbers of Lpit_Icu_Ip_Types.h and Lpit_Icu_Ip_Defines.h are different."
+#endif
+
+/* Check if header file and Lpit_Icu_Ip_Defines.h header file are of the same software version */
+#if ((LPIT_ICU_IP_TYPES_SW_MAJOR_VERSION != LPIT_ICU_IP_DEFINES_SW_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_TYPES_SW_MINOR_VERSION != LPIT_ICU_IP_DEFINES_SW_MINOR_VERSION) || \
+     (LPIT_ICU_IP_TYPES_SW_PATCH_VERSION != LPIT_ICU_IP_DEFINES_SW_PATCH_VERSION))
+    #error "Software version numbers of Lpit_Icu_Ip_Types.h and Lpit_Icu_Ip_Defines.h are different."
+#endif
+
+/*==================================================================================================
+*                                       DEFINES AND MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+/** @brief Generic error codes. */
+typedef enum
+{
+    /** @brief Generic operation success status. */
+    LPIT_IP_STATUS_SUCCESS                         = 0x00U,
+    /** @brief Generic operation failure status. */
+    LPIT_IP_STATUS_ERROR                           = 0x01U
+} Lpit_Icu_Ip_StatusType;
+/*==================================================================================================
+*                                STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+/** @brief The notification functions shall have no parameters and no return value.*/
+typedef void                             (*Lpit_Icu_Ip_NotifyType)(void);
+
+/** @brief Callback type for each channel. */
+typedef void (*Lpit_Icu_Ip_CallbackType)(uint16 callbackParam1, boolean callbackParam2);
+
+/** @brief Callback type for each channel. */
+typedef void (*Lpit_Icu_Ip_LogicChState)(uint16 logicChannel, uint8 mask, boolean set);
+
+#if (STD_ON == LPIT_ICU_TIMESTAMP_API)
+/** @brief Type of operation for timestamp. */
+typedef enum
+{
+    LPIT_ICU_IP_NO_BUFFER       = 0U, /**< @brief No timestamp. */
+    LPIT_ICU_IP_CIRCULAR_BUFFER = 1U, /**< @brief The timestamp with circular buffer . */ 
+    LPIT_ICU_IP_LINEAR_BUFFER   = 2U  /**< @brief The timestamp with linear buffer . */  
+} Lpit_Icu_Ip_TimestampBufferType; 
+
+typedef struct
+{
+    uint16*                         bufferPtr;
+    uint16                          bufferSize;
+    uint16                          notifyInterval;
+    uint16                          notifyCount;
+    uint16                          bufferIndex;
+    Lpit_Icu_Ip_TimestampBufferType timestampBuffer;
+} Lpit_Icu_Ip_TimestampType;
+#endif /* STD_ON == LPIT_ICU_TIMESTAMP_API */
+
+/** @brief LPIT channel configuration structure. */
+typedef struct
+{
+    const uint8                           hwChannel;               /**< @brief Channel hardware index. */
+    const uint8                           triggerSelect;           /**< @brief Trigger to use for starting and/or reloading the LPIT timer. */
+    const uint8                           triggerSource;           /**< @brief Select source of trigger. */
+#if (STD_ON == LPIT_ICU_TIMESTAMP_API)
+    const Lpit_Icu_Ip_TimestampBufferType timestampBuffer;
+#endif
+    Lpit_Icu_Ip_CallbackType              callback;                /*!< @brief The callback function for channels edge detect events */
+    uint8                                 callbackParams;          /*!< @brief The parameters of callback functions for channels events */
+    Lpit_Icu_Ip_LogicChState              logicChStateCallback;    /*!< @brief Store address of function used to change the logic state of the channel in HLD. */
+    boolean                               initNotificationEnable;  /*!< Store the initialization state that determines whether Notifications are enabled, it is always TRUE with standalone IPL and FALSE with AUTOSAR mode. */
+    const Lpit_Icu_Ip_NotifyType          lpitChannelNotify;       /*!< @brief The notification functions shall have no parameters and no return value.*/
+} Lpit_Icu_Ip_ChannelConfigType;
+
+/** @brief LPIT IP specific configuration structure type. */
+typedef struct
+{
+    const uint8                         instance;             /**< @brief Instance hardware index. */
+    const boolean                       debugState;           /**< @brief Debug(freeze) mode. */
+    const uint8                         numberOfChannels;     /**< @brief Number of LPIT channels on the current instance. */ 
+    const Lpit_Icu_Ip_ChannelConfigType (*pChannelsConfig)[]; /**< @brief Pointer to the array of configured channels. */
+} Lpit_Icu_Ip_ConfigType;
+
+/** @brief LPIT channel measurement mode supported. */
+typedef enum
+{
+    LPIT_ICU_MODE_NO_MEASUREMENT     = 0x0U, /**< @brief No measurement mode. */
+    LPIT_ICU_MODE_SIGNAL_EDGE_DETECT = 0x1U, /**< @brief Signal edge detect measurement mode. */
+    LPIT_ICU_MODE_TIMESTAMP          = 0x2U  /**< @brief Timestamp measurement mode.*/
+} Lpit_Icu_Ip_MeasurementMode;
+
+/** @brief LPIT channels state. */
+typedef struct
+{
+    boolean                     initState;               /**< @brief Initialization status. */
+    Lpit_Icu_Ip_MeasurementMode measurementMode;         /**< @brief Measurement mode for current channel. */
+    Lpit_Icu_Ip_CallbackType    callback;                /*!< @brief The callback function for channels edge detect events */
+    uint8                       callbackParams;          /*!< @brief The parameters of callback functions for channels events */
+    Lpit_Icu_Ip_LogicChState    logicChStateCallback;    /*!< @brief Store address of function used to change the logic state of the channel in HLD. */
+    Lpit_Icu_Ip_NotifyType      lpitChannelNotify;       /*!< @brief The notification functions shall have no parameters and no return value.*/
+    boolean                     notificationEnable;      /*!< @brief Store the initialization state that determines whether Notifications are enabled, it is always TRUE with standalone IPL and FALSE with AUTOSAR mode. */         
+} Lpit_Icu_Ip_ChannelsStateType;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* LPIT_ICU_TYPES */

+ 257 - 0
RTD/include/Lptmr_Icu_Ip.h

@@ -0,0 +1,257 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPTMR_ICU_IP_H
+#define LPTMR_ICU_IP_H
+
+/**
+ *     @file       Lptmr_Icu_Ip.h
+ *     @brief      Header file of Low Power Timer module.
+ *     @details    This file contains signatures for all the functions which are related to Lptmr 
+ *                 module.
+ *     @addtogroup lptmr_icu_ip LPTMR IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lptmr_Icu_Ip_Types.h"
+#include "Lptmr_Icu_Ip_Cfg.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPTMR_ICU_IP_VENDOR_ID                    43
+#define LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION     4
+#define LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION     4
+#define LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION  0
+#define LPTMR_ICU_IP_SW_MAJOR_VERSION             1
+#define LPTMR_ICU_IP_SW_MINOR_VERSION             0
+#define LPTMR_ICU_IP_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (LPTMR_ICU_IP_VENDOR_ID != LPTMR_ICU_IP_TYPES_VENDOR_ID)
+    #error "Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION != LPTMR_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION != LPTMR_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION != LPTMR_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((LPTMR_ICU_IP_SW_MAJOR_VERSION != LPTMR_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_SW_MINOR_VERSION != LPTMR_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_SW_PATCH_VERSION != LPTMR_ICU_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Types.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (LPTMR_ICU_IP_VENDOR_ID != LPTMR_ICU_IP_CFG_VENDOR_ID)
+    #error "Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION != LPTMR_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION != LPTMR_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION != LPTMR_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((LPTMR_ICU_IP_SW_MAJOR_VERSION != LPTMR_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_SW_MINOR_VERSION != LPTMR_ICU_IP_CFG_SW_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_SW_PATCH_VERSION != LPTMR_ICU_IP_CFG_SW_PATCH_VERSION))
+#error "Software Version Numbers of Lptmr_Icu_Ip.h and Lptmr_Icu_Ip_Cfg.h are different"
+#endif
+
+/*===============================================================================================
+*                                       DEFINES AND MACROS
+===============================================================================================*/
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+#if (defined LPTMR_ICU_CONFIG_EXT)
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/* Macro used to import Lptmr generated configurations. */
+LPTMR_ICU_CONFIG_EXT
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+#endif /*LPTMR_ICU_CONFIG_EXT */
+
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+/**
+ * @brief
+ *
+ *
+ * @param[in]  instance - Hardware instance of LPTMR used.
+ * @param[in]  param    - Configuration of the input capture channel.
+ * @return     void
+ *        
+ *        
+ */
+Lptmr_Icu_Ip_StatusType Lptmr_Icu_Ip_Init(uint8 instance, const Lptmr_Icu_Ip_ConfigType *userConfig);
+
+#if (STD_ON == LPTMR_ICU_DEINIT_API)
+/**
+ * @brief      Disables input capture mode and clears LPTMR instance configuration
+ *
+ * @param[in]  instance   - Hardware instance of LPTMR used.
+ * @param[in]  ipConfig   - Configuration of the input capture channel.
+ */
+Lptmr_Icu_Ip_StatusType Lptmr_Icu_Ip_Deinit(uint8 instance);
+
+#endif /* LPTMR_ICU_DEINIT_API  */
+
+#if (STD_ON == LPTMR_ICU_SET_MODE_API)
+/**
+ * @brief      Driver function sets LPTMR hardware channel into SLEEP mode.
+ *
+ * @param[in]  instance  - Hardware instance of LPTMR used. 
+ * @return     void
+ */
+void Lptmr_Icu_Ip_SetSleepMode(uint8 instance);
+
+/**
+ * @brief      Driver function sets LPTMR hardware channel into NORMAL mode.
+ *
+ * @param[in]  instance  - Hardware instance of LPTMR used. 
+ * @return     void
+ */
+void Lptmr_Icu_Ip_SetNormalMode(uint8 instance);
+
+#endif  /* LPTMR_ICU_SET_MODE_API  */
+
+/**
+ * @brief     This function enables the requested activation condition(rising, falling or both
+ *            edges) for corresponding LPTMR channels.
+ * 
+ * @param[in] instance - Hardware instance of LPTMR used. 
+ * @param[in] activation Edge activation type used.
+ *           - LPTMR_ICU_RISING_EDGE : count pulse on Rising Edge
+ *           - LPTMR_ICU_FALLING_EDGE: count pulse on Falling Edge
+ * @return    void
+ */
+void Lptmr_Icu_Ip_SetActivationCondition(uint8 instance, Lptmr_Icu_Ip_EdgeType activation);
+
+#if (STD_ON == LPTMR_ICU_EDGE_DETECT_API)
+/**
+ * @brief     LPTMR IP layer function which enable edge detection measure mode for a given instance and channel.
+ * 
+ * @param[in] instance - Hardware instance of LPTMR used. 
+ * @return    void
+ */
+void Lptmr_Icu_Ip_EnableEdgeDetection(uint8 instance);
+
+/**
+ * @brief     LPTMR IP layer function which disable edge detection measure mode for a given instance and channel.
+ * 
+ * @param[in] instance  - Hardware instance of LPTMR used. 
+ * @return    void
+ */
+void Lptmr_Icu_Ip_DisableDetection(uint8 instance);
+
+#endif /* LPTMR_ICU_EDGE_DETECT_API */
+
+#if (STD_ON == LPTMR_ICU_EDGE_COUNT_API)
+/**
+ * @brief     LPTMR IP layer function which reset edge count measure mode for a given instance and channel.
+ * 
+ * @param[in] instance  - Hardware instance of LPTMR used. 
+ * @return    void
+ */
+void Lptmr_Icu_Ip_ResetEdgeCount(uint8 instance);
+
+/**
+ * @brief     LPTMR IP layer function which enable edge count measure mode for a given instance and channel.
+ * 
+ * @param[in] instance  - Hardware instance of LPTMR used. 
+ * @return    void
+ */
+void Lptmr_Icu_Ip_EnableEdgeCount(uint8 instance);
+
+/**
+ * @brief     LPTMR IP layer function which disable edge count measure mode for a given instance and channel.
+ * 
+ * @param[in] instance  - Hardware instance of LPTMR used. 
+ * @return    Lptmr_Icu_Ip_StatusType
+ */ 
+Lptmr_Icu_Ip_StatusType Lptmr_Icu_Ip_DisableEdgeCount(uint8 instance);
+
+/**
+ * @brief     LPTMR IP layer function which gets the number of edges for a given instance and channel.
+ * 
+ * @param[in] instance  - Hardware instance of LPTMR used. 
+ * @return    uint16
+ */
+uint16 Lptmr_Icu_Ip_GetEdgeNumbers(uint8 instance);
+
+#endif  /* LPTMR_ICU_EDGE_COUNT_API */
+
+#if (STD_ON == LPTMR_ICU_GET_INPUT_STATE_API)
+/**
+ * @brief Return input state of the channel.
+ * 
+ * @param[in] instance  - Hardware instance of LPTMR used. ype.
+ */
+boolean Lptmr_Icu_Ip_GetInputState(uint8 instance);
+
+#endif  /* LPTMR_ICU_GET_INPUT_STATE_API */
+
+void Lptmr_Icu_Ip_EnableInterrupt(uint8 instance);
+
+void Lptmr_Icu_Ip_DisableInterrupt(uint8 instance);
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* LPTMR_ICU_IP_H */

+ 150 - 0
RTD/include/Lptmr_Icu_Ip_Irq.h

@@ -0,0 +1,150 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPTMR_ICU_IP_IRQ_H
+#define LPTMR_ICU_IP_IRQ_H
+
+/**
+ *   @file       Interrupt functions description.
+ *   @details    This file contains the signature of interrups functions that can be used on the 
+ *               LPTMR module.
+ *   @addtogroup lptmr_icu_ip LPTMR IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "OsIf.h"
+#include "Lptmr_Icu_Ip_Cfg.h"
+#include "Lptmr_Icu_Ip_Types.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPTMR_ICU_IP_IRQ_VENDOR_ID                   43
+#define LPTMR_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION    4
+#define LPTMR_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION    4
+#define LPTMR_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION 0
+#define LPTMR_ICU_IP_IRQ_SW_MAJOR_VERSION            1
+#define LPTMR_ICU_IP_IRQ_SW_MINOR_VERSION            0
+#define LPTMR_ICU_IP_IRQ_SW_PATCH_VERSION            0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and OsIf.h file are of the same Autosar version */
+    #if ((LPTMR_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION != OSIF_AR_RELEASE_MAJOR_VERSION) || \
+         (LPTMR_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION != OSIF_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Lptmr_Icu_Ip_Irq.h and OsIf.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (LPTMR_ICU_IP_IRQ_VENDOR_ID != LPTMR_ICU_IP_CFG_VENDOR_ID)
+    #error "Lptmr_Icu_Ip_Irq.h and Lptmr_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((LPTMR_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION    != LPTMR_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION    != LPTMR_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION != LPTMR_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lptmr_Icu_Ip_Irq.h and Lptmr_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((LPTMR_ICU_IP_IRQ_SW_MAJOR_VERSION != LPTMR_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_SW_MINOR_VERSION != LPTMR_ICU_IP_CFG_SW_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_SW_PATCH_VERSION != LPTMR_ICU_IP_CFG_SW_PATCH_VERSION))
+#error "Software Version Numbers of Lptmr_Icu_Ip_Irq.h and Lptmr_Icu_Ip_Cfg.h are different"
+#endif
+
+/* Check if header file and Lptmr_Icu_Ip_Types.h header file are of the same vendor */
+#if (LPTMR_ICU_IP_IRQ_VENDOR_ID !=  LPTMR_ICU_IP_TYPES_VENDOR_ID)
+    #error "Lptmr_Icu_Ip_Irq.h and Lptmr_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if header file and Lptmr_Icu_Ip_Types.h header file are of the same AutoSar version */
+#if ((LPTMR_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION    != LPTMR_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION    != LPTMR_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION != LPTMR_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lptmr_Icu_Ip_Irq.h and LPtmr_Icu_Ip_Types.h are different"
+#endif
+/* Check if header file and Lptmr_Icu_Ip_Types.h header file file are of the same Software version */
+#if ((LPTMR_ICU_IP_IRQ_SW_MAJOR_VERSION != LPTMR_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_SW_MINOR_VERSION != LPTMR_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_SW_PATCH_VERSION != LPTMR_ICU_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Lptmr_Icu_Ip_Irq.h and Lptmr_Icu_Ip_Types.h are different"
+#endif
+
+/*==================================================================================================
+*                                        LOCAL CONSTANTS
+==================================================================================================*/
+#define ICU_START_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+/* Table of base addresses for LPTMR instances. */
+extern Lptmr_Icu_Ip_BaseType * const s_lptmrBase[LPTMR_ICU_IP_NUM_OF_MODULES];
+
+#define ICU_STOP_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+extern Lptmr_Icu_Ip_ChStateType Lptmr_Icu_aChConfig[LPTMR_ICU_IP_NUM_OF_MODULES];
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+/**
+ * @brief LPTRM_0 Channel 0 independent ISR declarations
+*/
+#if (defined LPTMR_ICU_0_CH_0_ISR_USED)
+ISR(LPTMR_0_CH_0_ISR);
+#endif
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* LPTMR_ICU_IP_IRQ_H */

+ 230 - 0
RTD/include/Lptmr_Icu_Ip_Types.h

@@ -0,0 +1,230 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPTMR_ICU_IP_TYPES_H
+#define LPTMR_ICU_IP_TYPES_H
+
+/**
+ *   @file       Lptmr_Icu_Ip_Types.h
+ *   @version    1.0.0
+ *
+ *   @brief      AUTOSAR Icu - LPTMR driver header file.
+ *   @details    LPTMR driver defines which need to be exported to external application
+ *
+ *   @addtogroup lptmr_icu_ip LPTMR IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lptmr_Icu_Ip_Defines.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPTMR_ICU_IP_TYPES_VENDOR_ID                     43
+#define LPTMR_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION      4
+#define LPTMR_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION      4
+#define LPTMR_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION   0
+#define LPTMR_ICU_IP_TYPES_SW_MAJOR_VERSION              1
+#define LPTMR_ICU_IP_TYPES_SW_MINOR_VERSION              0
+#define LPTMR_ICU_IP_TYPES_SW_PATCH_VERSION              0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (LPTMR_ICU_IP_TYPES_VENDOR_ID != LPTMR_ICU_IP_DEFINES_VENDOR_ID)
+    #error "Lptmr_Icu_Ip_Types.h and Lptmr_Icu_Ip_Defines.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((LPTMR_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION != LPTMR_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION != LPTMR_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION != LPTMR_ICU_IP_DEFINES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lptmr_Icu_Ip_Types.h and Lptmr_Icu_Ip_Defines.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((LPTMR_ICU_IP_TYPES_SW_MAJOR_VERSION != LPTMR_ICU_IP_DEFINES_SW_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_TYPES_SW_MINOR_VERSION != LPTMR_ICU_IP_DEFINES_SW_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_TYPES_SW_PATCH_VERSION != LPTMR_ICU_IP_DEFINES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Lptmr_Icu_Ip_Types.h and Lptmr_Icu_Ip_Defines.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+/* Mode Type */
+#define    LPTMR_ICU_IP_TM_MODE                 ((uint8)(0x01))      /**< @brief Pulse Time Counter mode */
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+/** 
+ * @brief Prescaler Selection
+ */
+typedef enum {
+    LPTMR_ICU_GLITCH_FILTER_2                   = 0x00U, /*!< Timer mode: prescaler 2, Glitch filter mode: invalid */
+    LPTMR_ICU_GLITCH_FILTER_4                   = 0x01U, /*!< Timer mode: prescaler 4, Glitch filter mode: 2 clocks */
+    LPTMR_ICU_GLITCH_FILTER_8                   = 0x02U, /*!< Timer mode: prescaler 8, Glitch filter mode: 4 clocks */
+    LPTMR_ICU_GLITCH_FILTER_16                  = 0x03U, /*!< Timer mode: prescaler 16, Glitch filter mode: 8 clocks */
+    LPTMR_ICU_GLITCH_FILTER_32                  = 0x04U, /*!< Timer mode: prescaler 32, Glitch filter mode: 16 clocks */
+    LPTMR_ICU_GLITCH_FILTER_64                  = 0x05U, /*!< Timer mode: prescaler 64, Glitch filter mode: 32 clocks */
+    LPTMR_ICU_GLITCH_FILTER_128                 = 0x06U, /*!< Timer mode: prescaler 128, Glitch filter mode: 64 clocks */
+    LPTMR_ICU_GLITCH_FILTER_256                 = 0x07U, /*!< Timer mode: prescaler 256, Glitch filter mode: 128 clocks */
+    LPTMR_ICU_GLITCH_FILTER_512                 = 0x08U, /*!< Timer mode: prescaler 512, Glitch filter mode: 256 clocks */
+    LPTMR_ICU_GLITCH_FILTER_1024                = 0x09U, /*!< Timer mode: prescaler 1024, Glitch filter mode: 512 clocks */
+    LPTMR_ICU_GLITCH_FILTER_2048                = 0x0AU, /*!< Timer mode: prescaler 2048, Glitch filter mode: 1024 clocks */
+    LPTMR_ICU_GLITCH_FILTER_4096                = 0x0BU, /*!< Timer mode: prescaler 4096, Glitch filter mode: 2048 clocks */
+    LPTMR_ICU_GLITCH_FILTER_8192                = 0x0CU, /*!< Timer mode: prescaler 8192, Glitch filter mode: 4096 clocks */
+    LPTMR_ICU_GLITCH_FILTER_16384               = 0x0DU, /*!< Timer mode: prescaler 16384, Glitch filter mode: 8192 clocks */
+    LPTMR_ICU_GLITCH_FILTER_32768               = 0x0EU, /*!< Timer mode: prescaler 32768, Glitch filter mode: 16384 clocks */
+    LPTMR_ICU_GLITCH_FILTER_65536               = 0x0FU  /*!< Timer mode: prescaler 65536, Glitch filter mode: 32768 clocks */
+} Lptmr_Icu_PrescalerType;
+
+/**
+* @brief            Lptmr_Icu_ChannelMeasurementModeType
+* @details          Type that indicates the channel mode type(capture mode, edge counter).
+*
+* */
+typedef enum
+{
+    LPTMR_ICU_MODE_NO_MEASUREMENT        = 0x00U, /*< @brief No measurement mode. */
+    LPTMR_ICU_MODE_SIGNAL_EDGE_DETECT    = 0x01U, /*< @brief Mode for detecting edges.  */
+    LPTMR_ICU_MODE_EDGE_COUNTER          = 0x08U  /*< @brief Mode for counting edges on */
+} Lptmr_Icu_MeasurementModeType;
+
+
+/**
+* @brief    Definition of input pin type.
+*/
+typedef enum
+{
+    /** @brief TRGMUX output */
+    TRGMUX_OUTPUT = 0x0U,
+    /** @brief LPTMR_ALT1 pin */
+    ALT1          = 0x1U,
+    /** @brief LPTMR_ALT2 pin */
+    ALT2          = 0x2U,
+    /** @brief LPTMR_ALT3 pin */
+    ALT3          = 0x3U
+} Lptmr_Icu_Ip_PinSelectType;
+
+/** @brief LPTMR clock source selection. */
+typedef enum
+{
+    LPTMR_ICU_SIRCDIV2_CLK = 0x0U,    /*!< @brief Select SIRCDIV2_CLK. */
+    LPTMR_ICU_LPO1K_CLK    = 0x1U,    /*!< @brief Select LPO1K_CLK. */    
+    LPTMR_ICU_RTC_CLK      = 0x2U,    /*!< @brief Select RTC_CLK. */
+    LPTMR_ICU_PCC_LPTMR0   = 0x3U     /*!< @brief Select PCC_LPTMR0. */
+} Lptmr_Icu_Ip_ClockSourceType;
+
+/**
+* @brief     Activation condition for the measurement - selecting edge type.
+*/
+typedef enum
+{
+    /** @brief Rising edge trigger. */
+    LPTMR_ICU_RISING_EDGE       = 0x0U,
+    /** @brief Rising edge trigger. */
+    LPTMR_ICU_FALLING_EDGE      = 0x1U,
+} Lptmr_Icu_Ip_EdgeType;
+
+/** @brief Generic error codes. */
+typedef enum
+{
+    /** @brief Generic operation success status. */
+    LPTMR_IP_STATUS_SUCCESS                         = 0x00U,
+    /** @brief Generic operation failure status. */
+    LPTMR_IP_STATUS_ERROR                           = 0x01U
+} Lptmr_Icu_Ip_StatusType;
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+/** @brief The notification functions shall have no parameters and no return value.*/
+typedef void (*Lptmr_Icu_Ip_NotifyType)(void);
+
+/** @brief Callback type for each channel. */
+typedef void (*Lptmr_Icu_Ip_CallbackType)(uint16 logicChannel, boolean overflow);
+
+/**
+* @brief    
+*/
+typedef struct
+{
+    boolean                                 chInit;                     /**< chInit state                                      */
+    Lptmr_Icu_MeasurementModeType           measMode;                   /**< measurement mode                                  */
+    Lptmr_Icu_Ip_NotifyType                 lptmrChannelNotification;   /*!< notification function for LPTMR IPL.              */
+    Lptmr_Icu_Ip_CallbackType               callback;                   /*!< interrupt callback function.                      */
+    uint16                                  callbackParam;              /*!< Logic channel for which callback is executed.     */
+}Lptmr_Icu_Ip_ChStateType;
+
+/**
+* @brief      Lptmr Channel specific configuration structure type
+*/
+typedef struct
+{
+    uint8                                   HwChannel;                  /*!< Physical hardware channel ID                                            */
+    const Lptmr_Icu_Ip_EdgeType       DefaultStartEdge;           /*!< Lptmr Default Start Edge                                                */
+    const Lptmr_Icu_MeasurementModeType     MeasurementModeType;        /*!< Lptmr MeasurementMode                                                   */
+    Lptmr_Icu_Ip_NotifyType                 lptmrChannelNotification;   /*!< The notification functions shall have no parameters and no return value.*/
+    Lptmr_Icu_Ip_CallbackType               callback;                   /*!< interrupt callback function.                                            */
+    uint16                                  callbackParam;              /*!< The parameters of callback functions for channels events                */
+} Lptmr_Icu_Ip_ChannelConfigType;
+
+/**
+* @brief      Lptmr IP specific configuration structure type
+*/
+typedef struct
+{
+    uint8                                   nNumChannels;               /*!< Number of Lptmr channels in the Icu configuration  */
+    const Lptmr_Icu_Ip_PinSelectType        PinSelect;                  /*!< Lptmr channel parameters                           */
+    const Lptmr_Icu_Ip_ClockSourceType      ClockSource;                /*!< Lptmr clock source                                 */
+    const Lptmr_Icu_PrescalerType           Prescaler;                  /*!< The Lptmr Prescaler values                         */
+    boolean                                 PrescalerEnable;            /*!< The Lptmr Prescaler Bypass                         */
+    const Lptmr_Icu_Ip_ChannelConfigType    (*pChannelsConfig)[];       /*!< Pointer to the configured channels for Lptmr       */
+} Lptmr_Icu_Ip_ConfigType;
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* LPTMR_ICU_IP_TYPES_H */

+ 191 - 0
RTD/include/Port_Ci_Icu_Ip.h

@@ -0,0 +1,191 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef PORT_CI_ICU_IP_H
+#define PORT_CI_ICU_IP_H
+
+/**
+ *     @file
+ *
+ *     @addtogroup port_ci_icu_ip PORT_CI IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Port_Ci_Icu_Ip_Types.h"
+#include "Port_Ci_Icu_Ip_Cfg.h"
+
+#if (PORT_CI_ICU_IP_ENABLE_USER_MODE_SUPPORT == STD_ON)
+#include "Reg_eSys.h"
+#endif
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define PORT_CI_ICU_IP_VENDOR_ID                    43
+#define PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION     4
+#define PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION     4
+#define PORT_CI_ICU_IP_AR_RELEASE_REVISION_VERSION  0
+#define PORT_CI_ICU_IP_SW_MAJOR_VERSION             1
+#define PORT_CI_ICU_IP_SW_MINOR_VERSION             0
+#define PORT_CI_ICU_IP_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (PORT_CI_ICU_IP_VENDOR_ID != PORT_CI_ICU_IP_TYPES_VENDOR_ID)
+    #error "Port_Ci_Icu_Ip.h and Port_Ci_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION    != PORT_CI_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION    != PORT_CI_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_AR_RELEASE_REVISION_VERSION != PORT_CI_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Port_Ci_Icu_Ip.h and Port_Ci_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((PORT_CI_ICU_IP_SW_MAJOR_VERSION != PORT_CI_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_SW_MINOR_VERSION != PORT_CI_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_SW_PATCH_VERSION != PORT_CI_ICU_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Port_Ci_Icu_Ip.h and Port_Ci_Icu_Ip_Types.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (PORT_CI_ICU_IP_VENDOR_ID != PORT_CI_ICU_IP_CFG_VENDOR_ID)
+    #error "Port_Ci_Icu_Ip.h and Port_Ci_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION    != PORT_CI_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION    != PORT_CI_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_AR_RELEASE_REVISION_VERSION != PORT_CI_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Port_Ci_Icu_Ip.h and Port_Ci_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((PORT_CI_ICU_IP_SW_MAJOR_VERSION != PORT_CI_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_SW_MINOR_VERSION != PORT_CI_ICU_IP_CFG_SW_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_SW_PATCH_VERSION != PORT_CI_ICU_IP_CFG_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Port_Ci_Icu_Ip.h and Port_Ci_Icu_Ip_Cfg.h are different"
+#endif
+
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if (PORT_CI_ICU_IP_ENABLE_USER_MODE_SUPPORT == STD_ON)
+        /* Check if header file and Reg_eSys.h file are of the same Autosar version */
+        #if ((PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION != REG_ESYS_AR_RELEASE_MAJOR_VERSION) || \
+             (PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION != REG_ESYS_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Port_Ci_Icu_Ip.h and Reg_eSys.h are different"
+        #endif
+    #endif
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+#if (defined PORT_CI_ICU_CONFIG_EXT)
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/* Macro used to import PORT_CI PB generated configurations. */
+PORT_CI_ICU_CONFIG_EXT
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+#endif
+
+/* @brief DMA/Interrupt Request rising/falling/either edge masks */
+#define ICU_PORT_CI_PCR_IREE_U32                            (0x90000u)
+#define ICU_PORT_CI_PCR_IFEE_U32                            (0xA0000u)
+#define ICU_PORT_CI_PCR_IEEE_U32                            (0xB0000u)
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+#define ICU_START_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+extern PORT_Type * const s_Port_Ci_Base[];
+#define ICU_STOP_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+#if ((PORT_CI_ICU_IP_SET_MODE_API == STD_ON) ||(PORT_CI_ICU_IP_EDGE_DETECT_API == STD_ON))
+void Port_Ci_Icu_Ip_EnableInterrupt(uint8 instance, uint8 hwChannel);
+#endif
+
+void Port_Ci_Icu_Ip_DisableInterrupt(uint8 instance, uint8 hwChannel);
+
+Port_Ci_Icu_Ip_StatusType Port_Ci_Icu_Ip_Init (uint8 instance,  const Port_Ci_Icu_Ip_ConfigType * userConfig);
+
+#if (STD_ON == PORT_CI_ICU_IP_DEINIT_API)
+Port_Ci_Icu_Ip_StatusType Port_Ci_Icu_Ip_DeInit(uint8 instance);
+#endif
+
+#if (PORT_CI_ICU_IP_SET_MODE_API == STD_ON)
+void Port_Ci_Icu_Ip_SetSleepMode(uint8 instance, uint8 hwChannel);
+void Port_Ci_Icu_Ip_SetNormalMode(uint8 instance, uint8 hwChannel);
+#endif  /* PORT_CI_ICU_IP_SET_MODE_API  */
+
+void Port_Ci_Icu_Ip_SetActivationCondition(uint8 instance, uint8 hwChannel, Port_Ci_Icu_Ip_EdgeType activation);
+
+#if (PORT_CI_ICU_IP_EDGE_DETECT_API == STD_ON)
+void Port_Ci_Icu_Ip_EnableEdgeDetection(uint8 instance, uint8 hwChannel);
+void Port_Ci_Icu_Ip_DisableDetection(uint8 instance, uint8 hwChannel);
+#endif /* PORT_CI_ICU_IP_EDGE_DETECT_API */
+
+#if (PORT_CI_ICU_IP_GET_INPUT_STATE_API == STD_ON)
+boolean Port_Ci_Icu_Ip_GetInputState(uint8 instance, uint8 hwChannel);
+#endif  /* PORT_CI_ICU_IP_GET_INPUT_STATE_API */
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* PORT_CI_ICU_IP_H */

+ 269 - 0
RTD/include/Port_Ci_Icu_Ip_Irq.h

@@ -0,0 +1,269 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef PORT_CI_ICU_IP_IRQ_H
+#define PORT_CI_ICU_IP_IRQ_H
+
+/**
+ *     @file
+ *
+ *     @addtogroup port_ci_icu_ip PORT_CI IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "OsIf.h"
+#include "Port_Ci_Icu_Ip_Cfg.h"
+#include "Port_Ci_Icu_Ip_Types.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define PORT_CI_ICU_IP_IRQ_VENDOR_ID                    43
+#define PORT_CI_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION     4
+#define PORT_CI_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION     4
+#define PORT_CI_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION  0
+#define PORT_CI_ICU_IP_IRQ_SW_MAJOR_VERSION             1
+#define PORT_CI_ICU_IP_IRQ_SW_MINOR_VERSION             0
+#define PORT_CI_ICU_IP_IRQ_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if this header file and OsIf.h file are of the same Autosar version */
+    #if ((PORT_CI_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION != OSIF_AR_RELEASE_MAJOR_VERSION) || \
+         (PORT_CI_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION != OSIF_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Irq.h and OsIf.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (PORT_CI_ICU_IP_IRQ_VENDOR_ID != PORT_CI_ICU_IP_TYPES_VENDOR_ID)
+    #error "Port_Ci_Icu_Ip_Irq.h and Port_Ci_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((PORT_CI_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION  != PORT_CI_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION  != PORT_CI_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION   != PORT_CI_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Irq.h and Port_Ci_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((PORT_CI_ICU_IP_IRQ_SW_MAJOR_VERSION  != PORT_CI_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_IRQ_SW_MINOR_VERSION  != PORT_CI_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_IRQ_SW_PATCH_VERSION  != PORT_CI_ICU_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Port_Ci_Icu_Ip_Irq.h and Port_Ci_Icu_Ip_Types.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (PORT_CI_ICU_IP_IRQ_VENDOR_ID != PORT_CI_ICU_IP_CFG_VENDOR_ID)
+    #error "Port_Ci_Icu_Ip_Irq.h and Port_Ci_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((PORT_CI_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION  != PORT_CI_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION  != PORT_CI_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION   != PORT_CI_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Irq.h and Port_Ci_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((PORT_CI_ICU_IP_IRQ_SW_MAJOR_VERSION  != PORT_CI_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_IRQ_SW_MINOR_VERSION  != PORT_CI_ICU_IP_CFG_SW_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_IRQ_SW_PATCH_VERSION  != PORT_CI_ICU_IP_CFG_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Port_Ci_Icu_Ip_Irq.h and Port_Ci_Icu_Ip_Cfg.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+extern Port_Ci_Icu_Ip_State Port_Ci_Icu_Ip_u32ChState[PORT_INSTANCE_COUNT][PORT_PCR_COUNT];
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+#if (defined PORT_CI_ICU_IP_SINGLE_INTERRUPT)
+/**
+* @brief     Interrupt handler for Port
+* @details   Process the interrupt of Port of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port is configured
+*/
+ISR(PORT_CI_ICU_IP_EXT_IRQ_SINGLE_INTERRUPT);
+#else
+#if (defined PORT_CI_ICU_IP_PORT_0_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port A
+* @details   Process the interrupt of Port A of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port A is configured
+*/
+ISR(PORT_CI_ICU_IP_A_EXT_IRQ_ISR);
+#endif  /* IRQ PORTA */
+
+#if (defined PORT_CI_ICU_IP_PORT_1_ISR_USED)
+/**
+* @brief     Interrupt handler for Port B
+* @details   Process the interrupt of Port B of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port B is configured
+*/
+ISR(PORT_CI_ICU_IP_B_EXT_IRQ_ISR);
+#endif  /* IRQ PORTB */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_2_ISR_USED)
+/**
+* @brief     Interrupt handler for Port C
+* @details   Process the interrupt of Port C of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port C is configured
+*/
+ISR(PORT_CI_ICU_IP_C_EXT_IRQ_ISR);
+#endif    /* IRQ PORTC */
+
+#if (defined PORT_CI_ICU_IP_PORT_3_ISR_USED)
+/**
+* @brief     Interrupt handler for Port D
+* @details   Process the interrupt of Port D of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port D is configured
+*/
+ISR(PORT_CI_ICU_IP_D_EXT_IRQ_ISR);
+#endif    /* IRQ PORTD */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_4_ISR_USED)
+/**
+* @brief     Interrupt handler for Port E
+* @details   Process the interrupt of Port E of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port E is configured
+*/
+ISR(PORT_CI_ICU_IP_E_EXT_IRQ_ISR);
+#endif    /* IRQ PORTE */
+
+#if (defined PORT_CI_ICU_IP_PORT_5_ISR_USED)
+/**
+* @brief     Interrupt handler for Port F
+* @details   Process the interrupt of Port F of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port F is configured
+*/
+ISR(PORT_CI_ICU_IP_F_EXT_IRQ_ISR);
+#endif  /* IRQ PORTF */
+
+#if (defined PORT_CI_ICU_IP_PORT_6_ISR_USED)
+/**
+* @brief     Interrupt handler for Port G
+* @details   Process the interrupt of Port G of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port G is configured
+*/
+ISR(ICU_PORT_CI_G_EXT_IRQ_ISR);
+#endif  /* IRQ PORTG */
+
+#if (defined PORT_CI_ICU_IP_PORT_7_ISR_USED)
+/**
+* @brief     Interrupt handler for Port H
+* @details   Process the interrupt of Port H of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port H is configured
+*/
+ISR(ICU_PORT_CI_H_EXT_IRQ_ISR);
+#endif  /* IRQ PORTH */
+
+#if (defined PORT_CI_ICU_IP_PORT_9_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port J
+* @details   Process the interrupt of Port J of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port J is configured
+*/
+ISR(ICU_PORT_CI_J_EXT_IRQ_ISR);
+#endif  /* IRQ PORTJ */
+
+#if (defined PORT_CI_ICU_IP_PORT_10_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port K
+* @details   Process the interrupt of Port K of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port K is configured
+*/
+ISR(PORT_CI_ICU_IP_K_EXT_IRQ_ISR);
+#endif  /* IRQ PORTK */
+
+#if (defined PORT_CI_ICU_IP_PORT_11_ISR_USED)
+/**
+* @brief     Interrupt handler for Port L
+* @details   Process the interrupt of Port L of Port_Ci IP
+* 
+* @note   This will be defined only if any channel on Port L is configured
+*/
+ISR(ICU_PORT_CI_L_EXT_IRQ_ISR);
+#endif  /* IRQ PORTL */
+#endif /* PORT_CI_ICU_IP_SINGLE_INTERRUPT */
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+
+#endif  /* PORT_CI_ICU_IP_IRQ_H */

+ 178 - 0
RTD/include/Port_Ci_Icu_Ip_Types.h

@@ -0,0 +1,178 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef PORT_CI_ICU_IP_TYPES
+#define PORT_CI_ICU_IP_TYPES
+
+/**
+ *     @file
+ * 
+ *     @addtogroup port_ci_icu_ip PORT_CI IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*==================================================================================================
+*                                        INCLUDE FILES
+==================================================================================================*/
+#include "StandardTypes.h"
+#include "Port_Ci_Icu_Ip_Defines.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define PORT_CI_ICU_IP_TYPES_VENDOR_ID                   43
+#define PORT_CI_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION    4
+#define PORT_CI_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION    4
+#define PORT_CI_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION 0
+#define PORT_CI_ICU_IP_TYPES_SW_MAJOR_VERSION            1
+#define PORT_CI_ICU_IP_TYPES_SW_MINOR_VERSION            0
+#define PORT_CI_ICU_IP_TYPES_SW_PATCH_VERSION            0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and StandardTypes.h file are of the same Autosar version */
+    #if ((PORT_CI_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (PORT_CI_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Types.h and StandardTypes.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (PORT_CI_ICU_IP_TYPES_VENDOR_ID != PORT_CI_ICU_IP_DEFINES_VENDOR_ID)
+    #error "Port_Ci_Icu_Ip_Types.h and Port_Ci_Icu_Ip_Defines.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((PORT_CI_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION    != PORT_CI_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION    != PORT_CI_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION != PORT_CI_ICU_IP_DEFINES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Types.h and Port_Ci_Icu_Ip_Defines.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((PORT_CI_ICU_IP_TYPES_SW_MAJOR_VERSION != PORT_CI_ICU_IP_DEFINES_SW_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_TYPES_SW_MINOR_VERSION != PORT_CI_ICU_IP_DEFINES_SW_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_TYPES_SW_PATCH_VERSION != PORT_CI_ICU_IP_DEFINES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Port_Ci_Icu_Ip_Types.h and Port_Ci_Icu_Ip_Defines.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+#define ICU_PORT_CI_CH_NEITHER_EDGE_U8       ((uint8)(0U))
+#define ICU_PORT_CI_CH_RISING_EDGE_U8        ((uint8)(1U))
+#define ICU_PORT_CI_CH_FALLING_EDGE_U8       ((uint8)(2U))
+#define ICU_PORT_CI_CH_EITHER_EDGE_U8        ((uint8)(3U))
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+/**
+* @brief         Port_Ci_Icu_Ip_EdgeType
+* @details       This indicates the activation type Port_Ci channel (Rising, Falling or Both)
+*
+* */
+typedef enum
+{
+    PORT_CI_ICU_NO_PIN_CONTROL = 0x00, /** @brief No trigger. */
+
+    PORT_CI_ICU_FALLING_EDGE = 0x1U,  /**< @brief  An appropriate action shall be executed when a
+                                 * falling edge occurs on the Port_Ci input signal. */
+
+    PORT_CI_ICU_RISING_EDGE  = 0x2U,  /**< @brief  An appropriate action shall be executed when a
+                                 * rising edge occurs on the Port_Ci input signal. */
+
+    PORT_CI_ICU_BOTH_EDGES   = 0x3U  /**< @brief  An appropriate action shall be executed when a rising
+                                 * edge or falling edge occurs on the Port_Ci input signal. */
+} Port_Ci_Icu_Ip_EdgeType;
+
+/** @brief Generic error codes. */
+typedef enum
+{
+    /** @brief Generic operation success status. */
+    PORT_CI_IP_STATUS_SUCCESS                         = 0x00U,
+    /** @brief Generic operation failure status. */
+    PORT_CI_IP_STATUS_ERROR                           = 0x01U
+} Port_Ci_Icu_Ip_StatusType;
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+/** @brief The notification functions shall have no parameters and no return value.*/
+typedef void                             (*Port_Ci_Icu_Ip_NotifyType)(void);
+/** @brief Callback signature used in each channel with an active interrupt. */
+typedef void (*Port_Ci_Icu_Ip_CallbackType)(uint16 callbackParam1, boolean callbackParam2);
+
+typedef struct
+{
+    uint8                           pinId;                      /** @brief Assigned Port_Ci channel id*/
+    Port_Ci_Icu_Ip_EdgeType   nDefaultStartEdge;          /** @brief Port_Ci Default Start Edge */
+    Port_Ci_Icu_Ip_CallbackType     callback;                   /**< @brief Pointer to the callback function.            */
+    Port_Ci_Icu_Ip_NotifyType       PortCiChannelNotification;  /**< @brief The notification functions shall have no parameters and no return value.*/
+    uint8                           callbackParam;              /**< @brief The logic channel for which callback is set. */
+} Port_Ci_Icu_Ip_ChannelConfigType;
+
+/**
+* @brief      Port_Ci IP specific configuration structure type
+*/
+typedef struct
+{
+    uint8                               nNumChannels;           /** @brief Number of Port_Ci channels in the Icu configuration */
+    const Port_Ci_Icu_Ip_ChannelConfigType    (*pChannelsConfig)[];   /** @brief Pointer to the configured channels for Port_Ci */
+} Port_Ci_Icu_Ip_ConfigType;
+
+/**
+ * @brief    PORT CI IP state structure.
+ * @details  This structure is used by the IPL driver for internal logic.
+ *           The content is populated at initialization time.
+ */
+typedef struct
+{
+    boolean                         chInit;                         /** @brief Initialization state. */
+    Port_Ci_Icu_Ip_CallbackType     callback;                       /** @brief Pointer to the callback function. */
+    Port_Ci_Icu_Ip_NotifyType       PortCiChannelNotification;      /** @brief The notification functions for SIGNAL_EDGE_DETECT mode. */
+    uint16                          callbackParam;                  /** @brief The logic channel for which callback is set. */
+} Port_Ci_Icu_Ip_State;
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* PORT_CI_ICU_IP_TYPES */

+ 796 - 0
RTD/src/Cmp_Ip.c

@@ -0,0 +1,796 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file Cmp_Ip.c
+ *
+ *     @addtogroup cmp_icu_ip CMP IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "StandardTypes.h"
+#include "Cmp_Ip.h"
+
+#if (CMP_IP_DEV_ERROR_DETECT == STD_ON)
+#include "Devassert.h"
+#endif /* CMP_IP_DEV_ERROR_DETECT == STD_ON */
+
+#include "SchM_Icu.h"
+#include "Mcal.h"
+
+/*==================================================================================================
+*                                         LOCAL MACROS
+==================================================================================================*/
+#define CMP_IP_VENDOR_ID_C                     43
+#define CMP_IP_AR_RELEASE_MAJOR_VERSION_C      4
+#define CMP_IP_AR_RELEASE_MINOR_VERSION_C      4
+#define CMP_IP_AR_RELEASE_REVISION_VERSION_C   0
+#define CMP_IP_SW_MAJOR_VERSION_C              1
+#define CMP_IP_SW_MINOR_VERSION_C              0
+#define CMP_IP_SW_PATCH_VERSION_C              0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and StandardTypes.h file are of the same Autosar version */
+    #if ((CMP_IP_AR_RELEASE_MAJOR_VERSION_C != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (CMP_IP_AR_RELEASE_MINOR_VERSION_C != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Cmp_Ip.c and StandardTypes.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (CMP_IP_VENDOR_ID_C != CMP_IP_VENDOR_ID)
+    #error "Cmp_Ip.c and Cmp_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((CMP_IP_AR_RELEASE_MAJOR_VERSION_C  != CMP_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (CMP_IP_AR_RELEASE_MINOR_VERSION_C  != CMP_IP_AR_RELEASE_MINOR_VERSION) || \
+     (CMP_IP_AR_RELEASE_REVISION_VERSION_C   != CMP_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Cmp_Ip.c and Cmp_Ip.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((CMP_IP_SW_MAJOR_VERSION_C  != CMP_IP_SW_MAJOR_VERSION) || \
+     (CMP_IP_SW_MINOR_VERSION_C  != CMP_IP_SW_MINOR_VERSION) || \
+     (CMP_IP_SW_PATCH_VERSION_C  != CMP_IP_SW_PATCH_VERSION))
+#error "Software Version Numbers of Cmp_Ip.c and Cmp_Ip.h are different"
+#endif
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+static Cmp_Ip_StateType Cmp_Ip_axState[ICU_CMP_INSTANCE_COUNT];
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#define ICU_START_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#ifdef CMP_ICU_SUPPORT_LOWPOWER
+LPCMP_Type * const Cmp_Ip_apxBase[ICU_CMP_INSTANCE_COUNT] = IP_LPCMP_BASE_PTRS;
+#endif
+
+#ifdef CMP_ICU_NOT_SUPPORT_LOWPOWER
+CMP_Type * const Cmp_Ip_apxBase[ICU_CMP_INSTANCE_COUNT] = IP_CMP_BASE_PTRS;
+#endif
+
+#define ICU_STOP_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                        LOCAL FUNCTIONS
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef CMP_ICU_SUPPORT_LOWPOWER
+static inline void Cmp_Ip_InitCcr0(uint8 instance, const Cmp_Ip_ConfigType* userConfig)
+{
+    LPCMP_Type * base = Cmp_Ip_apxBase[instance];
+    uint32 ccr0 = 0u;
+    
+    switch(userConfig->Comparator.FunctionalMode)
+    {
+        case CMP_IP_FUNCTIONALMODE_DISABLED:
+            break;
+        case CMP_IP_FUNCTIONALMODE_CONTINUOUS:
+            ccr0 |= LPCMP_CCR0_CMP_EN(1U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_NONFILTERED_EXT_CLK:
+            ccr0 |= LPCMP_CCR0_CMP_EN(1U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_NONFILTERED_INT_CLK:
+            ccr0 |= LPCMP_CCR0_CMP_EN(1U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_FILTERED_INT_CLK:
+            ccr0 |= LPCMP_CCR0_CMP_EN(1U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_FILTERED_EXT_CLK:
+            ccr0 |= LPCMP_CCR0_CMP_EN(1U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_WINDOWED:
+            ccr0 |= LPCMP_CCR0_CMP_EN(1U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_WINDOWED_RESAMPLED:
+            ccr0 |= LPCMP_CCR0_CMP_EN(1U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_WINDOWED_FILTERED:
+            ccr0 |= LPCMP_CCR0_CMP_EN(1U);
+            break;
+        default:
+            /* Impossible case */
+            break;
+    }
+    ccr0 |= LPCMP_CCR0_CMP_STOP_EN(userConfig->Comparator.EnableInStop?(uint32)1U:(uint32)0U);
+    ccr0 |= LPCMP_CCR0_CMP_EN(1u);
+    base->CCR0 = ccr0;
+}
+
+static inline void Cmp_Ip_InitCcr1(uint8 instance, const Cmp_Ip_ConfigType* userConfig)
+{
+    LPCMP_Type * base = Cmp_Ip_apxBase[instance];
+    uint32 ccr1 = 0u;
+
+    switch(userConfig->Comparator.FunctionalMode)
+    {
+        case CMP_IP_FUNCTIONALMODE_DISABLED:
+            break;
+        case CMP_IP_FUNCTIONALMODE_CONTINUOUS:
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_NONFILTERED_EXT_CLK:
+            ccr1 |= LPCMP_CCR1_SAMPLE_EN(1U);
+            ccr1 |= LPCMP_CCR1_FILT_CNT(1U);
+            ccr1 |= LPCMP_CCR1_FILT_PER(userConfig->Comparator.FilterSamplePeriod);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_NONFILTERED_INT_CLK:
+            ccr1 |= LPCMP_CCR1_FILT_CNT(1U);
+            ccr1 |= LPCMP_CCR1_FILT_PER(userConfig->Comparator.FilterSamplePeriod);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_FILTERED_INT_CLK:
+            ccr1 |= LPCMP_CCR1_FILT_CNT(userConfig->Comparator.FilterSampleCount);
+            ccr1 |= LPCMP_CCR1_FILT_PER(userConfig->Comparator.FilterSamplePeriod);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_FILTERED_EXT_CLK:
+            ccr1 |= LPCMP_CCR1_SAMPLE_EN(1U);           
+            ccr1 |= LPCMP_CCR1_FILT_CNT(userConfig->Comparator.FilterSampleCount);
+            ccr1 |= LPCMP_CCR1_FILT_PER(userConfig->Comparator.FilterSamplePeriod);
+            break;
+        case CMP_IP_FUNCTIONALMODE_WINDOWED:
+            ccr1 |= LPCMP_CCR1_WINDOW_EN(1U);
+            ccr1 |= LPCMP_CCR1_FILT_CNT(0U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_WINDOWED_RESAMPLED:
+            ccr1 |= LPCMP_CCR1_WINDOW_EN(1U);
+            ccr1 |= LPCMP_CCR1_FILT_CNT(1U);
+            ccr1 |= LPCMP_CCR1_FILT_PER(userConfig->Comparator.FilterSamplePeriod);
+            break;
+        case CMP_IP_FUNCTIONALMODE_WINDOWED_FILTERED:
+            ccr1 |= LPCMP_CCR1_WINDOW_EN(1U);
+            ccr1 |= LPCMP_CCR1_FILT_CNT(userConfig->Comparator.FilterSampleCount);
+            ccr1 |= LPCMP_CCR1_FILT_PER(userConfig->Comparator.FilterSamplePeriod);
+            break;
+        default:
+            /* Impossible case */
+            break;
+    }
+
+    ccr1 |= LPCMP_CCR1_COUT_PEN((userConfig->Comparator.EnablePinOutput)?1U:0U);
+    ccr1 |= LPCMP_CCR1_WINDOW_INV((userConfig->Comparator.EnableInverter)?1U:0U);
+    ccr1 |= LPCMP_CCR1_COUT_INV((userConfig->Comparator.EnableComparatorInvert)?1U:0U);
+    ccr1 |= LPCMP_CCR1_DMA_EN((userConfig->Comparator.EnableDma)?1U:0U);
+    ccr1 |= LPCMP_CCR1_COUT_SEL(userConfig->Comparator.OutputSelect);
+    ccr1 |= LPCMP_CCR1_COUTA_OWEN((userConfig->Comparator.WindowCloseOutputOverwrite == CMP_IP_WINDOWCLOSEOUTPUTOVERWRITE_DISABLED)?0U:1U);
+    ccr1 |= LPCMP_CCR1_COUTA_OW((userConfig->Comparator.WindowCloseOutputOverwrite == CMP_IP_WINDOWCLOSEOUTPUTOVERWRITE_HIGH)?1U:0U);
+    switch (userConfig->Comparator.WindowCloseEvent)
+    {
+        case CMP_IP_WINDOWCLOSEEVENT_RISING:
+            ccr1 &= (~LPCMP_CCR1_EVT_SEL_MASK); 
+            ccr1 |= LPCMP_CCR1_WINDOW_CLS(1u); 
+            break;
+        case CMP_IP_WINDOWCLOSEEVENT_FALLING:
+            ccr1 &= (~LPCMP_CCR1_EVT_SEL_MASK);           
+            ccr1 |= LPCMP_CCR1_WINDOW_CLS(1u) | LPCMP_CCR1_EVT_SEL(1u); 
+            break;
+        case CMP_IP_WINDOWCLOSEEVENT_BOTH:
+            ccr1 |= LPCMP_CCR1_WINDOW_CLS(1u) | LPCMP_CCR1_EVT_SEL(2u); 
+            break;
+        case CMP_IP_WINDOWCLOSEEVENT_NONE:
+            ccr1 &= (~LPCMP_CCR1_WINDOW_CLS_MASK); 
+            break;
+        default:
+            /* Impossible case */
+            break;
+    }
+    base->CCR1 = ccr1;
+}
+
+static inline void Cmp_Ip_InitCcr2(uint8 instance, const Cmp_Ip_ConfigType* userConfig)
+{
+    LPCMP_Type * base = Cmp_Ip_apxBase[instance];
+    uint32 ccr2 = 0u;
+    
+    ccr2 |= LPCMP_CCR2_HYSTCTR(userConfig->Comparator.HysteresisLevel);
+    ccr2 |= LPCMP_CCR2_OFFSET(userConfig->Comparator.OffsetLevel);
+    ccr2 |= LPCMP_CCR2_CMP_HPMD((userConfig->Comparator.EnableHighPowerMode)?1U:0U);
+    ccr2 |= LPCMP_CCR2_INMSEL((userConfig->Comparator.NegativeInputMux == CMP_IP_INPUTMUX_DAC)?0U:1U);
+    ccr2 |= LPCMP_CCR2_MSEL((userConfig->Comparator.NegativeInputMux == CMP_IP_INPUTMUX_DAC)?0U:(uint32)(userConfig->Comparator.NegativeInputMux));
+    ccr2 |= LPCMP_CCR2_INPSEL((userConfig->Comparator.PositiveInputMux == CMP_IP_INPUTMUX_DAC)?0U:1U);
+    ccr2 |= LPCMP_CCR2_PSEL((userConfig->Comparator.PositiveInputMux == CMP_IP_INPUTMUX_DAC)?0U:(uint32)(userConfig->Comparator.PositiveInputMux));
+    base->CCR2 = ccr2;
+}
+
+static inline void Cmp_Ip_InitDcr(uint8 instance, const Cmp_Ip_ConfigType* userConfig)
+{
+    LPCMP_Type * base = Cmp_Ip_apxBase[instance];
+    uint32 dcr = 0u;
+    
+    dcr |= LPCMP_DCR_DAC_DATA(userConfig->Dac.VoltageLevel);
+    dcr |= LPCMP_DCR_VRSEL(userConfig->Dac.VoltageRefSource);
+    dcr |= LPCMP_DCR_DAC_EN((userConfig->Dac.PowerState == CMP_IP_DACPOWERSTATE_ENABLED)?1U:0U);
+    dcr |= LPCMP_CCR0_LINKEN((userConfig->Dac.PowerState == CMP_IP_DACPOWERSTATE_LINKED)?1U:0U);
+    base->DCR = dcr;
+}
+#endif
+
+#if (defined(ICU_CMP_0_ISR_USED) || \
+     defined(ICU_CMP_1_ISR_USED) || \
+     defined(ICU_CMP_2_ISR_USED))
+    
+static void Cmp_Ip_IrqHandler(uint8 instance);
+#endif
+
+#ifdef CMP_ICU_NOT_SUPPORT_LOWPOWER
+/**
+* @brief      Icu driver function that initializes CMP.
+* @details    This function enables CMP instance 0 for signal compare and trigger interrupt
+*/
+static inline void Cmp_Ip_InitCmpC0(uint8 instance, const Cmp_Ip_ConfigType* const userConfig)
+{
+    CMP_Type * base = Cmp_Ip_apxBase[instance];
+    uint32 Cmp_C0 = 0u;
+    
+    switch(userConfig->Comparator.FunctionalMode)
+    {
+        case CMP_IP_FUNCTIONALMODE_DISABLED:
+            Cmp_C0 |= CMP_C0_EN(0U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_CONTINUOUS:
+            Cmp_C0 |= CMP_C0_EN(1U);
+            Cmp_C0 |= CMP_C0_WE(0U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_NONFILTERED_EXT_CLK:
+            Cmp_C0 |= CMP_C0_EN(1U);
+            Cmp_C0 |= CMP_C0_WE(0U);
+            Cmp_C0 |= CMP_C0_SE(1U);
+            Cmp_C0 |= CMP_C0_FILTER_CNT(1U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_NONFILTERED_INT_CLK:
+            Cmp_C0 |= CMP_C0_EN(1U);
+            Cmp_C0 |= CMP_C0_WE(0U);
+            Cmp_C0 |= CMP_C0_SE(0U);
+            Cmp_C0 |= CMP_C0_FILTER_CNT(1U);
+            Cmp_C0 |= CMP_C0_FPR(userConfig->Comparator.FilterSamplePeriod);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_FILTERED_INT_CLK:
+            Cmp_C0 |= CMP_C0_EN(1U);
+            Cmp_C0 |= CMP_C0_WE(0U);
+            Cmp_C0 |= CMP_C0_SE(1U);
+            Cmp_C0 |= CMP_C0_FILTER_CNT(2U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_SAMPLED_FILTERED_EXT_CLK:
+            Cmp_C0 |= CMP_C0_EN(1U);
+            Cmp_C0 |= CMP_C0_WE(0U);
+            Cmp_C0 |= CMP_C0_SE(0U);
+            Cmp_C0 |= CMP_C0_FILTER_CNT(2U);
+            Cmp_C0 |= CMP_C0_FPR(userConfig->Comparator.FilterSamplePeriod);
+            break;
+        case CMP_IP_FUNCTIONALMODE_WINDOWED:
+            Cmp_C0 |= CMP_C0_EN(1U);
+            Cmp_C0 |= CMP_C0_WE(1U);
+            Cmp_C0 |= CMP_C0_SE(0U);
+            break;
+        case CMP_IP_FUNCTIONALMODE_WINDOWED_RESAMPLED:
+            Cmp_C0 |= CMP_C0_EN(1U);
+            Cmp_C0 |= CMP_C0_WE(1U);
+            Cmp_C0 |= CMP_C0_SE(0U);
+            Cmp_C0 |= CMP_C0_FPR(userConfig->Comparator.FilterSamplePeriod);
+            break;
+        case CMP_IP_FUNCTIONALMODE_WINDOWED_FILTERED:
+            Cmp_C0 |= CMP_C0_EN(1U);
+            Cmp_C0 |= CMP_C0_WE(1U);
+            Cmp_C0 |= CMP_C0_SE(0U);
+            Cmp_C0 |= CMP_C0_FILTER_CNT(2U);
+            Cmp_C0 |= CMP_C0_FPR(userConfig->Comparator.FilterSamplePeriod);
+            break;
+        default:
+            /* Impossible case */
+            break;
+    }
+    
+    Cmp_C0 |= CMP_C0_HYSTCTR(userConfig->Comparator.HysteresisLevel);
+    Cmp_C0 |= CMP_C0_OFFSET(userConfig->Comparator.OffsetLevel);
+    Cmp_C0 |= CMP_C0_OPE(userConfig->Comparator.EnablePinOutput?(uint32)1U:(uint32)0U);
+    Cmp_C0 |= CMP_C0_INVT(userConfig->Comparator.EnableInverter?(uint32)1U:(uint32)0U);
+    Cmp_C0 |= CMP_C0_PMODE(userConfig->Comparator.EnableHighPowerMode?(uint32)1U:(uint32)0U);
+    Cmp_C0 |= CMP_C0_DMAEN(userConfig->Comparator.EnableDma?(uint32)1U:(uint32)0U);
+    Cmp_C0 |= CMP_C0_COS(userConfig->Comparator.OutputSelect);
+    
+    base->C0 = Cmp_C0;
+}
+
+/**
+* @brief      Icu driver function that initializes CMP.
+* @details    This function enables CMP instance 1 for signal compare and trigger interrupt
+*/
+static inline void Cmp_Ip_InitCmpC1(uint8 instance, const Cmp_Ip_ConfigType* const userConfig)
+{
+    CMP_Type * base = Cmp_Ip_apxBase[instance];
+    uint32 Cmp_C1 = 0u;
+    
+    Cmp_C1 |= CMP_C1_INNSEL((userConfig->Comparator.NegativeInputMux == CMP_IP_INPUTMUX_DAC)?0U:1U);
+    Cmp_C1 |= CMP_C1_MSEL((userConfig->Comparator.NegativeInputMux == CMP_IP_INPUTMUX_DAC)?0U:(uint32)(userConfig->Comparator.NegativeInputMux));
+    Cmp_C1 |= CMP_C1_INPSEL((userConfig->Comparator.PositiveInputMux == CMP_IP_INPUTMUX_DAC)?0U:1U);
+    Cmp_C1 |= CMP_C1_PSEL((userConfig->Comparator.PositiveInputMux == CMP_IP_INPUTMUX_DAC)?0U:(uint32)(userConfig->Comparator.PositiveInputMux));
+    Cmp_C1 |= CMP_C1_DACEN((userConfig->Dac.PowerState == CMP_IP_DACPOWERSTATE_ENABLED)?1U:0U);
+    Cmp_C1 |= CMP_C1_VRSEL(userConfig->Dac.VoltageRefSource);
+    Cmp_C1 |= CMP_C1_VOSEL(userConfig->Dac.VoltageLevel);
+    
+    base->C1 = Cmp_C1;
+}
+
+/**
+* @brief      Icu driver function that initializes CMP.
+* @details    This function enables CMP instance 2 for signal compare and trigger interrupt
+*/
+static inline void Cmp_Ip_InitCmpC2(uint8 instance, const Cmp_Ip_ConfigType* const userConfig)
+{
+    CMP_Type * base = Cmp_Ip_apxBase[instance];
+    uint32 Cmp_C2 = 0u;
+    
+    Cmp_C2 |= CMP_C2_RRIE((userConfig->Trigger.EnableRoundRobinInterrupt)?1U:0U);
+    Cmp_C2 |= CMP_C2_RRE((userConfig->Trigger.EnableRoundRobin)?1U:0U);
+    Cmp_C2 |= CMP_C2_FXMP(userConfig->Trigger.FixedPort);
+    Cmp_C2 |= CMP_C2_FXMXCH(userConfig->Trigger.FixedChannel);
+    Cmp_C2 |= CMP_C2_NSAM(userConfig->Trigger.SampleDelay);
+    Cmp_C2 |= CMP_C2_INITMOD(userConfig->Trigger.InitDelayValue);
+    Cmp_C2 |= CMP_C2_ACOn(userConfig->Trigger.RoundRobinEnChannelMask);
+
+    base->C2 = Cmp_C2;
+}
+#endif
+
+/**
+* @brief      Icu driver function that initializes CMP.
+* @details    This function enables CMP instance for signal compare and trigger interrupt
+*
+* @param[in]  instance      - The instance index
+* @param[in]  userConfig    - Pointer to channel configuration structure 
+*
+* @implements Cmp_Ip_Init_Activity
+*/
+Cmp_Ip_StatusType Cmp_Ip_Init(uint8 instance, const Cmp_Ip_ConfigType* userConfig)
+{
+#if (CMP_IP_DEV_ERROR_DETECT == STD_ON)
+    DevAssert(instance < ICU_CMP_INSTANCE_COUNT);
+    DevAssert(Cmp_Ip_axState[instance].State == ICU_CMP_IP_UNINIT);
+#endif
+    Cmp_Ip_StatusType   retStatus = CMP_IP_STATUS_SUCCESS;
+
+    if(ICU_CMP_IP_UNINIT == Cmp_Ip_axState[instance].State)
+    {
+#ifdef CMP_ICU_SUPPORT_LOWPOWER
+        LPCMP_Type * base = Cmp_Ip_apxBase[instance];
+        
+        uint32 ier = 0u;
+        uint32 csr = 0u;
+        uint32 rrcr0 = 0u;
+        uint32 rrcr1 = 0u;
+        uint32 rrcsr = 0u;
+        uint32 rrsr = 0u;
+
+        Cmp_Ip_InitCcr0(instance, userConfig);
+        Cmp_Ip_InitCcr1(instance, userConfig);
+        Cmp_Ip_InitCcr2(instance, userConfig);
+        Cmp_Ip_InitDcr(instance, userConfig);
+        
+        ier |= LPCMP_IER_CFR_IE(((userConfig->Comparator.OutputInterruptTrigger == CMP_IP_INTTRIG_NONE)|| \
+                                 (userConfig->Comparator.OutputInterruptTrigger == CMP_IP_INTTRIG_FALLING_EDGE))?0U:1U);
+        ier |= LPCMP_IER_CFF_IE(((userConfig->Comparator.OutputInterruptTrigger == CMP_IP_INTTRIG_NONE)|| \
+                                 (userConfig->Comparator.OutputInterruptTrigger == CMP_IP_INTTRIG_RISING_EDGE))?0U:1U);
+        ier |= LPCMP_IER_RRF_IE((userConfig->Trigger.EnableRoundRobinInterrupt)?1U:0U);
+        Cmp_Ip_axState[instance].CmpInterruptEdge =  userConfig->Comparator.OutputInterruptTrigger;
+
+
+        rrcr1 |= (uint32)userConfig->Trigger.RoundRobinEnChannelMask << (uint32)LPCMP_RRCR1_RR_CH0EN_SHIFT;
+        rrcsr |= (uint32)userConfig->Trigger.PrepgmStateChannelMask << (uint32)LPCMP_RRCSR_RR_CH0OUT_SHIFT;
+        rrcr0 |= LPCMP_RRCR0_RR_INITMOD(userConfig->Trigger.InitDelayValue);
+        rrcr0 |= LPCMP_RRCR0_RR_NSAM(userConfig->Trigger.SampleDelay);
+        rrcr1 |= LPCMP_RRCR1_FIXCH(userConfig->Trigger.FixedChannel);
+        rrcr1 |= LPCMP_RRCR1_FIXP(userConfig->Trigger.FixedPort);
+        Cmp_Ip_axState[instance].EnRoundRobinInterrupt = userConfig->Trigger.EnableRoundRobinInterrupt;
+        rrcr0 |= LPCMP_RRCR0_RR_EN((userConfig->Trigger.EnableRoundRobin)?1U:0U);
+
+        
+        base->IER = ier;
+        base->CSR = csr;
+        base->RRCR0 = rrcr0;
+        base->RRCR1 = rrcr1;
+        base->RRCSR = rrcsr;
+        base->RRSR = rrsr;
+
+        Cmp_Ip_axState[instance].State = ICU_CMP_IP_INIT;
+        Cmp_Ip_axState[instance].TriggerNotification = userConfig->TriggerNotification;
+        Cmp_Ip_axState[instance].ComparatorNotification = userConfig->ComparatorNotification;
+        Cmp_Ip_axState[instance].CallbackParam1 = userConfig->CallbackParam1;
+#endif
+
+#ifdef CMP_ICU_NOT_SUPPORT_LOWPOWER
+
+        Cmp_Ip_InitCmpC0(instance, userConfig);
+        Cmp_Ip_InitCmpC1(instance, userConfig);
+        Cmp_Ip_InitCmpC2(instance, userConfig);
+        
+        Cmp_Ip_axState[instance].CmpInterruptEdge =  userConfig->Comparator.OutputInterruptTrigger;
+        Cmp_Ip_axState[instance].EnRoundRobinInterrupt = userConfig->Trigger.EnableRoundRobinInterrupt;
+        Cmp_Ip_axState[instance].State = ICU_CMP_IP_INIT;
+        Cmp_Ip_axState[instance].TriggerNotification = userConfig->TriggerNotification;
+        Cmp_Ip_axState[instance].ComparatorNotification = userConfig->ComparatorNotification;
+        Cmp_Ip_axState[instance].CallbackParam1 = userConfig->CallbackParam1;
+#endif
+    }
+    else
+    {
+        /* instance already initialized - use deinitialize first */
+        retStatus = CMP_IP_STATUS_ERROR;
+    }
+    return retStatus;
+}
+
+/**
+* @brief      Icu driver function that reset CMP.
+* @details    This function reset CMP instance on reset values
+*
+* @param[in]  instance      - The instance index
+*
+* @implements Cmp_Ip_Deinit_Activity
+*/
+Cmp_Ip_StatusType Cmp_Ip_Deinit(uint8 instance)
+{
+    /* disable interrupt, stop notifications */
+#if (CMP_IP_DEV_ERROR_DETECT == STD_ON)
+    DevAssert(instance < ICU_CMP_INSTANCE_COUNT);
+    DevAssert(Cmp_Ip_axState[instance].State == ICU_CMP_IP_INIT);
+#endif
+    Cmp_Ip_StatusType   retStatus = CMP_IP_STATUS_SUCCESS;
+
+    if(ICU_CMP_IP_INIT == Cmp_Ip_axState[instance].State)
+    {
+        Cmp_Ip_axState[instance].State = ICU_CMP_IP_UNINIT;
+    }
+    else
+    {
+        /* instance already de-initialize - use initialize first */
+        retStatus = CMP_IP_STATUS_ERROR;
+    }
+    return retStatus;
+}
+
+/**
+* @brief      Icu driver function that enable user notification.
+* @details    This function enables CMP instance for calling user notification on interrupt
+*
+* @param[in]  instance      - The instance index
+*
+* @implements Cmp_Ip_EnableNotification_Activity
+*/
+void Cmp_Ip_EnableNotification(uint8 instance)
+{
+#if (CMP_IP_DEV_ERROR_DETECT == STD_ON)
+    DevAssert(instance < ICU_CMP_INSTANCE_COUNT);
+    if((NULL_PTR == Cmp_Ip_axState[instance].TriggerNotification) && (NULL_PTR == Cmp_Ip_axState[instance].ComparatorNotification))
+    {
+        DevAssert(FALSE);
+    }
+#endif
+
+    Cmp_Ip_axState[instance].NotificationEnabled = TRUE;
+}
+
+/**
+* @brief      Icu driver function that disable user notification.
+* @details    This function disable CMP instance for calling user notification on interrupt
+*
+* @param[in]  instance      - The instance index
+*
+* @implements Cmp_Ip_DisableNotification_Activity
+*/
+void Cmp_Ip_DisableNotification(uint8 instance)
+{
+#if (CMP_IP_DEV_ERROR_DETECT == STD_ON)
+    DevAssert(instance < ICU_CMP_INSTANCE_COUNT);
+#endif
+
+    Cmp_Ip_axState[instance].NotificationEnabled = FALSE;
+}
+
+void Cmp_Ip_EnableInterrupt(uint8 instance)
+{
+#if (CMP_IP_DEV_ERROR_DETECT == STD_ON)
+    DevAssert(instance < ICU_CMP_INSTANCE_COUNT);
+#endif
+
+#ifdef CMP_ICU_SUPPORT_LOWPOWER
+LPCMP_Type * base = Cmp_Ip_apxBase[instance];
+
+    /* clear w1c bits */
+    base->CSR = LPCMP_CSR_CFR_MASK | LPCMP_CSR_CFF_MASK | LPCMP_CSR_RRF_MASK;
+    
+    switch (Cmp_Ip_axState[instance].CmpInterruptEdge)
+    {
+        case CMP_IP_INTTRIG_NONE:
+            base->IER  |= LPCMP_IER_CFR_IE(0u) | LPCMP_IER_CFF_IE(0u);
+            break;
+        case CMP_IP_INTTRIG_FALLING_EDGE:
+            base->IER  |= LPCMP_IER_CFR_IE(0u) | LPCMP_IER_CFF_IE(1u);
+            break;
+        case CMP_IP_INTTRIG_RISING_EDGE:
+            base->IER  |= LPCMP_IER_CFR_IE(1u) | LPCMP_IER_CFF_IE(0u);
+            break;
+        case CMP_IP_INTTRIG_BOTH_EDGES:
+            base->IER  |= LPCMP_IER_CFR_IE(1u) | LPCMP_IER_CFF_IE(1u);
+            break;
+        default:
+            /* Impossible case */
+            break;
+
+    }
+    
+    if (TRUE == Cmp_Ip_axState[instance].EnRoundRobinInterrupt)
+    {
+        /* clear w1c bits */
+        base->RRSR = (0xFFu << LPCMP_RRSR_RR_CH0F_SHIFT);
+        base->IER |= LPCMP_IER_RRF_IE(1u);
+    }
+#endif
+
+#ifdef CMP_ICU_NOT_SUPPORT_LOWPOWER
+    CMP_Type * base = Cmp_Ip_apxBase[instance];
+
+    /* clear w1c bits */
+    base->C0 |= CMP_C0_CFF_MASK | CMP_C0_CFR_MASK;
+    
+    switch (Cmp_Ip_axState[instance].CmpInterruptEdge)
+    {
+        case CMP_IP_INTTRIG_RISING_EDGE:
+            base->C0 |= CMP_C0_IER(1U) | CMP_C0_IEF(0U);
+            break;
+        case CMP_IP_INTTRIG_FALLING_EDGE:
+            base->C0 |= CMP_C0_IER(0U) | CMP_C0_IEF(1U);
+            break;
+        case CMP_IP_INTTRIG_BOTH_EDGES:
+            base->C0 |= CMP_C0_IER(1U) | CMP_C0_IEF(1U);
+            break;
+        case CMP_IP_INTTRIG_NONE:
+            base->C0 |= CMP_C0_IER(0U) | CMP_C0_IEF(0U);
+            break;
+        default:
+            /* Impossible case */
+            break;
+    }
+    
+    if (TRUE == Cmp_Ip_axState[instance].EnRoundRobinInterrupt)
+    {
+        /* clear w1c bits */
+        base->C2 |= CMP_C2_CH0F_MASK | CMP_C2_CH1F_MASK | CMP_C2_CH2F_MASK | CMP_C2_CH3F_MASK | CMP_C2_CH4F_MASK | CMP_C2_CH5F_MASK | CMP_C2_CH6F_MASK | CMP_C2_CH7F_MASK;
+        base->C2 |= CMP_C2_RRIE(1U);
+    }
+#endif
+
+}
+
+/**
+ * @brief Disable CMP interrupt.
+ */
+void Cmp_Ip_DisableInterrupt(uint8 instance)
+{
+#if (CMP_IP_DEV_ERROR_DETECT == STD_ON)
+    DevAssert(instance < ICU_CMP_INSTANCE_COUNT);
+#endif
+
+#ifdef CMP_ICU_SUPPORT_LOWPOWER
+    LPCMP_Type * base = Cmp_Ip_apxBase[instance];
+
+    base->IER &= (~(LPCMP_IER_CFR_IE(1u) | LPCMP_IER_CFF_IE(1u)));
+    base->IER &= (~LPCMP_IER_RRF_IE(1u));
+#endif
+
+#ifdef CMP_ICU_NOT_SUPPORT_LOWPOWER
+    CMP_Type * base = Cmp_Ip_apxBase[instance];
+
+    base->C0 &= (~(CMP_C0_IER(1U) | CMP_C0_IEF(1U)));
+    base->C2 &= (~CMP_C2_RRIE(1U));
+#endif
+}
+
+/**
+ * @brief Set the type of activation for interrupt.
+ */
+void Cmp_Ip_SetInterruptActivation(uint8 instance, Cmp_Ip_OutputInterruptTriggerType Edge)
+{
+#if (CMP_IP_DEV_ERROR_DETECT == STD_ON)
+    DevAssert(instance < ICU_CMP_INSTANCE_COUNT);
+#endif
+
+    Cmp_Ip_axState[instance].CmpInterruptEdge = Edge;
+  
+}
+
+#if (CMP_ICU_GET_INPUT_STATE_API == STD_ON)
+/**
+ * @brief Get instance status.
+ */
+boolean Cmp_Ip_GetStatus(uint8 instance)
+{
+#if (CMP_IP_DEV_ERROR_DETECT == STD_ON)
+    DevAssert(instance < ICU_CMP_INSTANCE_COUNT);
+#endif
+    boolean status;
+
+#ifdef CMP_ICU_SUPPORT_LOWPOWER
+    status = (Cmp_Ip_apxBase[instance]->CSR == 0x0U)?FALSE:TRUE;
+#endif
+
+#ifdef CMP_ICU_NOT_SUPPORT_LOWPOWER
+    uint32 flag_Cmp;
+    uint32 flag_RR;
+    
+    flag_Cmp = Cmp_Ip_apxBase[instance]->C0 & (CMP_C0_CFF_MASK | CMP_C0_CFR_MASK);
+    flag_RR  = CMP_C2_CH0F_MASK | CMP_C2_CH1F_MASK | CMP_C2_CH2F_MASK | CMP_C2_CH3F_MASK | CMP_C2_CH4F_MASK | CMP_C2_CH5F_MASK | CMP_C2_CH6F_MASK | CMP_C2_CH7F_MASK;
+    flag_RR  = Cmp_Ip_apxBase[instance]->C2 & flag_RR;
+    
+    status   = ((flag_Cmp != 0U) || (flag_RR != 0U)) ? TRUE:FALSE;
+    
+#endif
+  
+    return status;
+}
+#endif
+
+#if (defined(ICU_CMP_0_ISR_USED) || \
+     defined(ICU_CMP_1_ISR_USED) || \
+     defined(ICU_CMP_2_ISR_USED))
+    
+static void Cmp_Ip_IrqHandler(uint8 instance)
+{
+#if (CMP_IP_DEV_ERROR_DETECT == STD_ON)
+    DevAssert(instance < ICU_CMP_INSTANCE_COUNT);
+#endif
+#ifdef CMP_ICU_SUPPORT_LOWPOWER
+    LPCMP_Type * base = Cmp_Ip_apxBase[instance];
+    uint32 ier = base->IER;
+    uint32 csr = base->CSR;
+    
+    /* clear w1c bits */
+    base->CSR = LPCMP_CSR_CFR_MASK | LPCMP_CSR_CFF_MASK | LPCMP_CSR_RRF_MASK;
+    base->RRSR = (0xFFu << LPCMP_RRSR_RR_CH0F_SHIFT);
+    uint32 flags = ier & csr; /* mask out interrupt sources that are not enabled - spurious interrupts */
+    if (Cmp_Ip_axState[instance].NotificationEnabled)
+    {
+        if (NULL_PTR != Cmp_Ip_axState[instance].ComparatorNotification)
+        {
+            if (0U != (flags & (LPCMP_CSR_CFR_MASK | LPCMP_CSR_CFF_MASK)))
+            {
+                Cmp_Ip_axState[instance].ComparatorNotification(Cmp_Ip_axState[instance].CallbackParam1, FALSE);
+            }
+        }
+        if (NULL_PTR != Cmp_Ip_axState[instance].TriggerNotification)
+        {
+            if (0U != (flags & LPCMP_CSR_RRF_MASK))
+            {
+                Cmp_Ip_axState[instance].TriggerNotification(Cmp_Ip_axState[instance].CallbackParam1, FALSE);
+            }
+        }
+    }
+#endif
+#ifdef CMP_ICU_NOT_SUPPORT_LOWPOWER
+    CMP_Type * base = Cmp_Ip_apxBase[instance];
+    uint32 flag_Cmp;
+    uint32 flag_RR;
+    
+    flag_RR  = CMP_C2_CH0F_MASK | CMP_C2_CH1F_MASK | CMP_C2_CH2F_MASK | CMP_C2_CH3F_MASK | CMP_C2_CH4F_MASK | CMP_C2_CH5F_MASK | CMP_C2_CH6F_MASK | CMP_C2_CH7F_MASK;
+    flag_RR  = base->C2 & flag_RR;
+    flag_Cmp = base->C0 & (CMP_C0_CFF_MASK | CMP_C0_CFR_MASK);
+    
+    /* clear w1c bits */
+    base->C0 |= CMP_C0_CFF_MASK | CMP_C0_CFR_MASK;
+    base->C2 |= CMP_C2_CH0F_MASK | CMP_C2_CH1F_MASK | CMP_C2_CH2F_MASK | CMP_C2_CH3F_MASK | CMP_C2_CH4F_MASK | CMP_C2_CH5F_MASK | CMP_C2_CH6F_MASK | CMP_C2_CH7F_MASK;
+
+    if (Cmp_Ip_axState[instance].NotificationEnabled)
+    {
+        if (NULL_PTR != Cmp_Ip_axState[instance].ComparatorNotification)
+        {
+            if (0U != flag_Cmp)
+            {
+                Cmp_Ip_axState[instance].ComparatorNotification(Cmp_Ip_axState[instance].CallbackParam1, FALSE);
+            }
+        }
+        if (NULL_PTR != Cmp_Ip_axState[instance].TriggerNotification)
+        {
+            if (0U != flag_RR)
+            {
+                Cmp_Ip_axState[instance].TriggerNotification(Cmp_Ip_axState[instance].CallbackParam1, FALSE);
+            }
+        }
+    }
+#endif
+} 
+#endif
+
+#if (defined(ICU_CMP_0_ISR_USED))
+ISR(CMP_0_ISR)
+{
+    Cmp_Ip_IrqHandler(0U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined(ICU_CMP_1_ISR_USED))
+ISR(CMP_1_ISR)
+{
+    Cmp_Ip_IrqHandler(1U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined(ICU_CMP_2_ISR_USED))
+ISR(CMP_2_ISR)
+{
+    Cmp_Ip_IrqHandler(2U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 1281 - 0
RTD/src/Ftm_Icu_Ip.c

@@ -0,0 +1,1281 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file       File with source code used to implement ICU driver functionality on FTM module.
+ *     @details    This file contains the source code for all functions which are using FTM module.
+ *     @addtogroup ftm_icu_ip FTM IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Ftm_Icu_Ip.h"
+#include "SchM_Icu.h"
+#include "OsIf.h"
+
+#if(FTM_ICU_IP_DEV_ERROR_DETECT == STD_ON)
+#include "Devassert.h"
+#endif
+
+#if (STD_ON == FTM_ICU_ENABLE_USER_MODE_SUPPORT)
+#define USER_MODE_REG_PROT_ENABLED  (FTM_ICU_ENABLE_USER_MODE_SUPPORT)
+#include "RegLockMacros.h"
+#endif
+
+/*==================================================================================================
+*                                  SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define FTM_ICU_IP_VENDOR_ID_C                     43
+#define FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION_C      4
+#define FTM_ICU_IP_AR_RELEASE_MINOR_VERSION_C      4
+#define FTM_ICU_IP_AR_RELEASE_REVISION_VERSION_C   0
+#define FTM_ICU_IP_SW_MAJOR_VERSION_C              1
+#define FTM_ICU_IP_SW_MINOR_VERSION_C              0
+#define FTM_ICU_IP_SW_PATCH_VERSION_C              0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if source file and OsIf.h file are of the same Autosar version */
+    #if ((FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != OSIF_AR_RELEASE_MAJOR_VERSION) || \
+         (FTM_ICU_IP_AR_RELEASE_MINOR_VERSION_C != OSIF_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers Ftm_Icu_Ip.c and OsIf.h are different"
+    #endif
+#endif
+
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if(FTM_ICU_IP_DEV_ERROR_DETECT == STD_ON)
+        /* Check if this header file and Devassert.h file are of the same Autosar version */
+        #if ((FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != DEVASSERT_AR_RELEASE_MAJOR_VERSION) || \
+            (FTM_ICU_IP_AR_RELEASE_MINOR_VERSION_C != DEVASSERT_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Ftm_Icu_Ip.c and Devassert.h are different"
+        #endif
+    #endif
+#endif
+
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and SchM_Icu.h file are of the same Autosar version */
+    #if ((FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != SCHM_ICU_AR_RELEASE_MAJOR_VERSION) || \
+         (FTM_ICU_IP_AR_RELEASE_MINOR_VERSION_C != SCHM_ICU_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Ftm_Icu_Ip.c and SchM_Icu.h are different"
+    #endif
+
+    #if (STD_ON == FTM_ICU_ENABLE_USER_MODE_SUPPORT)
+        /* Check if header file and RegLockMacros.h file are of the same Autosar version */
+        #if ((FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != REGLOCKMACROS_AR_RELEASE_MAJOR_VERSION) || \
+             (FTM_ICU_IP_AR_RELEASE_MINOR_VERSION_C != REGLOCKMACROS_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Ftm_Icu_Ip.c and RegLockMacros.h are different"
+        #endif
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (FTM_ICU_IP_VENDOR_ID_C != FTM_ICU_IP_VENDOR_ID)
+    #error "Ftm_Icu_Ip.c and Ftm_Icu_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_AR_RELEASE_MINOR_VERSION_C != FTM_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_AR_RELEASE_REVISION_VERSION_C != FTM_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Ftm_Icu_Ip.c and Ftm_Icu_Ip.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((FTM_ICU_IP_SW_MAJOR_VERSION_C != FTM_ICU_IP_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_SW_MINOR_VERSION_C != FTM_ICU_IP_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_SW_PATCH_VERSION_C != FTM_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Ftm_Icu_Ip.c and Ftm_Icu_Ip.h are different"
+#endif
+
+/*==================================================================================================
+*                           LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
+==================================================================================================*/
+
+/*==================================================================================================
+*                                         LOCAL MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        LOCAL CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        LOCAL VARIABLES
+==================================================================================================*/
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+
+#define ICU_START_SEC_VAR_CLEARED_16
+#include "Icu_MemMap.h"
+
+uint16 Ftm_Icu_Ip_aBufferPtr[FTM_INSTANCE_COUNT][FTM_ICU_IP_NUM_OF_CHANNELS];
+
+#define ICU_STOP_SEC_VAR_CLEARED_16
+#include "Icu_MemMap.h"
+
+#endif
+
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/* State of initialized FTM channels */
+Ftm_Icu_Ip_ChStateType Ftm_Icu_Ip_ChState[FTM_INSTANCE_COUNT][FTM_ICU_IP_NUM_OF_CHANNELS];
+
+Ftm_Icu_Ip_InstStateType Ftm_Icu_Ip_InsState[FTM_INSTANCE_COUNT];
+
+
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+/* Variables hold Edge Align for SignalMeasurement mode only.
+ * This variable is only set when the init driver, and is not
+ * affected by the Ftm_Icu_Ip_SetActivationCondition function
+ * such as the Ftm_Icu_Ip_ChState[module][channel].edgeTrigger variable.
+ */
+static Ftm_Icu_Ip_EdgeType SignalMeasurementEdgeAlign[FTM_INSTANCE_COUNT][FTM_ICU_IP_NUM_OF_CHANNELS];
+#endif
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#define ICU_START_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+/* Table of base addresses for FTM instances. */
+Ftm_Icu_Ip_BaseType * const ftmIcuBase[] = IP_FTM_BASE_PTRS;
+
+#define ICU_STOP_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                        GLOBAL CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                    LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+
+#if (STD_ON == FTM_ICU_ENABLE_USER_MODE_SUPPORT)
+    void Ftm_Icu_SetUserAccessAllowed(uint32 FtmBaseAddr);
+#endif
+
+#if (defined (MCAL_FTM_REG_PROT_AVAILABLE) && (STD_ON == FTM_ICU_ENABLE_USER_MODE_SUPPORT))
+    #define Call_Ftm_Icu_SetUserAccessAllowed(BaseAddr) OsIf_Trusted_Call1param(Ftm_Icu_SetUserAccessAllowed,(BaseAddr))
+#else
+    #define Call_Ftm_Icu_SetUserAccessAllowed(BaseAddr)
+#endif
+#if (STD_ON == FTM_ICU_DEINIT_API)
+static void Ftm_Icu_Ip_ClearChState(uint8 instance, uint8 hwChannel);
+#endif
+/**
+ * @brief Sets the FTM peripheral timer channel input capture filter value.
+ * 
+ * @param ftmBase 
+ * @param hwChannel 
+ * @param value   - Filer value for a specific channel; Set (value = 0) => filter disable.
+ */
+static void Ftm_Icu_Ip_SetChnInputCaptureFilter(Ftm_Icu_Ip_BaseType * const ftmBase, uint8 hwChannel, uint8 value);
+
+/*==================================================================================================
+*                                        LOCAL FUNCTIONS
+==================================================================================================*/
+
+/**
+ * @brief Sets the FTM peripheral timer channel input capture filter value.
+ * 
+ * @param ftmBase 
+ * @param hwChannel 
+ * @param value   - Filer value for a specific channel; Set (value = 0) => filter disable.
+ */
+static void Ftm_Icu_Ip_SetChnInputCaptureFilter(Ftm_Icu_Ip_BaseType * const ftmBase, uint8 hwChannel, uint8 value)
+{
+#if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(CHAN4_IDX > hwChannel);
+    DevAssert(NULL_PTR != ftmBase);
+    DevAssert((uint8)16U > value);
+#endif
+    /* For the current channel filter value will be set. */
+    switch (hwChannel)
+    {
+        case CHAN0_IDX:
+            ftmBase->FILTER &= ~FTM_FILTER_CH0FVAL_MASK;
+            ftmBase->FILTER |= FTM_FILTER_CH0FVAL(value);
+            break;
+        case CHAN1_IDX:
+            ftmBase->FILTER &= ~FTM_FILTER_CH1FVAL_MASK;
+            ftmBase->FILTER |= FTM_FILTER_CH1FVAL(value);
+            break;
+        case CHAN2_IDX:
+            ftmBase->FILTER &= ~FTM_FILTER_CH2FVAL_MASK;
+            ftmBase->FILTER |= FTM_FILTER_CH2FVAL(value);
+            break;
+        case CHAN3_IDX:
+            ftmBase->FILTER &= ~FTM_FILTER_CH3FVAL_MASK;
+            ftmBase->FILTER |= FTM_FILTER_CH3FVAL(value);
+            break;
+        default:
+            /* Nothing to do. */
+            break;
+    }
+}
+
+/**
+ * @brief Clear status, interrupt and overflow flags.
+ * 
+ * @param instance   - FTM instance where the current channel is located.
+ * @param hwChannel  - FTM hardware channel used.
+ */
+static inline void Ftm_Icu_Ip_ClearInterruptFlags(uint8 instance, uint8 hwChannel)
+{
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_15();
+    {
+        /* Clear the status and interrupt enable flags for the FTM channel. */
+        ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= (~(FTM_CSC_CHIE_MASK | FTM_CSC_CHF_MASK));
+        /* Clear overflow flag. */
+        ftmIcuBase[instance]->SC &= ~(FTM_SC_TOF_MASK);
+    }
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_15();
+}
+
+#if ((STD_ON == FTM_ICU_TIMESTAMP_API) || (STD_ON == FTM_ICU_EDGE_COUNT_API) || (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API))
+/**
+ * @brief Pin not used for FTM — revert the channel pin to general purpose I/O 
+ *        or other peripheral control
+ * 
+ * @param instance   - FTM instance where the current channel is located.
+ * @param hwChannel  - FTM hardware channel used.
+ */
+static inline void Ftm_Icu_Ip_StopChannel(uint8 instance, uint8 hwChannel)
+{
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_16();
+    /* Clear bits which controle channel edge. */
+    ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= ~(FTM_CSC_ELSA_MASK | FTM_CSC_ELSB_MASK);
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_16();
+}
+#endif
+
+/**
+ * @brief Sets up the global configuration for the FTM hardware instance.
+ * 
+ * @param instance 
+ * @param maxCountValue 
+ */
+static void Ftm_Icu_Ip_GlobalConfiguration(uint8 instance, uint16 maxCountValue)
+{
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_17();
+    /* If write protection is enabled, then disable it. */
+    if (0U != (ftmIcuBase[instance]->FMS & FTM_FMS_WPEN_MASK))
+    {
+       /* Disable write protection */
+       ftmIcuBase[instance]->MODE |= FTM_MODE_WPDIS_MASK;
+    }
+    /* Disable the FTM counter */
+    ftmIcuBase[instance]->SC &= (~FTM_SC_CLKS_MASK);
+    /* Value used to reset counter register:
+    *  after reaching the maximum value the overflow flag will be set. */
+    ftmIcuBase[instance]->MOD = maxCountValue;
+    /* Initialize with the reset value counter */
+    ftmIcuBase[instance]->CNTIN = (uint16) 0x0000U;
+    /* Clear TOF by reading SC and writing 0 to TOF */
+    ftmIcuBase[instance]->SC &= (~FTM_SC_TOF_MASK);
+    /* Enable FTM module */
+    ftmIcuBase[instance]->MODE |= FTM_MODE_FTMEN_MASK;
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_17();
+}
+
+/**
+ * @brief 
+ * 
+ * @param instance       - FTM instance hardware number.
+ * @param clockSource  - Source clock used by the current FTM instance.
+ * @param prescaler    - Value which divides the source clock.
+ */
+static void Ftm_Icu_Ip_SetClock(uint8 instance, Ftm_Icu_Ip_ClockSourceType clockSource, uint8 prescaler)
+{
+    /* Set Prescaler. */
+    uint8 psValue = 0U;
+    for (psValue = 0U; psValue < 8U; psValue++)
+    {
+        if(prescaler == (((uint8)1U) << psValue))
+        {
+            break;
+        }
+    }
+    ftmIcuBase[instance]->SC &= (~FTM_SC_PS_MASK);
+    ftmIcuBase[instance]->SC |= FTM_SC_PS(psValue);
+    /* Set Clock Source. */
+    ftmIcuBase[instance]->SC = (ftmIcuBase[instance]->SC & (~FTM_SC_CLKS_MASK)) | FTM_SC_CLKS(clockSource);
+}
+
+#if (STD_ON == FTM_ICU_DEINIT_API)
+/**
+ * @brief Reset channel state.
+ * 
+ * @param instance  - FTM instance where the current channel is located.
+ * @param hwChannel - FTM hardware channel used.
+ */
+static void Ftm_Icu_Ip_ClearChState(uint8 instance, uint8 hwChannel)
+{
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_18();
+    {
+#if (defined(FTM_ICU_SIGNAL_MEASUREMENT_API) && (FTM_ICU_SIGNAL_MEASUREMENT_API == STD_ON))
+        Ftm_Icu_Ip_ChState[instance][hwChannel].firstEdge         = FALSE;
+        Ftm_Icu_Ip_ChState[instance][hwChannel].measurement       = FTM_ICU_NO_MEASUREMENT;
+#endif
+#if (defined(FTM_ICU_EDGE_COUNT_API) && (STD_ON == FTM_ICU_EDGE_COUNT_API))
+        Ftm_Icu_Ip_ChState[instance][hwChannel].edgeNumbers       = 0U;
+#endif
+        Ftm_Icu_Ip_ChState[instance][hwChannel].channelMode       = FTM_ICU_MODE_NO_MEASUREMENT;
+        Ftm_Icu_Ip_ChState[instance][hwChannel].edgeTrigger       = FTM_ICU_NO_PIN_CONTROL;
+        Ftm_Icu_Ip_ChState[instance][hwChannel].dmaMode           = FTM_ICU_MODE_WITHOUT_DMA;
+        Ftm_Icu_Ip_ChState[instance][hwChannel].callback          = NULL_PTR;
+        Ftm_Icu_Ip_ChState[instance][hwChannel].callbackParam     = 0U;
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+        Ftm_Icu_Ip_ChState[instance][hwChannel].timestampBufferType = FTM_ICU_NO_TIMESTAMP;
+#endif
+
+    }
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_18();
+}
+#endif
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+
+#if (STD_ON == FTM_ICU_ENABLE_USER_MODE_SUPPORT)
+/**
+ * @brief        Enables FTM registers writing in User Mode by configuring REG_PROT
+ * @details      Sets the UAA (User Access Allowed) bit of the FTM IP allowing FTM registers writing in User Mode
+ *
+ * @param[in]    FtmBaseAddr
+ *
+ * @return       none
+ *
+ * @pre          Should be executed in supervisor mode
+ */
+void Ftm_Icu_SetUserAccessAllowed(uint32 FtmBaseAddr)
+{
+    SET_USER_ACCESS_ALLOWED(FtmBaseAddr, FTM_PROT_MEM_U32);
+}
+#endif /* STD_ON == FTM_ICU_ENABLE_USER_MODE_SUPPORT */
+
+#if (FTM_ICU_CAPTURERGISTER_API == STD_ON)
+/* @implements Ftm_Icu_Ip_GetCaptureRegisterValue_Activity */
+uint32 Ftm_Icu_Ip_GetCaptureRegisterValue(uint8 instance, uint8 hwChannel)
+{
+    return (ftmIcuBase[instance]->CONTROLS[hwChannel].CV);
+}
+#endif
+
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param userConfig 
+ * @return Ftm_Icu_Ip_StatusType
+ * @implements  Ftm_Icu_Ip_Init_Activity
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_Init (uint8 instance, const  Ftm_Icu_Ip_ConfigType *userConfig)
+{
+    uint8    index;
+    uint8    hwChannel;
+    Ftm_Icu_Ip_ModeType     ipMeasurementMode;
+    Ftm_Icu_Ip_BaseType*    ftmBase   = ftmIcuBase[instance];
+    Ftm_Icu_Ip_StatusType   retStatus = FTM_IP_STATUS_SUCCESS;
+
+#if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(instance < FTM_INSTANCE_COUNT);
+    DevAssert(userConfig != NULL_PTR);
+#endif 
+
+    if (FALSE == Ftm_Icu_Ip_InsState[instance].instInit)
+    {
+        Call_Ftm_Icu_SetUserAccessAllowed((uint32)ftmIcuBase[instance]);
+        
+        Ftm_Icu_Ip_GlobalConfiguration(instance, userConfig->pInstanceConfig->maxCountValue);
+        Ftm_Icu_Ip_InsState[instance].prescaler = userConfig->pInstanceConfig->cfgPrescaler;
+#if (FTM_ICU_DUAL_CLOCK_MODE_API == STD_ON)
+        Ftm_Icu_Ip_InsState[instance].prescalerAlternate = userConfig->pInstanceConfig->cfgAltPrescaler;
+#endif
+        for (index = 0U; index < userConfig->nNumChannels; index++)
+        {
+            hwChannel   = (*userConfig->pChannelsConfig)[index].hwChannel;
+            
+            Ftm_Icu_Ip_ChState[instance][hwChannel].notificationEnable      = (*userConfig->pChannelsConfig)[index].initNotificationEnable;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftmChannelNotification  = (*userConfig->pChannelsConfig)[index].ftmChannelNotification;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftmOverflowNotification = (*userConfig->pChannelsConfig)[index].ftmOverflowNotification;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].callback                = (*userConfig->pChannelsConfig)[index].callback;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].callbackParam           = (*userConfig->pChannelsConfig)[index].callbackParams;
+            
+            /* Set the event which will generate the interrupt */
+            Ftm_Icu_Ip_ChState[instance][hwChannel].edgeTrigger       = (*userConfig->pChannelsConfig)[index].edgeAlignement;
+            /* Save suboperation mode. */
+            Ftm_Icu_Ip_ChState[instance][hwChannel].dmaMode   = (*userConfig->pChannelsConfig)[index].chSubMode;
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+            SignalMeasurementEdgeAlign[instance][hwChannel] = (*userConfig->pChannelsConfig)[index].edgeAlignement;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aPeriod = (uint16)0U;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aActivePulseWidth = (uint16)0U;
+#endif
+
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBuffer = NULL_PTR;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferSize = (uint16)0U;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferNotify = (uint16)0U;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aNotifyCount = (uint16)0U;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferIndex = (uint16)0U;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].timestampBufferType    = (*userConfig->pChannelsConfig)[index].timestampBufferType;
+#endif /* STD_ON == FTM_ICU_TIMESTAMP_API */
+
+            Ftm_Icu_Ip_ChState[instance][hwChannel].logicChStateCallback = (*userConfig->pChannelsConfig)[index].logicChStateCallback;
+            /* Initialize with the reset value the channel status and control register. */
+            ftmBase->CONTROLS[hwChannel].CSC  = (uint32) 0x0U;
+            
+            /* Enable filtering for input channels */
+            if (hwChannel < CHAN4_IDX)
+            {
+                Ftm_Icu_Ip_SetChnInputCaptureFilter(ftmBase, (uint8)hwChannel, (*userConfig->pChannelsConfig)[index].filterValue);
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+                if ((FTM_ICU_PERIOD_TIME != Ftm_Icu_Ip_ChState[instance][hwChannel].measurement)&&\
+                   (FTM_ICU_MODE_SIGNAL_MEASUREMENT == (*userConfig->pChannelsConfig)[index].chMode))
+                {
+                    Ftm_Icu_Ip_SetChnInputCaptureFilter(ftmBase, (uint8)(hwChannel + 1U), (*userConfig->pChannelsConfig)[index].filterValue);
+                }
+#endif
+            }
+#if (STD_ON == FTM_ICU_TIMESTAMP_USES_DMA)
+            /* Set DMA property for the channel*/
+            ftmBase->CONTROLS[hwChannel].CSC |= FTM_CSC_DMA((uint32)Ftm_Icu_Ip_ChState[instance][hwChannel].dmaMode);
+#endif
+            Ftm_Icu_Ip_SetActivationCondition(instance, hwChannel, (Ftm_Icu_Ip_EdgeType)Ftm_Icu_Ip_ChState[instance][hwChannel].edgeTrigger);
+            ipMeasurementMode = (*userConfig->pChannelsConfig)[index].chMode;
+            switch(ipMeasurementMode)
+            {
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+                case FTM_ICU_MODE_SIGNAL_MEASUREMENT:
+                    {
+                        /* Save what type of signal measuremet will start. */
+                        Ftm_Icu_Ip_ChState[instance][hwChannel].measurement = (*userConfig->pChannelsConfig)[index].measurementMode;
+                        /* Save measurement mode in channel state. */
+                        Ftm_Icu_Ip_ChState[instance][hwChannel].channelMode = FTM_ICU_MODE_SIGNAL_MEASUREMENT;
+                    }
+                    break;
+#endif
+#if (STD_ON == FTM_ICU_EDGE_DETECT_API)
+                case FTM_ICU_MODE_SIGNAL_EDGE_DETECT:
+                    {
+                        /* Disable the dual edge mode. */
+                        ftmBase->COMBINE &= ~(uint32)FTM_COMBINE_COMBINEx_MASK_U32(hwChannel);
+                        /* Set non-continuouse mode */
+                        ftmBase->CONTROLS[hwChannel].CSC &= ~((uint32)FTM_CSC_MSB_MASK | (uint32)FTM_CSC_MSA_MASK);
+                        /* Save measurement mode in channel state. */
+                        Ftm_Icu_Ip_ChState[instance][hwChannel].channelMode = FTM_ICU_MODE_SIGNAL_EDGE_DETECT;
+                    }
+                    break;
+#endif
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+                case FTM_ICU_MODE_TIMESTAMP:
+                    {
+                        /* Verify if channel supports DMA. */
+                        /* Save measurement mode in channel state. */
+                        Ftm_Icu_Ip_ChState[instance][hwChannel].channelMode = FTM_ICU_MODE_TIMESTAMP;
+                    }
+                    break;
+#endif
+#if (STD_ON == FTM_ICU_EDGE_COUNT_API)
+                case FTM_ICU_MODE_EDGE_COUNTER:
+                    {
+                        /* Save measurement mode in channel state. */
+                        Ftm_Icu_Ip_ChState[instance][hwChannel].channelMode = FTM_ICU_MODE_EDGE_COUNTER;
+                    }
+                    break;
+#endif
+                default:
+                    {
+                        /* Do nothing. */
+                    }
+                    break;
+            }
+        }
+        /* Set debug mode. */
+        ftmBase->CONF |= ((uint32)userConfig->pInstanceConfig->debugMode << FTM_CONF_BDMMODE_SHIFT);
+        /* Set clock source to start the counter */
+        Ftm_Icu_Ip_SetClock(instance, userConfig->pInstanceConfig->cfgClkSrc, userConfig->pInstanceConfig->cfgPrescaler);
+        Ftm_Icu_Ip_InsState[instance].instInit = TRUE;
+    }
+    else
+    {
+        /* instance already initialized - use deinitialize first */
+        retStatus = FTM_IP_STATUS_ERROR;
+    }
+    return retStatus;
+}
+
+
+/**
+ * @brief FTM IP function that sets up the activation condition.
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @param activation 
+ * @implements Ftm_Icu_Ip_SetActivationCondition_Activity
+ */
+void Ftm_Icu_Ip_SetActivationCondition (uint8 instance, uint8 hwChannel, Ftm_Icu_Ip_EdgeType activation)
+{
+    Ftm_Icu_Ip_ChState[instance][hwChannel].edgeTrigger = activation;
+    /* Set activation condition in the Channel Status and Control Register (CSCR) */
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_19();
+    ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= ~(FTM_CSC_ELSB_MASK | FTM_CSC_ELSA_MASK);
+    ftmIcuBase[instance]->CONTROLS[hwChannel].CSC |= ((FTM_CSC_ELSB_MASK | FTM_CSC_ELSA_MASK) & \
+                                                    (uint32)((uint32)activation << FTM_CSC_ELSA_SHIFT));
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_19();
+}
+
+#if ((FTM_ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (FTM_ICU_IP_DEV_ERROR_DETECT == STD_ON))
+#if ((FTM_ICU_EDGE_COUNT_API == STD_ON) || (FTM_ICU_TIMESTAMP_API == STD_ON) || \
+     (FTM_ICU_GET_TIME_ELAPSED_API == STD_ON) || (FTM_ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON))
+/**
+ * @brief Ftm IP function that get the state of the overflow flag
+ * 
+ * @param instance 
+ * 
+ * @return      boolean      the state of the overflow flag
+ * @retval      TRUE         the overflow flag is set
+ * @retval      FALSE        the overflow flag is not set
+ */
+boolean Ftm_Icu_Ip_GetOverflow(uint8 instance)
+{
+    /* Get timer overflow flag */
+    uint32 statusTOF = ftmIcuBase[instance]->SC & FTM_SC_TOF_MASK;
+
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_20();
+    /* Clear overflow flag */
+    ftmIcuBase[instance]->SC = ftmIcuBase[instance]->SC & (~FTM_SC_TOF_MASK);
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_20();
+
+    /* Get and return the state of the overflow flag */
+    return (FTM_SC_TOF_MASK == (statusTOF & FTM_SC_TOF_MASK));
+}
+#endif
+#endif /* (FTM_ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (FTM_ICU_IP_DEV_ERROR_DETECT == STD_ON) */
+
+#if (STD_ON == FTM_ICU_GET_INPUT_LEVEL_API)
+/**
+ * @brief This function returns the actual status of PIN.
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @return Ftm_Icu_Ip_LevelType 
+ * @implements Ftm_Icu_Ip_GetInputLevel_Activity
+ */
+Ftm_Icu_Ip_LevelType Ftm_Icu_Ip_GetInputLevel(uint8 instance, uint8 hwChannel)
+{
+#if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(instance < FTM_INSTANCE_COUNT);
+    DevAssert(hwChannel < FTM_CONTROLS_COUNT);
+    DevAssert(Ftm_Icu_Ip_ChState[instance][hwChannel].channelMode != FTM_ICU_MODE_NO_MEASUREMENT);
+#endif
+    /* Return input level. */
+    return (((ftmIcuBase[instance]->CONTROLS[hwChannel].CSC & FTM_CSC_CHIS_MASK) == FTM_CSC_CHIS_MASK) ? \
+            FTM_ICU_LEVEL_HIGH : FTM_ICU_LEVEL_LOW);
+}
+#endif /* STD_ON == FTM_ICU_GET_INPUT_LEVEL_API */
+
+#if (STD_ON == FTM_ICU_DEINIT_API)
+/**
+ * @brief  FTM IP function that de-initialize a specific channel
+ * 
+ * @param instance
+ *
+ * @implements Ftm_Icu_Ip_DeInit_Activity
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_DeInit (uint8 instance)
+{
+    /* Logical channel. */
+    uint8 channel;
+    Ftm_Icu_Ip_StatusType   retStatus = FTM_IP_STATUS_SUCCESS;
+
+    if (TRUE == Ftm_Icu_Ip_InsState[instance].instInit)
+    {
+        /* Reset global configuration. */
+        Ftm_Icu_Ip_GlobalConfiguration(instance, (uint8)0U);
+        Ftm_Icu_Ip_InsState[instance].instInit = FALSE;
+        Ftm_Icu_Ip_InsState[instance].prescaler = (uint8)0U;
+        Ftm_Icu_Ip_InsState[instance].prescalerAlternate = (uint8)0U;
+        Ftm_Icu_Ip_InsState[instance].spuriousMask = (uint8)0U;
+        
+        /* Stop clock. */
+        Ftm_Icu_Ip_SetClock(instance, FTM_NO_CLOCK_SELECTED, (uint8)0U);
+
+        for (channel = 0U; channel < FTM_ICU_IP_NUM_OF_CHANNELS; channel++)
+        {
+            /* Clear filter for each chanel that support this feature. */
+            if (channel < (uint8)FTM_FILTER_MAX_NO_CH)
+            {
+                ftmIcuBase[instance]->FILTER = ~((uint32)FTM_FILTER_CH0FVAL_MASK << ((uint32)4U * (uint32)channel));
+            }
+            /* Reset Channel Value, Channel Status And Control and Counter Registers (CV, CSC, CNT) */
+            ftmIcuBase[instance]->CONTROLS[channel].CV  = 0U;
+            ftmIcuBase[instance]->CONTROLS[channel].CSC = 0U;
+            ftmIcuBase[instance]->CNT                   = 0U;
+
+            /* Reset BDMMODE bits. */
+            ftmIcuBase[instance]->CONF &= ~(FTM_CONF_BDMMODE_MASK);
+
+            /* Clear COMBINE bit for the FTM channel. */
+            if(0U == (channel % 2U))
+            {
+                ftmIcuBase[instance]->COMBINE &= ~((uint32)FTM_COMBINE_COMBINE0_MASK << ((uint32)8U * ((uint32)channel / (uint32)2U)));
+            }
+            /* Clear channel state. */
+            Ftm_Icu_Ip_ClearChState(instance, channel);
+       }
+    }
+    else
+    {
+        /* instance already de-initialize - use initialize first */
+        retStatus = FTM_IP_STATUS_ERROR;
+    }
+    return retStatus;
+
+}
+#endif /* STD_ON == FTM_ICU_DEINIT_API */
+
+#if (STD_ON == FTM_ICU_SET_MODE_API)
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param hwChannel 
+ */
+void Ftm_Icu_Ip_SetSleepMode(uint8 instance, uint8 hwChannel)
+{
+    /* Disable FTM mod on the output pin. */
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_21();
+    ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= ~(FTM_CSC_ELSB_MASK | FTM_CSC_ELSA_MASK);
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_21();
+}
+
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param hwChannel 
+ */
+void Ftm_Icu_Ip_SetNormalMode(uint8 instance, uint8 hwChannel)
+{
+    /* Get edge activation mode. */
+    Ftm_Icu_Ip_EdgeType edgeTrigger = Ftm_Icu_Ip_ChState[instance][hwChannel].edgeTrigger;
+    if (FTM_ICU_NO_PIN_CONTROL != edgeTrigger)
+    {
+        /* Set the FTM channel to the configured activation type. */
+        SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_22();
+        ftmIcuBase[instance]->CONTROLS[hwChannel].CSC |= ((FTM_CSC_ELSB_MASK | FTM_CSC_ELSA_MASK) & \
+                                                    ((uint32)edgeTrigger << FTM_CSC_ELSA_SHIFT));
+        SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_22();
+    }
+}
+#endif  /* STD_ON == FTM_ICU_SET_MODE_API */
+
+#if (STD_ON == FTM_ICU_EDGE_DETECT_API)
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @implements Ftm_Icu_Ip_EnableEdgeDetection_Activity
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_EnableEdgeDetection(uint8 instance, uint8 hwChannel)
+{
+    /* Enable interrupts on the FTM channel. */
+    /* Clear pending interrupt serviced. */
+    Ftm_Icu_Ip_ClearInterruptFlags(instance, hwChannel);
+    /* Set activation condition and start. */
+    Ftm_Icu_Ip_SetActivationCondition(instance, hwChannel, (Ftm_Icu_Ip_EdgeType)Ftm_Icu_Ip_ChState[instance][hwChannel].edgeTrigger);
+
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_23();
+    ftmIcuBase[instance]->CONTROLS[hwChannel].CSC |= FTM_CSC_CHIE_MASK;
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_23();
+    return FTM_IP_STATUS_SUCCESS;
+}
+#endif /* ICU_EDGE_DETECT_API */
+
+#if (STD_ON == FTM_ICU_EDGE_DETECT_API)
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @implements Ftm_Icu_Ip_DisableEdgeDetection_Activity
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_DisableEdgeDetection(uint8 instance, uint8 hwChannel)
+{
+    /* Disable interrupts on the FTM channel. */
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_24();
+    ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= (~FTM_CSC_CHIE_MASK);
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_24();
+
+    return FTM_IP_STATUS_SUCCESS;
+}
+#endif /* STD_ON == FTM_ICU_EDGE_DETECT_API */
+
+/**
+ * @brief Enable channel interrupt.
+ * 
+ * @param[in] instance   Hardware instance of FTM used. 
+ * @param[in] hwChannel  Hardware channel of FTM used.
+ * @return   void.
+ * @implements Ftm_Icu_Ip_EnableInterrupt_Activity
+ */
+void Ftm_Icu_Ip_EnableInterrupt(uint8 instance, uint8 hwChannel)
+{
+    ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= (~(FTM_CSC_CHIE_MASK | FTM_CSC_CHF_MASK));
+    ftmIcuBase[instance]->CONTROLS[hwChannel].CSC |= FTM_CSC_CHIE_MASK;
+}
+
+/**
+ * @brief Disable channel interrupt.
+ * 
+ * @param[in] instance   Hardware instance of FTM used. 
+ * @param[in] hwChannel  Hardware channel of FTM used.
+ * @return   void.
+ * @implements Ftm_Icu_Ip_DisableInterrupt_Activity
+ */
+void Ftm_Icu_Ip_DisableInterrupt(uint8 instance, uint8 hwChannel)
+{
+    ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= (~(FTM_CSC_CHIE_MASK | FTM_CSC_CHF_MASK));
+}
+
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+/** @implements Ftm_Icu_Ip_StartTimestamp_Activity */
+void Ftm_Icu_Ip_StartTimestamp(uint8   instance,
+                               uint8   hwChannel,
+                               uint16* bufferPtr,
+                               uint16  bufferSize,
+                               uint16  notifyInterval)
+{
+#if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(FTM_ICU_IP_NUM_OF_MODULES > instance);
+    DevAssert(FTM_ICU_IP_NUM_OF_CHANNELS > hwChannel);
+    DevAssert(NULL_PTR != ftmIcuBase[instance]);
+#endif
+    /* Reset bufferPtr. */
+    Ftm_Icu_Ip_aBufferPtr[instance][hwChannel] = 0U;
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_25();
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBuffer = bufferPtr;
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferSize = bufferSize;
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferNotify = notifyInterval;
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aNotifyCount = (uint16)0U;
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferIndex = (uint16)0U;
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_25();
+
+    /* Clear pending interrupt serviced. */
+    Ftm_Icu_Ip_ClearInterruptFlags(instance, hwChannel);
+    /* Configure the Timestamp mode for the Ftm channel in the configuration array */
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_25();
+    {
+#if defined(FTM_ICU_OVERFLOW_NOTIFICATION_API) && (FTM_ICU_OVERFLOW_NOTIFICATION_API == STD_ON)
+        /* Set Timer Overflow Interrupt Enable. */
+        ftmIcuBase[instance]->SC = ftmIcuBase[instance]->SC | FTM_SC_TOIE_MASK;
+#endif
+        /* Enable interrupts on the FTM channel. */
+        ftmIcuBase[instance]->CONTROLS[hwChannel].CSC |= FTM_CSC_CHIE_MASK;
+    }
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_25();
+    /* Set activation condition and start. */
+    Ftm_Icu_Ip_SetActivationCondition(instance, hwChannel, (Ftm_Icu_Ip_EdgeType)Ftm_Icu_Ip_ChState[instance][hwChannel].edgeTrigger);
+}
+
+/**
+ * @brief Stop a channel which run in timestamp mode.
+ * 
+ * @param instance  - FTM instance where the current channel is located.
+ * @param hwChannel - FTM hardware channel used.
+ * @implements Ftm_Icu_Ip_StopTimestamp_Activity
+ */
+void Ftm_Icu_Ip_StopTimestamp(uint8 instance, uint8 hwChannel)
+{
+#if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(FTM_ICU_IP_NUM_OF_MODULES > instance);
+    DevAssert(FTM_ICU_IP_NUM_OF_CHANNELS > hwChannel);
+    DevAssert(NULL_PTR != ftmIcuBase[instance]);
+    DevAssert(Ftm_Icu_Ip_ChState[instance][hwChannel].channelMode == FTM_ICU_MODE_TIMESTAMP);
+#endif
+    /* Stop channel activity. */
+    Ftm_Icu_Ip_StopChannel(instance, hwChannel);
+
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_26();
+    {
+        /* Disable Interrupts on the FTM channel. */
+        ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= ~(FTM_CSC_CHIE_MASK);
+#if defined(FTM_ICU_OVERFLOW_NOTIFICATION_API) && (STD_ON == FTM_ICU_OVERFLOW_NOTIFICATION_API)
+        /* Disable Timer Overflow Interrupt. */
+        ftmIcuBase[instance]->SC &= ~(FTM_SC_TOIE_MASK);
+#endif
+    }
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_26();
+}
+
+/** @implements Ftm_Icu_Ip_GetTimestampIndex_Activity */
+uint16 Ftm_Icu_Ip_GetTimestampIndex(uint8 instance, uint8 hwChannel)
+{
+    uint16 timestampIndex = 0U;
+
+#if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(instance < FTM_INSTANCE_COUNT);
+#endif
+    if (NULL_PTR == Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBuffer)
+    {
+        timestampIndex = 0U;
+    }
+    else
+    {
+        timestampIndex = Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferIndex;
+    }
+    return timestampIndex;
+}
+
+#endif  /* STD_ON == FTM_ICU_TIMESTAMP_API */
+
+#if ((STD_ON == FTM_ICU_TIMESTAMP_USES_DMA) && (STD_ON == FTM_ICU_TIMESTAMP_API))
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @return uint32 
+ * @implements Ftm_Icu_Ip_GetStartAddress_Activity
+ */
+uint32 Ftm_Icu_Ip_GetStartAddress(uint8 instance, uint8 hwChannel)
+{
+    return (uint32)(&ftmIcuBase[instance]->CONTROLS[hwChannel].CV);
+}
+#endif
+
+#if (STD_ON == FTM_ICU_EDGE_COUNT_API)
+/**
+ * @brief FTM IP function that reset the edge counting for FTM channel.
+ * 
+ * @param instance  - FTM instance where the current channel is located.
+ * @param hwChannel - FTM hardware channel used.
+ * @implements Ftm_Icu_Ip_ResetEdgeCount_Activity
+ */
+void Ftm_Icu_Ip_ResetEdgeCount(uint8 instance, uint8 hwChannel)
+{
+    Ftm_Icu_Ip_ChState[instance][hwChannel].edgeNumbers = 0U;
+}
+#endif  /* STD_ON == FTM_ICU_EDGE_COUNT_API */
+
+#if (STD_ON == FTM_ICU_EDGE_COUNT_API)
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param hwChannel
+ * @implements Ftm_Icu_Ip_EnableEdgeCount_Activity
+ */
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_EnableEdgeCount(uint8 instance, uint8 hwChannel)
+{
+    Ftm_Icu_Ip_ChState[instance][hwChannel].edgeNumbers = 0U;
+    
+    /* Clear interrupt flags. */
+    Ftm_Icu_Ip_ClearInterruptFlags(instance, hwChannel);
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_26();
+    {
+#if defined(FTM_ICU_OVERFLOW_NOTIFICATION_API) && (FTM_ICU_OVERFLOW_NOTIFICATION_API == STD_ON)
+        /* Set TOF interrupt enable. */
+        ftmIcuBase[instance]->SC |= FTM_SC_TOIE_MASK;
+#endif
+        /* Enable Interrupts on the FTM channel. */
+        ftmIcuBase[instance]->CONTROLS[hwChannel].CSC |= FTM_CSC_CHIE_MASK;
+    }
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_26();
+
+    /* Set activation condition and start. */
+    Ftm_Icu_Ip_SetActivationCondition(instance, hwChannel, (Ftm_Icu_Ip_EdgeType)Ftm_Icu_Ip_ChState[instance][hwChannel].edgeTrigger);
+    return FTM_IP_STATUS_SUCCESS;
+}
+#endif  /* STD_ON == FTM_ICU_EDGE_COUNT_API */
+
+#if (STD_ON == FTM_ICU_EDGE_COUNT_API)
+/**
+* @brief      Ftm_Icu_Ip_DisableEdgeCount
+* @details    Ftm IP function that disable the edge counting service for an Ftm channel
+*
+* @param[in]      hwChannel   - Ftm encoded hardware channel
+*
+* @return Ftm_Icu_Ip_StatusType
+*
+* @implements Ftm_Icu_Ip_DisableEdgeCount_Activity
+*/
+Ftm_Icu_Ip_StatusType Ftm_Icu_Ip_DisableEdgeCount(uint8 instance, uint8 hwChannel)
+{
+    Ftm_Icu_Ip_StopChannel(instance, hwChannel);
+
+    /* Disable Interrupts on the FTM channel. */
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_27();
+    {
+        ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= (~FTM_CSC_CHIE_MASK);
+#if defined(FTM_ICU_OVERFLOW_NOTIFICATION_API) && (FTM_ICU_OVERFLOW_NOTIFICATION_API == STD_ON)
+        /* Disable Timer Overflow Interrupt. */
+        ftmIcuBase[instance]->SC &= (~FTM_SC_TOIE_MASK);
+#endif
+    }
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_27();
+    return FTM_IP_STATUS_SUCCESS;
+}
+#endif  /* STD_ON == FTM_ICU_EDGE_COUNT_API */
+
+#if (STD_ON == FTM_ICU_EDGE_COUNT_API)
+/**
+ * @brief FTM IP function that get the edges number.
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @return uint16 
+ * @implements Ftm_Icu_Ip_GetEdgeNumbers_Activity
+ */
+uint16 Ftm_Icu_Ip_GetEdgeNumbers(uint8 instance, uint8 hwChannel)
+{
+    return Ftm_Icu_Ip_ChState[instance][hwChannel].edgeNumbers;
+}
+#endif  /* STD_ON == FTM_ICU_EDGE_COUNT_API */
+
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+/** @implements Ftm_Icu_Ip_StartSignalMeasurement_Activity */
+void Ftm_Icu_Ip_StartSignalMeasurement(uint8 instance, uint8 hwChannel)
+{
+    Ftm_Icu_Ip_MeasType measProperty = Ftm_Icu_Ip_ChState[instance][hwChannel].measurement;
+    /* Find the pair channel of the current channel. */
+    uint8 channelPair = (uint8)((0U == (hwChannel % 2U)) ? (hwChannel / 2U) : ((hwChannel - 1U) / 2U));
+
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aPeriod = (uint16)0U;
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aActivePulseWidth = (uint16)0U;
+    /* Clear status of first edge come to measurement in BOTH_EDGE mode for new session. */
+    Ftm_Icu_Ip_ChState[instance][hwChannel].firstEdgePolarity = FALSE;
+
+    if (FTM_ICU_PERIOD_TIME == measProperty)
+    {
+        
+        /* Clear interrupt flags. */
+        Ftm_Icu_Ip_ClearInterruptFlags(instance, hwChannel);
+        /* Set continuous capture mode - single edge capture. */
+        SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_28();
+        {
+            ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= ~(FTM_CSC_MSA_MASK | FTM_CSC_MSB_MASK);
+            /* Clear Dual Edge Capture on current channel pair. */
+            ftmIcuBase[instance]->COMBINE &= ~((uint32)FTM_COMBINE_DECAPEN0_MASK << ((uint32)8U * (uint32)channelPair));
+            ftmIcuBase[instance]->COMBINE &= ~((uint32)FTM_COMBINE_DECAP0_MASK << ((uint32)8U * (uint32)channelPair));
+            /* Enable channel interrupt. */
+            ftmIcuBase[instance]->CONTROLS[hwChannel].CSC |= FTM_CSC_CHIE_MASK;
+#if defined(FTM_ICU_OVERFLOW_NOTIFICATION_API) && (FTM_ICU_OVERFLOW_NOTIFICATION_API == STD_ON)
+            /* Set Timer Overflow Interrupt Enable */
+            ftmIcuBase[instance]->SC |= FTM_SC_TOIE_MASK;
+#endif
+        }
+        SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_28();
+        /* Update status of first signal measurement. */
+        Ftm_Icu_Ip_ChState[instance][hwChannel].firstEdge = TRUE;
+    }
+    else
+    {
+        /* Clear interrupt flags. */
+        Ftm_Icu_Ip_ClearInterruptFlags(instance, hwChannel);
+        SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_28();
+        {
+            if(FTM_ICU_DUTY_CYCLE == measProperty)
+            {
+                /* Enable first channel interrupt. */
+                ftmIcuBase[instance]->CONTROLS[hwChannel].CSC |= FTM_CSC_CHIE_MASK;
+                /* Update status of first signal measurement. */
+                Ftm_Icu_Ip_ChState[instance][hwChannel].firstEdge = TRUE;
+                /* Set continuous capture mode - single edge capture. */
+                ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= ~(FTM_CSC_MSA_MASK | FTM_CSC_MSB_MASK);
+                /* Clear Dual Edge Capture on current channel pair. */
+                ftmIcuBase[instance]->COMBINE &= ~((uint32)FTM_COMBINE_DECAPEN0_MASK << ((uint32)8U * (uint32)channelPair));
+                ftmIcuBase[instance]->COMBINE &= ~((uint32)FTM_COMBINE_DECAP0_MASK << ((uint32)8U * (uint32)channelPair));
+                /* Mark channel which is not verifyed for spourios interrupt. */
+                Ftm_Icu_Ip_InsState[instance].spuriousMask |= ((uint8)(1U << hwChannel));
+            }
+            else
+            {
+            /* Set continuous capture mode*/
+            ftmIcuBase[instance]->CONTROLS[hwChannel].CSC |= FTM_CSC_MSA_MASK;
+            /* Set Dual Edge Capture on current channel pair. */
+            ftmIcuBase[instance]->COMBINE |= ((uint32)FTM_COMBINE_DECAPEN0_MASK << ((uint32)8U * (uint32)channelPair));
+            ftmIcuBase[instance]->COMBINE |= ((uint32)FTM_COMBINE_DECAP0_MASK << ((uint32)8U * (uint32)channelPair));
+            /* Set Interrupt enable flag for the second channel. */
+            ftmIcuBase[instance]->CONTROLS[(hwChannel + 1U)].CSC |= FTM_CSC_CHIE_MASK;
+        }
+#if defined(FTM_ICU_OVERFLOW_NOTIFICATION_API) && (FTM_ICU_OVERFLOW_NOTIFICATION_API == STD_ON)
+            /* Set Timer Overflow Interrupt Enable */
+            ftmIcuBase[instance]->SC |= FTM_SC_TOIE_MASK;
+#endif
+        }
+        SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_28();
+
+        /* Save second channel state properties. */
+        Ftm_Icu_Ip_ChState[instance][(hwChannel + 1U)].measurement = measProperty;
+        Ftm_Icu_Ip_ChState[instance][(hwChannel + 1U)].channelMode = FTM_ICU_MODE_SIGNAL_MEASUREMENT;
+        /* Set activation condition for the second FTM channel. */
+        switch(SignalMeasurementEdgeAlign[instance][hwChannel])
+        {
+            case FTM_ICU_FALLING_EDGE:
+            {
+                Ftm_Icu_Ip_SetActivationCondition(instance, (uint8)(hwChannel + 1U), FTM_ICU_RISING_EDGE);
+            }
+            break;
+            case FTM_ICU_RISING_EDGE:
+            {
+                Ftm_Icu_Ip_SetActivationCondition(instance, (uint8)(hwChannel + 1U), FTM_ICU_FALLING_EDGE);
+            }
+            break;
+            default:
+            {
+                Ftm_Icu_Ip_SetActivationCondition(instance, (uint8)(hwChannel + 1U), FTM_ICU_BOTH_EDGES);
+            }
+            break;
+        }
+    }
+    /* Start the first channel. */
+    Ftm_Icu_Ip_SetActivationCondition(instance, hwChannel, SignalMeasurementEdgeAlign[instance][hwChannel]);
+}
+
+/** @implements Ftm_Icu_Ip_GetTimeElapsed_Activity */
+uint16 Ftm_Icu_Ip_GetTimeElapsed(uint8 instance, uint8 hwChannel)
+{
+    uint16 timeElapsed = (uint16)0U;
+
+#if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(instance < FTM_INSTANCE_COUNT);
+#endif
+
+    if((FTM_ICU_DUTY_CYCLE != Ftm_Icu_Ip_ChState[instance][hwChannel].measurement) && \
+        (FTM_ICU_NO_MEASUREMENT != Ftm_Icu_Ip_ChState[instance][hwChannel].measurement))
+    {
+        if ((Ftm_Icu_Ip_MeasType)FTM_ICU_PERIOD_TIME == Ftm_Icu_Ip_ChState[instance][hwChannel].measurement)
+        {
+            timeElapsed = Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aPeriod;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aPeriod = (uint16)0U;
+        }
+        else
+        {
+            timeElapsed = Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aActivePulseWidth;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aActivePulseWidth = (uint16)0U;
+        }
+    }
+    #if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+    else
+    {
+        DevAssert(TRUE);
+    }
+    #endif
+    return timeElapsed;
+}
+
+/** @implements Ftm_Icu_Ip_GetDutyCycleValues_Activity */
+void Ftm_Icu_Ip_GetDutyCycleValues(uint8 instance,
+                                   uint8 hwChannel,
+                                   Ftm_Icu_Ip_DutyCycleType* dutyCycleValues)
+{
+#if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(instance < FTM_INSTANCE_COUNT);
+#endif
+
+    if (FTM_ICU_DUTY_CYCLE == Ftm_Icu_Ip_ChState[instance][hwChannel].measurement)
+    {
+        if ((uint16)0U != Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aPeriod)
+        {
+            dutyCycleValues->ActiveTime = (uint16)Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aActivePulseWidth;
+            dutyCycleValues->PeriodTime = (uint16)Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aPeriod;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aActivePulseWidth = (uint16)0U;
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aPeriod           = (uint16)0U;
+        }
+        else
+        {
+            dutyCycleValues->ActiveTime = (uint16)0U;
+            dutyCycleValues->PeriodTime = (uint16)0U;
+        }
+    }
+    #if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+    else
+    {
+        DevAssert(TRUE);
+    }
+    #endif 
+}
+
+/**
+ * @brief Ftm_Icu_Ip_GetPWandPeriod
+ */
+void Ftm_Icu_Ip_GetPWandPeriod(uint8 instance, \
+                               uint8 hwChannel, \
+                               uint16* activePulseWidth, \
+                               uint16* period)
+{
+    *activePulseWidth = Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aActivePulseWidth;
+    *period = Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aPeriod;
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aActivePulseWidth = 0U;
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aPeriod = 0U;
+}
+
+#endif  /* STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API */
+
+#if (STD_ON == FTM_ICU_GET_INPUT_STATE_API)
+/**
+ * @brief Return input state of the channel.
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @return boolean 
+ */
+boolean Ftm_Icu_Ip_GetInputState(uint8 instance, uint8 hwChannel)
+{
+    boolean result = FALSE;
+    /* Get value from status and control register. */
+    uint32  statusRegister = ftmIcuBase[instance]->CONTROLS[hwChannel].CSC;
+
+    /* Interrupt not enabled, flag bit was set. */
+    if (FTM_CSC_CHIE_MASK != (FTM_CSC_CHIE_MASK & statusRegister))
+    {
+        if (FTM_CSC_CHF_MASK == (FTM_CSC_CHF_MASK & statusRegister))
+        {
+            result = TRUE;
+            /* Clear interrupt flag. */
+            SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_29();
+            ftmIcuBase[instance]->CONTROLS[hwChannel].CSC &= ~(FTM_CSC_CHF_MASK);
+            SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_29();
+        }
+    }
+    return result;
+}
+#endif /* STD_ON == FTM_ICU_GET_INPUT_STATE_API */
+
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+/**
+ * @brief FTM IP function which stops the signal measurement for a FTM channel.
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @implements Ftm_Icu_Ip_StopSignalMeasurement_Activity
+ */
+void Ftm_Icu_Ip_StopSignalMeasurement(uint8 instance, uint8 hwChannel)
+{
+    /* Stop Signal Measurement Mode for both channels used. */
+    Ftm_Icu_Ip_StopChannel(instance, hwChannel);
+    Ftm_Icu_Ip_StopChannel(instance, (uint8)(hwChannel + 1U));
+    
+    /* Clear status of first edge come to measurement in BOTH_EDGE mode for new session. */
+    Ftm_Icu_Ip_ChState[instance][hwChannel].firstEdgePolarity = FALSE;
+
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_30();
+    {
+        /* Clear interrupt and status flags for both channels. */
+        ftmIcuBase[instance]->CONTROLS[hwChannel].CSC       &= (~(FTM_CSC_CHIE_MASK | FTM_CSC_CHF_MASK));
+        ftmIcuBase[instance]->CONTROLS[(hwChannel + 1U)].CSC &= (~(FTM_CSC_CHIE_MASK | FTM_CSC_CHF_MASK));
+#if defined(FTM_ICU_OVERFLOW_NOTIFICATION_API) && (FTM_ICU_OVERFLOW_NOTIFICATION_API == STD_ON)
+        /* Disable Timer Overflow Interrupt Enable */
+        ftmIcuBase[instance]->SC &= ~FTM_SC_TOIE_MASK;
+#endif
+    }
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_30();
+}
+#endif  /* STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API */
+
+#if (STD_ON == FTM_ICU_DUAL_CLOCK_MODE_API)
+/**
+ * @brief This function sets the FTM prescaler.
+ * 
+ * @param instance 
+ * @param prescaler 
+ */
+void Ftm_Icu_Ip_SetPrescaler(uint8 instance, Ftm_Icu_Ip_ClockModeType selectPrescaler)
+{
+    uint8 prescaler = (uint8)0U;
+    uint8 psValue = (uint8)0U;
+    if (FTM_ICU_NORMAL_CLK == selectPrescaler)
+    {
+        prescaler = Ftm_Icu_Ip_InsState[instance].prescaler;
+    }
+    else
+    {
+        prescaler = Ftm_Icu_Ip_InsState[instance].prescalerAlternate;
+    }
+    for (psValue = 0U; psValue < 8U; psValue++)
+    {
+        if(prescaler == (((uint8)1U) << psValue))
+        {
+            break;
+        }
+    }
+    /* Set Prescaler value. */
+    ftmIcuBase[instance]->SC &= (~FTM_SC_PS_MASK);
+    ftmIcuBase[instance]->SC |= FTM_SC_PS(psValue);
+}
+#endif /* STD_ON == FTM_ICU_DUAL_CLOCK_MODE_API */
+
+/**
+ * @brief      Driver function Enable Notification for timestamp.
+ *
+ * @param[in]  instance  Hardware instance of FTM used. 
+ * @param[in]  hwChannel Hardware channel of FTM used.
+ * @return     void
+ */
+void Ftm_Icu_Ip_EnableNotification(uint8 instance, uint8 hwChannel)
+{
+    Ftm_Icu_Ip_ChState[instance][hwChannel].notificationEnable =  TRUE;
+}
+
+/**
+ * @brief      Driver function Disable Notification for timestamp.
+ *
+ * @param[in]  instance  Hardware instance of FTM used. 
+ * @param[in]  hwChannel Hardware channel of FTM used.
+ * @return     void
+ */
+void Ftm_Icu_Ip_DisableNotification(uint8 instance, uint8 hwChannel)
+{
+    Ftm_Icu_Ip_ChState[instance][hwChannel].notificationEnable =  FALSE;
+}
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 1153 - 0
RTD/src/Ftm_Icu_Ip_Irq.c

@@ -0,0 +1,1153 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file       File with source code used to implement ICU driver interrupts on FTM module.
+ *     @details    This file contains the source code for all interrupt functions which are using 
+ *                 FTM module.
+ *     @addtogroup ftm_icu_ip FTM IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Ftm_Icu_Ip.h"
+#include "Ftm_Icu_Ip_Irq.h"
+
+#include "SchM_Icu.h"
+#include "Mcal.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define FTM_ICU_IP_IRQ_VENDOR_ID_C                      43
+#define FTM_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C       4
+#define FTM_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION_C       4
+#define FTM_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION_C    0
+#define FTM_ICU_IP_IRQ_SW_MAJOR_VERSION_C               1
+#define FTM_ICU_IP_IRQ_SW_MINOR_VERSION_C               0
+#define FTM_ICU_IP_IRQ_SW_PATCH_VERSION_C               0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (FTM_ICU_IP_IRQ_VENDOR_ID_C != FTM_ICU_IP_IRQ_VENDOR_ID)
+    #error "Ftm_Icu_Ip_Irq.c and Ftm_Icu_Ip_Irq.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((FTM_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C != FTM_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION_C != FTM_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION_C != FTM_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Ftm_Icu_Ip_Irq.c and Ftm_Icu_Ip_Irq.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((FTM_ICU_IP_IRQ_SW_MAJOR_VERSION_C != FTM_ICU_IP_IRQ_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_SW_MINOR_VERSION_C != FTM_ICU_IP_IRQ_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_SW_PATCH_VERSION_C != FTM_ICU_IP_IRQ_SW_PATCH_VERSION))
+#error "Software Version Numbers of Ftm_Icu_Ip_Irq.c and Ftm_Icu_Ip_Irq.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (FTM_ICU_IP_IRQ_VENDOR_ID_C != FTM_ICU_IP_VENDOR_ID)
+    #error "Ftm_Icu_Ip_Irq.c and Ftm_Icu_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((FTM_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C != FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION_C != FTM_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION_C != FTM_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Ftm_Icu_Ip_Irq.c and Ftm_Icu_Ip.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((FTM_ICU_IP_IRQ_SW_MAJOR_VERSION_C != FTM_ICU_IP_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_SW_MINOR_VERSION_C != FTM_ICU_IP_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_IRQ_SW_PATCH_VERSION_C != FTM_ICU_IP_SW_PATCH_VERSION))
+#error "Software Version Numbers of Ftm_Icu_Ip_Irq.c and Ftm_Icu_Ip.h are different"
+#endif
+
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if this header file and SchM_Icu.h file are of the same Autosar version */
+    #if ((FTM_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C != SCHM_ICU_AR_RELEASE_MAJOR_VERSION) || \
+        (FTM_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION_C != SCHM_ICU_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Ftm_Icu_Ip_Irq.c and SchM_Icu.h are different"
+    #endif
+#endif
+
+/*==================================================================================================
+*                                        GLOBAL CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/* State of channels from FTM modules. */
+extern Ftm_Icu_Ip_ChStateType Ftm_Icu_Ip_ChState[FTM_INSTANCE_COUNT][FTM_ICU_IP_NUM_OF_CHANNELS];
+
+/* Instance state for FTMs. */
+extern Ftm_Icu_Ip_InstStateType Ftm_Icu_Ip_InsState[FTM_INSTANCE_COUNT];
+
+#if (((defined FTM_ICU_0_ISR_USED) || (defined FTM_ICU_1_ISR_USED) || \
+    (defined FTM_ICU_0_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_0_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_0_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_0_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_1_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_1_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_1_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_1_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_2_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_2_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_2_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_2_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_3_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_3_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_3_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_3_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_4_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_4_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_4_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_4_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_5_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_5_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_5_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_5_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_6_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_6_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_6_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_6_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_7_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_7_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_7_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_7_CH_6_CH_7_ISR_USED)) && \
+    (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API))
+static uint16 Icu_Ftm_ActivationPulseTemp[FTM_INSTANCE_COUNT][FTM_ICU_IP_NUM_OF_CHANNELS];
+#endif
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+
+#define ICU_START_SEC_VAR_CLEARED_16
+#include "Icu_MemMap.h"
+
+/* Channels buffer. */
+extern uint16 Ftm_Icu_Ip_aBufferPtr[FTM_INSTANCE_COUNT][FTM_ICU_IP_NUM_OF_CHANNELS];
+
+#define ICU_STOP_SEC_VAR_CLEARED_16
+#include "Icu_MemMap.h"
+
+#endif
+
+/*==================================================================================================
+*                                    LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+#if ((defined FTM_ICU_0_ISR_USED) || (defined FTM_ICU_1_ISR_USED) || \
+    (defined FTM_ICU_0_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_0_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_0_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_0_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_1_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_1_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_1_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_1_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_2_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_2_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_2_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_2_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_3_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_3_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_3_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_3_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_4_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_4_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_4_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_4_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_5_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_5_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_5_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_5_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_6_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_6_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_6_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_6_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_7_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_7_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_7_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_7_CH_6_CH_7_ISR_USED))
+
+/**
+ * @brief FTM IP function that get the state of the overflow flag
+ * 
+ * @param[in] instance     Hardware instance of FTM used. 
+ * @return    boolean    State of the overflow flag.
+ * @retval    TRUE       The overflow flag is set.
+ * @retval    FALSE      The overflow flag is not set.
+ */
+static inline boolean Ftm_Icu_Ip_GetOverflowIrq(uint8 instance);
+
+static inline void Ftm_Icu_Ip_ProcessInterrupt(uint8 instance, uint8 hwchannel);
+
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+static inline void Ftm_Icu_Ip_SignalMeasurement(uint8 instance, uint8 hwchannel, boolean overflow);
+
+/**
+ * @brief FTM IP function that handle the Signal Measurement
+ */
+static inline void Ftm_Icu_Ip_SignalMeasurementHandler(uint8  instance,
+                                         uint8  hwChannel,
+                                         uint16 activePulseWidth,
+                                         uint16 period,
+                                         boolean bOverflow);
+#endif /* STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API */
+
+#if ((STD_ON == FTM_ICU_EDGE_DETECT_API) || (STD_ON == FTM_ICU_EDGE_COUNT_API))
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @param overflow 
+ */
+static inline void Ftm_Icu_Ip_ReportEvents(uint8   instance,
+                                           uint8   hwChannel,
+                                           boolean overflow);
+#endif
+#endif /* All ISRs defines. */
+
+#if ((defined FTM_ICU_0_ISR_USED) || (defined FTM_ICU_1_ISR_USED) || \
+     (defined FTM_ICU_0_OVF_ISR_USED) || (defined FTM_ICU_1_OVF_ISR_USED) || \
+     (defined FTM_ICU_2_OVF_ISR_USED) || (defined FTM_ICU_3_OVF_ISR_USED) || \
+     (defined FTM_ICU_4_OVF_ISR_USED) || (defined FTM_ICU_5_OVF_ISR_USED) || \
+     (defined FTM_ICU_6_OVF_ISR_USED) || (defined FTM_ICU_7_OVF_ISR_USED))
+    static inline void Ftm_Icu_Ip_ProcessTofInterrupt(uint8 instance);
+#endif
+
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+/**
+ * @brief      FTM ICU driver function that handles the timestamp measurement in interrupt.
+ * @details    This service is called when an interrupt is recognized as a Timestamp
+ *             Measurement type.
+ * 
+ * @param instance  - Hardware channel of FTM used. 
+ * @param hwChannel - Hardware instance of FTM used. 
+ * @param bufferPtr - Address of the user buffer to store data.
+ * @param overflow  - Parameter that indicates the source of report is an overflow
+ * @internal
+ */
+static inline void Ftm_Icu_Ip_TimestampHandler(uint8         instance,
+                                               uint8         hwChannel,
+                                               const uint16* bufferPtr,
+                                               boolean       overflow);
+#endif /* FTM_ICU_TIMESTAMP_API */
+
+#if ((STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API) || (STD_ON == FTM_ICU_TIMESTAMP_API))
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param hwChannel 
+ * @param overflow 
+ */
+static inline void Ftm_Icu_Ip_ReportOverflow(uint8   instance,
+                                             uint8   hwChannel,
+                                             boolean overflow);
+#endif
+/*==================================================================================================
+*                                        LOCAL FUNCTIONS
+==================================================================================================*/
+#if ((defined FTM_ICU_0_ISR_USED) || (defined FTM_ICU_1_ISR_USED) || \
+     (defined FTM_ICU_0_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_0_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_0_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_0_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_1_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_1_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_1_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_1_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_2_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_2_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_2_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_2_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_3_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_3_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_3_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_3_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_4_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_4_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_4_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_4_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_5_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_5_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_5_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_5_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_6_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_6_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_6_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_6_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_7_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_7_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_7_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_7_CH_6_CH_7_ISR_USED))
+
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+/**
+ * @brief FTM IP function that handle the Signal Measurement
+ */
+static inline void Ftm_Icu_Ip_SignalMeasurementHandler(uint8  instance,
+                                                       uint8  hwChannel,
+                                                       uint16 activePulseWidth,
+                                                       uint16 period,
+                                                       boolean bOverflow)
+{
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aActivePulseWidth = activePulseWidth;
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aPeriod = period;
+    Ftm_Icu_Ip_ReportOverflow(instance, hwChannel, bOverflow);
+    if (NULL_PTR != Ftm_Icu_Ip_ChState[instance][hwChannel].logicChStateCallback)
+    {
+        Ftm_Icu_Ip_ChState[instance][hwChannel].logicChStateCallback(Ftm_Icu_Ip_ChState[instance][hwChannel].callbackParam, (1U << 1), TRUE);
+    }
+}
+#endif /* STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API */
+#endif
+
+#if ((defined FTM_ICU_0_ISR_USED) || (defined FTM_ICU_1_ISR_USED) || \
+     (defined FTM_ICU_0_OVF_ISR_USED) || (defined FTM_ICU_1_OVF_ISR_USED) || \
+     (defined FTM_ICU_2_OVF_ISR_USED) || (defined FTM_ICU_3_OVF_ISR_USED) || \
+     (defined FTM_ICU_4_OVF_ISR_USED) || (defined FTM_ICU_5_OVF_ISR_USED) || \
+     (defined FTM_ICU_6_OVF_ISR_USED) || (defined FTM_ICU_7_OVF_ISR_USED))
+static inline void Ftm_Icu_Ip_ProcessTofInterrupt(uint8 instance)
+{
+    uint8  hwchannel;
+    Ftm_Icu_Ip_ModeType measMode;
+
+    for (hwchannel = 0U; hwchannel < (uint8)FTM_ICU_IP_NUM_OF_CHANNELS; hwchannel++)
+    {
+        /* Get mode of measurement for each hwchannel. */
+        measMode = Ftm_Icu_Ip_ChState[instance][hwchannel].channelMode;
+
+        if ((FTM_ICU_MODE_TIMESTAMP == measMode) || \
+            (FTM_ICU_MODE_SIGNAL_MEASUREMENT == measMode))
+        {
+            /* Call ReportEvents for ASR or User_Callback for Edge Detection */
+            if(Ftm_Icu_Ip_ChState[instance][hwchannel].callback != NULL_PTR)
+            {
+                Ftm_Icu_Ip_ChState[instance][hwchannel].callback(Ftm_Icu_Ip_ChState[instance][hwchannel].callbackParam, TRUE);
+            }
+            else
+            {
+                /* Calling User Overflow Notification for the IPL channel */
+                if (NULL_PTR != Ftm_Icu_Ip_ChState[instance][hwchannel].ftmOverflowNotification)
+                {
+                    Ftm_Icu_Ip_ChState[instance][hwchannel].ftmOverflowNotification();
+                }
+            }
+        }
+    }
+}
+#endif
+
+#if ((defined FTM_ICU_0_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_0_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_0_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_0_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_1_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_1_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_1_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_1_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_2_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_2_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_2_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_2_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_3_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_3_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_3_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_3_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_4_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_4_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_4_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_4_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_5_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_5_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_5_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_5_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_6_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_6_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_6_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_6_CH_6_CH_7_ISR_USED) || \
+     (defined FTM_ICU_7_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_7_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_7_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_7_CH_6_CH_7_ISR_USED))
+static inline void Ftm_Icu_Ip_PairChHandler(uint8 moduleIndex, uint8 channelIndex)
+{
+    /* Read data from status and control register. */
+    uint8  isrStatus    = (uint8)ftmIcuBase[moduleIndex]->STATUS;
+    uint8  nextChannelIndex = channelIndex + (uint8)1U;
+    /* Clear the pair from STATUS flags. */
+    ftmIcuBase[moduleIndex]->STATUS &= (uint32)(~((uint32)0x03U << channelIndex)) | (uint32)(Ftm_Icu_Ip_InsState[moduleIndex].spuriousMask);
+
+    if ( ((isrStatus & (uint8)(1U << channelIndex)) != (uint8)0U) && \
+         ((ftmIcuBase[moduleIndex]->CONTROLS[channelIndex].CSC & FTM_CSC_CHIE_MASK) != (uint8)0U) )
+    {
+        Ftm_Icu_Ip_ProcessInterrupt(moduleIndex, channelIndex);
+    }
+    
+    if ( ((isrStatus & (uint8)(1U << nextChannelIndex)) != (uint8)0U) && \
+         ((ftmIcuBase[moduleIndex]->CONTROLS[nextChannelIndex].CSC & FTM_CSC_CHIE_MASK) != (uint8)0U) )
+    {
+        Ftm_Icu_Ip_ProcessInterrupt(moduleIndex, nextChannelIndex);
+    }
+}
+#endif /* All pair channels defines. */
+
+#if ((defined FTM_ICU_0_OVF_ISR_USED) || (defined FTM_ICU_1_OVF_ISR_USED) || (defined FTM_ICU_2_OVF_ISR_USED) || (defined FTM_ICU_3_OVF_ISR_USED) || \
+     (defined FTM_ICU_4_OVF_ISR_USED) || (defined FTM_ICU_5_OVF_ISR_USED) || (defined FTM_ICU_6_OVF_ISR_USED) || (defined FTM_ICU_7_OVF_ISR_USED))
+static inline void Ftm_Icu_Ip_TofHandler(uint8 moduleIndex)
+{
+    /* Read TOF value and verify if it was an overflow. */
+    if (FTM_SC_TOF_MASK  == (ftmIcuBase[moduleIndex]->SC & (uint32)FTM_SC_TOF_MASK) &&  \
+        FTM_SC_TOIE_MASK == (ftmIcuBase[moduleIndex]->SC & (uint32)FTM_SC_TOIE_MASK))
+    {
+        /* Clear timer overflow flag */
+        ftmIcuBase[moduleIndex]->SC &= ~(FTM_SC_TOF_MASK);
+        Ftm_Icu_Ip_ProcessTofInterrupt(moduleIndex);
+    }
+}
+#endif /* All timeroveflow defines. */
+
+#if ((defined FTM_ICU_0_ISR_USED) || (defined FTM_ICU_1_ISR_USED) || \
+    (defined FTM_ICU_0_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_0_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_0_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_0_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_1_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_1_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_1_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_1_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_2_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_2_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_2_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_2_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_3_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_3_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_3_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_3_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_4_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_4_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_4_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_4_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_5_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_5_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_5_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_5_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_6_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_6_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_6_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_6_CH_6_CH_7_ISR_USED) || \
+    (defined FTM_ICU_7_CH_0_CH_1_ISR_USED) || (defined FTM_ICU_7_CH_2_CH_3_ISR_USED) || (defined FTM_ICU_7_CH_4_CH_5_ISR_USED) || (defined FTM_ICU_7_CH_6_CH_7_ISR_USED))
+
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+
+static inline void Ftm_Icu_Ip_PeriodTime(uint8 instance, uint8 hwchannel, boolean overflow)
+{
+    uint16 firstChannelCV    = 0U;
+    uint16 period            = 0U;
+    /* Save hwchannel Value (CV) for first hardware channels */
+    firstChannelCV  =  (uint16)ftmIcuBase[instance]->CONTROLS[(hwchannel)].CV;
+
+    if(TRUE == Ftm_Icu_Ip_ChState[instance][hwchannel].firstEdge)
+    {
+        /* If the first edge is detected, save the value of the counter. */
+        Icu_Ftm_ActivationPulseTemp[instance][hwchannel]  = (uint16)firstChannelCV;
+        /* Prepare the second measurement. */
+        Ftm_Icu_Ip_ChState[instance][hwchannel].firstEdge = FALSE;
+    }
+    else
+    {
+        /* Calculate period and make the callback. */
+        if(firstChannelCV > Icu_Ftm_ActivationPulseTemp[instance][hwchannel])
+        {
+            period = firstChannelCV - Icu_Ftm_ActivationPulseTemp[instance][hwchannel];
+        }
+        else
+        {
+            period = (uint16)((uint16)FTM_MAX_VAL_COUNTER  - (uint16)Icu_Ftm_ActivationPulseTemp[instance][hwchannel]) + firstChannelCV + (uint16)1U;
+        }
+
+        /* Callback to process data from interrupt. */
+        Ftm_Icu_Ip_SignalMeasurementHandler(instance, hwchannel, 0U, period, overflow);
+    }
+}
+
+static inline void Ftm_Icu_Ip_DutyCycle(uint8 instance, uint8 hwchannel, boolean overflow)
+{
+    uint16 firstChannelCV    = 0U;
+    uint16 secondChannelCV   = 0U;
+    uint16 firstChannelEdge  = 0U;
+    uint16 secondChannelEdge = 0U;
+    uint16 period            = 0U;
+    uint16 pulseWidth        = 0U;
+    /* If it's the first activation edge remove from queue. */
+    if(TRUE == Ftm_Icu_Ip_ChState[instance][hwchannel].firstEdge)
+    {
+        /* Save hwchannel Status and Control (CSC) for the n and n+1 hardware channels */
+        firstChannelEdge  =  (uint16)ftmIcuBase[instance]->CONTROLS[hwchannel].CSC;
+        secondChannelEdge =  (uint16)ftmIcuBase[instance]->CONTROLS[(hwchannel + 1U)].CSC;
+        /* Save Activation Pulse Temp */
+        Icu_Ftm_ActivationPulseTemp[instance][hwchannel] = (uint16)ftmIcuBase[instance]->CONTROLS[hwchannel].CV;
+
+        
+        if (((firstChannelEdge & FTM_CSC_ELSB_MASK) > 0U) && ((firstChannelEdge & FTM_CSC_ELSA_MASK) > 0U))
+        {
+            if ((ftmIcuBase[instance]->CONTROLS[hwchannel].CSC & FTM_CSC_CHIS_MASK) > 0U)
+            {
+
+                firstChannelEdge  &= ~((uint16)FTM_CSC_ELSB_MASK);
+                secondChannelEdge &= ~((uint16)FTM_CSC_ELSA_MASK);
+            }
+            else
+            {
+                firstChannelEdge  &= ~((uint16)FTM_CSC_ELSA_MASK);
+                secondChannelEdge &= ~((uint16)FTM_CSC_ELSB_MASK);
+                Ftm_Icu_Ip_ChState[instance][hwchannel].firstEdgePolarity = TRUE;
+            }
+        }
+
+        SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_33();
+        {
+            /* Set the combine mode */
+            ftmIcuBase[instance]->COMBINE |= ((uint32)FTM_COMBINE_DECAPEN0_MASK << ((uint32)8U * ((uint32)hwchannel / (uint32)2U)));
+            ftmIcuBase[instance]->COMBINE |= ((uint32)FTM_COMBINE_DECAP0_MASK << ((uint32)8U * ((uint32)hwchannel / (uint32)2U)));
+            /* Dual Edge Capture - Continouos Capture Mode. */
+            ftmIcuBase[instance]->CONTROLS[hwchannel].CSC |= FTM_CSC_MSA_MASK;
+            /* Edge Polarity Selection for hwchannel. */
+            ftmIcuBase[instance]->CONTROLS[hwchannel].CSC &= ~(FTM_CSC_ELSB_MASK | FTM_CSC_ELSA_MASK);
+            ftmIcuBase[instance]->CONTROLS[hwchannel].CSC |= (uint32)((FTM_CSC_ELSB_MASK | FTM_CSC_ELSA_MASK) & ((uint32)secondChannelEdge));
+            ftmIcuBase[instance]->CONTROLS[(hwchannel + 1U)].CSC &= ~(FTM_CSC_ELSB_MASK | FTM_CSC_ELSA_MASK);
+            ftmIcuBase[instance]->CONTROLS[(hwchannel + 1U)].CSC |= (uint32)((FTM_CSC_ELSB_MASK | FTM_CSC_ELSA_MASK) & ((uint32)firstChannelEdge));
+            /* Clear the flag and enable interrupts for the n+1 hwchannel */
+            ftmIcuBase[instance]->CONTROLS[(hwchannel + 1U)].CSC &= ~(FTM_CSC_CHF_MASK);
+            ftmIcuBase[instance]->CONTROLS[(hwchannel + 1U)].CSC |= FTM_CSC_CHIE_MASK;
+            /* Clear interrupt flag on the n hwchannel */
+            ftmIcuBase[instance]->CONTROLS[hwchannel].CSC &= ~(FTM_CSC_CHIE_MASK);
+        }
+        SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_33();
+
+        /* Prepare the second measurement. */
+        Ftm_Icu_Ip_ChState[instance][hwchannel].firstEdge = FALSE;
+    }
+    else
+    {
+        /* Save the Counter Value (CV) for the n and the n+1 channels */
+        firstChannelCV  =  (uint16)ftmIcuBase[instance]->CONTROLS[(hwchannel - 1U)].CV;
+        secondChannelCV =  (uint16)ftmIcuBase[instance]->CONTROLS[(hwchannel)].CV;
+
+        /* At the 2nd edge, compute the Period and Active Pulse Width and make the callback. */
+        if (secondChannelCV > Icu_Ftm_ActivationPulseTemp[instance][(hwchannel - 1U)])
+        {
+            period = secondChannelCV - Icu_Ftm_ActivationPulseTemp[instance][(hwchannel - 1U)];
+        }
+        else
+        {
+            period = (uint16)((uint16)FTM_MAX_VAL_COUNTER - Icu_Ftm_ActivationPulseTemp[instance][(hwchannel - 1U)]) + secondChannelCV + (uint16)1U;
+        }
+        if (firstChannelCV > Icu_Ftm_ActivationPulseTemp[instance][(hwchannel - 1U)])
+        {
+            pulseWidth = firstChannelCV - Icu_Ftm_ActivationPulseTemp[instance][(hwchannel - 1U)];
+        }
+        else
+        {
+            pulseWidth = (uint16)((uint16)FTM_MAX_VAL_COUNTER - (uint16)Icu_Ftm_ActivationPulseTemp[instance][(hwchannel - 1U)]) + firstChannelCV +  (uint16)1U;
+        }
+        if (TRUE == Ftm_Icu_Ip_ChState[instance][(hwchannel - 1U)].firstEdgePolarity)
+        {
+            pulseWidth = period - pulseWidth;
+        }
+        Icu_Ftm_ActivationPulseTemp[instance][(hwchannel - 1U)] = (uint16)secondChannelCV;
+        /* Callback to process data from interrupt. */
+        Ftm_Icu_Ip_SignalMeasurementHandler(instance, (hwchannel - 1U), pulseWidth, period, overflow);
+    }
+}
+
+/**
+ * @brief Ftm_Icu_Ip_SignalMeasurement - process the signal measurement data
+ * 
+ * @param instance 
+ * @param hwchannel 
+ * @param bOverflow 
+ */
+static inline void Ftm_Icu_Ip_SignalMeasurement(uint8 instance, uint8 hwchannel, boolean overflow)
+{
+    uint16 firstChannelCV    = 0U;
+    uint16 secondChannelCV   = 0U;
+
+    uint16 pulseWidth        = 0U;
+    Ftm_Icu_Ip_MeasType measProperty = Ftm_Icu_Ip_ChState[instance][hwchannel].measurement;
+
+    if ((FTM_ICU_HIGH_TIME == measProperty) ||  (FTM_ICU_LOW_TIME == measProperty))
+    {
+        /* Save hwchannel Value (CV) for the n and n+1 hardware channels */
+        firstChannelCV  =  (uint16)ftmIcuBase[instance]->CONTROLS[(hwchannel - 1U)].CV;
+        secondChannelCV =  (uint16)ftmIcuBase[instance]->CONTROLS[(hwchannel)].CV;
+
+        /* Calculate Active Pulse Width and make the callback. */
+        if(secondChannelCV > firstChannelCV)
+        {
+            pulseWidth = (uint16)(secondChannelCV - firstChannelCV);
+        }
+        else
+        {
+            pulseWidth = (uint16)(FTM_MAX_VAL_COUNTER - firstChannelCV) + secondChannelCV + (uint16)1U;
+        }
+        /* Callback to process data from interrupt. */
+        Ftm_Icu_Ip_SignalMeasurementHandler(instance, (hwchannel - 1U), pulseWidth, 0U, overflow);
+    }
+    else if (FTM_ICU_PERIOD_TIME == measProperty)
+    {
+        Ftm_Icu_Ip_PeriodTime(instance, hwchannel, overflow);
+    }
+    else if (FTM_ICU_DUTY_CYCLE == measProperty)
+    {
+        Ftm_Icu_Ip_DutyCycle(instance, hwchannel, overflow);
+    }
+    else
+    {
+        /* Do nothing. */
+    }
+}
+#endif /* STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API */
+
+/**
+ * @brief Ftm IP function that get the state of the overflow flag
+ * 
+ * @param instance 
+ * 
+ * @return      boolean      the state of the overflow flag
+ * @retval      TRUE         the overflow flag is set
+ * @retval      FALSE        the overflow flag is not set
+ */
+static inline boolean Ftm_Icu_Ip_GetOverflowIrq(uint8 instance)
+{
+    /* Get timer overflow flag */
+    uint32 statusTOF = ftmIcuBase[instance]->SC & FTM_SC_TOF_MASK;
+
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_20();
+    /* Clear overflow flag */
+    ftmIcuBase[instance]->SC = ftmIcuBase[instance]->SC & (~FTM_SC_TOF_MASK);
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_20();
+
+    /* Get and return the state of the overflow flag */
+    return (FTM_SC_TOF_MASK == (statusTOF & FTM_SC_TOF_MASK));
+}
+
+static inline void Ftm_Icu_Ip_ProcessInterrupt(uint8 instance, uint8 hwchannel)
+{
+    /* Measurement mode of the current hwchannel. */
+    Ftm_Icu_Ip_ModeType measMode = Ftm_Icu_Ip_ChState[instance][hwchannel].channelMode;
+    boolean bOverflow = Ftm_Icu_Ip_GetOverflowIrq(instance);
+
+    switch (measMode)
+    {
+#if (STD_ON == FTM_ICU_EDGE_DETECT_API)
+        case FTM_ICU_MODE_SIGNAL_EDGE_DETECT:
+        {
+            Ftm_Icu_Ip_ReportEvents(instance, hwchannel, bOverflow);
+        }
+        break;
+#endif
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+        case FTM_ICU_MODE_TIMESTAMP:
+        {
+            /* Copy the Counter value in the Timestamp Buffer. */
+            Ftm_Icu_Ip_aBufferPtr[instance][hwchannel] = (uint16)ftmIcuBase[instance]->CONTROLS[hwchannel].CV;
+
+            /* Call timestamp handler. */
+            Ftm_Icu_Ip_TimestampHandler(instance, hwchannel, &Ftm_Icu_Ip_aBufferPtr[instance][hwchannel], bOverflow);
+        }
+        break;
+#endif
+#if (STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API)
+        case FTM_ICU_MODE_SIGNAL_MEASUREMENT:
+        {
+            Ftm_Icu_Ip_SignalMeasurement(instance, hwchannel, bOverflow);
+        }
+        break;
+#endif
+#if (STD_ON == FTM_ICU_EDGE_COUNT_API)
+        case FTM_ICU_MODE_EDGE_COUNTER:
+        {
+            Ftm_Icu_Ip_ChState[instance][hwchannel].edgeNumbers++;
+            if (0U == Ftm_Icu_Ip_ChState[instance][hwchannel].edgeNumbers)
+            {
+                bOverflow = TRUE;
+            }
+            else
+            {
+                bOverflow = FALSE;
+            }
+            
+            Ftm_Icu_Ip_ReportEvents(instance, hwchannel, bOverflow);
+        }
+        break;
+#endif /* STD_ON == ICU_EDGE_COUNT_API */
+        default:
+        {
+            /* Do nothing. */
+        }
+        break;
+    }
+}
+
+#if ((STD_ON == FTM_ICU_EDGE_DETECT_API) || (STD_ON == FTM_ICU_EDGE_COUNT_API))
+static inline void Ftm_Icu_Ip_ReportEvents(uint8   instance,
+                                           uint8   hwChannel,
+                                           boolean overflow)
+{   
+    /* Calling HLD Report Events for the logical channel */
+    if(Ftm_Icu_Ip_ChState[instance][hwChannel].callback != NULL_PTR)
+    {
+        Ftm_Icu_Ip_ChState[instance][hwChannel].callback(Ftm_Icu_Ip_ChState[instance][hwChannel].callbackParam, overflow);
+    }
+    else
+    {
+        /* Calling Notification for the IPL channel */
+        if ((NULL_PTR != Ftm_Icu_Ip_ChState[instance][hwChannel].ftmChannelNotification) && \
+           ((boolean)TRUE == Ftm_Icu_Ip_ChState[instance][hwChannel].notificationEnable))
+        {
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftmChannelNotification();
+        }
+        
+        /* Calling User Overflow Notification for the IPL channel */
+        if ( overflow && (NULL_PTR != Ftm_Icu_Ip_ChState[instance][hwChannel].ftmOverflowNotification))
+        {
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftmOverflowNotification();
+        }
+    }
+}
+#endif
+#endif
+
+#if (STD_ON == FTM_ICU_TIMESTAMP_API)
+/** @implements Ftm_Icu_Ip_TimestampHandler_Activity */
+static inline void Ftm_Icu_Ip_TimestampHandler(uint8         instance,
+                                               uint8         hwChannel,
+                                               const uint16* bufferPtr,
+                                               boolean       overflow)
+{
+    Ftm_Icu_Ip_ReportOverflow(instance, hwChannel, overflow);
+    
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBuffer[Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferIndex] = bufferPtr[0U];
+    Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferIndex++;
+
+    if (Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferIndex >= Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferSize)
+    {
+        if(FTM_ICU_CIRCULAR_BUFFER == Ftm_Icu_Ip_ChState[instance][hwChannel].timestampBufferType)
+        {
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferIndex = 0U;
+        }
+        else
+        {
+            Ftm_Icu_Ip_StopTimestamp(instance, hwChannel);
+            if (NULL_PTR != Ftm_Icu_Ip_ChState[instance][hwChannel].logicChStateCallback)
+            {
+                Ftm_Icu_Ip_ChState[instance][hwChannel].logicChStateCallback(Ftm_Icu_Ip_ChState[instance][hwChannel].callbackParam, (1U << 3), FALSE);
+            }
+        }
+    }
+
+    if (0U != Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferNotify)
+    {
+        Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aNotifyCount++;
+        if (Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aNotifyCount >= Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aBufferNotify)
+        {
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftm_Icu_Ip_aNotifyCount = 0U;
+            /* Call User Notification Function */
+            if ( (NULL_PTR != Ftm_Icu_Ip_ChState[instance][hwChannel].ftmChannelNotification) && \
+                 ((boolean)TRUE == Ftm_Icu_Ip_ChState[instance][hwChannel].notificationEnable))
+            {
+                Ftm_Icu_Ip_ChState[instance][hwChannel].ftmChannelNotification();
+            }
+        }
+    }
+}
+#endif /* FTM_ICU_TIMESTAMP_API */
+
+#if ((STD_ON == FTM_ICU_SIGNAL_MEASUREMENT_API) || (STD_ON == FTM_ICU_TIMESTAMP_API))
+static inline void Ftm_Icu_Ip_ReportOverflow(uint8   instance,
+                                             uint8   hwChannel,
+                                             boolean overflow)
+{
+    /* Calling HLD Report wakeup and overflow for the logical channel */
+    if(Ftm_Icu_Ip_ChState[instance][hwChannel].callback != NULL_PTR)
+    {
+        Ftm_Icu_Ip_ChState[instance][hwChannel].callback(Ftm_Icu_Ip_ChState[instance][hwChannel].callbackParam, overflow);
+    }
+    else
+    {
+        /* Calling User Overflow Notification for the IPL channel */
+        if ((NULL_PTR != Ftm_Icu_Ip_ChState[instance][hwChannel].ftmOverflowNotification) && overflow)
+        {
+            Ftm_Icu_Ip_ChState[instance][hwChannel].ftmOverflowNotification();
+        }
+    }
+}
+#endif
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+#if (defined FTM_ICU_0_ISR_USED)
+ISR(FTM_0_ISR)
+{
+    uint8  moduleIndex  = 0U;
+    uint8  channelIndex = 0U;
+    /* Read data from status and control register. */
+    uint8  isrStatus    = (uint8)ftmIcuBase[moduleIndex]->STATUS;
+#ifndef FTM_ICU_TOF_DISTINCT_LINE
+    uint32 ovfStatus = ftmIcuBase[moduleIndex]->SC & (uint32)FTM_SC_TOF_MASK;
+#endif
+
+    /* Clear channels interrupt flag. */
+    ftmIcuBase[moduleIndex]->STATUS = (uint8)Ftm_Icu_Ip_InsState[moduleIndex].spuriousMask;
+    /* Clear timer overflow flag. */
+    ftmIcuBase[moduleIndex]->SC &= ~(FTM_SC_TOF_MASK);
+
+#ifndef FTM_ICU_TOF_DISTINCT_LINE
+    /* Read TOF value and verify if it was an overflow. */
+    if ( (ovfStatus != 0U) && FTM_SC_TOIE_MASK == (ftmIcuBase[moduleIndex]->SC & (uint32)FTM_SC_TOIE_MASK) )
+    {
+        Ftm_Icu_Ip_ProcessTofInterrupt(moduleIndex);
+    }
+#endif
+
+    /* Verify status for each hwchannel and process interrupt. */
+    for (channelIndex = 0U; channelIndex < FTM_ICU_IP_NUM_OF_CHANNELS; channelIndex++)
+    {
+        if ( ((isrStatus & (uint8)(1U << channelIndex)) != (uint8)0U) && \
+             (ftmIcuBase[moduleIndex]->CONTROLS[channelIndex].CSC & FTM_CSC_CHIE_MASK) )
+        {
+            Ftm_Icu_Ip_ProcessInterrupt(moduleIndex, channelIndex);
+        }
+    }
+    EXIT_INTERRUPT();
+}
+#endif /* FTM_ICU_0_ISR_USED */
+
+#if (defined FTM_ICU_1_ISR_USED)
+ISR(FTM_1_ISR)
+{
+    uint8  moduleIndex  = 1U;
+    uint8  channelIndex = 0U;
+    /* Read data from status and control register. */
+    uint8  isrStatus    = (uint8)ftmIcuBase[moduleIndex]->STATUS;
+#ifndef FTM_ICU_TOF_DISTINCT_LINE
+    uint32 ovfStatus = ftmIcuBase[moduleIndex]->SC & (uint32)FTM_SC_TOF_MASK;
+#endif
+
+    /* Clear channels interrupt flag. */
+    ftmIcuBase[moduleIndex]->STATUS = (uint8)Ftm_Icu_Ip_InsState[moduleIndex].spuriousMask;
+    /* Clear timer overflow flag. */
+    ftmIcuBase[moduleIndex]->SC &= ~(FTM_SC_TOF_MASK);
+
+#ifndef FTM_ICU_TOF_DISTINCT_LINE
+    /* Read TOF value and verify if it was an overflow. */
+    if ( (ovfStatus != 0U) && FTM_SC_TOIE_MASK == (ftmIcuBase[moduleIndex]->SC & (uint32)FTM_SC_TOIE_MASK) )
+    {
+        Ftm_Icu_Ip_ProcessTofInterrupt(moduleIndex);
+    }
+#endif
+
+    /* Verify status for each hwchannel and process interrupt. */
+    for (channelIndex = 0U; channelIndex < FTM_ICU_IP_NUM_OF_CHANNELS; channelIndex++)
+    {
+        if ( ((isrStatus & (uint8)(1U << channelIndex)) != (uint8)0U) && \
+             (ftmIcuBase[moduleIndex]->CONTROLS[channelIndex].CSC & FTM_CSC_CHIE_MASK) )
+        {
+            Ftm_Icu_Ip_ProcessInterrupt(moduleIndex, channelIndex);
+        }
+    }
+    EXIT_INTERRUPT();
+}
+#endif /* FTM_ICU_1_ISR_USED */
+
+#if (defined FTM_ICU_0_CH_0_CH_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 0 channel 0 - channel 1.
+ */
+ISR(FTM_0_CH_0_CH_1_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(0U, 0U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_0_CH_2_CH_3_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 0 channel 2 - channel 3.
+ */
+ISR(FTM_0_CH_2_CH_3_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(0U, 2U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_0_CH_4_CH_5_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 0 channel 4 - channel 5.
+ */
+ISR(FTM_0_CH_4_CH_5_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(0U, 4U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_0_CH_6_CH_7_ISR_USED)
+ISR(FTM_0_CH_6_CH_7_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(0U, 6U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_1_CH_0_CH_1_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 1 channel 0 - channel 1.
+ */
+ISR(FTM_1_CH_0_CH_1_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(1U, 0U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_1_CH_2_CH_3_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 1 channel 2 - channel 3.
+ */
+ISR(FTM_1_CH_2_CH_3_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(1U, 2U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_1_CH_4_CH_5_ISR_USED)
+/**
+ * @brief          Independent interrupt handler.
+ * @details        Interrupt handler for FTM module 1 channel 4 - channel 5.
+ */
+ISR(FTM_1_CH_4_CH_5_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(1U, 4U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_1_CH_6_CH_7_ISR_USED)
+ISR(FTM_1_CH_6_CH_7_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(1U, 6U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_2_CH_0_CH_1_ISR_USED)
+ISR(FTM_2_CH_0_CH_1_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(2U, 0U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_2_CH_2_CH_3_ISR_USED)
+ISR(FTM_2_CH_2_CH_3_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(2U, 2U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_2_CH_4_CH_5_ISR_USED)
+ISR(FTM_2_CH_4_CH_5_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(2U, 4U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_2_CH_6_CH_7_ISR_USED)
+ISR(FTM_2_CH_6_CH_7_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(2U, 6U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_3_CH_0_CH_1_ISR_USED)
+ISR(FTM_3_CH_0_CH_1_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(3U, 0U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_3_CH_2_CH_3_ISR_USED)
+ISR(FTM_3_CH_2_CH_3_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(3U, 2U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_3_CH_4_CH_5_ISR_USED)
+ISR(FTM_3_CH_4_CH_5_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(3U, 4U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_3_CH_6_CH_7_ISR_USED)
+ISR(FTM_3_CH_6_CH_7_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(3U, 6U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_4_CH_0_CH_1_ISR_USED)
+ISR(FTM_4_CH_0_CH_1_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(4U, 0U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_4_CH_2_CH_3_ISR_USED)
+ISR(FTM_4_CH_2_CH_3_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(4U, 2U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_4_CH_4_CH_5_ISR_USED)
+ISR(FTM_4_CH_4_CH_5_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(4U, 4U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_4_CH_6_CH_7_ISR_USED)
+ISR(FTM_4_CH_6_CH_7_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(4U, 6U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_5_CH_0_CH_1_ISR_USED)
+ISR(FTM_5_CH_0_CH_1_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(5U, 0U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_5_CH_2_CH_3_ISR_USED)
+ISR(FTM_5_CH_2_CH_3_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(5U, 2U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_5_CH_4_CH_5_ISR_USED)
+ISR(FTM_5_CH_4_CH_5_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(5U, 4U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_5_CH_6_CH_7_ISR_USED)
+ISR(FTM_5_CH_6_CH_7_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(5U, 6U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_6_CH_0_CH_1_ISR_USED)
+ISR(FTM_6_CH_0_CH_1_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(6U, 0U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_6_CH_2_CH_3_ISR_USED)
+ISR(FTM_6_CH_2_CH_3_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(6U, 2U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_6_CH_4_CH_5_ISR_USED)
+ISR(FTM_6_CH_4_CH_5_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(6U, 4U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_6_CH_6_CH_7_ISR_USED)
+ISR(FTM_6_CH_6_CH_7_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(6U, 6U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_7_CH_0_CH_1_ISR_USED)
+ISR(FTM_7_CH_0_CH_1_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(7U, 0U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_7_CH_2_CH_3_ISR_USED)
+ISR(FTM_7_CH_2_CH_3_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(7U, 2U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_7_CH_4_CH_5_ISR_USED)
+ISR(FTM_7_CH_4_CH_5_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(7U, 4U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_7_CH_6_CH_7_ISR_USED)
+ISR(FTM_7_CH_6_CH_7_ISR)
+{
+    Ftm_Icu_Ip_PairChHandler(7U, 6U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_0_OVF_ISR_USED)
+ISR(FTM_0_OVF_ISR)
+{
+    Ftm_Icu_Ip_TofHandler(0U);
+    EXIT_INTERRUPT();
+}
+#endif /* FTM_ICU_0_OVF_ISR_USED */
+
+#if (defined FTM_ICU_1_OVF_ISR_USED)
+ISR(FTM_1_OVF_ISR)
+{
+    Ftm_Icu_Ip_TofHandler(1U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_2_OVF_ISR_USED)
+ISR(FTM_2_OVF_ISR)
+{
+    Ftm_Icu_Ip_TofHandler(2U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_3_OVF_ISR_USED)
+ISR(FTM_3_OVF_ISR)
+{
+    Ftm_Icu_Ip_TofHandler(3U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_4_OVF_ISR_USED)
+ISR(FTM_4_OVF_ISR)
+{
+    Ftm_Icu_Ip_TofHandler(4U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_5_OVF_ISR_USED)
+ISR(FTM_5_OVF_ISR)
+{
+    Ftm_Icu_Ip_TofHandler(5U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_6_OVF_ISR_USED)
+ISR(FTM_6_OVF_ISR)
+{
+    Ftm_Icu_Ip_TofHandler(6U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined FTM_ICU_7_OVF_ISR_USED)
+ISR(FTM_7_OVF_ISR)
+{
+    Ftm_Icu_Ip_TofHandler(7U);
+    EXIT_INTERRUPT();
+}
+#endif
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 2895 - 0
RTD/src/Icu.c

@@ -0,0 +1,2895 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file
+ *
+ *     @addtogroup icu Icu Driver
+ *     @{
+ */
+ 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*==================================================================================================
+ *                                          INCLUDE FILES
+ *  1) system and project includes
+ *  2) needed interfaces from external units
+ *  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "OsIf.h"
+#include "Icu.h"
+#include "Icu_EnvCfg.h"
+#include "Icu_Ipw.h"
+#include "Icu_Irq.h"
+
+#include "SchM_Icu.h"
+#if ((ICU_DEV_ERROR_DETECT == STD_ON) || (ICU_TIMESTAMP_API == STD_ON))
+    #include "Det.h"
+#endif
+
+/*==================================================================================================
+*                                  SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_VENDOR_ID_C                     43
+#define ICU_AR_RELEASE_MAJOR_VERSION_C      4
+#define ICU_AR_RELEASE_MINOR_VERSION_C      4
+#define ICU_AR_RELEASE_REVISION_VERSION_C   0
+#define ICU_SW_MAJOR_VERSION_C              1
+#define ICU_SW_MINOR_VERSION_C              0
+#define ICU_SW_PATCH_VERSION_C              0
+
+/*==================================================================================================
+ *                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if current file and Mcal header file are of the same Autosar version */
+    #if ((ICU_AR_RELEASE_MAJOR_VERSION_C != MCAL_AR_RELEASE_MAJOR_VERSION) || \
+         (ICU_AR_RELEASE_MINOR_VERSION_C != MCAL_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Icu.c and Mcal.h are different"
+    #endif
+    
+    /* Check if source file and SchM_Icu.h file are of the same Autosar version */
+    #if ((ICU_AR_RELEASE_MAJOR_VERSION_C != SCHM_ICU_AR_RELEASE_MAJOR_VERSION) || \
+         (ICU_AR_RELEASE_MINOR_VERSION_C != SCHM_ICU_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Icu.c and SchM_Icu.h are different"
+    #endif
+
+    /* Check if this header file and OsIf.h file are of the same Autosar version */
+    #if ((ICU_AR_RELEASE_MAJOR_VERSION_C != OSIF_AR_RELEASE_MAJOR_VERSION) || \
+        (ICU_AR_RELEASE_MINOR_VERSION_C != OSIF_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of  and OsIf.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_VENDOR_ID_C != ICU_VENDOR_ID)
+    #error "Icu.c and Icu.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_AR_RELEASE_MAJOR_VERSION_C != ICU_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION_C != ICU_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION_C != ICU_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu.c and Icu.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_SW_MAJOR_VERSION_C != ICU_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION_C != ICU_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION_C != ICU_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu.c and Icu.h are different"
+#endif
+
+/* Check if source file and Icu_EnvCfg header file are of the same vendor */
+#if (ICU_VENDOR_ID_C != ICU_ENVCFG_VENDOR_ID)
+    #error "Icu.c and Icu_EnvCfg.h have different vendor IDs"
+#endif
+/* Check if source file and Icu_EnvCfg header file are of the same AutoSar version */
+#if ((ICU_AR_RELEASE_MAJOR_VERSION_C != ICU_ENVCFG_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION_C != ICU_ENVCFG_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION_C != ICU_ENVCFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu.c and Icu_EnvCfg.h are different"
+#endif
+/* Check if source file and Icu_EnvCfg header file are of the same Software version */
+#if ((ICU_SW_MAJOR_VERSION_C != ICU_ENVCFG_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION_C != ICU_ENVCFG_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION_C != ICU_ENVCFG_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu.c and Icu_EnvCfg.h are different"
+#endif
+
+/* Check if source file and ICU IPW header file are of the same vendor */
+#if (ICU_VENDOR_ID_C != ICU_IPW_VENDOR_ID)
+#error "Icu.c and Icu_Ipw.h have different vendor IDs"
+#endif
+/* Check if source file and Icu_Ipw header file are of the same version */
+#if ((ICU_AR_RELEASE_MAJOR_VERSION_C != ICU_IPW_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION_C != ICU_IPW_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION_C != ICU_IPW_AR_RELEASE_REVISION_VERSION))
+#error "Autosar Version Numbers of Icu.c and Icu_Ipw.h are different"
+#endif
+/* Check if source file and Icu_Ipw header file are of the same Software Version */
+#if ((ICU_SW_MAJOR_VERSION_C != ICU_IPW_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION_C != ICU_IPW_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION_C != ICU_IPW_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu.c and Icu_Ipw.h are different"
+#endif
+
+/* Check if source file and DET header file are of the same version */
+#if (ICU_DEV_ERROR_DETECT == STD_ON)
+    #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+        #if ((ICU_AR_RELEASE_MAJOR_VERSION_C != DET_AR_RELEASE_MAJOR_VERSION) || \
+             (ICU_AR_RELEASE_MINOR_VERSION_C != DET_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Icu.c and Det.h are different"
+        #endif
+    #endif
+#endif /* ICU_DEV_ERROR_DETECT */
+
+/* Check if source file and ICU IRQ header file are of the same vendor */
+#if (ICU_VENDOR_ID_C != ICU_IRQ_VENDOR_ID)
+    #error "Icu.c and Icu_Irq.h have different vendor IDs"
+#endif
+/* Check if source file and ICU IRQ header file are of the same version */
+#if ((ICU_AR_RELEASE_MAJOR_VERSION_C != ICU_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION_C != ICU_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION_C != ICU_IRQ_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu.c and Icu_Irq.h are different"
+#endif
+/* Check if source file and ICU IRQ header are of the same Software version */
+#if ((ICU_SW_MAJOR_VERSION_C != ICU_IRQ_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION_C != ICU_IRQ_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION_C != ICU_IRQ_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu.c and Icu_Irq.h are different"
+#endif
+/*==================================================================================================
+ *                           LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
+==================================================================================================*/
+
+#if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) || (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON))
+typedef enum
+{
+    ICU_STATE_UNINIT = 0x00,
+    ICU_STATE_IDLE
+} Icu_eGlobalStateType;
+#endif /* ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) || (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)) */
+
+/*==================================================================================================
+*                                          LOCAL MACROS
+==================================================================================================*/
+
+#if (ICU_MULTICORE_SUPPORT == STD_ON)
+    #define Icu_GetCoreID()   (uint32)OsIf_GetCoreID()
+#else
+    #define Icu_GetCoreID()   ((uint32)0UL)
+#endif
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+/**
+* @brief      This function ends the validation of calling a function on a channel
+* @details    This service is a non reentrant function on channel used for ending the validation
+*                for the calls for functions that use one channel
+*
+* @param[in]   validation The function call was previously validated
+*
+* @return void
+*
+* where they are interchangeable.
+*/
+#define Icu_EndValidateCallAndChannel(validation)
+#endif /* (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)*/
+
+/*==================================================================================================
+ *                                        LOCAL CONSTANTS
+==================================================================================================*/
+
+
+/*==================================================================================================
+ *                                        LOCAL VARIABLES
+==================================================================================================*/
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) || (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON))
+static Icu_eGlobalStateType Icu_GlobalState[ICU_MAX_PARTITIONS] = {ICU_STATE_UNINIT};
+#endif /* ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) || (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)) */
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
+#include "Icu_MemMap.h"
+
+#if (ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON)
+/** @brief Array for saving value of DMA **/
+static volatile Icu_ValueType Icu_aDmaBuffer[ICU_MAX_CHANNEL][ICU_DMA_MAJORLOOP_COUNT];
+
+/** @brief Array for saving the period */
+static volatile Icu_ValueType Icu_aIsSecondInterrupt[ICU_MAX_CHANNEL];
+
+/** @brief Array for saving the period */
+static volatile Icu_ValueType Icu_aFirstEdgeTimeStamp[ICU_MAX_CHANNEL];
+
+#endif /* ICU_SIGNALMEASUREMENT_USES_DMA */
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
+
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+ *                                        GLOBAL CONSTANTS
+==================================================================================================*/
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#ifdef ICU_PRECOMPILE_SUPPORT
+
+#if (ICU_MULTICORE_SUPPORT == STD_ON)
+extern const Icu_ConfigType* const Icu_Config[ICU_MAX_PARTITIONS];
+#else
+extern const Icu_ConfigType Icu_Config;
+#endif
+
+#endif /*ICU_PRECOMPILE_SUPPORT*/
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+ *                                        GLOBAL VARIABLES
+==================================================================================================*/
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/** @brief Pointer initialized during init with the address of the received configuration structure.
+  *        Will be used by all functions to access the configuration data. */
+const Icu_ConfigType * Icu_pCfgPtr[ICU_MAX_PARTITIONS];
+
+/** @brief Saves the current Icu mode. */
+Icu_ModeType                  Icu_CurrentMode;
+
+/** @brief Stores actual state and configuration of ICU Channels. */
+volatile Icu_ChannelStateType Icu_aChannelState[ICU_MAX_CHANNEL];
+
+#if (STD_ON == ICU_TIMESTAMP_API)
+/** @brief Pointer to the buffer-array where the timestamp values shall be placed. */
+Icu_ValueType            *Icu_aBuffer[ICU_MAX_CHANNEL];
+
+/** @brief Array for saving the size of the external buffer (number of entries). */
+Icu_ValueType            Icu_aBufferSize[ICU_MAX_CHANNEL];
+
+/** @brief Array for saving Notification interval (number of events). */
+Icu_ValueType            Icu_aBufferNotify[ICU_MAX_CHANNEL];
+
+/** @brief Array for saving the number of notify counts. */
+volatile Icu_ValueType   Icu_aNotifyCount[ICU_MAX_CHANNEL];
+
+/** @brief Array for saving the time stamp index. */
+volatile Icu_IndexType   Icu_aBufferIndex[ICU_MAX_CHANNEL];
+#endif /* ICU_TIMESTAMP_API */
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+ *                                    LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+/**
+ * @brief     Icu_SetBitChState
+ * @details   Set the Icu_aChannelState bitfield specified by mask parameter in an atomic way.
+ *
+ * @param[in] Channel   - The logical number of ICU channel for current configuration structure
+ * @param[in] mask      - bitfield mask
+ *
+ * @return void
+ */
+static inline void Icu_SetBitChState(Icu_ChannelType Channel, Icu_ChannelStateType mask);
+
+static inline Icu_ChannelStateType Icu_GetBitChState(Icu_ChannelType Channel, 
+                                                     Icu_ChannelStateType mask);
+
+static inline void Icu_ClearBitChState(Icu_ChannelType Channel, Icu_ChannelStateType mask);
+
+#if (STD_ON == ICU_VALIDATE_GLOBAL_CALL)
+static inline Std_ReturnType Icu_ValidateGlobalCall(uint8 u8ServiceId, uint32 u32CoreId);
+
+static inline void Icu_EndValidateGlobalCall(Std_ReturnType validation, uint8 u8ServiceId,
+                                             uint32 u32CoreId);
+#endif
+
+#if ((STD_ON == ICU_VALIDATE_GLOBAL_CALL) && (STD_ON == ICU_SET_MODE_API))
+static inline Std_ReturnType Icu_ValidateCallSetMode(Icu_ModeType Mode, uint32 u32CoreId);
+#endif
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+static inline Std_ReturnType Icu_ValidateCallAndChannel(Icu_ChannelType Channel, uint8 u8ModeMask,
+                                                        uint8 u8ServiceId, uint32 u32CoreId);
+#endif
+
+#if ((ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (ICU_VALIDATE_PARAMS == STD_ON))
+#if ((ICU_EDGE_COUNT_API == STD_ON) || (ICU_TIMESTAMP_API == STD_ON) || \
+     (ICU_GET_TIME_ELAPSED_API == STD_ON) || (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON) )
+static inline boolean Icu_GetOverflow(Icu_ChannelType Channel,
+                                                     uint8 u8ServiceId,
+                                                     uint8 u8Error,
+                                                     uint32 u32CoreId
+                                                    );
+#endif
+#endif  /* ((ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (ICU_VALIDATE_PARAMS == STD_ON) */
+
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+static inline Std_ReturnType Icu_ValidatePtrInit(uint32 u32CoreId,
+                                                                const Icu_ConfigType * ConfigPtr
+                                                               );
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON)*/
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_SET_MODE_API == STD_ON))
+static inline Std_ReturnType Icu_ValidateMode(Icu_ModeType Mode);
+#endif /*(ICU_VALIDATE_PARAMS == STD_ON) && (ICU_SET_MODE_API == STD_ON*/
+
+#if((ICU_VALIDATE_PARAMS == STD_ON) && \
+    ((ICU_WAKEUP_FUNCTIONALITY_API == STD_ON) || (ICU_ENABLE_WAKEUP_API == STD_ON)|| \
+     (ICU_DISABLE_WAKEUP_API == STD_ON)))
+
+static inline Std_ReturnType Icu_ValidateWakeupChannel(Icu_ChannelType Channel,
+                                                                      uint8 u8ServiceId,
+                                                                      uint32 u32CoreId
+                                                                     );
+#endif /* ICU_VALIDATE_PARAMS == STD_ON */
+
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+static inline Std_ReturnType Icu_ValidateActivation(Icu_ActivationType Activation);
+#endif /* ICU_VALIDATE_PARAMS == STD_ON) */
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_TIMESTAMP_API == STD_ON))
+static inline Std_ReturnType Icu_ValidateTimestamp(Icu_ChannelType Channel,
+                                                                  const Icu_ValueType * pBufferPtr,
+                                                                  uint16 u16BufferSize,
+                                                                  uint16 u16NotifyInterval,
+                                                                  uint32 u32CoreId
+                                                                 );
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (ICU_TIMESTAMP_API == STD_ON) */
+
+
+#if (ICU_TIMESTAMP_API == STD_ON)
+static inline Std_ReturnType Icu_ValidateChannelStartState(Icu_ChannelType Channel);
+#endif /* ICU_TIMESTAMP_API == STD_ON */
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && \
+        ((ICU_GET_TIME_ELAPSED_API == STD_ON) || (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON)))
+static inline Std_ReturnType Icu_ValidateSignalMeasurementProperty(Icu_ChannelType Channel,
+                                                                                  uint16 u16ModePropertyMask,
+                                                                                  uint8  u8ServiceId,
+                                                                                  uint32 u32CoreId
+                                                                                 );
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (...) */
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON))
+static inline Std_ReturnType Icu_ValidatePtrDutyCycle(const Icu_DutyCycleType * DutyCycleValues);
+#endif /* ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON))*/
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_VERSION_INFO_API == STD_ON))
+static inline Std_ReturnType Icu_ValidateVersionInfoCall(const Std_VersionInfoType * versioninfo);
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_VERSION_INFO_API == STD_ON */
+
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_DUAL_CLOCK_MODE_API == STD_ON))
+static inline Std_ReturnType Icu_ValidateClockModeCall(Icu_SelectPrescalerType Prescaler);
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (ICU_DUAL_CLOCK_MODE_API == STD_ON) */
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_INPUT_LEVEL_API == STD_ON))
+static inline Std_ReturnType Icu_ValidateGetInputLevel(Icu_ChannelType Channel,
+                                                       uint32 u32CoreId);
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_INPUT_LEVEL_API == STD_ON */
+
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+static inline Std_ReturnType Icu_ValidateModeForSetUpFeature(uint8 u8ApiId);
+#endif /* ICU_VALIDATE_GLOBAL_CALL == STD_ON */
+
+#if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) && ((ICU_GET_PULSE_WIDTH_API == STD_ON) && (ICU_SIGNAL_MEASUREMENT_API == STD_ON)))
+static inline Std_ReturnType Icu_ValidateSignalMeasureWithoutInterrupt(Icu_ChannelType Channel,
+                                                                       uint8  u8ServiceId,
+                                                                       uint32 u32CoreId);
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && ((ICU_GET_PULSE_WIDTH_API == STD_ON) && (ICU_SIGNAL_MEASUREMENT_API == STD_ON))*/
+
+static inline void Icu_CallNotification(Icu_ChannelType Channel,
+                                                       uint32 u32CoreId
+                                                       );
+
+static inline Icu_ChannelType Icu_ConvertChannelIndexToChannel(Icu_ChannelType ChannelIndex,
+                                                                              uint32 u32CoreId
+                                                                              );
+
+/*==================================================================================================
+ *                                        LOCAL FUNCTIONS
+==================================================================================================*/
+static inline void Icu_SetBitChState(Icu_ChannelType Channel, Icu_ChannelStateType mask)
+{
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_00();
+    {
+        Icu_aChannelState[Channel] |= mask;
+    }
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_00();
+}
+
+/**
+ * @brief      Icu_GetBitChState
+ * @details    Return the Icu_aChannelState bitfield specified by mask parameter in an atomic way.
+ *
+ * @param[in]  Channel  - The logical number of ICU channel for current configuration structure
+ * @param[in]  mask     - bitfield mask
+ * @return     Bitfield specified by mask parameter
+ * @retval     ICU_CHANNEL_STATE_WKUP Wakeup feature is currently enabled
+ * @retval     ICU_CHANNEL_STATE_IDLE The current channel status is idle
+ * @retval     ICU_CHANNEL_STATE_NOTIFICATION Notification is enabled
+ * @retval     ICU_CHANNEL_STATE_RUNNING The current channel state is Running
+ *
+ */
+static inline Icu_ChannelStateType Icu_GetBitChState(Icu_ChannelType Channel, Icu_ChannelStateType mask)
+{
+    return (uint8)(Icu_aChannelState[Channel] & mask);
+}
+
+/**
+ * @brief      Icu_ClearBitChState 
+ * @details    Clear the Icu_aChannelState bitfield specified by mask parameter in an atomic way.
+ *
+ * @param[in]  Channel   - The logical number of ICU channel for current configuration structure
+ * @param[in]  mask      - bitfield mask
+ *
+ * @return void
+ */
+static inline void Icu_ClearBitChState(Icu_ChannelType Channel, Icu_ChannelStateType mask)
+{
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_01();
+    {
+        Icu_aChannelState[Channel] &= ((Icu_ChannelStateType)(~mask));
+    }
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_01();
+}
+
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+/**
+ * @brief      This function validates the global call
+ * @details    This service is a non reentrant function used for validating the calls for functions
+ *                that uses all the channels - Icu_Init, Icu_DeInit, Icu_SetMode.
+ *
+ * @param[in]   u8ServiceId           The service id of the caller function
+ * @param[in]   u32CoreId             The number of current core ID
+ *
+ * @return         The validity of the function call
+ * @retval      E_OK      The function call is valid
+ * @retval      E_NOT_OK The function call is invalid
+ * @implements  Icu_ValidateGlobalCall_Activity
+ *
+ * */
+static inline Std_ReturnType Icu_ValidateGlobalCall(uint8 u8ServiceId,
+                                                    uint32 u32CoreId)
+{
+    Std_ReturnType valid = (Std_ReturnType)E_OK;
+
+    if (ICU_STATE_UNINIT == Icu_GlobalState[u32CoreId])
+    {
+        if (ICU_INIT_ID != u8ServiceId)
+        {
+            (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, u8ServiceId, ICU_E_UNINIT);
+            valid = (Std_ReturnType)E_NOT_OK;
+        }
+    }
+    else
+    {
+        if (ICU_INIT_ID == u8ServiceId)
+        {
+            (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, u8ServiceId, ICU_E_ALREADY_INITIALIZED);
+            valid = (Std_ReturnType)E_NOT_OK;
+        }
+    }
+    return valid;
+}
+#endif /* ICU_VALIDATE_GLOBAL_CALL == STD_ON */
+
+#if (STD_ON == ICU_VALIDATE_GLOBAL_CALL)
+/**
+ * @brief      This function ends the validation of the global call.
+ * @details    This service is a non reentrant function used for end the validation the calls for
+ *             functions that uses all the channels - Icu_Init, Icu_DeInit, Icu_SetMode.
+ *
+ * @param[in]   u8ServiceId     The service id of the caller function
+ * @param[in]   validation      The function call was previously validated
+ * @param[in]   u32CoreId       The number of current core ID
+ *
+ * @return void
+ *
+ */
+static inline void Icu_EndValidateGlobalCall(Std_ReturnType validation, uint8 u8ServiceId, uint32 u32CoreId)
+{
+    if ((Std_ReturnType)E_OK == validation)
+    {
+        if (ICU_DEINIT_ID == u8ServiceId)
+        {
+            Icu_GlobalState[u32CoreId] = ICU_STATE_UNINIT;
+        }
+        else
+        {
+            Icu_GlobalState[u32CoreId] = ICU_STATE_IDLE;
+        }
+    }
+}
+#endif /* STD_ON == ICU_VALIDATE_GLOBAL_CALL */
+
+#if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) && (ICU_SET_MODE_API == STD_ON))
+/**
+ * @brief      This function checks if running operations are performed while changing the Icu mode
+ *
+ * @param[in]   Mode        The mode that user wants to change to
+ * @param[in]   u32CoreId   The number of current core ID
+ *
+ * @return      The validity of the function call
+ * @retval      E_OK        The function call is valid
+ * @retval      E_NOT_OK    The function call is invalid
+ * @implements Icu_ValidateCallSetMode_Activity
+ */
+static inline Std_ReturnType Icu_ValidateCallSetMode(Icu_ModeType Mode, uint32 u32CoreId)
+{
+    Icu_ChannelType Channel;
+    Icu_ChannelType ChannelIndex;
+    Std_ReturnType valid = (Std_ReturnType)E_OK;
+    boolean bChRunning  = FALSE;
+
+    /*Check that there is no channel that is running and is not wake-up capable*/
+    if (Mode != Icu_CurrentMode)
+    {
+
+        for (ChannelIndex = 0U; ChannelIndex < Icu_pCfgPtr[u32CoreId]->nNumChannels; ChannelIndex++)
+        {  
+            /* Call low level function. */
+            Channel = Icu_ConvertChannelIndexToChannel(ChannelIndex, u32CoreId);
+            if((ICU_CHANNEL_STATE_RUNNING == Icu_GetBitChState(Channel, ICU_CHANNEL_STATE_RUNNING|ICU_CHANNEL_STATE_WKUP)))
+            {
+                bChRunning  = TRUE;
+                (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, ICU_SETMODE_ID, ICU_E_BUSY_OPERATION);
+                break;
+            }
+
+        }
+        valid = (TRUE == bChRunning)? (Std_ReturnType)E_NOT_OK : (Std_ReturnType)E_OK;
+    }
+    return valid;
+}
+#endif /*((ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON) && #if (ICU_SET_MODE_API == STD_ON))*/
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+/**
+ * @brief       This function validates the call for a specific channel
+ * @details     This service is a non reentrant function on channel used for validating the calls
+ *              for functions that use one channel
+ *
+ * @param[in]   Channel          Logical number of the ICU channel
+ * @param[in]   ModeMask         The modes that are valid for the specific channel
+ * @param[in]   u8ServiceId      The service id of the caller function
+ * @param[in]   u32CoreId        The number of current core ID
+ * @return         The validity of the function call
+ * @retval      E_OK      The function call is valid
+ * @retval      E_NOT_OK The function call is invalid
+ *
+ * @implements Icu_ValidateCallAndChannel_Activity
+ *
+ * */
+static inline Std_ReturnType Icu_ValidateCallAndChannel(Icu_ChannelType Channel, uint8 u8ModeMask,
+                                                        uint8 u8ServiceId, uint32 u32CoreId)
+{
+    Std_ReturnType valid = (Std_ReturnType)E_NOT_OK;
+    Icu_MeasurementModeType tempMode;
+    Icu_ChannelType ChannelIndex;
+    uint8 errorId;
+    boolean bReportError = FALSE;
+
+    if (ICU_STATE_UNINIT == Icu_GlobalState[u32CoreId])
+    {
+        bReportError = TRUE;
+        errorId = ICU_E_UNINIT;
+    }
+    else
+    {
+        if(ICU_MAX_CHANNEL <= Channel)
+        {
+            bReportError = TRUE;
+            errorId = ICU_E_PARAM_CHANNEL;
+        }
+        else
+        {
+            ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+            tempMode = (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_ChannelMode;
+
+            if (ChannelIndex > Icu_pCfgPtr[u32CoreId]->nNumChannels)
+            {
+                bReportError = TRUE;
+                errorId = ICU_E_PARAM_CONFIG;
+            }
+            else if ( (uint8)tempMode != (u8ModeMask & (uint8)tempMode) )
+            {
+                bReportError = TRUE;
+                errorId = ICU_E_PARAM_CHANNEL;
+            }
+            else
+            {
+                valid = (Std_ReturnType)E_OK;
+            }
+        }
+    }
+    if(bReportError)
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, u8ServiceId, errorId);
+    }
+    return valid;
+}
+#endif
+
+#if ((ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (ICU_VALIDATE_PARAMS == STD_ON))
+#if ((ICU_EDGE_COUNT_API == STD_ON) || (ICU_TIMESTAMP_API == STD_ON) || \
+     (ICU_GET_TIME_ELAPSED_API == STD_ON) || (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON) )
+/**
+ * @brief      This indicates the overflow status for a specific channel
+ * @details    In case the overflow notification is not activated, this service reports the overflow
+ *                status on a specific channel
+ *
+ * @param[in]   Channel              Logical number of the ICU channel
+ * @param[in]   u8ServiceId          The service id of the caller function
+ * @param[in]   u8Error              The error id that is reported in case of overflow
+ * @param[in]   u32CoreId            The number of current core ID
+ *
+ * @return      Status of the overflow flag
+ * @retval      TRUE          an overflow event occurred for the given channel
+ * @retval      FALSE         an overflow event has not occurred for a given channel
+ */
+static inline boolean Icu_GetOverflow(Icu_ChannelType Channel, uint8 u8ServiceId,
+                                      uint8 u8Error, uint32 u32CoreId)
+{
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    boolean bOverflow        = FALSE;
+    boolean bChOverflowState = FALSE;
+    uint8   ChannelIndex     = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+
+    /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+    ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+
+    if (ICU_CHANNEL_STATE_OVERFLOW == Icu_GetBitChState(Channel, ICU_CHANNEL_STATE_OVERFLOW))
+    {
+        bChOverflowState = TRUE;
+    }
+
+    if ((TRUE == Icu_Ipw_Get_Overflow(ChannelConfig)) || (TRUE == bChOverflowState))
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, (uint8)0U, u8ServiceId, u8Error);
+        bOverflow = TRUE;
+    }
+    return bOverflow;
+}
+#endif
+#endif  /* ((ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (ICU_VALIDATE_PARAMS == STD_ON) */
+
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+/**
+ * @brief       This function validate the initialization pointer.
+ *
+ * @param[in]   ConfigPtr   Pointer to a selected configuration structure.
+ *
+ * @return                  The validity of the function call
+ * @retval      E_OK        The function call is valid
+ * @retval      E_NOT_OK    The function call is invalid
+ *
+ * */
+static inline Std_ReturnType Icu_ValidatePtrInit(uint32 u32CoreId, const Icu_ConfigType * ConfigPtr)
+{
+    Std_ReturnType valid = (Std_ReturnType)E_OK;
+
+#ifdef ICU_PRECOMPILE_SUPPORT
+    if (NULL_PTR != ConfigPtr)
+    {
+#else
+    if (NULL_PTR == ConfigPtr)
+    {
+#endif /*ICU_PRECOMPILE_SUPPORT*/
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, ICU_INIT_ID, ICU_E_INIT_FAILED);
+        valid = (Std_ReturnType)E_NOT_OK;
+    }
+#ifndef ICU_PRECOMPILE_SUPPORT
+#if (ICU_MULTICORE_SUPPORT == STD_ON)
+    else if (u32CoreId != ConfigPtr->u32CoreId)
+    {
+        (void)Det_ReportError((uint16) ICU_MODULE_ID, 0U, ICU_INIT_ID, ICU_E_PARAM_CONFIG);
+        valid = (Std_ReturnType)E_NOT_OK;  
+    }
+#endif /*ICU_MULTICORE_SUPPORT*/
+    else
+    {
+        /* Do nothing */
+    }
+#else
+    else
+    {
+#if (ICU_MULTICORE_SUPPORT == STD_ON)
+        if (NULL_PTR == Icu_Config[u32CoreId])
+        {
+            /* Avoid compiler warning */
+            (void)u32CoreId;
+            (void)Det_ReportError((uint16) ICU_MODULE_ID, 0U, ICU_INIT_ID, ICU_E_INIT_FAILED);
+            valid = (Std_ReturnType)E_NOT_OK;
+        }
+        else if (u32CoreId != Icu_Config[u32CoreId]->u32CoreId)
+        {
+            (void)Det_ReportError((uint16) ICU_MODULE_ID, 0U, ICU_INIT_ID, ICU_E_PARAM_CONFIG);
+            valid = (Std_ReturnType)E_NOT_OK;
+        }
+        else
+        {
+            /* Do nothing */
+        }
+#endif /*ICU_MULTICORE_SUPPORT*/
+    }    
+#endif /*ICU_PRECOMPILE_SUPPORT*/
+    (void)u32CoreId;
+    return valid;
+}
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON)*/
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_SET_MODE_API == STD_ON))
+/**
+ * @brief       This function validate the mode that will be set in the driver.
+ *
+ * @param[in]   Mode        Specifies the operation mode
+ *
+ * @return                  The validity of the function call
+ * @retval      E_OK        The function call is valid
+ * @retval      E_NOT_OK    The function call is invalid
+ *
+ * @implements  Icu_ValidateMode_Activity
+ *
+ * */
+static inline Std_ReturnType Icu_ValidateMode(Icu_ModeType Mode)
+{
+    Std_ReturnType valid =  (Std_ReturnType)E_NOT_OK;
+
+    if ((ICU_MODE_SLEEP != Mode) && (ICU_MODE_NORMAL != Mode))
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, ICU_SETMODE_ID, ICU_E_PARAM_MODE);
+    }
+    else
+    {
+        valid = (Std_ReturnType)E_OK;
+    }
+    return valid;
+}
+#endif /*(ICU_VALIDATE_PARAMS == STD_ON) && (ICU_SET_MODE_API == STD_ON*/
+
+#if((ICU_VALIDATE_PARAMS == STD_ON) && \
+    ((ICU_WAKEUP_FUNCTIONALITY_API == STD_ON) || (ICU_ENABLE_WAKEUP_API == STD_ON)|| \
+     (ICU_DISABLE_WAKEUP_API == STD_ON)))
+/**
+ * @brief          This function validates a wakeup channel
+ *
+ * @param[in]   Channel            Logical number of the ICU channel
+ * @param[in]   u8ServiceId        The service id of the caller function
+ * @param[in]   u32CoreId          The number of current core ID
+ *
+ * @return                  The validity of the function call
+ * @retval      E_OK        The function call is valid
+ * @retval      E_NOT_OK    The function call is invalid
+ *
+ * @implements Icu_ValidateWkupChannel_Activity
+ * */
+static inline Std_ReturnType Icu_ValidateWakeupChannel(Icu_ChannelType Channel, uint8 u8ServiceId,
+                                                       uint32 u32CoreId)
+{
+    Std_ReturnType  valid =  (Std_ReturnType)E_OK;
+    Icu_ChannelType ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+    boolean   bWakeup = (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_WakeupCapabile;
+
+    if (TRUE != bWakeup)
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, u8ServiceId, ICU_E_PARAM_CHANNEL);
+        valid =  (Std_ReturnType)E_NOT_OK;
+    }
+    return valid;
+}
+#endif /* ICU_VALIDATE_PARAMS == STD_ON */
+
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+/**
+ * @brief      This service validates the activation condition.
+ *
+ * @param[in]   Activation       Type of activation.
+ *
+ * @return      The validity of the function call
+ * @retval      E_OK      The function call is valid
+ * @retval      E_NOT_OK The function call is invalid
+ *
+ * @implements Icu_ValidateActivation_Activity
+ *
+ * */
+static inline Std_ReturnType Icu_ValidateActivation(Icu_ActivationType Activation)
+{
+    Std_ReturnType valid = (Std_ReturnType)E_OK;
+
+    if ((ICU_RISING_EDGE != Activation) && (ICU_FALLING_EDGE != Activation) && \
+        (ICU_BOTH_EDGES != Activation))
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, ICU_SETACTIVATIONCONDITION_ID, ICU_E_PARAM_ACTIVATION);
+        valid = (Std_ReturnType)E_NOT_OK;
+    }
+    return valid;
+}
+#endif /* ICU_VALIDATE_PARAMS == STD_ON) */
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_TIMESTAMP_API == STD_ON))
+/**
+ * @brief          This function validate of the timestamp parameters.
+ * @details        This service validates the timestamp parameters passed to Icu_StartTimestamp.
+ *
+ * @param[in]   Channel             Logical number of the ICU channel
+ * @param[in]   pBufferPtr          Pointer to the buffer-array where the timestamp values shall be
+ *                                  placed.
+ * @param[in]   u16BufferSize       Size of the external buffer (number of entries)
+ * @param[in]   u16NotifyInterval   Notification interval (number of events).
+ * @param[in]   u32CoreId           The number of current core ID
+ *
+ * @return                  The validity of the function call
+ * @retval      E_OK        The function call is valid
+ * @retval      E_NOT_OK    The function call is invalid
+ *
+ * @implements  Icu_ValidateTimestamp_Activity
+ *
+ * */
+static inline Std_ReturnType Icu_ValidateTimestamp(Icu_ChannelType Channel, const Icu_ValueType * pBufferPtr,
+                                                   uint16 u16BufferSize, uint16 u16NotifyInterval,
+                                                   uint32 u32CoreId)
+{
+    Std_ReturnType  valid = (Std_ReturnType)E_NOT_OK;
+    Icu_ChannelType ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+
+    if (NULL_PTR == pBufferPtr)
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, ICU_STARTTIMESTAMP_ID, ICU_E_PARAM_POINTER);
+    }
+
+    else  if ((uint16)0U == u16BufferSize)
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, ICU_STARTTIMESTAMP_ID, ICU_E_PARAM_BUFFER_SIZE);
+    }
+    else if ((ICU_CHANNEL_STATE_NOTIFICATION == Icu_GetBitChState(Channel,ICU_CHANNEL_STATE_NOTIFICATION)) &&
+             (NULL_PTR != (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_ChannelNotification) &&
+             ((uint16)0U == u16NotifyInterval)
+            )
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, ICU_STARTTIMESTAMP_ID, ICU_E_PARAM_NOTIFY_INTERVAL);
+    }
+    else
+    {
+        valid= (Std_ReturnType)E_OK;
+    }
+    return valid;
+}
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (ICU_TIMESTAMP_API == STD_ON) */
+
+
+#if (ICU_TIMESTAMP_API == STD_ON)
+/**
+ * @brief      This function validates the state of timestamp channel
+ *
+ * @param[in]   Channel          Logical number of the ICU channel
+ *
+ * @return                  The validity of the function call
+ * @retval      E_OK        The function call is valid
+ * @retval      E_NOT_OK    The function call is invalid
+ *
+ * @implements Icu_ValidateChannelStartState_Activity
+ * */
+static inline Std_ReturnType Icu_ValidateChannelStartState(Icu_ChannelType Channel)
+{
+    Std_ReturnType valid = (Std_ReturnType)E_OK;
+
+    if(ICU_CHANNEL_STATE_RUNNING != Icu_GetBitChState(Channel, ICU_CHANNEL_STATE_RUNNING))
+    {
+        (void)Det_ReportRuntimeError((uint16)ICU_MODULE_ID, 0U, ICU_STOPTIMESTAMP_ID, ICU_E_NOT_STARTED);
+        valid = (Std_ReturnType)E_NOT_OK;
+    }
+    return valid;
+}
+#endif /* ICU_TIMESTAMP_API == STD_ON */
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && \
+        ((ICU_GET_TIME_ELAPSED_API == STD_ON) || (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON)))
+/**
+ * @brief       This function validates the signal measurement property
+ *
+ * @param[in]   Channel                 Logical number of the ICU channel
+ * @param[in]   u16ModePropertyMask     The mode property valid
+ * @param[in]   u8ServiceId             The service id of the caller function
+ * @param[in]   u32CoreId               The number of current core ID
+ *
+ * @return         The validity of the function call
+ * @retval      E_OK      The function call is valid
+ * @retval      E_NOT_OK The function call is invalid
+ *
+ * @implements Icu_ValidateSignalMeasurementProperty_Activity
+ * */
+static inline Std_ReturnType Icu_ValidateSignalMeasurementProperty(Icu_ChannelType Channel,
+                                                                                  uint16 u16ModePropertyMask,
+                                                                                  uint8  u8ServiceId,
+                                                                                  uint32 u32CoreId
+                                                                                 )
+{
+    Std_ReturnType  valid = (Std_ReturnType)E_OK;
+    Icu_ChannelType ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+    Icu_MeasurementSubModeType tempProperty = \
+                        (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_ChannelProperty;
+
+    if((tempProperty) != (u16ModePropertyMask & tempProperty))
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, u8ServiceId, ICU_E_PARAM_CHANNEL);
+        valid = (Std_ReturnType)E_NOT_OK;
+    }
+    return valid;
+}
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (...) */
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON))
+/**
+ * @brief       This function validates the duty cycle parameter
+ *
+ * @param[in]   DutyCycleValues  Pointer to a buffer where the results (high time and period time)
+ *                                 shall be placed.
+ *
+ *
+ * @return      The validity of the function call
+ * @retval      E_OK      The function call is valid
+ * @retval      E_NOT_OK The function call is invalid
+ *
+ * @implements Icu_ValidatePtrDutyCycle_Activity
+ *
+ * */
+static inline Std_ReturnType Icu_ValidatePtrDutyCycle(const Icu_DutyCycleType * DutyCycleValues)
+{
+    Std_ReturnType valid = (Std_ReturnType)E_OK;
+
+    if (NULL_PTR == DutyCycleValues)
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, ICU_GETDUTYCYCLEVALUES_ID, ICU_E_PARAM_POINTER);
+        valid = (Std_ReturnType)E_NOT_OK;
+    }
+    return valid;
+}
+#endif /* ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON))*/
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_VERSION_INFO_API == STD_ON))
+/**
+ * @brief       This function validates the versionInfo parameter
+ *
+ * @param[in]   versioninfo  Pointer to a buffer where the results for version shall be saved
+ *
+ *
+ * @return      The validity of the function call
+ * @retval      E_OK      The function call is valid
+ * @retval      E_NOT_OK The function call is invalid
+ *
+ * */
+static inline Std_ReturnType Icu_ValidateVersionInfoCall(const Std_VersionInfoType * versioninfo)
+{
+    Std_ReturnType valid = (Std_ReturnType)E_OK;
+
+    if (NULL_PTR == versioninfo)
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, ICU_GETVERSIONINFO_ID, ICU_E_PARAM_VINFO);
+        valid = (Std_ReturnType)E_NOT_OK;
+    }
+    return valid;
+}
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_VERSION_INFO_API == STD_ON */
+
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_DUAL_CLOCK_MODE_API == STD_ON))
+/**
+ * @brief       This function validates the Prescaler parameter
+ *
+ * @param[in]   Prescaler One of the two clock functioning modes
+ *
+ *
+ * @return      The validity of the function call
+ * @retval      E_OK     The function call is valid
+ * @retval      E_NOT_OK The function call is invalid
+ *
+ * */
+static inline Std_ReturnType Icu_ValidateClockModeCall(Icu_SelectPrescalerType Prescaler)
+{
+    Std_ReturnType valid = (Std_ReturnType)E_OK;
+
+    if ((ICU_NORMAL_CLOCK_MODE != Prescaler) && (ICU_ALTERNATE_CLOCK_MODE != Prescaler))
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, (uint8)0U, (uint8)ICU_SET_CLOCK_MODE_ID, (uint8)ICU_E_PARAM_CLOCK_MODE);
+        valid = (Std_ReturnType)E_NOT_OK;
+    }
+    return valid;
+}
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (ICU_DUAL_CLOCK_MODE_API == STD_ON) */
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_INPUT_LEVEL_API == STD_ON))
+/**
+ * @brief       This function validates the Channel type
+ *
+ * @param[in]   Channel               The logical channel
+ * @param[in]   u32CoreId             The number of current core ID
+ *
+ * @return      The validity of the channel type
+ * @retval      E_OK      The function call is valid
+ * @retval      E_NOT_OK  The function call is invalid
+ *
+ */
+static inline Std_ReturnType Icu_ValidateGetInputLevel(Icu_ChannelType Channel, uint32 u32CoreId)
+{
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    Icu_ChannelType ChannelIndex;
+    Std_ReturnType valid = (Std_ReturnType)E_OK;
+    
+    /* ChannelIndex - Index of channel in the partition where is used.*/
+    ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+    /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+    ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+
+    if (ICU_IPW_ERROR == Icu_Ipw_ValidateGetInputLevel(ChannelConfig))
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, (uint8)0U, (uint8)ICU_GET_INPUT_LEVEL_ID, (uint8)ICU_E_PARAM_CHANNEL);
+        valid = (Std_ReturnType)E_NOT_OK;
+    }
+    return valid;
+}
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_INPUT_LEVEL_API == STD_ON */
+
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+/**
+ * @brief       This function validates mode when Enable feature
+ *
+ * @param[in]   u8ApiId - the id of function
+ *
+ *
+ * @return      The validity of the channel type
+ * @retval      E_OK      The function call is valid
+ * @retval      E_NOT_OK The function call is invalid
+ * @implements  Icu_ValidateModeForSetUpFeature_Activity
+ *
+ **/
+static inline Std_ReturnType Icu_ValidateModeForSetUpFeature(uint8 u8ApiId)
+{
+    Std_ReturnType valid =  (Std_ReturnType)E_NOT_OK;
+
+    if (ICU_MODE_SLEEP == Icu_CurrentMode)
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, u8ApiId, ICU_E_FORBIDEN_MODE);
+    }
+    else
+    {
+        valid = (Std_ReturnType)E_OK;
+    }
+    return valid;
+}
+#endif /* ICU_VALIDATE_GLOBAL_CALL == STD_ON */
+
+#if ((ICU_VALIDATE_GLOBAL_CALL == STD_ON) && ((ICU_GET_PULSE_WIDTH_API == STD_ON) && (ICU_SIGNAL_MEASUREMENT_API == STD_ON)))
+/**
+ * @brief       This function validates for SignalMeasurement without interrupt
+ *
+ * @param[in]   Channel               The logical channel
+ * @param[in]   u8ApiId               The id of function
+ * @param[in]   u32CoreId             The number of current core ID
+ *
+ * @return      The validity of the function call
+ * @retval      E_OK      The function call is valid
+ * @retval      E_NOT_OK The function call is invalid
+ *
+ **/
+static inline Std_ReturnType Icu_ValidateSignalMeasureWithoutInterrupt(Icu_ChannelType Channel,
+                                                                                     uint8  u8ServiceId,
+                                                                                     uint32 u32CoreId
+                                                                                     )
+{
+    Std_ReturnType valid = (Std_ReturnType)E_OK;
+    Icu_ChannelType ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+    valid = Icu_Ipw_ValidateSignalMeasureWithoutInterrupt(ChannelIndex, &Icu_pCfgPtr[u32CoreId]->Icu_IpConfigPtr);
+
+    if((Std_ReturnType)E_NOT_OK == valid)
+    {
+        (void)Det_ReportError((uint16)ICU_MODULE_ID, 0U, u8ServiceId, ICU_E_PARAM_CHANNEL);
+        valid = (Std_ReturnType)E_NOT_OK;
+    }
+    return valid;
+}
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && ((ICU_GET_PULSE_WIDTH_API == STD_ON) && (ICU_SIGNAL_MEASUREMENT_API == STD_ON))*/
+
+/**
+ * @brief      This function calls the notification, if available for specific channels
+ *
+ * @param[in]  Channel               Logical number of the ICU channel
+ * @param[in]  u32CoreId             The number of current core ID
+ *
+ * @return     void
+ * @pre        Icu_Init must be called before.
+ */
+static inline void Icu_CallNotification(Icu_ChannelType Channel, uint32 u32CoreId)
+{
+    Icu_ChannelType ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+
+    if ((ICU_CHANNEL_STATE_NOTIFICATION == Icu_GetBitChState(Channel, ICU_CHANNEL_STATE_NOTIFICATION)) \
+        && (NULL_PTR != (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_ChannelNotification))
+    {
+        (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_ChannelNotification();
+    }
+}
+
+/**
+ * @brief       This function get the channel number corresponding to the index of channel
+ *
+ * @param[in]   ChannelIndex          Channel Index of the ICU channel
+ * @param[in]   u32CoreId             The number of current core ID
+ *
+ * @return      The channel number corresponds to the channel in the core
+ * @pre         Icu_Init must be called before.
+ *
+ *
+ * */
+static inline Icu_ChannelType Icu_ConvertChannelIndexToChannel(Icu_ChannelType ChannelIndex,
+                                                               uint32 u32CoreId)
+{
+    Icu_ChannelType Channel = ICU_MAX_CHANNEL;
+
+    for (Channel = 0U; Channel < ICU_MAX_CHANNEL; Channel++)
+    {
+        if(ChannelIndex == (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel])
+        {
+            break;
+        }
+    }
+    return Channel;
+}
+/*==================================================================================================
+ *                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+
+/**
+ * @brief          This function initializes the driver.
+ * @details        This service is a non reentrant function used for driver initialization.
+ *        The  Initialization function  shall initialize  all relevant  registers of  the configured
+ *        hardware with the  values of the  structure referenced by  the parameter ConfigPtr.
+ *        If  the  hardware  allows  for   only  one  usage   of  the  register,   the  driver
+ *        module implementing that functionality is responsible for initializing the register.
+ *        The initialization function of this module shall always have a pointer as a parameter,
+ *        even though for Variant PC no configuration set shall be given.
+ *        Instead a NULL pointer shall be passed to the initialization function.
+ *        The Icu  module environment  shall not  call Icu_Init  during a  running operation (e. g.
+ *        timestamp measurement or edge counting).
+ *
+ * @param[in]         ConfigPtr        Pointer to a selected configuration structure.
+ *
+ * @return             void
+ * @implements         Icu_Init_Activity
+ */
+void Icu_Init(const Icu_ConfigType *ConfigPtr)
+{
+    Icu_ChannelType Channel;
+    Icu_ChannelType ChannelIndex;
+    uint32 u32CoreId;
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+    Icu_ChannelConfigType const * ChannelConfig;
+#endif
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON) || (ICU_VALIDATE_PARAMS == STD_ON)
+    Std_ReturnType valid;
+#endif
+    /* Get core ID of current processor */
+    u32CoreId = Icu_GetCoreID();
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    valid = Icu_ValidateGlobalCall(ICU_INIT_ID, u32CoreId);
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif /* (ICU_VALIDATE_GLOBAL_CALL == STD_ON */
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+        valid = Icu_ValidatePtrInit(u32CoreId ,ConfigPtr);
+        if ((Std_ReturnType)E_OK == valid)
+        {
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) */
+
+#ifdef ICU_PRECOMPILE_SUPPORT
+#if (ICU_MULTICORE_SUPPORT == STD_ON)
+            Icu_pCfgPtr[u32CoreId] = Icu_Config[u32CoreId];
+#else /* ICU_MULTICORE_SUPPORT == STD_OFF */
+            Icu_pCfgPtr[u32CoreId] = &Icu_Config;
+#endif /* ICU_MULTICORE_SUPPORT */
+            (void)ConfigPtr;
+#else
+            Icu_pCfgPtr[u32CoreId] = ConfigPtr;
+#endif /* ICU_PRECOMPILE_SUPPORT */
+
+#ifdef ICU_NONBONDED_WAKEUP_PULLUP
+            Icu_Ipw_PullUpNonBondedWakeupPin();
+#endif
+            Icu_Ipw_Init((Icu_pCfgPtr[u32CoreId]->nNumInstances), (Icu_pCfgPtr[u32CoreId]->Icu_IpConfigPtr));
+
+            for (ChannelIndex = 0U; ChannelIndex < Icu_pCfgPtr[u32CoreId]->nNumChannels; ChannelIndex++)
+            {
+                Channel = Icu_ConvertChannelIndexToChannel(ChannelIndex, u32CoreId);
+                /* Clear channel internal state */
+                if (ICU_MAX_CHANNEL > Channel)
+                {
+                    Icu_aChannelState[Channel] = 0x00U;
+                }
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+                ChannelConfig = (&(*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]);
+                if ((ICU_MODE_TIMESTAMP == ChannelConfig->Icu_ChannelMode) && (Channel < ICU_MAX_CHANNEL))
+                {
+                    Icu_aBuffer[Channel] = NULL_PTR;
+                }
+#endif /* ICU_TIMESTAMP_API */
+            }
+            Icu_CurrentMode = ICU_MODE_NORMAL;
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+        }
+#endif
+#if (STD_ON == ICU_VALIDATE_GLOBAL_CALL)
+    }
+    Icu_EndValidateGlobalCall(valid, ICU_INIT_ID, u32CoreId);
+#endif
+}
+
+#if (ICU_DE_INIT_API == STD_ON)
+/**
+ * @brief   This function de-initializes the ICU module.
+ * @details This service is a Non reentrant function used for ICU De-Initialization
+ *        After the call of this service, the state of the peripherals used by configuration shall be
+ *        the  same as  after power  on reset.  Values of  registers which  are not  writable  are
+ *        excluded.
+ *        This service shall disable all used interrupts and notifications.
+ *        The Icu module environment shall not  call Icu_DeInit during a running  operation  (e. g.
+ *        timestamp measurement or edge counting)
+ *
+ * @return void
+ *
+ * @pre Icu_Init must be called before.
+ *
+ * @implements Icu_DeInit_Activity
+ */
+void Icu_DeInit(void)
+{
+    Icu_ChannelType Channel;
+    Icu_ChannelType ChannelIndex;
+    uint32 u32CoreId = Icu_GetCoreID();
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateGlobalCall(ICU_DEINIT_ID, u32CoreId);
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif /* ICU_VALIDATE_GLOBAL_CALL == STD_ON*/
+
+        Icu_Ipw_DeInit((Icu_pCfgPtr[u32CoreId]->nNumInstances), (Icu_pCfgPtr[u32CoreId]->Icu_IpConfigPtr));
+
+        for (ChannelIndex = 0U; ChannelIndex < Icu_pCfgPtr[u32CoreId]->nNumChannels; ChannelIndex++)
+        {
+            Channel = Icu_ConvertChannelIndexToChannel(ChannelIndex, u32CoreId);
+            /* Clear channel internal state */
+            if (ICU_MAX_CHANNEL > Channel)
+            {
+                Icu_aChannelState[Channel] =  0x00U;
+            }
+        }
+
+        Icu_pCfgPtr[u32CoreId] = NULL_PTR;
+        Icu_CurrentMode = ICU_MODE_NORMAL;
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    }
+    Icu_EndValidateGlobalCall(valid, ICU_DEINIT_ID, u32CoreId);
+#endif /* ICU_VALIDATE_GLOBAL_CALL == STD_ON*/
+}
+#endif /* ICU_DE_INIT_API */
+
+
+#if (ICU_SET_MODE_API == STD_ON)
+/**
+ * @brief           This function sets the ICU mode.
+ * @details     This service is a non reentrant function used for ICU mode  selection.
+ *       This service shall  set the  operation mode  to the given mode parameter.
+ *       This service  can be  called during  running operations.  If so,  an ongoing operation that
+ *       generates interrupts on a wakeup capable  channel like e.g. time stamping or  edge counting
+ *       might lead to the  ICU module not being  able to properly enter sleep  mode. This is then a
+ *       system or ECU configuration issue not a problem of this specification.
+ *
+ * @param[in]   Mode        Specifies the operation mode
+ * @return      void
+ *
+ * @pre         Icu_Init must be called before.
+ * @implements  Icu_SetMode_Activity
+ */
+void Icu_SetMode(Icu_ModeType Mode)
+{
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    Icu_ChannelType Channel;
+    Icu_ChannelType ChannelIndex;
+    uint32 u32CoreId;
+
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON) || (ICU_VALIDATE_PARAMS == STD_ON)
+    Std_ReturnType valid;
+#endif
+
+    /* Get core ID of current processor */
+    u32CoreId = Icu_GetCoreID();
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+
+    valid = Icu_ValidateGlobalCall(ICU_SETMODE_ID, u32CoreId);
+    if ((Std_ReturnType)E_OK == valid)
+    {
+        valid = Icu_ValidateCallSetMode(Mode, u32CoreId);
+        if ((Std_ReturnType)E_OK == valid)
+        {
+#endif /* ICU_VALIDATE_GLOBAL_CALL == STD_ON */
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+            valid = Icu_ValidateMode(Mode);
+            if ((Std_ReturnType)E_OK == valid)
+            {
+#endif /* ICU_VALIDATE_PARAMS == STD_ON */
+                for (ChannelIndex = 0U; ChannelIndex < Icu_pCfgPtr[u32CoreId]->nNumChannels; ChannelIndex++)
+                {
+                    /* Decode logic channel.  */
+                    Channel = Icu_ConvertChannelIndexToChannel(ChannelIndex, u32CoreId);
+                    /* Channel configuration for actual ChannelIndex in this core. */
+                    ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+                    if (ICU_MODE_SLEEP == Mode)
+                    {
+                        if ((Icu_GetBitChState(Channel, ICU_CHANNEL_STATE_WKUP) != ICU_CHANNEL_STATE_WKUP) && \
+                            (Icu_CurrentMode != Mode))
+                        {
+                            Icu_Ipw_SetSleepMode(ChannelConfig);
+                        }
+                    }
+                    else
+                    {
+                        if ((Icu_GetBitChState(Channel, ICU_CHANNEL_STATE_RUNNING) == ICU_CHANNEL_STATE_RUNNING) && \
+                            (Icu_CurrentMode != Mode))
+                        {
+                            Icu_Ipw_SetNormalMode(ChannelConfig);
+                        }
+                    }
+                }
+                Icu_CurrentMode = Mode;
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+            }
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) */
+
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+        }
+    }
+    Icu_EndValidateGlobalCall(valid, ICU_SETMODE_ID, u32CoreId);
+#endif /* (ICU_VALIDATE_GLOBAL_CALL == STD_ON)*/
+}
+#endif /* ICU_SET_MODE_API */
+
+#if (ICU_DISABLE_WAKEUP_API == STD_ON)
+/**
+ * @brief   This function disables the wakeup capability of a single ICU channel.
+ * @details This service is reentrant function and shall disable  the wakeup capability of
+ *          a single ICU channel.This  service is only feasible for ICU channels configured
+ *          statically as wakeup capable TRUE.
+ *          The  function  Icu_DisableWakeup shall  be  pre compile  time  configurable On,Off by
+ *          the configuration parameter IcuDisableWakeupApi.
+ *
+ * @param[in]     Channel          Logical number of the ICU channel
+ *
+ * @return void
+ * @pre Icu_Init must be called before.
+ * @implements Icu_DisableWakeup_Activity
+ */
+void Icu_DisableWakeup(Icu_ChannelType Channel)
+{
+#if ((ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON) || (ICU_VALIDATE_PARAMS == STD_ON))
+    uint32 u32CoreId = Icu_GetCoreID();
+#endif
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid;
+
+    uint8 mask = (uint8)((uint32)ICU_MODE_EDGE_COUNTER | (uint32)ICU_MODE_SIGNAL_EDGE_DETECT | \
+                                (uint32)ICU_MODE_SIGNAL_MEASUREMENT | (uint32)ICU_MODE_TIMESTAMP);
+
+    valid = Icu_ValidateCallAndChannel (Channel, mask, ICU_DISABLEWAKEUP_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif /* (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON) */
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+        if ((Std_ReturnType)E_OK == Icu_ValidateWakeupChannel(Channel, ICU_DISABLEWAKEUP_ID, u32CoreId))
+        {
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) */
+            Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_WKUP);
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+        }
+#endif /*(ICU_VALIDATE_PARAMS == STD_ON)*/
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif /* (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON) */
+}
+#endif /* ICU_DISABLE_WAKEUP_API */
+
+#if (ICU_ENABLE_WAKEUP_API == STD_ON)
+/**
+ * @brief   This function (re-)enables the wakeup capability of the given ICU channel.
+ * @details The function is reentrant and re-enable the wake-up capability of a single ICU channel.
+ *
+ * @param[in]  Channel          Logical number of the ICU channel
+ *
+ * @return     void
+ * @pre        Icu_Init must be called before. The channel must be configured as wakeup capable.
+ * @implements Icu_EnableWakeup_Activity
+ */
+void Icu_EnableWakeup(Icu_ChannelType Channel)
+{
+#if (( ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON) || ( ICU_VALIDATE_PARAMS == STD_ON))
+    uint32 u32CoreId = Icu_GetCoreID();
+#endif
+
+#if ( ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid;
+    uint8 mask;
+#endif /* ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON */
+
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    if((Std_ReturnType)E_OK == Icu_ValidateModeForSetUpFeature(ICU_ENABLEWAKEUP_ID))
+    {
+#endif
+
+#if ( ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    mask = (uint8)((uint32)ICU_MODE_EDGE_COUNTER | (uint32)ICU_MODE_SIGNAL_EDGE_DETECT | \
+                  (uint32)ICU_MODE_SIGNAL_MEASUREMENT | (uint32)ICU_MODE_TIMESTAMP);
+    valid = Icu_ValidateCallAndChannel (Channel, mask, ICU_ENABLEWAKEUP_ID, u32CoreId);
+
+    if((Std_ReturnType)E_OK == valid)
+    {
+#endif
+#if ( ICU_VALIDATE_PARAMS == STD_ON)
+        if((Std_ReturnType)E_OK == Icu_ValidateWakeupChannel(Channel, ICU_ENABLEWAKEUP_ID, u32CoreId))
+        {
+#endif
+            Icu_SetBitChState(Channel, ICU_CHANNEL_STATE_WKUP);
+#if ( ICU_VALIDATE_PARAMS == STD_ON)
+        }
+#endif
+#if ( ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    }
+#endif
+}
+#endif /* ICU_ENABLE_WAKEUP_API */
+
+
+#if (ICU_WAKEUP_FUNCTIONALITY_API == STD_ON)
+/**
+ * @brief  Checks if a wakeup capable ICU channel is the source for a wakeup event.
+ * @details The function calls the ECU state manager service EcuM_SetWakeupEvent
+ * in case of a valid ICU channel wakeup event.
+ *
+ * @param[in]     WakeupSource          Information on wakeup source to be checked.
+ *
+ * @return     void
+ * @pre        Icu_Init must be called before. The channel must be configured as wakeup capable.
+ * @implements Icu_CheckWakeup_Activity
+ */
+void Icu_CheckWakeup(EcuM_WakeupSourceType WakeupSource)
+{
+    Icu_ChannelType Channel;
+    Icu_ChannelType ChannelIndex;
+    const Icu_ChannelConfigType * pTempPtr;
+    uint32 u32CoreId = Icu_GetCoreID();
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateGlobalCall(ICU_CHECKWAKEUP_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif /* ICU_VALIDATE_GLOBAL_CALL == STD_ON*/
+
+        for (ChannelIndex = 0U; ChannelIndex < Icu_pCfgPtr[u32CoreId]->nNumChannels; ChannelIndex++)
+        {
+            Channel = Icu_ConvertChannelIndexToChannel(ChannelIndex, u32CoreId);
+            pTempPtr = &(*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex];
+            if ((Icu_ChannelStateType)(ICU_CHANNEL_IS_WAKEUP_SOURCE | ICU_CHANNEL_STATE_WKUP) ==  \
+                 Icu_GetBitChState(Channel, ICU_CHANNEL_IS_WAKEUP_SOURCE | ICU_CHANNEL_STATE_WKUP) \
+                )
+            {
+#if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
+                if (WakeupSource == (EcuM_WakeupSourceType)pTempPtr->Icu_Channel_WakeupValue)
+                {
+                    EcuM_SetWakeupEvent(WakeupSource);
+                    Icu_ClearBitChState(Channel, ICU_CHANNEL_IS_WAKEUP_SOURCE);
+                }
+#else
+                Icu_ClearBitChState(Channel, ICU_CHANNEL_IS_WAKEUP_SOURCE);
+#endif
+                break;
+            }
+        }
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    }
+    Icu_EndValidateGlobalCall(valid, ICU_CHECKWAKEUP_ID, u32CoreId);
+#endif /* ICU_VALIDATE_GLOBAL_CALL == STD_ON*/
+}
+#endif /* ICU_WAKEUP_FUNCTIONALITY_API */
+
+
+/**
+ * @brief   This function sets the activation-edge for the given channel.
+ * @details This service  is reentrant and shall set  the  activation-edge according to Activation
+ *          parameter for the given channel.
+ *          This service shall support channels which are configured
+ *          for  the following Icu_MeasurementMode:
+ *          - ICU_MODE_SIGNAL_EDGE_DETECT
+ *          - ICU_MODE_TIMESTAMP
+ *          - ICU_MODE_EDGE_COUNTER
+ *
+ * @param[in]  Channel          Logical number of the ICU channel
+ * @param[in]  Activation       Type of activation.
+ *
+ * @return     void
+ * @pre        Icu_Init must be called before. The channel must be properly configured
+ *             (ICU_MODE_SIGNAL_EDGE_DETECT, ICU_MODE_TIMESTAMP, ICU_MODE_EDGE_COUNTER).
+ * @implements Icu_SetActivationCondition_Activity
+ */
+void Icu_SetActivationCondition(Icu_ChannelType Channel, Icu_ActivationType Activation)
+{
+    Icu_ChannelType ChannelIndex;
+    uint32 u32CoreId = Icu_GetCoreID();
+#if ( ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid;
+    uint8 mask = (uint8)((uint32)ICU_MODE_EDGE_COUNTER | (uint32)ICU_MODE_SIGNAL_EDGE_DETECT | (uint32)ICU_MODE_TIMESTAMP);
+
+    valid = Icu_ValidateCallAndChannel (Channel, mask, ICU_SETACTIVATIONCONDITION_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+#if ( ICU_VALIDATE_PARAMS == STD_ON)
+        if ((Std_ReturnType)E_OK == Icu_ValidateActivation(Activation))
+        {
+#endif
+            /* Clear IDLE status */
+            Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_IDLE);
+
+            ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+            Icu_Ipw_SetActivationCondition(Activation, \
+                           (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_IpwChannelConfigPtr);
+                           
+#if ( ICU_VALIDATE_PARAMS == STD_ON)
+        }
+#endif
+#if ( ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+}
+
+
+/**
+* @brief   This function disables the notification of a channel.
+*
+* @details This function is reentrant and disables the notification of a channel.
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return     void
+* @pre        Icu_Init must be called before.
+* @implements Icu_DisableNotification_Activity
+**/
+void Icu_DisableNotification(Icu_ChannelType Channel)
+{
+    uint32 u32CoreId = Icu_GetCoreID();
+    Icu_ChannelType ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+#if ( ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid;
+    uint8 mask;
+
+    mask = (uint8)((uint32)ICU_MODE_SIGNAL_EDGE_DETECT | (uint32)ICU_MODE_TIMESTAMP);
+
+    valid = Icu_ValidateCallAndChannel(Channel, mask, ICU_DISABLENOTIFICATION_ID, u32CoreId);
+
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+        /* Clear notification enable status */
+        Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_NOTIFICATION);
+        Icu_Ipw_DisableNotification((*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_IpwChannelConfigPtr);
+
+#if ( ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateGlobalCall(valid, ICU_DISABLENOTIFICATION_ID, u32CoreId);
+#endif
+}
+
+
+/**
+* @brief   This function enables the notification on the given channel.
+* @details This function is reentrant and enables the notification on the given channel. The
+*          notification  will be reported only when the channel measurement property is enabled or
+*          started
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+* @pre Icu_Init must be called before.
+* @implements Icu_EnableNotification_Activity
+**/
+void Icu_EnableNotification(Icu_ChannelType Channel)
+{
+    uint32 u32CoreId = Icu_GetCoreID();
+    Icu_ChannelType ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid;
+    uint8 mask;
+
+    mask = (uint8)((uint32)ICU_MODE_SIGNAL_EDGE_DETECT | (uint32)ICU_MODE_TIMESTAMP);
+
+    valid = Icu_ValidateCallAndChannel(Channel, mask, ICU_ENABLENOTIFICATION_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+        /* Set notification enable status */
+        Icu_SetBitChState(Channel, ICU_CHANNEL_STATE_NOTIFICATION);
+        Icu_Ipw_EnableNotification((*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_IpwChannelConfigPtr);
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateGlobalCall(valid, ICU_ENABLENOTIFICATION_ID, u32CoreId);
+#endif
+}
+
+
+#if (ICU_GET_INPUT_STATE_API == STD_ON)
+/**
+ * @brief   This function returns the status of the ICU input.
+ * @details This service is reentrant shall return the status of  the ICU input.
+ *          Only channels which are configured for the following Icu_MeasurementMode shall be
+ *          supported:
+ *          - ICU_MODE_SIGNAL_EDGE_DETECT,
+ *          - ICU_MODE_SIGNAL_MEASUREMENT.
+ *
+ * @param[in]  Channel - Logical number of the ICU channel
+ *
+ * @return     Icu_InputStateType
+ * @retval     ICU_ACTIVE     An activation edge has been detected
+ * @retval     ICU_IDLE       No activation edge has been detected since the last call of
+ *             Icu_GetInputState() or Icu_Init().
+ *
+ * @pre        Icu_Init must be called before.
+ *
+ * @implements Icu_GetInputState_Activity
+ */
+Icu_InputStateType Icu_GetInputState(Icu_ChannelType Channel)
+{    
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    Icu_InputStateType tempState = ICU_IDLE;
+    uint32             u32CoreId = Icu_GetCoreID();
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid;
+    uint8 mask;
+
+    mask = (uint8)((uint32)ICU_MODE_SIGNAL_EDGE_DETECT | (uint32)ICU_MODE_SIGNAL_MEASUREMENT);
+
+    valid = Icu_ValidateCallAndChannel(Channel, mask, ICU_GETINPUTSTATE_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+        ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+        ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+        if (ICU_CHANNEL_STATE_IDLE == Icu_GetBitChState(Channel, ICU_CHANNEL_STATE_IDLE))
+        {
+            tempState = ICU_ACTIVE;
+            /* Clear IDLE status. */
+            Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_IDLE);
+        }
+        else if (ICU_MODE_SIGNAL_EDGE_DETECT == \
+                 ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_ChannelMode)
+        {
+            tempState = Icu_Ipw_GetInputState(ChannelConfig) ? ICU_ACTIVE : ICU_IDLE;
+        }
+        else
+        {
+            /* Do nothing. */
+        }
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateGlobalCall(valid, ICU_GETINPUTSTATE_ID, u32CoreId);
+#endif
+    return (tempState);
+}
+#endif /* ICU_GET_INPUT_STATE_API */
+
+
+#if (ICU_TIMESTAMP_API == STD_ON)
+/** @implements Icu_StartTimestamp_Activity */
+void Icu_StartTimestamp(Icu_ChannelType Channel, Icu_ValueType* BufferPtr, uint16 BufferSize, uint16 NotifyInterval)
+{
+    Icu_ChannelType                  ChannelIndex;
+    const Icu_Ipw_ChannelConfigType* ChannelConfig;
+    uint32  u32CoreId = Icu_GetCoreID();
+
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    if((Std_ReturnType)E_OK == Icu_ValidateModeForSetUpFeature(ICU_STARTTIMESTAMP_ID))
+    {
+#endif
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+        Mcl_DmaChannelTransferListType global_Mcl_DmaChannelTransferList[10U];
+#endif
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+        Std_ReturnType valid = Icu_ValidateCallAndChannel(Channel, (uint8)ICU_MODE_TIMESTAMP, \
+                                                          ICU_STARTTIMESTAMP_ID, u32CoreId);
+        if ((Std_ReturnType)E_OK == valid)
+        {
+#endif
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+            if ((Std_ReturnType)E_OK == Icu_ValidateTimestamp(Channel, BufferPtr, BufferSize,\
+                NotifyInterval, u32CoreId))
+            {
+#endif
+                /* Time stamp is running. */
+                Icu_SetBitChState(Channel, ICU_CHANNEL_STATE_RUNNING);
+
+                /* Clear the previous overflow status flag (if was the case). */
+                Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_OVERFLOW);
+
+                /* ChannelIndex - Index of channel in the partition where is used.*/
+                ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+                /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+                ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+                SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_02 ();
+                {
+                    Icu_aBuffer[Channel]       = BufferPtr;
+                    Icu_aBufferSize[Channel]   = BufferSize;
+                    Icu_aBufferNotify[Channel] = NotifyInterval;
+                    Icu_aNotifyCount[Channel]  = 0U;
+                    Icu_aBufferIndex[Channel]  = 0U;
+                }
+                SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_02();
+
+                if(NoMclDmaChannel != (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel)
+                {
+                    /* Create the desired configuration list. */
+                    global_Mcl_DmaChannelTransferList[0U].Param = MCL_DMA_CH_SET_SOURCE_ADDRESS;
+                    global_Mcl_DmaChannelTransferList[0U].Value = Icu_Ipw_GetStartAddress(ChannelConfig);
+                    /* Compiler_Warning: DMA TCD addresses are restricted to 32 bits, so casting from pointer type to uint32 is safe.
+                     * The application should ensure that only addresses that fit in uint32 are used for configuring DMA. */
+                    global_Mcl_DmaChannelTransferList[1U].Param = MCL_DMA_CH_SET_DESTINATION_ADDRESS;
+                    global_Mcl_DmaChannelTransferList[1U].Value = (uint32)BufferPtr;
+                    global_Mcl_DmaChannelTransferList[2U].Param = MCL_DMA_CH_SET_DESTINATION_TRANSFER_SIZE;
+                    global_Mcl_DmaChannelTransferList[2U].Value = (uint32)ICU_DMA_SIZE;
+                    global_Mcl_DmaChannelTransferList[3U].Param = MCL_DMA_CH_SET_SOURCE_TRANSFER_SIZE;
+                    global_Mcl_DmaChannelTransferList[3U].Value = (uint32)ICU_DMA_SIZE;
+                    global_Mcl_DmaChannelTransferList[4U].Param = MCL_DMA_CH_SET_SOURCE_SIGNED_OFFSET;
+                    global_Mcl_DmaChannelTransferList[4U].Value = (uint32)0U;
+                    global_Mcl_DmaChannelTransferList[5U].Param = MCL_DMA_CH_SET_DESTINATION_SIGNED_OFFSET;
+                    global_Mcl_DmaChannelTransferList[5U].Value = (uint32)ICU_DMA_OFFSET;
+                    global_Mcl_DmaChannelTransferList[6U].Param = MCL_DMA_CH_SET_SOURCE_MODULO;
+                    global_Mcl_DmaChannelTransferList[6U].Value = (uint32)0U;
+                    global_Mcl_DmaChannelTransferList[7U].Param = MCL_DMA_CH_SET_DESTINATION_MODULO;
+                    global_Mcl_DmaChannelTransferList[7U].Value = (uint32)0U;
+
+                    if ((NotifyInterval >= BufferSize) || (NotifyInterval == (uint16)0))
+                    {
+                        global_Mcl_DmaChannelTransferList[8U].Param = MCL_DMA_CH_SET_MINORLOOP_SIZE;
+                        global_Mcl_DmaChannelTransferList[8U].Value = ICU_DMA_NUM_BYTES;
+                        global_Mcl_DmaChannelTransferList[9U].Param = MCL_DMA_CH_SET_MAJORLOOP_COUNT;
+                        global_Mcl_DmaChannelTransferList[9U].Value = BufferSize;
+                    }
+                    else if (NotifyInterval < BufferSize)
+                    {
+                        global_Mcl_DmaChannelTransferList[8U].Param = MCL_DMA_CH_SET_MINORLOOP_SIZE;
+                        global_Mcl_DmaChannelTransferList[8U].Value = ICU_DMA_NUM_BYTES;
+                        global_Mcl_DmaChannelTransferList[9U].Param = MCL_DMA_CH_SET_MAJORLOOP_COUNT;
+                        global_Mcl_DmaChannelTransferList[9U].Value = NotifyInterval;
+                    }
+                    else
+                    {
+                        /* does nothing */
+                    }
+                    Mcl_SetDmaChannelTransferList((*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel, \
+                                                  global_Mcl_DmaChannelTransferList, (uint32)10U);
+                    Mcl_SetDmaChannelCommand((*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel, \
+                                             MCL_DMA_CH_START_REQUEST);
+                }
+#endif /* ICU_TIMESTAMP_USES_DMA == STD_ON */
+                Icu_Ipw_StartTimestamp(ChannelConfig, BufferPtr, BufferSize, NotifyInterval);
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+            }
+#endif
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+        }
+    Icu_EndValidateGlobalCall(valid, ICU_STARTTIMESTAMP_ID, u32CoreId);
+#endif
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    }
+#endif
+}
+
+/**
+* @brief   This function stops the timestamp measurement of the given channel.
+* @details This function is reentrant and stops the timestamp measurement of the given channel.
+*
+* @param[in]     Channel          Logical number of the ICU channel
+*
+* @return void
+*
+* @implements Icu_StopTimestamp_Activity
+**/
+void Icu_StopTimestamp(Icu_ChannelType Channel)
+{
+    Icu_ChannelType           ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    uint32 u32CoreId = Icu_GetCoreID();
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateCallAndChannel(Channel,(uint8)ICU_MODE_TIMESTAMP, ICU_STOPTIMESTAMP_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+        if ((Std_ReturnType)E_OK == Icu_ValidateChannelStartState(Channel))
+        {
+            /* ChannelIndex - Index of channel in the partition where is used.*/
+            ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+            /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+            ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+            if (NoMclDmaChannel != (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel)
+            {
+                Mcl_SetDmaChannelCommand((*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel, \
+                                         MCL_DMA_CH_STOP_REQUEST);
+            }
+#endif
+            Icu_Ipw_StopTimestamp(ChannelConfig);
+            Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_RUNNING);
+        }
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+}
+#endif /* STD_ON == ICU_TIMESTAMP_API */
+
+#if (ICU_TIMESTAMP_API == STD_ON)
+/** @implements Icu_GetTimestampIndex_Activity */
+Icu_IndexType Icu_GetTimestampIndex(Icu_ChannelType Channel)
+{
+    Icu_IndexType timestampIndex = 0U;
+    Icu_ChannelType ChannelIndex;
+    const Icu_Ipw_ChannelConfigType* ChannelConfig;
+    uint32 u32CoreId = Icu_GetCoreID();
+
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+    uint32          startIter;
+    uint32          crtIter;
+    uint32* const   pStartIter = &startIter;
+    uint32* const   pCrtIter = &crtIter;
+#endif
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateCallAndChannel(Channel, (uint8)ICU_MODE_TIMESTAMP, ICU_GETTIMESTAMPINDEX_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_OVERFLOW_NOTIFICATION_API == STD_OFF))
+        if (FALSE == Icu_GetOverflow(Channel, ICU_GETTIMESTAMPINDEX_ID, ICU_E_TIMESTAMP_OVERFLOW, u32CoreId))
+        {
+#endif
+
+            /* ChannelIndex - Index of channel in the partition where is used.*/
+            ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+            if (NoMclDmaChannel != (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel)
+            {
+                if (NULL_PTR == Icu_aBuffer[Channel])
+                {
+                    timestampIndex = 0U;
+                }
+                else
+                {
+                    Mcl_GetDmaChannelParam((*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel, \
+                                            MCL_DMA_CH_GET_BEGIN_ITER_COUNT, pStartIter);
+                    Mcl_GetDmaChannelParam((*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel, \
+                                            MCL_DMA_CH_GET_CURRENT_ITER_COUNT, pCrtIter);
+                    crtIter = startIter - crtIter;
+                    timestampIndex =  Icu_aBufferIndex[Channel] + (Icu_IndexType)crtIter;
+                }
+            }
+            else
+            {
+#endif /* ICU_TIMESTAMP_USES_DMA == STD_ON */
+                /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+                ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+                timestampIndex = Icu_Ipw_GetTimestampIndex(ChannelConfig);
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+            }
+#endif
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_OVERFLOW_NOTIFICATION_API == STD_OFF))
+        }
+#endif
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+    return timestampIndex;
+}
+#endif /* ICU_TIMESTAMP_API */
+
+
+#if (STD_ON == ICU_EDGE_COUNT_API)
+/**
+ * @brief      This function resets the value of the counted edges to zero.
+ * @details    This function is reentrant and resets the value of the counted edges to zero.
+ *
+ * @param[in]  Channel - Logical number of the ICU channel.
+ *
+ * @return     void
+ *
+ * @pre        Icu_Init must be called before.
+ * 
+ * @implements Icu_ResetEdgeCount_Activity
+ */
+void Icu_ResetEdgeCount(Icu_ChannelType Channel)
+{
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    /* Get used core. */
+    uint32 u32CoreId = Icu_GetCoreID();
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateCallAndChannel \
+                (Channel, (uint8)ICU_MODE_EDGE_COUNTER, ICU_RESETEDGECOUNT_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+        /* ChannelIndex - Index of channel in the current partition. */
+        ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+        /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+        ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+        /* Clear overflow flag. */
+        Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_OVERFLOW);
+        Icu_Ipw_ResetEdgeCount(ChannelConfig);
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Icu_EndValidateCallAndChannel(valid);
+    }
+#endif
+}
+#endif /* STD_ON == ICU_EDGE_COUNT_API */
+
+#if (STD_ON == ICU_EDGE_COUNT_API)
+/**
+ * @brief   This function enables the counting of edges of the given channel.
+ * @details This service is reentrant and shall enable the counting of  edges of the given channel.
+ *          Note: This  service doesnot do the real counting itself. This is done by the hardware
+ *          (capture unit). Only the configured edges shall be counted (rising edge, falling edge or
+ *           both edges).
+ *
+ *          Configuration  of  the  edge  is  done  in  Icu_Init  or  Icu_SetActivationCondition.The
+ *          configured edge can be  changed during runtime using  Icu_SetActivationCondition.
+ *          Interrupts are not required for edge counting.If interrupts are enabled, the interrupt
+ *          service routine
+ *          will set the overflow flag if more than 0xFFFFFF edges are measured.
+ *
+ * @param[in]     Channel          Logical number of the ICU channel
+ *
+ * @return void
+ * @pre Icu_Init must be called before. The given channel must be configured in Measurement Mode
+ *      Edge Counter.
+ *
+ * @implements Icu_EnableEdgeCount_Activity
+ */
+void Icu_EnableEdgeCount(Icu_ChannelType Channel)
+{
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    /* Get core number. */
+    uint32 u32CoreId = Icu_GetCoreID();
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    if((Std_ReturnType)E_OK == Icu_ValidateModeForSetUpFeature(ICU_ENABLEEDGECOUNT_ID))
+    {
+#endif
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+        Std_ReturnType valid = Icu_ValidateCallAndChannel \
+            (Channel,(uint8)ICU_MODE_EDGE_COUNTER, ICU_ENABLEEDGECOUNT_ID, u32CoreId);
+
+        if ((Std_ReturnType)E_OK == valid)
+        {
+#endif
+            /* Clear the previous overflow status flag (if was the case). */
+            Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_OVERFLOW);
+            /* Clear overflow flag */
+            Icu_SetBitChState(Channel, ICU_CHANNEL_STATE_RUNNING);
+            /* ChannelIndex - Index of channel in the partition where is used.*/
+            ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+            /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+            ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+            Icu_Ipw_EnableEdgeCount(ChannelConfig);
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+        }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    }
+#endif
+}
+#endif /* ICU_EDGE_COUNT_API */
+
+#if (STD_ON == ICU_EDGE_COUNT_API)
+/**
+ * @details This function is reentrant and disables the counting of edges of the given channel.
+ * @brief   This function disables the counting of edges of the given channel.
+ *
+ * @param[in]     Channel          Logical number of the ICU channel
+ *
+ * @return void
+ *
+ * @pre Icu_Init must be called before.The given channel must be configured in Measurement
+ *      Mode Edge Counter.
+ *
+ * @implements Icu_DisableEdgeCount_Activity
+ */
+void Icu_DisableEdgeCount(Icu_ChannelType Channel)
+{
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    /* Get core number. */
+    uint32 u32CoreId = Icu_GetCoreID();
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateCallAndChannel \
+        (Channel,(uint8)ICU_MODE_EDGE_COUNTER, ICU_DISABLEEDGECOUNT_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+        /* ChannelIndex - Index of channel in the partition where is used.*/
+        ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+        /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+        ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+        Icu_Ipw_DisableEdgeCount(ChannelConfig);
+        Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_RUNNING);
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+}
+#endif /* STD_ON == ICU_EDGE_COUNT_API */
+
+
+#if (STD_ON == ICU_EDGE_COUNT_API)
+/**
+ * @brief   This function reads the number of counted edges.
+ * @details This function is reentrant reads the number of counted edges after the last call
+ *          of Icu_ResetEdgeCount().
+ *
+ * @param[in]     Channel          Logical number of the ICU channel
+ *
+ * @return Icu_EdgeNumberType - Number of the counted edges.
+ *
+ * @pre Icu_Init must be called before. The given channel must be configured in Measurement
+ *      Mode Edge Counter.
+ *
+ * @implements Icu_GetEdgeNumbers_Activity
+ **/
+Icu_EdgeNumberType Icu_GetEdgeNumbers(Icu_ChannelType Channel)
+{
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    /* Get core number. */
+    uint32             u32CoreId   = Icu_GetCoreID();
+    Icu_EdgeNumberType edgeNumbers = 0U;
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateCallAndChannel \
+        (Channel,(uint8)ICU_MODE_EDGE_COUNTER, ICU_GETEDGENUMBERS_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+#if (ICU_OVERFLOW_NOTIFICATION_API == STD_OFF)
+        if (FALSE == Icu_GetOverflow(Channel, ICU_GETEDGENUMBERS_ID, ICU_E_EDGECOUNTING_OVERFLOW, u32CoreId))
+        {
+#endif
+#endif
+            /* ChannelIndex - Index of channel in the partition where is used.*/
+            ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+            /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+            ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+            edgeNumbers = Icu_Ipw_GetEdgeNumbers(ChannelConfig);
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+#if (ICU_OVERFLOW_NOTIFICATION_API == STD_OFF)
+        }
+#endif
+#endif
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+    return edgeNumbers;
+}
+#endif /* STD_ON == ICU_EDGE_COUNT_API */
+
+
+#if (STD_ON == ICU_EDGE_DETECT_API)
+/**
+ * @brief     This function enables or re-enables the detection of edges of the given channel.
+ * @details   This function is reentrant enables or re-enables the detection of edges of the given
+ *            channel.
+ *
+ * @param[in] Channel          Logical number of the ICU channel
+ *
+ * @return    void
+ *
+ * @pre       Icu_Init must be called before. The channel must be configured in Measurement Mode Edge
+ *            Counter
+ * @implements Icu_EnableEdgeDetection_Activity
+ */
+void Icu_EnableEdgeDetection(Icu_ChannelType Channel)
+{
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    /* Get core number. */
+    uint32             u32CoreId   = Icu_GetCoreID();
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid;
+#endif
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    if((Std_ReturnType)E_OK == Icu_ValidateModeForSetUpFeature(ICU_ENABLEEDGEDETECTION_ID))
+    {
+#endif
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+        valid = Icu_ValidateCallAndChannel(Channel, (uint8)ICU_MODE_SIGNAL_EDGE_DETECT, \
+                                           ICU_ENABLEEDGEDETECTION_ID, u32CoreId);
+
+        if ((Std_ReturnType)E_OK == valid)
+        {
+#endif
+            Icu_SetBitChState(Channel, ICU_CHANNEL_STATE_RUNNING);
+            /* ChannelIndex - Index of channel in the partition where is used.*/
+            ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+            /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+            ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+            Icu_Ipw_EnableEdgeDetection(ChannelConfig);
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+        }
+        Icu_EndValidateCallAndChannel(valid);
+#endif
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    }
+#endif
+}
+#endif /* STD_ON == ICU_EDGE_DETECT_API */
+
+
+#if (STD_ON == ICU_EDGE_DETECT_API)
+/**
+ * @brief      This function is reentrant and disables the detection of edges of the given channel.
+ *
+ * @param[in]  Channel - Logical number of the ICU channel
+ *
+ * @return     void
+ *
+ * @pre        Icu_Init must be called before. The channel must be configured in Measurement 
+ *             Mode Edge Detection.
+ * @implements Icu_DisableEdgeDetection_Activity
+ */
+void Icu_DisableEdgeDetection(Icu_ChannelType Channel)
+{
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    /* Get core number. */
+    uint32             u32CoreId   = Icu_GetCoreID();
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateCallAndChannel \
+        (Channel,(uint8)ICU_MODE_SIGNAL_EDGE_DETECT, ICU_DISABLEEDGEDETECTION_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+        /* ChannelIndex - Index of channel in the partition where is used.*/
+        ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+        /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+        ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+        Icu_Ipw_DisableEdgeDetection(ChannelConfig);
+        Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_RUNNING);
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+}
+#endif /* STD_ON == ICU_EDGE_DETECT_API */
+
+
+#if (STD_ON == ICU_SIGNAL_MEASUREMENT_API)
+/**
+ * @brief   This function starts the measurement of signals.
+ * @details This service is reentrant and starts the measurement of signals beginning with the
+ *          configured default start edge which occurs first after the call of this service.
+ *          This service shall only be available in Measurement Mode ICU_MODE_SIGNAL_MEASUREMENT.
+ *          This service shall reset the state for the given channel to ICU_IDLE.
+ *
+ * @param[in]  Channel - Logical number of the ICU channel
+ *
+ * @return     void
+ * 
+ * @pre        Icu_Init must be called before. The channel must be configured in Measurement Mode Signal
+ *             Measurement.
+ * 
+ * @implements Icu_StartSignalMeasurement_Activity
+ */
+void Icu_StartSignalMeasurement(Icu_ChannelType Channel)
+{
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    uint32 u32CoreId = Icu_GetCoreID();
+#if (ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON)
+    uint8 u8index = 0U;
+    Mcl_DmaChannelTransferListType global_Mcl_DmaChannelTransferList[10U];
+#endif
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid;
+#endif
+
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    if((Std_ReturnType)E_OK == Icu_ValidateModeForSetUpFeature(ICU_STARTSIGNALMEASUREMENT_ID))
+    {
+#endif
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+        valid = Icu_ValidateCallAndChannel(Channel, (uint8)ICU_MODE_SIGNAL_MEASUREMENT, ICU_STARTSIGNALMEASUREMENT_ID, u32CoreId);
+
+        if ((Std_ReturnType)E_OK == valid)
+        {
+#endif
+            /* ChannelIndex - Index of channel in the partition where is used.*/
+            ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+            /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+            ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+            Icu_SetBitChState(Channel, ICU_CHANNEL_STATE_RUNNING);
+            /*Clear the previous overflow status flag (if was the case) */
+            Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_OVERFLOW);
+            SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_08();
+            {
+#if (ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON)
+                if(NoMclDmaChannel != (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel)
+                {
+                    /* initialize the members of the structure */
+                    global_Mcl_DmaChannelTransferList[0U].Param = MCL_DMA_CH_SET_SOURCE_ADDRESS;
+                    global_Mcl_DmaChannelTransferList[0U].Value = Icu_Ipw_GetStartAddress(ChannelConfig);
+                    /* Compiler_Warning: This warning is thrown because of a conversion between a Icu_ValyeType pointer and a uint32 */
+                    global_Mcl_DmaChannelTransferList[1U].Param = MCL_DMA_CH_SET_DESTINATION_ADDRESS;
+                    global_Mcl_DmaChannelTransferList[1U].Value = (uint32)&Icu_aDmaBuffer[Channel][0];
+                    global_Mcl_DmaChannelTransferList[2U].Param = MCL_DMA_CH_SET_DESTINATION_TRANSFER_SIZE;
+                    global_Mcl_DmaChannelTransferList[2U].Value = (uint32)ICU_DMA_SIZE;
+                    global_Mcl_DmaChannelTransferList[3U].Param = MCL_DMA_CH_SET_SOURCE_TRANSFER_SIZE;
+                    global_Mcl_DmaChannelTransferList[3U].Value = (uint32)ICU_DMA_SIZE;
+                    global_Mcl_DmaChannelTransferList[4U].Param = MCL_DMA_CH_SET_SOURCE_SIGNED_OFFSET;
+                    global_Mcl_DmaChannelTransferList[4U].Value = (uint32)0U;
+                    global_Mcl_DmaChannelTransferList[5U].Param = MCL_DMA_CH_SET_DESTINATION_SIGNED_OFFSET;
+                    global_Mcl_DmaChannelTransferList[5U].Value = (uint32)ICU_DMA_OFFSET;
+                    global_Mcl_DmaChannelTransferList[6U].Param = MCL_DMA_CH_SET_SOURCE_MODULO;
+                    global_Mcl_DmaChannelTransferList[6U].Value = (uint32)0U;
+                    global_Mcl_DmaChannelTransferList[7U].Param = MCL_DMA_CH_SET_DESTINATION_MODULO;
+                    global_Mcl_DmaChannelTransferList[7U].Value = (uint32)0U;
+                    global_Mcl_DmaChannelTransferList[8U].Param = MCL_DMA_CH_SET_MINORLOOP_SIZE;
+                    global_Mcl_DmaChannelTransferList[8U].Value = (uint32)ICU_DMA_NUM_BYTES;
+                    global_Mcl_DmaChannelTransferList[9U].Param = MCL_DMA_CH_SET_MAJORLOOP_COUNT;
+                    global_Mcl_DmaChannelTransferList[9U].Value = (uint32)ICU_DMA_MAJORLOOP_FIRST_COUNT;
+                    Mcl_SetDmaChannelTransferList((*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel, \
+                                                  global_Mcl_DmaChannelTransferList, (uint32)10U);
+                    Mcl_SetDmaChannelCommand((*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel, \
+                                             MCL_DMA_CH_START_REQUEST);
+
+                     /*Clear the DMA result buffer for configured DMA channel*/
+                    for(u8index = 0U; u8index < ICU_DMA_MAJORLOOP_COUNT; u8index++)
+                    {
+                        Icu_aDmaBuffer[Channel][u8index] = (uint16)0;
+                    }
+                }
+#endif
+            }
+            SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_08();
+            Icu_Ipw_StartSignalMeasurement(ChannelConfig);
+            Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_IDLE);
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+        }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    }
+#endif
+}
+
+/** @implements Icu_StopSignalMeasurement_Activity */
+void Icu_StopSignalMeasurement(Icu_ChannelType Channel)
+{
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    uint32 u32CoreId = Icu_GetCoreID();
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateCallAndChannel \
+        (Channel, (uint8)ICU_MODE_SIGNAL_MEASUREMENT, ICU_STOPSIGNALMEASUREMENT_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+        /* ChannelIndex - Index of channel in the partition where is used.*/
+        ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+        /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+        ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+        Icu_Ipw_StopSignalMeasurement(ChannelConfig);
+        Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_RUNNING);
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+}
+#endif /* STD_ON == ICU_SIGNAL_MEASUREMENT_API */
+
+#if (ICU_GET_TIME_ELAPSED_API == STD_ON)
+/** @implements Icu_GetTimeElapsed_Activity */
+Icu_ValueType Icu_GetTimeElapsed(Icu_ChannelType Channel)
+{
+    Icu_ValueType timeElapsed = (Icu_ValueType)0U;
+    uint32 u32CoreId = Icu_GetCoreID();
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateCallAndChannel(Channel,\
+                           (uint8)ICU_MODE_SIGNAL_MEASUREMENT, ICU_GETTIMEELAPSED_ID, u32CoreId);
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+#if (ICU_OVERFLOW_NOTIFICATION_API == STD_OFF)
+        if (FALSE == Icu_GetOverflow(Channel, ICU_GETTIMEELAPSED_ID, ICU_E_MEASUREMENT_OVERFLOW, u32CoreId))
+        {
+#endif
+            if ((Std_ReturnType)E_OK == Icu_ValidateSignalMeasurementProperty(Channel, \
+                     (uint16)((uint32)ICU_LOW_TIME | (uint32)ICU_HIGH_TIME | (uint32)ICU_PERIOD_TIME), \
+                     ICU_GETTIMEELAPSED_ID, u32CoreId ))
+            {
+#endif
+                /* ChannelIndex - Index of channel in the partition where is used.*/
+                ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+                /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+                ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+                timeElapsed = Icu_Ipw_GetTimeElapsed(ChannelConfig);
+                Icu_ClearBitChState(Channel,ICU_CHANNEL_STATE_IDLE);
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+            }
+#if (ICU_OVERFLOW_NOTIFICATION_API == STD_OFF)
+        }
+#endif
+#endif
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+    return timeElapsed;
+}
+#endif /* ICU_GET_TIME_ELAPSED_API */
+
+#if (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON)
+/** @implements Icu_GetDutyCycleValues_Activity */
+void Icu_GetDutyCycleValues(Icu_ChannelType Channel, Icu_DutyCycleType* DutyCycleValues)
+{
+    uint32 u32CoreId = Icu_GetCoreID();
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateCallAndChannel \
+        (Channel, (uint8)ICU_MODE_SIGNAL_MEASUREMENT, ICU_GETDUTYCYCLEVALUES_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+#if (ICU_OVERFLOW_NOTIFICATION_API == STD_OFF)
+        if (FALSE == Icu_GetOverflow(Channel, ICU_GETDUTYCYCLEVALUES_ID, ICU_E_MEASUREMENT_OVERFLOW, u32CoreId))
+        {
+#endif
+            if ((Std_ReturnType)E_OK == Icu_ValidateSignalMeasurementProperty
+                        (Channel, (uint16)ICU_DUTY_CYCLE, ICU_GETDUTYCYCLEVALUES_ID, u32CoreId))
+            {
+                if ((Std_ReturnType)E_OK == Icu_ValidatePtrDutyCycle(DutyCycleValues))
+                {
+#endif
+                    /* ChannelIndex - Index of channel in the partition where is used.*/
+                    ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+                    /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+                    ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+                    Icu_Ipw_GetDutyCycleValues(ChannelConfig, DutyCycleValues);
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+                }
+            }
+#if (ICU_OVERFLOW_NOTIFICATION_API == STD_OFF)
+        }
+#endif
+#endif
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+}
+#endif /* ICU_GET_DUTY_CYCLE_VALUES_API */
+
+#if (ICU_GET_VERSION_INFO_API == STD_ON)
+/**
+* @brief   This service returns the version information of this module.
+* @details This  service is Non reentrant and returns the version information of this module.
+*          The version information includes:
+*          - Module Id
+*          - Vendor Id
+*          - Vendor specific version numbers
+*          If source code for caller and callee of this function is available this function should
+*          be realized as a macro. The macro should be defined in the modules header file.
+*
+* @param[out] versioninfo      Pointer to location to store version info
+*
+* @return     void
+* @implements Icu_GetVersionInfo_Activity
+**/
+void Icu_GetVersionInfo (Std_VersionInfoType *versioninfo)
+{
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+    if ((Std_ReturnType)E_OK == Icu_ValidateVersionInfoCall(versioninfo))
+    {
+#endif
+        (versioninfo)->vendorID         = (uint16)ICU_VENDOR_ID;
+        (versioninfo)->moduleID         = (uint8)ICU_MODULE_ID;
+        (versioninfo)->sw_major_version = (uint8)ICU_SW_MAJOR_VERSION;
+        (versioninfo)->sw_minor_version = (uint8)ICU_SW_MINOR_VERSION;
+        (versioninfo)->sw_patch_version = (uint8)ICU_SW_PATCH_VERSION;
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+    }
+#endif
+}
+#endif  /* ICU_GET_VERSION_INFO_API == STD_ON */
+
+#if (STD_ON == ICU_DUAL_CLOCK_MODE_API)
+/**
+ * @brief      This function changes the channel prescaler.
+ * @details    This function sets all channels prescalers based on the input mode.
+ *
+ * @param[in]  Prescaler - Prescaler type: Normal or Alternate
+ *
+ * @return     void
+ *
+ * @pre        Icu_Init must be called before.
+ *
+ * @implements Icu_SetClockMode_Activity
+ */
+void Icu_SetClockMode(Icu_SelectPrescalerType selectPrescaler)
+{
+    const Icu_Ipw_IpConfigType (*modulesIpwConfig)[];
+    uint8                      instancesNumber;
+    /* Get core ID of current processor */
+    uint32 u32CoreId = Icu_GetCoreID();
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON) || (ICU_VALIDATE_PARAMS == STD_ON)
+    Std_ReturnType valid;
+#endif
+#if (ICU_VALIDATE_GLOBAL_CALL == STD_ON)
+    valid = Icu_ValidateGlobalCall(ICU_SET_CLOCK_MODE_ID, u32CoreId);
+    if ((Std_ReturnType)E_OK == valid)
+    {
+#endif /* (ICU_VALIDATE_GLOBAL_CALL == STD_ON */
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+        if ((Std_ReturnType)E_OK == Icu_ValidateClockModeCall(selectPrescaler))
+        {
+#endif
+            modulesIpwConfig = Icu_pCfgPtr[u32CoreId]->Icu_IpConfigPtr;
+            instancesNumber  = Icu_pCfgPtr[u32CoreId]->nNumInstances;
+            Icu_Ipw_SetClockMode(modulesIpwConfig, selectPrescaler, instancesNumber);
+#if (ICU_VALIDATE_PARAMS == STD_ON)
+        }
+#endif
+#if (STD_ON == ICU_VALIDATE_GLOBAL_CALL)
+    }
+    Icu_EndValidateGlobalCall(valid, ICU_SET_CLOCK_MODE_ID, u32CoreId);
+#endif
+}
+#endif /* STD_ON == ICU_DUAL_CLOCK_MODE_API */
+
+#if (STD_ON == ICU_GET_INPUT_LEVEL_API)
+/**
+ * @brief      This function returns the actual status of PIN.
+ *
+ * @param[in]  Channel - Logical number of the ICU channel
+ *
+ * @return     Icu_LevelType
+ *
+ * @pre        Icu_Init must be called before.
+ * @implements Icu_GetInputLevel_Activity
+ */
+Icu_LevelType Icu_GetInputLevel(Icu_ChannelType Channel)
+{
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    Icu_ChannelType ChannelIndex;
+    Icu_LevelType level     = (Icu_LevelType)ICU_LEVEL_LOW;
+    uint32        u32CoreId = Icu_GetCoreID();
+
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType valid = Icu_ValidateCallAndChannel \
+                    (Channel,(uint8)ICU_MODE_SIGNAL_MEASUREMENT|(uint8)ICU_MODE_SIGNAL_EDGE_DETECT, \
+                     ICU_GET_INPUT_LEVEL_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == valid)
+    {
+        if ((Std_ReturnType)E_OK == Icu_ValidateGetInputLevel(Channel, u32CoreId))
+        {
+#endif
+            /* ChannelIndex - Index of channel in the partition where is used.*/
+            ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+            /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+            ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+            level = (Icu_LevelType)Icu_Ipw_GetInputLevel(ChannelConfig);
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+        }
+    }
+    Icu_EndValidateCallAndChannel(valid);
+#endif
+    return level;
+}
+#endif /* ICU_GET_INPUT_LEVEL_API */
+
+/**
+ * @brief      This function reports the wakeup and overflow events, if available.
+ *
+ * @param[in]  hwChannel        Hardware number identifier of the ICU channel
+ * @param[in]  bOverflow        Parameter that indicates the source of report is an overflow
+ *
+ * @return     void
+ * @pre        Icu_Init must be called before.
+ * @implements Icu_ReportWakeupAndOverflow_Activity
+ **/
+void Icu_ReportWakeupAndOverflow(uint16 Channel, boolean bOverflow)
+{
+#if ((ICU_REPORT_WAKEUP_SOURCE == STD_ON) || \
+    (defined(ICU_OVERFLOW_NOTIFICATION_API) && (ICU_OVERFLOW_NOTIFICATION_API == STD_ON)))
+    uint32  u32CoreId = Icu_GetCoreID();
+    Icu_ChannelType ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+#endif /* ICU_REPORT_WAKEUP_SOURCE == STD_ON */
+
+    if ((ICU_CHANNEL_STATE_WKUP == Icu_GetBitChState(Channel, ICU_CHANNEL_STATE_WKUP)) && \
+        (ICU_MODE_SLEEP == Icu_CurrentMode))
+    {
+        Icu_SetBitChState(Channel, ICU_CHANNEL_IS_WAKEUP_SOURCE);
+#if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
+        EcuM_CheckWakeup((EcuM_WakeupSourceType)\
+                         (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_Channel_WakeupValue);
+#endif /* ICU_REPORT_WAKEUP_SOURCE == STD_ON */
+    }
+    if (TRUE == bOverflow)
+    {
+        Icu_SetBitChState(Channel, ICU_CHANNEL_STATE_OVERFLOW);
+#if defined(ICU_OVERFLOW_NOTIFICATION_API) && (ICU_OVERFLOW_NOTIFICATION_API == STD_ON)
+        if (NULL_PTR != (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_ChOverflowNotification)
+        {
+            (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_ChOverflowNotification();
+        }
+#endif  /* ICU_OVERFLOW_NOTIFICATION_API */
+    }
+}
+
+/**
+* @brief     This function reports the wakeup event, overflow event and notification, if available
+*
+* @param[in]    hwChannel          Harware number identifier of the ICU channel
+* @param[in]    overflow           Parameter that indicates the source of report is an overflow
+*
+* @return      void
+* @pre        Icu_Init must be called before.
+* @implements Icu_ReportEvents_Activity
+**/
+void Icu_ReportEvents(uint16 Channel, boolean bOverflow)
+{
+    uint32 u32CoreId = Icu_GetCoreID();
+
+    Icu_SetBitChState(Channel, ICU_CHANNEL_STATE_IDLE);
+    Icu_ReportWakeupAndOverflow(Channel, bOverflow);
+    Icu_CallNotification(Channel, u32CoreId);
+}
+
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+/** @implements Icu_TimestampDmaProcessing_Activity */
+void Icu_TimestampDmaProcessing(Icu_ChannelType Channel)
+{
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    uint32 crtIterCount;
+    uint32 u32CoreId = Icu_GetCoreID();
+    Icu_ChannelType ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+    Mcl_ChannelType Mcl_DmaChannel = (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel;
+    Icu_IndexType  noOfBufferElemToFill = 0U;
+
+    Mcl_DmaChannelTransferListType Mcl_DmaChUpdateDestAddress[1U];
+    Mcl_DmaChannelTransferListType Mcl_DmaChUpdateIterCount[1U];
+
+    Mcl_GetDmaChannelParam((*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel, \
+                            MCL_DMA_CH_GET_BEGIN_ITER_COUNT, &crtIterCount);
+    
+    /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+    ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+
+    SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_03();
+    {
+        Icu_aBufferIndex[Channel] += (uint16)crtIterCount;
+        noOfBufferElemToFill = Icu_aBufferSize[Channel] - Icu_aBufferIndex[Channel];
+
+        /* Handling notification*/
+        if ((Icu_IndexType)0 != Icu_aBufferNotify[Channel])
+        {
+            Icu_aNotifyCount[Channel] += (uint16)crtIterCount;
+            if  (Icu_aNotifyCount[Channel] == Icu_aBufferNotify[Channel])
+            {
+                Icu_aNotifyCount[Channel] = 0U;
+                /* Call User Notification Function and/or Wakeup Function */
+                Icu_CallNotification(Channel, u32CoreId);
+            }
+        }
+    }
+    SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_03();
+
+    if (0U == noOfBufferElemToFill)
+    {
+        if ((uint8) ICU_CIRCULAR_BUFFER ==  \
+                (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_ChannelProperty)
+        {
+            SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_03();
+            {
+                Icu_aBufferIndex[Channel] = 0U;
+                Mcl_DmaChUpdateDestAddress[0U].Param = MCL_DMA_CH_SET_DESTINATION_ADDRESS;
+                Mcl_DmaChUpdateDestAddress[0U].Value = (uint32)Icu_aBuffer[Channel];
+                Mcl_SetDmaChannelTransferList(Mcl_DmaChannel, Mcl_DmaChUpdateDestAddress, 1U);
+
+                if ((Icu_aBufferSize[Channel] > (Icu_aBufferNotify[Channel] - Icu_aNotifyCount[Channel])) &&
+                    ((Icu_IndexType)0U != Icu_aBufferNotify[Channel]))
+                {
+                    Mcl_DmaChUpdateIterCount[0U].Param = MCL_DMA_CH_SET_MAJORLOOP_COUNT;
+                    Mcl_DmaChUpdateIterCount[0U].Value = (uint32)Icu_aBufferNotify[Channel] - (uint32)Icu_aNotifyCount[Channel];
+                    Mcl_SetDmaChannelTransferList(Mcl_DmaChannel, Mcl_DmaChUpdateIterCount, 1U);
+                }
+            }
+            SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_03();
+        }
+        else /* if linear buffer stop the timestamp*/
+        {
+            Icu_Ipw_StopTimestamp(ChannelConfig);
+            Icu_ClearBitChState(Channel, ICU_CHANNEL_STATE_RUNNING);
+        }
+    }
+    else
+    {
+        SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_03();
+        {
+            if (crtIterCount < Icu_aBufferNotify[Channel])
+            {
+                Mcl_DmaChUpdateIterCount[0U].Param = MCL_DMA_CH_SET_MAJORLOOP_COUNT;
+                Mcl_DmaChUpdateIterCount[0U].Value = Icu_aBufferNotify[Channel];
+                Mcl_SetDmaChannelTransferList(Mcl_DmaChannel, Mcl_DmaChUpdateIterCount, 1U);
+            }
+            if (noOfBufferElemToFill < Icu_aBufferNotify[Channel])
+            {
+                Mcl_DmaChUpdateIterCount[0U].Param = MCL_DMA_CH_SET_MAJORLOOP_COUNT;
+                Mcl_DmaChUpdateIterCount[0U].Value = noOfBufferElemToFill;
+                Mcl_SetDmaChannelTransferList(Mcl_DmaChannel, Mcl_DmaChUpdateIterCount, 1U);
+            }
+        }
+        SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_03();
+    }
+}
+#endif /* (ICU_TIMESTAMP_USES_DMA == STD_ON) */
+
+#if (ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON)
+void Icu_SignalMeasurementDmaProcessing(Icu_ChannelType Channel)
+{
+    uint32 u32CoreId = Icu_GetCoreID();
+    uint8 u8index;
+    Icu_ValueType BufferValue1;
+    Icu_ValueType BufferValue2;
+    Icu_ValueType BufferValue3;
+    Mcl_DmaChannelTransferListType Mcl_DmaChUpdateDestAddress[1U];
+    Mcl_DmaChannelTransferListType Mcl_DmaChUpdateIterCount[1U];
+    uint8 ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+    Mcl_ChannelType Mcl_DmaChannel =(*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Mcl_DmaChannel;
+    Icu_ActivationType Activation = ICU_BOTH_EDGES;
+
+    Icu_ValueType* Icu_aActivePulseWidth;
+    Icu_ValueType* Icu_aPeriod;
+
+    Icu_ChannelType                 ChannelIndex;
+    const Icu_Ipw_ChannelConfigType *ChannelConfig;
+    /* ChannelIndex - Index of channel in the partition where is used.*/
+    ChannelIndex  = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+    /* ChannelConfig - Address of logic configuration for channel on u32CoreId partition. */
+    ChannelConfig = ((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr;
+    Icu_Ipw_GetPWandPeriod(ChannelConfig, Icu_aActivePulseWidth, Icu_aPeriod);
+
+    Mcl_SetDmaChannelCommand(Mcl_DmaChannel, MCL_DMA_CH_STOP_REQUEST);
+
+    if ((uint32)1 == Icu_aIsSecondInterrupt[Channel])
+    {
+        BufferValue1 = Icu_aFirstEdgeTimeStamp[Channel];
+        BufferValue2 = Icu_aDmaBuffer[Channel][0];
+        BufferValue3 = Icu_aDmaBuffer[Channel][1];
+        Mcl_DmaChUpdateDestAddress[0U].Param = MCL_DMA_CH_SET_DESTINATION_ADDRESS;
+        Mcl_DmaChUpdateDestAddress[0U].Value = (uint32)&Icu_aDmaBuffer[Channel][0];
+        Mcl_SetDmaChannelTransferList(Mcl_DmaChannel, Mcl_DmaChUpdateDestAddress, 1U);
+        Mcl_SetDmaChannelCommand(Mcl_DmaChannel, MCL_DMA_CH_START_REQUEST);
+
+        /* Store the aPeriod value */
+        SchM_Enter_Icu_ICU_EXCLUSIVE_AREA_09();
+        {
+            if(BufferValue2 > BufferValue1)
+            {
+                *Icu_aActivePulseWidth = BufferValue2 - BufferValue1;
+            }
+            else
+            {
+                *Icu_aActivePulseWidth = (ICU_CAPTURE_REGISTER_MASK - BufferValue1) + BufferValue2;
+            }
+
+            /* Store the aPeriod value */
+            if(BufferValue3 > BufferValue1)
+            {
+                *Icu_aPeriod =  BufferValue3 - BufferValue1;
+            }
+            else
+            {
+                *Icu_aPeriod = (ICU_CAPTURE_REGISTER_MASK - BufferValue1) + BufferValue3;
+            }
+        }
+        SchM_Exit_Icu_ICU_EXCLUSIVE_AREA_09();
+        Icu_aFirstEdgeTimeStamp[Channel] = Icu_aDmaBuffer[Channel][1];
+    }
+    else
+    {
+        Icu_aIsSecondInterrupt[Channel] = (uint32)1;
+        Icu_aFirstEdgeTimeStamp[Channel] = Icu_aDmaBuffer[Channel][0];
+        Mcl_DmaChUpdateDestAddress[0U].Param = MCL_DMA_CH_SET_DESTINATION_ADDRESS;
+        Mcl_DmaChUpdateDestAddress[0U].Value = (uint32)&Icu_aDmaBuffer[Channel][0];
+        Mcl_SetDmaChannelTransferList(Mcl_DmaChannel, Mcl_DmaChUpdateDestAddress, 1U);
+        Mcl_DmaChUpdateIterCount[0U].Param = MCL_DMA_CH_SET_MAJORLOOP_COUNT;
+        Mcl_DmaChUpdateIterCount[0U].Value = (uint16)ICU_DMA_MAJORLOOP_COUNT;
+        Mcl_SetDmaChannelTransferList(Mcl_DmaChannel, Mcl_DmaChUpdateIterCount, 1U);
+        Mcl_SetDmaChannelCommand(Mcl_DmaChannel, MCL_DMA_CH_START_REQUEST);
+        for(u8index = 0U; u8index < ICU_DMA_MAJORLOOP_COUNT; u8index++)
+        {
+            Icu_aDmaBuffer[Channel][u8index] = (uint32)0;
+        }
+        Icu_Ipw_SetActivationCondition(Activation, \
+                       (*(Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr))[ChannelIndex].Icu_IpwChannelConfigPtr);
+    }
+    Icu_SetBitChState(Channel, ICU_CHANNEL_STATE_IDLE);
+}
+#endif/* ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON */
+
+#if ((ICU_CAPTURERGISTER_API == STD_ON) && ((ICU_SIGNAL_MEASUREMENT_API == STD_ON) || \
+                                                                    (ICU_TIMESTAMP_API == STD_ON)))
+/**
+* @brief   This function starts the measurement of signals.
+* @details. This service returns the value of Capture register.
+*   This API is used to measure the time difference  between 2 different timer channels.
+*
+* @param[in]    Channel     Logical number of the ICU channel
+*
+* @return Icu_ValueType     Value of Capture register
+* @pre Icu_Init must be called before.
+* @pre The given channel must be configured in SignalMeasurement or in Timestamp mode
+* @implements Icu_GetCaptureRegisterValue_Activity
+**/
+Icu_ValueType Icu_GetCaptureRegisterValue(Icu_ChannelType Channel)
+{
+    Icu_ValueType tempValue = (Icu_ValueType)0U;
+    uint32 u32CoreId = Icu_GetCoreID();
+    Icu_ChannelType ChannelIndex;
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType validchannel = Icu_ValidateCallAndChannel \
+                (Channel,((uint8)ICU_MODE_SIGNAL_MEASUREMENT | (uint8)ICU_MODE_TIMESTAMP), ICU_GET_CAPTURE_REGISTER_VALUE_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == validchannel)
+    {
+#endif
+        ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+        tempValue = (Icu_ValueType)Icu_Ipw_GetCaptureRegisterValue(((*Icu_pCfgPtr[u32CoreId]->Icu_ChannelConfigPtr)[ChannelIndex]).Icu_IpwChannelConfigPtr);
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    }
+#endif
+    return tempValue;
+}
+#endif
+
+#if ((ICU_GET_PULSE_WIDTH_API == STD_ON) && (ICU_SIGNAL_MEASUREMENT_API == STD_ON))
+
+/**
+* @brief      This function returns the signals High time, Low time and Period without using the
+*             channel interrupt.
+* @details    This function returns the signals High time, Low time and Period without using the
+*             channel interrupt.
+* @param[in]  Channel       Logical number of the ICU channel
+* @pre        Icu_Init must be called before.
+**/
+void Icu_GetPulseWidth(Icu_ChannelType Channel)
+{
+    uint32 u32CoreId = Icu_GetCoreID();
+    Icu_ChannelType ChannelIndex;
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+    Std_ReturnType validchannel1 = Icu_ValidateCallAndChannel \
+                (Channel,(uint8)ICU_MODE_SIGNAL_MEASUREMENT, ICU_GET_PULSE_WIDTH_ID, u32CoreId);
+
+    if ((Std_ReturnType)E_OK == validchannel1)
+    {
+        if((Std_ReturnType)E_OK == Icu_ValidateSignalMeasureWithoutInterrupt(Channel, ICU_GET_PULSE_WIDTH_ID, u32CoreId))
+        {
+#endif
+            ChannelIndex = (*Icu_pCfgPtr[u32CoreId]->Icu_IndexChannelMap)[Channel];
+            Icu_Ipw_GetPulseWidth(ChannelIndex, &Icu_pCfgPtr[u32CoreId]->Icu_IpConfigPtr);
+#if (ICU_VALIDATE_CALL_AND_CHANNEL == STD_ON)
+        }
+    }
+#endif
+}
+#endif
+
+/**
+ * @brief The callback function
+ */
+void Icu_LogicChStateCallback(uint16 logicChannel, uint8 mask, boolean set)
+{
+    if (set)
+    {
+        Icu_SetBitChState((Icu_ChannelType)logicChannel, (Icu_ChannelStateType)mask);
+    }
+    else
+    {
+        Icu_ClearBitChState((Icu_ChannelType)logicChannel, (Icu_ChannelStateType)mask);    
+    }
+}
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 1091 - 0
RTD/src/Icu_Ipw.c

@@ -0,0 +1,1091 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file
+ *     @internal
+ *     @addtogroup icu_ipw Icu Driver
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Icu_Ipw.h"
+#include "Ftm_Icu_Ip.h"
+#include "Lpit_Icu_Ip.h"
+#include "Lptmr_Icu_Ip.h"
+#include "Port_Ci_Icu_Ip.h"
+#include "Cmp_Ip.h"
+
+/*==================================================================================================
+*                                    SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_IPW_VENDOR_ID_C                     43
+#define ICU_IPW_AR_RELEASE_MAJOR_VERSION_C      4
+#define ICU_IPW_AR_RELEASE_MINOR_VERSION_C      4
+#define ICU_IPW_AR_RELEASE_REVISION_VERSION_C   0
+#define ICU_IPW_SW_MAJOR_VERSION_C              1
+#define ICU_IPW_SW_MINOR_VERSION_C              0
+#define ICU_IPW_SW_PATCH_VERSION_C              0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_VENDOR_ID_C != ICU_IPW_VENDOR_ID)
+    #error "Icu_Ipw.c and Icu_Ipw.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_AR_RELEASE_MAJOR_VERSION_C  != ICU_IPW_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_MINOR_VERSION_C  != ICU_IPW_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_REVISION_VERSION_C   != ICU_IPW_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw.c and Icu_Ipw.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_SW_MAJOR_VERSION_C  != ICU_IPW_SW_MAJOR_VERSION) || \
+     (ICU_IPW_SW_MINOR_VERSION_C  != ICU_IPW_SW_MINOR_VERSION) || \
+     (ICU_IPW_SW_PATCH_VERSION_C  != ICU_IPW_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw.c and Icu_Ipw.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_VENDOR_ID_C != PORT_CI_ICU_IP_VENDOR_ID)
+    #error "Icu_Ipw.c and Port_Ci_Icu_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_AR_RELEASE_MAJOR_VERSION_C    != PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_MINOR_VERSION_C    != PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_REVISION_VERSION_C != PORT_CI_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw.c and Port_Ci_Icu_Ip.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_SW_MAJOR_VERSION_C  != PORT_CI_ICU_IP_SW_MAJOR_VERSION) || \
+     (ICU_IPW_SW_MINOR_VERSION_C  != PORT_CI_ICU_IP_SW_MINOR_VERSION) || \
+     (ICU_IPW_SW_PATCH_VERSION_C  != PORT_CI_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw.c and Port_Ci_Icu_Ip.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_VENDOR_ID_C != FTM_ICU_IP_VENDOR_ID)
+    #error "Icu_Ipw.c and Ftm_Icu_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_AR_RELEASE_MAJOR_VERSION_C    != FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_MINOR_VERSION_C    != FTM_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_REVISION_VERSION_C != FTM_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw.c and Ftm_Icu_Ip.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_SW_MAJOR_VERSION_C != FTM_ICU_IP_SW_MAJOR_VERSION) || \
+     (ICU_IPW_SW_MINOR_VERSION_C != FTM_ICU_IP_SW_MINOR_VERSION) || \
+     (ICU_IPW_SW_PATCH_VERSION_C != FTM_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw.c and Ftm_Icu_Ip.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_VENDOR_ID_C != LPTMR_ICU_IP_VENDOR_ID)
+    #error "Icu_Ipw.c and Lptmr_Icu_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_AR_RELEASE_MAJOR_VERSION_C    != LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_MINOR_VERSION_C    != LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_REVISION_VERSION_C != LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw.c and Lptmr_Icu_Ip.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_SW_MAJOR_VERSION_C != LPTMR_ICU_IP_SW_MAJOR_VERSION) || \
+     (ICU_IPW_SW_MINOR_VERSION_C != LPTMR_ICU_IP_SW_MINOR_VERSION) || \
+     (ICU_IPW_SW_PATCH_VERSION_C != LPTMR_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw.c and Lptmr_Icu_Ip.h are different"
+#endif
+
+/* Check if source file and ICU Lpit_Icu_Ip.h header file are of the same vendor */
+#if (ICU_IPW_VENDOR_ID_C != LPIT_ICU_IP_VENDOR_ID)
+    #error "Icu_Ipw.c and Lpit_Icu_Ip.h have different vendor IDs!"
+#endif
+/* Check if source file and ICU Lpit_Icu_Ip.h header file are of the same AutoSar version */
+#if ((ICU_IPW_AR_RELEASE_MAJOR_VERSION_C    != LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_MINOR_VERSION_C    != LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_REVISION_VERSION_C != LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw.c and Lpit_Icu_Ip.h are different!"
+#endif
+/* Check if source file and ICU Lpit_Icu_Ip.h header file are of the same Software version */
+#if ((ICU_IPW_SW_MAJOR_VERSION_C != LPIT_ICU_IP_SW_MAJOR_VERSION) || \
+     (ICU_IPW_SW_MINOR_VERSION_C != LPIT_ICU_IP_SW_MINOR_VERSION) || \
+     (ICU_IPW_SW_PATCH_VERSION_C != LPIT_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw.c and Lpit_Icu_Ip.h are different!"
+#endif
+
+/* Check if source file and ICU Cmp_Ip.h header file are of the same vendor */
+#if (ICU_IPW_VENDOR_ID_C != CMP_IP_VENDOR_ID)
+    #error "Icu_Ipw.c and Cmp_Ip.h have different vendor IDs!"
+#endif
+/* Check if source file and ICU Cmp_Ip.h header file are of the same AutoSar version */
+#if ((ICU_IPW_AR_RELEASE_MAJOR_VERSION_C    != CMP_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_MINOR_VERSION_C    != CMP_IP_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_AR_RELEASE_REVISION_VERSION_C != CMP_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw.c and Cmp_Ip.h are different!"
+#endif
+/* Check if source file and ICU Cmp_Ip.h header file are of the same Software version */
+#if ((ICU_IPW_SW_MAJOR_VERSION_C != CMP_IP_SW_MAJOR_VERSION) || \
+     (ICU_IPW_SW_MINOR_VERSION_C != CMP_IP_SW_MINOR_VERSION) || \
+     (ICU_IPW_SW_PATCH_VERSION_C != CMP_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw.c and Cmp_Ip.h are different!"
+#endif
+
+/*==================================================================================================
+*                           LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
+==================================================================================================*/
+
+/*==================================================================================================
+*                                       LOCAL MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        LOCAL CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        LOCAL VARIABLES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        GLOBAL CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                    LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        LOCAL FUNCTIONS
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+/**
+* @brief                Icu_Ipw_Init
+* @details              Initialize a hardware Icu IP Instance
+*
+* @param[in]            count       - Number of instances to be configured
+* @param[in]            pIpConfig   - Pointer that contains IP specific configuration data for the Icu driver
+*
+* @return void
+*
+* @pre                  Icu_DeInit must be called before.
+*
+*/
+void Icu_Ipw_Init(uint8 count, const Icu_Ipw_IpConfigType (*pIpConfig)[])
+{
+    uint8 index;
+
+    for(index = 0; index < count; index++)
+    {
+        if (ICU_FTM_MODULE == (*pIpConfig)[index].instanceIp)
+        {
+            (void)Ftm_Icu_Ip_Init((*pIpConfig)[index].instanceNo, \
+                                              (*pIpConfig)[index].pFtmHwIpConfig);
+        }
+        else if (ICU_LPIT_MODULE == (*pIpConfig)[index].instanceIp)
+        {
+            (void)Lpit_Icu_Ip_Init((*pIpConfig)[index].instanceNo, \
+                                   (*pIpConfig)[index].pLpitHwInstanceConfig);
+        }
+        else if (ICU_LPTMR_MODULE == (*pIpConfig)[index].instanceIp)
+        {
+            (void)Lptmr_Icu_Ip_Init((*pIpConfig)[index].instanceNo, \
+                                              (*pIpConfig)[index].pLptmrHwIpConfig);
+        }
+        else if (ICU_PORT_CI_MODULE == (*pIpConfig)[index].instanceIp)
+        {
+            (void)Port_Ci_Icu_Ip_Init((*pIpConfig)[index].instanceNo, \
+                                              (*pIpConfig)[index].pPortCiHwIpConfig);
+        }
+        else if (ICU_CMP_MODULE == (*pIpConfig)[index].instanceIp)
+        {
+            (void)Cmp_Ip_Init((*pIpConfig)[index].instanceNo, \
+                            (*pIpConfig)[index].pCmpHwIpConfig);
+        }
+        else
+        {
+            /* Default do nothing. */
+        }
+    }
+}
+
+#if (STD_ON == ICU_DE_INIT_API)
+/**
+* @brief              Icu_Ipw_DeInit
+* @details            De-initialize ICU hardware channel
+*
+* @param[in]          pIpConfig - Pointer to ICU top configuration structure
+*
+* @return void
+*
+* @pre                Icu_Init must be called before.
+*
+*/
+void Icu_Ipw_DeInit(uint8 count, const Icu_Ipw_IpConfigType (*pIpConfig)[])
+{
+    uint8 index;
+
+    for(index = 0; index < count; index++)
+    {
+        if (ICU_FTM_MODULE == (*pIpConfig)[index].instanceIp)
+        {
+            (void)Ftm_Icu_Ip_DeInit((*pIpConfig)[index].instanceNo);
+        }
+        else if (ICU_LPIT_MODULE == (*pIpConfig)[index].instanceIp)
+        {
+            (void)Lpit_Icu_Ip_Deinit((*pIpConfig)[index].instanceNo);
+        }
+        else if (ICU_LPTMR_MODULE == (*pIpConfig)[index].instanceIp)
+        {
+            (void)Lptmr_Icu_Ip_Deinit((*pIpConfig)[index].instanceNo);
+        }
+        else if (ICU_PORT_CI_MODULE == (*pIpConfig)[index].instanceIp)
+        {
+            (void)Port_Ci_Icu_Ip_DeInit((*pIpConfig)[index].instanceNo);
+        }
+        else if (ICU_CMP_MODULE == (*pIpConfig)[index].instanceIp)
+        {
+            (void)Cmp_Ip_Deinit((*pIpConfig)[index].instanceNo);
+        }
+        else
+        {
+            /* Default do nothing. */
+        }
+    }
+}
+#endif /* ICU_DE_INIT_API == STD_ON */
+
+#if (ICU_SET_MODE_API == STD_ON)
+/**
+ * @brief Put the channel in a reduce power state.
+ * @details    Set sleep mode
+ * 
+ * @param ChannelConfig - configuration of the channel
+ *
+ * @return void
+ * @internal
+ */
+void Icu_Ipw_SetSleepMode(const Icu_Ipw_ChannelConfigType* ChannelConfig)
+{
+    uint8 channel;
+    uint8 module = ChannelConfig->instanceNo;
+    Icu_Ipw_ModuleType ipType = ChannelConfig->channelIp;
+
+    /* Select IP type case. */
+    switch(ipType)
+    {
+        case ICU_FTM_MODULE:
+        {
+            channel = (ChannelConfig->pFtmHwChannelConfig)->hwChannel;
+            Ftm_Icu_Ip_SetSleepMode(module, channel);
+            break;
+        }
+        case ICU_LPTMR_MODULE:
+        {
+            Lptmr_Icu_Ip_SetSleepMode(module);
+            break;
+        }
+        case ICU_PORT_CI_MODULE:
+        {
+            channel = (ChannelConfig->pPortCiHwChannelConfig)->pinId;
+            Port_Ci_Icu_Ip_SetSleepMode(module, channel);
+            break;
+        }
+        default:
+        {
+            /* Do nothing. */
+        }
+        break;
+    }
+}
+
+/**
+ * @brief      Icu_Ipw_SetNormalMode
+ * @details    Set normal mode
+ *
+ * @param[in]  ChannelConfig - The index of ICU channel for current configuration structure
+ *
+ * @return void
+ * @internal
+ */
+void Icu_Ipw_SetNormalMode (const Icu_Ipw_ChannelConfigType* ChannelConfig)
+{
+    uint8 channel;
+    uint8 module = ChannelConfig->instanceNo;
+    Icu_Ipw_ModuleType ipType = ChannelConfig->channelIp;
+
+    /* Select IP type case. */
+    switch(ipType)
+    {
+        case ICU_FTM_MODULE:
+        {
+            channel = (ChannelConfig->pFtmHwChannelConfig)->hwChannel;
+            Ftm_Icu_Ip_SetNormalMode(module, channel);
+            break;
+        }
+        case ICU_LPTMR_MODULE:
+        {
+            Lptmr_Icu_Ip_SetNormalMode(module);
+            break;
+        }
+        case ICU_PORT_CI_MODULE:
+        {
+            channel = (ChannelConfig->pPortCiHwChannelConfig)->pinId;
+            Port_Ci_Icu_Ip_SetNormalMode(module, channel);
+            break;
+        }
+        default:
+            {
+                /* Do nothing. */
+            }
+            break;
+    }
+}
+#endif  /* ICU_SET_MODE_API */
+
+/**
+* @brief      Icu_Ipw_SetActivationCondition
+ * @brief 
+ * 
+ * @param activation    - the type of activation for the ICU channel.
+ * @param ChannelConfig - channel to be configured.
+*
+* @return void
+*
+*/
+void Icu_Ipw_SetActivationCondition(Icu_ActivationType activation,
+                                    const Icu_Ipw_ChannelConfigType* ChannelConfig)
+{
+    uint8 channel;
+    uint8 module = ChannelConfig->instanceNo;
+    Icu_Ipw_ModuleType ipType = ChannelConfig->channelIp;
+
+    /* Select IP type case. */
+    switch(ipType)
+    {
+        case ICU_FTM_MODULE:
+        {
+            channel = (ChannelConfig->pFtmHwChannelConfig)->hwChannel;
+            if (ICU_FALLING_EDGE == activation)
+            {
+                Ftm_Icu_Ip_SetActivationCondition(module, channel, FTM_ICU_FALLING_EDGE);
+            }
+            else if (ICU_RISING_EDGE == activation)
+            {
+                Ftm_Icu_Ip_SetActivationCondition(module, channel, FTM_ICU_RISING_EDGE);
+            }
+            else if (ICU_BOTH_EDGES == activation)
+            {
+                Ftm_Icu_Ip_SetActivationCondition(module, channel, FTM_ICU_BOTH_EDGES);
+            }
+            else
+            {
+                Ftm_Icu_Ip_SetActivationCondition(module, channel, FTM_ICU_NO_PIN_CONTROL);
+            }
+            break;
+        }
+        case ICU_PORT_CI_MODULE:
+        {
+            channel = (ChannelConfig->pPortCiHwChannelConfig)->pinId;
+            if (ICU_FALLING_EDGE == activation)
+            {
+                Port_Ci_Icu_Ip_SetActivationCondition(module, channel, PORT_CI_ICU_FALLING_EDGE);
+            }
+            else if (ICU_RISING_EDGE == activation)
+            {
+                Port_Ci_Icu_Ip_SetActivationCondition(module, channel, PORT_CI_ICU_RISING_EDGE);
+            }
+            else if (ICU_BOTH_EDGES == activation)
+            {
+                Port_Ci_Icu_Ip_SetActivationCondition(module, channel, PORT_CI_ICU_BOTH_EDGES);
+            }
+            else
+            {
+                Port_Ci_Icu_Ip_SetActivationCondition(module, channel, PORT_CI_ICU_NO_PIN_CONTROL);
+            }
+            break;
+        }
+        case ICU_LPTMR_MODULE:
+        {
+            if (ICU_FALLING_EDGE == activation)
+            {
+                Lptmr_Icu_Ip_SetActivationCondition(module, LPTMR_ICU_FALLING_EDGE);
+            }
+            else
+            {
+                Lptmr_Icu_Ip_SetActivationCondition(module, LPTMR_ICU_RISING_EDGE);
+            }
+            break;
+        }
+        case ICU_CMP_MODULE:
+        {
+            if (ICU_FALLING_EDGE == activation)
+            {
+                Cmp_Ip_SetInterruptActivation(module, CMP_IP_INTTRIG_FALLING_EDGE);
+            }
+            else if (ICU_RISING_EDGE == activation)
+            {
+                Cmp_Ip_SetInterruptActivation(module, CMP_IP_INTTRIG_RISING_EDGE);
+            }
+            else if (ICU_BOTH_EDGES == activation)
+            {
+                Cmp_Ip_SetInterruptActivation(module, CMP_IP_INTTRIG_BOTH_EDGES);
+            }
+            else
+            {
+                Cmp_Ip_SetInterruptActivation(module, CMP_IP_INTTRIG_NONE);
+            }
+            break;
+        }
+        default:
+            {
+                /* Do nothing. */
+            }
+            break;
+    }
+}
+
+#if (ICU_GET_INPUT_STATE_API == STD_ON)
+/**
+ * @brief Service that returns the state of the ICU driver.
+ * 
+ * @param ChannelConfig 
+ * @return boolean 
+ */
+boolean Icu_Ipw_GetInputState(const Icu_Ipw_ChannelConfigType *ChannelConfig)
+{
+    boolean retState = FALSE;
+
+    if (ICU_FTM_MODULE == ChannelConfig->channelIp)
+    {
+        retState = Ftm_Icu_Ip_GetInputState(ChannelConfig->instanceNo, \
+                        (ChannelConfig->pFtmHwChannelConfig)->hwChannel);
+    }
+    else if (ICU_LPIT_MODULE == ChannelConfig->channelIp)
+    {
+        retState = Lpit_Icu_Ip_GetInputState(ChannelConfig->instanceNo, \
+                        (ChannelConfig->pLpitHwChannelConfig)->hwChannel);
+    }
+    else if (ICU_LPTMR_MODULE == ChannelConfig->channelIp)
+    {
+        retState = Lptmr_Icu_Ip_GetInputState(ChannelConfig->instanceNo);
+    }
+    else if (ICU_PORT_CI_MODULE == ChannelConfig->channelIp)
+    {
+        retState = Port_Ci_Icu_Ip_GetInputState(ChannelConfig->instanceNo, \
+                        (ChannelConfig->pPortCiHwChannelConfig)->pinId);
+    }
+    else if (ICU_CMP_MODULE == ChannelConfig->channelIp)
+    {
+        retState = Cmp_Ip_GetStatus(ChannelConfig->instanceNo);
+    }
+    else
+    {
+        retState = FALSE;
+    }
+    return (retState);
+}
+#endif /* ICU_GET_INPUT_STATE_API */
+
+#if (STD_ON == ICU_TIMESTAMP_API)
+void Icu_Ipw_StartTimestamp(const Icu_Ipw_ChannelConfigType* channelConfig,
+                            uint16* bufferPtr,
+                            uint16  bufferSize,
+                            uint16  notifyInterval)
+{
+    /* Select IP type. */
+    switch(channelConfig->channelIp)
+    {
+        case ICU_FTM_MODULE:
+        {
+            /* Call FTM start timestamp function. */
+            Ftm_Icu_Ip_StartTimestamp(channelConfig->instanceNo,
+                                      (channelConfig->pFtmHwChannelConfig)->hwChannel,
+                                      bufferPtr,
+                                      bufferSize,
+                                      notifyInterval);
+            break;
+        }
+        case ICU_LPIT_MODULE:
+        {
+            Lpit_Icu_Ip_StartTimestamp(channelConfig->instanceNo,
+                                       (channelConfig->pLpitHwChannelConfig)->hwChannel,
+                                       bufferPtr,
+                                       bufferSize,
+                                       notifyInterval);
+            break;
+        }
+        default:
+        {
+            /* Do nothing. */
+            break;
+        }
+    }
+}
+
+void Icu_Ipw_StopTimestamp(const Icu_Ipw_ChannelConfigType *channelConfig)
+{
+    /* Select IP type. */
+    switch(channelConfig->channelIp)
+    {
+        case ICU_FTM_MODULE:
+        {
+            /* Call FTM stop timestamp function. */
+            Ftm_Icu_Ip_StopTimestamp(channelConfig->instanceNo, \
+                                     (channelConfig->pFtmHwChannelConfig)->hwChannel);
+            break;
+        }
+        case ICU_LPIT_MODULE:
+        {
+            Lpit_Icu_Ip_DisableDetectionMode(channelConfig->instanceNo, \
+                                      (channelConfig->pLpitHwChannelConfig)->hwChannel);
+            break;
+        }
+        default:
+        {
+            /* Do nothing. */
+            break;
+        }
+    }
+}
+
+uint16 Icu_Ipw_GetTimestampIndex(const Icu_Ipw_ChannelConfigType* channelConfig)
+{
+    uint16 timestampIndex = 0U;
+    /* Select IP type. */
+    switch(channelConfig->channelIp)
+    {
+        case ICU_FTM_MODULE:
+        {
+            timestampIndex = Ftm_Icu_Ip_GetTimestampIndex(channelConfig->instanceNo, \
+                                                          (channelConfig->pFtmHwChannelConfig)->hwChannel);
+            break;
+        }
+        case ICU_LPIT_MODULE:
+        {
+            timestampIndex = Lpit_Icu_Ip_GetTimestampIndex(channelConfig->instanceNo,
+                                                           (channelConfig->pLpitHwChannelConfig)->hwChannel);
+            break;
+        }
+        default:
+        {
+            /* Do nothing. */
+            break;
+        }
+    }
+    return timestampIndex;
+}
+
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+uint32 Icu_Ipw_GetStartAddress(const Icu_Ipw_ChannelConfigType *ChannelConfig)
+{
+    uint32 startAddr = 0U;
+    if (ICU_FTM_MODULE == ChannelConfig->channelIp)
+    {
+        startAddr = Ftm_Icu_Ip_GetStartAddress(ChannelConfig->instanceNo, \
+                               (ChannelConfig->pFtmHwChannelConfig)->hwChannel);
+    }
+    return startAddr;
+}
+#endif  /* ICU_TIMESTAMP_USES_DMA == STD_ON */
+
+#endif  /* ICU_TIMESTAMP_API == STD_ON */
+
+#if (STD_ON == ICU_EDGE_COUNT_API)
+void Icu_Ipw_ResetEdgeCount(const Icu_Ipw_ChannelConfigType *ChannelConfig)
+{
+    /* Select IP type case. */
+    if(ICU_FTM_MODULE == ChannelConfig->channelIp)
+    {
+        Ftm_Icu_Ip_ResetEdgeCount(ChannelConfig->instanceNo, \
+                    (ChannelConfig->pFtmHwChannelConfig)->hwChannel);
+    }
+    else if(ICU_LPTMR_MODULE == ChannelConfig->channelIp)
+    {
+        Lptmr_Icu_Ip_ResetEdgeCount(ChannelConfig->instanceNo);
+    }
+    else
+    {
+        /* Default do nothing. */
+    }
+}
+
+void Icu_Ipw_EnableEdgeCount(const Icu_Ipw_ChannelConfigType *ChannelConfig)
+{
+    /* Select IP type case. */
+    if(ICU_FTM_MODULE == ChannelConfig->channelIp)
+    {
+        (void)Ftm_Icu_Ip_EnableEdgeCount(ChannelConfig->instanceNo, \
+                    (ChannelConfig->pFtmHwChannelConfig)->hwChannel);
+    }
+    else if(ICU_LPTMR_MODULE == ChannelConfig->channelIp)
+    {
+        Lptmr_Icu_Ip_EnableEdgeCount(ChannelConfig->instanceNo);
+    }
+    else
+    {
+        /* Default do nothing. */
+    }
+}
+
+void Icu_Ipw_DisableEdgeCount(const Icu_Ipw_ChannelConfigType *ChannelConfig)
+{
+    /* Select IP type case. */
+    if(ICU_FTM_MODULE == ChannelConfig->channelIp)
+    {
+        (void)Ftm_Icu_Ip_DisableEdgeCount(ChannelConfig->instanceNo, \
+                    (ChannelConfig->pFtmHwChannelConfig)->hwChannel);
+    }
+    else if(ICU_LPTMR_MODULE == ChannelConfig->channelIp)
+    {
+        (void)Lptmr_Icu_Ip_DisableEdgeCount(ChannelConfig->instanceNo);
+    }
+    else
+    {
+        /* Default do nothing. */
+    }
+}
+
+uint16 Icu_Ipw_GetEdgeNumbers(const Icu_Ipw_ChannelConfigType *ChannelConfig)
+{
+    uint16 edgeNumber = (uint16)0U;
+
+    /* Select IP type case. */
+    if(ICU_FTM_MODULE == ChannelConfig->channelIp)
+    {
+        edgeNumber = (uint16)Ftm_Icu_Ip_GetEdgeNumbers(ChannelConfig->instanceNo, \
+                        (ChannelConfig->pFtmHwChannelConfig)->hwChannel);
+    }
+    else if(ICU_LPTMR_MODULE == ChannelConfig->channelIp)
+    {
+        edgeNumber = (uint16)Lptmr_Icu_Ip_GetEdgeNumbers(ChannelConfig->instanceNo);
+    }
+    else
+    {
+        edgeNumber = (uint16)0U;
+    }
+
+    return edgeNumber;
+}
+#endif  /* STD_ON == ICU_EDGE_COUNT_API */
+
+#if (STD_ON == ICU_EDGE_DETECT_API)
+/**
+ * @brief          Retrieve the number of edges
+ *
+ * @param[in]      nChannelNumber - The index of ICU channel for current configuration structure
+ * @return         void
+ */
+void Icu_Ipw_EnableEdgeDetection(const Icu_Ipw_ChannelConfigType * ChannelConfig)
+{
+    uint8 channel;
+    uint8 module = ChannelConfig->instanceNo;
+    Icu_Ipw_ModuleType ipType = ChannelConfig->channelIp;
+
+    /* Select IP type case. */
+    switch(ipType)
+    {
+        case ICU_FTM_MODULE:
+        {
+            channel = (ChannelConfig->pFtmHwChannelConfig)->hwChannel;
+            (void)Ftm_Icu_Ip_EnableEdgeDetection(module, channel);
+            break;
+        }
+        case ICU_LPIT_MODULE:
+        {
+            channel = (ChannelConfig->pLpitHwChannelConfig)->hwChannel;
+            Lpit_Icu_Ip_EnableEdgeDetection(module, channel);
+            break;
+        }
+        case ICU_LPTMR_MODULE:
+        {
+            Lptmr_Icu_Ip_EnableEdgeDetection(module);
+            break;
+        }
+        case ICU_PORT_CI_MODULE:
+        {
+            channel = (ChannelConfig->pPortCiHwChannelConfig)->pinId;
+            Port_Ci_Icu_Ip_EnableEdgeDetection(module, channel);
+            break;
+        }
+        case ICU_CMP_MODULE:
+        {
+            Cmp_Ip_EnableInterrupt(module);
+            Cmp_Ip_EnableNotification(module);
+            break;
+        }
+        default:
+        {
+            /* Do nothing. */
+            break;
+        }
+    }
+}
+#endif /* ICU_EDGE_DETECT_API */
+
+#if (ICU_EDGE_DETECT_API == STD_ON)
+/**
+ * @brief 
+ * 
+ * @param ChannelConfig - channel configuration used.
+ */
+void Icu_Ipw_DisableEdgeDetection(const Icu_Ipw_ChannelConfigType* ChannelConfig)
+{
+    uint8 channel;
+    uint8 module = ChannelConfig->instanceNo;
+    Icu_Ipw_ModuleType ipType = ChannelConfig->channelIp;
+
+    /* Select IP type case. */
+    switch(ipType)
+    {
+        case ICU_FTM_MODULE:
+        {
+            channel = (ChannelConfig->pFtmHwChannelConfig)->hwChannel;
+            (void)Ftm_Icu_Ip_DisableEdgeDetection(module, channel);
+            break;
+        }
+        case ICU_LPIT_MODULE:
+        {
+            channel = (ChannelConfig->pLpitHwChannelConfig)->hwChannel;
+            Lpit_Icu_Ip_DisableDetectionMode(module, channel);
+            break;
+        }
+        case ICU_LPTMR_MODULE:
+        {
+            Lptmr_Icu_Ip_DisableDetection(module);
+            break;
+        }
+        case ICU_PORT_CI_MODULE:
+        {
+            channel = (ChannelConfig->pPortCiHwChannelConfig)->pinId;
+            Port_Ci_Icu_Ip_DisableDetection(module, channel);
+            break;
+        }
+        case ICU_CMP_MODULE:
+        {
+            Cmp_Ip_DisableInterrupt(module);
+            Cmp_Ip_DisableNotification(module);
+            break;
+        }
+        default:
+        {
+            /* Do nothing. */
+            break;
+        }
+    }
+}
+#endif /* ICU_EDGE_DETECT_API */
+
+#if ((ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (ICU_VALIDATE_PARAMS == STD_ON))
+#if ((ICU_EDGE_COUNT_API == STD_ON) || (ICU_TIMESTAMP_API == STD_ON) || \
+     (ICU_GET_TIME_ELAPSED_API == STD_ON) || (ICU_GET_DUTY_CYCLE_VALUES_API == STD_ON) )
+/**
+ * @brief The function get the state of the overflow flag
+ * @internal
+ * @param ChannelConfig      Channel configuration pointer
+ * @return      boolean      the state of the overflow flag
+ * @retval      TRUE         the overflow flag is set
+ * @retval      FALSE        the overflow flag is not set
+ */
+boolean Icu_Ipw_Get_Overflow(const Icu_Ipw_ChannelConfigType* ChannelConfig)
+{
+    boolean bOverflow = FALSE;
+
+    if (ICU_FTM_MODULE == ChannelConfig->channelIp)
+    {
+        /* Check if FTM Module Overflow. */
+        bOverflow = (boolean)Ftm_Icu_Ip_GetOverflow(ChannelConfig->instanceNo);
+    }
+    return bOverflow;
+}
+#endif /* ICU_EDGE_COUNT_API == STD_ON */
+#endif /* (ICU_OVERFLOW_NOTIFICATION_API == STD_OFF) && (ICU_VALIDATE_PARAMS == STD_ON) */
+
+#if (STD_ON == ICU_GET_INPUT_LEVEL_API)
+Icu_LevelType Icu_Ipw_GetInputLevel(const Icu_Ipw_ChannelConfigType* ChannelConfig)
+{
+    Icu_LevelType nInputLevel;
+
+    /* Select IP type case. */
+    switch(ChannelConfig->channelIp)
+    {
+        case ICU_FTM_MODULE:
+        {
+            nInputLevel = (Ftm_Icu_Ip_GetInputLevel(ChannelConfig->instanceNo, \
+                            (ChannelConfig->pFtmHwChannelConfig)->hwChannel) == FTM_ICU_LEVEL_HIGH)?ICU_LEVEL_HIGH:ICU_LEVEL_LOW;
+            break;
+        }
+        default:
+        {
+            nInputLevel = ICU_LEVEL_LOW;
+            break;
+        }
+    }
+    return nInputLevel;
+}
+#endif /* STD_ON == ICU_GET_INPUT_LEVEL_API */
+
+#if ((ICU_CAPTURERGISTER_API == STD_ON) && ((ICU_SIGNAL_MEASUREMENT_API == STD_ON) || (ICU_TIMESTAMP_API == STD_ON)))/**
+ * @brief      Capture the value of counter register for a specified channel.
+ * 
+ * @details   The API shall return the value stored in capture register.
+ *            The API is the equivalent of AUTOSAR API GetCaptureRegisterValue.
+ * 
+ * @param ChannelConfig      Channel configuration pointer
+ * @return     uint32  Value of the register captured.
+ */
+Icu_ValueType Icu_Ipw_GetCaptureRegisterValue (const Icu_Ipw_ChannelConfigType* ChannelConfig)
+{
+    Icu_ValueType nRValue;
+    if (ICU_FTM_MODULE == ChannelConfig->channelIp)
+    {
+        /* Get FTM Module Capture Register Value */
+        nRValue = (Icu_ValueType)Ftm_Icu_Ip_GetCaptureRegisterValue(ChannelConfig->instanceNo, \
+                                                                    (ChannelConfig->pFtmHwChannelConfig)->hwChannel);
+    }
+    else
+    {
+        nRValue = (Icu_ValueType)0U;
+    }
+    return nRValue;
+}
+#endif
+
+#if (STD_ON == ICU_SIGNAL_MEASUREMENT_API)
+void Icu_Ipw_StartSignalMeasurement (const Icu_Ipw_ChannelConfigType* ChannelConfig)
+{
+    if (ICU_FTM_MODULE == ChannelConfig->channelIp)
+    {
+        /* Start Signal Measurement. */
+        Ftm_Icu_Ip_StartSignalMeasurement(ChannelConfig->instanceNo, \
+                    (ChannelConfig->pFtmHwChannelConfig)->hwChannel);
+    }
+}
+
+void Icu_Ipw_StopSignalMeasurement(const Icu_Ipw_ChannelConfigType * ChannelConfig)
+{
+    if (ICU_FTM_MODULE == ChannelConfig->channelIp)
+    {
+        /* Start Signal Measurement. */
+        Ftm_Icu_Ip_StopSignalMeasurement(ChannelConfig->instanceNo, \
+                    (ChannelConfig->pFtmHwChannelConfig)->hwChannel);
+    }
+}
+
+void Icu_Ipw_GetPWandPeriod(const Icu_Ipw_ChannelConfigType* channelConfig, \
+                            Icu_ValueType* Icu_aActivePulseWidth, \
+                            Icu_ValueType* Icu_aPeriod)
+{
+    /* Select IP type case. */
+    if(ICU_FTM_MODULE == channelConfig->channelIp)
+    {
+        Ftm_Icu_Ip_GetPWandPeriod(channelConfig->instanceNo, \
+                                  (channelConfig->pFtmHwChannelConfig)->hwChannel, \
+                                  (uint16*)Icu_aActivePulseWidth, \
+                                  (uint16*)Icu_aPeriod);
+    }
+}
+
+#endif  /* STD_ON == ICU_SIGNAL_MEASUREMENT_API */
+
+#if (STD_ON == ICU_GET_DUTY_CYCLE_VALUES_API)
+void Icu_Ipw_GetDutyCycleValues(const Icu_Ipw_ChannelConfigType* channelConfig,
+                                Icu_DutyCycleType* DutyCycleValues)
+{
+    /* Select IP type case. */
+    if(ICU_FTM_MODULE == channelConfig->channelIp)
+    {
+        Ftm_Icu_Ip_DutyCycleType ftmDutyCycleValues = {0, 0};
+        Ftm_Icu_Ip_GetDutyCycleValues(channelConfig->instanceNo, \
+                                      (channelConfig->pFtmHwChannelConfig)->hwChannel, \
+                                      &ftmDutyCycleValues);
+        DutyCycleValues->ActiveTime = (Icu_ValueType)ftmDutyCycleValues.ActiveTime;
+        DutyCycleValues->PeriodTime = (Icu_ValueType)ftmDutyCycleValues.PeriodTime;
+    }
+}
+#endif /* STD_ON == ICU_GET_DUTY_CYCLE_VALUES_API */
+
+#if (STD_ON == ICU_GET_TIME_ELAPSED_API)
+Icu_ValueType Icu_Ipw_GetTimeElapsed(const Icu_Ipw_ChannelConfigType* channelConfig)
+{
+    uint16 timeElapsed;
+    /* Select IP type case. */
+    switch(channelConfig->channelIp)
+    {
+        case ICU_FTM_MODULE:
+        {
+            timeElapsed = Ftm_Icu_Ip_GetTimeElapsed(channelConfig->instanceNo, \
+                                                   (channelConfig->pFtmHwChannelConfig)->hwChannel);
+            break;
+        }
+        default:
+        {
+            timeElapsed = 0U;
+            break;
+        }
+    }
+    return (Icu_ValueType)timeElapsed;
+}
+
+#endif /* STD_ON == ICU_GET_TIME_ELAPSED_API */
+
+#if (STD_ON == ICU_DUAL_CLOCK_MODE_API)
+/**
+ * @brief This function sets the module prescalers based on the input mode.
+ * 
+ * @param moduleConfig 
+ * @param selectPrescaler Prescaler type ( Normal or Alternate )
+ * @param modulesNumber 
+ */
+void Icu_Ipw_SetClockMode(const Icu_Ipw_IpConfigType (*moduleConfig)[], Icu_SelectPrescalerType selectPrescaler, uint8 modulesNumber)
+{
+    uint8              index;
+    uint8              module;
+    Icu_Ipw_ModuleType ipType;
+
+    for(index = 0; index < modulesNumber; index++)
+    {
+        ipType = (*moduleConfig)[index].instanceIp;
+        module = (*moduleConfig)[index].instanceNo;
+
+        /* Select IP type case. */
+        switch(ipType)
+        {
+            case ICU_FTM_MODULE:
+            {
+                Ftm_Icu_Ip_SetPrescaler(module, \
+                    (selectPrescaler == ICU_ALTERNATE_CLOCK_MODE) ? FTM_ICU_ALTERNATE_CLK : FTM_ICU_NORMAL_CLK);
+                break;
+            }
+            default:
+            {
+                /* Do nothing. */
+                break;
+            }
+
+        }
+    }
+}
+#endif /* STD_ON == ICU_DUAL_CLOCK_MODE_API */
+
+#if ((ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_INPUT_LEVEL_API == STD_ON))
+Icu_Ipw_StatusType Icu_Ipw_ValidateGetInputLevel(const Icu_Ipw_ChannelConfigType * ChannelConfig)
+{
+    Icu_Ipw_ModuleType  ipType = ChannelConfig->channelIp;
+    Icu_Ipw_StatusType result = ICU_IPW_ERROR;
+
+    /* Select IP type case. */
+    if(ICU_FTM_MODULE == ipType)
+    {
+        result = ICU_IPW_SUCCESS;
+    }
+    return result;
+}
+#endif /* (ICU_VALIDATE_PARAMS == STD_ON) && (ICU_GET_INPUT_LEVEL_API == STD_ON */
+
+void Icu_Ipw_EnableNotification(const Icu_Ipw_ChannelConfigType* ChannelConfig)
+{
+    uint8 channel;
+    uint8 module = ChannelConfig->instanceNo;
+    Icu_Ipw_ModuleType ipType = ChannelConfig->channelIp;
+
+    /* Select IP type case. */
+    switch(ipType)
+    {
+        case ICU_FTM_MODULE:
+        {
+            channel = (ChannelConfig->pFtmHwChannelConfig)->hwChannel;
+            Ftm_Icu_Ip_EnableNotification(module, channel);
+            break;
+        }
+        case ICU_LPIT_MODULE:
+        {
+            channel = (ChannelConfig->pLpitHwChannelConfig)->hwChannel;
+            Lpit_Icu_Ip_EnableNotification(module, channel);
+            break;
+        }
+        default:
+        {
+            /* Do nothing. */
+        }
+        break;
+    }
+}
+
+void Icu_Ipw_DisableNotification(const Icu_Ipw_ChannelConfigType* ChannelConfig)
+{
+    uint8 channel;
+    uint8 module = ChannelConfig->instanceNo;
+    Icu_Ipw_ModuleType ipType = ChannelConfig->channelIp;
+
+    /* Select IP type case. */
+    switch(ipType)
+    {
+        case ICU_FTM_MODULE:
+        {
+            channel = (ChannelConfig->pFtmHwChannelConfig)->hwChannel;
+            Ftm_Icu_Ip_DisableNotification(module, channel);
+            break;
+        }
+        case ICU_LPIT_MODULE:
+        {
+            channel = (ChannelConfig->pLpitHwChannelConfig)->hwChannel;
+            Lpit_Icu_Ip_DisableNotification(module, channel);
+            break;
+        }
+        default:
+        {
+            /* Do nothing. */
+        }
+        break;
+    }
+}
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 363 - 0
RTD/src/Lpit_Icu_Ip.c

@@ -0,0 +1,363 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file       Lpit_Icu_Ip.c
+ *     @details    This source file contains the code for all driver functions which are using LPIT
+ *                 module.
+ *     @addtogroup lpit_icu_ip LPIT IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lpit_Icu_Ip.h"
+
+#if(LPIT_ICU_IP_DEV_ERROR_DETECT == STD_ON)
+#include "Devassert.h"
+#endif
+/*==================================================================================================
+*                                  SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPIT_ICU_IP_VENDOR_ID_C                    43
+#define LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION_C     4
+#define LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION_C     4
+#define LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION_C  0
+#define LPIT_ICU_IP_SW_MAJOR_VERSION_C             1
+#define LPIT_ICU_IP_SW_MINOR_VERSION_C             0
+#define LPIT_ICU_IP_SW_PATCH_VERSION_C             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and Lpit_Icu_Ip.h header file are of the same vendor */
+#if (LPIT_ICU_IP_VENDOR_ID_C != LPIT_ICU_IP_VENDOR_ID)
+    #error "Lpit_Icu_Ip.c and Lpit_Icu_Ip.h have different vendor IDs"
+#endif
+
+/* Check if source file and Lpit_Icu_Ip.h header file are of the same AUTOSAR version */
+#if ((LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION_C    != LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION_C    != LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION_C != LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lpit_Icu_Ip.c and Lpit_Icu_Ip.h are different"
+#endif
+
+/* Check if source file and Lpit_Icu_Ip.h header file are of the same software version */
+#if ((LPIT_ICU_IP_SW_MAJOR_VERSION_C != LPIT_ICU_IP_SW_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_SW_MINOR_VERSION_C != LPIT_ICU_IP_SW_MINOR_VERSION) || \
+     (LPIT_ICU_IP_SW_PATCH_VERSION_C != LPIT_ICU_IP_SW_PATCH_VERSION))
+#error "Software Version Numbers of Lpit_Icu_Ip.c and Lpit_Icu_Ip.h are different"
+#endif
+
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if(LPIT_ICU_IP_DEV_ERROR_DETECT == STD_ON)
+        /* Check if this header file and Devassert.h file are of the same Autosar version */
+        #if ((LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != DEVASSERT_AR_RELEASE_MAJOR_VERSION) || \
+             (LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION_C != DEVASSERT_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Lpit_Icu_Ip.c and Devassert.h are different"
+        #endif
+    #endif
+#endif
+
+/*==================================================================================================
+*                                        LOCAL CONSTANTS
+==================================================================================================*/
+#define ICU_START_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+/* Table of base addresses for LPIT instances. */
+LPIT_Type* const lpitBase[] = IP_LPIT_BASE_PTRS;
+
+#define ICU_STOP_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
+#include "Icu_MemMap.h"
+
+#if (STD_ON == LPIT_ICU_TIMESTAMP_API)
+Lpit_Icu_Ip_TimestampType timestampState[LPIT_INSTANCE_COUNT][LPIT_TMR_COUNT];
+#endif
+
+Lpit_Icu_Ip_ChannelsStateType channelsState[LPIT_INSTANCE_COUNT][LPIT_TMR_COUNT];
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+/** @implements Lpit_Icu_Ip_Init_Activity */
+Lpit_Icu_Ip_StatusType Lpit_Icu_Ip_Init (uint8 instance, const Lpit_Icu_Ip_ConfigType * userConfig)
+{
+    const Lpit_Icu_Ip_ChannelConfigType* lpitChConfig;
+    uint8  counter;
+
+    /* Enable hardware module clock. This shall be be executed before any other setup is made. */
+    lpitBase[instance]->MCR |= LPIT_MCR_M_CEN_MASK;
+
+    for (counter = 0U; counter < userConfig->numberOfChannels; counter++)
+    {
+        lpitChConfig = &(*userConfig->pChannelsConfig)[counter];
+
+        /* Enables the LPIT timer channel. */
+        lpitBase[instance]->TMR[lpitChConfig->hwChannel].TCTRL |= LPIT_TMR_TCTRL_T_EN_MASK;
+
+        /* Disable channel interrupts. */
+        lpitBase[instance]->MIER &= ~(uint32)(LPIT_MIER_TIE_START_MASK << (uint32)lpitChConfig->hwChannel);
+
+        /* Clear pending interrupts. */
+        lpitBase[instance]->MSR |= (uint32)(LPIT_MSR_TIF_START_MASK << (uint32)lpitChConfig->hwChannel);
+
+        /* Enable LPIT in DOZE mode. */
+        lpitBase[instance]->MCR |= LPIT_MCR_DOZE_EN_MASK;
+
+        /* Enable/Disable Debug(freeze) mode. */
+/*         if ((uint8)1U == u8freezeEnable)
+        {
+           REG_BIT_SET32(LPIT_MCR_ADDR32(instance), LPIT_MCR_FRZ_MASK_U32);
+        }
+        else
+        {
+           REG_BIT_CLEAR32(LPIT_MCR_ADDR32(instance), LPIT_MCR_FRZ_MASK_U32);
+        } */
+        lpitBase[instance]->MCR |= (uint32)((uint32)(userConfig->debugState?1U:0U) << LPIT_MCR_DBG_EN_SHIFT);
+
+        /* Select source of trigger as internal/external trigger. */
+/*      if ((uint8)1U == u8TriggerSource)
+        {
+            Trigger source selected is the internal trigger
+           REG_BIT_SET32(LPIT_TCTRL_ADDR32((instance),(currentCh)),(uint32)LPIT_TCTRL_TRG_SRC_MASK_U32);
+        }
+        else
+        {
+            Trigger source selected is the external trigger
+           REG_BIT_CLEAR32(LPIT_TCTRL_ADDR32((instance),(currentCh)),(uint32)LPIT_TCTRL_TRG_SRC_MASK_U32);
+        } */
+        lpitBase[instance]->TMR[lpitChConfig->hwChannel].TCTRL |= (uint32)((uint32)lpitChConfig->triggerSource << LPIT_TMR_TCTRL_TRG_SRC_SHIFT);
+
+        /* Selects the trigger to use for starting and/or reloading the LPIT timer. */
+        lpitBase[instance]->TMR[lpitChConfig->hwChannel].TCTRL |= (uint32)((uint32)lpitChConfig->triggerSelect << LPIT_TMR_TCTRL_TRG_SEL_SHIFT);
+
+        /* Enter Trigger Input Capture Mode */
+        lpitBase[instance]->TMR[lpitChConfig->hwChannel].TCTRL |= LPIT_TMR_TCTRL_MODE_MASK;
+
+        channelsState[instance][lpitChConfig->hwChannel].initState = TRUE;
+        channelsState[instance][lpitChConfig->hwChannel].callback = lpitChConfig->callback;
+        channelsState[instance][lpitChConfig->hwChannel].callbackParams = lpitChConfig->callbackParams;
+        channelsState[instance][lpitChConfig->hwChannel].lpitChannelNotify = lpitChConfig->lpitChannelNotify;
+        channelsState[instance][lpitChConfig->hwChannel].logicChStateCallback = lpitChConfig->logicChStateCallback;
+        channelsState[instance][lpitChConfig->hwChannel].notificationEnable = lpitChConfig->initNotificationEnable;
+
+#if (STD_ON == LPIT_ICU_TIMESTAMP_API)
+        /* Save state for the timestamp APIs. */
+        timestampState[instance][lpitChConfig->hwChannel].timestampBuffer     = lpitChConfig->timestampBuffer;
+#endif
+    }
+    return LPIT_IP_STATUS_SUCCESS;
+}
+
+#if (LPIT_ICU_DEINIT_API == STD_ON)
+/** @implements Lpit_Icu_Ip_Deinit_Activity */
+Lpit_Icu_Ip_StatusType Lpit_Icu_Ip_Deinit(uint8 instance)
+{
+    uint8  currentCh;
+
+    /* Enable hardware module clock. This shall be be executed before any other setup is made */
+    lpitBase[instance]->MCR |= LPIT_MCR_M_CEN_MASK;
+
+    for (currentCh=0U; currentCh < LPIT_TMR_COUNT; currentCh++)
+    {
+        /* Disable the LPIT timer channel. */
+        lpitBase[instance]->TMR[currentCh].TCTRL &= ~LPIT_TMR_TCTRL_T_EN_MASK;
+
+        /* Disable channel interrupts. */
+        lpitBase[instance]->MIER &= ~(uint32)(LPIT_MIER_TIE_START_MASK << (uint32)currentCh);
+
+        /* Clear interrupt flag. */
+        lpitBase[instance]->MSR |= (uint32)((uint32)LPIT_MSR_TIF0_MASK << (uint32)currentCh);
+
+        /* Clear debug mode. */
+        lpitBase[instance]->MCR &= ~LPIT_MCR_DBG_EN_MASK;
+
+        /* Disable DOZE mode. */
+        lpitBase[instance]->MCR &= ~LPIT_MCR_DOZE_EN_MASK;
+
+        /* Update state variable. */
+        channelsState[instance][currentCh].initState = FALSE;
+        channelsState[instance][currentCh].notificationEnable = FALSE;
+    }
+    /* Disable hardware module clock */
+    lpitBase[instance]->MCR &= ~LPIT_MCR_M_CEN_MASK;
+    return LPIT_IP_STATUS_SUCCESS;
+}
+#endif /* LPIT_ICU_DEINIT_API */
+
+/** @implements Lpit_Icu_Ip_EnableInterrupt_Activity */
+void Lpit_Icu_Ip_EnableInterrupt(uint8 instance, uint8 hwChannel)
+{
+    /* Clear timer interrupt flag if it is enabled. */
+    lpitBase[instance]->MSR |= (uint32)(LPIT_MSR_TIF_START_MASK << (uint32)hwChannel);
+
+    /* Enable channel interrupts. */
+    lpitBase[instance]->MIER |= (uint32)(LPIT_MIER_TIE_START_MASK << (uint32)hwChannel);
+}
+
+/** @implements Lpit_Icu_Ip_DisableInterrupt_Activity */
+void Lpit_Icu_Ip_DisableInterrupt(uint8 instance, uint8 hwChannel)
+{
+    /* Disable channel interrupts. */
+    lpitBase[instance]->MIER &= ~(uint32)(LPIT_MIER_TIE_START_MASK << (uint32)hwChannel);
+}
+
+#if (LPIT_ICU_EDGE_DETECT_API == STD_ON)
+/** @implements Lpit_Icu_Ip_EnableEdgeDetection_Activity */
+void Lpit_Icu_Ip_EnableEdgeDetection(uint8 instance, uint8 hwChannel)
+{
+    /* Enable interrupt for channel. */
+    Lpit_Icu_Ip_EnableInterrupt(instance, hwChannel);
+    /* Set Edge Detect mode for the Lpit channel in the configuration array */
+    channelsState[instance][hwChannel].measurementMode = LPIT_ICU_MODE_SIGNAL_EDGE_DETECT;
+}
+#endif /* LPIT_ICU_EDGE_DETECT_API */
+
+#if ((LPIT_ICU_EDGE_DETECT_API == STD_ON) || (LPIT_ICU_TIMESTAMP_API == STD_ON))
+/** @implements Lpit_Icu_Ip_DisableDetectionMode_Activity */
+void Lpit_Icu_Ip_DisableDetectionMode(uint8 instance, uint8 hwChannel)
+{
+    /* Disable interrupt for channel. */
+    Lpit_Icu_Ip_DisableInterrupt(instance, hwChannel);
+    /* Clean measurement mode for the LPIT channel in the configuration array. */
+    channelsState[instance][hwChannel].measurementMode = LPIT_ICU_MODE_NO_MEASUREMENT;
+}
+#endif /* (LPIT_ICU_EDGE_DETECT_API == STD_ON) || (LPIT_ICU_TIMESTAMP_API == STD_ON) */
+
+#if (STD_ON == LPIT_ICU_GET_INPUT_STATE_API)
+/** @implements Lpit_Icu_Ip_GetInputState_Activity */
+boolean Lpit_Icu_Ip_GetInputState(uint8 instance, uint8 hwChannel)
+{
+    boolean result         = FALSE;
+    uint32  statusRegister = lpitBase[instance]->MSR;
+    uint32  intEnRegister  = lpitBase[instance]->MIER;
+
+    /* Interrupt not enabled, flag bit was set. */
+    if (0x0U == ((uint32)(LPIT_MIER_TIE_START_MASK << hwChannel) & intEnRegister))
+    {
+        if (0x0U != ((uint32)(LPIT_MSR_TIF_START_MASK << hwChannel) & statusRegister))
+        {
+            result = TRUE;
+            /* Clear interrupt flag. */
+            lpitBase[instance]->MSR |= (uint32)(LPIT_MSR_TIF_START_MASK << hwChannel);
+        }
+    }
+    return result;
+}
+#endif /* STD_ON == LPIT_ICU_GET_INPUT_STATE_API */
+
+#if (STD_ON == LPIT_ICU_TIMESTAMP_API)
+/** @implements Lpit_Icu_Ip_StartTimestamp_Activity */
+void Lpit_Icu_Ip_StartTimestamp(uint8 instance,
+                                uint8 hwChannel,
+                                uint16 *bufferPtr,
+                                uint16 bufferSize,
+                                uint16 notifyInterval)
+{
+#if (STD_ON == LPIT_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(LPIT_INSTANCE_COUNT > instance);
+    DevAssert(LPIT_TMR_COUNT > hwChannel);
+    DevAssert(NULL_PTR != lpitBase[instance]);
+#endif
+    /* Configure the Timestamp mode for the LPIT hwChannel in the state configuration array. */
+    channelsState[instance][hwChannel].measurementMode = LPIT_ICU_MODE_TIMESTAMP;
+
+    /* Initiate timestamp state for current channel. */
+    timestampState[instance][hwChannel].bufferPtr      = bufferPtr;
+    timestampState[instance][hwChannel].bufferSize     = bufferSize;
+    timestampState[instance][hwChannel].notifyInterval = notifyInterval;
+    timestampState[instance][hwChannel].notifyCount    = (uint16)0U;
+    timestampState[instance][hwChannel].bufferIndex    = (uint16)0U;
+
+    /* Clear interrupt flag. */
+    lpitBase[instance]->MSR |= (uint32)(LPIT_MSR_TIF_START_MASK << (uint32)hwChannel);
+
+    /* Enable interrupt for channel. */
+    Lpit_Icu_Ip_EnableInterrupt(instance, hwChannel);
+}
+
+/**
+ * @brief      Get timestamp index for timestamp mode.
+ */
+uint16 Lpit_Icu_Ip_GetTimestampIndex(uint8 instance, uint8 channel)
+{
+#if (STD_ON == LPIT_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(LPIT_INSTANCE_COUNT > instance);
+    DevAssert(LPIT_TMR_COUNT > channel);
+#endif
+    uint16 timestampIndex = 0U;
+    if (NULL_PTR != timestampState[instance][channel].bufferPtr)
+    {
+        timestampIndex = timestampState[instance][channel].bufferIndex;
+    }
+    return timestampIndex;
+}
+
+#endif /* STD_ON == LPIT_ICU_TIMESTAMP_API */
+
+/**
+ * @brief      Driver function Enable Notification for timestamp.
+ */
+void Lpit_Icu_Ip_EnableNotification(uint8 instance, uint8 hwChannel)
+{
+    channelsState[instance][hwChannel].notificationEnable = TRUE;
+}
+
+/**
+ * @brief      Driver function Disable Notification for timestamp.
+ */
+void Lpit_Icu_Ip_DisableNotification(uint8 instance, uint8 hwChannel)
+{
+    channelsState[instance][hwChannel].notificationEnable = FALSE;
+}
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 378 - 0
RTD/src/Lpit_Icu_Ip_Irq.c

@@ -0,0 +1,378 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file       File with source code used to implement ICU driver interrupts on LPIT module.
+ *     @details    This file contains the source code for all interrupt functions which are using 
+ *                 LPIT module.
+ *     @addtogroup lpit_icu_ip LPIT IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lpit_Icu_Ip.h"
+#include "Lpit_Icu_Ip_Irq.h"
+
+#if(LPIT_ICU_IP_DEV_ERROR_DETECT == STD_ON)
+#include "Devassert.h"
+#endif
+#include "Mcal.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPIT_ICU_IP_IRQ_VENDOR_ID_C                   43
+#define LPIT_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C    4
+#define LPIT_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION_C    4
+#define LPIT_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION_C 0
+#define LPIT_ICU_IP_IRQ_SW_MAJOR_VERSION_C            1
+#define LPIT_ICU_IP_IRQ_SW_MINOR_VERSION_C            0
+#define LPIT_ICU_IP_IRQ_SW_PATCH_VERSION_C            0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and Lpit_Icu_Ip.h header file are of the same vendor */
+#if (LPIT_ICU_IP_IRQ_VENDOR_ID_C != LPIT_ICU_IP_VENDOR_ID)
+    #error "Lpit_Icu_Ip_Irq.c and Lpit_Icu_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and Lpit_Icu_Ip.h header file are of the same AutoSar version */
+#if ((LPIT_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C    != LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION_C    != LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION_C != LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lpit_Icu_Ip_Irq.c and Lpit_Icu_Ip.h are different"
+#endif
+/* Check if source file and Lpit_Icu_Ip.h header file are of the same Software version */
+#if ((LPIT_ICU_IP_IRQ_SW_MAJOR_VERSION_C != LPIT_ICU_IP_SW_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_SW_MINOR_VERSION_C != LPIT_ICU_IP_SW_MINOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_SW_PATCH_VERSION_C != LPIT_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Lpit_Icu_Ip_Irq.c and Lpit_Icu_Ip.h are different"
+#endif
+
+/* Check if source file and Lpit_Icu_Ip_Irq.h header file are of the same vendor */
+#if (LPIT_ICU_IP_IRQ_VENDOR_ID_C != LPIT_ICU_IP_IRQ_VENDOR_ID)
+    #error "Lpit_Icu_Ip_Irq.c and Lpit_Icu_Ip_Irq.h have different vendor IDs"
+#endif
+/* Check if source file and Lpit_Icu_Ip_Irq.h header file are of the same AutoSar version */
+#if ((LPIT_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C    != LPIT_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION_C    != LPIT_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION_C != LPIT_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lpit_Icu_Ip_Irq.c and Lpit_Icu_Ip_Irq.h are different"
+#endif
+/* Check if source file and Lpit_Icu_Ip_Irq.h header file are of the same Software version */
+#if ((LPIT_ICU_IP_IRQ_SW_MAJOR_VERSION_C != LPIT_ICU_IP_IRQ_SW_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_SW_MINOR_VERSION_C != LPIT_ICU_IP_IRQ_SW_MINOR_VERSION) || \
+     (LPIT_ICU_IP_IRQ_SW_PATCH_VERSION_C != LPIT_ICU_IP_IRQ_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Lpit_Icu_Ip_Irq.c and Lpit_Icu_Ip_Irq.h are different"
+#endif
+
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if(LPIT_ICU_IP_DEV_ERROR_DETECT == STD_ON)
+        /* Check if source file and Devassert.h file are of the same Autosar version */
+        #if ((LPIT_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C != DEVASSERT_AR_RELEASE_MAJOR_VERSION) || \
+             (LPIT_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION_C != DEVASSERT_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Lpit_Icu_Ip.h and Devassert.h are different"
+        #endif
+    #endif
+#endif
+
+/*==================================================================================================
+*                                    LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+#if ((defined LPIT_ICU_0_CH_0_ISR_USED) || (defined LPIT_ICU_0_CH_1_ISR_USED) || (defined LPIT_ICU_0_CH_2_ISR_USED) || (defined LPIT_ICU_0_CH_3_ISR_USED) || (defined LPIT_ICU_0_ISR_USED))
+#if (STD_ON == LPIT_ICU_TIMESTAMP_API)
+/**
+ * @brief 
+ * 
+ * @param channel 
+ * @param instance 
+ * @internal
+ */
+static void Lpit_Icu_Ip_TimestampHandler(uint8 instance, uint8 channel);
+#endif /* STD_ON == LPIT_ICU_TIMESTAMP_API */
+
+/**
+ * @brief   LPIT IP function that handles the interrupt of a LPIT channel for ICU driver.
+ * @details This function:
+ *           - Reads the status register
+ *           - Clears the pending interrupt
+ *           - Processes interrupt for corresponding LPIT channel
+ *
+ * @param[in]  instance LPIT hardware module
+ * @param[in]  channel  LPIT hardware channel
+ */
+static inline void Lpit_Icu_Ip_IrqHandler(uint8 instance, uint8 channel);
+
+#if (STD_ON == LPIT_ICU_EDGE_DETECT_API)
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param hwChannel 
+ */
+static inline void Lpit_Icu_Ip_ReportEvents(uint8 instance, uint8 hwChannel);
+#endif /* STD_ON == LPIT_ICU_EDGE_DETECT_API */
+#endif /* ISRs USED defines */
+
+/*==================================================================================================
+*                                        LOCAL FUNCTIONS
+==================================================================================================*/
+#if ((defined LPIT_ICU_0_CH_0_ISR_USED) || (defined LPIT_ICU_0_CH_1_ISR_USED) || (defined LPIT_ICU_0_CH_2_ISR_USED) || (defined LPIT_ICU_0_CH_3_ISR_USED) || (defined LPIT_ICU_0_ISR_USED))
+#if (STD_ON == LPIT_ICU_TIMESTAMP_API)
+static void Lpit_Icu_Ip_TimestampHandler(uint8 instance,
+                                         uint8 channel)
+{
+    uint16 chBufferSize;
+    uint16 chBufferNotify;
+
+    chBufferSize = timestampState[instance][channel].bufferSize;
+    chBufferNotify = timestampState[instance][channel].notifyInterval;
+
+    timestampState[instance][channel].bufferPtr[timestampState[instance][channel].bufferIndex] = (uint16)lpitBase[instance]->TMR[channel].CVAL;
+    timestampState[instance][channel].bufferIndex++;
+
+    if (timestampState[instance][channel].bufferIndex >= chBufferSize)
+    {
+        /* If circular buffer, loop; if linear buffer, terminate. */
+        if (LPIT_ICU_IP_CIRCULAR_BUFFER == timestampState[instance][channel].timestampBuffer)
+        {
+            timestampState[instance][channel].bufferIndex = 0U;
+        }
+        else
+        {
+            /* Linear buffer is full, stop the channel */
+            Lpit_Icu_Ip_DisableDetectionMode(instance, channel);
+            if (NULL_PTR != channelsState[instance][channel].logicChStateCallback)
+            {
+                channelsState[instance][channel].logicChStateCallback(channelsState[instance][channel].callbackParams, (1U << 3), FALSE);
+            }
+        }
+    }
+
+    if (0U != chBufferNotify)
+    {
+        timestampState[instance][channel].notifyCount++;
+        if (timestampState[instance][channel].notifyCount >= chBufferNotify)
+        {
+            timestampState[instance][channel].notifyCount = 0U;
+            /* Call User Notification Function */
+            if ( (NULL_PTR != channelsState[instance][channel].lpitChannelNotify) && \
+                 ((boolean)TRUE == channelsState[instance][channel].notificationEnable))
+            {
+                channelsState[instance][channel].lpitChannelNotify();
+            }
+        }
+    }
+}
+#endif /* STD_ON == LPIT_ICU_TIMESTAMP_API */
+
+static inline void Lpit_Icu_Ip_IrqHandler(uint8 instance, uint8 channel)
+{
+#if (STD_ON == LPIT_ICU_IP_DEV_ERROR_DETECT)
+    DevAssert(instance < LPIT_INSTANCE_COUNT);
+    DevAssert(channel < LPIT_TMR_COUNT);
+#endif
+
+    boolean channelStatusFlags = FALSE;
+    Lpit_Icu_Ip_MeasurementMode measMode = channelsState[instance][channel].measurementMode;
+
+    /* Interrupt status: enable/disable. */
+    channelStatusFlags = ((((lpitBase[instance]->MIER & ((uint32)(LPIT_MIER_TIE_START_MASK << (uint32)channel))) != 0U) && 
+                         ((lpitBase[instance]->MSR & ((uint32)(LPIT_MSR_TIF_START_MASK << (uint32)channel))) != 0U)) ?
+                          TRUE : FALSE);
+
+    /* Clear pending interrupt serviced. */
+    lpitBase[instance]->MSR |= (uint32)(LPIT_MSR_TIF_START_MASK << (uint32)channel);
+
+    if (LPIT_ICU_MODE_NO_MEASUREMENT != measMode)
+    {
+        if (TRUE == channelStatusFlags)
+        {
+            switch (measMode)
+            {
+#if (STD_ON == LPIT_ICU_TIMESTAMP_API)
+            case LPIT_ICU_MODE_TIMESTAMP:
+            {
+                /* Copy the Counter value in the Timestamp Buffer*/
+                /* TODO: lpit has a counter on 32bits but we are treating in the ICU driver values on 16 bits only. */
+                /* Make the call to handler function. */
+                Lpit_Icu_Ip_TimestampHandler(instance, channel);
+                break;
+            }
+#endif /* STD_ON == LPIT_ICU_TIMESTAMP_API */
+#if (STD_ON == LPIT_ICU_EDGE_DETECT_API)
+            case LPIT_ICU_MODE_SIGNAL_EDGE_DETECT:
+            {
+                /* Call ReportEvents. */
+                Lpit_Icu_Ip_ReportEvents(instance, channel);
+            }
+            break;
+#endif
+            default:
+            {
+                /* Do nothing. */
+                break;
+            }
+            }
+        }
+    }
+}
+
+#if (STD_ON == LPIT_ICU_EDGE_DETECT_API)
+static inline void Lpit_Icu_Ip_ReportEvents(uint8 instance, uint8 hwChannel)
+{   
+    /* Calling HLD Report Events for the logical channel */
+    if(channelsState[instance][hwChannel].callback != NULL_PTR)
+    {
+        channelsState[instance][hwChannel].callback(channelsState[instance][hwChannel].callbackParams, FALSE);
+    }
+    else
+    {
+        /* Calling Notification for the IPL channel */
+        if ( (NULL_PTR != channelsState[instance][hwChannel].lpitChannelNotify) && \
+             ((boolean)TRUE == channelsState[instance][hwChannel].notificationEnable))
+        {
+            channelsState[instance][hwChannel].lpitChannelNotify();
+        }
+    }
+}
+#endif /* STD_ON == LPIT_ICU_EDGE_DETECT_AP */
+#endif /* ISRs USED defines */
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+#if (defined LPIT_ICU_0_CH_0_ISR_USED)
+/**
+ * @brief   LPIT IP function that handles the interrupt of a LPIT 0 channel 0 for ICU driver.
+ */
+ISR(LPIT_0_CH_0_ISR)
+{
+    uint8 u8LPitchannel = 0U;
+    uint8 u8ModuleIdx = 0U;
+    uint32 u32IsrStatus = lpitBase[u8ModuleIdx]->MSR;
+
+    if ((uint8)((uint8)u32IsrStatus & (uint8)(1U << u8LPitchannel)) == (uint8)(1U << u8LPitchannel))
+    {
+        Lpit_Icu_Ip_IrqHandler(u8ModuleIdx, u8LPitchannel);
+    }
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined LPIT_ICU_0_CH_1_ISR_USED)
+/**
+ * @brief   LPIT IP function that handles the interrupt of a LPIT 0 channel 1 for ICU driver.
+ */
+ISR(LPIT_0_CH_1_ISR)
+{
+    uint8 u8LPitchannel = 1U;
+    uint8 u8ModuleIdx = 0U;
+    uint32 u32IsrStatus = lpitBase[u8ModuleIdx]->MSR;
+
+    if ((uint8)((uint8)u32IsrStatus & (uint8)(1U << u8LPitchannel)) == (uint8)(1U << u8LPitchannel))
+    {
+        Lpit_Icu_Ip_IrqHandler(u8ModuleIdx, u8LPitchannel);
+    }
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined LPIT_ICU_0_CH_2_ISR_USED)
+/**
+ * @brief   LPIT IP function that handles the interrupt of a LPIT 0 channel 2 for ICU driver.
+ */
+ISR(LPIT_0_CH_2_ISR)
+{
+    uint8 u8LPitchannel = 2U;
+    uint8 u8ModuleIdx = 0U;
+    uint32 u32IsrStatus = lpitBase[u8ModuleIdx]->MSR;
+
+    if ((uint8)((uint8)u32IsrStatus & (uint8)(1U << u8LPitchannel)) == (uint8)(1U << u8LPitchannel))
+    {
+        Lpit_Icu_Ip_IrqHandler(u8ModuleIdx, u8LPitchannel);
+    }
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined LPIT_ICU_0_CH_3_ISR_USED)
+/**
+ * @brief   LPIT IP function that handles the interrupt of a LPIT 0 channel 3 for ICU driver.
+ */
+ISR(LPIT_0_CH_3_ISR)
+{
+    uint8 u8LPitchannel = 3U;
+    uint8 u8ModuleIdx = 0U;
+    uint32 u32IsrStatus = lpitBase[u8ModuleIdx]->MSR;
+
+    if ((uint8)((uint8)u32IsrStatus & (uint8)(1U << u8LPitchannel)) == (uint8)(1U << u8LPitchannel))
+    {
+        Lpit_Icu_Ip_IrqHandler(u8ModuleIdx, u8LPitchannel);
+    }
+    EXIT_INTERRUPT();
+}
+#endif
+
+#if (defined LPIT_ICU_0_ISR_USED)
+/**
+ * @brief   LPIT IP function that handles the interrupt of a LPIT 0.
+ */
+ISR(LPIT_0_ISR)
+{
+    uint8 u8LPitchannel = 0U;
+    uint8 u8ModuleIdx = 0U;
+    uint32 u32IsrStatus = lpitBase[u8ModuleIdx]->MSR;
+
+    for (u8LPitchannel = 0U; u8LPitchannel < LPIT_TMR_COUNT; u8LPitchannel++)
+    {
+        if ((uint8)((uint8)u32IsrStatus & (uint8)(1U << u8LPitchannel)) == (uint8)(1U << u8LPitchannel))
+        {
+            Lpit_Icu_Ip_IrqHandler(u8ModuleIdx, u8LPitchannel);
+        }
+    }
+    EXIT_INTERRUPT();
+}
+#endif
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 623 - 0
RTD/src/Lptmr_Icu_Ip.c

@@ -0,0 +1,623 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file       File with source code used to implement ICU driver functionality on LPTMR module.
+ *     @details    This file contains the source code for all functions which are using LPTMR module.
+ *     @addtogroup lptmr_icu_ip LPTMR IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lptmr_Icu_Ip.h"
+#include "SchM_Icu.h"
+#include "OsIf.h"
+
+#if(LPTMR_ICU_IP_DEV_ERROR_DETECT == STD_ON)
+    #include "Devassert.h"
+#endif
+
+#if (STD_ON == LPTMR_ICU_ENABLE_USER_MODE_SUPPORT)
+    #define USER_MODE_REG_PROT_ENABLED  (LPTMR_ICU_ENABLE_USER_MODE_SUPPORT)
+    #include "RegLockMacros.h"
+#endif
+
+/*==================================================================================================
+*                                  SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPTMR_ICU_IP_VENDOR_ID_C                     43
+#define LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION_C      4
+#define LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION_C      4
+#define LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION_C   0
+#define LPTMR_ICU_IP_SW_MAJOR_VERSION_C              1
+#define LPTMR_ICU_IP_SW_MINOR_VERSION_C              0
+#define LPTMR_ICU_IP_SW_PATCH_VERSION_C              0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if source file and OsIf.h file are of the same Autosar version */
+    #if ((LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != OSIF_AR_RELEASE_MAJOR_VERSION) || \
+         (LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION_C != OSIF_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers Lptmr_Icu_Ip.c and OsIf.h are different"
+    #endif
+#endif
+
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and SchM_Icu.h file are of the same Autosar version */
+    #if ((LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != SCHM_ICU_AR_RELEASE_MAJOR_VERSION) || \
+         (LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION_C != SCHM_ICU_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Lptmr_Icu_Ip.c and SchM_Icu.h are different"
+    #endif
+
+    #if (STD_ON == LPTMR_ICU_ENABLE_USER_MODE_SUPPORT)
+        /* Check if header file and RegLockMacros.h file are of the same Autosar version */
+        #if ((LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != REGLOCKMACROS_AR_RELEASE_MAJOR_VERSION) || \
+             (LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION_C != REGLOCKMACROS_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Lptmr_Icu_Ip.c and RegLockMacros.h are different"
+        #endif
+    #endif
+#endif /* DISABLE_MCAL_INTERMODULE_ASR_CHECK */
+
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if(LPTMR_ICU_IP_DEV_ERROR_DETECT == STD_ON)
+        /* Check if this header file and Devassert.h file are of the same Autosar version */
+        #if ((LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != DEVASSERT_AR_RELEASE_MAJOR_VERSION) || \
+             (LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION_C != DEVASSERT_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Lptmr_Icu_Ip.c and Devassert.h are different"
+        #endif
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (LPTMR_ICU_IP_VENDOR_ID_C != LPTMR_ICU_IP_VENDOR_ID)
+    #error "Lptmr_Icu_Ip.c and Lptmr_Icu_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION_C != LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION_C != LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lptmr_Icu_Ip.c and Lptmr_Icu_Ip.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((LPTMR_ICU_IP_SW_MAJOR_VERSION_C != LPTMR_ICU_IP_SW_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_SW_MINOR_VERSION_C != LPTMR_ICU_IP_SW_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_SW_PATCH_VERSION_C != LPTMR_ICU_IP_SW_PATCH_VERSION))
+#error "Software Version Numbers of Lptmr_Icu_Ip.c and Lptmr_Icu_Ip.h are different"
+#endif
+
+/*==================================================================================================
+*                           LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
+==================================================================================================*/
+
+/*==================================================================================================
+*                                         LOCAL MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        LOCAL CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        LOCAL VARIABLES
+==================================================================================================*/
+#define ICU_START_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/* Table of base addresses for LPTMR instances. */
+Lptmr_Icu_Ip_BaseType * const s_lptmrBase[LPTMR_ICU_IP_NUM_OF_MODULES] = IP_LPTMR_BASE_PTRS;
+
+#define ICU_STOP_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+Lptmr_Icu_Ip_ChStateType Lptmr_Icu_aChConfig[LPTMR_ICU_IP_NUM_OF_MODULES];
+
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                    LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+static inline void Lptmr_Icu_Ip_SetPrescaler(uint8 instance, Lptmr_Icu_PrescalerType prescalerValue, boolean enable);
+static inline void Lptmr_Icu_Ip_ClearCompareFlag(uint8 instance);
+static inline void Lptmr_Icu_Ip_TimerEnable(uint8 instance, boolean enable);
+static inline void Lptmr_Icu_Ip_TimerModeSelect(uint8 instance, uint32 mode);
+static inline void Lptmr_Icu_Ip_PinSelect(uint8 instance, Lptmr_Icu_Ip_PinSelectType Pin);
+static inline void Lptmr_Icu_Ip_SetClockSelect(uint8 instance, Lptmr_Icu_Ip_ClockSourceType clocksource);
+#if ((STD_ON == LPTMR_ICU_EDGE_COUNT_API) || (STD_ON == LPTMR_ICU_EDGE_DETECT_API))
+static inline void Lptmr_Icu_Ip_SetMeasurementMode(uint8 instance,Lptmr_Icu_MeasurementModeType mode);
+#endif
+#if (STD_ON == LPTMR_ICU_GET_INPUT_STATE_API)
+static inline boolean Lptmr_Icu_Ip_GetCmpFlagState(uint8 instance);
+static inline boolean Lptmr_Icu_Ip_GetInterruptBit(uint8 instance);
+#endif
+#if (STD_ON == LPTMR_ICU_STANDBY_WAKEUP_SUPPORT)
+static inline boolean Lptmr_Icu_Ip_CheckInterruptAndFlag(uint8 instance);
+#endif
+
+/*==================================================================================================
+*                                        LOCAL FUNCTIONS
+==================================================================================================*/
+/*!
+ * @brief Enable/Disable the LPTMR
+ *
+ * Enable/Disable the LPTMR. Starts/Stop the timer/counter.
+ *
+ * @param[in] base   - LPTMR base pointer
+ * @param[in] enable - The new state for LPTMR timer
+ *          - true:  enable timer
+ *          - false: disable timer and internal logic is reset
+ *
+ */
+static inline void Lptmr_Icu_Ip_TimerEnable(uint8 instance, boolean enable)
+{
+    if (TRUE == enable)
+    {
+        s_lptmrBase[instance]->CSR |=  LPTMR_CSR_TEN_MASK;
+    }
+    else
+    {
+        s_lptmrBase[instance]->CSR &= ~(LPTMR_CSR_TEN_MASK);
+    }
+}
+
+/*!
+ * @brief Clear the Compare Flag
+ *
+ * This function clears the Compare Flag/Interrupt Pending state.
+ *
+ * @param[in] base - LPTMR base pointer
+ */
+static inline void Lptmr_Icu_Ip_ClearCompareFlag(uint8 instance)
+{
+    s_lptmrBase[instance]->CSR |= LPTMR_CSR_TCF_MASK;
+}
+
+/*!
+ * @brief Configure the Work Mode
+ *
+ * This function configures the LPTMR to either Timer Mode or Pulse Counter
+ * Mode. This feature can be configured only when the LPTMR is disabled.
+ *
+ * @param[in] base - LPTMR base pointer
+ * @param[in] mode - New Work Mode
+ *          - LPTMR_ICU_IP_TM_MODE: LPTMR set to Pulse Counter Mode
+ */
+static inline void Lptmr_Icu_Ip_TimerModeSelect(uint8 instance, uint32 mode)
+{
+
+    s_lptmrBase[instance]->CSR = (s_lptmrBase[instance]->CSR & ~LPTMR_CSR_TMS_MASK) | LPTMR_CSR_TMS(mode);
+
+}
+
+/*!
+ * @brief Configure the Prescaler/Glitch Filter divider value
+ *
+ * This function configures the value for the Prescaler/Glitch Filter. This
+ * feature can be configured only when the LPTMR is disabled.
+ *
+ * @param[in] base  - LPTMR base pointer
+ * @param[in] presc - The new Prescaler value
+ *          - LPTMR_PRESCALE_2: Timer mode: prescaler 2, Glitch filter mode: invalid
+ *          - LPTMR_PRESCALE_4_GLITCHFILTER_2: Timer mode: prescaler 4, Glitch filter mode: 2 clocks
+ *          - LPTMR_PRESCALE_8_GLITCHFILTER_4: Timer mode: prescaler 8, Glitch filter mode: 4 clocks
+ *          - LPTMR_PRESCALE_16_GLITCHFILTER_8: Timer mode: prescaler 16, Glitch filter mode: 8 clocks
+ *          - LPTMR_PRESCALE_32_GLITCHFILTER_16: Timer mode: prescaler 32, Glitch filter mode: 16 clocks
+ *          - LPTMR_PRESCALE_64_GLITCHFILTER_32: Timer mode: prescaler 64, Glitch filter mode: 32 clocks
+ *          - LPTMR_PRESCALE_128_GLITCHFILTER_64: Timer mode: prescaler 128, Glitch filter mode: 64 clocks
+ *          - LPTMR_PRESCALE_256_GLITCHFILTER_128: Timer mode: prescaler 256, Glitch filter mode: 128 clocks
+ *          - LPTMR_PRESCALE_512_GLITCHFILTER_256: Timer mode: prescaler 512, Glitch filter mode: 256 clocks
+ *          - LPTMR_PRESCALE_1024_GLITCHFILTER_512: Timer mode: prescaler 1024, Glitch filter mode: 512 clocks
+ *          - LPTMR_PRESCALE_2048_GLITCHFILTER_1024: Timer mode: prescaler 2048, Glitch filter mode: 1024 clocks
+ *          - LPTMR_PRESCALE_4096_GLITCHFILTER_2048: Timer mode: prescaler 4096, Glitch filter mode: 2048 clocks
+ *          - LPTMR_PRESCALE_8192_GLITCHFILTER_4096: Timer mode: prescaler 8192, Glitch filter mode: 4096 clocks
+ *          - LPTMR_PRESCALE_16384_GLITCHFILTER_8192: Timer mode: prescaler 16384, Glitch filter mode: 8192 clocks
+ *          - LPTMR_PRESCALE_32768_GLITCHFILTER_16384: Timer mode: prescaler 32768, Glitch filter mode: 16384 clocks
+ *          - LPTMR_PRESCALE_65536_GLITCHFILTER_32768: Timer mode: prescaler 65536, Glitch filter mode: 32768 clocks
+ */
+static inline void Lptmr_Icu_Ip_SetPrescaler(uint8 instance, Lptmr_Icu_PrescalerType prescalerValue, boolean enable)
+{
+    if(TRUE == enable)
+    {
+        s_lptmrBase[instance]->PSR &= ~(LPTMR_PSR_PBYP_MASK);
+        s_lptmrBase[instance]->PSR = (s_lptmrBase[instance]->PSR & ~LPTMR_PSR_PRESCALE_MASK) | LPTMR_PSR_PRESCALE(prescalerValue);
+    }else
+    {
+        s_lptmrBase[instance]->PSR |= (LPTMR_PSR_PBYP_MASK);
+    }
+}
+
+/*!
+ * @brief Configure the Pin selection for Pulse Counter Mode
+ *
+ * This function configures the input Pin selection for Pulse Counter Mode.
+ * This feature can be configured only when the LPTMR is disabled.
+ *
+ * @param[in] base   - LPTMR base pointer
+ * @param[in] pinsel - Pin selection
+ *          - LPTMR_PINSELECT_TRGMUX: count pulses from TRGMUX output
+ *          - LPTMR_PINSELECT_ALT1: count pulses from pin alt 1
+ *          - LPTMR_PINSELECT_ALT2: count pulses from pin alt 2
+ *          - LPTMR_PINSELECT_ALT3: count pulses from pin alt 3
+ */
+static inline void Lptmr_Icu_Ip_PinSelect(uint8 instance, Lptmr_Icu_Ip_PinSelectType Pin)
+{
+    s_lptmrBase[instance]->CSR = (s_lptmrBase[instance]->CSR & ~LPTMR_CSR_TPS_MASK) | LPTMR_CSR_TPS(Pin);
+}
+
+/*!
+ * @brief Configure the LPTMR input Clock selection
+ *
+ * This function configures a clock source for the LPTMR. This feature can be
+ * configured only when the LPTMR is disabled.
+ *
+ * @param[in] base - LPTMR base pointer
+ * @param[in] clocksel - New Clock Source
+ *          - LPTMR_CLOCKSOURCE_SIRCDIV2: clock from SIRC DIV2
+ *          - LPTMR_CLOCKSOURCE_1KHZ_LPO: clock from 1kHz LPO
+ *          - LPTMR_CLOCKSOURCE_RTC: clock from RTC
+ *          - LPTMR_CLOCKSOURCE_PCC: clock from PCC
+ */
+static inline void Lptmr_Icu_Ip_SetClockSelect(uint8 instance, Lptmr_Icu_Ip_ClockSourceType clocksource)
+{
+    s_lptmrBase[instance]->PSR = (s_lptmrBase[instance]->PSR & ~LPTMR_PSR_PCS_MASK) | LPTMR_PSR_PCS(clocksource);
+}
+
+#if ((STD_ON == LPTMR_ICU_EDGE_COUNT_API) || (STD_ON == LPTMR_ICU_EDGE_DETECT_API))
+/*!
+ * @brief Configure the Measurement Mode state
+ *
+ * This function configures the Free Running feature of the LPTMR. This feature
+ * can be configured only when the LPTMR is disabled.
+ *
+ * @param[in] base   - LPTMR base pointer
+ *            mode
+ *          
+ */
+static inline void Lptmr_Icu_Ip_SetMeasurementMode(uint8 instance, Lptmr_Icu_MeasurementModeType mode)
+{
+#if (STD_ON == LPTMR_ICU_EDGE_COUNT_API)
+    if (LPTMR_ICU_MODE_EDGE_COUNTER == mode)
+    {
+        /* Clear flag*/
+        Lptmr_Icu_Ip_ClearCompareFlag(instance);
+        /* CNR is reset on overflow */
+        s_lptmrBase[instance]->CSR = (s_lptmrBase[instance]->CSR & ~LPTMR_CSR_TFC_MASK) | LPTMR_CSR_TFC_MASK;
+    }
+#endif
+#if (STD_ON == LPTMR_ICU_EDGE_DETECT_API)
+    if (LPTMR_ICU_MODE_SIGNAL_EDGE_DETECT == mode)
+    {
+        /* Clear flag*/
+        Lptmr_Icu_Ip_ClearCompareFlag(instance);
+        /* CNR is reset whenever TCF is set. */
+        s_lptmrBase[instance]->CSR &= ~(LPTMR_CSR_TFC_MASK);
+        /* set the hardware trigger asserts until the next time the CNR increments */
+        s_lptmrBase[instance]->CMR = (s_lptmrBase[instance]->CMR & ~LPTMR_CMR_COMPARE_MASK) | LPTMR_CMR_COMPARE(1U);
+    }
+#endif
+}
+#endif
+
+#if (STD_ON == LPTMR_ICU_GET_INPUT_STATE_API)
+/**
+* @brief         Lptmr_Icu_Ip_GetCmpFlagState Get the Compare Flag state
+* @details       This function checks whether a Compare Match event has occurred or if there is an Interrupt Pending.
+* @param[in]     instance     LPtimer hw instance number
+*
+* @return       The Compare Flag state
+*               - true: Compare Match/Interrupt Pending asserted
+*               - false: Compare Match/Interrupt Pending not asserted
+* @pre           The driver needs to be initialized.
+*
+*/
+static inline boolean Lptmr_Icu_Ip_GetCmpFlagState(uint8 instance)
+{
+    uint32 CmpFlagState;
+    CmpFlagState = (s_lptmrBase[instance]->CSR & LPTMR_CSR_TCF_MASK) >> LPTMR_CSR_TCF_SHIFT;
+    return ((CmpFlagState == 1u) ? TRUE : FALSE);
+}
+
+/**
+* @brief        : Lptmr_Icu_Ip_GetInterruptBit get the bit CSR_TIE (CSR)
+* @details       This function checks whether Timer Interrupt enable or not
+* @param[in]     instance       LPtimer hardware instance number              
+*
+* @return        status
+*                  
+*/
+static inline boolean Lptmr_Icu_Ip_GetInterruptBit(uint8 instance)
+{ 
+    uint32 status;
+    status = (s_lptmrBase[instance]->CSR & LPTMR_CSR_TIE_MASK) >> LPTMR_CSR_TIE_SHIFT;
+    return ((status == 1u) ? TRUE : FALSE);
+}
+#endif
+
+#if (STD_ON == LPTMR_ICU_STANDBY_WAKEUP_SUPPORT)
+/**
+* @brief        : Lptmr_Icu_Ip_CheckInterruptAndFlag get the bit CSR_TIE and CSR_TCF
+* @details       This function checks if Timer Interrupt enable and Compare Match event has occurred
+* @param[in]     instance       LPtimer hardware instance number
+*
+* @return        status
+*                  
+*/
+static inline boolean Lptmr_Icu_Ip_CheckInterruptAndFlag(uint8 instance)
+{ 
+    uint32 status;
+    uint32 CmpFlagState;
+    status = (s_lptmrBase[instance]->CSR & LPTMR_CSR_TIE_MASK) >> LPTMR_CSR_TIE_SHIFT;
+    CmpFlagState = (s_lptmrBase[instance]->CSR & LPTMR_CSR_TCF_MASK) >> LPTMR_CSR_TCF_SHIFT;
+    return (((status == 1u) && (CmpFlagState == 1u)) ? TRUE : FALSE);
+}
+#endif
+
+/*==================================================================================================
+*                                       GLOBAL FUNCTIONS
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+/** @implements  Lptmr_Icu_Ip_Init_Activity */
+Lptmr_Icu_Ip_StatusType Lptmr_Icu_Ip_Init(uint8 instance, const Lptmr_Icu_Ip_ConfigType *userConfig)
+{
+    const Lptmr_Icu_Ip_ChannelConfigType *pLptmrChannelConfig = &(*userConfig->pChannelsConfig)[0];
+    Lptmr_Icu_Ip_StatusType   retStatus = LPTMR_IP_STATUS_SUCCESS;
+
+    if(FALSE == Lptmr_Icu_aChConfig[instance].chInit)
+    {
+#if (STD_ON == LPTMR_ICU_STANDBY_WAKEUP_SUPPORT)
+        if(TRUE == Lptmr_Icu_Ip_CheckInterruptAndFlag(instance))
+#endif
+        {
+            /*Stop timer */
+            Lptmr_Icu_Ip_TimerEnable(instance, FALSE);
+            
+            /* Disable interrupts*/
+            Lptmr_Icu_Ip_DisableInterrupt(instance);
+            
+            /*Clear Flag*/
+            Lptmr_Icu_Ip_ClearCompareFlag(instance);
+            
+            /*Set Input source */
+            Lptmr_Icu_Ip_PinSelect(instance, userConfig->PinSelect);
+            
+            /* Configures the mode of LPTMR is Time Counter */
+            Lptmr_Icu_Ip_TimerModeSelect(instance, LPTMR_ICU_IP_TM_MODE);
+        }
+        
+        /* Set Clock source*/
+        Lptmr_Icu_Ip_SetClockSelect(instance, userConfig->ClockSource);
+        
+        /* Set Prescale*/
+        Lptmr_Icu_Ip_SetPrescaler(instance, userConfig->Prescaler, userConfig->PrescalerEnable);
+
+        /*Set Activation Condition*/
+        Lptmr_Icu_Ip_SetActivationCondition(instance, pLptmrChannelConfig->DefaultStartEdge);
+
+#if ((STD_ON == LPTMR_ICU_EDGE_COUNT_API) || (STD_ON == LPTMR_ICU_EDGE_DETECT_API))
+        /*Set Measurement Mode*/
+        Lptmr_Icu_Ip_SetMeasurementMode(instance, pLptmrChannelConfig->MeasurementModeType);
+#endif
+
+        /* Start timer. */
+        Lptmr_Icu_Ip_TimerEnable(instance, TRUE);
+        
+        /* Save instance info. */
+        Lptmr_Icu_aChConfig[instance].chInit = TRUE;
+        Lptmr_Icu_aChConfig[instance].measMode = pLptmrChannelConfig->MeasurementModeType;
+        Lptmr_Icu_aChConfig[instance].callback = pLptmrChannelConfig->callback;
+        Lptmr_Icu_aChConfig[instance].callbackParam = pLptmrChannelConfig->callbackParam;
+        Lptmr_Icu_aChConfig[instance].lptmrChannelNotification = pLptmrChannelConfig->lptmrChannelNotification;
+    }
+    else
+    {
+        /* instance already initialized - use deinitialize first */
+        retStatus = LPTMR_IP_STATUS_ERROR;
+    }
+    return retStatus;
+}
+
+#if (STD_ON == LPTMR_ICU_DEINIT_API)
+/** @implements  Lptmr_Icu_Ip_Deinit_Activity */
+Lptmr_Icu_Ip_StatusType Lptmr_Icu_Ip_Deinit(uint8 instance)
+{
+    Lptmr_Icu_Ip_StatusType   retStatus = LPTMR_IP_STATUS_SUCCESS;
+
+    if (TRUE == Lptmr_Icu_aChConfig[instance].chInit)
+    {
+        /*Stop timer */
+        Lptmr_Icu_Ip_TimerEnable(instance, FALSE);
+        
+        /* Disable interrupts*/
+        Lptmr_Icu_Ip_DisableInterrupt(instance);
+        
+        /*Clear Flag*/
+        Lptmr_Icu_Ip_ClearCompareFlag(instance);
+        
+        /* Record the deinit */
+        Lptmr_Icu_aChConfig[instance].chInit = FALSE;
+        Lptmr_Icu_aChConfig[instance].measMode = (Lptmr_Icu_MeasurementModeType)LPTMR_ICU_MODE_NO_MEASUREMENT;
+        Lptmr_Icu_aChConfig[instance].callback = NULL_PTR;
+        Lptmr_Icu_aChConfig[instance].callbackParam = 0U;
+        Lptmr_Icu_aChConfig[instance].lptmrChannelNotification = NULL_PTR;
+    }
+    else
+    {
+        /* instance already de-initialize - use initialize first */
+        retStatus = LPTMR_IP_STATUS_ERROR;
+    }
+    return retStatus;
+}
+#endif
+
+#if (STD_ON == LPTMR_ICU_SET_MODE_API)
+/**
+* @brief      Driver function that sets Lptmr hardware channel into SLEEP mode.
+* @details    This function enables the interrupt if wakeup is enabled for corresponding
+*             Lptmr channel
+*
+* @return void
+*
+* */
+void Lptmr_Icu_Ip_SetSleepMode(uint8 instance)
+{
+    /* Disable interrupts*/
+    Lptmr_Icu_Ip_DisableInterrupt(instance);
+}
+
+/**
+* @brief      Driver function that sets the Lptmr hardware channel into NORMAL mode.
+* @details    This function enables the interrupt if Notification is enabled for corresponding
+*             Lptmr channel
+*
+* @return void
+*
+* */
+void Lptmr_Icu_Ip_SetNormalMode(uint8 instance)
+{
+    /* Enable interrupts*/
+    Lptmr_Icu_Ip_EnableInterrupt(instance);
+}
+#endif  /* LPTMR_ICU_SET_MODE_API  */
+
+/** @implements  Lptmr_Icu_Ip_SetActivationCondition_Activity */
+void Lptmr_Icu_Ip_SetActivationCondition(uint8 instance, Lptmr_Icu_Ip_EdgeType activation)
+{
+    s_lptmrBase[instance]->CSR = ((s_lptmrBase[instance]->CSR & ~(LPTMR_CSR_TPP_MASK)) | LPTMR_CSR_TPP(activation));
+}
+
+#if (STD_ON == LPTMR_ICU_EDGE_DETECT_API)
+/** @implements  Lptmr_Icu_Ip_EnableEdgeDetection_Activity */
+void Lptmr_Icu_Ip_EnableEdgeDetection(uint8 instance)
+{
+    Lptmr_Icu_Ip_EnableInterrupt(instance);
+}
+
+/** @implements  Lptmr_Icu_Ip_DisableDetection_Activity */
+void Lptmr_Icu_Ip_DisableDetection(uint8 instance)
+{
+    Lptmr_Icu_Ip_DisableInterrupt(instance);
+}
+
+#endif /* LPTMR_ICU_EDGE_DETECT_API */
+
+#if (STD_ON == LPTMR_ICU_EDGE_COUNT_API)
+
+void Lptmr_Icu_Ip_ResetEdgeCount(uint8 instance)
+{
+    /*Stop timer */
+    Lptmr_Icu_Ip_TimerEnable(instance, FALSE);
+    /*Start timer */
+    Lptmr_Icu_Ip_TimerEnable(instance, TRUE);
+}
+
+/** @implements  Lptmr_Icu_Ip_EnableEdgeCount_Activity */
+void Lptmr_Icu_Ip_EnableEdgeCount(uint8 instance)
+{
+    /*Stop timer */
+    Lptmr_Icu_Ip_TimerEnable(instance, FALSE);
+    /*Start timer */
+    Lptmr_Icu_Ip_TimerEnable(instance, TRUE);
+}
+
+/** @implements  Lptmr_Icu_Ip_DisableEdgeCount_Activity */
+Lptmr_Icu_Ip_StatusType Lptmr_Icu_Ip_DisableEdgeCount(uint8 instance)
+{
+    /*Stop timer */
+    Lptmr_Icu_Ip_TimerEnable(instance, FALSE);
+    return LPTMR_IP_STATUS_SUCCESS;
+}
+
+uint16 Lptmr_Icu_Ip_GetEdgeNumbers(uint8 instance)
+{
+    /*Write random number to read counter value*/
+    s_lptmrBase[instance]->CNR &= LPTMR_CNR_COUNTER(1);
+    return (uint16)s_lptmrBase[instance]->CNR;
+}
+#endif  /* LPTMR_ICU_EDGE_COUNT_API */
+
+#if (STD_ON == LPTMR_ICU_GET_INPUT_STATE_API)
+/** @implements  Lptmr_Icu_Ip_GetInputState_Activity */
+boolean Lptmr_Icu_Ip_GetInputState(uint8 instance)
+{
+    boolean bStatus = FALSE;
+    if((FALSE == Lptmr_Icu_Ip_GetInterruptBit(instance)) && (TRUE == Lptmr_Icu_Ip_GetCmpFlagState(instance)))
+    {
+        Lptmr_Icu_Ip_ClearCompareFlag(instance);
+        bStatus = TRUE;
+    }
+    return bStatus;
+}
+#endif  /* LPTMR_ICU_GET_INPUT_STATE_API */
+
+/*!
+ * @brief Configure the Interrupt Enable state
+ *
+ * This function configures the Interrupt Enable state for the LPTMR. If enabled,
+ * an interrupt is generated when a Compare Match event occurs.
+ *
+ * @param[in] base   - LPTMR base pointer
+ * @implements  Lptmr_Icu_Ip_EnableInterrupt_Activity
+ */
+void Lptmr_Icu_Ip_EnableInterrupt(uint8 instance)
+{
+    s_lptmrBase[instance]->CSR |= LPTMR_CSR_TIE_MASK;
+}
+
+/*!
+ * @brief Configure the Interrupt disable state
+ *
+ * This function configures the Interrupt disable state for the LPTMR. If enabled,
+ * an interrupt is generated when a Compare Match event occurs.
+ *
+ * @param[in] base   - LPTMR base pointer
+ * @implements  Lptmr_Icu_Ip_DisableInterrupt_Activity
+ */
+void Lptmr_Icu_Ip_DisableInterrupt(uint8 instance)
+{
+    s_lptmrBase[instance]->CSR &= ~(LPTMR_CSR_TIE_MASK);
+}
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 227 - 0
RTD/src/Lptmr_Icu_Ip_Irq.c

@@ -0,0 +1,227 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file       File with source code used to implement ICU driver interrupts on LPTMR module.
+ *     @details    This file contains the source code for all interrupt functions which are using 
+ *                 LPTMR module.
+ *     @addtogroup lptmr_icu_ip LPTMR IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lptmr_Icu_Ip_Irq.h"
+#include "Mcal.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPTMR_ICU_IP_IRQ_VENDOR_ID_C                   43
+#define LPTMR_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C    4
+#define LPTMR_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION_C    4
+#define LPTMR_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION_C 0
+#define LPTMR_ICU_IP_IRQ_SW_MAJOR_VERSION_C            1
+#define LPTMR_ICU_IP_IRQ_SW_MINOR_VERSION_C            0
+#define LPTMR_ICU_IP_IRQ_SW_PATCH_VERSION_C            0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and Lptmr_Icu_Ip_Irq.h header file are of the same vendor */
+#if (LPTMR_ICU_IP_IRQ_VENDOR_ID_C != LPTMR_ICU_IP_IRQ_VENDOR_ID)
+    #error "Lptmr_Icu_Ip_Irq.c and Lptmr_Icu_Ip_Irq.h have different vendor IDs"
+#endif
+/* Check if source file and Lptmr_Icu_Ip_Irq.h header file are of the same AutoSar version */
+#if ((LPTMR_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION_C    != LPTMR_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION_C    != LPTMR_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION_C != LPTMR_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lptmr_Icu_Ip_Irq.c and Lptmr_Icu_Ip_Irq.h are different"
+#endif
+/* Check if source file and Lptmr_Icu_Ip_Irq.h header file are of the same Software version */
+#if ((LPTMR_ICU_IP_IRQ_SW_MAJOR_VERSION_C != LPTMR_ICU_IP_IRQ_SW_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_SW_MINOR_VERSION_C != LPTMR_ICU_IP_IRQ_SW_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_IRQ_SW_PATCH_VERSION_C != LPTMR_ICU_IP_IRQ_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Lptmr_Icu_Ip_Irq.c and Lptmr_Icu_Ip_Irq.h are different"
+#endif
+
+/*==================================================================================================
+*                                    LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+#if (defined LPTMR_ICU_0_CH_0_ISR_USED)
+static inline void Lptmr_Icu_Ip_ClearCompareFlagIrq(uint8 instance);
+static inline boolean Lptmr_Icu_Ip_GetCmpFlagStateIrq(uint8 instance);
+static inline boolean Lptmr_Icu_Ip_GetInterruptBitIrq(uint8 instance);
+static inline void Lptmr_Icu_Ip_ProcessInterruptIrq(uint8 instance);
+
+#if (STD_ON == LPTMR_ICU_EDGE_DETECT_API)
+/**
+ * @brief 
+ * 
+ * @param instance 
+ * @param overflow 
+ */
+static inline void Lptmr_Icu_Ip_ReportEvents(uint16 instance);
+#endif
+#endif
+
+/*==================================================================================================
+*                                        LOCAL FUNCTIONS
+==================================================================================================*/
+#if (defined LPTMR_ICU_0_CH_0_ISR_USED)
+/*!
+ * @brief Clear the Compare Flag
+ *
+ * This function clears the Compare Flag/Interrupt Pending state.
+ *
+ * @param[in] base - LPTMR base pointer
+ */
+static inline void Lptmr_Icu_Ip_ClearCompareFlagIrq(uint8 instance)
+{
+    s_lptmrBase[instance]->CSR |= LPTMR_CSR_TCF_MASK;
+}
+
+/**
+* @brief         Lptmr_Icu_Ip_GetCmpFlagStateIrq Get the Compare Flag state
+* @details       This function checks whether a Compare Match event has occurred or if there is an Interrupt Pending.
+* @param[in]     instance     LPtimer hw instance number
+*
+* @return       The Compare Flag state
+*               - true: Compare Match/Interrupt Pending asserted
+*               - false: Compare Match/Interrupt Pending not asserted
+* @pre           The driver needs to be initialized.
+*
+*/
+static inline boolean Lptmr_Icu_Ip_GetCmpFlagStateIrq(uint8 instance)
+{
+    uint32 CmpFlagState;
+    CmpFlagState = (s_lptmrBase[instance]->CSR & LPTMR_CSR_TCF_MASK) >> LPTMR_CSR_TCF_SHIFT;
+    return ((CmpFlagState == 1u) ? TRUE : FALSE);
+}
+
+/**
+* @brief        : Lptmr_Icu_Ip_GetInterruptBitIrq get the bit CSR_TIE (CSR)
+* @details       This function checks whether Timer Interrupt enable or not
+* @param[in]     instance       LPtimer hardware instance number              
+*
+* @return        status
+*                  
+*/
+static inline boolean Lptmr_Icu_Ip_GetInterruptBitIrq(uint8 instance)
+{ 
+    uint32 status;
+    status = (s_lptmrBase[instance]->CSR & LPTMR_CSR_TIE_MASK) >> LPTMR_CSR_TIE_SHIFT;
+    return ((status == 1u) ? TRUE : FALSE);
+}
+
+/**
+* @brief   Lptmr_Icu_Ip_ProcessInterruptIrq.
+* @details Function used by interrupt service routines to call notification
+*          functions if provided and enabled
+*
+* @param[in]     channel      hardware channel index
+*/
+static inline void Lptmr_Icu_Ip_ProcessInterruptIrq(uint8 instance)
+{
+    /* Clear Interrupt Flag */
+    Lptmr_Icu_Ip_ClearCompareFlagIrq(instance);
+    /* Call handler */
+    if(TRUE == Lptmr_Icu_aChConfig[instance].chInit)
+    {
+#if (STD_ON == LPTMR_ICU_EDGE_DETECT_API)
+        switch (Lptmr_Icu_aChConfig[instance].measMode)
+        {
+            case LPTMR_ICU_MODE_SIGNAL_EDGE_DETECT:
+            {
+                Lptmr_Icu_Ip_ReportEvents(instance);
+            }
+            break;
+            default: /* case LPTMR_ICU_EDGE_COUNT:*/
+            {
+                /* Do nothing */
+            }
+            break;
+        }
+#endif
+    }
+}
+
+#if (STD_ON == LPTMR_ICU_EDGE_DETECT_API)
+static inline void Lptmr_Icu_Ip_ReportEvents(uint16 instance)
+{  
+    /* Calling HLD Report Events for the logical channel */
+    if(Lptmr_Icu_aChConfig[instance].callback != NULL_PTR)
+    {
+        Lptmr_Icu_aChConfig[instance].callback(Lptmr_Icu_aChConfig[instance].callbackParam, FALSE);
+    }
+    else
+    {
+        /* Calling Notification for the IPL channel */
+        if ((NULL_PTR != Lptmr_Icu_aChConfig[instance].lptmrChannelNotification) && \
+           ((boolean)TRUE == Lptmr_Icu_aChConfig[instance].chInit))
+        {
+            Lptmr_Icu_aChConfig[instance].lptmrChannelNotification();
+        }
+    }
+}
+#endif /* STD_ON == LPTMR_ICU_EDGE_DETECT_API */
+#endif /* defined LPTMR_ICU_0_CH_0_ISR_USED */
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+
+#if (defined LPTMR_ICU_0_CH_0_ISR_USED)
+ISR(LPTMR_0_CH_0_ISR)
+{
+    uint8 instance = 0U;
+    /* Read TCF value and verify if it was an interrupt. */
+    if(TRUE == (Lptmr_Icu_Ip_GetCmpFlagStateIrq(instance) && Lptmr_Icu_Ip_GetInterruptBitIrq(instance)))
+    {
+        Lptmr_Icu_Ip_ProcessInterruptIrq(instance);
+    }
+    EXIT_INTERRUPT();
+}
+#endif
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 460 - 0
RTD/src/Port_Ci_Icu_Ip.c

@@ -0,0 +1,460 @@
+
+/*==================================================================================================
+s*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file
+ *      
+ *     @addtogroup port_ci_icu_ip PORT_CI IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                        INCLUDE FILES
+==================================================================================================*/
+#include "StandardTypes.h"
+#include "Port_Ci_Icu_Ip.h"
+#include "OsIf.h"
+
+#if(PORT_CI_ICU_IP_DEV_ERROR_DETECT == STD_ON)
+#include "Devassert.h"
+#endif
+
+#if (STD_ON == PORT_CI_ICU_IP_ENABLE_USER_MODE_SUPPORT)
+    #define USER_MODE_REG_PROT_ENABLED  (PORT_CI_ICU_IP_ENABLE_USER_MODE_SUPPORT)
+    #include "RegLockMacros.h"
+#endif
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define PORT_CI_ICU_IP_VENDOR_ID_C                   43
+#define PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION_C    4
+#define PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION_C    4
+#define PORT_CI_ICU_IP_AR_RELEASE_REVISION_VERSION_C 0
+#define PORT_CI_ICU_IP_SW_MAJOR_VERSION_C            1
+#define PORT_CI_ICU_IP_SW_MINOR_VERSION_C            0
+#define PORT_CI_ICU_IP_SW_PATCH_VERSION_C            0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and StandardTypes.h file are of the same Autosar version */
+    #if ((PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION_C != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Port_Ci_Icu_Ip.c and StandardTypes.h are different"
+    #endif
+
+    #if (STD_ON == PORT_CI_ICU_IP_ENABLE_USER_MODE_SUPPORT)
+        /* Check if header file and RegLockMacros.h file are of the same Autosar version */
+        #if ((PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != REGLOCKMACROS_AR_RELEASE_MAJOR_VERSION) || \
+             (PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION_C != REGLOCKMACROS_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Port_Ci_Icu_Ip.c and RegLockMacros.h are different"
+        #endif
+    #endif
+    
+    /* Check if this header file and OsIf.h file are of the same Autosar version */
+    #if ((PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != OSIF_AR_RELEASE_MAJOR_VERSION) || \
+         (PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION_C != OSIF_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Port_Ci_Icu_Ip.c and OsIf.h are different"
+    #endif
+    #if(PORT_CI_ICU_IP_DEV_ERROR_DETECT == STD_ON)
+        /* Check if this header file and Devassert.h file are of the same Autosar version */
+        #if ((PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION_C != DEVASSERT_AR_RELEASE_MAJOR_VERSION) || \
+             (PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION_C != DEVASSERT_AR_RELEASE_MINOR_VERSION))
+            #error "AutoSar Version Numbers of Port_Ci_Icu_Ip.c and Devassert.h are different"
+        #endif
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (PORT_CI_ICU_IP_VENDOR_ID_C != PORT_CI_ICU_IP_VENDOR_ID)
+    #error "Port_Ci_Icu_Ip.c and Port_Ci_Icu_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION_C  != PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION_C  != PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_AR_RELEASE_REVISION_VERSION_C   != PORT_CI_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Port_Ci_Icu_Ip.c and Port_Ci_Icu_Ip.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((PORT_CI_ICU_IP_SW_MAJOR_VERSION_C != PORT_CI_ICU_IP_SW_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_SW_MINOR_VERSION_C != PORT_CI_ICU_IP_SW_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_SW_PATCH_VERSION_C != PORT_CI_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Port_Ci_Icu_Ip.c and Port_Ci_Icu_Ip.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                       GLOBAL CONSTANTS
+==================================================================================================*/
+#define ICU_START_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+/* Table of base addresses for SUIL2 instances. */
+PORT_Type * const s_Port_Ci_Base[] = IP_PORT_BASE_PTRS;
+#define ICU_STOP_SEC_CONST_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                  LOCAL VARIABLE DECLARATIONS
+==================================================================================================*/
+#define ICU_START_SEC_VAR_CLEARED_8
+#include "Icu_MemMap.h"
+#if ((PORT_CI_ICU_IP_SET_MODE_API == STD_ON) || (PORT_CI_ICU_IP_EDGE_DETECT_API == STD_ON))
+static uint8 Port_Ci_Icu_Ip_aChActivationMode[PORT_PCR_COUNT];
+#endif
+#define ICU_STOP_SEC_VAR_CLEARED_8
+#include "Icu_MemMap.h"
+
+#define ICU_START_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+Port_Ci_Icu_Ip_State Port_Ci_Icu_Ip_u32ChState[PORT_INSTANCE_COUNT][PORT_PCR_COUNT];
+#define ICU_STOP_SEC_VAR_CLEARED_UNSPECIFIED
+#include "Icu_MemMap.h"
+/*==================================================================================================
+*                                        DEFINES AND MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                   LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                      FUNCTION PROTOTYPES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+#if ((PORT_CI_ICU_IP_SET_MODE_API == STD_ON) ||(PORT_CI_ICU_IP_EDGE_DETECT_API == STD_ON))
+/** @implements  Port_Ci_Icu_Ip_EnableInterrupt_Activity */
+void Port_Ci_Icu_Ip_EnableInterrupt(uint8 instance, uint8 hwChannel)
+{
+    uint32 u32pinMask = (uint32)((uint32)1U << (uint32)hwChannel);
+
+     /* Enable interrupt and set mode*/
+    if (Port_Ci_Icu_Ip_aChActivationMode[hwChannel] == ICU_PORT_CI_CH_FALLING_EDGE_U8)
+    {
+        s_Port_Ci_Base[instance]->PCR[hwChannel] &= ~ICU_PORT_CI_PCR_IREE_U32;
+        s_Port_Ci_Base[instance]->PCR[hwChannel] |= ICU_PORT_CI_PCR_IFEE_U32;
+    }
+    else if (Port_Ci_Icu_Ip_aChActivationMode[hwChannel] == ICU_PORT_CI_CH_RISING_EDGE_U8)
+    {
+        s_Port_Ci_Base[instance]->PCR[hwChannel] &= ~ICU_PORT_CI_PCR_IFEE_U32;
+        s_Port_Ci_Base[instance]->PCR[hwChannel] |= ICU_PORT_CI_PCR_IREE_U32;
+    }
+    else
+    {
+        s_Port_Ci_Base[instance]->PCR[hwChannel] |= (ICU_PORT_CI_PCR_IREE_U32 | ICU_PORT_CI_PCR_IFEE_U32);
+    }
+    
+    /* Clear pending flag */
+    s_Port_Ci_Base[instance]->ISFR |= u32pinMask;
+}
+#endif
+
+/** @implements  Port_Ci_Icu_Ip_DisableInterrupt_Activity */
+void Port_Ci_Icu_Ip_DisableInterrupt(uint8 instance, uint8 hwChannel)
+{
+    uint32 u32pinMask = (uint32)((uint32)1U << (uint32)hwChannel);
+
+    /* Disable interrupt */
+    s_Port_Ci_Base[instance]->PCR[hwChannel] &= ~PORT_PCR_IRQC_MASK;
+    
+    /* Clear pending flag */
+    s_Port_Ci_Base[instance]->ISFR |= u32pinMask;
+}
+
+/**
+* @brief      Driver function that initializes Port_Ci hardware channel.
+* @details    This function:
+*              - Disables interrupt.
+*              - Sets Interrupt Filter Enable Register
+*              - Sets Activation Condition
+* 
+* @param[in]  userConfig IRQ HW Channel
+* 
+* @return Port_Ci_Icu_Ip_StatusType
+* 
+* @implements  Port_Ci_Icu_Ip_Init_Activity
+* */
+Port_Ci_Icu_Ip_StatusType Port_Ci_Icu_Ip_Init (uint8 instance,  const Port_Ci_Icu_Ip_ConfigType * userConfig)
+{
+    /* logical channel */
+    uint8                        nCounter;
+    uint8                        hwChannel;
+
+    for (nCounter=0U; nCounter < userConfig->nNumChannels; nCounter++)
+    {
+        /* only handle Port_Ci channels */
+        hwChannel = (uint8)((*userConfig->pChannelsConfig)[nCounter].pinId);
+
+        /* Disable IRQ Interrupt */
+        Port_Ci_Icu_Ip_DisableInterrupt(instance, hwChannel);
+
+        /* Set Activation Condition */
+        Port_Ci_Icu_Ip_SetActivationCondition 
+        (
+            instance, hwChannel, 
+            (Port_Ci_Icu_Ip_EdgeType)((*userConfig->pChannelsConfig)[nCounter].nDefaultStartEdge)
+        );
+        Port_Ci_Icu_Ip_u32ChState[instance][hwChannel].chInit = TRUE;
+        Port_Ci_Icu_Ip_u32ChState[instance][hwChannel].callback = (*userConfig->pChannelsConfig)[nCounter].callback;
+        Port_Ci_Icu_Ip_u32ChState[instance][hwChannel].callbackParam = (*userConfig->pChannelsConfig)[nCounter].callbackParam;
+        Port_Ci_Icu_Ip_u32ChState[instance][hwChannel].PortCiChannelNotification = (*userConfig->pChannelsConfig)[nCounter].PortCiChannelNotification;
+    }
+    return PORT_CI_IP_STATUS_SUCCESS;
+}
+
+#if (STD_ON == PORT_CI_ICU_IP_DEINIT_API)
+/**
+* @brief      Driver function that de-initializes Icu Port.
+* @details    This function:
+*              - Disables interrupt.
+*              - Clears edge event enable registers
+*              - Clears Interrupt Filter Enable Register
+* 
+* @param[in]  pPort_CiIpConfig  - IRQ HW Channel
+* 
+* @return Port_Ci_Icu_Ip_StatusType
+*
+* @implements  Port_Ci_Icu_Ip_DeInit_Activity
+* */
+Port_Ci_Icu_Ip_StatusType Port_Ci_Icu_Ip_DeInit(uint8 instance)
+{
+    /* logical channel */
+    uint8   hwChannel;
+    uint32  u32pinMask;
+
+    for (hwChannel=0U; hwChannel < PORT_PCR_COUNT; hwChannel++)
+    {
+        /* only handle Port_Ci channels */
+        u32pinMask = (uint32)((uint32)1U << (uint32)hwChannel);
+        
+        /* Disable IRQ Interrupt */
+        Port_Ci_Icu_Ip_DisableInterrupt(instance, hwChannel);
+        
+        /* Clear edge event enable registers */
+        s_Port_Ci_Base[instance]->PCR[hwChannel] &= ~PORT_PCR_IRQC_MASK;
+            
+        /* Clear Interrupt Filter Enable Register */
+        s_Port_Ci_Base[instance]->DFER &= ~u32pinMask;
+        
+        /* Record the deinit */
+        Port_Ci_Icu_Ip_u32ChState[instance][hwChannel].chInit = FALSE;
+        Port_Ci_Icu_Ip_u32ChState[instance][hwChannel].callback = NULL_PTR;
+        Port_Ci_Icu_Ip_u32ChState[instance][hwChannel].callbackParam = 0U;
+        Port_Ci_Icu_Ip_u32ChState[instance][hwChannel].PortCiChannelNotification = NULL_PTR;
+#if ((PORT_CI_ICU_IP_SET_MODE_API == STD_ON) || (PORT_CI_ICU_IP_EDGE_DETECT_API == STD_ON))
+        Port_Ci_Icu_Ip_aChActivationMode[hwChannel] = ICU_PORT_CI_CH_NEITHER_EDGE_U8;
+#endif
+    }
+    return PORT_CI_IP_STATUS_SUCCESS;
+}
+#endif
+
+#if (PORT_CI_ICU_IP_SET_MODE_API == STD_ON)
+/**
+* @brief      Driver function that sets Port_Ci hardware channel into SLEEP mode.
+* @details    This function enables the interrupt if wakeup is enabled for corresponding 
+*             Port_Ci channel
+* 
+* @param[in]  hwChannel       - IRQ HW Channel
+* 
+* @return void
+* 
+* */
+
+void Port_Ci_Icu_Ip_SetSleepMode(uint8 instance, uint8 hwChannel)
+{
+    /* Disable IRQ Interrupt */
+    Port_Ci_Icu_Ip_DisableInterrupt(instance, hwChannel);
+}
+
+/**
+* @brief      Driver function that sets the Port_Ci hardware channel into NORMAL mode.
+* @details    This function enables the interrupt if Notification is enabled for corresponding
+*             Port_Ci channel
+* 
+* @param[in]  hwChannel - IRQ HW Channel
+* 
+* @return void
+* 
+* */
+
+void Port_Ci_Icu_Ip_SetNormalMode(uint8 instance, uint8 hwChannel)
+{
+    /* Enable IRQ Interrupt */
+    Port_Ci_Icu_Ip_EnableInterrupt(instance, hwChannel);
+}
+#endif  /* PORT_CI_ICU_IP_SET_MODE_API */
+
+/**
+* @brief      Driver function that sets activation condition of Port_Ci channel
+* @details    This function enables the requested activation condition(rising, falling or both
+*             edges) for corresponding Port_Ci channels.
+* 
+* @param[in]  hwChannel -  IRQ HW Channel
+* @param[in]  activation - Activation condition
+* 
+* @return void
+*
+* @implements  Port_Ci_Icu_Ip_SetActivationCondition_Activity
+* */
+void Port_Ci_Icu_Ip_SetActivationCondition(uint8 instance, uint8 hwChannel, Port_Ci_Icu_Ip_EdgeType activation)
+{
+    switch (activation)
+    {
+        case PORT_CI_ICU_RISING_EDGE:
+        {
+            s_Port_Ci_Base[instance]->PCR[hwChannel] &= ~ICU_PORT_CI_PCR_IFEE_U32;
+            s_Port_Ci_Base[instance]->PCR[hwChannel] |= ICU_PORT_CI_PCR_IREE_U32;
+#if ((PORT_CI_ICU_IP_SET_MODE_API == STD_ON) || (PORT_CI_ICU_IP_EDGE_DETECT_API == STD_ON))
+            Port_Ci_Icu_Ip_aChActivationMode[hwChannel] = ICU_PORT_CI_CH_RISING_EDGE_U8;
+#endif
+        }
+        break;
+
+        case PORT_CI_ICU_FALLING_EDGE:
+        {
+            s_Port_Ci_Base[instance]->PCR[hwChannel] &= ~ICU_PORT_CI_PCR_IREE_U32;
+            s_Port_Ci_Base[instance]->PCR[hwChannel] |= ICU_PORT_CI_PCR_IFEE_U32;
+#if ((PORT_CI_ICU_IP_SET_MODE_API == STD_ON) || (PORT_CI_ICU_IP_EDGE_DETECT_API == STD_ON))
+            Port_Ci_Icu_Ip_aChActivationMode[hwChannel] = ICU_PORT_CI_CH_FALLING_EDGE_U8;
+#endif            
+        }
+        break;
+
+        case PORT_CI_ICU_BOTH_EDGES:
+        {
+            s_Port_Ci_Base[instance]->PCR[hwChannel] |= ICU_PORT_CI_PCR_IEEE_U32;
+#if ((PORT_CI_ICU_IP_SET_MODE_API == STD_ON) || (PORT_CI_ICU_IP_EDGE_DETECT_API == STD_ON))            
+            Port_Ci_Icu_Ip_aChActivationMode[hwChannel] = ICU_PORT_CI_CH_EITHER_EDGE_U8;
+#endif
+        }
+        break;
+        
+        default:
+        {
+            s_Port_Ci_Base[instance]->PCR[hwChannel] &= ~(ICU_PORT_CI_PCR_IREE_U32|ICU_PORT_CI_PCR_IFEE_U32);
+#if ((PORT_CI_ICU_IP_SET_MODE_API == STD_ON) || (PORT_CI_ICU_IP_EDGE_DETECT_API == STD_ON))            
+            Port_Ci_Icu_Ip_aChActivationMode[hwChannel] = ICU_PORT_CI_CH_NEITHER_EDGE_U8;
+#endif
+        }
+        break;
+        
+    }
+}
+
+#if (PORT_CI_ICU_IP_EDGE_DETECT_API == STD_ON)
+/**
+* @brief      Port_Ci_Icu_Ip_EnableEdgeDetection
+* @details    This function enables the interrupt corresponding to the Port_Ci channel.
+* 
+* @param[in]  hwChannel - IRQ HW Channel
+* 
+* @return void
+*
+* @implements  Port_Ci_Icu_Ip_EnableEdgeDetection_Activity
+* */
+void Port_Ci_Icu_Ip_EnableEdgeDetection(uint8 instance, uint8 hwChannel)
+{
+    /* Enable IRQ Interrupt */
+    Port_Ci_Icu_Ip_EnableInterrupt(instance, hwChannel);
+}
+
+/**
+* @brief      Port_Ci_Icu_Ip_DisableDetection
+* @details    This function disables the interrupt corresponding to the Port_Ci channel.
+* 
+* @param[in]  hwChannel - IRQ HW Channel
+* 
+* @return void
+*
+* @implements  Port_Ci_Icu_Ip_DisableDetection_Activity
+* */
+void Port_Ci_Icu_Ip_DisableDetection(uint8 instance, uint8 hwChannel)
+{   
+    /* Disable IRQ Interrupt */
+    Port_Ci_Icu_Ip_DisableInterrupt(instance, hwChannel);
+}
+#endif /* PORT_CI_ICU_IP_EDGE_DETECT_API */
+
+#if (PORT_CI_ICU_IP_GET_INPUT_STATE_API == STD_ON)
+/**
+* @brief      Port_Ci_Icu_Ip_GetInputState
+* @details    This function returns the input state of the corresponding Port_Ci channel.
+*             The API is usable only for the case when IRQ is not serviced - application does not enable core interrupt. 
+* @param[in]  instance - Port index 
+* @param[in]  hwChannel  - Index of the Channel from the selected port
+* 
+* @return void
+*
+* @implements  Port_Ci_Icu_Ip_GetInputState_Activity
+* */
+boolean Port_Ci_Icu_Ip_GetInputState(uint8 instance, uint8 hwChannel)
+{
+    boolean bStatus = FALSE;
+    uint32 u32pinMask = (uint32)((uint32)1U << (uint32)hwChannel);
+
+    /* The flag is generated only if an interrupt is set in PCR registers */
+    /* the checking is only done for the flag considering that IRQ is not serviced */
+    if (0x0U !=  (s_Port_Ci_Base[instance]->ISFR & u32pinMask) )
+    {
+        /* Clear IRQ Flag */
+        s_Port_Ci_Base[instance]->ISFR |= u32pinMask;
+        
+        bStatus = TRUE;
+    }
+
+    return bStatus;
+}
+#endif  /* PORT_CI_ICU_IP_GET_INPUT_STATE_API */
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 536 - 0
RTD/src/Port_Ci_Icu_Ip_Irq.c

@@ -0,0 +1,536 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *     @file
+ *
+ *     @addtogroup port_ci_icu_ip PORT_CI IPL
+ *     @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+*  1) system and project includes
+*  2) needed interfaces from external units
+*  3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "SchM_Icu.h"
+#include "StandardTypes.h"
+#include "Port_Ci_Icu_Ip.h"
+#include "Port_Ci_Icu_Ip_Irq.h"
+#include "Mcal.h"
+
+/*==================================================================================================
+*                                SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define PORT_CI_ICU_IRQ_VENDOR_ID_C                      43
+#define PORT_CI_ICU_IRQ_AR_RELEASE_MAJOR_VERSION_C       4
+#define PORT_CI_ICU_IRQ_AR_RELEASE_MINOR_VERSION_C       4
+#define PORT_CI_ICU_IRQ_AR_RELEASE_REVISION_VERSION_C    0
+#define PORT_CI_ICU_IRQ_SW_MAJOR_VERSION_C               1
+#define PORT_CI_ICU_IRQ_SW_MINOR_VERSION_C               0
+#define PORT_CI_ICU_IRQ_SW_PATCH_VERSION_C               0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and StandardTypes.h file are of the same Autosar version */
+    #if ((PORT_CI_ICU_IRQ_AR_RELEASE_MAJOR_VERSION_C != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (PORT_CI_ICU_IRQ_AR_RELEASE_MINOR_VERSION_C != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Irq.c and StandardTypes.h are different"
+    #endif
+
+    /* Check if header file and SchM_Icu.h file are of the same Autosar version */
+    #if ((PORT_CI_ICU_IRQ_AR_RELEASE_MAJOR_VERSION_C != SCHM_ICU_AR_RELEASE_MAJOR_VERSION) || \
+         (PORT_CI_ICU_IRQ_AR_RELEASE_MINOR_VERSION_C != SCHM_ICU_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Irq.c and SchM_Icu.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (PORT_CI_ICU_IRQ_VENDOR_ID_C != PORT_CI_ICU_IP_VENDOR_ID)
+    #error "Port_Ci_Icu_Ip_Irq.c and Port_Ci_Icu_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((PORT_CI_ICU_IRQ_AR_RELEASE_MAJOR_VERSION_C  != PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IRQ_AR_RELEASE_MINOR_VERSION_C  != PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (PORT_CI_ICU_IRQ_AR_RELEASE_REVISION_VERSION_C   != PORT_CI_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Irq.c and Port_Ci_Icu_Ip.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((PORT_CI_ICU_IRQ_SW_MAJOR_VERSION_C  != PORT_CI_ICU_IP_SW_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IRQ_SW_MINOR_VERSION_C  != PORT_CI_ICU_IP_SW_MINOR_VERSION) || \
+     (PORT_CI_ICU_IRQ_SW_PATCH_VERSION_C  != PORT_CI_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Port_Ci_Icu_Ip_Irq.c and Port_Ci_Icu_Ip.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (PORT_CI_ICU_IRQ_VENDOR_ID_C != PORT_CI_ICU_IP_IRQ_VENDOR_ID)
+    #error "Port_Ci_Icu_Ip_Irq.c and Port_Ci_Icu_Ip_Irq.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((PORT_CI_ICU_IRQ_AR_RELEASE_MAJOR_VERSION_C  != PORT_CI_ICU_IP_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IRQ_AR_RELEASE_MINOR_VERSION_C  != PORT_CI_ICU_IP_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (PORT_CI_ICU_IRQ_AR_RELEASE_REVISION_VERSION_C   != PORT_CI_ICU_IP_IRQ_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Irq.c and Port_Ci_Icu_Ip_Irq.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((PORT_CI_ICU_IRQ_SW_MAJOR_VERSION_C  != PORT_CI_ICU_IP_IRQ_SW_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IRQ_SW_MINOR_VERSION_C  != PORT_CI_ICU_IP_IRQ_SW_MINOR_VERSION) || \
+     (PORT_CI_ICU_IRQ_SW_PATCH_VERSION_C  != PORT_CI_ICU_IP_IRQ_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Port_Ci_Icu_Ip_Irq.c and Port_Ci_Icu_Ip_Irq.h are different"
+#endif
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                    LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+#if (defined PORT_CI_ICU_IP_SINGLE_INTERRUPT)
+    
+/**
+* @brief      Port_Ci_Icu_Ip_ProcessSingleInterrupt
+* @details
+*
+* @return void
+* */
+static inline void Port_Ci_Icu_Ip_ProcessSingleInterrupt(void);
+#endif
+
+#if ((defined PORT_CI_ICU_IP_PORT_0_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_1_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_2_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_3_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_4_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_5_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_6_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_7_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_9_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_10_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_11_ISR_USED))
+
+/**
+* @brief      Port_Ci_Icu_Ip_ProcessInterrupt
+* @details
+* 
+* @param[in]      portId - first IRQ HW Channel from the HW group
+* 
+* @return void
+*
+*
+* */
+static inline void Port_Ci_Icu_Ip_ProcessInterrupt(uint8 portId);
+#endif
+
+#if ((defined PORT_CI_ICU_IP_PORT_0_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_1_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_2_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_3_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_4_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_5_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_6_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_7_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_9_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_10_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_11_ISR_USED)|| (defined PORT_CI_ICU_IP_SINGLE_INTERRUPT))
+static inline void Port_Ci_Icu_Ip_ReportEvents(uint8 portId, uint8 pinId);
+#endif
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                        LOCAL FUNCTIONS
+==================================================================================================*/
+/** @brief Include Memory mapping specification. **/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+#if (defined PORT_CI_ICU_IP_SINGLE_INTERRUPT)
+    
+/**
+* @brief      Port_Ci_Icu_Ip_ProcessSingleInterrupt
+* @details
+*
+* @return void
+* */
+static inline void Port_Ci_Icu_Ip_ProcessSingleInterrupt(void)
+{
+    uint8 portId = 0U;
+    uint8 pinId;
+    uint32 u32Port_CiPCR;
+    uint32 u32Port_CiPCRTemp = 0x0U;
+    uint32 u32RegIrqMask = 0x0U;
+    uint32 pinIdMask;
+    uint32 u32RegPort_CiISFR;
+
+    for (portId = 0; portId < ICU_NUM_PORT_CI_HW_MODULE_U8; portId++)
+    {
+        u32Port_CiPCRTemp = 0x0U;
+        pinIdMask = (uint32)1U;
+        u32RegPort_CiISFR = s_Port_Ci_Base[portId]->ISFR;
+        
+        if (0U != u32RegPort_CiISFR)
+        {
+            for (pinId=0U; pinId<32U; pinId++)
+            {
+                u32Port_CiPCR = s_Port_Ci_Base[portId]->PCR[pinId] & PORT_PCR_IRQC_MASK;
+                
+                if ((ICU_PORT_CI_PCR_IREE_U32 == u32Port_CiPCR) || (ICU_PORT_CI_PCR_IFEE_U32 == u32Port_CiPCR) \
+                        || (ICU_PORT_CI_PCR_IEEE_U32 == u32Port_CiPCR))
+                {
+                    u32Port_CiPCRTemp |= pinIdMask;
+                }
+                
+                /* Get only IRQ's activated with the enabled flag set */
+                u32RegIrqMask = pinIdMask & u32RegPort_CiISFR & u32Port_CiPCRTemp ;
+                
+                if (0x0U != u32RegIrqMask)
+                {
+                    /* Clear pending interrupt serviced */
+                    s_Port_Ci_Base[portId]->ISFR |= u32RegIrqMask;
+                    Port_Ci_Icu_Ip_ReportEvents(portId, pinId);
+                }
+                pinIdMask <<= (uint32)1U;
+            }
+        }
+    }
+}
+#endif /* PORT_CI_ICU_IP_SINGLE_INTERRUPT */
+
+#if ((defined PORT_CI_ICU_IP_PORT_0_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_1_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_2_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_3_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_4_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_5_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_6_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_7_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_9_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_10_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_11_ISR_USED))
+
+/**
+* @brief      Port_Ci_Icu_Ip_ProcessInterrupt
+* @details
+* 
+* @param[in]      portId - first IRQ HW Channel from the HW group
+* 
+* @return void
+*
+*
+* */
+static inline void Port_Ci_Icu_Ip_ProcessInterrupt(uint8 portId)
+{
+    uint8 pinId;
+    uint32 u32Port_CiPCR;
+    uint32 u32Port_CiPCRTemp = 0x0U;
+    uint32 u32RegIrqMask = 0x0U;
+    uint32 pinIdMask = (uint32)1U;
+    uint32 u32RegPort_CiISFR = s_Port_Ci_Base[portId]->ISFR;
+
+    for (pinId=0U; pinId<32U; pinId++)
+    {
+        u32Port_CiPCR = (s_Port_Ci_Base[portId]->PCR[pinId] & PORT_PCR_IRQC_MASK);
+        
+        if ((ICU_PORT_CI_PCR_IREE_U32 == u32Port_CiPCR) || (ICU_PORT_CI_PCR_IFEE_U32 == u32Port_CiPCR) \
+                || (ICU_PORT_CI_PCR_IEEE_U32 == u32Port_CiPCR))
+        {
+            u32Port_CiPCRTemp |= pinIdMask;
+        }
+        
+        /* Get only IRQ's activated with the enabled flag set */
+        u32RegIrqMask = pinIdMask & u32RegPort_CiISFR & u32Port_CiPCRTemp ;
+        
+        if (0x0U != u32RegIrqMask)
+        {
+            /* Clear pending interrupt serviced */
+            s_Port_Ci_Base[portId]->ISFR |= u32RegIrqMask;
+            Port_Ci_Icu_Ip_ReportEvents(portId, pinId);
+        }
+        pinIdMask <<= (uint32)1U;
+    }
+}
+#endif
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+
+#if (defined PORT_CI_ICU_IP_SINGLE_INTERRUPT)
+/**
+* @brief     Interrupt handler for Port
+* @details   Process the interrupt of Port of Port_Ci IP
+* 
+* @isr
+* @note   This will be defined only if any channel on Port is configured
+*/
+ISR(PORT_CI_ICU_IP_EXT_IRQ_SINGLE_INTERRUPT)
+{
+    Port_Ci_Icu_Ip_ProcessSingleInterrupt();
+    EXIT_INTERRUPT();
+}
+#endif /* PORT_CI_ICU_IP_SINGLE_INTERRUPT */
+    
+#if (defined PORT_CI_ICU_IP_PORT_0_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port A
+* @details   Process the interrupt of Port A of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port A is configured
+*/
+ISR(PORT_CI_ICU_IP_A_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)0U);
+    EXIT_INTERRUPT();
+}
+#endif  /* IRQ PORTA */
+
+#if (defined PORT_CI_ICU_IP_PORT_1_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port B
+* @details   Process the interrupt of Port B of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port B is configured
+*/
+//extern void Port_WakeUp_CallBack(void);
+ISR(PORT_CI_ICU_IP_B_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)1U);
+//    Port_WakeUp_CallBack();
+    EXIT_INTERRUPT();
+}
+#endif  /* IRQ PORTB */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_2_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port C
+* @details   Process the interrupt of Port C of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port C is configured
+*/
+ISR(PORT_CI_ICU_IP_C_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)2U);
+    EXIT_INTERRUPT();
+}
+#endif    /* IRQ PORTC */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_3_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port D
+* @details   Process the interrupt of Port D of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port D is configured
+*/
+ISR(PORT_CI_ICU_IP_D_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)3U);
+    EXIT_INTERRUPT();
+}
+
+#endif    /* IRQ PORTD */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_4_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port E
+* @details   Process the interrupt of Port E of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port E is configured
+*/
+ISR(PORT_CI_ICU_IP_E_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)4U);
+    EXIT_INTERRUPT();
+}
+
+#endif    /* IRQ PORTE */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_5_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port F
+* @details   Process the interrupt of Port F of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port F is configured
+*/
+ISR(PORT_CI_ICU_IP_F_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)5U);
+    EXIT_INTERRUPT();
+}
+#endif  /* IRQ PORTF */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_6_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port G
+* @details   Process the interrupt of Port G of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port G is configured
+*/
+ISR(ICU_PORT_CI_G_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)6U);
+    EXIT_INTERRUPT();
+}
+#endif  /* IRQ PORTG */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_7_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port H
+* @details   Process the interrupt of Port H of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port H is configured
+*/
+ISR(ICU_PORT_CI_H_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)7U);
+    EXIT_INTERRUPT();
+}
+#endif  /* IRQ PORTH */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_9_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port J
+* @details   Process the interrupt of Port J of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port J is configured
+*/
+ISR(ICU_PORT_CI_J_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)9U);
+    EXIT_INTERRUPT();
+}
+#endif  /* IRQ PORTJ */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_10_ISR_USED)
+
+/**
+* @brief     Interrupt handler for Port K
+* @details   Process the interrupt of Port K of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port K is configured
+*/
+ISR(PORT_CI_ICU_IP_K_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)10U);
+    EXIT_INTERRUPT();
+}
+#endif  /* IRQ PORTK */
+
+
+#if (defined PORT_CI_ICU_IP_PORT_11_ISR_USED)
+/**
+* @brief     Interrupt handler for Port L
+* @details   Process the interrupt of Port L of Port_Ci IP
+* 
+* @isr
+* 
+* *
+* @note   This will be defined only if any channel on Port L is configured
+*/
+ISR(ICU_PORT_CI_L_EXT_IRQ_ISR)
+{
+    Port_Ci_Icu_Ip_ProcessInterrupt((uint8)11U);
+    EXIT_INTERRUPT();
+}
+#endif  /* IRQ PORTL */
+
+#if ((defined PORT_CI_ICU_IP_PORT_0_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_1_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_2_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_3_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_4_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_5_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_6_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_7_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_9_ISR_USED) || (defined PORT_CI_ICU_IP_PORT_10_ISR_USED) || \
+     (defined PORT_CI_ICU_IP_PORT_11_ISR_USED)|| (defined PORT_CI_ICU_IP_SINGLE_INTERRUPT))
+static inline void Port_Ci_Icu_Ip_ReportEvents(uint8 portId, uint8 pinId)
+{
+    if((TRUE == Port_Ci_Icu_Ip_u32ChState[portId][pinId].chInit) && \
+       (NULL_PTR != Port_Ci_Icu_Ip_u32ChState[portId][pinId].callback))
+    {
+        Port_Ci_Icu_Ip_u32ChState[portId][pinId].callback(Port_Ci_Icu_Ip_u32ChState[portId][pinId].callbackParam, FALSE);
+    }
+    else
+    {
+        /* Calling Notification for the IPL channel */
+        if ((TRUE == Port_Ci_Icu_Ip_u32ChState[portId][pinId].chInit) && \
+            (NULL_PTR != Port_Ci_Icu_Ip_u32ChState[portId][pinId].PortCiChannelNotification))
+        {
+            Port_Ci_Icu_Ip_u32ChState[portId][pinId].PortCiChannelNotification();
+        }
+    }
+}
+#endif
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 272 - 75
code/app/AppGlobalVar.c

@@ -1,41 +1,28 @@
 /*
- * @Author: chenjie
- * @Date: 2022-06-06
- * @LastEditTime: 2022-10-27
- * @LastEditors: chenjie
- * @Description: 
- * @FilePath: \S32K146_4G\code\app\AppGlobalVar.c
- * Copyright (c) 2022 by chenjie, All Rights Reserved.
+ * @Author       : ChenJie
+ * @Date         : 2022-01-23 13:45:09
+ * @Version      : V3.0
+ * @LastEditors  : ChenJie
+ * @LastEditTime : 2022-05-17 18:46:11
+ * @Description  : file content
+ * @FilePath     : \S32K146_4G\src\AppGlobalVar.c
  */
-
 /*
  * AppGlobalVar.c
- *应用层全局��
- *  Created on: 2022年1月19日
+ *Ó¦ÓòãÈ«¾Ö±äÁ¿
+ *  Created on: 2022Äê1ÔÂ19ÈÕ
  *      Author: QiXiang_CHENJIE
  */
-#include "AppGlobalVar.h"
-
-#ifdef APP_RELEASE
-const char WebSiteName[] = "\"iotp.fast-fun.cn\"";
-uint16 WebSitePort = 8712;
-#else
-const char WebSiteName[] = "\"nas.fast-fun.cn\"";
-uint16 WebSitePort = 8812;
-#endif
 
-#define defaultSn "SPFPFL264S226D001"
-const uint32 AppSwVersion = 0x00000105;
-
-const uint8 DataModuleType = 0x02;//01=NB,02-4G
-const uint16 HwVersion = 0x001;
-const uint32 BlSwVersion = 0x00000001;
-const uint32 DrvSwVersion = 0x00000001;
-const uint8 BmsManuFacture = 0xff;
-const uint8 BmsInfo = 0xff;
+#include "AppGlobalVar.h"
+//²âÊÔ
 
-uint8 TcpbattSN[BATT_SN_LEN] = {0x31};
-volatile uint32 TimerCounter = 0; // ms��
+//*È«¾Ö±äÁ¿*//
+uint8 TcpbattSN[17] = {0x31}; //ÉÏ´«µÄSN±àºÅ
+uint8 VIN[17] = {0};
+volatile uint32 TimerCounter = 0; // msµ¥Î»
+uint32 BattTempR[4] = {0};		  // ADC²éѯµÄζÈRÖµ
+uint16 ErrorArray[10] = {0};
 uint8 Fota_update_flag = 0;
 uint8 Fota_error_flag = 0;
 /*GPS*/
@@ -46,17 +33,25 @@ uint8 CanIf_u8TxConfirmCnt = 0U;
 boolean CanIf_bTxFlag = false;
 uint8 CanIf_u8RxIndicationCnt = 0U;
 boolean CanIf_bRxFlag = false;
-QueueHandle_t CanRecvQueueHandle;
+QueueHandle_t CanRecvQueueHandle0;
+QueueHandle_t CanRecvQueueHandle1;
+QueueHandle_t CanRecvQueueHandle2;
+
+TaskHandle_t Uart_Hal_RecvTask_Handle,Uart_Hal_SendTask_Handle,CanTask_Handle,GpsTask_Handle,Uart_4G_Task_Handle;
+SemaphoreHandle_t sleep_mutex = NULL;
 
-/*TCP相关��*/
-bool TcpSysReboot = 1; // tcp无法�网时,��使能
+bool TcpSysReboot = 1;
 char ImeiNum[15] = {0};
 char IccidNum[20] = {0};
 uint8 CSQValue = 0;
-sint8 SocketId = -1; // �网状�
-sint8 RegChkRet = 0; // 驻网状�
+sint8 SocketId = -1;
+sint8 RegChkRet = 0;
 char WebSiteIp[20] = {0};
 uint8 TcpWorkState = 0;
+const char WebSiteName[] = "\"iotp.fast-fun.cn\"";
+uint16 WebSitePort = 8712;
+//const char WebSiteName[] = "\"nas.fast-fun.cn\"";
+//uint16 WebSitePort = 8812;
 
 #define EEP_START_SEC_VAR_INIT_8_NO_CACHEABLE
 #include "Eep_MemMap.h"
@@ -64,44 +59,246 @@ AppConfigBody AppConfigInfo = {false, true, {defaultSn}, {0}};
 #define EEP_STOP_SEC_VAR_INIT_8_NO_CACHEABLE
 #include "Eep_MemMap.h"
 
-/*以下���为串��议相关��*/
-#ifdef APP_UART0_ENABLE
-AppDataBody AppDataInfo = {BMS_CELLNUM, BMS_TEMPNUM};
-uint16 avrgCellVol = 0; // 平�电压
-uint16 bmsHwVersion = 0;
-uint32 bmsSwVersion = 0;
-uint16 battCellU[BMS_CELLNUM]; // 电池电压
-uint16 battI = 10000;              // BMS电�(tcp上传)
-uint16 battPackVol = 0;        // bms电压
-uint16 maxCellVol = 0;         // 最大�体电压
-uint16 minCellVol = 0;         // 最��体电压
-// uint16 socd_pct_vcuSoc = 0;		 // soc(tcp上传,精度0.1)
-// uint16 sohd_pct_bcuSoh = 0;		 // soh(tcp上传,精度0.1)
-uint32 battBalanceoInfo = 0;     //
-uint32 battProtectState = 0;     // bms�护状�
-uint32 battWarningState = 0;     // bms告警状�
-uint8 AvgBattTemp = 0;           // 平��体温度
-uint8 battCellTemp[BMS_TEMPNUM]; // 电池温度
-uint8 Battdesigncap = 0;         // 电池包设计容�
-uint8 battHeatEnableState = 0;   // bms加热状�
-uint8 battMOSSwitchState = 0;    // bms mos开关状�
-uint8 battSOC = 0;               // bms��soc
-uint8 battSOH = 0;               // bms��soh
-uint8 battWorkState = 0;         // bms工作状�
-uint8 BmsOtherTemp = 0;          // BMS其他温度,没有其他温度,为0
-uint8 maxCellTemp = 0;           // 最大�体温度
-uint8 minCellTemp = 0;           // 最��体温度
-uint8 OtherTemp = 0;             // 通讯模�其他温度
-uint8 battHeatState = 0;
-uint8 battFanState = 0;
-uint8 battRelayState = 0;
-uint8 battConverState = 0;
-uint8 battSeparateEnable = 0;
-uint8 battSeparateCtlState = 0;
-uint8 battSeparateState = 0;
-uint16 ErrorArray[5] = {0};
-uint32 meterAllPwr[2] = {0};
-uint32 meterPosPwr[2] = {0};
-uint32 meterNegPwr[2] = {0};
-uint32 BattTempR[4] = {0xFF};
+/*ÒÔϱäÁ¿¾ùΪApp_CANÏà¹Ø±äÁ¿*/
+#ifdef APP_CAN_ENABLE
+// VCUÏà¹Ø
+uint8 vehicleStatus = 0;
+uint8 bmsHVOn = 0;
+uint8 currentGearPosition = 0;
+uint8 parkingBreakStatus = 0;
+uint8 breakingStatus = 0;
+uint32 ODO = 0;
+uint8 dcdcWorkStatus = 0;
+uint8 numOfChrgableSubsys = 0;
+uint8 chrgableSubsysCode = 0;
+
+uint16 vcuDCVol = 0;
+// EBCÏà¹Ø
+uint8 ebcStatus = 0;
+uint8 ebcAskHVOn = 0;
+uint8 ebcAskHVOff = 0;
+uint8 retainLockSignal = 0;
+uint8 dischargeLockSignal = 0;
+uint8 chargeLockSignal = 0;
+uint8 chargeFlag = 0;
+// BcuÏà¹Ø
+UINT32 BcuInTable[28] = {
+	0x1801D0F3,
+	0x1801D8F3,
+	0x1880D0F3,
+	0x1881D0F3,
+	0x1882D0F3,
+	0x1883D0F3,
+	0x1884D0F3,
+	0x1885D0F3,
+	0x1886D0F3,
+	0x1887D0F3,
+	0x1888D0F3,
+	0x1889D0F3,
+	0x188AD0F3,
+	0x18C1D0F3,
+	0x18C2D0F3,
+	0x18E1D0F3,
+	0x18E2D0F3,
+	0x18E3D0F3,
+	0x18E4D0F3,
+	0x18E5D0F3,
+	0x18E6D0F3,
+	0x18F1D0F3,
+	0x18F2D0F3,
+	0x18F3D0F3,
+	0x18F4D0F3,
+	0x18F5D0F3,
+	0x18FF45F4,
+	0x18FFC13A,
+};
+BOOL BcuRxShortError[28];
+BOOL BcuRxLongError[28];
+UINT8 BcuRxErrorCounter[28];
+UINT8 BcuRxFlag[28];
+/************************************************************
+ *BCU->4G½âÂë±äÁ¿´æ·ÅÇø
+ ************************************************************/
+UINT8 BMS_ReqVIN = 0x00;						//ÊÇ·ñÇëÇóVINÂë,0:Ô¤Áô;1:ÇëÇóVIN;2:²»ÇëÇóVIN;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_ReqHVOff = 0x00;						//ÊÇ·ñÇëÇóϸßѹ,0:Ô¤Áô;1:ÇëÇóϸßѹ;2:²»ÇëÇóϸßѹ;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_ProtocolEditionH = 0x00;				//ͨѶЭÒé°æ±¾¸ßλ(Àý : °æ±¾Îª3 .1, Ôò´Ë´¦·¢3),	, Re - 1, Off - 0,
+UINT8 BMS_ProtocolEditionL = 0x00;				//ͨѶЭÒé°æ±¾µÍλ(Àý : °æ±¾Îª3 .1, Ôò´Ë´¦·¢1),	, Re - 1, Off - 0,
+UINT8 BMS_CharDevNum = 0x00;					//¿É³äµç×°ÖÃϵͳÐòºÅ(BMSÊÇÕû³µÖпɳäµç×°ÖÃϵͳÖеĵڼ¸¸ö, ÐèÒªÕû³µ¸æÖª),1,Re-1,Off-0,
+UINT8 BMS_FtPosRly = 0x00;						//Ö÷Õý¼ÌµçÆ÷Õ³Á¬¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtNegRly = 0x00;						//Ö÷¸º¼ÌµçÆ÷Õ³Á¬¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtPosCharRly1 = 0x00;					//³äÕý1¼ÌµçÆ÷Õ³Á¬¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtNegCharRly1 = 0x00;					//³ä¸º1¼ÌµçÆ÷Õ³Á¬¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtPosCharRly2 = 0x00;					//³äÕý2¼ÌµçÆ÷Õ³Á¬¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtNegCharRly2 = 0x00;					//³ä¸º2¼ÌµçÆ÷Õ³Á¬¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtHeatRly1 = 0x00;					//¼ÓÈÈ1/Õý¼ÌµçÆ÷Õ³Á¬¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtHeatRly2 = 0x00;					//¼ÓÈÈ2/¸º¼ÌµçÆ÷Õ³Á¬¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_StPosRly = 0x00;						//Ö÷Õý¼ÌµçÆ÷״̬(Èç¼ÌµçÆ÷״̬ÓÉBMS¼ì²â),0:Ô¤Áô;1:¿ªÆô;2:±ÕºÏ;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_StNegRly = 0x00;						//Ö÷¸º¼ÌµçÆ÷״̬(Èç¼ÌµçÆ÷״̬ÓÉBMS¼ì²â),0:Ô¤Áô;1:¿ªÆô;2:±ÕºÏ;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_StPreCharRly = 0x00;					//Ô¤³ä¼ÌµçÆ÷״̬,0:Ô¤Áô;1:¿ªÆô;2:±ÕºÏ;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_StPosCharRly1 = 0x00;					//Ö±Á÷³äÕý¼ÌµçÆ÷1״̬,0:Ô¤Áô;1:¿ªÆô;2:±ÕºÏ;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_StNegCharRly1 = 0x00;					//Ö±Á÷³ä¸º¼ÌµçÆ÷1״̬,0:Ô¤Áô;1:¿ªÆô;2:±ÕºÏ;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_StPosCharRly2 = 0x00;					//Ö±Á÷³äÕý¼ÌµçÆ÷2״̬,0:Ô¤Áô;1:¿ªÆô;2:±ÕºÏ;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_StNegCharRly2 = 0x00;					//Ö±Á÷³ä¸º¼ÌµçÆ÷2״̬,0:Ô¤Áô;1:¿ªÆô;2:±ÕºÏ;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_FtAuxRelayWeld = 0x00;				//¸½¼þ¼ÌµçÆ÷Õ³Á¬¹ÊÕÏ(±£Áô),0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_BraOpenCirc = 0x00;					//֧·¶Ï·¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtBackCharCurrOutLim = 0x00;			//»Ø³äµçÁ÷³¬ÏÞ±¨¾¯,0:Õý³£1 : 1¼¶ Çá΢¹ÊÕÏ 2 : 2¼¶ ½ÏÑÏÖعÊÕÏ 3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtPosRlyOpen = 0x00;					//Ö÷Õý¼ÌµçÆ÷ÎÞ·¨±ÕºÏ±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtNegRlyOpen = 0x00;					//Ö÷¸º¼ÌµçÆ÷ÎÞ·¨±ÕºÏ±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtPosCharRly1Open = 0x00;				//Ö±Á÷³äµçÕý1¼ÌµçÆ÷ÎÞ·¨±ÕºÏ±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtPosCharRly2Open = 0x00;				//Ö±Á÷³äµçÕý2¼ÌµçÆ÷ÎÞ·¨±ÕºÏ±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtNegCharRly1Open = 0x00;				//Ö±Á÷³äµç¸º1¼ÌµçÆ÷ÎÞ·¨±ÕºÏ±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtNegCharRly2Open = 0x00;				//Ö±Á÷³äµç¸º2¼ÌµçÆ÷ÎÞ·¨±ÕºÏ±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtTMSContClose = 0x00;				//¼ÓÈÈĤ»òTMS½Ó´¥Æ÷ÎÞ·¨¶Ï¿ª±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtTMSContOpen = 0x00;					//¼ÓÈÈĤ»òTMS½Ó´¥Æ÷ÎÞ·¨±ÕºÏ±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtTMS = 0x00;							//ÈȹÜÀíϵͳ¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_Ft24VSpy = 0x00;						// BMS 24V¹©µçÒì³£±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtPACKSelfProt = 0x00;				//µç³Ø°ü×Ô±£»¤±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtCharSockTempOver = 0x00;			//³äµç²å×ù¹ýα¨¾¯,0:Õý³£1 : 1¼¶ Çá΢¹ÊÕÏ 2 : 2¼¶ ½ÏÑÏÖعÊÕÏ 3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtTempOutCtrl = 0x00;					//ÈÈʧ¿Ø±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_StPosHeatRly = 0x00;					//¼ÓÈÈÕý¼ÌµçÆ÷״̬,0:±£Áô;1:¿ªÆô;2:±ÕºÏ;3:ÎÞЧ,Re-1,Off-0,
+UINT8 BMS_StNegHeatRly = 0x00;					//¼ÓÈȸº¼ÌµçÆ÷״̬,0:±£Áô;1:¿ªÆô;2:±ÕºÏ;3:ÎÞЧ,Re-1,Off-0,
+UINT8 BMS_CharSysNum = 0x00;					//¿É³äµç´¢ÄÜ×Óϵͳ×ÜÊý(±£Áô),,Re-1,Off-0,
+UINT8 BMS_FtCode = 0x00;						//µç³Øϵͳ¹ÊÕÏÂë,Ïê¼û¸½±íµç³Øϵͳ¹ÊÕÏÂëÁбí,Re-1,Off-0,
+UINT8 BMS_ST1CheckSum = 0x00;					// B2V_ST1µÄCheckSum,Byte0=Byte1 XOR Byte2 XOR Byte3 XOR Byte4 XOR Byte5 XOR Byte6 XOR Byte7,Re-1,Off-0,
+UINT8 BMS_ST1Counter = 0x00;					// B2V_ST1µÄÉúÃüÐźÅ,0~14Ñ­»·,15:ÐźÅÎÞЧ,Re-1,Off-0,
+UINT8 BMS_Mode = 0x00;							// BMSµ±Ç°×´Ì¬,0:Ô¤Áô;1:¸ßѹÉϵç;2:¸ßѹϵç;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_AuxRlySt = 0x00;						//¸½¼þ¼ÌµçÆ÷״̬,0:¿ªÆô;1:±ÕºÏ;,Re-1,Off-0,
+UINT8 BMS_BattBalaSt = 0x00;					// BMSµ±Ç°¾ùºâ״̬,0:먦Æô¾ùºâ;1:¿ªÆô¾ùºâ;,Re-1,Off-0,
+UINT8 BMS_CharGunSt = 0x00;						//Ö±Á÷³äµçǹÁ¬½Ó״̬,0:δÁ¬½Ó1 : Á¬½Ó, Re - 1, Off - 0,
+UINT8 BMS_CharMode = 0x00;						// BMSµ±Ç°³äµçģʽ,0:Ô¤Áô1 : Ö±Á÷³äµç 2 : ½»Á÷³äµç 3 : ÆäËû³äµç, Re - 1, Off - 0,
+UINT8 BMS_CharSt = 0x00;						//³äµç״̬,0:¿ÉÒÔ³äµç1 : ÕýÔÚ³äµç 2 : ³äµç½áÊø 3 : ³äµç¹ÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtLvl = 0x00;							//µ±Ç°×î¸ß¹ÊÕϵȼ¶,0:Õý³£1 : 1¼¶ Çá΢¹ÊÕÏ 2 : 2¼¶ ½ÏÑÏÖعÊÕÏ 3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtCellTempDiff = 0x00;				//µçоβîÒì³£±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtCellTempHigh = 0x00;				//µçоζȹý¸ß±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtPACKOverVolt = 0x00;				// PACK¹ýѹ±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtPACKUndeVolt = 0x00;				// PACKǷѹ±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtSOCLow = 0x00;						// SOC¹ýµÍ±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtCellOverVolt = 0x00;				//µ¥Ìåµçѹ¹ý¸ß±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtCellUndeVolt = 0x00;				//µ¥ÌåµçѹǷѹ±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtIns = 0x00;							//¾øÔµ±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtCellOverVoltDiff = 0x00;			//µ¥Ìåѹ²î¹ý´ó,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtCharCurrOver = 0x00;				//³äµçµçÁ÷¹ý´ó±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtDisCharCurrOver = 0x00;				//·ÅµçµçÁ÷¹ý´ó±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtCellTempLow = 0x00;					//µçоζȹýµÍ±¨¾¯,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtBranVoltDifOver = 0x00;				//֧·ѹ²î¹ý´ó±¨¾¯(´æÔÚ²¢ÁªÖ§Â·µÄϵͳ),0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtBMSHardWare = 0x00;					// BMSÓ²¼þ¹ÊÕÏ,0:ÎÞ¹ÊÕÏ; 1:1¼¶ Çá΢¹ÊÕÏ; 2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 3¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtSOCHigh = 0x00;						// SOC¹ý¸ß±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtSOCJump = 0x00;						// SOCÌø±ä±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtInCom = 0x00;						// BMSÄÚ²¿Í¨ÐŹÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtSysMism = 0x00;						// BMS/¿É³äµç´¢ÄÜϵͳ²»Æ¥Å䱨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtHvIntLock = 0x00;					//¸ßѹ»¥Ëø±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtSmoke = 0x00;						//»ð¾¯Ì½²âÆ÷¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtFire = 0x00;						//µç³Ø°ü»ðÔÖ±¨¾¯,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtNum = 0x00;							// BMSµ±Ç°·¢ÉúµÄ¹ÊÕÏ×ÜÊýÄ¿(°üÀ¨GB32960Öй涨µÄ¹ÊÕÏÊýÄ¿),,Re-1,Off-0,
+UINT8 BMS_PackSOC = 0x00;						//µç³Ø°üSOC,,Re-0.4,Off-0,
+UINT8 BMS_PackSOH = 0x00;						//µç³Ø°üSOH,,Re-0.4,Off-0,
+UINT8 BMS_MaxCellTemp = 0x00;					//µ¥Ìå×î¸ßζÈ,,Re-1,Off--50,¡æ
+UINT8 BMS_MinCellTemp = 0x00;					//µ¥Ìå×îµÍζÈ,,Re-1,Off--50,¡æ
+UINT8 BMS_AverCellTemp = 0x00;					//µ¥Ìåƽ¾ùζÈ,,Re-1,Off--50,¡æ
+UINT8 BMS_MaxCellTempCSC = 0x00;				//×î¸ßζȵçоËùÔÚ×Óϵͳ(CSC)±àºÅ,·¶Î§(1~255),Re-1,Off-0,
+UINT8 BMS_MaxCellTempNum = 0x00;				//×î¸ßζȵçоËùÔÚ×Óϵͳ(CSC)ÄÚζÈ̽Õë±àºÅ,·¶Î§(1~255),Re-1,Off-0,
+UINT8 BMS_MinCellTempCSC = 0x00;				//×îµÍζȵçоËùÔÚ×Óϵͳ(CSC)±àºÅ,·¶Î§(1~255),Re-1,Off-0,
+UINT8 BMS_MinCellTempNum = 0x00;				//×îµÍζȵçоËùÔÚ×Óϵͳ(CSC)ÄÚζÈ̽Õë±àºÅ,·¶Î§(1~255),Re-1,Off-0,
+UINT8 BMS_MaxCellVoltCSC = 0x00;				//×î¸ßµçѹµçоËùÔÚ×Óϵͳ(CSC)±àºÅ,·¶Î§(1~255),Re-1,Off-0,
+UINT8 BMS_MaxCellVoltNum = 0x00;				//×î¸ßµçѹµçоËùÔÚ×Óϵͳ(CSC)ÄÚµ¥Ìå±àºÅ,·¶Î§(1~255),Re-1,Off-0,
+UINT8 BMS_MinCellVoltCSC = 0x00;				//×îµÍµçѹµçоËùÔÚ×Óϵͳ(CSC)±àºÅ,·¶Î§(1~255),Re-1,Off-0,
+UINT8 BMS_MinCellVoltNum = 0x00;				//×îµÍµçѹµçоËùÔÚ×Óϵͳ(CSC)ÄÚµ¥Ìå±àºÅ,·¶Î§(1~255),Re-1,Off-0,
+UINT8 BMS_InsDeteSt = 0x00;						// BMS¾øÔµ¼ì²â״̬,0:Í£Ö¹¼ì²â;1:¼¤»î¼ì²â;,Re-1,Off-0,
+UINT8 BMS_FtCharInsLow = 0x00;					//³äµç¾øÔµ×èÖµµÍ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtCurrSenr = 0x00;					//µçÁ÷´«¸ÐÆ÷¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtHeatingFilm = 0x00;					//¼ÓÈÈĤ¼ÓÈȻط¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtMainLoopPreChar = 0x00;				//Ö÷»Ø·Ԥ³ä»òÔ¤¼ì¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtAuxLoopPreChar = 0x00;				//¸¨¼þ»Ø·Ԥ³ä»òÔ¤¼ì¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtACANLost = 0x00;					// ACAN/Õû³µCANͨѶ¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtDCDC = 0x00;						// BMS-DC-DC¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtSOCDif = 0x00;						// SOC²îÒì¹ý´ó,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtCellOverDisChar = 0x00;				//µçо¹ý·Å¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtCharOver = 0x00;					//³µÔØ´¢ÄÜ×°Öùý³ä±¨¾¯,0:Õý³£;1:1¼¶ Çá΢¹ÊÕÏ;2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 10¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtContDisCharCurrOverLoad = 0x00;		//³ÖÐø»Ø³ä¹ýÁ÷¹ÊÕÏ,0:Õý³£;1:1¼¶ Çá΢¹ÊÕÏ;2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 10¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_FtContCharCurrOverLoad = 0x00;		//³ÖÐø·Åµç¹ýÁ÷¹ÊÕÏ,0:Õý³£;1:1¼¶ Çá΢¹ÊÕÏ;2:2¼¶ ½ÏÑÏÖعÊÕÏ3 : 10¼¶ ×îÑÏÖعÊÕÏ, Re - 1, Off - 0,
+UINT8 BMS_Gun1DCNegTemp = 0x00;					//³äµç¿Ú1¸ºÎ¸ÐÖµ,,Re-1,Off--40,¡æ
+UINT8 BMS_Gun1DCPosTemp = 0x00;					//³äµç¿Ú1ÕýθÐÖµ,,Re-1,Off--40,¡æ
+UINT8 BMS_Gun2DCNegTemp = 0x00;					//³äµç¿Ú2¸ºÎ¸ÐÖµ,,Re-1,Off--40,¡æ
+UINT8 BMS_Gun2DCPosTemp = 0x00;					//³äµç¿Ú2ÕýθÐÖµ,,Re-1,Off--40,¡æ
+UINT8 BMS_CurrHeatSt = 0x00;					//µ±Ç°¼ÓÈÈ״̬,0:δ¼ÓÈÈ;1:¼ÓÈÈÖÐ;2:Ô¤Áô;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_CurrCoolSt = 0x00;					//µ±Ç°Àäȴ״̬,0:δÀäÈ´;1:ÀäÈ´ÖÐ;2:Ô¤Áô;3:ÎÞЧ;,Re-1,Off-0,
+UINT8 BMS_FtCharCnct = 0x00;					//²åǹÁ¬½ÓÐźÅÒì³£,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtOverDisCharCurrDuringChar = 0x00;	//³äµçʱ·ÅµçµçÁ÷¹ý´ó,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtCharNTC = 0x00;						//³äµç²å×ùNTC¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_FtELock = 0x00;						//µç×ÓËø¹ÊÕÏ,0:Õý³£; 1:¹ÊÕÏ,Re-1,Off-0,
+UINT8 BMS_CellVoltFramNum = 0x00;				//µ¥Ìåµçѹ֡ÐòºÅ,ÓÐЧֵ1~255,Re-1,Off-0,
+UINT8 BMS_CellTempFramNum = 0x00;				//ζÈÖ¡ÐòºÅ,ÓÐЧֵ1~255,Re-1,Off-0,
+UINT8 BMS_CSC_Code = 0x00;						//×Óϵͳ±àºÅCSC,ÓÐЧֵ1~255,Re-1,Off-0,
+UINT8 BMS_CellTemp[BMS_TEMP_MAX_NUM] = {0x00};	//µ±Ç°CSCϵĵÚN¸ö̽ÕëµÄζÈ,255 "Invalid" 0xFF ÎÞЧÓÐЧֵ 0 ~254, µ¥Î» ¡æ, ·¶Î§(-50 ~204)¡æ, , Re - 1, Off-- 50,¡æ
+UINT8 BMS_Checksum = 0x00;						//µç³Ø±àÂëÐÅÏ¢1µÄCheckSum,Byte0=Byte1 XOR Byte2 XOR Byte3 XOR Byte4 XOR Byte5 XOR Byte6 XOR Byte7,Re-1,Off-0,
+UINT8 BMS_PackComp = 0x00;						//µç³Ø³§¼Ò,1:"CATL" 2:"Li Shen" 3:"MGL" 4:"SAMSUN" 5:"LG",Re-1,Off-0,
+UINT8 BMS_BattCodeLeng = 0x00;					//µç³Ø±àÂ볤¶È,0:Do not transmit this Code,Re-1,Off-0,
+UINT8 BMS_SN[27] = {0x00};						//µç³Ø±àÂë(SN)×Ö·û1(ASCII),,Re-1,Off-0,
+UINT8 BMS_BattType = 0x00;						//µç³ØÀàÐÍ,1:ǦËáµç³Ø; 2:ÄøÇâµç³Ø; 3:Á×ËáÌú﮵ç³Ø; 4:ÃÌËá﮵ç³Ø; 5:îÜËá﮵ç³Ø; 6:ÈýÔª²ÄÁϵç³Ø; 7:¾ÛºÏÎïï®Àë×Óµç³Ø; 8:îÑËá﮵ç³Ø; 9:³¬¼¶µçÈÝ; 10~13:±£Áô; 14:ȼÁϵç³Ø;15:±£Áô,Re-1,Off-0,
+UINT8 BMS_CoolType = 0x00;						//µç³ØÀäÈ´·½Ê½,0:ÆäËûÀäÈ´·½Ê½1 : ×ÔÈ»ÀäÈ´ 2 : ·çÉÈÀäÈ´ 3 : Ë®ÀäÈ´, Re - 1, Off - 0,
+UINT8 BMS_CSC_Total = 0x00;						//µç³ØϵͳÖÐCSC×ܵÄÊýÄ¿,,Re-1,Off-0,
+UINT8 BMS_CellVoltLevel = 0x00;					//µ¥Ìåƽ̨µçѹ(·Çʵʱ±ä»¯µÄÖµ),ÓÐЧֵ0~5V;  255 "Signal Invalid" 0xFF ÎÞЧ,Re-0.1,Off-0,V
+UINT8 BMS_CellMinVolt = 0x00;					//µ¥Ìå¿ÉÓÃ×îµÍµçѹ(·Çʵʱ±ä»¯µÄÖµ),ÓÐЧֵ0~5V;  255 "Signal Invalid" 0xFF ÎÞЧ,Re-0.1,Off-0,V
+UINT8 BMS_CellMaxVolt = 0x00;					//µ¥Ìå¿ÉÓÃ×î¸ßµçѹ(·Çʵʱ±ä»¯µÄÖµ),ÓÐЧֵ0~5V;  255 "Signal Invalid" 0xFF ÎÞЧ,Re-0.1,Off-0,V
+UINT8 BMS_HVBranNum = 0x00;						//µç³Øϵͳ¸ßѹ֧·Êý,,Re-1,Off-0,
+UINT8 BMS_SingleHVBranchCellNum = 0x00;			//µç³Øϵͳµ¥Ö§Â·µçоÊý,,Re-1,Off-0,
+UINT8 BMS_ReqMode = 0x00;						// BMSÇëÇóÉ趨ģʽ,0:¹Ø»úģʽ1 : ÖÆÀäģʽ 2 : ÖÆÈÈģʽ 3 : ×ÔÑ­»·Ä£Ê½, Re - 1, Off - 0,
+UINT8 BMS_HVCmd = 0x00;							//¸ßѹÇëÇó,0:ÇëÇóÉϸßѹ1 : ÇëÇóϸßѹ, Re - 1, Off - 0,
+UINT8 BMS_ChgSts = 0x00;						//³äµç״̬,0:·Ç³äµç1 : ³äµç, Re - 1, Off - 0,
+UINT8 BMS_HVRelaySts = 0x00;					// BMS¸ßѹ¼ÌµçÆ÷״̬,0:¶Ï¿ª×´Ì¬; 1:±ÕºÏ״̬; 2~3:ÎÞЧ,Re-1,Off-0,
+UINT8 BMS_SetTemp = 0x00;						//É趨ζÈ,,Re-1,Off--40,
+UINT8 BMS_Life = 0x00;							// BMSÉúÃüÖ¡,,Re-1,Off-0,
+UINT8 BMS_CRC = 0x00;							// CRCУÑéÖµ,,Re-1,Off-0,
+UINT8 TMS_WorkStatus = 0x00;					// TMS¹¤×÷״̬,0:¹Ø»úģʽ1 : ÖÆÀäģʽ 2 : ÖÆÈÈģʽ 3 : ×ÔÑ­»·Ä£Ê½, Re - 1, Off - 0,
+UINT8 TMS_HVRelayST = 0x00;						// TMS¸ßѹ¼ÌµçÆ÷״̬,0:¶Ï¿ª×´Ì¬; 1:±ÕºÏ״̬; 2~3:ÎÞЧ,Re-1,Off-0,
+UINT8 TMS_OutletTemp = 0x00;					//³öˮζÈ(»ú×éµ½µç³Ø),255:ÎÞЧ,Re-1,Off--40,
+UINT8 TMS_InletTemp = 0x00;						//»ØˮζÈ(µç³Øµ½»ú×é),255:ÎÞЧ,Re-1,Off--40,
+UINT8 TMS_ErrCode = 0x00;						// TMS¹ÊÕÏÂë,0:ÎÞ¹ÊÕÏ; ³öÏÖ 1 ÖÖÒÔÉÏÑ­»··¢ËÍ,Re-1,Off-0,
+UINT8 TMS_FaultLevel = 0x00;					// TMS¹ÊÕÏÂëµÈ¼¶,0:ÎÞЧ1 : 1¼¶¹ÊÕÏ 2 : 2¼¶¹ÊÕÏ 3 : 3¼¶¹ÊÕÏ, Re - 1, Off - 0,
+UINT16 BMS_SoftwareVersion = 0x00;				//Èí¼þ°æ±¾ºÅ:RyyyBzzz(RΪÈí¼þ°æ±¾¡¢BΪ²âÊÔ°æ±¾¡¢Õýʽ°æ±¾²»´øB)  ,yyy:0~254,¾«¶È1,255:ÎÞЧ,²»ÏÔʾ;zzz:0~254,¾«¶È1,255:ÎÞЧ,²»ÏÔʾ;
+UINT16 BMS_HardwareVersion = 0x00;				//Ó²¼þ°æ±¾ºÅ:VyyyBzzz(VΪӲ¼þ°æ±¾¡¢BΪ²âÊÔ°æ±¾¡¢Õýʽ°æ±¾²»´øB)  ,,Re-1,Off-0,
+UINT16 BMS_PackCurr = 0x00;						//µç³Ø°ü×ܵçÁ÷,³äµçΪ¸ºÖµ,·ÅµçΪÕýÖµ,,Re-0.1,Off--1000,A
+UINT16 BMS_MaxCharCurr = 0x00;					//µç³Ø°ü×î´ó»Ø³äµçÁ÷,,Re-0.1,Off--1000,A
+UINT16 BMS_MaxDisCharCurr = 0x00;				//µç³Ø°ü×î´ó·ÅµçµçÁ÷,,Re-0.1,Off--1000,A
+UINT16 BMS_PosIns = 0x00;						//ĸÏßÕý¶Ô³µÌå¾øÔµµç×è,,Re-1,Off-0,K¦¸
+UINT16 BMS_NegIns = 0x00;						//ĸÏ߸º¶Ô³µÌå¾øÔµµç×è,,Re-1,Off-0,K¦¸
+UINT16 BMS_BattVolt = 0x00;						//µç³Ø°üÄÚ²àµçѹ,,Re-0.1,Off-0,V
+UINT16 BMS_LinkVolt = 0x00;						//µç³Ø°üÍâ²àµçѹ,,Re-0.1,Off-0,V
+UINT16 BMS_MaxCellVolt = 0x00;					//µ¥Ìå×î¸ßµçѹֵ,,Re-0.001,Off-0,V
+UINT16 BMS_AverCellVolt = 0x00;					//µçоµçѹƽ¾ùÖµ,,Re-0.001,Off-0,V
+UINT16 BMS_MinCellVolt = 0x00;					//µçо×îµÍµçѹֵ,,Re-0.001,Off-0,V
+UINT16 BMS_ContChrgCurr = 0x00;					// BMSÔÊÐíµÄ³ÖÐø»Ø³äµçÁ÷,,Re-0.1,Off-0,A
+UINT16 BMS_ContDisCharCurr = 0x00;				// BMSÔÊÐíµÄ³ÖÐø·ÅµçµçÁ÷,,Re-0.1,Off--1000,A
+UINT16 BMS_CharReqVolt = 0x00;					//³äµçËùÐèµçѹ(½»Á÷),,Re-0.1,Off-0,V
+UINT16 BMS_CharReqCurr = 0x00;					//³äµçËùÐèµçÁ÷(½»Á÷),,Re-0.1,Off--1000,A
+UINT16 BMS_SysInsRes = 0x00;					//ϵͳ¾øÔµµç×è,,Re-1,Off-0,K¦¸
+UINT16 BMS_MaxDisCharPwr = 0x00;				//×î´óÔÊÐí·Åµç¹¦ÂÊ,,Re-0.1,Off-0,kw
+UINT16 BMS_MaxCharPwr = 0x00;					//×î´óÔÊÐí³äµç¹¦ÂÊ,,Re-0.1,Off-0,kw
+UINT16 BMS_ContDisCharPwr = 0x00;				// BMSÔÊÐíµÄ³ÖÐø·Åµç¹¦ÂÊ,,Re-0.1,Off-0,kw
+UINT16 BMS_ContCharPwr = 0x00;					// BMSÔÊÐíµÄ³ÖÐø³äµç¹¦ÂÊ,,Re-0.1,Off-0,kw
+UINT16 BMS_InstEngyCons = 0x00;					//¶¯Á¦µç³Ø˲ʱ°Ù¹«ÀïÄܺÄ,,Re-0.1,Off-0,kwh
+UINT16 BMS_TotalEngyCons = 0x00;				//¶¯Á¦µç³Ø×Ü/ƽ¾ù°Ù¹«ÀïÄܺÄ,,Re-0.1,Off-0,kwh
+UINT16 BMS_SOE = 0x00;							//Ê£ÓàµçÁ¿,,Re-0.01,Off-0,kwh
+UINT16 BMS_RmanCharTime = 0x00;					//Ê£Óà³äµçʱ¼ä,,Re-1,Off-0,min
+UINT16 BMS_CharNum = 0x00;						//³äµç´ÎÊý,,Re-1,Off-0,
+UINT16 BMS_CellVolt[BMS_CELL_MAX_NUM] = {0x00}; //µçоµÄµçѹ,65535 "Invalid" 0xFFFF ÎÞЧÓÐЧֵ 0 ~65534, ·¶Î§(0 ~65.534) V, Re - 0.001, Off - 0, V
+UINT16 BMS_BattRateCap = 0x00;					//µç³Ø°ü¶î¶¨ÈÝÁ¿,ÓÐЧֵ 0~65534,65535 "Signal Invalid" ÎÞЧ,Re-1,Off-0,Ah
+UINT16 BMS_BattRateVolt = 0x00;					//µç³Ø°ü¶î¶¨µçѹ,ÓÐЧֵ 0~6553.4,65535 "Signal Invalid" ÎÞЧ,Re-0.1,Off-0,V
+UINT16 BMS_BattRateEngy = 0x00;					//µç³Ø°ü¶î¶¨ÄÜÁ¿,ÓÐЧֵ 0~6553.4,65535 "Signal Invalid" ÎÞЧ,Re-0.1,Off-0,kWh
+UINT16 BMS_CellTotal = 0x00;					// PACKÖе¥ÌåµçоµÄ×ÜÊýÄ¿,,Re-1,Off-0,
+UINT16 BMS_TempTotal = 0x00;					// PACKÖеçоζȵã(̽Õë)µÄ×ÜÊýÄ¿,,Re-1,Off-0,
+UINT16 BMS_SingleCharEngy = 0x00;				//µ¥´Î³äµçkWh Êý,,Re-0.1,Off-0,KWh
+UINT16 BMS_SingleCharCapy = 0x00;				//µ¥´Î³äµçAh Êý,,Re-0.1,Off-0,Ah
+UINT16 BMS_HVVolt = 0x00;						// BMSµ±Ç°µçѹ,,Re-1,Off-0,
+UINT16 TMS_ReqPow = 0x00;						// TMSÐèÇó¹¦ÂÊ,65535:ÎÞЧ,Re-0.1,Off-0,Kw
+UINT32 BMS_TotalCharEngy = 0x00;				//ÀۼƳäÈëkWh Êý,,Re-0.1,Off-0,KWh
+UINT32 BMS_TotalDisCharEngy = 0x00;				//ÀۼƷųökWh Êý,,Re-0.1,Off-0,KWh
+UINT32 BMS_TotalBackCharEngy = 0x00;			//Àۼƶ¯ÄÜ»ØÀ¡³äÈëkWh Êý,,Re-0.1,Off-0,KWh
+UINT32 BMS_TotalStaCharEngy = 0x00;				//Àۼƻ»µçÕ¾³äÈëkWh Êý,,Re-0.1,Off-0,KWh
+UINT32 BMS_TotalGunCharEngy = 0x00;				//ÀۼƲåǹ³äµç³äÈëkWh Êý,,Re-0.1,Off-0,KWh
+UINT32 BMS_TotalGunCharCapy = 0x00;				//ÀۼƲåǹ³äµç³äÈëAh Êý,,Re-0.1,Off-0,Ah
+UINT32 BMS_TotalCharCapy = 0x00;				//ÀۼƳäÈëAh Êý,,Re-0.1,Off-0,Ah
+UINT32 BMS_TotalDisCharCapy = 0x00;				//ÀۼƷųöAh Êý,,Re-0.1,Off-0,Ah
+UINT32 BMS_TotalBackCharCapy = 0x00;			//Àۼƶ¯ÄÜ»ØÀ¡³äÈëAh Êý,,Re-0.1,Off-0,Ah
+UINT32 BMS_TotalStaCharCapy = 0x00;				//Àۼƻ»µçÕ¾³äÈëAh Êý,,Re-0.1,Off-0,Ah
 #endif

+ 275 - 77
code/app/AppGlobalVar.h

@@ -1,38 +1,58 @@
-/*** 
- * @Author: chenjie
- * @Date: 2022-06-06
- * @LastEditTime: 2022-10-27
- * @LastEditors: chenjie
- * @Description: 
- * @FilePath: \S32K146_4G\code\app\AppGlobalVar.h
- * @Copyright (c) 2022 by chenjie, All Rights Reserved.
+/*
+ * @Author       : ChenJie
+ * @Date         : 2022-01-23 13:45:09
+ * @Version      : V3.0
+ * @LastEditors  : ChenJie
+ * @LastEditTime : 2022-05-17 18:37:07
+ * @Description  : file content
+ * @FilePath     : \S32K146_4G\src\AppGlobalVar.h
+ */
+/*
+ * AppGlobal.h
+ *Ӧ�ò�ȫ�ֱ���
+ *  Created on: 2022��1��19��
+ *      Author: QiXiang_CHENJIE
  */
-
 #ifndef APPGLOBALVAR_H_
 #define APPGLOBALVAR_H_
 
-#define APP_UART0_ENABLE
-//#define APP_CAN_ENABLE
+//#define APP_UART0_ENABLE //ƽ����Ŀ
+#define APP_CAN_ENABLE //�ؿ���Ŀ
 
 #include "hal_adapter.h"
+// test Var
+#define defaultSn "GYTEST00000000001"
+// #define defaultSn "PZLCLL128N2236001"
 #define BATT_SN_LEN 17
-extern const uint32 AppSwVersion;
-extern const uint8 DataModuleType;
-extern const uint16 HwVersion;
-extern const uint32 BlSwVersion;
-extern const uint32 DrvSwVersion;
-extern const uint8 BmsManuFacture;
-extern const uint8 BmsInfo;
+#define HWVERSION 0x0001
+#define BLSWVERSION 0x00000001
+#define DRVSWVERSION 0x00000001
+#define APPSWVERSION 0x00000104
+#define BMS_MANUFACTURE 0xFF
+#define BMS_INFO 0xFF
+#define DATA_MODULE_TYPE 0x02
+
+#define BMS_CELL_MAX_NUM 384
+#define BMS_TEMP_MAX_NUM 64
+
+typedef struct _AppDataType
+{
+    uint8 BattCellCount; 
+    uint8 BattTempCount; 
+} AppDataBody;
+
 extern bool TcpSysReboot;
-extern uint8 TcpbattSN[BATT_SN_LEN];
+extern uint8 TcpbattSN[17];
 extern uint8 VIN[17];
 extern volatile uint32 TimerCounter;
+extern uint32 BattTempR[4];
+extern uint16 ErrorArray[10];
 extern uint8 Fota_update_flag;
 extern uint8 Fota_error_flag;
 typedef struct
 {
-	uint8 RealLen;
-	uint8 *DataPtr;
+    uint8 RealLen;
+    uint8 *DataPtr;
 } QueueDataTrans_Type;
 /*GPS*/
 extern QueueHandle_t GpsDataQueueHandle;
@@ -42,8 +62,24 @@ extern uint8 CanIf_u8TxConfirmCnt;
 extern boolean CanIf_bTxFlag;
 extern uint8 CanIf_u8RxIndicationCnt;
 extern boolean CanIf_bRxFlag;
-extern QueueHandle_t CanRecvQueueHandle;
+extern QueueHandle_t CanRecvQueueHandle0;
+extern QueueHandle_t CanRecvQueueHandle1;
+extern QueueHandle_t CanRecvQueueHandle2;
 
+extern TaskHandle_t Uart_Hal_RecvTask_Handle,Uart_Hal_SendTask_Handle,CanTask_Handle,GpsTask_Handle,Uart_4G_Task_Handle;
+extern SemaphoreHandle_t sleep_mutex;
+/*Fota*/
+typedef struct _Fota_Type
+{
+    bool Fota_update_error;
+    uint32 Fota_All_Data_Len;
+    uint32 Fota_Current_Addres;
+    uint8 Fota_Recv_Data_Len;
+    uint8 *Fota_Recv_DataPtr;
+    uint32 Fota_Flash_Addres;
+    uint8 Fota_CRC;
+} Fota_Type;
+/*���±�����ΪTCP��ر���*/
 extern uint8 CSQValue;
 extern sint8 SocketId;
 extern sint8 RegChkRet;
@@ -55,65 +91,227 @@ extern char IccidNum[20];
 extern uint8 TcpWorkState;
 typedef struct _AppEppType
 {
-	uint32 battDischrgAccCap;  //单位maH
-	uint32 battDischrgAccEnrg; //单位wh
+	uint32 battDischrgAccCap; 
+	uint32 battDischrgAccEnrg;
 	uint16 battCycleTimes;
-} AppEppBody;
+}AppEppBody;
 typedef struct _AppConfigType
 {
-	bool appSaveFlg;
-	bool eolFlg;
-	uint8 deviceSn[17];
+    bool appSaveFlg;
+    bool eolFlg;
+    uint8 deviceSn[17];
 	AppEppBody AppDataInfo;
-	uint8 re[20];
+    uint8 re[20];
 } AppConfigBody;
 extern AppConfigBody AppConfigInfo;
-#define BMS_CELLNUM 120
-#define BMS_TEMPNUM 40
-typedef struct _AppDataType
-{
-	uint8 BattCellCount;
-	uint8 BattTempCount;
-} AppDataBody;
-extern AppDataBody AppDataInfo;
-extern uint16 avrgCellVol;
-extern uint16 battCellU[BMS_CELLNUM];
-extern uint16 battI;
-extern uint16 bmsHwVersion;
-extern uint32 bmsSwVersion;
-extern uint16 battPackVol;
-extern uint16 maxCellVol;
-extern uint16 minCellVol;
-// extern uint16 socd_pct_vcuSoc;
-// extern uint16 sohd_pct_bcuSoh;
-extern uint32 battBalanceoInfo;
-extern uint32 battProtectState;
-extern uint32 battWarningState;
-extern uint8 AvgBattTemp;
-extern uint8 battCellTemp[BMS_TEMPNUM];
-extern uint8 Battdesigncap;
-extern uint8 battHeatEnableState;
-extern uint8 battMOSSwitchState;
-extern uint8 battSOC;
-extern uint8 battSOH;
-extern uint8 battWorkState;
-extern uint8 BmsOtherTemp;
-extern uint8 maxCellTemp;
-extern uint8 minCellTemp;
-extern uint8 OtherTemp;
-extern uint8 battHeatState;
-extern uint8 battFanState;
-extern uint8 battRelayState;
-extern uint8 battConverState;
-extern uint8 battSeparateEnable;
-extern uint8 battSeparateCtlState;
-extern uint8 battSeparateState;
-extern uint16 ErrorArray[5];
-extern uint32 meterAllPwr[2];
-extern uint32 meterPosPwr[2];
-extern uint32 meterNegPwr[2];
-extern uint32 BattTempR[4];
-extern uint32 battAccEnrg;
-extern uint32 battAccCap;
-extern uint16 battAccUseTimes;
+
+/*���±�����ΪApp_CAN��ر���*/
+#ifdef APP_CAN_ENABLE
+extern uint8 vehicleStatus;
+extern uint8 bmsHVOn;
+extern uint8 currentGearPosition;
+extern uint8 parkingBreakStatus;
+extern uint8 breakingStatus;
+extern uint32 ODO;
+extern uint8 dcdcWorkStatus;
+extern uint8 numOfChrgableSubsys;
+extern uint8 chrgableSubsysCode;
+extern uint16 vcuDCVol;
+// EBC
+extern uint8 ebcStatus;
+extern uint8 ebcAskHVOn;
+extern uint8 ebcAskHVOff;
+extern uint8 retainLockSignal;
+extern uint8 dischargeLockSignal;
+extern uint8 chargeLockSignal;
+extern uint8 chargeFlag;
+// BCU�������
+extern UINT32 BcuInTable[28];
+extern BOOL BcuRxShortError[28];
+extern BOOL BcuRxLongError[28];
+extern UINT8 BcuRxErrorCounter[28];
+extern UINT8 BcuRxFlag[28];
+extern UINT8 BMS_ReqVIN;
+extern UINT8 BMS_ReqHVOff;
+extern UINT8 BMS_ProtocolEditionH;
+extern UINT8 BMS_ProtocolEditionL;
+extern UINT8 BMS_CharDevNum;
+extern UINT8 BMS_FtPosRly;
+extern UINT8 BMS_FtNegRly;
+extern UINT8 BMS_FtPosCharRly1;
+extern UINT8 BMS_FtNegCharRly1;
+extern UINT8 BMS_FtPosCharRly2;
+extern UINT8 BMS_FtNegCharRly2;
+extern UINT8 BMS_FtHeatRly1;
+extern UINT8 BMS_FtHeatRly2;
+extern UINT8 BMS_StPosRly;
+extern UINT8 BMS_StNegRly;
+extern UINT8 BMS_StPreCharRly;
+extern UINT8 BMS_StPosCharRly1;
+extern UINT8 BMS_StNegCharRly1;
+extern UINT8 BMS_StPosCharRly2;
+extern UINT8 BMS_StNegCharRly2;
+extern UINT8 BMS_FtAuxRelayWeld;
+extern UINT8 BMS_BraOpenCirc;
+extern UINT8 BMS_FtBackCharCurrOutLim;
+extern UINT8 BMS_FtPosRlyOpen;
+extern UINT8 BMS_FtNegRlyOpen;
+extern UINT8 BMS_FtPosCharRly1Open;
+extern UINT8 BMS_FtPosCharRly2Open;
+extern UINT8 BMS_FtNegCharRly1Open;
+extern UINT8 BMS_FtNegCharRly2Open;
+extern UINT8 BMS_FtTMSContClose;
+extern UINT8 BMS_FtTMSContOpen;
+extern UINT8 BMS_FtTMS;
+extern UINT8 BMS_Ft24VSpy;
+extern UINT8 BMS_FtPACKSelfProt;
+extern UINT8 BMS_FtCharSockTempOver;
+extern UINT8 BMS_FtTempOutCtrl;
+extern UINT8 BMS_StPosHeatRly;
+extern UINT8 BMS_StNegHeatRly;
+extern UINT8 BMS_CharSysNum;
+extern UINT8 BMS_FtCode;
+extern UINT8 BMS_ST1CheckSum;
+extern UINT8 BMS_ST1Counter;
+extern UINT8 BMS_Mode;
+extern UINT8 BMS_AuxRlySt;
+extern UINT8 BMS_BattBalaSt;
+extern UINT8 BMS_CharGunSt;
+extern UINT8 BMS_CharMode;
+extern UINT8 BMS_CharSt;
+extern UINT8 BMS_FtLvl;
+extern UINT8 BMS_FtCellTempDiff;
+extern UINT8 BMS_FtCellTempHigh;
+extern UINT8 BMS_FtPACKOverVolt;
+extern UINT8 BMS_FtPACKUndeVolt;
+extern UINT8 BMS_FtSOCLow;
+extern UINT8 BMS_FtCellOverVolt;
+extern UINT8 BMS_FtCellUndeVolt;
+extern UINT8 BMS_FtIns;
+extern UINT8 BMS_FtCellOverVoltDiff;
+extern UINT8 BMS_FtCharCurrOver;
+extern UINT8 BMS_FtDisCharCurrOver;
+extern UINT8 BMS_FtCellTempLow;
+extern UINT8 BMS_FtBranVoltDifOver;
+extern UINT8 BMS_FtBMSHardWare;
+extern UINT8 BMS_FtSOCHigh;
+extern UINT8 BMS_FtSOCJump;
+extern UINT8 BMS_FtInCom;
+extern UINT8 BMS_FtSysMism;
+extern UINT8 BMS_FtHvIntLock;
+extern UINT8 BMS_FtSmoke;
+extern UINT8 BMS_FtFire;
+extern UINT8 BMS_FtNum;
+extern UINT8 BMS_PackSOC;
+extern UINT8 BMS_PackSOH;
+extern UINT8 BMS_MaxCellTemp;
+extern UINT8 BMS_MinCellTemp;
+extern UINT8 BMS_AverCellTemp;
+extern UINT8 BMS_MaxCellTempCSC;
+extern UINT8 BMS_MaxCellTempNum;
+extern UINT8 BMS_MinCellTempCSC;
+extern UINT8 BMS_MinCellTempNum;
+extern UINT8 BMS_MaxCellVoltCSC;
+extern UINT8 BMS_MaxCellVoltNum;
+extern UINT8 BMS_MinCellVoltCSC;
+extern UINT8 BMS_MinCellVoltNum;
+extern UINT8 BMS_InsDeteSt;
+extern UINT8 BMS_FtCharInsLow;
+extern UINT8 BMS_FtCurrSenr;
+extern UINT8 BMS_FtHeatingFilm;
+extern UINT8 BMS_FtMainLoopPreChar;
+extern UINT8 BMS_FtAuxLoopPreChar;
+extern UINT8 BMS_FtACANLost;
+extern UINT8 BMS_FtDCDC;
+extern UINT8 BMS_FtSOCDif;
+extern UINT8 BMS_FtCellOverDisChar;
+extern UINT8 BMS_FtCharOver;
+extern UINT8 BMS_FtContDisCharCurrOverLoad;
+extern UINT8 BMS_FtContCharCurrOverLoad;
+extern UINT8 BMS_Gun1DCNegTemp;
+extern UINT8 BMS_Gun1DCPosTemp;
+extern UINT8 BMS_Gun2DCNegTemp;
+extern UINT8 BMS_Gun2DCPosTemp;
+extern UINT8 BMS_CurrHeatSt;
+extern UINT8 BMS_CurrCoolSt;
+extern UINT8 BMS_FtCharCnct;
+extern UINT8 BMS_FtOverDisCharCurrDuringChar;
+extern UINT8 BMS_FtCharNTC;
+extern UINT8 BMS_FtELock;
+extern UINT8 BMS_CellVoltFramNum;
+extern UINT8 BMS_CellTempFramNum;
+extern UINT8 BMS_CSC_Code;
+extern UINT8 BMS_CellTemp[BMS_TEMP_MAX_NUM];
+extern UINT8 BMS_Checksum;
+extern UINT8 BMS_PackComp;
+extern UINT8 BMS_BattCodeLeng;
+extern UINT8 BMS_SN[27];
+extern UINT8 BMS_BattType;
+extern UINT8 BMS_CoolType;
+extern UINT8 BMS_CSC_Total;
+extern UINT8 BMS_CellVoltLevel;
+extern UINT8 BMS_CellMinVolt;
+extern UINT8 BMS_CellMaxVolt;
+extern UINT8 BMS_HVBranNum;
+extern UINT8 BMS_SingleHVBranchCellNum;
+extern UINT8 BMS_ReqMode;
+extern UINT8 BMS_HVCmd;
+extern UINT8 BMS_ChgSts;
+extern UINT8 BMS_HVRelaySts;
+extern UINT8 BMS_SetTemp;
+extern UINT8 BMS_Life;
+extern UINT8 BMS_CRC;
+extern UINT8 TMS_WorkStatus;
+extern UINT8 TMS_HVRelayST;
+extern UINT8 TMS_OutletTemp;
+extern UINT8 TMS_InletTemp;
+extern UINT8 TMS_ErrCode;
+extern UINT8 TMS_FaultLevel;
+extern UINT16 BMS_SoftwareVersion;
+extern UINT16 BMS_HardwareVersion;
+extern UINT16 BMS_PackCurr;
+extern UINT16 BMS_MaxCharCurr;
+extern UINT16 BMS_MaxDisCharCurr;
+extern UINT16 BMS_PosIns;
+extern UINT16 BMS_NegIns;
+extern UINT16 BMS_BattVolt;
+extern UINT16 BMS_LinkVolt;
+extern UINT16 BMS_MaxCellVolt;
+extern UINT16 BMS_AverCellVolt;
+extern UINT16 BMS_MinCellVolt;
+extern UINT16 BMS_ContChrgCurr;
+extern UINT16 BMS_ContDisCharCurr;
+extern UINT16 BMS_CharReqVolt;
+extern UINT16 BMS_CharReqCurr;
+extern UINT16 BMS_SysInsRes;
+extern UINT16 BMS_MaxDisCharPwr;
+extern UINT16 BMS_MaxCharPwr;
+extern UINT16 BMS_ContDisCharPwr;
+extern UINT16 BMS_ContCharPwr;
+extern UINT16 BMS_InstEngyCons;
+extern UINT16 BMS_TotalEngyCons;
+extern UINT16 BMS_SOE;
+extern UINT16 BMS_RmanCharTime;
+extern UINT16 BMS_CharNum;
+extern UINT16 BMS_CellVolt[BMS_CELL_MAX_NUM];
+extern UINT16 BMS_BattRateCap;
+extern UINT16 BMS_BattRateVolt;
+extern UINT16 BMS_BattRateEngy;
+extern UINT16 BMS_CellTotal;
+extern UINT16 BMS_TempTotal;
+extern UINT16 BMS_SingleCharEngy;
+extern UINT16 BMS_SingleCharCapy;
+extern UINT16 BMS_HVVolt;
+extern UINT16 TMS_ReqPow;
+extern UINT32 BMS_TotalCharEngy;
+extern UINT32 BMS_TotalDisCharEngy;
+extern UINT32 BMS_TotalBackCharEngy;
+extern UINT32 BMS_TotalStaCharEngy;
+extern UINT32 BMS_TotalGunCharEngy;
+extern UINT32 BMS_TotalGunCharCapy;
+extern UINT32 BMS_TotalCharCapy;
+extern UINT32 BMS_TotalDisCharCapy;
+extern UINT32 BMS_TotalBackCharCapy;
+extern UINT32 BMS_TotalStaCharCapy;
+#endif
 #endif /* APPGLOBALVAR_H_ */

+ 945 - 197
code/app/AppTaskCan.c

@@ -1,24 +1,25 @@
 /*
- * @Author: chenjie
- * @Date: 2022-06-06
- * @LastEditTime: 2022-10-27
- * @LastEditors: chenjie
- * @Description: 
- * @FilePath: \S32K146_4G\code\app\AppTaskCan.c
- * Copyright (c) 2022 by chenjie, All Rights Reserved.
+ * AppTaskCan.c
+ *
+ *  Created on: 2022年2月13日
+ *      Author: QiXiang_CHENJIE
  */
 #include "AppTaskCan.h"
+#ifdef APP_CAN_ENABLE
+uint32 timerCANIdle = 0x00;
+uint32 timerCounterNow = 0;
 static uint8 BattSendFlg = 0;
 static void UDSAnsFunc(uint8 *rawData);
-static void UdsAns(bool PosFlg,uint8 UdsService,uint8 UdsSubService,uint8 Idx,uint8 *AnsData,uint8 AnsDataLen);
+static void UdsAns(bool PosFlg, uint8 UdsService, uint8 UdsSubService, uint8 Idx, uint8 *AnsData, uint8 AnsDataLen);
 static void BattSendFunc(void);
 static void vCanRxCallback(TimerHandle_t pxTimer)
 {
 	uint32 ulTimerID;
 	ulTimerID = (uint32)pvTimerGetTimerID(pxTimer);
-	if(ulTimerID==0)
+	if (ulTimerID == 0)
 	{
 		Can_MainFunction_Read();
+		timerCANIdle++;
 	}
 }
 void CanTask(void *pvParameters)
@@ -27,21 +28,22 @@ void CanTask(void *pvParameters)
 	(void)pvParameters;
 	CanIf_bRxFlag = false;
 	Can_Msg_Type_Data CanRxMsg;
-	CanRecvQueueHandle = xQueueCreate(100, sizeof(Can_Msg_Type_Data));
+	CanRecvQueueHandle1 = xQueueCreate(100, sizeof(Can_Msg_Type_Data));
 	TimerHandle_t monitorTimer1ms;
-	monitorTimer1ms = xTimerCreate("monitor1ms",1,pdTRUE,(void *)0,vCanRxCallback);
-	xTimerStart(monitorTimer1ms,0);
+	monitorTimer1ms = xTimerCreate("monitor1ms", 1, pdTRUE, (void *)0, vCanRxCallback);
+	xTimerStart(monitorTimer1ms, 0);
 	BaseType_t ret = pdFALSE;
 	GsensorInit();
-	while(1)
+	while (1)
 	{
 		do
 		{
 			memset(&CanRxMsg, 0, sizeof(CanRxMsg));
-			ret = xQueueReceive(CanRecvQueueHandle, &CanRxMsg, 1);
+			ret = xQueueReceive(CanRecvQueueHandle1, &CanRxMsg, 1);
 			if (ret == pdPASS)
 			{
-				if(IsJumptoBootloader(CanRxMsg.id, CanRxMsg.data))
+				timerCANIdle = 0x00;
+				if (IsJumptoBootloader(CanRxMsg.id, CanRxMsg.data))
 				{
 					DoRoutinePositiveAnswer();
 					RequestEnterBootloader();
@@ -50,81 +52,431 @@ void CanTask(void *pvParameters)
 				}
 				else
 				{
-					BcuDecodeFunction(CanRxMsg.id,CanRxMsg.data);//can鍗忚�瑙f瀽
+					BcuDecodeFunction(CanRxMsg.id, CanRxMsg.data); // can协议解析
 				}
 			}
-		}while(ret == pdPASS);
+			if(timerCANIdle >= 60000)
+			{
+				timerCANIdle = 0;
+				xSemaphoreGive(sleep_mutex);
+			}
+		} while (ret == pdPASS);
 		SL_SC7A20_Read_XYZ_Data(xyzData);
-		if(BattSendFlg)
+		if (BattSendFlg)
 		{
 			BattSendFunc();
 		}
 		if((TimerCounter - timerCounterNow)>=100)
 		{
+			BcuRxDiagnose();
 			timerCounterNow = TimerCounter;
-			//娓╁害閲囬泦
 			ADC_ReadValue();
 		}
 	}
 }
-//娉ㄦ剰瑙g爜瓒呴檺闂��
+//注意解码超限问题
 void BcuDecodeFunction(uint32 ID, uint8 *rawData)
 {
-	switch(ID)
+	switch (ID)
+	{
+	case 0x1801D0F3:
+		BMS_ReqVIN = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0x3);
+		BMS_ReqHVOff = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 2) & 0x3);
+		BcuRxFlag[0] = 0x01;
+		break;
+	case 0x1801D8F3:
+		BMS_SoftwareVersion = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
+		BMS_HardwareVersion = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
+		BMS_ProtocolEditionH = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0x3);
+		BMS_ProtocolEditionL = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 2) & 0xF);
+		BcuRxFlag[1] = 0x01;
+		break;
+	case 0x1880D0F3:
+		BMS_CharDevNum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xF);
+		BMS_FtPosRly = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 4) & 0x1);
+		BMS_FtNegRly = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 5) & 0x1);
+		BMS_FtPosCharRly1 = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 6) & 0x1);
+		BMS_FtNegCharRly1 = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 7) & 0x1);
+		BMS_FtPosCharRly2 = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0x1);
+		BMS_FtNegCharRly2 = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 1) & 0x1);
+		BMS_FtHeatRly1 = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 2) & 0x1);
+		BMS_FtHeatRly2 = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 3) & 0x1);
+		BMS_StPosRly = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 4) & 0x3);
+		BMS_StNegRly = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 6) & 0x3);
+		BMS_StPreCharRly = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0x3);
+		BMS_StPosCharRly1 = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 2) & 0x3);
+		BMS_StNegCharRly1 = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 4) & 0x3);
+		BMS_StPosCharRly2 = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 6) & 0x3);
+		BMS_StNegCharRly2 = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0x3);
+		BMS_FtAuxRelayWeld = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 2) & 0x1);
+		BMS_BraOpenCirc = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 3) & 0x1);
+		BMS_FtBackCharCurrOutLim = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 4) & 0x3);
+		BMS_FtPosRlyOpen = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 6) & 0x1);
+		BMS_FtNegRlyOpen = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 7) & 0x1);
+		BMS_FtPosCharRly1Open = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0x1);
+		BMS_FtPosCharRly2Open = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 1) & 0x1);
+		BMS_FtNegCharRly1Open = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 2) & 0x1);
+		BMS_FtNegCharRly2Open = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 3) & 0x1);
+		BMS_FtTMSContClose = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 4) & 0x1);
+		BMS_FtTMSContOpen = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 5) & 0x1);
+		BMS_FtTMS = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 6) & 0x1);
+		BMS_Ft24VSpy = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 7) & 0x1);
+		BMS_FtPACKSelfProt = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0x1);
+		BMS_FtCharSockTempOver = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 1) & 0x3);
+		BMS_FtTempOutCtrl = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 3) & 0x1);
+		BMS_StPosHeatRly = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 4) & 0x3);
+		BMS_StNegHeatRly = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 6) & 0x3);
+		BMS_CharSysNum = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xF);
+		BMS_FtCode = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
+		BcuRxFlag[2] = 0x01;
+		break;
+	case 0x1881D0F3:
+		BMS_ST1CheckSum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
+		BMS_ST1Counter = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xF);
+		BMS_Mode = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 4) & 0x3);
+		BMS_AuxRlySt = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 6) & 0x1);
+		BMS_BattBalaSt = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 7) & 0x1);
+		BMS_CharGunSt = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0x1);
+		BMS_CharMode = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 1) & 0x3);
+		BMS_CharSt = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 3) & 0x3);
+		BMS_FtLvl = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 5) & 0x3);
+		BMS_FtCellTempDiff = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0x3);
+		BMS_FtCellTempHigh = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 2) & 0x3);
+		BMS_FtPACKOverVolt = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 4) & 0x3);
+		BMS_FtPACKUndeVolt = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 6) & 0x3);
+		BMS_FtSOCLow = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0x3);
+		BMS_FtCellOverVolt = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 2) & 0x3);
+		BMS_FtCellUndeVolt = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 4) & 0x3);
+		BMS_FtIns = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 6) & 0x3);
+		BMS_FtCellOverVoltDiff = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0x3);
+		BMS_FtCharCurrOver = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 2) & 0x3);
+		BMS_FtDisCharCurrOver = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 4) & 0x3);
+		BMS_FtCellTempLow = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 6) & 0x3);
+		BMS_FtBranVoltDifOver = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0x3);
+		BMS_FtBMSHardWare = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 2) & 0x3);
+		BMS_FtSOCHigh = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 4) & 0x1);
+		BMS_FtSOCJump = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 5) & 0x1);
+		BMS_FtInCom = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 6) & 0x1);
+		BMS_FtSysMism = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 7) & 0x1);
+		BMS_FtHvIntLock = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0x1);
+		BMS_FtSmoke = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 1) & 0x1);
+		BMS_FtFire = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 2) & 0x1);
+		BMS_FtNum = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 3) & 0x1F);
+		BcuRxFlag[3] = 0x01;
+		break;
+	case 0x1882D0F3:
+		BMS_PackSOC = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
+		BMS_PackSOH = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
+		BMS_PackCurr = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
+		BMS_MaxCharCurr = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
+		BMS_MaxDisCharCurr = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
+		BcuRxFlag[4] = 0x01;
+		break;
+	case 0x1883D0F3:
+		BMS_PosIns = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
+		BMS_NegIns = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
+		BMS_BattVolt = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
+		BMS_LinkVolt = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
+		BcuRxFlag[5] = 0x01;
+		break;
+	case 0x1884D0F3:
+		BMS_MaxCellTemp = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
+		BMS_MinCellTemp = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
+		BMS_AverCellTemp = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
+		BMS_MaxCellTempCSC = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
+		BMS_MaxCellTempNum = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
+		BMS_MinCellTempCSC = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
+		BMS_MinCellTempNum = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
+		BcuRxFlag[6] = 0x01;
+		break;
+	case 0x1885D0F3:
+		BMS_MaxCellVolt = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
+		BMS_MaxCellVoltCSC = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
+		BMS_MaxCellVoltNum = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
+		BMS_AverCellVolt = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
+		BcuRxFlag[7] = 0x01;
+		break;
+	case 0x1886D0F3:
+		BMS_MinCellVolt = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
+		BMS_MinCellVoltCSC = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
+		BMS_MinCellVoltNum = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
+		BMS_ContChrgCurr = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
+		BMS_ContDisCharCurr = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
+		BcuRxFlag[8] = 0x01;
+		break;
+	case 0x1887D0F3:
+		BMS_CharReqVolt = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
+		BMS_CharReqCurr = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
+		BMS_SysInsRes = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
+		BMS_InsDeteSt = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0x1);
+		BMS_FtCharInsLow = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 1) & 0x1);
+		BMS_FtCurrSenr = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 2) & 0x1);
+		BMS_FtHeatingFilm = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 3) & 0x1);
+		BMS_FtMainLoopPreChar = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 4) & 0x1);
+		BMS_FtAuxLoopPreChar = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 5) & 0x1);
+		BMS_FtACANLost = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 6) & 0x1);
+		BMS_FtDCDC = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 7) & 0x1);
+		BMS_FtSOCDif = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0x1);
+		BMS_FtCellOverDisChar = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 1) & 0x1);
+		BMS_FtCharOver = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 2) & 0x3);
+		BMS_FtContDisCharCurrOverLoad = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 4) & 0x3);
+		BMS_FtContCharCurrOverLoad = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 6) & 0x3);
+		BcuRxFlag[9] = 0x01;
+		break;
+	case 0x1888D0F3:
+		BMS_MaxDisCharPwr = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
+		BMS_MaxCharPwr = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
+		BMS_ContDisCharPwr = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
+		BMS_ContCharPwr = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
+		BcuRxFlag[10] = 0x01;
+		break;
+	case 0x1889D0F3:
+		BMS_InstEngyCons = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
+		BMS_TotalEngyCons = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
+		BMS_SOE = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
+		BMS_RmanCharTime = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
+		BcuRxFlag[11] = 0x01;
+		break;
+	case 0x188AD0F3:
+		BMS_Gun1DCNegTemp = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
+		BMS_Gun1DCPosTemp = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
+		BMS_Gun2DCNegTemp = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
+		BMS_Gun2DCPosTemp = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
+		BMS_CurrHeatSt = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0x3);
+		BMS_CurrCoolSt = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 2) & 0x3);
+		BMS_FtCharCnct = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 4) & 0x1);
+		BMS_FtOverDisCharCurrDuringChar = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 5) & 0x1);
+		BMS_FtCharNTC = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 6) & 0x1);
+		BMS_FtELock = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 7) & 0x1);
+		BMS_CharNum = (UINT16)(((*(UINT8 *)(rawData + 5)) | (*(UINT8 *)(rawData + 6) << 8)) & 0xFFFF);
+		BcuRxFlag[12] = 0x01;
+		break;
+	case 0x18C1D0F3:
+		BMS_CellVoltFramNum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
+		BMS_CSC_Code = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
+		if (BMS_CellVoltFramNum == 0 || BMS_CellVoltFramNum > 128)
+		{
+			break;
+		}
+		for (UINT8 i = 0; i < 3; i++)
 		{
-		case 0x1C00EDEA:
+			BMS_CellVolt[(BMS_CellVoltFramNum - 1) * 3 + i] = (UINT16)(((*(UINT8 *)(rawData + i * 2 + 2)) | (*(UINT8 *)(rawData + i * 2 + 3) << 8)) & 0xFFFF);
+		}
+		BcuRxFlag[13] = 0x01;
+		break;
+	case 0x18C2D0F3:
+		BMS_CellTempFramNum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
+		BMS_CSC_Code = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
+		if (BMS_CellTempFramNum == 0 || BMS_CellTempFramNum > 12)
 		{
-			UDSAnsFunc(rawData);
 			break;
 		}
+		for (UINT8 i = 0; i < 6; i++)
+		{
+			if (((BMS_CellTempFramNum - 1) * 6 + i) < sizeof(BMS_CellTemp))
+			{
+				BMS_CellTemp[(BMS_CellTempFramNum - 1) * 6 + i] = (UINT8)(((*(UINT8 *)(rawData + 2 + i))) & 0xFF);
+				if(BMS_CellTemp[(BMS_CellTempFramNum - 1) * 6 + i] <= (0xFF - 10)   &&   BMS_CellTemp[(BMS_CellTempFramNum - 1) * 6 + i] >= 10)
+				{
+					BMS_CellTemp[(BMS_CellTempFramNum - 1) * 6 + i] = BMS_CellTemp[(BMS_CellTempFramNum - 1) * 6 + i] - 10;  //the tcp offset is -40, while the can message offset is -50
+				}
+			}
+		}
+		BcuRxFlag[14] = 0x01;
+		break;
+	case 0x18E1D0F3:
+		BMS_Checksum = 0;
+		for (UINT8 i = 1; i < 8; i++)
+		{
+			BMS_Checksum = (UINT8)(((*(UINT8 *)(rawData + i))) & 0xFF) ^ BMS_Checksum;
+		}
+		if (BMS_Checksum == (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF))
+		{
+			BMS_PackComp = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0x7);
+			BMS_BattCodeLeng = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 3) & 0x1F);
+			BMS_SN[0] = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
+			BMS_SN[1] = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
+			BMS_SN[2] = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
+			BMS_SN[3] = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
+			BMS_SN[4] = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
+			BMS_SN[5] = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
+		}
+		BcuRxFlag[15] = 0x01;
+		break;
+	case 0x18E2D0F3:
+		BMS_Checksum = 0;
+		for (UINT8 i = 1; i < 8; i++)
+		{
+			BMS_Checksum = (UINT8)(((*(UINT8 *)(rawData + i))) & 0xFF) ^ BMS_Checksum;
+		}
+		if (BMS_Checksum == (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF))
+		{
+			BMS_SN[6] = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
+			BMS_SN[7] = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
+			BMS_SN[8] = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
+			BMS_SN[9] = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
+			BMS_SN[10] = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
+			BMS_SN[11] = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
+			BMS_SN[12] = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
 		}
+		BcuRxFlag[16] = 0x01;
+		break;
+	case 0x18E3D0F3:
+		BMS_Checksum = 0;
+		for (UINT8 i = 1; i < 8; i++)
+		{
+			BMS_Checksum = (UINT8)(((*(UINT8 *)(rawData + i))) & 0xFF) ^ BMS_Checksum;
+		}
+		if (BMS_Checksum == (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF))
+		{
+			BMS_SN[13] = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
+			BMS_SN[14] = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
+			BMS_SN[15] = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
+			BMS_SN[16] = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
+			BMS_SN[17] = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
+			BMS_SN[18] = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
+			BMS_SN[19] = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
+		}
+		BcuRxFlag[17] = 0x01;
+		break;
+	case 0x18E4D0F3:
+		BMS_Checksum = 0;
+		for (UINT8 i = 1; i < 8; i++)
+		{
+			BMS_Checksum = (UINT8)(((*(UINT8 *)(rawData + i))) & 0xFF) ^ BMS_Checksum;
+		}
+		if (BMS_Checksum == (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF))
+		{
+			BMS_SN[20] = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
+			BMS_SN[21] = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
+			BMS_SN[22] = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
+			BMS_SN[23] = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
+			BMS_SN[24] = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
+			BMS_SN[25] = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
+			BMS_SN[26] = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
+		}
+		BcuRxFlag[18] = 0x01;
+		break;
+	case 0x18E5D0F3:
+		BMS_BattRateCap = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
+		BMS_BattRateVolt = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
+		BMS_BattRateEngy = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
+		BMS_BattType = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xF);
+		BMS_CoolType = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 4) & 0x3);
+		BcuRxFlag[19] = 0x01;
+		break;
+	case 0x18E6D0F3:
+		BMS_CSC_Total = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
+		BMS_CellTotal = (UINT16)(((*(UINT8 *)(rawData + 1)) | (*(UINT8 *)(rawData + 2) << 8)) & 0xFFFF);
+		BMS_TempTotal = (UINT16)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8)) & 0xFFFF);
+		BMS_CellVoltLevel = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
+		BMS_CellMinVolt = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
+		BMS_CellMaxVolt = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
+		BcuRxFlag[20] = 0x01;
+		break;
+	case 0x18F1D0F3:
+		BMS_TotalCharEngy = (UINT32)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8) | (*(UINT8 *)(rawData + 2) << 16) | (*(UINT8 *)(rawData + 3) << 24)) & 0xFFFFFF);
+		BMS_TotalDisCharEngy = (UINT32)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8) | (*(UINT8 *)(rawData + 5) << 16) | (*(UINT8 *)(rawData + 6) << 24)) & 0xFFFFFF);
+		BMS_SingleCharEngy = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
+		BcuRxFlag[21] = 0x01;
+		break;
+	case 0x18F2D0F3:
+		BMS_TotalBackCharEngy = (UINT32)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8) | (*(UINT8 *)(rawData + 2) << 16) | (*(UINT8 *)(rawData + 3) << 24)) & 0xFFFFFF);
+		BMS_TotalStaCharEngy = (UINT32)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8) | (*(UINT8 *)(rawData + 5) << 16) | (*(UINT8 *)(rawData + 6) << 24)) & 0xFFFFFF);
+		BcuRxFlag[22] = 0x01;
+		break;
+	case 0x18F3D0F3:
+		BMS_TotalGunCharEngy = (UINT32)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8) | (*(UINT8 *)(rawData + 2) << 16) | (*(UINT8 *)(rawData + 3) << 24)) & 0xFFFFFF);
+		BMS_TotalGunCharCapy = (UINT32)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8) | (*(UINT8 *)(rawData + 5) << 16) | (*(UINT8 *)(rawData + 6) << 24)) & 0xFFFFFF);
+		BcuRxFlag[23] = 0x01;
+		break;
+	case 0x18F4D0F3:
+		BMS_TotalCharCapy = (UINT32)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8) | (*(UINT8 *)(rawData + 2) << 16) | (*(UINT8 *)(rawData + 3) << 24)) & 0xFFFFFF);
+		BMS_TotalDisCharCapy = (UINT32)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8) | (*(UINT8 *)(rawData + 5) << 16) | (*(UINT8 *)(rawData + 6) << 24)) & 0xFFFFFF);
+		BMS_SingleCharCapy = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
+		BcuRxFlag[24] = 0x01;
+		break;
+	case 0x18F5D0F3:
+		BMS_TotalBackCharCapy = (UINT32)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8) | (*(UINT8 *)(rawData + 2) << 16) | (*(UINT8 *)(rawData + 3) << 24)) & 0xFFFFFF);
+		BMS_TotalStaCharCapy = (UINT32)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8) | (*(UINT8 *)(rawData + 5) << 16) | (*(UINT8 *)(rawData + 6) << 24)) & 0xFFFFFF);
+		BMS_HVBranNum = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
+		BMS_SingleHVBranchCellNum = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
+		BcuRxFlag[25] = 0x01;
+		break;
+	case 0x18FF45F4:
+		BMS_ReqMode = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0x3);
+		BMS_HVCmd = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 2) & 0x3);
+		BMS_ChgSts = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 4) & 0x3);
+		BMS_HVRelaySts = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 6) & 0x3);
+		BMS_HVVolt = (UINT16)(((*(UINT8 *)(rawData + 1)) | (*(UINT8 *)(rawData + 2) << 8)) & 0xFFFF);
+		BMS_SetTemp = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
+		BMS_Life = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
+		BMS_CRC = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
+		BcuRxFlag[26] = 0x01;
+		break;
+	case 0x18FFC13A:
+		TMS_WorkStatus = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0x3);
+		TMS_HVRelayST = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 2) & 0x3);
+		TMS_OutletTemp = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
+		TMS_InletTemp = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
+		TMS_ReqPow = (UINT16)(((*(UINT8 *)(rawData + 5)) | (*(UINT8 *)(rawData + 6) << 8)) & 0xFFFF);
+		TMS_ErrCode = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0x3F);
+		TMS_FaultLevel = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 6) & 0x3);
+		BcuRxFlag[27] = 0x01;
+		break;
+	case 0x1C00EDEA:
+		UDSAnsFunc(rawData);
+		break;
+	default:
+		break;
+	}
 }
 static void UDSAnsFunc(uint8 *rawData)
 {
 	static uint8 UdsStates = 1;
 	uint8 Data[8] = {0};
-	memcpy(Data,rawData,8);
+	memcpy(Data, rawData, 8);
 	uint8 UdsService = 0;
 	uint8 UdsSubService = 0;
 	UdsService = Data[0];
 	UdsSubService = Data[1];
-	uint8 AnsData[24]={0};
+	uint8 AnsData[24] = {0};
 	static uint8 deviceSnRecvFlg = 0;
-	switch(UdsService)
+	switch (UdsService)
 	{
-	case 0x10://妯″紡鍒囨崲
+	case 0x10: //模式切换
 	{
-		if(UdsSubService==0x01)
+		if (UdsSubService == 0x01)
 		{
-			UdsStates = 0x01;//鍏抽棴UDS璇婃柇
-			UdsAns(true,UdsService,UdsSubService,0x00,NULL,0);
+			UdsStates = 0x01; //关闭UDS诊断
+			UdsAns(true, UdsService, UdsSubService, 0x00, NULL, 0);
 		}
-		else if(UdsSubService==0x02)
+		else if (UdsSubService == 0x02)
 		{
-			if(UdsStates==0x01||UdsStates==0x02)
+			if (UdsStates == 0x01 || UdsStates == 0x02)
 			{
-				UdsStates = 0x02;//鎵撳紑UDS璇婃柇
-				UdsAns(true,UdsService,UdsSubService,0x00,NULL,0);
+				UdsStates = 0x02; //打开UDS诊断
+				UdsAns(true, UdsService, UdsSubService, 0x00, NULL, 0);
 			}
 			else
 			{
-				UdsAns(false,UdsService,UdsSubService,0x00,NULL,0);
+				UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
 			}
 		}
 		break;
 	}
-	case 0x11://鎺у埗
+	case 0x11://控制
 	{
 		if(UdsStates==0x02)
 		{
 			switch(UdsSubService)
 			{
-				case 0x01://閲嶅惎
+				case 0x01://重启
 				{
-					AnsData[0] = AppSwVersion>>24;
-					AnsData[1] = AppSwVersion>>16;
-					AnsData[2] = AppSwVersion>>8;
-					AnsData[3] = AppSwVersion>>0;
+					AnsData[0] = APPSWVERSION>>24;
+					AnsData[1] = APPSWVERSION>>16;
+					AnsData[2] = APPSWVERSION>>8;
+					AnsData[3] = APPSWVERSION>>0;
 					UdsAns(true,UdsService,UdsSubService,0x00,AnsData,4);
 					AppConfigInfo.appSaveFlg = true;
 					vTaskDelay(pdMS_TO_TICKS(1000));
@@ -144,61 +496,61 @@ static void UDSAnsFunc(uint8 *rawData)
 		}
 		break;
 	}
-	case 0x22://鏌ヨ�
+	case 0x22: //查询
 	{
-		if(UdsStates==0x02)
+		if (UdsStates == 0x02)
 		{
-			switch(UdsSubService)
+			switch (UdsSubService)
 			{
-			case 0x01://鐗堟湰鍙锋煡璇�
+			case 0x01: //版本号查询
 			{
-				AnsData[0] = AppSwVersion>>24;
-				AnsData[1] = AppSwVersion>>16;
-				AnsData[2] = AppSwVersion>>8;
-				AnsData[3] = AppSwVersion>>0;
-				UdsAns(true,UdsService,UdsSubService,0x00,AnsData,4);
+				AnsData[0] = APPSWVERSION >> 24;
+				AnsData[1] = APPSWVERSION >> 16;
+				AnsData[2] = APPSWVERSION >> 8;
+				AnsData[3] = APPSWVERSION >> 0;
+				UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 4);
 				break;
 			}
-			case 0x02://SN鍙风爜鏌ヨ�
+			case 0x02: // SN号码查询
 			{
-				memcpy(AnsData,AppConfigInfo.deviceSn,17);
-				for(uint8 i=0;i<5;i++)
+				memcpy(AnsData, AppConfigInfo.deviceSn, 17);
+				for (uint8 i = 0; i < 5; i++)
 				{
-					UdsAns(true,UdsService,UdsSubService,i,&AnsData[i*4],4);
+					UdsAns(true, UdsService, UdsSubService, i, &AnsData[i * 4], 4);
 				}
 				break;
 			}
-			case 0x03://ICCID鏌ヨ�
+			case 0x03: // ICCID查询
 			{
-				memcpy(AnsData,IccidNum,20);
-				for(uint8 i=0;i<5;i++)
+				memcpy(AnsData, IccidNum, 20);
+				for (uint8 i = 0; i < 5; i++)
 				{
-					UdsAns(true,UdsService,UdsSubService,i,&AnsData[i*4],4);
+					UdsAns(true, UdsService, UdsSubService, i, &AnsData[i * 4], 4);
 				}
 				break;
 			}
-			case 0x04://IMEI鏌ヨ�
+			case 0x04: // IMEI查询
 			{
-				memcpy(AnsData,ImeiNum,15);
-				for(uint8 i=0;i<4;i++)
+				memcpy(AnsData, ImeiNum, 15);
+				for (uint8 i = 0; i < 4; i++)
 				{
-					UdsAns(true,UdsService,UdsSubService,i,&AnsData[i*4],4);
+					UdsAns(true, UdsService, UdsSubService, i, &AnsData[i * 4], 4);
 				}
 				break;
 			}
-			case 0x05://椹荤綉鐘舵€佹煡璇�
+			case 0x05: //驻网状态查询
 			{
-				AnsData[0]= RegChkRet;
-				UdsAns(true,UdsService,UdsSubService,0x00,AnsData,1);
+				AnsData[0] = RegChkRet;
+				UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 1);
 				break;
 			}
-			case 0x06://鑱旂綉鐘舵€佹煡璇�
+			case 0x06: //联网状态查询
 			{
-				AnsData[0]= SocketId;
-				UdsAns(true,UdsService,UdsSubService,0x00,AnsData,1);
+				AnsData[0] = SocketId;
+				UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 1);
 				break;
 			}
-			case 0x07://瀹氫綅淇℃伅鏌ヨ�
+			case 0x07: //定位信息查询
 			{
 				GPSInfo GpsRecvData;
 				if (xQueuePeek(GpsDataQueueHandle, &GpsRecvData, 0) == pdPASS)
@@ -215,72 +567,83 @@ static void UDSAnsFunc(uint8 *rawData)
 					AnsData[12] = GpsRecvData.altitude[0];
 					AnsData[13] = GpsRecvData.altitude[1];
 					AnsData[14] = GpsRecvData.satelliteNum;
-					for(uint8 i=0;i<4;i++)
+					for (uint8 i = 0; i < 4; i++)
 					{
-						UdsAns(true,UdsService,UdsSubService,i,&AnsData[i*4],4);
+						UdsAns(true, UdsService, UdsSubService, i, &AnsData[i * 4], 4);
 					}
 					break;
 				}
 				else
 				{
-					AnsData[0]=0xFF;
-					UdsAns(true,UdsService,UdsSubService,0x00,AnsData,1);
+					AnsData[0] = 0xFF;
+					UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 1);
 				}
 				break;
 			}
-			case 0x08://娓╁害妫€娴嬫煡璇�
+			case 0x08: //温度检测查询
 			{
-				UdsAns(true,UdsService,UdsSubService,0x00,AnsData,1);
+				UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 1);
 				break;
 			}
-			case 0x09://鐢垫睜淇℃伅鏌ヨ�
+			case 0x09: //电池信息查询
 			{
-				UdsAns(true,UdsService,UdsSubService,0x00,AnsData,1);
+				UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 1);
 				BattSendFlg = 1;
 				break;
 			}
-			case 0x0A://涓夎酱鏁版嵁鏌ヨ�
+			case 0x0A: //三轴数据查询
 			{
-				AnsData[0] = xyzData[0]>>8;
-				AnsData[1] = xyzData[0]>>0;
-				AnsData[2] = xyzData[1]>>8;
-				AnsData[3] = xyzData[1]>>0;
-				AnsData[4] = xyzData[2]>>8;
-				AnsData[5] = xyzData[2]>>0;
-				for(uint8 i=0;i<2;i++)
+				AnsData[0] = xyzData[0] >> 8;
+				AnsData[1] = xyzData[0] >> 0;
+				AnsData[2] = xyzData[1] >> 8;
+				AnsData[3] = xyzData[1] >> 0;
+				AnsData[4] = xyzData[2] >> 8;
+				AnsData[5] = xyzData[2] >> 0;
+				for (uint8 i = 0; i < 2; i++)
 				{
-					UdsAns(true,UdsService,UdsSubService,i,&AnsData[i*4],4);
+					UdsAns(true, UdsService, UdsSubService, i, &AnsData[i * 4], 4);
 				}
 				break;
 			}
-			}//switch
-		}//if
+			} // switch
+		}	  // if
 		else
 		{
-			UdsAns(false,UdsService,UdsSubService,0x00,NULL,0);
+			UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
 		}
 		break;
 	}
-	case 0x2E://鍐欏叆
+	case 0x27: //控制
 	{
-		if(UdsStates==0x02)
+		if (UdsStates == 0x02)
 		{
-			switch(UdsSubService)
+		}
+		else
+		{
+			UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
+		}
+		break;
+	}
+	case 0x2E: //写入
+	{
+		if (UdsStates == 0x02)
+		{
+			switch (UdsSubService)
 			{
 			case 0x01:
 			{
-				setbit(deviceSnRecvFlg,Data[3]);
-				if(Data[3]<0x04)
+				setbit(deviceSnRecvFlg, Data[3]);
+				if (Data[3] < 0x04)
 				{
-					memcpy(&AppConfigInfo.deviceSn[Data[3]*4],&Data[4],4);
-					UdsAns(true,UdsService,UdsSubService,0x00,&Data[3],1);
+					memcpy(&AppConfigInfo.deviceSn[Data[3] * 4], &Data[4], 4);
+					UdsAns(true, UdsService, UdsSubService, 0x00, &Data[3], 1);
 				}
-				else if(Data[3]==0x04)
+				else if (Data[3] == 0x04)
 				{
-					memcpy(&AppConfigInfo.deviceSn[Data[3]*4],&Data[4],1);
-					UdsAns(true,UdsService,UdsSubService,0x00,&Data[3],1);
+					memcpy(&AppConfigInfo.deviceSn[Data[3] * 4], &Data[4], 1);
+					UdsAns(true, UdsService, UdsSubService, 0x00, &Data[3], 1);
 				}
-				if(deviceSnRecvFlg==0x1F)
+				if (deviceSnRecvFlg == 0x1F)
 				{
 					deviceSnRecvFlg = 0;
 					AppConfigInfo.appSaveFlg = true;
@@ -296,7 +659,7 @@ static void UDSAnsFunc(uint8 *rawData)
 		}
 		break;
 	}
-	case 0x31://鎺у埗
+	case 0x31://控制
 	{
 		if(UdsStates==0x02)
 		{
@@ -304,7 +667,7 @@ static void UDSAnsFunc(uint8 *rawData)
 		}
 		else
 		{
-			UdsAns(false,UdsService,UdsSubService,0x00,NULL,0);
+			UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
 		}
 		break;
 	}
@@ -313,20 +676,20 @@ static void UDSAnsFunc(uint8 *rawData)
 	}
 	return;
 }
-static void UdsAns(bool PosFlg,uint8 UdsService,uint8 UdsSubService,uint8 Idx,uint8 *AnsData,uint8 AnsDataLen)
+static void UdsAns(bool PosFlg, uint8 UdsService, uint8 UdsSubService, uint8 Idx, uint8 *AnsData, uint8 AnsDataLen)
 {
 	Can_Msg_Type CanTxMsg;
 	uint32 CanAnsId = 0x1C00EAED;
 	uint8 SendData[8] = {0};
-	if(PosFlg)
+	if (PosFlg)
 	{
 		SendData[0] = 0x78;
 		SendData[1] = UdsService;
 		SendData[2] = UdsSubService;
 		SendData[3] = Idx;
-		if(AnsData!=NULL&&AnsDataLen!=0x00)
+		if (AnsData != NULL && AnsDataLen != 0x00)
 		{
-			memcpy(&SendData[4],AnsData,AnsDataLen);
+			memcpy(&SendData[4], AnsData, AnsDataLen);
 		}
 	}
 	else
@@ -344,113 +707,498 @@ static void UdsAns(bool PosFlg,uint8 UdsService,uint8 UdsSubService,uint8 Idx,ui
 }
 static void BattSendFunc(void)
 {
-	Can_Msg_Type CanTxMsg;
-	uint32 CanAnsId = 0;
-	uint8 SendData[8] = {0};
-	static uint8 SendStep = 0;
-	static uint8 SendCounter = 0;
-	switch(SendStep)
-	{
-	case 0x00:
+//	Can_Msg_Type CanTxMsg;
+//	uint32 CanAnsId = 0;
+//	uint8 SendData[8] = {0};
+//	static uint8 SendStep = 0;
+//	static uint8 SendCounter = 0;
+//	switch (SendStep)
+//	{
+//	case 0x00:
+//	{
+//		SendStep++;
+//		break;
+//	}
+//	case 0x01:
+//	{
+//		CanAnsId = 0x1C01EAED;
+//		SendData[0] =  battHeatState;
+//		SendData[1] =  battFanState;
+//		SendData[2] =  battRelayState;
+//		SendData[3] =  battConverState;
+//		SendStep++;
+//		break;
+//	}
+//	case 0x02:
+//	{
+//		uint16 ErrorTemp ;
+//		ErrorTemp = GetErrorNum(ErrorArray,sizeof(ErrorArray)/2);
+//		CanAnsId = 0x1C09EAED;
+//		SendData[0] =  battWorkState;
+//		SendData[1] =  ErrorTemp>>8;
+//		SendData[2] =  ErrorTemp;
+//		SendData[3] =  0;
+//		SendData[4] =  0;
+//		SendData[5] =  0;
+//		SendData[6] =  0;
+//		SendData[7] =  0;
+//		SendStep++;
+//		break;
+//	}
+//	case 0x03:
+//	{
+//		CanAnsId = 0x1C0AEAED;
+//		uint16 SocTemp = battSOC*10;
+//		SendData[0] =  battI>>8;
+//		SendData[1] =  battI;
+//		SendData[2] =  battPackVol>>8;
+//		SendData[3] =  battPackVol;
+//		SendData[4] =  SocTemp>>8;
+//		SendData[5] =  SocTemp;
+//		SendData[6] =  battSOH;
+//		SendData[7] =  battMOSSwitchState;
+//		SendStep++;
+//		break;
+//	}
+//	case 0x04:
+//	{
+//		CanAnsId = 0x1C10EAED + (SendCounter<<16);
+//		if((SendCounter*8 + 7)>BMS_TEMPNUM)
+//		{
+//			SendCounter = 0;
+//			SendStep++;
+//			break;
+//		}
+//		else
+//		{
+//			SendData[0] =  battCellTemp[SendCounter*8 + 0];
+//			SendData[1] =  battCellTemp[SendCounter*8 + 1];
+//			SendData[2] =  battCellTemp[SendCounter*8 + 2];
+//			SendData[3] =  battCellTemp[SendCounter*8 + 3];
+//			SendData[4] =  battCellTemp[SendCounter*8 + 4];
+//			SendData[5] =  battCellTemp[SendCounter*8 + 5];
+//			SendData[6] =  battCellTemp[SendCounter*8 + 6];
+//			SendData[7] =  battCellTemp[SendCounter*8 + 7];
+//		}
+//		break;
+//	}
+//	case 0x05:
+//	{
+//		CanAnsId = 0x1CA0EAED + (SendCounter<<16);
+//		if((SendCounter*4 + 3)>BMS_CELLNUM)
+//		{
+//			SendCounter = 0;
+//			SendStep++;
+//			break;
+//		}
+//		else
+//		{
+//			SendData[0] =  battCellU[SendCounter*4 + 0]>>8;
+//			SendData[1] =  battCellU[SendCounter*4 + 0];
+//			SendData[2] =  battCellU[SendCounter*4 + 1]>>8;
+//			SendData[3] =  battCellU[SendCounter*4 + 1];
+//			SendData[4] =  battCellU[SendCounter*4 + 2]>>8;
+//			SendData[5] =  battCellU[SendCounter*4 + 2];
+//			SendData[6] =  battCellU[SendCounter*4 + 3]>>8;
+//			SendData[7] =  battCellU[SendCounter*4 + 3];
+//		}
+//		break;
+//	}
+//	default:
+//	{
+//		SendStep = 0;
+//		BattSendFlg = 0;
+//		return;
+//		break;
+//	}
+//	}
+//	CanTxMsg.id = CanAnsId;
+//	CanTxMsg.idFrame = CAN_EXTENDED_ID_TYPE;
+//	CanTxMsg.sdu = SendData;
+//	CanTxMsg.length = 8;
+//	CanIf_SendMessage(CAN1, CanTxMsg);
+}
+
+void BcuRxDiagnose(void) // 100ms调用一次
+{
+
+	static UINT32 TimeCounter = 0;	// ms
+	TimeCounter = TimeCounter + 10; //
+	for (UINT8 i = 0; i < sizeof(BcuInTable) / 4; i++)
 	{
-		SendStep++;
-		break;
+		if (BcuRxFlag[i] == 1) // received msg, and clear the error conter
+		{
+			BcuRxErrorCounter[i] = 0;
+			BcuRxFlag[i] = 0;
+			continue;
+		}
+		if (BcuRxErrorCounter[i] < 3)
+		{
+			BcuRxShortError[i] = 0;
+			BcuRxLongError[i] = 0;
+		}
+		else if (BcuRxErrorCounter[i] >= 3 && BcuRxErrorCounter[i] < 13)
+		{
+			BcuRxShortError[i] = 1;
+			BcuRxLongError[i] = 0;
+		}
+		else if (BcuRxErrorCounter[i] >= 13)
+		{
+			BcuRxShortError[i] = 0;
+			BcuRxLongError[i] = 1;
+			BcuRxMsgSetInvalidValue(BcuInTable[i]);
+			BcuRxErrorCounter[i] = 0;
+		}
+		else if (BcuRxErrorCounter[i] == 0xFF)
+		{
+			BcuRxErrorCounter[i] = 0xFE;
+		}
 	}
-	case 0x01:
+	if (TimeCounter % 100 == 0) // period <=100ms
 	{
-		CanAnsId = 0x1C01EAED;
-		SendData[0] =  battHeatState;
-		SendData[1] =  battFanState;
-		SendData[2] =  battRelayState;
-		SendData[3] =  battConverState;
-		SendStep++;
-		break;
+		BcuRxErrorCounter[0]++; // can msg 0x1801D0F3
+		// if(BcuRxErrorCounter[0]>=13)
+		BcuRxErrorCounter[2]++; // can msg 0x1880D0F3
+		// if(BcuRxErrorCounter[2]>=13)
+		BcuRxErrorCounter[3]++; // can msg 0x1881D0F3
+		// if(BcuRxErrorCounter[3]>=13)
+		BcuRxErrorCounter[4]++; // can msg 0x1882D0F3
+		// if(BcuRxErrorCounter[4]>=13)
+		BcuRxErrorCounter[5]++; // can msg 0x1883D0F3
+		// if(BcuRxErrorCounter[5]>=13)
+		BcuRxErrorCounter[6]++; // can msg 0x1884D0F3
+		// if(BcuRxErrorCounter[6]>=13)
+		BcuRxErrorCounter[7]++; // can msg 0x1885D0F3
+		// if(BcuRxErrorCounter[7]>=13)
+		BcuRxErrorCounter[8]++; // can msg 0x1886D0F3
+		// if(BcuRxErrorCounter[8]>=13)
+		BcuRxErrorCounter[9]++; // can msg 0x1887D0F3
+		// if(BcuRxErrorCounter[9]>=13)
+		BcuRxErrorCounter[10]++; // can msg 0x1888D0F3
+		// if(BcuRxErrorCounter[10]>=13)
+		BcuRxErrorCounter[13]++; // can msg 0x18C1D0F3
+		// if(BcuRxErrorCounter[13]>=13)
+		BcuRxErrorCounter[14]++; // can msg 0x18C2D0F3
+		// if(BcuRxErrorCounter[14]>=13)
+		BcuRxErrorCounter[19]++; // can msg 0x18E5D0F3
+		// if(BcuRxErrorCounter[19]>=13)
+		BcuRxErrorCounter[20]++; // can msg 0x18E6D0F3
+								 // if(BcuRxErrorCounter[20]>=13)
 	}
-	case 0x02:
+	if (TimeCounter % 1000 == 0) // period ==1000ms
 	{
-		uint16 ErrorTemp ;
-		ErrorTemp = GetErrorNum(ErrorArray,sizeof(ErrorArray)/2);
-		CanAnsId = 0x1C09EAED;
-		SendData[0] =  battWorkState;
-		SendData[1] =  ErrorTemp>>8;
-		SendData[2] =  ErrorTemp;
-		SendData[3] =  0;
-		SendData[4] =  0;
-		SendData[5] =  0;
-		SendData[6] =  0;
-		SendData[7] =  0;
-		SendStep++;
-		break;
+		BcuRxErrorCounter[11]++; // can msg 0x1889D0F3
+		// if(BcuRxErrorCounter[11]>=13)
+		// printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[11]);
+		BcuRxErrorCounter[12]++; // can msg 0x188AD0F3
+		// if(BcuRxErrorCounter[12]>=13)
+		// printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[12]);
+		BcuRxErrorCounter[15]++; // can msg 0x18E1D0F3
+		// if(BcuRxErrorCounter[15]>=13)
+		// printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[15]);
+		BcuRxErrorCounter[16]++; // can msg 0x18E2D0F3
+		// if(BcuRxErrorCounter[16]>=13)
+		// printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[16]);
+		BcuRxErrorCounter[17]++; // can msg 0x18E3D0F3
+		// if(BcuRxErrorCounter[17]>=13)
+		// printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[17]);
+		BcuRxErrorCounter[18]++; // can msg 0x18E4D0F3
+		// if(BcuRxErrorCounter[18]>=13)
+		// printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[18]);
+		BcuRxErrorCounter[26]++; // can msg 0x18FF45F4
+		// if(BcuRxErrorCounter[26]>=13)
+		// printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[26]);
+		BcuRxErrorCounter[27]++; // can msg 0x18FFC13A
+								 // if(BcuRxErrorCounter[27]>=13)
+								 // printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[27]);
 	}
-	case 0x03:
+	if (TimeCounter % 30000 == 0) // period ==30000ms
 	{
-		CanAnsId = 0x1C0AEAED;
-		uint16 SocTemp = battSOC*10;
-		SendData[0] =  battI>>8;
-		SendData[1] =  battI;
-		SendData[2] =  battPackVol>>8;
-		SendData[3] =  battPackVol;
-		SendData[4] =  SocTemp>>8;
-		SendData[5] =  SocTemp;
-		SendData[6] =  battSOH;
-		SendData[7] =  battMOSSwitchState;
-		SendStep++;
-		break;
+		BcuRxErrorCounter[1]++; // can msg 0x1801D8F3
+								// if(BcuRxErrorCounter[1]>=13)
+								// printf("can msg 0x%x lost,cycle time30000ms\n",COMInTable[1]);
 	}
-	case 0x04:
+}
+void BcuRxMsgSetInvalidValue(uint32 ID)
+{
+
+	switch (ID)
 	{
-		CanAnsId = 0x1C10EAED + (SendCounter<<16);
-		if((SendCounter*8 + 7)>BMS_TEMPNUM)
-		{
-			SendCounter = 0;
-			SendStep++;
-			break;
-		}
-		else
-		{
-			SendData[0] =  battCellTemp[SendCounter*8 + 0];
-			SendData[1] =  battCellTemp[SendCounter*8 + 1];
-			SendData[2] =  battCellTemp[SendCounter*8 + 2];
-			SendData[3] =  battCellTemp[SendCounter*8 + 3];
-			SendData[4] =  battCellTemp[SendCounter*8 + 4];
-			SendData[5] =  battCellTemp[SendCounter*8 + 5];
-			SendData[6] =  battCellTemp[SendCounter*8 + 6];
-			SendData[7] =  battCellTemp[SendCounter*8 + 7];
-		}
+	case 0x1801D0F3:
+		BMS_ReqVIN = 0xFF;
+		BMS_ReqHVOff = 0xFF;
 		break;
-	}
-	case 0x05:
-	{
-		CanAnsId = 0x1CA0EAED + (SendCounter<<16);
-		if((SendCounter*4 + 3)>BMS_CELLNUM)
+	case 0x1801D8F3:
+		BMS_SoftwareVersion = 0xFFFF;
+		BMS_HardwareVersion = 0xFFFF;
+		BMS_ProtocolEditionH = 0xFF;
+		BMS_ProtocolEditionL = 0xFF;
+		break;
+	case 0x1880D0F3:
+		BMS_CharDevNum = 0xFF;
+		BMS_FtPosRly = 0xFF;
+		BMS_FtNegRly = 0xFF;
+		BMS_FtPosCharRly1 = 0xFF;
+		BMS_FtNegCharRly1 = 0xFF;
+		BMS_FtPosCharRly2 = 0xFF;
+		BMS_FtNegCharRly2 = 0xFF;
+		BMS_FtHeatRly1 = 0xFF;
+		BMS_FtHeatRly2 = 0xFF;
+		BMS_StPosRly = 0xFF;
+		BMS_StNegRly = 0xFF;
+		BMS_StPreCharRly = 0xFF;
+		BMS_StPosCharRly1 = 0xFF;
+		BMS_StNegCharRly1 = 0xFF;
+		BMS_StPosCharRly2 = 0xFF;
+		BMS_StNegCharRly2 = 0xFF;
+		BMS_FtAuxRelayWeld = 0xFF;
+		BMS_BraOpenCirc = 0xFF;
+		BMS_FtBackCharCurrOutLim = 0xFF;
+		BMS_FtPosRlyOpen = 0xFF;
+		BMS_FtNegRlyOpen = 0xFF;
+		BMS_FtPosCharRly1Open = 0xFF;
+		BMS_FtPosCharRly2Open = 0xFF;
+		BMS_FtNegCharRly1Open = 0xFF;
+		BMS_FtNegCharRly2Open = 0xFF;
+		BMS_FtTMSContClose = 0xFF;
+		BMS_FtTMSContOpen = 0xFF;
+		BMS_FtTMS = 0xFF;
+		BMS_Ft24VSpy = 0xFF;
+		BMS_FtPACKSelfProt = 0xFF;
+		BMS_FtCharSockTempOver = 0xFF;
+		BMS_FtTempOutCtrl = 0xFF;
+		BMS_StPosHeatRly = 0xFF;
+		BMS_StNegHeatRly = 0xFF;
+		BMS_CharSysNum = 0xFF;
+		BMS_FtCode = 0xFF;
+		break;
+	case 0x1881D0F3:
+		BMS_ST1CheckSum = 0xFF;
+		BMS_ST1Counter = 0xFF;
+		BMS_Mode = 0xFF;
+		BMS_AuxRlySt = 0xFF;
+		BMS_BattBalaSt = 0xFF;
+		BMS_CharGunSt = 0xFF;
+		BMS_CharMode = 0xFF;
+		BMS_CharSt = 0xFF;
+		BMS_FtLvl = 0xFF;
+		BMS_FtCellTempDiff = 0xFF;
+		BMS_FtCellTempHigh = 0xFF;
+		BMS_FtPACKOverVolt = 0xFF;
+		BMS_FtPACKUndeVolt = 0xFF;
+		BMS_FtSOCLow = 0xFF;
+		BMS_FtCellOverVolt = 0xFF;
+		BMS_FtCellUndeVolt = 0xFF;
+		BMS_FtIns = 0xFF;
+		BMS_FtCellOverVoltDiff = 0xFF;
+		BMS_FtCharCurrOver = 0xFF;
+		BMS_FtDisCharCurrOver = 0xFF;
+		BMS_FtCellTempLow = 0xFF;
+		BMS_FtBranVoltDifOver = 0xFF;
+		BMS_FtBMSHardWare = 0xFF;
+		BMS_FtSOCHigh = 0xFF;
+		BMS_FtSOCJump = 0xFF;
+		BMS_FtInCom = 0xFF;
+		BMS_FtSysMism = 0xFF;
+		BMS_FtHvIntLock = 0xFF;
+		BMS_FtSmoke = 0xFF;
+		BMS_FtFire = 0xFF;
+		BMS_FtNum = 0xFF;
+		break;
+	case 0x1882D0F3:
+		BMS_PackSOC = 0xFF;
+		BMS_PackSOH = 0xFF;
+		BMS_PackCurr = 0xFFFF;
+		BMS_MaxCharCurr = 0xFFFF;
+		BMS_MaxDisCharCurr = 0xFFFF;
+		break;
+	case 0x1883D0F3:
+		BMS_PosIns = 0xFFFF;
+		BMS_NegIns = 0xFFFF;
+		BMS_BattVolt = 0xFFFF;
+		BMS_LinkVolt = 0xFFFF;
+		break;
+	case 0x1884D0F3:
+		BMS_MaxCellTemp = 0xFF;
+		BMS_MinCellTemp = 0xFF;
+		BMS_AverCellTemp = 0xFF;
+		BMS_MaxCellTempCSC = 0xFF;
+		BMS_MaxCellTempNum = 0xFF;
+		BMS_MinCellTempCSC = 0xFF;
+		BMS_MinCellTempNum = 0xFF;
+		break;
+	case 0x1885D0F3:
+		BMS_MaxCellVolt = 0xFFFF;
+		BMS_MaxCellVoltCSC = 0xFF;
+		BMS_MaxCellVoltNum = 0xFF;
+		BMS_AverCellVolt = 0xFFFF;
+		break;
+	case 0x1886D0F3:
+		BMS_MinCellVolt = 0xFFFF;
+		BMS_MinCellVoltCSC = 0xFF;
+		BMS_MinCellVoltNum = 0xFF;
+		BMS_ContChrgCurr = 0xFFFF;
+		BMS_ContDisCharCurr = 0xFFFF;
+		break;
+	case 0x1887D0F3:
+		BMS_CharReqVolt = 0xFFFF;
+		BMS_CharReqCurr = 0xFFFF;
+		BMS_SysInsRes = 0xFFFF;
+		BMS_InsDeteSt = 0xFF;
+		BMS_FtCharInsLow = 0xFF;
+		BMS_FtCurrSenr = 0xFF;
+		BMS_FtHeatingFilm = 0xFF;
+		BMS_FtMainLoopPreChar = 0xFF;
+		BMS_FtAuxLoopPreChar = 0xFF;
+		BMS_FtACANLost = 0xFF;
+		BMS_FtDCDC = 0xFF;
+		BMS_FtSOCDif = 0xFF;
+		BMS_FtCellOverDisChar = 0xFF;
+		BMS_FtCharOver = 0xFF;
+		BMS_FtContDisCharCurrOverLoad = 0xFF;
+		BMS_FtContCharCurrOverLoad = 0xFF;
+		break;
+	case 0x1888D0F3:
+		BMS_MaxDisCharPwr = 0xFFFF;
+		BMS_MaxCharPwr = 0xFFFF;
+		BMS_ContDisCharPwr = 0xFFFF;
+		BMS_ContCharPwr = 0xFFFF;
+		break;
+	case 0x1889D0F3:
+		BMS_InstEngyCons = 0xFFFF;
+		BMS_TotalEngyCons = 0xFFFF;
+		BMS_SOE = 0xFFFF;
+		BMS_RmanCharTime = 0xFFFF;
+		break;
+	case 0x188AD0F3:
+		BMS_Gun1DCNegTemp = 0xFF;
+		BMS_Gun1DCPosTemp = 0xFF;
+		BMS_Gun2DCNegTemp = 0xFF;
+		BMS_Gun2DCPosTemp = 0xFF;
+		BMS_CurrHeatSt = 0xFF;
+		BMS_CurrCoolSt = 0xFF;
+		BMS_FtCharCnct = 0xFF;
+		BMS_FtOverDisCharCurrDuringChar = 0xFF;
+		BMS_FtCharNTC = 0xFF;
+		BMS_FtELock = 0xFF;
+		BMS_CharNum = 0xFFFF;
+		break;
+	case 0x18C1D0F3:
+		BMS_CellVoltFramNum = 0xFF;
+		for (UINT16 i = 0; i < sizeof(BMS_CellVolt) / 2; i++)
 		{
-			SendCounter = 0;
-			SendStep++;
-			break;
+			BMS_CellVolt[i] = 0xFFFF;
 		}
-		else
+		break;
+	case 0x18C2D0F3:
+		BMS_CellTempFramNum = 0xFF;
+		BMS_CSC_Code = 0xFF;
+		for (UINT8 i = 0; i < sizeof(BMS_CellTemp); i++)
 		{
-			SendData[0] =  battCellU[SendCounter*4 + 0]>>8;
-			SendData[1] =  battCellU[SendCounter*4 + 0];
-			SendData[2] =  battCellU[SendCounter*4 + 1]>>8;
-			SendData[3] =  battCellU[SendCounter*4 + 1];
-			SendData[4] =  battCellU[SendCounter*4 + 2]>>8;
-			SendData[5] =  battCellU[SendCounter*4 + 2];
-			SendData[6] =  battCellU[SendCounter*4 + 3]>>8;
-			SendData[7] =  battCellU[SendCounter*4 + 3];
+			BMS_CellTemp[i] = 0xFF;
 		}
 		break;
-	}
+	case 0x18E1D0F3:
+		BMS_Checksum = 0xFF;
+		BMS_PackComp = 0xFF;
+		BMS_BattCodeLeng = 0xFF;
+		BMS_SN[0] = 0xFF;
+		BMS_SN[1] = 0xFF;
+		BMS_SN[2] = 0xFF;
+		BMS_SN[3] = 0xFF;
+		BMS_SN[4] = 0xFF;
+		BMS_SN[5] = 0xFF;
+		break;
+	case 0x18E2D0F3:
+		BMS_Checksum = 0xFF;
+		BMS_SN[6] = 0xFF;
+		BMS_SN[7] = 0xFF;
+		BMS_SN[8] = 0xFF;
+		BMS_SN[9] = 0xFF;
+		BMS_SN[10] = 0xFF;
+		BMS_SN[11] = 0xFF;
+		BMS_SN[12] = 0xFF;
+		break;
+	case 0x18E3D0F3:
+		BMS_Checksum = 0xFF;
+		BMS_SN[13] = 0xFF;
+		BMS_SN[14] = 0xFF;
+		BMS_SN[15] = 0xFF;
+		BMS_SN[16] = 0xFF;
+		BMS_SN[17] = 0xFF;
+		BMS_SN[18] = 0xFF;
+		BMS_SN[19] = 0xFF;
+		break;
+	case 0x18E4D0F3:
+		BMS_Checksum = 0xFF;
+		BMS_SN[20] = 0xFF;
+		BMS_SN[21] = 0xFF;
+		BMS_SN[22] = 0xFF;
+		BMS_SN[23] = 0xFF;
+		BMS_SN[24] = 0xFF;
+		BMS_SN[25] = 0xFF;
+		BMS_SN[26] = 0xFF;
+		break;
+	case 0x18E5D0F3:
+		BMS_BattRateCap = 0xFFFF;
+		BMS_BattRateVolt = 0xFFFF;
+		BMS_BattRateEngy = 0xFFFF;
+		BMS_BattType = 0xFF;
+		BMS_CoolType = 0xFF;
+		break;
+	case 0x18E6D0F3:
+		BMS_CSC_Total = 0xFF;
+		BMS_CellTotal = BMS_CELL_MAX_NUM;
+		BMS_TempTotal = BMS_TEMP_MAX_NUM;
+		BMS_CellVoltLevel = 0xFF;
+		BMS_CellMinVolt = 0xFF;
+		BMS_CellMaxVolt = 0xFF;
+		break;
+	case 0x18F1D0F3:
+		BMS_TotalCharEngy = 0xFFFFFFFF;
+		BMS_TotalDisCharEngy = 0xFFFFFFFF;
+		BMS_SingleCharEngy = 0xFFFF;
+		break;
+	case 0x18F2D0F3:
+		BMS_TotalBackCharEngy = 0xFFFFFFFF;
+		BMS_TotalStaCharEngy = 0xFFFFFFFF;
+		break;
+	case 0x18F3D0F3:
+		BMS_TotalGunCharEngy = 0xFFFFFFFF;
+		BMS_TotalGunCharCapy = 0xFFFFFFFF;
+		break;
+	case 0x18F4D0F3:
+		BMS_TotalCharCapy = 0xFFFFFFFF;
+		BMS_TotalDisCharCapy = 0xFFFFFFFF;
+		BMS_SingleCharCapy = 0xFFFF;
+		break;
+	case 0x18F5D0F3:
+		BMS_TotalBackCharCapy = 0xFFFFFFFF;
+		BMS_TotalStaCharCapy = 0xFFFFFFFF;
+		BMS_HVBranNum = 0xFF;
+		BMS_SingleHVBranchCellNum = 0xFF;
+		break;
+	case 0x18FF45F4:
+		BMS_ReqMode = 0xFF;
+		BMS_HVCmd = 0xFF;
+		BMS_ChgSts = 0xFF;
+		BMS_HVRelaySts = 0xFF;
+		BMS_HVVolt = 0xFFFF;
+		BMS_SetTemp = 0xFF;
+		BMS_Life = 0xFF;
+		BMS_CRC = 0xFF;
+		break;
+	case 0x18FFC13A:
+		TMS_WorkStatus = 0xFF;
+		TMS_HVRelayST = 0xFF;
+		TMS_OutletTemp = 0xFF;
+		TMS_InletTemp = 0xFF;
+		TMS_ReqPow = 0xFFFF;
+		TMS_ErrCode = 0xFF;
+		TMS_FaultLevel = 0xFF;
+		break;
 	default:
-	{
-		SendStep = 0;
-		BattSendFlg = 0;
 		break;
 	}
-	}
-	CanTxMsg.id = CanAnsId;
-	CanTxMsg.idFrame = CAN_EXTENDED_ID_TYPE;
-	CanTxMsg.sdu = SendData;
-	CanTxMsg.length = 8;
-	CanIf_SendMessage(CAN1, CanTxMsg);
 }
+#endif

+ 2 - 0
code/app/AppTaskCan.h

@@ -17,5 +17,7 @@
 #include "Hal_Wdg.h"
 #include "AppTaskGps.h"
 void BcuDecodeFunction(uint32 ID, uint8 *rawData);
+void BcuRxDiagnose(void);
+void BcuRxMsgSetInvalidValue(uint32 ID);
 void CanTask(void *pvParameters);
 #endif /* APPTASKCAN_H_ */

+ 1 - 1
code/app/AppTaskGps.c

@@ -103,7 +103,7 @@ void GpsDataDecode(uint8 *msg)
 //		GpsInfoData.AccMileage[3] = AppDataInfo.AccMileage;
 	}
 	p2 = strtok(p2, ","); //只取第2行的信息GGA
-	memset(databuffer, 0x00, 20);
+	memset(databuffer, 0x30, 20);
 	if (strcmp(p2, "$GNGGA") == 0)
 	{
 		index = 0;

+ 62 - 20
code/app/AppTaskMain.c

@@ -1,16 +1,14 @@
 /*
- * @Author: chenjie
- * @Date: 2022-06-06
- * @LastEditTime: 2022-10-27
- * @LastEditors: chenjie
- * @Description: 
- * @FilePath: \S32K146_4G\code\app\AppTaskMain.c
- * Copyright (c) 2022 by chenjie, All Rights Reserved.
+ * AppTaskMain.c
+ *
+ *  Created on: 2022年2月22日
+ *      Author: QiXiang_CHENJIE
  */
 
 #include "AppTaskMain.h"
 #include "hal_fls.h"
 static void vTimerCallback(TimerHandle_t pxTimer);
+extern uint32 timerCANIdle;
 void MainTask(void *pvParameters)
 {
 	(void)pvParameters;
@@ -20,6 +18,9 @@ void MainTask(void *pvParameters)
 	TimerHandle_t monitorTimer1ms;
 	monitorTimer1ms = xTimerCreate("monitor1ms",1,pdTRUE,(void *)0,vTimer1msCallback);
 	xTimerStart(monitorTimer1ms,0);
+
+	sleep_mutex = xSemaphoreCreateBinary();
+
 	uint32 *eppromAddStart = 0x14000000;
 	if(*(uint8 *)(eppromAddStart)==0xff)
 	{
@@ -36,29 +37,70 @@ void MainTask(void *pvParameters)
 				WATCHDOG_HAL_Feed();
 			}
 		}
-		if(TimerCounter%1000==0)
-		{
-			if(AppConfigInfo.eolFlg==true)
-			{
-				Dio_FlipChannel(DioConf_DioChannel_PTE9_GPIO_OUT_MCU_LED5);
-			}
-			else
-			{
-				Dio_WriteChannel(DioConf_DioChannel_PTE9_GPIO_OUT_MCU_LED5, STD_ON);
-			}
-		}
 		if(AppConfigInfo.appSaveFlg)
 		{
 			AppConfigInfo.appSaveFlg = false;
 			HAL_EEP_Write(0,(uint8 *)&AppConfigInfo,sizeof(AppConfigInfo));
 		}
-		if(Fota_update_flag || Fota_error_flag)//鍗囩骇鎸囦护鍙戝嚭锛岃繘琛岄噸鍚�,鎴栬€匜TP鏈嶅姟鍣ㄥ嚭鐜伴棶棰橈紝杩涜�閲嶅惎
+		if(Fota_update_flag || Fota_error_flag)
 		{
-			//閲嶅惎鍓嶄繚瀛樻暟鎹�
+			//重启前保存数据
 			AppConfigInfo.appSaveFlg = false;
 			HAL_EEP_Write(0,(uint8 *)&AppConfigInfo,sizeof(AppConfigInfo));
 			SystemSoftwareReset();
 		}
+
+		if(pdTRUE == xSemaphoreTake(sleep_mutex,1))
+		{
+    		vTaskSuspend(Uart_Hal_RecvTask_Handle);
+    		vTaskSuspend(Uart_Hal_SendTask_Handle);
+    		vTaskSuspend(CanTask_Handle);
+    		vTaskSuspend(GpsTask_Handle);
+    		vTaskSuspend(Uart_4G_Task_Handle);
+
+			SystemPeripheralDeinit();
+			SystemPrepareForSleep();
+
+
+
+			coreInit();
+			SystemModulesInit();
+
+			/* Initialize all pins*/
+			#if (PORT_PRECOMPILE_SUPPORT == STD_ON)
+				Port_Init(NULL_PTR);
+			#elif (PORT_PRECOMPILE_SUPPORT == STD_OFF)
+				Port_Init(&Port_Config_VS_0);
+			#endif
+			vTaskDelay(pdMS_TO_TICKS(100));
+
+//			vTaskDelay(pdMS_TO_TICKS(100));
+		//					currentMode = Mcu_GetPowerModeState();
+			Dio_WriteChannel(DioConf_DioChannel_PTE9_GPIO_OUT_MCU_LED5, STD_OFF);
+
+//			vTaskDelay(pdMS_TO_TICKS(500));
+//			Icu_DeInit();
+			//4G module power on
+//			vTaskDelay(pdMS_TO_TICKS(1000));
+
+			timerCANIdle = 0;
+			Dio_WriteChannel(DioConf_DioChannel_PTA6_GPIO_OUT_MCU_4G_POW_EN, STD_ON);
+			vTaskDelay(pdMS_TO_TICKS(1000));
+			Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_ON);
+			vTaskDelay(pdMS_TO_TICKS(500));
+			Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_OFF);
+
+			//GPS module power on
+			Dio_WriteChannel(DioConf_DioChannel_PTD1_GPIO_OUT_MCU_GPS_POW_EN, STD_ON);
+//			vTaskDelay(pdMS_TO_TICKS(1000));
+
+			vTaskResume(Uart_Hal_RecvTask_Handle);
+			vTaskResume(Uart_Hal_SendTask_Handle);
+			vTaskResume(CanTask_Handle);
+			vTaskResume(GpsTask_Handle);
+			vTaskResume(Uart_4G_Task_Handle);
+
+		}
 	}
 }
 static void vTimerCallback(TimerHandle_t pxTimer)

+ 4 - 246
code/app/AppTaskUart0.c

@@ -1,250 +1,8 @@
 /*
- * @Author: chenjie
- * @Date: 2022-06-06
- * @LastEditTime: 2022-10-27
- * @LastEditors: chenjie
- * @Description: 
- * @FilePath: \S32K146_4G\code\app\AppTaskUart0.c
- * Copyright (c) 2022 by chenjie, All Rights Reserved.
+ * AppTaskUart0.c
+ *
+ *  Created on: 2022222
+ *      Author: QiXiang_CHENJIE
  */
 #include "AppTaskUart0.h"
-#ifdef APP_UART0_ENABLE
-static process_Uart0 gProcess_Uart0_Task = PROCESS_UART_STATE_IDLE;
-#define PROC_UART0_STATE_SWITCH(a) (gProcess_Uart0_Task = a)
-bool bmsCellInfoDecode(uint8 *dataPtr);
-bool bmsTempInfoDecode(uint8 *dataPtr);
-bool bmsOtherInfoDecode(uint8 *dataPtr);
-void UartBusReadDataFunc(uint16 RegAddrBegin, uint16 Reg_Num, bool (*decodeFunc)(uint8 *dataPtr));
-// void battDataCalFunc(void);
-static uint16 UartNoDataReadCounter = 0;
-void Uart0Task(void *pvParameters)
-{
-	(void)pvParameters;
-	UartAnsType UartAnsData;
-	uint16 pReadLen = 0;
-	static uint8 writecounter = 0;
-	while (1)
-	{
-		switch (gProcess_Uart0_Task)
-		{
-		case PROCESS_UART_STATE_IDLE:
-		{
-			vTaskDelay(pdMS_TO_TICKS(10));
-			if ((TimerCounter % 1000) == 0 && 1)
-			{
-				PROC_UART0_STATE_SWITCH(PROCESS_UART_STATE_READ);
-			}
-			else if (TimerCounter % 100 == 0)
-			{
-				PROC_UART0_STATE_SWITCH(PROCESS_UART_STATE_WRITE);
-			}
-			break;
-		}
-		case PROCESS_UART_STATE_READ:
-		{
-			/*01 04 00 01 00 38 A0 18
-			01 04 00 64 00 78 B1 F7
-			01 04 01 90 00 28 F1 C5 */
-			Dio_FlipChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2);
-			//其他参数读取
-			UartBusReadDataFunc(0x01, 0x38, bmsOtherInfoDecode);
-			//电压读取
-			UartBusReadDataFunc(0x64, 120, bmsCellInfoDecode);
-			//温度读取
-			UartBusReadDataFunc(0x190, 40, bmsTempInfoDecode);
-			//没有读到数据时的默认值
-			if (UartNoDataReadCounter > 10)
-			{
-				memset((uint8 *)&UartAnsData, 0x00, sizeof(UartAnsData));
-				bmsCellInfoDecode(UartAnsData.Data);
-				bmsTempInfoDecode(UartAnsData.Data);
-				bmsOtherInfoDecode(UartAnsData.Data);
-				PutErrorNum(ErrorArray, sizeof(ErrorArray) / 2, 1);
-				vTaskDelay(pdMS_TO_TICKS(2000));
-			}
-			PROC_UART0_STATE_SWITCH(PROCESS_UART_STATE_IDLE);
-			break;
-		}
-		case PROCESS_UART_STATE_WRITE:
-		{
-			if (battSeparateEnable) //最多重新写5次
-			{
-				uint16 RegAddress = 0;
-				uint16 CRC_chk_buffer = 0;
-				uint8 WriteData[2] = {0x00, 0x00};
-				uint8 UartRecvBuffer[10];
-				if (!battSeparateCtlState)
-				{
-					WriteData[1] = 0x55;
-				}
-				else
-				{
-					WriteData[1] = 0xAA;
-				}
-				RegAddress = 100;
-				UartWriteMsgType Uart_Write_Msg;
-				Uart_Write_Msg.Bms_Address = BMS_ADDRESS_CODE;
-				Uart_Write_Msg.Bms_Funcode = UART_WRITE_CODE;
-				Uart_Write_Msg.Reg_Begin_H = RegAddress >> 8;
-				Uart_Write_Msg.Reg_Begin_L = RegAddress;
-				Uart_Write_Msg.Reg_Num_H = 0x00;
-				Uart_Write_Msg.Reg_Num_L = 0x01;
-				Uart_Write_Msg.Data_Count = 0x02; //要写入的字节数
-				memcpy(Uart_Write_Msg.Data, WriteData, 2);
-				CRC_chk_buffer = crc_chk((uint8 *)&Uart_Write_Msg, sizeof(Uart_Write_Msg) - 2);
-				Uart_Write_Msg.CRC_L = CRC_chk_buffer;
-				Uart_Write_Msg.CRC_H = CRC_chk_buffer >> 8;
-				UART_Query_Data(UART_LPUART0, UART_LPUART0, (uint8 *)&Uart_Write_Msg, sizeof(Uart_Write_Msg), UartRecvBuffer, &pReadLen, 500);
-				if (pReadLen > 3 && *(UartRecvBuffer + 1) == 0x10)
-				{
-					writecounter = 0;
-					battSeparateEnable = 0;
-				}
-				else
-				{
-					writecounter++;
-				}
-			}
-			if (writecounter >= 5)
-			{
-				battSeparateEnable = 0;
-				writecounter = 0;
-			}
-			PROC_UART0_STATE_SWITCH(PROCESS_UART_STATE_IDLE);
-			break;
-		}
-		case PROCESS_UART_STATE_SLEEP:
-		{
-			break;
-		}
-		default:
-			break;
-		}
-	}
-}
-bool bmsCellInfoDecode(uint8 *dataPtr) //电压数据解码
-{
-	for (uint8 i = 0; i < BMS_CELLNUM; i++)
-	{
-		battCellU[i] = ((dataPtr[(0x00 + i) * 2] << 8) | dataPtr[(0x00 + i) * 2 + 1]);
-	}
-	return true;
-}
-bool bmsTempInfoDecode(uint8 *dataPtr) //温度数据解码
-{
-	for (uint8 i = 0; i < BMS_TEMPNUM; i++)
-	{
-		battCellTemp[i] = dataPtr[(0x00 + i) * 2 + 1];
-	}
-	return true;
-}
-bool bmsOtherInfoDecode(uint8 *dataPtr) //其他数据解析
-{
-	uint16 Batt_current;
-	battPackVol = (dataPtr[(0x00) * 2]) << 8 | (dataPtr[(0x00) * 2 + 1]);
-	Batt_current = (dataPtr[(0x01) * 2] << 8) | (dataPtr[(0x01) * 2 + 1]);
-	if(battPackVol==0)
-	{
-		Batt_current=16000;
-	}
-	battI = Batt_current - 6000; //电流偏移量不同
-	battSOC = dataPtr[(0x02) * 2 + 1];
-	battSOH = dataPtr[(0x03) * 2 + 1];
-	battWorkState = (dataPtr[(0x06) * 2 + 1]) & 0x03; //电池状态(原始数据),3表示开路,2表示放电,1表示充电
-	switch (battWorkState)							  //电池状态(上传数据),0表示开路,1表示放电,2表示充电
-	{
-	case 0:
-		battWorkState = 0;
-		break;
-	case 1:
-		battWorkState = 2;
-		break;
-	case 2:
-		battWorkState = 1;
-		break;
-	case 3:
-		battWorkState = 0;
-		break;
-	default:
-		break;
-	}
-	maxCellVol = (dataPtr[(0x13) * 2] << 8) | dataPtr[(0x13) * 2 + 1];
-	minCellVol = (dataPtr[(0x16) * 2] << 8) | dataPtr[(0x16) * 2 + 1];
-	AppConfigInfo.AppDataInfo.battDischrgAccEnrg = (dataPtr[(0x34) * 2] << 8) | dataPtr[(0x34) * 2 + 1];
-	AppConfigInfo.AppDataInfo.battCycleTimes = AppConfigInfo.AppDataInfo.battDischrgAccEnrg / 49000;
-	return true;
-}
-void UartBusReadDataFunc(uint16 RegAddrBegin, uint16 Reg_Num, bool (*decodeFunc)(uint8 *dataPtr))
-{
-	// argv In
-	UartQueryType Uart0AskMsg;
-	uint16 ReadLen1 = 0;
-	uint16 ReadLenTar = 0;
-	uint8 ReadDelayCounter = 0;
-	uint16 CRC_chk_buffer = 0;
-	uint16 pReadLen;
-	UartAnsType UartAnsData;
-	uint8 UartDataRecv[256];
-	pReadLen = 0;
-	Uart0AskMsg.Bms_Address = BMS_ADDRESS_CODE;
-	Uart0AskMsg.Bms_Funcode = UART_READ_CODE;
-	Uart0AskMsg.Reg_Begin_H = RegAddrBegin >> 8;
-	Uart0AskMsg.Reg_Begin_L = RegAddrBegin;
-	Uart0AskMsg.Reg_Num_H = Reg_Num >> 8;
-	Uart0AskMsg.Reg_Num_L = Reg_Num;
-	CRC_chk_buffer = crc_chk((uint8 *)&Uart0AskMsg, 6);
-	Uart0AskMsg.CRC_L = CRC_chk_buffer;
-	Uart0AskMsg.CRC_H = CRC_chk_buffer >> 8;
-	UART_Send_Data(UART_LPUART0, (uint8 *)&Uart0AskMsg, sizeof(Uart0AskMsg), 1000);
-	ReadLenTar = (Reg_Num)*2 + 5;
-	memset((uint8 *)&UartAnsData, 0x00, sizeof(UartAnsData));
-	while (1)
-	{
-		UART_Receive_Data(UART_LPUART0, UartDataRecv, &pReadLen, 100);
-		if (pReadLen > 2)
-		{
-			memcpy((uint8 *)&UartAnsData + ReadLen1, UartDataRecv, pReadLen);
-			ReadLen1 = ReadLen1 + pReadLen;
-		}
-		else
-		{
-			ReadDelayCounter++;
-		}
-		if (ReadLen1 >= ReadLenTar)
-		{
-			ReadDelayCounter = 0;
-			pReadLen = ReadLen1;
-			ReadLen1 = 0;
-			break;
-		}
-		if (ReadDelayCounter >= 20)
-		{
-			ReadDelayCounter = 0;
-			pReadLen = 0;
-			ReadLen1 = 0;
-			break;
-		}
-	}
-	if (pReadLen > 0)
-	{
-		uint16 CrcChkGet = 0xffff;
-		uint16 CrcChkCal = 0x0000;
-		CrcChkCal = crc_chk((uint8 *)&UartAnsData, pReadLen - 2);
-		CrcChkGet = ((uint16)(UartAnsData.Data[pReadLen - 1 - 3]) << 8) | ((uint16)(UartAnsData.Data[pReadLen - 2 - 3]));
-		if (CrcChkCal == CrcChkGet)
-		{
-			decodeFunc(UartAnsData.Data);
-			UartNoDataReadCounter = 0;
-		}
-		else
-		{
-			UartNoDataReadCounter++;
-		}
-	}
-	else
-	{
-		UartNoDataReadCounter++;
-	}
-}
 
-#endif

Разница между файлами не показана из-за своего большого размера
+ 333 - 327
code/app/AppTaskUart1.c


+ 19 - 14
code/app/AppTaskUart1.h

@@ -1,13 +1,18 @@
-/*** 
- * @Author: chenjie
- * @Date: 2022-06-06
- * @LastEditTime: 2022-10-27
- * @LastEditors: chenjie
- * @Description: 
- * @FilePath: \S32K146_4G\code\app\AppTaskUart1.h
- * @Copyright (c) 2022 by chenjie, All Rights Reserved.
+/*
+ * @Author       : ChenJie
+ * @Date         : 2022-02-10 11:44:08
+ * @Version      : V3.0
+ * @LastEditors  : ChenJie
+ * @LastEditTime : 2022-05-17 16:22:56
+ * @Description  : file content
+ * @FilePath     : \S32K146_4G\src\AppTaskUart1.h
+ */
+/*
+ * AppTaskUart2.h
+ *4G的串口函数
+ *  Created on: 2022年2月10日
+ *      Author: QiXiang_CHENJIE
  */
-
 
 #ifndef APPTASKUART1_H_
 #define APPTASKUART1_H_
@@ -19,8 +24,8 @@
 #define BATT_SN_LEN 17
 #define TCP_START_SYM1 0x23
 #define TCP_START_SYM2 0x23
-#define TCP_CMD_SYM 0x02   //瀹炴椂淇℃伅涓婃姤鏄�0x02
-#define TCP_HEART_SYM 0x07 //蹇冭烦鍖呮爣蹇�
+#define TCP_CMD_SYM 0x02   //实时信息上报是0x02
+#define TCP_HEART_SYM 0x07 //心跳包标志
 #define TCP_ANS_SYM 0xFE
 #define TCP_ENCPT_ENABLE 0x00
 #define TCP_ENCPT_DISABLE 0x01
@@ -186,9 +191,9 @@ typedef sint8 (*pFunc)(char *PSendStr, char *pReadStr, uint8 CmdIdx, uint16 pRea
 sint8 at_callbackFunc(char *PSendStr, char *pReadStr, uint8 CmdIdx, uint16 pReadLen);
 typedef struct
 {
-	ATCmd cmd; /*鎸囦护搴忓彿*/
-	char *str; /*鎸囦护鍐呭�*/
-	pFunc cb;  /*瀵瑰簲鐨勬墽琛�*/
+	ATCmd cmd; /*指令序号*/
+	char *str; /*指令内容*/
+	pFunc cb;  /*对应的执行*/
 } ATCmdFunc;
 typedef enum
 {

+ 1 - 1
code/app/UDSTask.h

@@ -1,7 +1,7 @@
 /*
  * UDSTask.h
  *
- *  Created on: 2022Äê3ÔÂ14ÈÕ
+ *  Created on: 2022Äê3ÔÂ14ÈÕ
  *      Author: Zhengchao
  */
 

+ 5 - 0
code/hal/Hal_Wdg.c

@@ -19,6 +19,11 @@ void WdgInit(void)
 	Wdg_43_Instance0_SetTriggerCondition(5000);
 }
 
+void WdgDeInit(void)
+{
+	Wdg_43_Instance0_SetMode(WDGIF_OFF_MODE);
+}
+
 
 void Wdg_CallBackNotification1(void)
 {

+ 1 - 0
code/hal/Hal_Wdg.h

@@ -27,4 +27,5 @@ uint32 HAL_GetTimerTickCnt(void);
 void WATCHDOG_HAL_Feed(void);
 void DoResetECU(void);
 void WdgInit(void);
+void WdgDeInit(void);
 #endif /* HAL_WDG_H_ */

+ 208 - 18
code/hal/hal_adapter.c

@@ -1,13 +1,18 @@
 /*
  * hal_adapter.c
- *中间层函数调用库
- *  Created on: 2022年1月18日
+ *Öмä²ãº¯Êýµ÷Óÿâ
+ *  Created on: 2022Äê1ÔÂ18ÈÕ
  *      Author: QiXiang_CHENJIE
  */
 #include "hal_adapter.h"
 #include "AppGlobalVar.h"
 #include "stdio.h"
 #include "stdarg.h"
+
+/********************************/
+#include "Icu.h"
+#include "Gpt.h"
+
 uint8_t __attribute__((section(".non_cacheable_data"))) RX_Buffer[3][BUFFER_SIZE];
 uint32_t bufferIdx[3] = {0};
 volatile uint32 VarNotification_0 = 0;
@@ -26,6 +31,10 @@ uint32_t write_ringBuffer(uint8_t *buffer, uint32_t size, ringbuffer_t *ringBuf)
 uint32_t read_ringBuffer(uint8_t *buffer, uint32_t size, ringbuffer_t *ringBuf);
 uint8 ringBufferforUart[3][BUFFER_SIZE];
 ringbuffer_t uartRingBuffer[3];
+#if UARTPRINTF==1
+	uint8 ringbuffer[1024];
+	ringbuffer_t printfRingBuffer;
+#endif
 sint8 AtcmdDelayRecvFunc(uint8 recvChannel,char *ResultStrPtr,uint16 delayTime)
 {
 	sint8 outValue = -1;
@@ -52,7 +61,7 @@ sint8 AtcmdDelayRecvFunc(uint8 recvChannel,char *ResultStrPtr,uint16 delayTime)
 	}
 	return outValue;
 }
-#if 0
+#if UARTPRINTF==1
 	uint16 myPrintf(const char *fmt, ...)
 	{
 		int n;
@@ -104,6 +113,14 @@ uint32_t write_ringBuffer(uint8_t *buffer, uint32_t size, ringbuffer_t *ringBuf)
     memcpy(ringBuf_source + ringBuf_bw, buffer, size);
     ringBuf->bw = (ringBuf_bw + size) % ringBuf_len;
     ringBuf->btoRead += size;
+#if SEGGER_PRINTF==1
+    if(ringBuf->source==ringBufferforUart[1])
+    {
+    	//SEGGER_RTT_printf("[%d]buffer=%s\r\nringBuf->bw=%X,size=%X,%X\r\n",__LINE__,buffer,ringBuf->bw,size,ringBuf->bw-size+ringBuf_source);
+
+    	SEGGER_RTT_printf("[%d]buffer=%s\r\n\r\n",__LINE__,buffer);
+    }
+#endif
 /*
     if(ringBuf->br!=0)
     {
@@ -233,8 +250,8 @@ Std_ReturnType UART_Send_Data(uint8 transChannel, const uint8 *txBuffer, uint32
 	 UartSendQueue[2] = xQueueCreate(1, sizeof(UartMsg_t));
 	 UartHalQueueHandle = xQueueCreate(9, sizeof(UartHalMsg_t));
 
-	 xTaskCreate(Uart_Hal_RecvTask, (const char *const)"UartRecv", 256, (void *)0, main_TASK_PRIORITY + 5, NULL);
-	 xTaskCreate(Uart_Hal_SendTask, (const char *const)"UartSend", 256, (void *)0, main_TASK_PRIORITY + 4, NULL);
+	 xTaskCreate(Uart_Hal_RecvTask, (const char *const)"UartRecv", 256, (void *)0, main_TASK_PRIORITY + 5, &Uart_Hal_RecvTask_Handle);
+	 xTaskCreate(Uart_Hal_SendTask, (const char *const)"UartSend", 256, (void *)0, main_TASK_PRIORITY + 4, &Uart_Hal_SendTask_Handle);
  }
  Std_ReturnType UartStartRecvFunc(uint8 channel)
  {
@@ -279,7 +296,7 @@ Std_ReturnType UART_Send_Data(uint8 transChannel, const uint8 *txBuffer, uint32
 	 uint8 UartState[3] = {UartAbortRecv,UartAbortRecv,UartAbortRecv};
 	 while(1)
 	 {
-		 if((T_timeout[UartIdx]>1000) && (Uart_ReceiveStatus[UartIdx] != UART_STATUS_NO_ERROR) )//判定UART�止,超时�止,�是接收状�则�止
+		 if((T_timeout[UartIdx]>1000) && (Uart_ReceiveStatus[UartIdx] != UART_STATUS_NO_ERROR) )
 		 {
 			  Uart_Abort(UartIdx, UART_RECEIVE);
 			  UartState[UartIdx] = UartAbortRecv;
@@ -290,7 +307,7 @@ Std_ReturnType UART_Send_Data(uint8 transChannel, const uint8 *txBuffer, uint32
 			 UartState[UartIdx] = UartRecvComplete;
 		 }
 
-		 if((UartState[UartIdx] == UartAbortRecv) || (UartState[UartIdx] == UartRecvComplete)) //判定UART开始接收:UART�止�开始接收
+		 if((UartState[UartIdx] == UartAbortRecv) || (UartState[UartIdx] == UartRecvComplete))
 		 {
 			 if(E_OK == UartStartRecvFunc(UartIdx))
 			 {
@@ -299,7 +316,7 @@ Std_ReturnType UART_Send_Data(uint8 transChannel, const uint8 *txBuffer, uint32
 		 }
 		 Uart_ReceiveStatus[UartIdx] = Uart_GetStatus(UartIdx, &T_bytesRemaining[UartIdx], UART_RECEIVE);
 		 T_timeout[UartIdx]++;
-		 UartIdx = (UartIdx + 1) > 2 ? 0 : (UartIdx + 1);
+		 UartIdx = (UartIdx + 1) > 2 ? 1 : (UartIdx + 1);
 		 ret = xQueueReceive(UartHalQueueHandle,&UartHalMsgRecv,1);
 		  if(ret==pdTRUE)
 		  {
@@ -307,10 +324,19 @@ Std_ReturnType UART_Send_Data(uint8 transChannel, const uint8 *txBuffer, uint32
 			  {
 					if(UartHalMsgRecv.value>0)
 					{
+
+
+
 						recvSize = write_ringBuffer(RX_Buffer[UartHalMsgRecv.Channel],UartHalMsgRecv.value,&uartRingBuffer[UartHalMsgRecv.Channel]);
 						UartRecvMsg.DataLen = UartHalMsgRecv.value;
 						UartRecvMsg.dataAddr = (uint32)(uartRingBuffer[UartHalMsgRecv.Channel].bw + uartRingBuffer[UartHalMsgRecv.Channel].source - UartHalMsgRecv.value);
 						ret_send = xQueueSend(UartRecvQueue[UartHalMsgRecv.Channel],&UartRecvMsg,10);
+//#if SEGGER_PRINTF==1
+//						if(UartHalMsgRecv.Channel==1)
+//						{
+//							SEGGER_RTT_printf("[%d]source=%X,dataAddr=%X\r\n",__LINE__,uartRingBuffer[UartHalMsgRecv.Channel].source,UartRecvMsg.dataAddr);
+//						}
+//#endif
 					}
 					T_timeout[UartHalMsgRecv.Channel] = 0;
 					UartState[UartHalMsgRecv.Channel] = UartRecvComplete;
@@ -332,10 +358,6 @@ Std_ReturnType UART_Send_Data(uint8 transChannel, const uint8 *txBuffer, uint32
 		 ret = xQueueReceive(UartSendQueue[UartIdx],&UartSendMsg,1);
 		 if(ret==pdTRUE)
 		 {
-			 if(UartIdx==UART_LPUART0)
-			 {
-				 Dio_WriteChannel(DioConf_DioChannel_PTB4_GPIO_OUT_MCU_RS485_EN, STD_ON);
-			 }
 			 T_Uart_Status[UartIdx] = Uart_AsyncSend(UartIdx, UartSendMsg.dataPtr, UartSendMsg.DataLen);
 		     if (E_OK != T_Uart_Status[UartIdx])
 		     {
@@ -347,7 +369,7 @@ Std_ReturnType UART_Send_Data(uint8 transChannel, const uint8 *txBuffer, uint32
 		    	 UartSendState[UartIdx] = UartStartSend;
 		     }
 		 }
-		 /*开始���的判定*/
+		 /*¿ªÊ¼·¢ËͺóµÄÅж¨*/
 		 if(UartSendState[UartIdx] == UartStartSend)
 		 {
 			 Uart_TransmitStatus[UartIdx] = Uart_GetStatus(UartIdx, &T_bytesRemaining[UartIdx], UART_SEND);
@@ -552,10 +574,6 @@ void UART_Callback(uint32 hwInstance, Lpuart_Uart_Ip_EventType event)
     //    (void)userData;
 		Lpuart_Uart_Ip_StateStructureType * UartState;
 		UartState = (Lpuart_Uart_Ip_StateStructureType *)Lpuart_Uart_Ip_apStateStructuresArray[hwInstance];
-	if (hwInstance==0&&event == LPUART_UART_IP_EVENT_END_TRANSFER)
-	{
-		Dio_WriteChannel(DioConf_DioChannel_PTB4_GPIO_OUT_MCU_RS485_EN, STD_OFF);
-	}
     /* Check the event type */
     if (event == LPUART_UART_IP_EVENT_RX_FULL)
     {
@@ -700,7 +718,18 @@ void CanIf_RxIndication(const Can_HwType *Mailbox, const PduInfoType *PduInfoPtr
     canRxMsgQueueData.id = canRxMsg_Buff.id;
     canRxMsgQueueData.length = canRxMsg_Buff.length;
     memcpy(canRxMsgQueueData.data, canRxMsg_Buff.sdu, canRxMsgQueueData.length);
-    xQueueSend(CanRecvQueueHandle, &canRxMsgQueueData, 0);
+    switch(Mailbox->Hoh)
+    {
+	    case 0:
+	    	xQueueSend(CanRecvQueueHandle0, &canRxMsgQueueData, 0);
+	    	break;
+	    case 1:
+	    	xQueueSend(CanRecvQueueHandle1, &canRxMsgQueueData, 0);
+	    	break;
+	    case 2:
+	    	xQueueSend(CanRecvQueueHandle2, &canRxMsgQueueData, 0);
+	    	break;
+    }
 }
 
 void CanIf_CurrentIcomConfiguration(uint8 ControllerId, IcomConfigIdType ConfigurationId, IcomSwitch_ErrorType Error)
@@ -961,3 +990,164 @@ void SystemSoftwareReset(void)
     /* Write computed register value */
     S32_SCB->AIRCR = regValue;
 }
+
+void SystemPrepareForSleep(void)
+{
+
+	for(int pinIndex = 0; pinIndex <PortConfigSet_PortContainer_GPIO_PTB4_GPIO_OUT_MCU_RS485_EN; pinIndex++)
+	{
+		if(pinIndex == PortConfigSet_PortContainer_CAN_PTA12_CAN1_RX_MCU_CAN1_RX /*|| pinIndex == PortConfigSet_PortContainer_INT_PTB0_LPTMR0_ATL3_MCU_CC1_INT || pinIndex == PortConfigSet_PortContainer_INT_PTE11_LPTMR0_ALT1_MCU_3D_INT1 || pinIndex == PortConfigSet_PortContainer_INT_PTD5_LPTMR0_ATL2_MCU_3D_INT2*/)
+		{
+			continue;
+		}
+		else
+		{
+			Port_SetAsUnusedPin(pinIndex);
+		}
+	}
+
+	Port_SetPinMode(PortConfigSet_PortContainer_CAN_PTA12_CAN1_RX_MCU_CAN1_RX,PORT_GPIO_MODE);
+
+#if (ICU_PRECOMPILE_SUPPORT == STD_ON)
+					Icu_Init(NULL_PTR);
+#elif (ICU_PRECOMPILE_SUPPORT == STD_OFF)
+	Icu_Init(&Icu_Config_VS_0);
+#endif
+
+
+	Mcu_SetMode(McuModeSettingConf_VLPS);
+
+}
+
+
+void SystemPeripheralDeinit(void)
+{
+	WdgDeInit();
+	Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_OFF);
+	vTaskDelay(pdMS_TO_TICKS(3000));
+	Dio_WriteChannel(DioConf_DioChannel_PTA6_GPIO_OUT_MCU_4G_POW_EN, STD_OFF);
+
+	Dio_WriteChannel(DioConf_DioChannel_PTD1_GPIO_OUT_MCU_GPS_POW_EN, STD_OFF);//GPS ShutDown
+
+	Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_ON);
+	Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_ON);
+	Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_ON);
+	Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_ON);
+	Dio_WriteChannel(DioConf_DioChannel_PTE9_GPIO_OUT_MCU_LED5, STD_ON);
+
+	Uart_Deinit();
+
+	Can_SetControllerMode(CanController_0, CAN_CS_STOPPED);
+	Can_SetControllerMode(CanController_1, CAN_CS_STOPPED);
+//	Can_SetControllerMode(CanController_2, CAN_CS_STOPPED);
+
+	Can_DeInit();
+
+	Adc_DeInit();
+
+	Gpt_DisableNotification(GptConf_GptChannelConfiguration_GptChannelConfiguration_0);
+
+	Gpt_DeInit();
+
+	Spi_DeInit();
+
+	Mcl_DeInit();
+
+//	systemInitFlag = false;
+}
+
+void coreInit(void)
+{
+	/* Initialize the Mcu driver */
+#if (MCU_PRECOMPILE_SUPPORT == STD_ON)
+	Mcu_Init(NULL_PTR);
+#elif (MCU_PRECOMPILE_SUPPORT == STD_OFF)
+	Mcu_Init(&Mcu_Config_VS_0);
+#endif /* (MCU_PRECOMPILE_SUPPORT == STD_ON) */
+
+	Mcu_InitClock(McuClockSettingConfig_0);
+
+	/* Wait until PLL is locked */
+	while (MCU_PLL_LOCKED != Mcu_GetPllStatus())
+	{
+		/* Busy wait until the System PLL is locked */
+	}
+	Mcu_DistributePllClock();
+
+	OsIf_Init(NULL_PTR);
+
+	Platform_Init(NULL_PTR);
+}
+
+void SystemModulesInit(void)
+{
+//	Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+	/* Initialize Mcl module */
+	Mcl_Init(NULL_PTR);
+
+	SEGGER_RTT_Init();
+
+
+	/* Initializes an UART driver*/
+#if (UART_PRECOMPILE_SUPPORT == STD_ON)
+	Uart_Init(NULL_PTR);
+#elif (UART_PRECOMPILE_SUPPORT == STD_OFF)
+	Uart_Init(&Uart_xConfig_VS_0);
+#endif
+	IP_LPUART0->CTRL |= LPUART_CTRL_ILT(1);
+	IP_LPUART1->CTRL |= LPUART_CTRL_ILT(1);
+	IP_LPUART2->CTRL |= LPUART_CTRL_ILT(1);
+	IP_LPUART0->CTRL |= LPUART_CTRL_IDLECFG(5);
+	IP_LPUART1->CTRL |= LPUART_CTRL_IDLECFG(3);
+	IP_LPUART2->CTRL |= LPUART_CTRL_IDLECFG(3);
+
+#if 1 /* Initialize Platform driver */
+#if (CAN_PRECOMPILE_SUPPORT == STD_ON)
+	Can_Init(NULL_PTR);
+#elif (CAN_PRECOMPILE_SUPPORT == STD_OFF)
+	Can_Init(&Can_Config_VS_0);
+#endif
+	Can_SetControllerMode(CanController_0, CAN_CS_STARTED);
+	Can_SetControllerMode(CanController_1, CAN_CS_STARTED);
+//	Can_SetControllerMode(CanController_2, CAN_CS_STARTED);
+#endif
+
+#if (ADC_PRECOMPILE_SUPPORT == STD_ON)
+	Adc_Init(NULL_PTR);
+#else
+	Adc_Init(&Adc_Config_VS_0);
+#endif /* ADC_PRECOMPILE_SUPPORT == STD_ON */
+
+	/* Partition only if it was not partitioned before for EERAM with code 0x4 */
+//    Eep_DepartParitition(T_EEEPROM_SIZE);
+	/* Initialize Eep driver */
+#if defined (EEP_PRECOMPILE_SUPPORT)
+	Eep_Init(NULL_PTR);
+#else
+	Eep_Init(&Eep_Config_VS_0);
+#endif
+	//Init Flash Driver
+#if defined (FLS_PRECOMPILE_SUPPORT)
+	Fls_Init(NULL_PTR);
+#else
+	Fls_Init(&Fls_Config_VS_0);
+	while(MEMIF_IDLE == Fls_GetStatus())
+	{
+		;
+	}
+#endif
+
+
+	Spi_Init(NULL_PTR);
+			/* Initialize the Gpt driver */
+	Gpt_Init(&Gpt_Config_VS_0);
+
+	/* Enable the Gpt notification to periodically service the Wdg */
+	Gpt_EnableNotification(GptConf_GptChannelConfiguration_GptChannelConfiguration_0);
+
+	Icu_DeInit();
+
+	WdgInit();
+
+	IsFeedWdg = true;
+}

+ 23 - 6
code/hal/hal_adapter.h

@@ -9,8 +9,8 @@
  */
 /*
  * hal_adapter.h
- *中间层函数调用库
- *  Created on: 2022年1月18日
+ *Öмä²ãº¯Êýµ÷Óÿâ
+ *  Created on: 2022Äê1ÔÂ18ÈÕ
  *      Author: QiXiang_CHENJIE
  */
 
@@ -43,7 +43,8 @@
 #include "SL_Sc7a20_Driver.h"
 #include "SEGGER_RTT_Conf.h"
 #include "SEGGER_RTT.h"
-/*适应性定义*/
+#include "hal_Wdg.h"
+/*ÊÊÓ¦ÐÔ¶¨Òå*/
 typedef unsigned char UINT8;
 typedef unsigned short UINT16;
 typedef unsigned long UINT32;
@@ -52,6 +53,8 @@ typedef signed char INT8;
 typedef signed short INT16;
 typedef signed long INT32;
 
+#define UARTPRINTF 0
+#define SEGGER_PRINTF 0
 #define CAN0 0
 #define CAN1 1
 #ifndef min
@@ -60,9 +63,9 @@ typedef signed long INT32;
 #ifndef max
 #define max(A, B) ((A) < (B) ? (B) : (A))
 #endif
-#define getbit(x, y) ((x) >> (y)&1) //获�x的第y�的数值
-#define setbit(x, y) x |= (1 << y)  // x的第y�置1
-#define clrbit(x, y) x &= ~(1 << y) // x的第y�置0
+#define getbit(x, y) ((x) >> (y)&1) //»ñÈ¡xµÄµÚyλµÄÊýÖµ
+#define setbit(x, y) x |= (1 << y)  // xµÄµÚyλÖÃ1
+#define clrbit(x, y) x &= ~(1 << y) // xµÄµÚyλÖÃ0
 #define UART_LPUART0 0
 #define UART_LPUART1 1
 #define UART_LPUART2 2
@@ -247,4 +250,18 @@ void create_ringBuffer(ringbuffer_t *ringBuf, uint8_t *buf, uint32_t buf_len);
 void clear_ringBuffer(ringbuffer_t *ringBuf);
 uint32_t write_ringBuffer(uint8_t *buffer, uint32_t size, ringbuffer_t *ringBuf);
 uint32_t read_ringBuffer(uint8_t *buffer, uint32_t size, ringbuffer_t *ringBuf);
+
+
+void coreInit(void);
+void SystemModulesInit(void);
+void Icu_DeInit(void);
+void SystemPeripheralDeinit(void);
+void SystemPrepareForSleep(void);
+
+
+#if UARTPRINTF==1
+	uint16 myPrintf(const char *fmt, ...);
+	extern uint8 ringbuffer[1024];
+	extern ringbuffer_t printfRingBuffer;
+#endif
 #endif /* HAL_ADAPTER_H_ */

+ 126 - 97
code/main.c

@@ -49,6 +49,7 @@
 #include "Lpuart_Uart_Ip.h"
 #include "Gpt.h"
 #include "Wdg_43_Instance0.h"
+#include "Icu.h"
 /* User includes */
 
 #include <string.h>
@@ -61,7 +62,7 @@
 #include "AppTaskCan.h"
 #include "AppTaskGps.h"
 #include "Hal_Fls.h"
-#include "SEGGER_SYSVIEW.h"
+
 #include "cm_backtrace.h"
 #define APPNAME                        "S32K146_4G"
 #define HARDWARE_VERSION               "V1.0.0"
@@ -69,110 +70,138 @@
 int main(void)
 {
  	volatile int exit_code = 0;
-	/* Initialize the Mcu driver */
-#if (MCU_PRECOMPILE_SUPPORT == STD_ON)
-	Mcu_Init(NULL_PTR);
-#elif (MCU_PRECOMPILE_SUPPORT == STD_OFF)
-	Mcu_Init(&Mcu_Config_VS_0);
-#endif /* (MCU_PRECOMPILE_SUPPORT == STD_ON) */
 
-	Mcu_InitClock(McuClockSettingConfig_0);
 
-	/* Wait until PLL is locked */
-	while (MCU_PLL_LOCKED != Mcu_GetPllStatus())
-	{
-		/* Busy wait until the System PLL is locked */
-	}
-	Mcu_DistributePllClock();
-	/* Initialize Mcl module */
-	Mcl_Init(NULL_PTR);
 
-	Mcu_SetMode(McuModeSettingConf_Run);
-	OsIf_Init(NULL_PTR);
-	Platform_Init(NULL_PTR);
 
-	/* Initialize all pins*/
+	coreInit();
+
+/* Initialize all pins*/
 #if (PORT_PRECOMPILE_SUPPORT == STD_ON)
 	Port_Init(NULL_PTR);
 #elif (PORT_PRECOMPILE_SUPPORT == STD_OFF)
 	Port_Init(&Port_Config_VS_0);
 #endif
 
-	/* Initializes an UART driver*/
-#if (UART_PRECOMPILE_SUPPORT == STD_ON)
-	Uart_Init(NULL_PTR);
-#elif (UART_PRECOMPILE_SUPPORT == STD_OFF)
-	Uart_Init(&Uart_xConfig_VS_0);
-#endif
+	SystemModulesInit();
 
- /* Initialize Platform driver */
-#if (CAN_PRECOMPILE_SUPPORT == STD_ON)
-	Can_Init(NULL_PTR);
-#elif (CAN_PRECOMPILE_SUPPORT == STD_OFF)
-	Can_Init(&Can_Config_VS_0);
-#endif
-	Can_SetControllerMode(CanController_0, CAN_CS_STARTED);
-	Can_SetControllerMode(CanController_1, CAN_CS_STARTED);
-	Can_SetControllerMode(CanController_2, CAN_CS_STARTED);
-
-	//Init ADC Module
-#if (ADC_PRECOMPILE_SUPPORT == STD_ON)
-	Adc_Init(NULL_PTR);
-#else
-	Adc_Init(&Adc_Config_VS_0);
-#endif /* ADC_PRECOMPILE_SUPPORT == STD_ON */
-    /* Partition only if it was not partitioned before for EERAM with code 0x4 */
-//    Eep_DepartParitition(T_EEEPROM_SIZE);
-    /* Initialize Eep driver */
-#if defined (EEP_PRECOMPILE_SUPPORT)
-    Eep_Init(NULL_PTR);
-#else
-    Eep_Init(&Eep_Config_VS_0);
-#endif
-    //Init Flash Driver
-#if defined (FLS_PRECOMPILE_SUPPORT)
-    Fls_Init(NULL_PTR);
-#else
-    Fls_Init(&Fls_Config_VS_0);
-    while(MEMIF_IDLE == Fls_GetStatus())
-    {
-    	;
-    }
-#endif
-	// this function should be called in ADC Task at once
-	Adc_CalibrationStatusType CalibStatus;
-	Adc_Calibrate(AdcHwUnit_0, &CalibStatus);
-	if (CalibStatus.Adc_UnitSelfTestStatus == E_NOT_OK)
+
+	//4G module power on
+	Dio_WriteChannel(DioConf_DioChannel_PTA6_GPIO_OUT_MCU_4G_POW_EN, STD_ON);
+	Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_ON);
+
+	//GPS module power on
+	Dio_WriteChannel(DioConf_DioChannel_PTD1_GPIO_OUT_MCU_GPS_POW_EN, STD_ON);
+
+
+//	// this function should be called in ADC Task at once
+//	Adc_CalibrationStatusType CalibStatus;
+//	Adc_Calibrate(AdcHwUnit_0, &CalibStatus);
+//	if (CalibStatus.Adc_UnitSelfTestStatus == E_NOT_OK)
+//	{
+//		// if so, the adc is failed to Calibrate;
+//	}
+//	ADC_ReadValue();
+//	Boot_CheckDownlaodAPPStatus();
+
+
+
+
+//	Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+//	Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+//	Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+//	Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
+//	Dio_WriteChannel(DioConf_DioChannel_PTE9_GPIO_OUT_MCU_LED5, STD_OFF);
+	Mcu_ResetType bootreason;
+	bootreason = Mcu_GetResetReason();
+	if(bootreason == MCU_STOP_ACKNOWLEDGE_ERROR_RESET)
+		Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+	else if(bootreason == MCU_MDM_AP_SYSTEM_RESET)
+		Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+	else if(bootreason == MCU_SW_RESET)
 	{
-		// if so, the adc is failed to Calibrate;
+		Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+		Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
 	}
-	ADC_ReadValue();
-	Boot_CheckDownlaodAPPStatus();
-
-	Spi_Init(NULL_PTR);
-	    /* Initialize the Gpt driver */
-	Gpt_Init(&Gpt_Config_VS_0);
-
-	/* Enable the Gpt notification to periodically service the Wdg */
-	Gpt_EnableNotification(GptConf_GptChannelConfiguration_GptChannelConfiguration_0);
-
-	WdgInit();
-	IP_LPUART0->CTRL |= LPUART_CTRL_ILT(1);
-	IP_LPUART1->CTRL |= LPUART_CTRL_ILT(1);
-	IP_LPUART2->CTRL |= LPUART_CTRL_ILT(1);
-	IP_LPUART0->CTRL |= LPUART_CTRL_IDLECFG(5);
-	IP_LPUART1->CTRL |= LPUART_CTRL_IDLECFG(3);
-	IP_LPUART2->CTRL |= LPUART_CTRL_IDLECFG(3);
-
-	Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
-	Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
-	Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
-	Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
-	Dio_WriteChannel(DioConf_DioChannel_PTE9_GPIO_OUT_MCU_LED5, STD_OFF);
-
-#ifdef SEGGER_SYSTEMVIEW
-	SEGGER_SYSVIEW_Conf();
-#endif
+
+	else if(bootreason == MCU_CORE_LOCKUP_RESET)
+		Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+	else if(bootreason == MCU_JTAG_RESET)
+	{
+			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+//			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+		}
+	else if(bootreason == MCU_POWER_ON_RESET)
+	{
+//			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+			}
+	else if(bootreason == MCU_EXTERNAL_PIN_RESET)
+	{
+			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+	}
+	else if(bootreason == MCU_WATCHDOG_RESET)
+	{
+//			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+//			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+//			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
+	}
+
+	else if(bootreason == MCU_CMU_LOSS_OF_CLOCK_RESET)
+	{
+			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+//			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+//			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
+	}
+	else if(bootreason == MCU_LOSS_OF_LOCK_RESET)
+	{
+//			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+//			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
+	}
+	else if(bootreason == MCU_LOSS_OF_CLOCK_RESET)
+	{
+			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+//			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
+	}
+	else if(bootreason == MCU_LOW_OR_HIGH_VOLTAGE_DETECT_RESET)
+	{
+//			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+//			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
+	}
+	else if(bootreason == MCU_NO_RESET_REASON)
+	{
+			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+//			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
+	}
+	else if(bootreason == MCU_MULTIPLE_RESET_REASON)
+	{
+//			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
+	}
+	else if(bootreason == MCU_RESET_UNDEFINED)
+	{
+			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3, STD_OFF);
+			Dio_WriteChannel(DioConf_DioChannel_PTE8_GPIO_OUT_MCU_LED4, STD_OFF);
+	}
+
 
 #ifdef SEGGER_RTT_PRINTF
 	SEGGER_RTT_Init();
@@ -180,11 +209,11 @@ int main(void)
 	SEGGER_RTT_printf("[%d] boot\r\n",__LINE__);
 #endif
 	UartInit();
-	xTaskCreate(MainTask, (const char *const)"MainTask", 256, (void *)0, main_TASK_PRIORITY + 6, NULL);
-	// xTaskCreate(Uart0Task, (const char *const)"Uart0_Bms_Task", 1024, (void *)0, main_TASK_PRIORITY + 2, NULL);
-	xTaskCreate(CanTask, (const char *const)"CanTask", 512, (void *)0, main_TASK_PRIORITY + 2, NULL);
-	xTaskCreate(GpsTask, (const char *const)"GpsTask", 512, (void *)0, main_TASK_PRIORITY + 1, NULL);
-	xTaskCreate(Uart_4G_Task, (const char *const)"Uart_4G_Task", 2048, (void *)0, main_TASK_PRIORITY + 0, NULL);
+	xTaskCreate(MainTask, (const char *const)"MainTask", 512, (void *)0, main_TASK_PRIORITY + 6, NULL);
+//	xTaskCreate(Uart0Task, (const char *const)"Uart0_Bms_Task", 512, (void *)0, main_TASK_PRIORITY + 2, NULL);
+	xTaskCreate(CanTask, (const char *const)"CanTask", 512, (void *)0, main_TASK_PRIORITY + 2, &CanTask_Handle);
+	xTaskCreate(GpsTask, (const char *const)"GpsTask", 512, (void *)0, main_TASK_PRIORITY + 1, &GpsTask_Handle);
+	xTaskCreate(Uart_4G_Task, (const char *const)"Uart_4G_Task", 2048, (void *)0, main_TASK_PRIORITY + 0, &Uart_4G_Task_Handle);
 	vTaskStartScheduler();
 	for (;;)
 	{

+ 86 - 0
generate/include/Cmp_Ip_Cfg.h

@@ -0,0 +1,86 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef CMP_IP_CFG_H
+#define CMP_IP_CFG_H
+
+/**
+ *   @file    Cmp_Ip_Cfg.h
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup cmp_icu_ip CMP IPL
+ *   @{
+ */
+ 
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+#include "StandardTypes.h"
+#include "Cmp_Ip_VS_0_PBcfg.h"
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define CMP_IP_CFG_VENDOR_ID                    43
+#define CMP_IP_CFG_AR_RELEASE_MAJOR_VERSION     4
+#define CMP_IP_CFG_AR_RELEASE_MINOR_VERSION     4
+#define CMP_IP_CFG_AR_RELEASE_REVISION_VERSION  0
+#define CMP_IP_CFG_SW_MAJOR_VERSION             1
+#define CMP_IP_CFG_SW_MINOR_VERSION             0
+#define CMP_IP_CFG_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+ *                                      FILE VERSION CHECKS
+ *================================================================================================*/
+
+/* Check if header file and StandardTypes.h file are of the same Autosar version */
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((CMP_IP_CFG_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (CMP_IP_CFG_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+    #error "AutoSar Version Numbers of Cmp_Ip_Cfg.h and StandardTypes.h are different"
+    #endif
+#endif
+
+/*==================================================================================================
+                                       DEFINES AND MACROS
+==================================================================================================*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* CMP_IP_CFG_H */

+ 94 - 0
generate/include/Cmp_Ip_Defines.h

@@ -0,0 +1,94 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef CMP_IP_DEFINES_H
+#define CMP_IP_DEFINES_H
+
+/**
+ *   @file    Cmp_Ip_Defines.h
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup cmp_icu_ip CMP IPL
+ *   @{
+ */
+ 
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+#include "StandardTypes.h"
+/* Include platform header file. */
+#include "S32K146_CMP.h"
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define CMP_IP_DEFINES_VENDOR_ID                    43
+#define CMP_IP_DEFINES_AR_RELEASE_MAJOR_VERSION     4
+#define CMP_IP_DEFINES_AR_RELEASE_MINOR_VERSION     4
+#define CMP_IP_DEFINES_AR_RELEASE_REVISION_VERSION  0
+#define CMP_IP_DEFINES_SW_MAJOR_VERSION             1
+#define CMP_IP_DEFINES_SW_MINOR_VERSION             0
+#define CMP_IP_DEFINES_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+ *                                      FILE VERSION CHECKS
+ *================================================================================================*/
+
+/* Check if header file and StandardTypes.h file are of the same Autosar version */
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((CMP_IP_DEFINES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (CMP_IP_DEFINES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+    #error "AutoSar Version Numbers of Cmp_Ip_Defines.h and StandardTypes.h are different"
+    #endif
+#endif
+
+/*==================================================================================================
+                                       DEFINES AND MACROS
+==================================================================================================*/
+#define CMP_ICU_NOT_SUPPORT_LOWPOWER
+#define ICU_CMP_INSTANCE_COUNT    (CMP_INSTANCE_COUNT)
+
+/** @brief Adds or removes all services related to input state functionality. */
+#define CMP_ICU_GET_INPUT_STATE_API          (STD_ON)
+
+
+#define     CMP_IP_DEV_ERROR_DETECT        (STD_ON)
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* CMP_IP_DEFINES_H */

+ 90 - 0
generate/include/Cmp_Ip_VS_0_PBcfg.h

@@ -0,0 +1,90 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef CMP_IP_VS_0_PBCFG_H
+#define CMP_IP_VS_0_PBCFG_H
+
+/**
+ *   @file    Cmp_Ip_PBcfg.h
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup cmp_icu_ip CMP IPL
+ *   @{
+ */
+ 
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                         INCLUDE FILES
+*================================================================================================*/
+#include "Cmp_Ip_Types.h"
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define CMP_IP_PBCFG_VS_0_VENDOR_ID                    43
+#define CMP_IP_PBCFG_VS_0_AR_RELEASE_MAJOR_VERSION     4
+#define CMP_IP_PBCFG_VS_0_AR_RELEASE_MINOR_VERSION     4
+#define CMP_IP_PBCFG_VS_0_AR_RELEASE_REVISION_VERSION  0
+#define CMP_IP_PBCFG_VS_0_SW_MAJOR_VERSION             1
+#define CMP_IP_PBCFG_VS_0_SW_MINOR_VERSION             0
+#define CMP_IP_PBCFG_VS_0_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+ *                                      FILE VERSION CHECKS
+ *================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (CMP_IP_PBCFG_VS_0_VENDOR_ID != CMP_IP_TYPES_VENDOR_ID)
+    #error "Cmp_Ip_PBcfg.h and Cmp_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((CMP_IP_PBCFG_VS_0_AR_RELEASE_MAJOR_VERSION != CMP_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (CMP_IP_PBCFG_VS_0_AR_RELEASE_MINOR_VERSION != CMP_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (CMP_IP_PBCFG_VS_0_AR_RELEASE_REVISION_VERSION != CMP_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Cmp_Ip_PBcfg.h and Cmp_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((CMP_IP_PBCFG_VS_0_SW_MAJOR_VERSION != CMP_IP_TYPES_SW_MAJOR_VERSION) || \
+     (CMP_IP_PBCFG_VS_0_SW_MINOR_VERSION != CMP_IP_TYPES_SW_MINOR_VERSION) || \
+     (CMP_IP_PBCFG_VS_0_SW_PATCH_VERSION != CMP_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Cmp_Ip_PBcfg.h and Cmp_Ip_Types.h are different"
+#endif
+/*==================================================================================================
+ *                                       DEFINES AND MACROS
+ *================================================================================================*/
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* CMP_IP_VS_0_PBCFG_H */

+ 4 - 10
generate/include/EcuM_Cfg.h

@@ -76,22 +76,16 @@ extern "C" {
 /** @brief Identifier for wakeup source EcuMWakeupSource_0*/
 #define EcuMConf_EcuMWakeupSource_EcuMWakeupSource_0 ((uint32)((uint32)1U<<0))
 
-#if (defined EcuMConf_EcuMWakeupSource_EcuMWakeupSource_1) /* to prevent double declaration */
-#error EcuMConf_EcuMWakeupSource_EcuMWakeupSource_1 already defined
-#endif
-/** @brief Identifier for wakeup source EcuMWakeupSource_1*/
-#define EcuMConf_EcuMWakeupSource_EcuMWakeupSource_1 ((uint32)((uint32)1U<<1))
-
 
 
 /* ======== Sleep modes ======== */
 
 
-#if (defined EcuMConf_EcuMSleepMode_EcuMSleepMode_0) /* to prevent double declaration */
-#error EcuMConf_EcuMSleepMode_EcuMSleepMode_0 already defined
+#if (defined EcuMConf_EcuMSleepMode_EcuMSleepMode_1) /* to prevent double declaration */
+#error EcuMConf_EcuMSleepMode_EcuMSleepMode_1 already defined
 #endif
-/** @brief Identifier for wakeup source EcuMSleepMode_0*/
-#define EcuMConf_EcuMSleepMode_EcuMSleepMode_0 0x0U
+/** @brief Identifier for wakeup source EcuMSleepMode_1*/
+#define EcuMConf_EcuMSleepMode_EcuMSleepMode_1 0x0U
 
 
 /*==================================================================================================

+ 1 - 1
generate/include/Eep_Cfg.h

@@ -170,7 +170,7 @@ extern "C"{
 #define EEP_COMPARE_API             FTFC_EEP_IP_COMPARE_API
 
 /* Pre-processor switch to enable and disable development error detection */
-#define EEP_DEV_ERROR_DETECT        (STD_OFF) //zhengchao 20220421
+#define EEP_DEV_ERROR_DETECT        (STD_ON)
 
 /* Compile switch to enable and disable the Eep_GetJobResult function */
 #define EEP_GET_JOB_RESULT_API      (STD_ON)

+ 1 - 1
generate/include/FlexCAN_Ip_Cfg.h

@@ -147,7 +147,7 @@ extern "C"{
 #define FLEXCAN_IP_TIMEOUT_DURATION    (1000000U)
 
 /* This this will set the timer source for osif that will be used for timeout */
-#define FLEXCAN_IP_SERVICE_TIMEOUT_TYPE    (OSIF_COUNTER_SYSTEM)
+#define FLEXCAN_IP_SERVICE_TIMEOUT_TYPE    (OSIF_COUNTER_DUMMY)
 
 
 /* @brief Maximum number of Message Buffers supported for payload size 8 for any of the CAN instances */

+ 1 - 1
generate/include/Flexio_Spi_Ip_Cfg.h

@@ -147,7 +147,7 @@ extern "C"{
 * @brief Define Timeout Method.
 * @details Define a certain timeout method from OsIf will be used in the driver.
 */
-#define FLEXIO_SPI_IP_TIMEOUT_METHOD           (OSIF_COUNTER_SYSTEM)
+#define FLEXIO_SPI_IP_TIMEOUT_METHOD           (OSIF_COUNTER_DUMMY)
 
 /**
 * @brief          Enable User Mode Support.

+ 2 - 2
generate/include/Flexio_Uart_Ip_Defines.h

@@ -80,7 +80,7 @@ extern "C"{
 /* @brief Using FLEXIO */
 #define FLEXIO_UART_IP_IS_USING                         (STD_OFF)
 /* @brief Development error detection */
-#define FLEXIO_UART_IP_DEV_ERROR_DETECT                 (STD_ON)
+#define FLEXIO_UART_IP_DEV_ERROR_DETECT                 (STD_OFF)
 
 /* @brief FLEXIO DMA support */
 #define FLEXIO_UART_IP_HAS_DMA_ENABLED                  (STD_ON)
@@ -89,7 +89,7 @@ extern "C"{
 #define FLEXIO_UART_IP_NUMBER_OF_SHIFTER_AND_TIMER      (4U)
 
 /* @brief Uart Osif source counter. This parameter is used to select between different OsIf counter implementation */
-#define FLEXIO_UART_IP_TIMEOUT_TYPE                     (OSIF_COUNTER_SYSTEM)
+#define FLEXIO_UART_IP_TIMEOUT_TYPE                     (OSIF_COUNTER_DUMMY)
 
 /* @brief Number of loops before returning FLEXIO_STATUS_TIMEOUT.*/
 #define FLEXIO_UART_IP_TIMEOUT_VALUE_US                 (100000U)

+ 1 - 1
generate/include/Ftfc_Eep_Ip_Cfg.h

@@ -130,7 +130,7 @@ extern "C"{
 #define FTFC_EEP_IP_ALIGNED_RAM_ACCESS      STD_OFF
 
 /** OsIf counter type used in timeout detection */
-#define FTFC_EEP_IP_TIMEOUT_TYPE            OSIF_COUNTER_SYSTEM
+#define FTFC_EEP_IP_TIMEOUT_TYPE            OSIF_COUNTER_DUMMY
 #define FTFC_EEP_IP_ABORT_TIMEOUT           268435456U
 #define FTFC_EEP_IP_ASYNC_WRITE_TIMEOUT     268435456U
 #define FTFC_EEP_IP_SYNC_WRITE_TIMEOUT      268435456U

+ 98 - 0
generate/include/Ftm_Icu_Ip_Cfg.h

@@ -0,0 +1,98 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef FTM_ICU_IP_CFG_H
+#define FTM_ICU_IP_CFG_H
+
+/**
+ *   @file    Ftm_Icu_Ip_Cfg.h
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the ICU module.
+ *   @details Contains the information that will be exported by the module, as requested by AUTOSAR.
+ *
+ *   @addtogroup ftm_icu_ip FTM IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+/* Include all variants header files. */
+#include "Ftm_Icu_Ip_VS_0_PBcfg.h"
+
+/*==================================================================================================
+*                                 SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define FTM_ICU_IP_CFG_VENDOR_ID                    43
+#define FTM_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION     4
+#define FTM_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION     4
+#define FTM_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION  0
+#define FTM_ICU_IP_CFG_SW_MAJOR_VERSION             1
+#define FTM_ICU_IP_CFG_SW_MINOR_VERSION             0
+#define FTM_ICU_IP_CFG_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU configuration header file are of the same vendor */
+#if (FTM_ICU_IP_VS_0_PBCFG_VENDOR_ID != FTM_ICU_IP_CFG_VENDOR_ID)
+    #error "Ftm_Icu_Ip_VS_0_PBcfg.h and Ftm_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+    /* Check if header file and Icu configuration header file are of the same Autosar version */
+#if ((FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION != FTM_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION != FTM_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION != FTM_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION) \
+    )
+#error "AutoSar Version Numbers of Ftm_Icu_Ip_VS_0_PBcfg.h and Ftm_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if header file and Icu configuration header file are of the same software version */
+#if ((FTM_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION != FTM_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION != FTM_ICU_IP_CFG_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION != FTM_ICU_IP_CFG_SW_PATCH_VERSION) \
+    )
+#error "Software Version Numbers of Ftm_Icu_Ip_VS_0_PBcfg.h and Ftm_Icu_Ip_Cfg.h are different"
+#endif
+
+/*==================================================================================================
+*                                       DEFINES AND MACROS
+==================================================================================================*/
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* FTM_ICU_IP_CFG_H */
+

+ 162 - 0
generate/include/Ftm_Icu_Ip_Defines.h

@@ -0,0 +1,162 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef FTM_ICU_IP_DEFINES_H
+#define FTM_ICU_IP_DEFINES_H
+
+/**
+*   @file
+*
+*   @addtogroup ftm_icu_ip FTM IPL
+*   @{
+*/
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+#include "StandardTypes.h"
+/* Include platform header file. */
+#include "S32K146_FTM.h"
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define FTM_ICU_IP_DEFINES_VENDOR_ID                       43
+#define FTM_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION        4
+#define FTM_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION        4
+#define FTM_ICU_IP_DEFINES_AR_RELEASE_REVISION_VERSION     0
+#define FTM_ICU_IP_DEFINES_SW_MAJOR_VERSION                1
+#define FTM_ICU_IP_DEFINES_SW_MINOR_VERSION                0
+#define FTM_ICU_IP_DEFINES_SW_PATCH_VERSION                0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if header file and Std_Types.h file are of the same Autosar version */
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((FTM_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (FTM_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Ftm_Icu_Ip_Defines.h and Std_Types.h are different"
+    #endif
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                       DEFINES AND MACROS
+==================================================================================================*/
+/* Macros that indicate FTM instances used by ICU. */
+
+/** @brief Switches the Development Error Detection and Notification on or off.  */
+#define FTM_ICU_IP_DEV_ERROR_DETECT        (STD_ON)
+
+#if (STD_ON == FTM_ICU_IP_DEV_ERROR_DETECT)
+/** @brief The number of FTM instances available on platform */
+#define FTM_ICU_IP_NUM_OF_MODULES          (6U)
+#endif
+
+/** @brief The number of channels available on each FTM instance */
+#define FTM_ICU_IP_NUM_OF_CHANNELS         (8U)
+
+/** TODO:Generate @brief The number of channels with filter on each FTM instance */
+#define FTM_FILTER_MAX_NO_CH               (4U)
+
+/** @brief Adds or removes all services related to the timestamp functionality. */
+#define FTM_ICU_TIMESTAMP_API              (STD_ON)
+
+/** @brief Adds or removes all services related to the edge detect functionality. */
+#define FTM_ICU_EDGE_DETECT_API            (STD_ON)
+
+/** @brief Adds or removes all services related to the signal mesurement functionality. */
+#define FTM_ICU_SIGNAL_MEASUREMENT_API     (STD_ON)
+
+/** @brief Adds or removes all services related to the input level. */
+#define FTM_ICU_GET_INPUT_LEVEL_API        (STD_ON)
+
+/** @brief Adds or removes all services related to the deinitialization functionality. */
+#define FTM_ICU_DEINIT_API                 (STD_ON)
+
+/** @brief Adds or removes all services related to mode set functionality. */
+#define FTM_ICU_SET_MODE_API               (STD_ON)
+
+/** @brief Adds or removes all services related to edge count functionality. */
+#define FTM_ICU_EDGE_COUNT_API             (STD_ON)
+
+/** @brief  Adds or removes the service Icu_GetTimeElapsed() from the code. */
+#define FTM_ICU_GET_TIME_ELAPSED_API        (STD_ON)
+
+/** @brief  Adds or removes the service Icu_GetDutyCycleValues() from the code. */
+#define FTM_ICU_GET_DUTY_CYCLE_VALUES_API   (STD_ON)
+
+/** @brief Adds or removes all services related to input state functionality. */
+#define FTM_ICU_GET_INPUT_STATE_API        (STD_ON)
+
+/** @brief Adds or removes all services related to dual clock edge functionality. */
+#define FTM_ICU_DUAL_CLOCK_MODE_API        (STD_OFF)
+
+/** @brief Support for User mode.If this parameter has been configured to 'STD_ON',
+ *  the FTM driver code can be executed from both supervisor and user mode. */
+#define FTM_ICU_ENABLE_USER_MODE_SUPPORT   (STD_OFF)
+
+#define FTM_ICU_CAPTURERGISTER_API         (STD_OFF)
+
+/** @brief Adds or Removes the code related to overflow notification */
+#define FTM_ICU_OVERFLOW_NOTIFICATION_API  (STD_OFF)
+
+/* Verification for user mode support. */
+#ifndef MCAL_ENABLE_USER_MODE_SUPPORT
+ #if (defined (FTM_ICU_ENABLE_USER_MODE_SUPPORT) && (STD_ON == FTM_ICU_ENABLE_USER_MODE_SUPPORT))
+    #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
+ #endif
+#endif
+
+/**
+ * @brief Adds or removes the support for TimeStamp Measurement with DMA.
+ *        STD_ON:  DMA in TS measurement can be used.
+ *        STD_OFF: DMA in TS measurement can not be used.
+ */
+#define FTM_ICU_TIMESTAMP_USES_DMA            (STD_OFF)
+
+/** @brief Get FTM type for each platform. */
+#define Ftm_Icu_Ip_BaseType                   FTM_Type
+
+/* Define used for FTM instance with distinct lines for overflow IRQ and event IRQ. */#define FTM_ICU_TOF_DISTINCT_LINE             (STD_ON)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* FTM_ICU_IP_DEFINES_H */
+
+/** @} */
+

+ 97 - 0
generate/include/Ftm_Icu_Ip_VS_0_PBcfg.h

@@ -0,0 +1,97 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef FTM_ICU_IP_VS_0_PBCFG_H
+#define FTM_ICU_IP_VS_0_PBCFG_H
+
+/**
+ *   @file    Ftm_Icu_VS_0_PBCfg.c
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the ICU module.
+ *   @details Contains the information that will be exported by the module, as requested by AUTOSAR.
+ *
+ *   @addtogroup ftm_icu_ip FTM IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Ftm_Icu_Ip_Types.h"
+
+/*==================================================================================================
+*                                 SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define FTM_ICU_IP_VS_0_PBCFG_VENDOR_ID                    43
+#define FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION     4
+#define FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION     4
+#define FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION  0
+#define FTM_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION             1
+#define FTM_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION             0
+#define FTM_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (FTM_ICU_IP_VS_0_PBCFG_VENDOR_ID != FTM_ICU_IP_TYPES_VENDOR_ID)
+    #error "Ftm_Icu_Ip_PBcfg.h and Ftm_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION    != FTM_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION    != FTM_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION != FTM_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Ftm_Icu_Ip_PBcfg.h and Ftm_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((FTM_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION != FTM_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION != FTM_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION != FTM_ICU_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Ftm_Icu_Ip_PBcfg.h and Ftm_Icu_Ip_Types.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                       DEFINES AND MACROS
+==================================================================================================*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* FTM_ICU_IP_VS_0_PBCFG_H */

+ 413 - 0
generate/include/Icu_Cfg.h

@@ -0,0 +1,413 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_CFG_H
+#define ICU_CFG_H
+
+/**
+*   @file Icu_Cfg.h
+*   @version 1.0.0
+*
+*   @brief   AUTOSAR Icu - contains the configuration data of the ICU driver
+*   @details Contains the configuration data of the ICU driver
+*
+*   @addtogroup icu Icu Driver
+*   @{
+*/
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+                                         INCLUDE FILES
+ 1) system and project includes
+ 2) needed interfaces from external units
+ 3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Icu_EnvCfg.h"
+#include "StandardTypes.h"
+#include "Icu_VS_0_PBcfg.h"
+
+
+
+/*==================================================================================================
+                               SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_CFG_VENDOR_ID                       43
+#define ICU_CFG_AR_RELEASE_MAJOR_VERSION        4
+#define ICU_CFG_AR_RELEASE_MINOR_VERSION        4
+#define ICU_CFG_AR_RELEASE_REVISION_VERSION     0
+#define ICU_CFG_SW_MAJOR_VERSION                1
+#define ICU_CFG_SW_MINOR_VERSION                0
+#define ICU_CFG_SW_PATCH_VERSION                0
+
+/*==================================================================================================
+                                      FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and Icu_EnvCfg header file are of the same vendor */
+#if (ICU_CFG_VENDOR_ID != ICU_ENVCFG_VENDOR_ID)
+    #error "Icu_Cfg.h and Icu_EnvCfg.h have different vendor IDs"
+#endif
+/* Check if source file and Icu_EnvCfg header file are of the same AutoSar version */
+#if ((ICU_CFG_AR_RELEASE_MAJOR_VERSION != ICU_ENVCFG_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_CFG_AR_RELEASE_MINOR_VERSION != ICU_ENVCFG_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_CFG_AR_RELEASE_REVISION_VERSION != ICU_ENVCFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Cfg.h and Icu_EnvCfg.h are different"
+#endif
+/* Check if source file and Icu_EnvCfg header file are of the same Software version */
+#if ((ICU_CFG_SW_MAJOR_VERSION != ICU_ENVCFG_SW_MAJOR_VERSION) || \
+     (ICU_CFG_SW_MINOR_VERSION != ICU_ENVCFG_SW_MINOR_VERSION) || \
+     (ICU_CFG_SW_PATCH_VERSION != ICU_ENVCFG_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Cfg.h and Icu_EnvCfg.h are different"
+#endif
+
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((ICU_CFG_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (ICU_CFG_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Icu_Cfg.h and StandardTypes.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU configuration header file are of the same vendor */
+#if (ICU_VS_0_PBCFG_VENDOR_ID != ICU_CFG_VENDOR_ID)
+    #error "Icu_VS_0_PBcfg.h and Icu_Cfg.h have different vendor IDs"
+#endif
+/* Check if header file and Icu configuration header file are of the same Autosar version */
+#if ((ICU_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION != ICU_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION != ICU_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION != ICU_CFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_VS_0_PBcfg.h and Icu_Cfg.h are different"
+#endif
+/* Check if header file and Icu configuration header file are of the same software version */
+#if ((ICU_VS_0_PBCFG_SW_MAJOR_VERSION != ICU_CFG_SW_MAJOR_VERSION) || \
+     (ICU_VS_0_PBCFG_SW_MINOR_VERSION != ICU_CFG_SW_MINOR_VERSION) || \
+     (ICU_VS_0_PBCFG_SW_PATCH_VERSION != ICU_CFG_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_VS_0_PBcfg.h and Icu_Cfg.h are different"
+#endif
+
+/*==================================================================================================
+                                           CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+                                       DEFINES AND MACROS
+==================================================================================================*/
+#define ICU_CONFIG_EXT \
+      ICU_CONFIG_VS_0_PB \
+
+
+/** @brief Maximum number of ICU channels configured. */
+#define ICU_MAX_CHANNEL     ((Icu_ChannelType)1U)
+
+/**
+*   @brief  Switches the Development Error Detection and Notification on or off.
+*        STD_ON: Enabled.
+*        STD_OFF: Disabled.
+*   @implements ICU_DEV_ERROR_DETECT_define
+*/
+#define ICU_DEV_ERROR_DETECT            (STD_ON)
+
+/**
+*   @brief  Switch for enabling Wakeup source reporting.
+*        STD_ON: Report Wakeup source.
+*        STD_OFF: Do not report Wakeup source.
+*
+*/
+#define ICU_REPORT_WAKEUP_SOURCE        (STD_ON)
+
+/**
+* @brief Support for User mode.
+*        If this parameter has been configured to 'STD_ON', the ICU driver code can be executed from both supervisor and user mode.
+*/
+#define ICU_ENABLE_USER_MODE_SUPPORT   (STD_OFF)
+
+#ifndef MCAL_ENABLE_USER_MODE_SUPPORT
+ #ifdef ICU_ENABLE_USER_MODE_SUPPORT
+  #if (STD_ON == ICU_ENABLE_USER_MODE_SUPPORT)
+   #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
+  #endif /* (STD_ON == ICU_ENABLE_USER_MODE_SUPPORT) */
+ #endif /* ifdef ICU_ENABLE_USER_MODE_SUPPORT*/
+#endif /* ifndef MCAL_ENABLE_USER_MODE_SUPPORT */
+
+/** @brief Configuration of Optional API's. */
+/**
+*   @brief  Adds or removes the service Icu_GetVersionInfo() from the code.
+*        STD_ON: Icu_GetVersionInfo() can be used.
+*        STD_OFF: Icu_GetVersionInfo() can not be used.
+*
+*/
+#define ICU_GET_VERSION_INFO_API        (STD_ON)
+
+/**
+*   @brief  Adds or removes the service Icu_DeInit() from the code.
+*        STD_ON: Icu_DeInit() can be used. STD_OFF: Icu_DeInit() can not be used.
+*   @implements ICU_DE_INIT_API_define
+*/
+#define ICU_DE_INIT_API                 (STD_ON)
+
+/**
+*   @brief  Adds or removes the service Icu_SetMode() from the code.
+*        STD_ON: Icu_SetMode() can be used.
+*        STD_OFF: Icu_SetMode() can not be used.
+*   @implements ICU_SET_MODE_API_define
+*/
+#define ICU_SET_MODE_API                (STD_ON)
+
+/**
+*   @brief  Adds or removes the service Icu_DisableWakeup() from the code.
+*        STD_ON: Icu_DisableWakeup() can be used.
+*        STD_OFF: Icu_DisableWakeup() can not be used.
+*   @implements ICU_DISABLE_WAKEUP_API_define
+*/
+#define ICU_DISABLE_WAKEUP_API          (STD_ON)
+
+/**
+*   @brief  Adds or removes the service Icu_EnableWakeup() from the code.
+*        STD_ON: Icu_EnableWakeup() can be used.
+*        STD_OFF: Icu_EnableWakeup() can not be used.
+*   @implements ICU_ENABLE_WAKEUP_API_define
+*/
+#define ICU_ENABLE_WAKEUP_API           (STD_ON)
+
+/**
+*   @brief  Adds or removes all services related to the timestamping functionality as listed
+*        below from the code: Icu_StartTimestamp(), Icu_StopTimestamp(), Icu_GetTimestampIndex().
+*        STD_ON: The services listed above can be used.
+*        STD_OFF: The services listed above can not be used.
+*   @implements ICU_TIMESTAMP_API_define
+*/
+#define ICU_TIMESTAMP_API               (STD_ON)
+
+/**
+*   @brief  Adds or removes all services related to the edge counting functionality as listed below,
+*           from the code: Icu_ResetEdgeCount(), Icu_EnableEdgeCount(), Icu_DisableEdgeCount(),
+*           Icu_GetEdgeNumbers().
+*        STD_ON: The services listed above can be used.
+*        STD_OFF: The services listed above can not be used.
+*   @implements ICU_EDGE_COUNT_API_define
+*/
+#define ICU_EDGE_COUNT_API              (STD_ON)
+
+/**
+*   @brief  Adds or removes the service Icu_GetTimeElapsed() from the code.
+*        STD_ON: Icu_GetTimeElapsed() can be used.
+*        STD_OFF: Icu_GetTimeElapsed() can not be used.
+*   @implements ICU_GET_TIME_ELAPSED_API_define
+*/
+#define ICU_GET_TIME_ELAPSED_API        (STD_ON)
+
+/**
+*   @brief  Adds or removes the service Icu_GetDutyCycleValues() from the code.
+*        STD_ON: Icu_GetDutyCycleValues() can be used.
+*        STD_OFF: Icu_GetDutyCycleValues() can not be used.
+*   @implements ICU_GET_DUTY_CYCLE_VALUES_API_define
+*/
+#define ICU_GET_DUTY_CYCLE_VALUES_API   (STD_ON)
+
+/**
+*   @brief  Adds or removes the service Icu_GetInputState() from the code.
+*        STD_ON: Icu_GetInputState() can be used.
+*        STD_OFF: Icu_GetInputState() can not be used.
+*   @implements ICU_GET_INPUT_STATE_API_define
+*/
+#define ICU_GET_INPUT_STATE_API         (STD_ON)
+
+/**
+*   @brief  Adds or removes the services Icu_StartSignalMeasurement() and
+*          Icu_StopSignalMeasurement() from the code.
+*        STD_ON: Icu_StartSignalMeasurement() and Icu_StopSignalMeasurement() can be used.
+*        STD_OFF: Icu_StartSignalMeasurement() and Icu_StopSignalMeasurement() can not be used.
+*   @implements ICU_SIGNAL_MEASUREMENT_API_define
+*/
+#define ICU_SIGNAL_MEASUREMENT_API      (STD_ON)
+
+/**
+*   @brief  Adds or removes the service Icu_CheckWakeup() from the code.
+*        STD_ON: Icu_CheckWakeup() can be used.
+*        STD_OFF: Icu_CheckWakeup() can not be used.
+*   @implements ICU_WAKEUP_FUNCTIONALITY_API_define
+*/
+#define ICU_WAKEUP_FUNCTIONALITY_API      (STD_ON)
+
+/**
+*   @brief  Adds or removes the services Icu_EnableEdgeDetection() and Icu_DisableEdgeDetection()
+*           from the code.
+*        STD_ON: Icu_EnableEdgeDetection() and Icu_DisableEdgeDetection() can be used.
+*        STD_OFF: Icu_EnableEdgeDetection() and Icu_DisableEdgeDetection() can not be used.
+*
+*   @implements  ICU_EDGE_DETECT_API_define
+*/
+#define ICU_EDGE_DETECT_API      (STD_ON)
+
+/**
+*   @brief  Implementation specific parameter
+*        Adds or Removes the code related to overflow notification
+*        STD_ON: Overflow notification function will be called if overflow occurs
+*        STD_OFF: Overflow notification function will not be called though overflow occurs
+*
+*/
+#define ICU_OVERFLOW_NOTIFICATION_API      (STD_OFF)
+
+/**
+*   @brief   Adds or removes the service Icu_GetInputLevel() from the code.
+*         STD_ON:  Icu_GetInputLevel() can be used.
+*         STD_OFF: Icu_GetInputLevel() can not be used.
+*
+*
+*/
+#define ICU_GET_INPUT_LEVEL_API             (STD_ON)
+
+
+/**
+*   @brief   Adds / removes the service Icu_GetPulseWidth() from the code.
+*         STD_ON:  Icu_GetPulseWidth() can be used.
+*         STD_OFF: Icu_GetPulseWidth() can not be used.
+*/
+#define ICU_GET_PULSE_WIDTH_API             (STD_OFF)
+
+/**
+ * @brief  Adds or removes the support  measurement with DMA
+ *         STD_ON:  DMA measurement can be used.
+ *         STD_OFF: DMA measurement can not be used.
+ */
+
+/**
+ * @brief Adds or removes the for support Signal Measurement with DMA.
+ *        STD_ON:  DMA in SM measurement can be used.
+ *        STD_OFF: DMA in SM measurement can not be used.
+ */
+#define ICU_SIGNALMEASUREMENT_USES_DMA   (STD_OFF)
+
+/**
+ * @brief Adds or removes the support for TimeStamp Measurement with DMA.
+ *        STD_ON:  DMA in TS measurement can be used.
+ *        STD_OFF: DMA in TS measurement can not be used.
+ */
+#define ICU_TIMESTAMP_USES_DMA           (STD_OFF)
+
+#if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
+/**
+ * @brief Implementation specific.
+ *        Each channel provides a subset of the functionality available in the unified channel,
+ *        at a resolution of 32 bits.
+ */
+#define ICU_CAPTURE_REGISTER_MASK   (((Icu_ValueType)0xFFFFU))
+
+/**
+ * @brief Implementation specific.
+ *        Each channel provides a DMA resolution of 16 bits.
+ */
+#define ICU_DMA_SIZE                (DMA_IP_TRANSFER_SIZE_2_BYTE)
+
+/**
+ * @brief Implementation specific.
+ *        DMA number of bytes transfer on a minor loop is 2 bytes - for 16 bits hw registers.
+ */
+#define ICU_DMA_NUM_BYTES           (2U)
+
+/**
+ * @brief Implementation specific.
+ *        DMA offset is 16 bits HW registers.
+ */
+#define ICU_DMA_OFFSET              (2U)
+
+/** @brief Define when no MCL DMA channel is used. */
+#define NoMclDmaChannel             ((Mcl_ChannelType)0xFF)
+
+#endif /* ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON)) */
+
+/**
+*   @brief   Adds / removes the service Icu_SetClockMode() from the code.
+*         STD_ON:  Icu_SetClockMode() can be used.
+*         STD_OFF: Icu_SetClockMode() can not be used.
+*
+*/
+#define ICU_DUAL_CLOCK_MODE_API     (STD_OFF)
+
+/**
+*   @brief   Adds / removes the service Icu_GetCaptureRegisterValue() from the code.
+*         STD_ON:  Icu_GetCaptureRegisterValue() can be used.
+*         STD_OFF: Icu_GetCaptureRegisterValue() can not be used.
+*/
+#define ICU_CAPTURERGISTER_API      (STD_OFF)
+
+#define IcuChannel_0                     (IcuConf_IcuChannel_IcuChannel_0)
+#define IcuConf_IcuChannel_IcuChannel_0  ((Icu_ChannelType)0U) 
+
+
+
+
+
+
+/**
+* @brief          Number of configured partitions.
+*/
+#define ICU_MAX_PARTITIONS                    (1U)
+
+#define ICU_MULTICORE_SUPPORT             (STD_OFF)
+
+
+
+/*==================================================================================================
+                                             ENUMS
+==================================================================================================*/
+
+
+/*==================================================================================================
+                                 STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+/**
+*   @brief Implementation specific. This type shall be chosen in order to have the most efficient
+*       implementation on a specific microcontroller platform.
+*       Range: 0  to width of the timer register.
+*       Description: Width of the buffer for timestamp ticks and measured elapsed timeticks
+*/
+typedef uint16 Icu_TimerRegisterWidthType;
+
+/**
+*   @brief Implementation specific. This type shall be chosen in order to have the most efficient
+*       implementation on a specific microcontroller platform.
+*       Description: Type, to abstract the return value of the service Icu_GetTimestampIndex().
+*/
+typedef uint16 Icu_HwSpecificIndexType;
+
+/**
+*   @brief Implementation specific. This type shall be chosen in order to have the most efficient
+*       implementation on a specific microcontroller platform.
+*       Description: Type, to abstract the return value of the service Icu_GetEdgeNumbers().
+*/
+typedef uint16 Icu_HwSpecificEdgeNumberType;
+
+/*==================================================================================================
+                                     FUNCTION PROTOTYPES
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif    /* ICU_CFG_H */
+
+/** @} */

+ 108 - 0
generate/include/Icu_Ipw_Cfg.h

@@ -0,0 +1,108 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_IPW_CFG_H
+#define ICU_IPW_CFG_H
+
+/**
+ *   @file Icu_Ipw_Cfg.h
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the configuration data of the ICU driver
+ *   @details Contains the configuration data of the ICU driver
+ *   @internal
+ *   @addtogroup icu_ipw
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+                                         INCLUDE FILES
+ 1) system and project includes
+ 2) needed interfaces from external units
+ 3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Icu_Ipw_VS_0_PBcfg.h"
+
+/*==================================================================================================
+                               SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_IPW_CFG_VENDOR_ID                   43
+#define ICU_IPW_CFG_AR_RELEASE_MAJOR_VERSION    4
+#define ICU_IPW_CFG_AR_RELEASE_MINOR_VERSION    4
+#define ICU_IPW_CFG_AR_RELEASE_REVISION_VERSION 0
+#define ICU_IPW_CFG_SW_MAJOR_VERSION            1
+#define ICU_IPW_CFG_SW_MINOR_VERSION            0
+#define ICU_IPW_CFG_SW_PATCH_VERSION            0
+
+/*==================================================================================================
+                                      FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU configuration header file are of the same vendor */
+#if (ICU_IPW_CFG_VENDOR_ID != ICU_IPW_VS_0_PBCFG_VENDOR_ID)
+    #error "Icu_Ipw_Cfg.h and Icu_Ipw_VS_0_PBcfg.h have different vendor IDs"
+#endif
+    /* Check if header file and Icu configuration header file are of the same Autosar version */
+#if ((ICU_IPW_CFG_AR_RELEASE_MAJOR_VERSION != ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_CFG_AR_RELEASE_MINOR_VERSION != ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_CFG_AR_RELEASE_REVISION_VERSION != ICU_IPW_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_Cfg.h and Icu_Ipw_VS_0_PBcfg.h are different"
+#endif
+/* Check if header file and Icu configuration header file are of the same software version */
+#if ((ICU_IPW_CFG_SW_MAJOR_VERSION != ICU_IPW_VS_0_PBCFG_SW_MAJOR_VERSION) || \
+     (ICU_IPW_CFG_SW_MINOR_VERSION != ICU_IPW_VS_0_PBCFG_SW_MINOR_VERSION) || \
+     (ICU_IPW_CFG_SW_PATCH_VERSION != ICU_IPW_VS_0_PBCFG_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_Cfg.h and Icu_Ipw_VS_0_PBcfg.h are different"
+#endif
+
+/*==================================================================================================
+                                           CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+                                       DEFINES AND MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+                                             ENUMS
+==================================================================================================*/
+
+/*==================================================================================================
+                                 STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+/*==================================================================================================
+                                     FUNCTION PROTOTYPES
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* ICU_IPW_CFG_H */

+ 84 - 0
generate/include/Icu_Ipw_VS_0_PBcfg.h

@@ -0,0 +1,84 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_IPW_VS_0_PBCFG_H
+#define ICU_IPW_VS_0_PBCFG_H
+
+/**
+ *   @file           Icu_Ipw_PBcfg.h
+ *   @version        1.0.0
+ *
+ *   @brief          AUTOSAR Icu  - Icu driver configuration header file.
+ *   @details        
+ *   @internal
+ *   @addtogroup     icu_ipw
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+
+
+/*==================================================================================================
+*                              SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_IPW_VS_0_PBCFG_VENDOR_ID                    43
+#define ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION     4
+#define ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION     4
+#define ICU_IPW_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION  0
+#define ICU_IPW_VS_0_PBCFG_SW_MAJOR_VERSION             1
+#define ICU_IPW_VS_0_PBCFG_SW_MINOR_VERSION             0
+#define ICU_IPW_VS_0_PBCFG_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                      DEFINES AND MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+ *                                       GLOBAL CONSTANTS
+ *================================================================================================*/
+
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+extern const Icu_Ipw_ChannelConfigType Icu_Ipw_IpChannelConfig_PB_VS_0[1U];
+extern const Icu_Ipw_IpConfigType Icu_Ipw_IpConfig_PB_VS_0[1U];
+
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ICU_IPW_VS_0_PBCFG_H */

+ 74 - 0
generate/include/Icu_VS_0_PBcfg.h

@@ -0,0 +1,74 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef ICU_VS_0_PBCFG_H
+#define ICU_VS_0_PBCFG_H
+
+/**
+ *   @file       Icu_VS_0_PBcfg.h
+ *   @version    1.0.0
+ *
+ *   @brief      AUTOSAR Icu  - ICU driver configuration header file.
+ *   @details        
+ *
+ *   @addtogroup icu Icu Driver
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                         INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+*================================================================================================*/
+
+/*==================================================================================================
+*                              SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define ICU_VS_0_PBCFG_VENDOR_ID                    43
+#define ICU_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION     4
+#define ICU_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION     4
+#define ICU_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION  0
+#define ICU_VS_0_PBCFG_SW_MAJOR_VERSION             1
+#define ICU_VS_0_PBCFG_SW_MINOR_VERSION             0
+#define ICU_VS_0_PBCFG_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                      DEFINES AND MACROS
+==================================================================================================*/
+#define ICU_CONFIG_VS_0_PB \
+        extern const Icu_ConfigType Icu_Config_VS_0;
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* ICU_VS_0_PBCFG_H */
+

+ 1 - 0
generate/include/IntCtrl_Ip_Cfg.h

@@ -109,6 +109,7 @@ extern void LPUART_UART_IP_1_IRQHandler(void);
 extern void LPUART_UART_IP_2_IRQHandler(void);
 extern void Adc_1_Isr(void);
 extern void LPIT_0_CH_0_ISR(void);
+extern void PORT_CI_ICU_IP_A_EXT_IRQ_ISR(void);
 extern void MCL_FLEXIO_ISR(void);
 extern void CAN0_ORED_IRQHandler(void);
 extern void CAN0_Error_IRQHandler(void);

+ 93 - 0
generate/include/Lpit_Icu_Ip_Cfg.h

@@ -0,0 +1,93 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPIT_ICU_IP_CFG_H
+#define LPIT_ICU_IP_CFG_H
+
+/**
+ *   @file    Lpit_Icu_Ip_Cfg.h
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the ICU module.
+ *   @details Contains the information that will be exported by the module, as requested by AUTOSAR.
+ *
+ *   @addtogroup lpit_icu_ip LPIT IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+/* Include all variants header files. */
+#include "Lpit_Icu_Ip_VS_0_PBcfg.h"
+/*==================================================================================================
+*                                 SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPIT_ICU_IP_CFG_VENDOR_ID                    43
+#define LPIT_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION     4
+#define LPIT_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION     4
+#define LPIT_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION  0
+#define LPIT_ICU_IP_CFG_SW_MAJOR_VERSION             1
+#define LPIT_ICU_IP_CFG_SW_MINOR_VERSION             0
+#define LPIT_ICU_IP_CFG_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if header file and ICU Lpit_Icu_Ip_Cfg.h header file are of the same vendor */
+#if (LPIT_ICU_IP_VS_0_PBCFG_VENDOR_ID != LPIT_ICU_IP_CFG_VENDOR_ID)
+    #error "Lpit_Icu_Ip_VS_0_PBcfg.h and Lpit_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+    /* Check if header file and Icu Lpit_Icu_Ip_Cfg header file are of the same Autosar version */
+#if ((LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION    != LPIT_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION    != LPIT_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION) )
+#error "AutoSar Version Numbers of Lpit_Icu_Ip_VS_0_PBcfg.h and Lpit_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if header file and Icu Lpit_Icu_Ip_Cfg.h header file are of the same software version */
+#if ( (LPIT_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION != LPIT_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+      (LPIT_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION != LPIT_ICU_IP_CFG_SW_MINOR_VERSION) || \
+      (LPIT_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION != LPIT_ICU_IP_CFG_SW_PATCH_VERSION) )
+#error "Software Version Numbers of Lpit_Icu_Ip_VS_0_PBcfg.h and Lpit_Icu_Ip_Cfg.h are different"
+#endif
+
+/*==================================================================================================
+*                                       DEFINES AND MACROS
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* LPIT_ICU_IP_CFG_H */
+

+ 115 - 0
generate/include/Lpit_Icu_Ip_Defines.h

@@ -0,0 +1,115 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPIT_ICU_IP_DEFINES
+#define LPIT_ICU_IP_DEFINES
+
+/**
+ * @file    Lpit_Icu_Ip_Defines.h
+ * @version 1.0.0
+ *
+ * @addtogroup lpit_icu_ip LPIT IPL
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                         INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "StandardTypes.h"
+/* Include platform header file. */
+#include "S32K146_LPIT.h"
+
+/*==================================================================================================
+*                              SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPIT_ICU_IP_DEFINES_VENDOR_ID                    43
+#define LPIT_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION     4
+#define LPIT_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION     4
+#define LPIT_ICU_IP_DEFINES_AR_RELEASE_REVISION_VERSION  0
+#define LPIT_ICU_IP_DEFINES_SW_MAJOR_VERSION             1
+#define LPIT_ICU_IP_DEFINES_SW_MINOR_VERSION             0
+#define LPIT_ICU_IP_DEFINES_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+===================================================================================================*/
+/* Check if header file and StandardTypes.h are of the same AUTOSAR version */
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((LPIT_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (LPIT_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AUTOSAR version numbers of Lpit_Icu_Ip.h and StandardTypes.h are different."
+    #endif
+#endif
+
+/*==================================================================================================
+*                                       DEFINES AND MACROS
+==================================================================================================*/
+/* Macros that indicate LPIT instances used by ICU. */
+
+/* MIER start bit mask. */
+#define LPIT_MIER_TIE_START_MASK                (uint32)0x1U
+
+/* MSR start bit mask. */
+#define LPIT_MSR_TIF_START_MASK                 (uint32)0x1U
+
+/* Channels trigger select defines. */
+#define LPIT_ICU_TRG_CH0                        ((uint8)0U)
+#define LPIT_ICU_TRG_CH1                        ((uint8)1U)
+#define LPIT_ICU_TRG_CH2                        ((uint8)2U)
+#define LPIT_ICU_TRG_CH3                        ((uint8)3U)
+
+/* Channels trigger source defines. */
+#define LPIT_ICU_CH_INTERNAL_TRIGGER            ((uint8)1U)
+#define LPIT_ICU_CH_EXTERNAL_TRIGGER            ((uint8)0U)
+
+/** @brief Switches the Development Error Detection and Notification on or off.  */
+#define LPIT_ICU_IP_DEV_ERROR_DETECT            (STD_ON)
+
+/** @brief Adds or removes all services related to the deinitialization functionality. */
+#define LPIT_ICU_DEINIT_API                     (STD_ON)
+
+/** @brief Adds or removes all services related to edge detect functionality. */
+#define LPIT_ICU_EDGE_DETECT_API                (STD_ON)
+
+/** @brief Adds or removes all services related to the timestamp functionality. */
+#define LPIT_ICU_TIMESTAMP_API                  (STD_ON)
+
+/** @brief Adds or removes all services related to input state functionality. */
+#define LPIT_ICU_GET_INPUT_STATE_API            (STD_ON)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* LPIT_ICU_IP_DEFINES */
+
+/** @} */
+

+ 92 - 0
generate/include/Lpit_Icu_Ip_VS_0_PBcfg.h

@@ -0,0 +1,92 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPIT_ICU_IP_VS_0_PBCFG_H
+#define LPIT_ICU_IP_VS_0_PBCFG_H
+
+/**
+ * @file    Lpit_Icu_VS_0_PBcfg.h
+ * @version 1.0.0
+ *
+ * @brief   AUTOSAR Icu - contains the data exported by the ICU module.
+ * @details Contains the information that will be exported by the module, as requested by AUTOSAR.
+ *
+ * @addtogroup lpit_icu_ip LPIT IPL
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                         INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lpit_Icu_Ip_Types.h"
+
+/*==================================================================================================
+*                                 SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPIT_ICU_IP_VS_0_PBCFG_VENDOR_ID                    43
+#define LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION     4
+#define LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION     4
+#define LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION  0
+#define LPIT_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION             1
+#define LPIT_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION             0
+#define LPIT_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if header file and ICU Lpit_Icu_Ip_Types.h file are of the same vendor. */
+#if (LPIT_ICU_IP_VS_0_PBCFG_VENDOR_ID != LPIT_ICU_IP_TYPES_VENDOR_ID)
+    #error "Lpit_Icu_Ip_VS_0_PBcfg.h and Lpit_Icu_Ip_Types.h have different vendor IDs!"
+#endif
+/* Check if header file and ICU Lpit_Icu_Ip_Types.h file are of the same AutoSar version */
+#if ((LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION    != LPIT_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION    != LPIT_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION != LPIT_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lpit_Icu_Ip_VS_0_PBcfg.h and Lpit_Icu_Ip_Types.h are different!"
+#endif
+/* Check if header file and ICU Lpit_Icu_Ip_Types.h file are of the same Software version */
+#if ((LPIT_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION != LPIT_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION != LPIT_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (LPIT_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION != LPIT_ICU_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Lpit_Icu_Ip_VS_0_PBcfg.h and Lpit_Icu_Ip_Types.h are different!"
+#endif
+
+/*==================================================================================================
+*                                        GLOBAL CONSTANTS
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* LPIT_ICU_IP_VS_0_PBCFG_H */

+ 1 - 1
generate/include/Lpspi_Ip_Cfg.h

@@ -185,7 +185,7 @@ extern "C"{
 * @brief Define Timeout Method.
 * @details Define a certain timeout method from OsIf will be used in the driver.
 */
-#define LPSPI_IP_TIMEOUT_METHOD           (OSIF_COUNTER_SYSTEM)
+#define LPSPI_IP_TIMEOUT_METHOD           (OSIF_COUNTER_DUMMY)
 
 /**
 * @brief Switches ON or OFF for the detection and reporting of development errors(API parameter checking) at IP level.

+ 3 - 2
generate/include/Lptmr_Gpt_Ip_Cfg_Defines.h

@@ -77,12 +77,13 @@ extern "C"{
 /**
 * @brief These defines indicate that at least one channel from each module is used in all configurations.
 */
-#define LPTMR_GPT_IP_USED (STD_OFF)
+#define LPTMR_GPT_IP_USED (STD_ON)
 
 /**
 * @brief IRQ Defines for each channel used
 */
-
+                    #define LPTMR_0_CH_0_ISR_USED
+                
 /**
 * @brief    LPTMR_GPT_IP_SET_CLOCK_MODE 
 * @details  SET_CLOCK_MODE is not supported in this release

+ 105 - 0
generate/include/Lptmr_Icu_Ip_Cfg.h

@@ -0,0 +1,105 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPTMR_ICU_IP_CFG_H
+#define LPTMR_ICU_IP_CFG_H
+
+/**
+ *   @file    Lptmr_Icu_Ip_Cfg.h
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the ICU module.
+ *   @details Contains the information that will be exported by the module, as requested by AUTOSAR.
+ *
+ *   @addtogroup lptmr_icu_ip LPTMR IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+/* Include all variants header files. */
+#include "StandardTypes.h"
+#include "Lptmr_Icu_Ip_VS_0_PBcfg.h"
+
+/*==================================================================================================
+*                                 SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPTMR_ICU_IP_CFG_VENDOR_ID                    43
+#define LPTMR_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION     4
+#define LPTMR_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION     4
+#define LPTMR_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION  0
+#define LPTMR_ICU_IP_CFG_SW_MAJOR_VERSION             1
+#define LPTMR_ICU_IP_CFG_SW_MINOR_VERSION             0
+#define LPTMR_ICU_IP_CFG_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if header file and StandardTypes.h file are of the same Autosar version */
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((LPTMR_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (LPTMR_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Lptmr_Icu_Ip_Cfg.h and StandardTypes.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU configuration header file are of the same vendor */
+#if (LPTMR_ICU_IP_VS_0_PBCFG_VENDOR_ID != LPTMR_ICU_IP_CFG_VENDOR_ID)
+    #error "Lptmr_Icu_Ip_VS_0_PBcfg.h and Lptmr_Icu_Ip_Cfg.h have different vendor IDs"
+#endif
+    /* Check if header file and Icu configuration header file are of the same Autosar version */
+#if ((LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION != LPTMR_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION != LPTMR_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION != LPTMR_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION) \
+    )
+#error "AutoSar Version Numbers of Lptmr_Icu_Ip_VS_0_PBcfg.h and Lptmr_Icu_Ip_Cfg.h are different"
+#endif
+/* Check if header file and Icu configuration header file are of the same software version */
+#if ((LPTMR_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION != LPTMR_ICU_IP_CFG_SW_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION != LPTMR_ICU_IP_CFG_SW_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION != LPTMR_ICU_IP_CFG_SW_PATCH_VERSION) \
+    )
+#error "Software Version Numbers of Lptmr_Icu_Ip_VS_0_PBcfg.h and Lptmr_Icu_Ip_Cfg.h are different"
+#endif
+
+/*==================================================================================================
+*                                       DEFINES AND MACROS
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* LPTMR_ICU_IP_CFG_H */
+

+ 142 - 0
generate/include/Lptmr_Icu_Ip_Defines.h

@@ -0,0 +1,142 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPTMR_ICU_IP_DEFINES_H
+#define LPTMR_ICU_IP_DEFINES_H
+
+/**
+*   @file
+*
+*   @addtogroup lptmr_icu_ip LPTMR IPL
+*   @{
+*/
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+#include "StandardTypes.h"
+/* Include platform header file. */
+#include "S32K146_LPTMR.h"
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define LPTMR_ICU_IP_DEFINES_VENDOR_ID                       43
+#define LPTMR_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION        4
+#define LPTMR_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION        4
+#define LPTMR_ICU_IP_DEFINES_AR_RELEASE_REVISION_VERSION     0
+#define LPTMR_ICU_IP_DEFINES_SW_MAJOR_VERSION                1
+#define LPTMR_ICU_IP_DEFINES_SW_MINOR_VERSION                0
+#define LPTMR_ICU_IP_DEFINES_SW_PATCH_VERSION                0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if header file and Std_Types.h file are of the same Autosar version */
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((LPTMR_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (LPTMR_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Lptmr_Icu_Ip_Defines.h and Std_Types.h are different"
+    #endif
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                       DEFINES AND MACROS
+==================================================================================================*/
+/* Macros that indicate LPTMR instances used by ICU. */
+
+/** @brief Switches the Development Error Detection and Notification on or off.  */
+#define LPTMR_ICU_IP_DEV_ERROR_DETECT        (STD_ON)
+
+/** @brief The number of LPTMR instances available on platform */
+#define LPTMR_ICU_IP_NUM_OF_MODULES          (1U)
+
+/** @brief Adds or removes all services related to the edge detect functionality. */
+#define LPTMR_ICU_EDGE_DETECT_API            (STD_ON)
+
+/** @brief */
+#define LPTMR_ICU_STANDBY_WAKEUP_SUPPORT     (STD_ON)
+
+/** @brief Adds or removes all services related to the deinitialization functionality. */
+#define LPTMR_ICU_DEINIT_API                 (STD_ON)
+
+/** @brief Adds or removes all services related to mode set functionality. */
+#define LPTMR_ICU_SET_MODE_API               (STD_ON)
+
+/** @brief Adds or removes all services related to edge count functionality. */
+#define LPTMR_ICU_EDGE_COUNT_API             (STD_ON)
+
+/** @brief Adds or removes all services related to input state functionality. */
+#define LPTMR_ICU_GET_INPUT_STATE_API        (STD_ON)
+
+/** @brief Support for User mode.If this parameter has been configured to 'STD_ON',
+ *  the LPTMR driver code can be executed from both supervisor and user mode. */
+#define LPTMR_ICU_ENABLE_USER_MODE_SUPPORT   (STD_OFF)
+
+/* Verification for user mode support. */
+#ifndef MCAL_ENABLE_USER_MODE_SUPPORT
+ #if (defined (LPTMR_ICU_ENABLE_USER_MODE_SUPPORT) && (STD_ON == LPTMR_ICU_ENABLE_USER_MODE_SUPPORT))
+    #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
+ #endif
+#endif
+
+
+/** @brief Get LPTMR type for each platform. */
+#define Lptmr_Icu_Ip_BaseType                   LPTMR_Type
+
+/*==================================================================================================
+*                                              ENUMS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                  GLOBAL VARIABLE DECLARATIONS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                       FUNCTION PROTOTYPES
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* LPTMR_ICU_IP_DEFINES_H */
+
+/** @} */
+

+ 97 - 0
generate/include/Lptmr_Icu_Ip_VS_0_PBcfg.h

@@ -0,0 +1,97 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef LPTMR_ICU_IP_VS_0_PBCFG_H
+#define LPTMR_ICU_IP_VS_0_PBCFG_H
+
+/**
+ *   @file    Lptmr_Icu_VS_0_PBCfg.h
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the ICU module.
+ *   @details Contains the information that will be exported by the module, as requested by AUTOSAR.
+ *
+ *   @addtogroup lptmr_icu_ip LPTMR IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lptmr_Icu_Ip_Types.h"
+
+/*==================================================================================================
+*                                 SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPTMR_ICU_IP_VS_0_PBCFG_VENDOR_ID                    43
+#define LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION     4
+#define LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION     4
+#define LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION  0
+#define LPTMR_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION             1
+#define LPTMR_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION             0
+#define LPTMR_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (LPTMR_ICU_IP_VS_0_PBCFG_VENDOR_ID != LPTMR_ICU_IP_TYPES_VENDOR_ID)
+    #error "Lptmr_Icu_Ip_PBcfg.h and Lptmr_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION  != LPTMR_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION  != LPTMR_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION   != LPTMR_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lptmr_Icu_Ip_PBcfg.h and Lptmr_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((LPTMR_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION  != LPTMR_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION  != LPTMR_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION  != LPTMR_ICU_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Lptmr_Icu_Ip_PBcfg.h and Lptmr_Icu_Ip_Types.h are different"
+#endif
+
+/*==================================================================================================
+*                                            CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                       DEFINES AND MACROS
+==================================================================================================*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* LPTMR_ICU_IP_VS_0_PBCFG_H */

+ 3 - 3
generate/include/Lpuart_Uart_Ip_Defines.h

@@ -77,16 +77,16 @@ extern "C"{
 ==================================================================================================*/
 
 /* @brief Development error detection */
-#define LPUART_UART_IP_DEV_ERROR_DETECT             (STD_ON)
+#define LPUART_UART_IP_DEV_ERROR_DETECT             (STD_OFF)
 
 /* @brief Number of available hardware instances */
 #define LPUART_UART_IP_NUMBER_OF_INSTANCES          (3U) /*!< Number of available hardware instances */
 
 /* @brief Uart Osif source counter. This parameter is used to select between different OsIf counter implementation */
-#define LPUART_UART_IP_TIMEOUT_TYPE                 (OSIF_COUNTER_SYSTEM)
+#define LPUART_UART_IP_TIMEOUT_TYPE                 (OSIF_COUNTER_DUMMY)
 
 /* @brief Number of loops before returning LPUART_STATUS_TIMEOUT.*/
-#define LPUART_UART_IP_TIMEOUT_VALUE_US             (100000U)
+#define LPUART_UART_IP_TIMEOUT_VALUE_US             (10000U)  //zhengchao
 
 /* @brief LPUART DMA support */
 #define LPUART_UART_IP_HAS_DMA_ENABLED              (STD_ON)

+ 18 - 3
generate/include/Mcu_Cfg.h

@@ -324,7 +324,7 @@ extern "C"{
 /**
 * @brief            Enable the usage of Non-Autosar API Mcu_GetPowerMode_State() for getting infos system platform configuration.
 */
-#define MCU_POWERMODE_STATE_API   (STD_OFF)
+#define MCU_POWERMODE_STATE_API   (STD_ON)
 
 /**
 * @brief            Enable the usage of Non-Autosar API Mcu_GetPowerDomain_Status. Get PMU state: operable or not.
@@ -397,7 +397,7 @@ extern "C"{
 * @brief            ISR Mcu_VoltageError_ISR is/isn't available (STD_ON/STD_OFF)
 */
 #if (MCU_CMU_PMC_SCG_INTERRUPT == STD_ON)
-#define MCU_VOLTAGE_ERROR_ISR_USED   (STD_OFF)
+#define MCU_VOLTAGE_ERROR_ISR_USED   (STD_ON)
 #endif
 /**
 * @brief            Maximum number of MCU Clock configurations.
@@ -408,7 +408,7 @@ extern "C"{
 /**
 * @brief            Maximum number of MCU Mode configurations.
 */
-#define MCU_MAX_MODECONFIGS   ((uint32)1U)
+#define MCU_MAX_MODECONFIGS   ((uint32)4U)
 
 
 /**
@@ -660,6 +660,21 @@ typedef uint32 Mcu_PowerModeStateType;
 #define McuConf_McuModeSettingConf_McuModeSettingConf_Run   ((Mcu_ModeType)0U)
 
 
+#define McuModeSettingConf_STOP1   ((Mcu_ModeType)1U)
+
+#define McuConf_McuModeSettingConf_McuModeSettingConf_STOP1   ((Mcu_ModeType)1U)
+
+
+#define McuModeSettingConf_VLPS   ((Mcu_ModeType)2U)
+
+#define McuConf_McuModeSettingConf_McuModeSettingConf_VLPS   ((Mcu_ModeType)2U)
+
+
+#define McuModeSettingConf_VLPR   ((Mcu_ModeType)3U)
+
+#define McuConf_McuModeSettingConf_McuModeSettingConf_VLPR   ((Mcu_ModeType)3U)
+
+
 /**
 * @brief            Create defines with the IDs assigned to Mcu RAM Section configurations.
 *                   These IDs will be transmitted as input parameters for Mcu_InitRamSection() API.

+ 1 - 1
generate/include/OsIf_Cfg.h

@@ -106,7 +106,7 @@ extern "C"{
 
 #define OSIF_DEV_ERROR_DETECT            (STD_OFF)
 
-#define USING_OS_BAREMETAL
+#define USING_OS_FREERTOS
 
 #define OSIF_USE_SYSTEM_TIMER            (STD_ON)
 

+ 3 - 2
generate/include/Os_cfg.h

@@ -93,8 +93,9 @@ extern "C" {
 *                                       DEFINES AND MACROS
 ==================================================================================================*/
     #define OsCounter_0   0
-    #define OS_TICKS2NS_OsCounter_0(x) 10000U 
-    #define OS_TICKS2US_OsCounter_0(x) 10U 
+    #define OS_TICKS2NS_OsCounter_0(x) 1000000000000U 
+
+    #define OS_TICKS2US_OsCounter_0(x) 1000000000U 
 
 
 /*==================================================================================================

+ 2 - 2
generate/include/Port_Cfg.h

@@ -530,13 +530,13 @@ PORT_CONFIG_VS_0_PB \
 * @brief Use/remove Port_SetAsUnusedPin/Port_SetAsUsedPin function from the compiled driver.
 *
 */
-#define PORT_SET_AS_UNUSED_PIN_API           (STD_OFF)
+#define PORT_SET_AS_UNUSED_PIN_API           (STD_ON)
 
 /**
 * @brief Use/remove Port_ResetPinMode function from the compiled driver.
 *
 */
-#define PORT_RESET_PIN_MODE_API           (STD_OFF)
+#define PORT_RESET_PIN_MODE_API           (STD_ON)
 
 /**
 * @brief Enable/Disable Port_SetPinMode function updating the output level of the pins configured at runtime as GPIO

+ 103 - 0
generate/include/Port_Ci_Icu_Ip_Cfg.h

@@ -0,0 +1,103 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef PORT_CI_ICU_IP_CFG_H
+#define PORT_CI_ICU_IP_CFG_H
+
+/**
+ *   @file       Port_Ci_Icu_Ip_Cfg.h
+ *   @version    1.0.0
+ *
+ *   @brief      AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details    Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup port_ci_icu_ip PORT_CI IPL
+ *   @{
+ */
+ 
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+#include "StandardTypes.h"
+#include "Port_Ci_Icu_Ip_VS_0_PBcfg.h"
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define PORT_CI_ICU_IP_CFG_VENDOR_ID                       43
+#define PORT_CI_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION        4
+#define PORT_CI_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION        4
+#define PORT_CI_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION     0
+#define PORT_CI_ICU_IP_CFG_SW_MAJOR_VERSION                1
+#define PORT_CI_ICU_IP_CFG_SW_MINOR_VERSION                0
+#define PORT_CI_ICU_IP_CFG_SW_PATCH_VERSION                0
+
+/*==================================================================================================
+ *                                      FILE VERSION CHECKS
+ *================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and StandardTypes.h file are of the same Autosar version */
+    #if ((PORT_CI_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (PORT_CI_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Cfg.h and StandardTypes.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU configuration header file are of the same vendor */
+#if (PORT_CI_ICU_IP_CFG_VENDOR_ID != PORT_CI_ICU_IP_VS_0_PBCFG_VENDOR_ID)
+    #error "Port_Ci_Icu_Ip_Cfg.h and Port_Ci_Icu_Ip_VS_0_PBcfg.h have different vendor IDs"
+#endif
+    /* Check if header file and Icu configuration header file are of the same Autosar version */
+#if ((PORT_CI_ICU_IP_CFG_AR_RELEASE_MAJOR_VERSION != PORT_CI_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_CFG_AR_RELEASE_MINOR_VERSION != PORT_CI_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_CFG_AR_RELEASE_REVISION_VERSION != PORT_CI_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION) \
+    )
+#error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Cfg.h and Port_Ci_Icu_Ip_VS_0_PBcfg.h are different"
+#endif
+/* Check if header file and Icu configuration header file are of the same software version */
+#if ((PORT_CI_ICU_IP_CFG_SW_MAJOR_VERSION != PORT_CI_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_CFG_SW_MINOR_VERSION != PORT_CI_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_CFG_SW_PATCH_VERSION != PORT_CI_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION) \
+    )
+#error "Software Version Numbers of Port_Ci_Icu_Ip_Cfg.h and Port_Ci_Icu_Ip_VS_0_PBcfg.h are different"
+#endif
+/*==================================================================================================
+                                       DEFINES AND MACROS
+==================================================================================================*/
+#define PORT_CI_ICU_CONFIG_EXT \
+ PORT_CI_ICU_CONFIG_VS_0_PB \
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* PORT_CI_ICU_IP_CFG_H */

+ 135 - 0
generate/include/Port_Ci_Icu_Ip_Defines.h

@@ -0,0 +1,135 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef PORT_CI_ICU_IP_DEFINES_H
+#define PORT_CI_ICU_IP_DEFINES_H
+
+/**
+ *   @file       Port2_Icu_Ip_Defines.h
+ *   @version    1.0.0
+ *
+ *   @brief      AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details    Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup port2_icu_ip PORT_CI IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+#include "StandardTypes.h"
+/* Include platform header file. */
+#include "S32K146_PORT.h"
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define PORT_CI_ICU_IP_DEFINES_VENDOR_ID                      43
+#define PORT_CI_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION       4
+#define PORT_CI_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION       4
+#define PORT_CI_ICU_IP_DEFINES_AR_RELEASE_REVISION_VERSION    0
+#define PORT_CI_ICU_IP_DEFINES_SW_MAJOR_VERSION               1
+#define PORT_CI_ICU_IP_DEFINES_SW_MINOR_VERSION               0
+#define PORT_CI_ICU_IP_DEFINES_SW_PATCH_VERSION               0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and StandardTypes.h file are of the same Autosar version */
+    #if ((PORT_CI_ICU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (PORT_CI_ICU_IP_DEFINES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_Defines.h and StandardTypes.h are different"
+    #endif
+#endif
+
+/*==================================================================================================
+*                                       DEFINES AND MACROS
+==================================================================================================*/
+/* Macros that indicate PORT instances used by ICU. */
+/** @brief PORT 0 ISR enable/disable */
+#define PORT_CI_ICU_IP_PORT_0_ISR_USED        (STD_ON)
+
+/**
+* @brief PORT CI channels defines
+*/
+/*
+ * PORT CI channel encoding
+ *
+ * [              4 bit | 5 bit                ]
+ * [ module id: 15 ... 0 | channel id: 31 ... 0 ]
+ */
+#define ICU_PORT_CI_MOD_MASK_U16                                      ((uint16)0x1E0)
+#define ICU_PORT_CI_MOD_SHIFT                                         ((uint16)5U)
+#define ICU_PORT_CI_CH_MASK_U16                                       ((uint16)0x1F)
+#define ICU_PORT_CI_CH_SHIFT                                          ((uint16)0U)
+
+/* PORT CI module and channel decoding */
+#define ICU_PORT_CI_MODULE_INDEX_U8(ch)      ((uint8)(((ch) & ICU_PORT_CI_MOD_MASK_U16) >> ICU_PORT_CI_MOD_SHIFT))
+#define ICU_PORT_CI_CHANNEL_INDEX_U8(ch)     ((uint8)(((ch) & ICU_PORT_CI_CH_MASK_U16)  >> ICU_PORT_CI_CH_SHIFT))
+
+/** @brief   Get A number of PORT_CI hardware modules from resource file*/
+#define ICU_NUM_PORT_CI_HW_MODULE_U8  ((uint8)5U)
+
+/** @brief Switches the Development Error Detection and Notification on or off.  */
+#define PORT_CI_ICU_IP_DEV_ERROR_DETECT        (STD_ON)
+
+/** @brief Adds or removes all services related to mode set functionality. */
+#define PORT_CI_ICU_IP_SET_MODE_API               (STD_ON)
+
+/** @brief Add or remove all functions related to input state. */
+#define PORT_CI_ICU_IP_GET_INPUT_STATE_API        (STD_ON)
+
+/** @brief Adds or removes all services related to the edge detect functionality. */
+#define PORT_CI_ICU_IP_EDGE_DETECT_API              (STD_ON)
+
+/** @brief Adds or removes all services related to the deinitialization functionality. */
+#define PORT_CI_ICU_IP_DEINIT_API              (STD_ON)
+
+/** @brief Support for User mode. If this parameter has been configured to 'STD_ON', the FTM driver 
+ *         code can be executed from both supervisor and user mode. */
+#define PORT_CI_ICU_IP_ENABLE_USER_MODE_SUPPORT   (STD_OFF)
+
+/* Verification for user mode support. */
+#ifndef MCAL_ENABLE_USER_MODE_SUPPORT
+    #if (defined (PORT_CI_ICU_IP_ENABLE_USER_MODE_SUPPORT) && (STD_ON == PORT_CI_ICU_IP_ENABLE_USER_MODE_SUPPORT))
+        #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
+    #endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif  /* PORT_CI_ICU_IP_DEFINES_H */

+ 96 - 0
generate/include/Port_Ci_Icu_Ip_VS_0_PBcfg.h

@@ -0,0 +1,96 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+#ifndef PORT_CI_ICU_IP_VS_0_PBCFG_H
+#define PORT_CI_ICU_IP_VS_0_PBCFG_H
+
+/**
+ *   @file    Port_Ci_Icu_Ip_VS_0_PBcfg.h
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup port_ci_icu_ip PORT_CI IPL
+ *   @{
+ */
+ 
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+#include "Port_Ci_Icu_Ip_Types.h"
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define PORT_CI_ICU_IP_VS_0_PBCFG_VENDOR_ID                    43
+#define PORT_CI_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION     4
+#define PORT_CI_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION     4
+#define PORT_CI_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION  0
+#define PORT_CI_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION             1
+#define PORT_CI_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION             0
+#define PORT_CI_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION             0
+
+/*==================================================================================================
+ *                                      FILE VERSION CHECKS
+ *================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (PORT_CI_ICU_IP_VS_0_PBCFG_VENDOR_ID != PORT_CI_ICU_IP_TYPES_VENDOR_ID)
+    #error "Port_Ci_Icu_Ip_VS_0_PBcfg.h and Port_Ci_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((PORT_CI_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION    != PORT_CI_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION    != PORT_CI_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION != PORT_CI_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Port_Ci_Icu_Ip_VS_0_PBcfg.h and Port_Ci_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((PORT_CI_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION != PORT_CI_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (PORT_CI_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION != PORT_CI_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (PORT_CI_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION != PORT_CI_ICU_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Port_Ci_Icu_Ip_VS_0_PBcfg.h and Port_Ci_Icu_Ip_Types.h are different"
+#endif
+
+/*==================================================================================================
+ *                                       DEFINES AND MACROS
+ *================================================================================================*/
+#define PORT_CI_ICU_CONFIG_VS_0_PB \
+extern const Port_Ci_Icu_Ip_ChannelConfigType Port_Ci_Icu_Ip_0_ChannelConfig_PB_VS_0[1U]; \
+extern const Port_Ci_Icu_Ip_ConfigType Port_Ci_Icu_Ip_0_Config_PB_VS_0; \
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif /* PORT_CI_ICU_IP_VS_0_PBCFG_H */
+

+ 1 - 1
generate/include/Port_Ci_Port_Ip_Defines.h

@@ -92,7 +92,7 @@ extern "C"{
 #endif /* ifndef MCAL_ENABLE_USER_MODE_SUPPORT */
 
 /* Pre-processor switch to enable/disable development error detection for Port_Ci Ip API */
-#define PORT_CI_PORT_IP_DEV_ERROR_DETECT         (STD_OFF)
+#define PORT_CI_PORT_IP_DEV_ERROR_DETECT         (STD_ON)
 
 /*==================================================================================================
 *                                             ENUMS

+ 3 - 3
generate/include/Power_Ip_Cfg_Defines.h

@@ -88,7 +88,7 @@ extern "C"{
 /**
 * @brief            Support for Low Power mode.
 */
-#define MCU_ENTER_LOW_POWER_MODE   (STD_OFF)
+#define MCU_ENTER_LOW_POWER_MODE   (STD_ON)
 
 
 /**
@@ -106,7 +106,7 @@ extern "C"{
 /**
 * @brief            ISR Mcu_PMC_UnderOverVoltage_ISR is/isn't available (STD_ON/STD_OFF)
 */
-#define POWER_IP_VOLTAGE_ERROR_ISR_USED              (STD_OFF)
+#define POWER_IP_VOLTAGE_ERROR_ISR_USED              (STD_ON)
 
 /**
 * @brief            Enable the usage of Non-Autosar Peripheral CMU.
@@ -133,7 +133,7 @@ extern "C"{
 /**
 * @brief            Enable the usage of Non-Autosar API Mcu_GetPowerMode_State() for getting infos system platform configuration.
 */
-#define POWER_IP_POWERMODE_STATE_API   (STD_OFF)
+#define POWER_IP_POWERMODE_STATE_API   (STD_ON)
 
 /**
 * @brief            If this parameter is set to TRUE, the System Mode Controller (SMC) initialization has to be disabled in the MCU driver.

+ 2 - 2
generate/include/Uart_Defines.h

@@ -80,7 +80,7 @@ extern "C"
 #define UART_PRECOMPILE_SUPPORT         (STD_ON)
 
 /* @brief Enables / Disables DET development errors detection and reporting */
-#define UART_DEV_ERROR_DETECT           (STD_ON)
+#define UART_DEV_ERROR_DETECT           (STD_OFF)
 
 /* @brief Enables / Disables Runtime errors detection and reporting */
 #define UART_RUNTIME_ERROR_DETECT       (STD_ON)
@@ -89,7 +89,7 @@ extern "C"
 #define UART_CH_MAX_CONFIG              (3U)
 
 /* @brief UART Osif source counter. This parameter is used to select between different OsIf counter implementation */
-#define UART_TIMEOUT_TYPE               (OSIF_COUNTER_SYSTEM)
+#define UART_TIMEOUT_TYPE               (OSIF_COUNTER_DUMMY)
 
 /* @brief Number of loops before returning Timeout status */
 #define UART_TIMEOUT_VALUE_US           (100000U)

+ 2 - 2
generate/include/Wdg_Cfg_Defines.h

@@ -219,8 +219,8 @@ extern "C"{
 * @brief  This macros indicate the Wdg timeout value for Wdg module.
 */
 
-#define WDG_TIMEOUT_VALUE_ARRAY {{(uint32)0,(uint32)500, (uint32)500}, \
-{(uint32) 0, (uint32)1, (uint32) 0} \
+#define WDG_TIMEOUT_VALUE_ARRAY {{(uint32)0,(uint32)500, (uint32)100}, \
+{(uint32) 0, (uint32)2, (uint32) 0} \
 }
 
 /*==================================================================================================

+ 3 - 3
generate/include/Wdg_Ipw_Cfg_Defines.h

@@ -149,14 +149,14 @@ extern "C"{
 /**
 * @brief  These variables will indicate the Wdg Initial Timeout and Wdg Max Timeout parameters in miliseconds for Wdg module 0
 */
-#define WDG_IPW_INSTANCE0_INITIAL_TIMEOUT_U16 ((uint16)1)
-#define WDG_IPW_INSTANCE0_MAX_TIMEOUT_U16 ((uint16)8)
+#define WDG_IPW_INSTANCE0_INITIAL_TIMEOUT_U16 ((uint16)200)
+#define WDG_IPW_INSTANCE0_MAX_TIMEOUT_U16 ((uint16)10000)
 
 /**
 * @brief  These variables will indicate the Wdg Initial Timeout and Wdg Max Timeout parameters in miliseconds for Wdg module 1
 */
 #define WDG_IPW_INSTANCE1_INITIAL_TIMEOUT_U16 ((uint16)1)
-#define WDG_IPW_INSTANCE1_MAX_TIMEOUT_U16 ((uint16)8)
+#define WDG_IPW_INSTANCE1_MAX_TIMEOUT_U16 ((uint16)10)
 
 /*==================================================================================================
                                        LOCAL CONSTANTS

+ 1 - 1
generate/include/modules.h

@@ -198,7 +198,7 @@ extern "C" {
 * @brief This constant used for other modules to check if ICU is present in the project.  
 * @violates @ref modules_h_REF_1 MISRA 2012 Advisory Rule 2.5, unused macro. 
 */
-#define USE_ICU_MODULE              (STD_OFF)
+#define USE_ICU_MODULE              (STD_ON)
 
 /** 
 * @brief This constant used for other modules to check if LIN is present in the project.  

+ 141 - 0
generate/src/Cmp_Ip_VS_0_PBcfg.c

@@ -0,0 +1,141 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *   @file    Cmp_Ip_VS_0_PBcfg.c
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the ICU module
+ *   @details Contains the information that will be exported by the module, as requested by AUTOSAR.
+ *
+ *   @addtogroup cmp_ip CMP IPL
+ *   @{
+ */
+ 
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+#include "StandardTypes.h"
+#include "Cmp_Ip_Types.h"
+#include "Icu_Ipw_Irq.h"
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define CMP_IP_VS_0_PBCFG_VENDOR_ID_C                    43
+#define CMP_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C     4
+#define CMP_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C     4
+#define CMP_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C  0
+#define CMP_IP_VS_0_PBCFG_SW_MAJOR_VERSION_C             1
+#define CMP_IP_VS_0_PBCFG_SW_MINOR_VERSION_C             0
+#define CMP_IP_VS_0_PBCFG_SW_PATCH_VERSION_C             0
+
+/*==================================================================================================
+ *                                      FILE VERSION CHECKS
+ *================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and StandardTypes.h file are of the same Autosar version */
+    #if ((CMP_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (CMP_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Cmp_Ip_VS_0_PBcfg.c and StandardTypes.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (CMP_IP_VS_0_PBCFG_VENDOR_ID_C != CMP_IP_TYPES_VENDOR_ID)
+    #error "Cmp_Ip_VS_0_PBcfg.c and Cmp_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((CMP_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C    != CMP_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (CMP_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C    != CMP_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (CMP_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != CMP_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Cmp_Ip_VS_0_PBcfg.c and Cmp_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((CMP_IP_VS_0_PBCFG_SW_MAJOR_VERSION_C != CMP_IP_TYPES_SW_MAJOR_VERSION) || \
+     (CMP_IP_VS_0_PBCFG_SW_MINOR_VERSION_C != CMP_IP_TYPES_SW_MINOR_VERSION) || \
+     (CMP_IP_VS_0_PBCFG_SW_PATCH_VERSION_C != CMP_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Cmp_Ip_VS_0_PBcfg.c and Cmp_Ip_Types.h are different"
+#endif
+
+/*==================================================================================================
+ *                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       LOCAL MACROS
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                      LOCAL CONSTANTS
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       LOCAL VARIABLES
+ *================================================================================================*/
+ 
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+/** @brief Signature of report events interrupt function. */
+extern void Icu_ReportEvents(uint16 Channel, boolean bOverflow);
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+/*==================================================================================================
+ *                                       GLOBAL CONSTANTS
+ *================================================================================================*/
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h" 
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h" 
+
+/*==================================================================================================
+ *                                       GLOBAL VARIABLES
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                   LOCAL FUNCTION PROTOTYPES
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       LOCAL FUNCTIONS
+ *================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 2 - 2
generate/src/Ewm_Ip_VS_0_PBcfg.c

@@ -117,9 +117,9 @@ const Ewm_Ip_ConfigType Ewm_Ip_Settings_VS_0=
 
     EWM_IN_ASSERT_DISABLED, /*.assertLogic */ 
     (boolean)          TRUE,                   /*.InterruptEnable */
-    (uint8)          100,                   /*.u8Prescaler */
+    (uint8)          0,                   /*.u8Prescaler */
     (uint8)         0x00,                   /*.u8CompareLow */
-    (uint8)         0x4f,                   /*.u8CompareHigh */
+    (uint8)         0x02,                   /*.u8CompareHigh */
     (Ewm_Ip_CallbackPtrType) &Wdg_CallBackNotification1     /*pfEwmCallback*/
 };
 

+ 0 - 108
generate/src/Ftfc_Fls_Ip_PBcfg.c

@@ -1,108 +0,0 @@
-/*==================================================================================================
-*   Project              : RTD AUTOSAR 4.4
-*   Platform             : CORTEXM
-*   Peripheral           : FTFC_FLS_IP IPV_QSPI
-*   Dependencies         : none
-*
-*   Autosar Version      : 4.4.0
-*   Autosar Revision     : ASR_REL_4_4_REV_0000
-*   Autosar Conf.Variant :
-*   SW Version           : 1.0.0
-*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
-*
-*   (c) Copyright 2020-2021 NXP Semiconductors
-*   All Rights Reserved.
-*
-*   NXP Confidential. This software is owned or controlled by NXP and may only be
-*   used strictly in accordance with the applicable license terms. By expressly
-*   accepting such terms or by downloading, installing, activating and/or otherwise
-*   using the software, you are agreeing that you have read, and that you agree to
-*   comply with and are bound by, such license terms. If you do not agree to be
-*   bound by the applicable license terms, then you may not retain, install,
-*   activate or otherwise use the software.
-==================================================================================================*/
-
-/**
-*   @file Ftfc_Fls_Ip_PBcfg.c
-*
-*   @addtogroup FLS
-*   @{
-*/
-
-/* implements Ftfc_Fls_Ip_PBcfg.c_Artifact */
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-
-/*==================================================================================================
-*                                        INCLUDE FILES
-* 1) system and project includes
-* 2) needed interfaces from external units
-* 3) internal and external interfaces from this unit
-==================================================================================================*/
-#include "Ftfc_Fls_Ip_Types.h"
-
-
-/*==================================================================================================
-*                              SOURCE FILE VERSION INFORMATION
-==================================================================================================*/
-#define FTFC_FLS_IP_VENDOR_ID_CFG_C                          43
-#define FTFC_FLS_IP_AR_RELEASE_MAJOR_VERSION_CFG_C           4
-#define FTFC_FLS_IP_AR_RELEASE_MINOR_VERSION_CFG_C           4
-#define FTFC_FLS_IP_AR_RELEASE_REVISION_VERSION_CFG_C        0
-#define FTFC_FLS_IP_SW_MAJOR_VERSION_CFG_C                   1
-#define FTFC_FLS_IP_SW_MINOR_VERSION_CFG_C                   0
-#define FTFC_FLS_IP_SW_PATCH_VERSION_CFG_C                   0
-
-
-/*==================================================================================================
-*                                     FILE VERSION CHECKS
-==================================================================================================*/
-/* Check if current file and Ftfc_Fls_Ip_Types header file are of the same vendor */
-#if (FTFC_FLS_IP_VENDOR_ID_CFG_C != FTFC_FLS_IP_TYPES_VENDOR_ID)
-    #error "Ftfc_Fls_Ip_PBCfg.c and Ftfc_Fls_Ip_Types.h have different vendor ids"
-#endif
-/* Check if current file and Ftfc_Fls_Ip_Types header file are of the same Autosar version */
-#if ((FTFC_FLS_IP_AR_RELEASE_MAJOR_VERSION_CFG_C    != FTFC_FLS_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
-     (FTFC_FLS_IP_AR_RELEASE_MINOR_VERSION_CFG_C    != FTFC_FLS_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
-     (FTFC_FLS_IP_AR_RELEASE_REVISION_VERSION_CFG_C != FTFC_FLS_IP_TYPES_AR_RELEASE_REVISION_VERSION) \
-    )
-    #error "AutoSar Version Numbers of Ftfc_Fls_Ip_PBCfg.c and Ftfc_Fls_Ip_Types.h are different"
-#endif
-/* Check if current file and Ftfc_Fls_Ip_Types header file are of the same Software version */
-#if ((FTFC_FLS_IP_SW_MAJOR_VERSION_CFG_C != FTFC_FLS_IP_TYPES_SW_MAJOR_VERSION) || \
-     (FTFC_FLS_IP_SW_MINOR_VERSION_CFG_C != FTFC_FLS_IP_TYPES_SW_MINOR_VERSION) || \
-     (FTFC_FLS_IP_SW_PATCH_VERSION_CFG_C != FTFC_FLS_IP_TYPES_SW_PATCH_VERSION) \
-    )
-    #error "Software Version Numbers of Ftfc_Fls_Ip_PBCfg.c and Ftfc_Fls_Ip_Types.h are different"
-#endif
-
-
-/*==================================================================================================
-                                     FUNCTION PROTOTYPES
-==================================================================================================*/
-
-
-/*==================================================================================================
-                                           CONSTANTS
-==================================================================================================*/
-#define FLS_START_SEC_CONFIG_DATA_UNSPECIFIED
-#include "Fls_MemMap.h"
-
-const Ftfc_ConfigType FlsConfigSet_VS_0_InitCfg =
-{
-    NULL_PTR,  /* FlsStartFlashAccessNotif */
-    NULL_PTR  /* FlsFinishedFlashAccessNotif */
-};
-
-#define FLS_STOP_SEC_CONFIG_DATA_UNSPECIFIED
-#include "Fls_MemMap.h"
-
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @}*/

+ 5 - 5
generate/src/Ftfc_Fls_Ip_VS_0_PBcfg.c

@@ -91,11 +91,11 @@ extern "C"{
 #define FLS_START_SEC_CONFIG_DATA_UNSPECIFIED
 #include "Fls_MemMap.h"
 
-//const Ftfc_ConfigType FlsConfigSet_VS_0_InitCfg =
-//{
-//    NULL_PTR,  /* FlsStartFlashAccessNotif */
-//    NULL_PTR  /* FlsFinishedFlashAccessNotif */
-//};
+const Ftfc_ConfigType FlsConfigSet_VS_0_InitCfg =
+{
+    NULL_PTR,  /* FlsStartFlashAccessNotif */
+    NULL_PTR  /* FlsFinishedFlashAccessNotif */
+};
 
 #define FLS_STOP_SEC_CONFIG_DATA_UNSPECIFIED
 #include "Fls_MemMap.h"

+ 137 - 0
generate/src/Ftm_Icu_Ip_VS_0_PBcfg.c

@@ -0,0 +1,137 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *   @file       Ftm_Icu_Ip_VS_0_PBcfg.c
+ *   @version    1.0.0
+ *
+ *   @brief      AUTOSAR Icu - contains the data exported by the ICU module.
+ *   @details    Contains the information that will be exported by the module, as requested by AUTOSAR.
+ *
+ *   @addtogroup ftm_icu_ip FTM IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Ftm_Icu_Ip_Types.h"
+
+/*==================================================================================================
+*                                 SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define FTM_ICU_IP_VS_0_PBCFG_VENDOR_ID_C                    43
+#define FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C     4
+#define FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C     4
+#define FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C  0
+#define FTM_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION_C             1
+#define FTM_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION_C             0
+#define FTM_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION_C             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (FTM_ICU_IP_VS_0_PBCFG_VENDOR_ID_C != FTM_ICU_IP_TYPES_VENDOR_ID)
+    #error "Ftm_Icu_IpVS_0_PBcfg.c and Ftm_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != FTM_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != FTM_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != FTM_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Ftm_Icu_IpVS_0_PBcfg.c and Ftm_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((FTM_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION_C != FTM_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION_C != FTM_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (FTM_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION_C != FTM_ICU_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Ftm_Icu_IpVS_0_PBcfg.c and Ftm_Icu_Ip_Types.h are different"
+#endif
+/*==================================================================================================
+*                           LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
+==================================================================================================*/
+
+/*==================================================================================================
+*                                          LOCAL MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                         LOCAL CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                         LOCAL VARIABLES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+/** @brief Signature of report events interrupt function. */
+extern void Icu_ReportEvents(uint16 Channel, boolean bOverflow);
+
+/** @brief Signature of wakeup and overflow interrupt function. */
+extern void Icu_ReportWakeupAndOverflow(uint16 Channel, boolean bOverflow);
+
+/** @brief Signature of change logic channel state function. */
+extern void Icu_LogicChStateCallback(uint16 logicChannel, uint8 mask, boolean set);
+
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+/*==================================================================================================
+*                                        GLOBAL CONSTANTS
+==================================================================================================*/
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                    LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                         LOCAL FUNCTIONS
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 115 - 0
generate/src/Icu_Cfg.c

@@ -0,0 +1,115 @@
+
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *   @file    Icu_Cfg.c
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup icu Icu Driver
+ *   @{
+ */
+ 
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*=================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+#include "Icu.h"
+#include "Icu_Ipw.h"
+
+#if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
+#include "CDD_Mcl.h"
+#endif
+
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define ICU_VENDOR_ID_PCCFG_C                       43
+#define ICU_AR_RELEASE_MAJOR_VERSION_PCCFG_C        4
+#define ICU_AR_RELEASE_MINOR_VERSION_PCCFG_C        4
+#define ICU_AR_RELEASE_REVISION_VERSION_PCCFG_C     0
+#define ICU_SW_MAJOR_VERSION_PCCFG_C                1
+#define ICU_SW_MINOR_VERSION_PCCFG_C                0
+#define ICU_SW_PATCH_VERSION_PCCFG_C                0
+
+/*==================================================================================================
+ *                                      FILE VERSION CHECKS
+ *================================================================================================*/
+/* Check Icu_Cfg.c against Icu.h file versions */
+#if (ICU_VENDOR_ID_PCCFG_C != ICU_VENDOR_ID)
+    #error "Icu_Cfg.c and Icu.h have different vendor IDs"
+#endif
+#if ((ICU_AR_RELEASE_MAJOR_VERSION_PCCFG_C != ICU_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION_PCCFG_C != ICU_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION_PCCFG_C != ICU_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Cfg.c and Icu.h are different"
+#endif
+#if ((ICU_SW_MAJOR_VERSION_PCCFG_C != ICU_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION_PCCFG_C != ICU_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION_PCCFG_C != ICU_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Cfg.c and Icu.h are different"
+#endif
+
+
+/* Check Icu_Cfg.c against Icu_Ipw.h file versions */
+#if (ICU_VENDOR_ID_PCCFG_C != ICU_IPW_VENDOR_ID)
+    #error "Icu_Cfg.c and Icu_Ipw.h have different vendor IDs"
+#endif
+#if ((ICU_AR_RELEASE_MAJOR_VERSION_PCCFG_C != ICU_IPW_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION_PCCFG_C != ICU_IPW_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION_PCCFG_C != ICU_IPW_AR_RELEASE_REVISION_VERSION))
+  #error "AutoSar Version Numbers of Icu_Cfg.c and Icu_Ipw.h are different"
+#endif
+#if ((ICU_SW_MAJOR_VERSION_PCCFG_C != ICU_IPW_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION_PCCFG_C != ICU_IPW_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION_PCCFG_C != ICU_IPW_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Cfg.c and Icu_Ipw.h are different"
+#endif
+
+#if (ICU_TIMESTAMP_USES_DMA == STD_ON)
+/* Check Icu_Cfg.c against CDD_Mcl.h file versions */
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((ICU_AR_RELEASE_MAJOR_VERSION_PCCFG_C != CDD_MCL_AR_RELEASE_MAJOR_VERSION_H) || \
+         (ICU_AR_RELEASE_MINOR_VERSION_PCCFG_C != CDD_MCL_AR_RELEASE_MINOR_VERSION_H))
+        #error "AutoSar Version Numbers of Icu_Cfg.c and CDD_Mcl.h are different"
+    #endif
+#endif
+#endif /* ICU_TIMESTAMP_USES_DMA == STD_ON */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 116 - 0
generate/src/Icu_DmaNotification.c

@@ -0,0 +1,116 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *   @file    Icu_DmaNotification.c
+ *   @version 1.0.0
+ *
+ *   @brief   AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup icu Icu Driver
+ *   @{
+ */
+ 
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *==================================================================================================*/
+#include "Icu.h"
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *==================================================================================================*/
+#define ICU_VENDOR_ID_DMANOTIF_C                    43
+#define ICU_AR_RELEASE_MAJOR_VERSION_DMANOTIF_C     4
+#define ICU_AR_RELEASE_MINOR_VERSION_DMANOTIF_C     4
+#define ICU_AR_RELEASE_REVISION_VERSION_DMANOTIF_C  0
+#define ICU_SW_MAJOR_VERSION_DMANOTIF_C             1
+#define ICU_SW_MINOR_VERSION_DMANOTIF_C             0
+#define ICU_SW_PATCH_VERSION_DMANOTIF_C             0
+
+/*==================================================================================================
+ *                                      FILE VERSION CHECKS
+ *==================================================================================================*/
+/* Check Icu_DmaNotification.c against Icu.h file versions */
+#if (ICU_VENDOR_ID_DMANOTIF_C != ICU_VENDOR_ID)
+    #error "Icu_DmaNotification.c and Icu.h have different vendor IDs!"
+#endif
+
+#if ((ICU_AR_RELEASE_MAJOR_VERSION_DMANOTIF_C != ICU_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION_DMANOTIF_C != ICU_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION_DMANOTIF_C != ICU_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_DmaNotification.c and Icu.h are different"
+#endif
+
+#if ((ICU_SW_MAJOR_VERSION_DMANOTIF_C != ICU_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION_DMANOTIF_C != ICU_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION_DMANOTIF_C != ICU_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_DmaNotification.c  and Icu.h are different"
+#endif
+
+/* Check Icu_DmaNotification.c against Icu_Irq.h file versions */
+#if (ICU_VENDOR_ID_DMANOTIF_C != ICU_IRQ_VENDOR_ID)
+    #error "Icu_DmaNotification.c and Icu_Irq.h have different vendor IDs"
+#endif
+
+#if ((ICU_AR_RELEASE_MAJOR_VERSION_DMANOTIF_C != ICU_IRQ_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_AR_RELEASE_MINOR_VERSION_DMANOTIF_C != ICU_IRQ_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_AR_RELEASE_REVISION_VERSION_DMANOTIF_C != ICU_IRQ_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_DmaNotification.c and Icu_Irq.h are different"
+#endif
+
+#if ((ICU_SW_MAJOR_VERSION_DMANOTIF_C != ICU_IRQ_SW_MAJOR_VERSION) || \
+     (ICU_SW_MINOR_VERSION_DMANOTIF_C != ICU_IRQ_SW_MINOR_VERSION) || \
+     (ICU_SW_PATCH_VERSION_DMANOTIF_C != ICU_IRQ_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_DmaNotification.c  and Icu_Irq.h are different"
+#endif
+
+/*==================================================================================================
+ *                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
+ *==================================================================================================*/
+
+/*==================================================================================================
+ *                                       GLOBAL FUNCTIONS
+ *==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+#if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
+#endif /* ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON)) */
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 272 - 0
generate/src/Icu_Ipw_VS_0_PBcfg.c

@@ -0,0 +1,272 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *   @file       Icu_Ipw_VS_0_PBcfg.c
+ *   @version    1.0.0
+ *
+ *   @brief      AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details    Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup icu_ipw
+ *   @{
+ */
+ 
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                         INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+*================================================================================================*/
+#include "StandardTypes.h"
+#include "Icu_Ipw_Types.h"
+#include "Ftm_Icu_Ip.h"
+#include "Lpit_Icu_Ip.h"
+#include "Lptmr_Icu_Ip.h"
+#include "Port_Ci_Icu_Ip.h"
+#include "Cmp_Ip.h"
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define ICU_IPW_VS_0_PBCFG_VENDOR_ID_C                   43
+#define ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C    4
+#define ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C    4
+#define ICU_IPW_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C 0
+#define ICU_IPW_VS_0_PBCFG_SW_MAJOR_VERSION_C            1
+#define ICU_IPW_VS_0_PBCFG_SW_MINOR_VERSION_C            0
+#define ICU_IPW_VS_0_PBCFG_SW_PATCH_VERSION_C            0
+
+/*==================================================================================================
+ *                                      FILE VERSION CHECKS
+ *================================================================================================*/
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    /* Check if header file and StandardTypes.h file are of the same Autosar version */
+    #if ((ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != STD_AR_RELEASE_MINOR_VERSION))
+        #error "AutoSar Version Numbers of Icu_Ipw_VS_0_PBCfg.c and StandardTypes.h are different"
+    #endif
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_VS_0_PBCFG_VENDOR_ID_C != ICU_IPW_TYPES_VENDOR_ID)
+    #error "Icu_Ipw_VS_0_PBCfg.c and Icu_Ipw_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C  != ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C  != ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C   != ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Icu_Ipw_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_VS_0_PBCFG_SW_MAJOR_VERSION_C  != ICU_IPW_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_MINOR_VERSION_C  != ICU_IPW_TYPES_SW_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_PATCH_VERSION_C  != ICU_IPW_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Icu_Ipw_Types.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_IPW_VS_0_PBCFG_VENDOR_ID_C != LPTMR_ICU_IP_VENDOR_ID)
+    #error "Icu_Ipw_VS_0_PBCfg.c and Lptmr_Icu_Ip.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C  != LPTMR_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C  != LPTMR_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C   != LPTMR_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Lptmr_Icu_Ip.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_IPW_VS_0_PBCFG_SW_MAJOR_VERSION_C  != LPTMR_ICU_IP_SW_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_MINOR_VERSION_C  != LPTMR_ICU_IP_SW_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_PATCH_VERSION_C  != LPTMR_ICU_IP_SW_PATCH_VERSION))
+#error "Software Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Lptmr_Icu_Ip.h are different"
+#endif
+
+#if (ICU_IPW_VS_0_PBCFG_VENDOR_ID_C != LPIT_ICU_IP_VENDOR_ID)
+    #error "Icu_Ipw_VS_0_PBCfg.c and Lpit_Icu_Ip.h have different vendor ids"
+#endif
+
+/* Check if  source file and Lpit_Icu_Ip.h file are of the same Autosar version */
+#if ((ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != LPIT_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != LPIT_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != LPIT_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Lpit_Icu_Ip.h are different"
+#endif
+
+/* Check if source file and Lpit_Icu_Ip.h file are of the same Software version */
+#if ((ICU_IPW_VS_0_PBCFG_SW_MAJOR_VERSION_C != LPIT_ICU_IP_SW_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_MINOR_VERSION_C != LPIT_ICU_IP_SW_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_PATCH_VERSION_C != LPIT_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Lpit_Icu_Ip.h are different"
+#endif
+
+#if (ICU_IPW_VS_0_PBCFG_VENDOR_ID_C != FTM_ICU_IP_VENDOR_ID)
+    #error "Icu_Ipw_VS_0_PBCfg.c and Ftm_Icu_Ip.h have different vendor ids"
+#endif
+
+/* Check if  source file and Ftm_Icu_Ip.h file are of the same Autosar version */
+#if ((ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != FTM_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != FTM_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != FTM_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Ftm_Icu_Ip.h are different"
+#endif
+
+/* Check if source file and Ftm_Icu_Ip.h file are of the same Software version */
+#if ((ICU_IPW_VS_0_PBCFG_SW_MAJOR_VERSION_C != FTM_ICU_IP_SW_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_MINOR_VERSION_C != FTM_ICU_IP_SW_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_PATCH_VERSION_C != FTM_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Ftm_Icu_Ip.h are different"
+#endif
+
+#if (ICU_IPW_VS_0_PBCFG_VENDOR_ID_C != PORT_CI_ICU_IP_VENDOR_ID)
+    #error "Icu_Ipw_VS_0_PBCfg.c and Port_Ci_Icu_Ip.h have different vendor ids"
+#endif
+
+/* Check if  source file and Port_Ci_Icu_Ip.h file are of the same Autosar version */
+#if ((ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != PORT_CI_ICU_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != PORT_CI_ICU_IP_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != PORT_CI_ICU_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Port_Ci_Icu_Ip.h are different"
+#endif
+
+/* Check if source file and Port_Ci_Icu_Ip.h file are of the same Software version */
+#if ((ICU_IPW_VS_0_PBCFG_SW_MAJOR_VERSION_C != PORT_CI_ICU_IP_SW_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_MINOR_VERSION_C != PORT_CI_ICU_IP_SW_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_PATCH_VERSION_C != PORT_CI_ICU_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Port_Ci_Icu_Ip.h are different"
+#endif
+
+/* Check if  source file and Cmp_Ip.h file are of the same Autosar version */
+#if ((ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != CMP_IP_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != CMP_IP_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != CMP_IP_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Cmp_Ip.h are different"
+#endif
+
+/* Check if source file and Cmp_Ip.h file are of the same Software version */
+#if ((ICU_IPW_VS_0_PBCFG_SW_MAJOR_VERSION_C != CMP_IP_SW_MAJOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_MINOR_VERSION_C != CMP_IP_SW_MINOR_VERSION) || \
+     (ICU_IPW_VS_0_PBCFG_SW_PATCH_VERSION_C != CMP_IP_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_Ipw_VS_0_PBCfg.c and Cmp_Ip.h are different"
+#endif
+
+/*==================================================================================================
+ *                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       LOCAL MACROS
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                      LOCAL CONSTANTS
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       LOCAL VARIABLES
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       GLOBAL CONSTANTS
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       GLOBAL VARIABLES
+ *================================================================================================*/
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+/**
+ *   @brief This index relates the Hardware channels with the respective ICU channel. *
+ *   When an normal interrupt is asserted this index is used to locate the corresponding ICU channel
+ */
+/** @brief ICU channels IP related configuration array */
+const Icu_Ipw_ChannelConfigType Icu_Ipw_IpChannelConfig_PB_VS_0[1U] =
+{
+    /** @brief IcuChannel_0 */
+    {
+        /** @brief IP type of this channel */
+        ICU_PORT_CI_MODULE,
+        /** @brief Instance number */
+        (uint8)0,
+        /** @brief Ftm IP channel pointer */
+        NULL_PTR,
+        /** @brief LPIT IP channel pointer */
+        NULL_PTR,
+        /** @brief LPTMR IP channel pointer */
+        NULL_PTR,
+        /** @brief Port Ci IP channel pointer */
+        &Port_Ci_Icu_Ip_0_ChannelConfig_PB_VS_0[0U],
+        /** @brief Cmp IP channel pointer */
+        NULL_PTR,
+        /** @brief Index in the configuration table of the Port Ci channels */
+        (uint8)0
+    }
+
+};
+
+const Icu_Ipw_IpConfigType Icu_Ipw_IpConfig_PB_VS_0[1U] =
+{
+    {
+        /** @brief IP type */
+        ICU_PORT_CI_MODULE,
+        /** @brief IP instance number */
+        0U,
+        /** @brief pointer to Ftm Ci HW configuration of instance */
+        NULL_PTR,
+        /** @brief pointer to Lpit HW configuration of instance */
+        NULL_PTR,
+        /** @brief pointer to Lptmr HW configuration of instance */
+        NULL_PTR,
+        /** @brief pointer to Port Ci HW configuration of instance */
+        &Port_Ci_Icu_Ip_0_Config_PB_VS_0,
+        /** @brief pointer to Cmp HW configuration of instance */
+        NULL_PTR
+    }
+};
+
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+ *                                   LOCAL FUNCTION PROTOTYPES
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       LOCAL FUNCTIONS
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       GLOBAL FUNCTIONS
+ *================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 241 - 0
generate/src/Icu_VS_0_PBcfg.c

@@ -0,0 +1,241 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *   @file       Icu_PBCfg.c
+ *   @version    1.0.0
+ *
+ *   @brief      AUTOSAR Icu - contains the data exported by the Icu module
+ *   @details    Contains the information that will be exported by the module, as requested by Autosar.
+ *
+ *   @addtogroup icu Icu Driver
+ *   @{
+ */
+ 
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+ /*==================================================================================================
+ *                                         INCLUDE FILES
+ * 1) system and project includes
+ * 2) needed interfaces from external units
+ * 3) internal and external interfaces from this unit
+ *================================================================================================*/
+#include "StandardTypes.h"
+#include "Icu.h"
+#include "Icu_Ipw_Types.h"
+#include "Icu_Ipw_VS_0_PBcfg.h"
+
+#if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
+#include "CDD_Mcl.h"
+#endif
+
+/*==================================================================================================
+ *                              SOURCE FILE VERSION INFORMATION
+ *================================================================================================*/
+#define ICU_VS_0_PBCFG_VENDOR_ID_C                   43
+#define ICU_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C    4
+#define ICU_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C    4
+#define ICU_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C 0
+#define ICU_VS_0_PBCFG_SW_MAJOR_VERSION_C            1
+#define ICU_VS_0_PBCFG_SW_MINOR_VERSION_C            0
+#define ICU_VS_0_PBCFG_SW_PATCH_VERSION_C            0
+
+/*==================================================================================================
+ *                                      FILE VERSION CHECKS
+ *================================================================================================*/
+/* Check if header file and StandardTypes.h file are of the same Autosar version */
+#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
+    #if ((ICU_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != STD_AR_RELEASE_MAJOR_VERSION) || \
+         (ICU_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != STD_AR_RELEASE_MINOR_VERSION))
+    #error "AutoSar Version Numbers of Icu_VS_0_PBcfg.c and StandardTypes.h are different"
+    #endif
+    
+    #if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
+        #if ((ICU_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != CDD_MCL_AR_RELEASE_MAJOR_VERSION_H) || \
+             (ICU_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != CDD_MCL_AR_RELEASE_MINOR_VERSION_H))
+            #error "AutoSar Version Numbers of Icu_VS_0_PBcfg.c and CDD_Mcl.h are different"
+        #endif
+    #endif    
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_VS_0_PBCFG_VENDOR_ID_C != ICU_VENDOR_ID)
+    #error "Icu_VS_0_PBcfg.c and Icu.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != ICU_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != ICU_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != ICU_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_VS_0_PBcfg.c and Icu.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_VS_0_PBCFG_SW_MAJOR_VERSION_C != ICU_SW_MAJOR_VERSION) || \
+     (ICU_VS_0_PBCFG_SW_MINOR_VERSION_C != ICU_SW_MINOR_VERSION) || \
+     (ICU_VS_0_PBCFG_SW_PATCH_VERSION_C != ICU_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_VS_0_PBcfg.c and Icu.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_VS_0_PBCFG_VENDOR_ID_C != ICU_IPW_TYPES_VENDOR_ID)
+    #error "Icu_VS_0_PBcfg.c and Icu_Ipw_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != ICU_IPW_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != ICU_IPW_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != ICU_IPW_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_VS_0_PBcfg.c and Icu_Ipw_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_VS_0_PBCFG_SW_MAJOR_VERSION_C != ICU_IPW_TYPES_SW_MAJOR_VERSION) || \
+     (ICU_VS_0_PBCFG_SW_MINOR_VERSION_C != ICU_IPW_TYPES_SW_MINOR_VERSION) || \
+     (ICU_VS_0_PBCFG_SW_PATCH_VERSION_C != ICU_IPW_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_VS_0_PBcfg.c and Icu_Ipw_Types.h are different"
+#endif
+
+/* Check if source file and ICU header file are of the same vendor */
+#if (ICU_VS_0_PBCFG_VENDOR_ID_C != ICU_IPW_VS_0_PBCFG_VENDOR_ID)
+    #error "Icu_VS_0_PBcfg.c and Icu_Ipw_VS_0_PBcfg.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((ICU_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != ICU_IPW_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION) || \
+     (ICU_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != ICU_IPW_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION) || \
+     (ICU_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != ICU_IPW_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Icu_VS_0_PBcfg.c and Icu_Ipw_VS_0_PBcfg.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((ICU_VS_0_PBCFG_SW_MAJOR_VERSION_C != ICU_IPW_VS_0_PBCFG_SW_MAJOR_VERSION) || \
+     (ICU_VS_0_PBCFG_SW_MINOR_VERSION_C != ICU_IPW_VS_0_PBCFG_SW_MINOR_VERSION) || \
+     (ICU_VS_0_PBCFG_SW_PATCH_VERSION_C != ICU_IPW_VS_0_PBCFG_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Icu_VS_0_PBcfg.c and Icu_Ipw_VS_0_PBcfg.h are different"
+#endif
+
+/*==================================================================================================
+ *                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       LOCAL MACROS
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                      LOCAL CONSTANTS
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       LOCAL VARIABLES
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       GLOBAL CONSTANTS
+ *================================================================================================*/
+
+
+
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+
+
+/*
+*   @brief Translation LUT for Logical channel number to Partition Configuration indexed location
+*/
+const uint8 Icu_ChIndexMap_PB_VS_0[1U] = 
+{
+    0U    /* IcuConfigSet has an index of 0 */
+};
+/*
+*  @brief    PB_VS_0 Configuration
+*/
+static const Icu_ChannelConfigType Icu_ChannelConfig_PB_VS_0[1U]=
+{
+    /* IcuChannel_0 */
+    {
+        (boolean)TRUE,    /* Wakeup capability */
+        ICU_FALLING_EDGE,    /* Edge used */
+        ICU_MODE_SIGNAL_EDGE_DETECT,     /* Measurement mode */
+        (Icu_MeasurementSubModeType)0U, /* Icu_MeasurementSubModeType */
+        NULL_PTR, /* Icu_Channel_Notification */
+#if ((ICU_SIGNALMEASUREMENT_USES_DMA == STD_ON) || (ICU_TIMESTAMP_USES_DMA == STD_ON))
+        (Mcl_ChannelType)NoMclDmaChannel, /* Mcl_DmaChannel */
+#endif
+#if (ICU_OVERFLOW_NOTIFICATION_API == STD_ON)
+        NULL_PTR, /* Icu_Channel_OverflowNotification */
+#endif  /* ICU_OVERFLOW_NOTIFICATION_API */
+#if (ICU_REPORT_WAKEUP_SOURCE == STD_ON)
+        (Icu_WakeupValueType)((uint32)((uint32)1U<<0)), /* Icu_Channel_WakeupValue */
+#endif /* (ICU_REPORT_WAKEUP_SOURCE == STD_ON) */
+        &Icu_Ipw_IpChannelConfig_PB_VS_0[0U] /* Ipw channel pointer */
+    }
+};
+
+
+    
+
+
+
+/*
+*   @brief Postbuild Configuration for each Partition
+*/
+const Icu_ConfigType Icu_Config_VS_0=
+{
+    (uint8)1, 
+    /** @brief The number of channels configured*/
+    &Icu_ChannelConfig_PB_VS_0, 
+    /** @brief Icu Channel Configuration Pointer */
+    (uint8)1, /* The number of IP instances configured*/
+    /** @brief Icu Instance Configuration Pointer */
+    &Icu_Ipw_IpConfig_PB_VS_0,
+    /** @brief Index of channel in each partition map table*/
+    &Icu_ChIndexMap_PB_VS_0,
+    /** @brief core index*/
+    (uint8)0U
+};
+
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+/*==================================================================================================
+ *                                       GLOBAL VARIABLES
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                   LOCAL FUNCTION PROTOTYPES
+ *================================================================================================*/
+
+/*==================================================================================================
+ *                                       LOCAL FUNCTIONS
+ *================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 2 - 2
generate/src/IntCtrl_Ip_Cfg.c

@@ -107,7 +107,7 @@ static const IntCtrl_Ip_IrqConfigType aIrqConfiguration[] = {
     {PDB0_IRQn, (boolean)FALSE, 0U},
     {SCG_IRQn, (boolean)FALSE, 0U},
     {LPTMR0_IRQn, (boolean)FALSE, 0U},
-    {PORTA_IRQn, (boolean)FALSE, 0U},
+    {PORTA_IRQn, (boolean)TRUE, 0U},
     {PORTB_IRQn, (boolean)FALSE, 0U},
     {PORTC_IRQn, (boolean)FALSE, 0U},
     {PORTD_IRQn, (boolean)FALSE, 0U},
@@ -219,7 +219,7 @@ static const IntCtrl_Ip_IrqRouteConfigType aIrqRouteConfig[] = {
         {PDB0_IRQn, 0U, undefined_handler},
         {SCG_IRQn, 0U, undefined_handler},
         {LPTMR0_IRQn, 0U, undefined_handler},
-        {PORTA_IRQn, 0U, undefined_handler},
+        {PORTA_IRQn, 0U, PORT_CI_ICU_IP_A_EXT_IRQ_ISR},
         {PORTB_IRQn, 0U, undefined_handler},
         {PORTC_IRQn, 0U, undefined_handler},
         {PORTD_IRQn, 0U, undefined_handler},

+ 1 - 1
generate/src/LPit_Gpt_Ip_VS_0_PBcfg.c

@@ -106,7 +106,7 @@ extern "C"{
 const Lpit_Gpt_Ip_InstanceConfigType LPIT_0_InitConfig_PB_VS_0 = 
 {
         /** @brief DOZE Mode Enable Bit */
-        (boolean)FALSE,
+        (boolean)TRUE,
         /** @brief LPIT Debug Mode */
         (boolean)FALSE
 };

+ 111 - 0
generate/src/Lpit_Icu_Ip_VS_0_PBcfg.c

@@ -0,0 +1,111 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ * @file    Lpit_Icu_VS_0_PBcfg.c
+ * @version 1.0.0
+ *
+ * @brief   AUTOSAR Icu - contains the data exported by the ICU module.
+ * @details Contains the information that will be exported by the module, as requested by AUTOSAR.
+ *
+ * @addtogroup lpit_icu_ip LPIT IPL
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/*==================================================================================================
+*                                         INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lpit_Icu_Ip_Types.h"
+
+/*==================================================================================================
+*                                 SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPIT_ICU_IP_VS_0_PBCFG_VENDOR_ID_C                    43
+#define LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C     4
+#define LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C     4
+#define LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C  0
+#define LPIT_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION_C             1
+#define LPIT_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION_C             0
+#define LPIT_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION_C             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU Lpit_Icu_Ip_Types.h file are of the same vendor */
+#if (LPIT_ICU_IP_VS_0_PBCFG_VENDOR_ID_C != LPIT_ICU_IP_TYPES_VENDOR_ID)
+    #error "Lpit_Icu_IpVS_0_PBcfg.c and Lpit_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU Lpit_Icu_Ip_Types.h file are of the same AutoSar version */
+#if ((LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C    != LPIT_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C    != LPIT_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (LPIT_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != LPIT_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lpit_Icu_IpVS_0_PBcfg.c and Lpit_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU Lpit_Icu_Ip_Types.h file are of the same Software version */
+#if ((LPIT_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION_C != LPIT_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (LPIT_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION_C != LPIT_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (LPIT_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION_C != LPIT_ICU_IP_TYPES_SW_PATCH_VERSION))
+#error "Software Version Numbers of Lpit_Icu_IpVS_0_PBcfg.c and Lpit_Icu_Ip_Types.h are different"
+#endif
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+
+/** @brief Signature of report events interrupt function. */
+extern void Icu_ReportEvents(uint16 Channel, boolean bOverflow);
+
+/** @brief Signature of wakeup and overflow interrupt function. */
+extern void Icu_ReportWakeupAndOverflow(uint16 Channel, boolean bOverflow);
+
+/** @brief Signature of change logic channel state function. */
+extern void Icu_LogicChStateCallback(uint16 logicChannel, uint8 mask, boolean set);
+
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+/*==================================================================================================
+*                                        GLOBAL CONSTANTS
+==================================================================================================*/
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 133 - 0
generate/src/Lptmr_Icu_Ip_VS_0_PBcfg.c

@@ -0,0 +1,133 @@
+/*==================================================================================================
+*   Project              : RTD AUTOSAR 4.4
+*   Platform             : CORTEXM
+*   Peripheral           : Ftm Lpit Lptmr Port_Ci LpCmp
+*   Dependencies         : none
+*
+*   Autosar Version      : 4.4.0
+*   Autosar Revision     : ASR_REL_4_4_REV_0000
+*   Autosar Conf.Variant :
+*   SW Version           : 1.0.0
+*   Build Version        : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
+*
+*   (c) Copyright 2020-2021 NXP Semiconductors
+*   All Rights Reserved.
+*
+*   NXP Confidential. This software is owned or controlled by NXP and may only be
+*   used strictly in accordance with the applicable license terms. By expressly
+*   accepting such terms or by downloading, installing, activating and/or otherwise
+*   using the software, you are agreeing that you have read, and that you agree to
+*   comply with and are bound by, such license terms. If you do not agree to be
+*   bound by the applicable license terms, then you may not retain, install,
+*   activate or otherwise use the software.
+==================================================================================================*/
+
+/**
+ *   @file       Lptmr_Icu_Ip_VS_0_PBcfg.c
+ *   @version    1.0.0
+ *
+ *   @brief      AUTOSAR Icu - contains the data exported by the ICU module.
+ *   @details    Contains the information that will be exported by the module, as requested by AUTOSAR.
+ *
+ *   @addtogroup lptmr_icu_ip LPTMR IPL
+ *   @{
+ */
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+
+/*==================================================================================================
+*                                          INCLUDE FILES
+* 1) system and project includes
+* 2) needed interfaces from external units
+* 3) internal and external interfaces from this unit
+==================================================================================================*/
+#include "Lptmr_Icu_Ip_Types.h"
+
+/*==================================================================================================
+*                                 SOURCE FILE VERSION INFORMATION
+==================================================================================================*/
+#define LPTMR_ICU_IP_VS_0_PBCFG_VENDOR_ID_C                    43
+#define LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C     4
+#define LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C     4
+#define LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C  0
+#define LPTMR_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION_C             1
+#define LPTMR_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION_C             0
+#define LPTMR_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION_C             0
+
+/*==================================================================================================
+*                                       FILE VERSION CHECKS
+==================================================================================================*/
+/* Check if source file and ICU header file are of the same vendor */
+#if (LPTMR_ICU_IP_VS_0_PBCFG_VENDOR_ID_C != LPTMR_ICU_IP_TYPES_VENDOR_ID)
+    #error "Lptmr_Icu_IpVS_0_PBcfg.c and Lptmr_Icu_Ip_Types.h have different vendor IDs"
+#endif
+/* Check if source file and ICU header file are of the same AutoSar version */
+#if ((LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_MAJOR_VERSION_C != LPTMR_ICU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_MINOR_VERSION_C != LPTMR_ICU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_AR_RELEASE_REVISION_VERSION_C != LPTMR_ICU_IP_TYPES_AR_RELEASE_REVISION_VERSION))
+    #error "AutoSar Version Numbers of Lptmr_Icu_IpVS_0_PBcfg.c and Lptmr_Icu_Ip_Types.h are different"
+#endif
+/* Check if source file and ICU header file are of the same Software version */
+#if ((LPTMR_ICU_IP_VS_0_PBCFG_SW_MAJOR_VERSION_C != LPTMR_ICU_IP_TYPES_SW_MAJOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_SW_MINOR_VERSION_C != LPTMR_ICU_IP_TYPES_SW_MINOR_VERSION) || \
+     (LPTMR_ICU_IP_VS_0_PBCFG_SW_PATCH_VERSION_C != LPTMR_ICU_IP_TYPES_SW_PATCH_VERSION))
+    #error "Software Version Numbers of Lptmr_Icu_IpVS_0_PBcfg.c and Lptmr_Icu_Ip_Types.h are different"
+#endif
+
+/*==================================================================================================
+*                           LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
+==================================================================================================*/
+
+/*==================================================================================================
+*                                          LOCAL MACROS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                         LOCAL CONSTANTS
+==================================================================================================*/
+
+/*==================================================================================================
+*                                         LOCAL VARIABLES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                        GLOBAL FUNCTIONS
+==================================================================================================*/
+#define ICU_START_SEC_CODE
+#include "Icu_MemMap.h"
+/** @brief Signature of report events interrupt function. */
+extern void Icu_ReportEvents(uint16 Channel, boolean bOverflow);
+#define ICU_STOP_SEC_CODE
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                        GLOBAL CONSTANTS
+==================================================================================================*/
+
+#define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+
+#define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Icu_MemMap.h"
+
+/*==================================================================================================
+*                                        GLOBAL VARIABLES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                    LOCAL FUNCTION PROTOTYPES
+==================================================================================================*/
+
+/*==================================================================================================
+*                                         LOCAL FUNCTIONS
+==================================================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */

+ 1 - 1
generate/src/Mcu_VS_0_PBcfg.c

@@ -152,7 +152,7 @@ const Mcu_ConfigType Mcu_PreCompileConfig =
     (Mcu_RamSectionType)0U,
 
     /* Number of Power Modes configurations. */
-    (Mcu_ModeType)1U,
+    (Mcu_ModeType)4U,
 
 #if (MCU_INIT_CLOCK == STD_ON)
     /* Number of Clock Setting configurations. */

Некоторые файлы не были показаны из-за большого количества измененных файлов