Cmp_Ip.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : Ftm Lpit Lptmr Port_Ci LpCmp
  5. * Dependencies : none
  6. *
  7. * Autosar Version : 4.4.0
  8. * Autosar Revision : ASR_REL_4_4_REV_0000
  9. * Autosar Conf.Variant :
  10. * SW Version : 1.0.0
  11. * Build Version : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
  12. *
  13. * (c) Copyright 2020-2021 NXP Semiconductors
  14. * All Rights Reserved.
  15. *
  16. * NXP Confidential. This software is owned or controlled by NXP and may only be
  17. * used strictly in accordance with the applicable license terms. By expressly
  18. * accepting such terms or by downloading, installing, activating and/or otherwise
  19. * using the software, you are agreeing that you have read, and that you agree to
  20. * comply with and are bound by, such license terms. If you do not agree to be
  21. * bound by the applicable license terms, then you may not retain, install,
  22. * activate or otherwise use the software.
  23. ==================================================================================================*/
  24. #ifndef CMP_IP_H
  25. #define CMP_IP_H
  26. /**
  27. * @file
  28. *
  29. * @addtogroup cmp_icu_ip CMP IPL
  30. * @{
  31. */
  32. #ifdef __cplusplus
  33. extern "C"{
  34. #endif
  35. /*==================================================================================================
  36. * INCLUDE FILES
  37. ==================================================================================================*/
  38. #include "Cmp_Ip_Types.h"
  39. #include "Cmp_Ip_Cfg.h"
  40. #include "OsIf.h"
  41. /*==================================================================================================
  42. * SOURCE FILE VERSION INFORMATION
  43. ==================================================================================================*/
  44. #define CMP_IP_VENDOR_ID 43
  45. #define CMP_IP_AR_RELEASE_MAJOR_VERSION 4
  46. #define CMP_IP_AR_RELEASE_MINOR_VERSION 4
  47. #define CMP_IP_AR_RELEASE_REVISION_VERSION 0
  48. #define CMP_IP_SW_MAJOR_VERSION 1
  49. #define CMP_IP_SW_MINOR_VERSION 0
  50. #define CMP_IP_SW_PATCH_VERSION 0
  51. /*==================================================================================================
  52. * FILE VERSION CHECKS
  53. ==================================================================================================*/
  54. /* Check if source file and ICU header file are of the same vendor */
  55. #if (CMP_IP_VENDOR_ID != CMP_IP_TYPES_VENDOR_ID)
  56. #error "Cmp_Ip.h and Cmp_Ip_Types.h have different vendor IDs"
  57. #endif
  58. /* Check if source file and ICU header file are of the same AutoSar version */
  59. #if ((CMP_IP_AR_RELEASE_MAJOR_VERSION != CMP_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
  60. (CMP_IP_AR_RELEASE_MINOR_VERSION != CMP_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
  61. (CMP_IP_AR_RELEASE_REVISION_VERSION != CMP_IP_TYPES_AR_RELEASE_REVISION_VERSION))
  62. #error "AutoSar Version Numbers of Cmp_Ip.h and Cmp_Ip_Types.h are different"
  63. #endif
  64. /* Check if source file and ICU header file are of the same Software version */
  65. #if ((CMP_IP_SW_MAJOR_VERSION != CMP_IP_TYPES_SW_MAJOR_VERSION) || \
  66. (CMP_IP_SW_MINOR_VERSION != CMP_IP_TYPES_SW_MINOR_VERSION) || \
  67. (CMP_IP_SW_PATCH_VERSION != CMP_IP_TYPES_SW_PATCH_VERSION))
  68. #error "Software Version Numbers of Cmp_Ip.h and Cmp_Ip_Types.h are different"
  69. #endif
  70. /* Check if source file and ICU header file are of the same vendor */
  71. #if (CMP_IP_VENDOR_ID != CMP_IP_CFG_VENDOR_ID)
  72. #error "Cmp_Ip.h and Cmp_Ip_Cfg.h have different vendor IDs"
  73. #endif
  74. /* Check if source file and ICU header file are of the same AutoSar version */
  75. #if ((CMP_IP_AR_RELEASE_MAJOR_VERSION != CMP_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
  76. (CMP_IP_AR_RELEASE_MINOR_VERSION != CMP_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
  77. (CMP_IP_AR_RELEASE_REVISION_VERSION != CMP_IP_CFG_AR_RELEASE_REVISION_VERSION))
  78. #error "AutoSar Version Numbers of Cmp_Ip.h and Cmp_Ip_Cfg.h are different"
  79. #endif
  80. /* Check if source file and ICU header file are of the same Software version */
  81. #if ((CMP_IP_SW_MAJOR_VERSION != CMP_IP_CFG_SW_MAJOR_VERSION) || \
  82. (CMP_IP_SW_MINOR_VERSION != CMP_IP_CFG_SW_MINOR_VERSION) || \
  83. (CMP_IP_SW_PATCH_VERSION != CMP_IP_CFG_SW_PATCH_VERSION))
  84. #error "Software Version Numbers of Cmp_Ip.h and Cmp_Ip_Cfg.h are different"
  85. #endif
  86. /*==================================================================================================
  87. * DEFINES AND MACROS
  88. ==================================================================================================*/
  89. #if (defined CMP_CONFIG_EXT)
  90. #define ICU_START_SEC_CONFIG_DATA_UNSPECIFIED
  91. #include "Icu_MemMap.h"
  92. /* Macro used to import WKPU generated configurations. */
  93. CMP_CONFIG_EXT
  94. #define ICU_STOP_SEC_CONFIG_DATA_UNSPECIFIED
  95. #include "Icu_MemMap.h"
  96. #endif
  97. /*==================================================================================================
  98. * GLOBAL VARIABLE DECLARATIONS
  99. ==================================================================================================*/
  100. /*==================================================================================================
  101. * FUNCTION PROTOTYPES
  102. ==================================================================================================*/
  103. #define ICU_START_SEC_CODE
  104. #include "Icu_MemMap.h"
  105. /**
  106. * @brief Configure all comparator features with the given configuration structure
  107. *
  108. * This function configures the comparator module with the options
  109. * provided in the config structure.
  110. *
  111. * @param instance - instance number
  112. * @param config - the configuration structure
  113. * @return
  114. * - CMP_IP_STATUS_SUCCESS : Completed successfully.
  115. * - CMP_IP_STATUS_ERROR : Error occurred.
  116. */
  117. Cmp_Ip_StatusType Cmp_Ip_Init(uint8 instance, const Cmp_Ip_ConfigType* userConfig);
  118. /**
  119. * @brief Reset all register used by ICU driver on current CMP instance.
  120. *
  121. * @param Instance - The number instance to be deinitialize.
  122. * @return Cmp_Ip_StatusType
  123. */
  124. Cmp_Ip_StatusType Cmp_Ip_Deinit(uint8 instance);
  125. /**
  126. * @brief Enable CMP notification.
  127. *
  128. * @param Instance The number of instance for which the notifcation will be enabled.
  129. */
  130. void Cmp_Ip_EnableNotification(uint8 instance);
  131. /**
  132. * @brief Disable CMP notification.
  133. *
  134. * @param Instance The number of instance for which the notifcation will be enabled.
  135. */
  136. void Cmp_Ip_DisableNotification(uint8 instance);
  137. /**
  138. * @brief Set the type of activation for interrupt.
  139. *
  140. * @param Instance The number of instance for which the interrupt activation will be set.
  141. * @param Edge
  142. */
  143. void Cmp_Ip_SetInterruptActivation(uint8 instance, Cmp_Ip_OutputInterruptTriggerType Edge);
  144. /**
  145. * @brief Enable CMP interrupt.
  146. *
  147. * @param Instance The number of instance for which the interrupt will be enabled.
  148. */
  149. void Cmp_Ip_EnableInterrupt(uint8 instance);
  150. /**
  151. * @brief Disable CMP interrupt.
  152. *
  153. * @param Instance The number of instance for which the interrupt will be disable.
  154. */
  155. void Cmp_Ip_DisableInterrupt(uint8 instance);
  156. #if (CMP_ICU_GET_INPUT_STATE_API == STD_ON)
  157. /**
  158. * @brief Get instance status.
  159. *
  160. * @param Instance The number of instace to get the status.
  161. * @return boolean
  162. */
  163. boolean Cmp_Ip_GetStatus(uint8 instance);
  164. #endif
  165. #if (defined(ICU_CMP_0_ISR_USED))
  166. /**
  167. * @brief Interrupt handler for CMP 0.
  168. * @details Process the interrupt of instance 0.
  169. *
  170. * @remarks This will be defined only if CMP 0 is configured.
  171. */
  172. ISR(CMP_0_ISR);
  173. #endif
  174. #if (defined(ICU_CMP_1_ISR_USED))
  175. /**
  176. * @brief Interrupt handler for CMP 1.
  177. * @details Process the interrupt of instance 1.
  178. *
  179. * @remarks This will be defined only if CMP 1 is configured.
  180. */
  181. ISR(CMP_1_ISR);
  182. #endif
  183. #if (defined(ICU_CMP_2_ISR_USED))
  184. /**
  185. * @brief Interrupt handler for CMP 2.
  186. * @details Process the interrupt of instance 2.
  187. *
  188. * @remarks This will be defined only if CMP 2 is configured.
  189. */
  190. ISR(CMP_2_ISR);
  191. #endif
  192. #define ICU_STOP_SEC_CODE
  193. #include "Icu_MemMap.h"
  194. #ifdef __cplusplus
  195. }
  196. #endif
  197. /** @} */
  198. #endif /* WKPU_ICU_IP_H */