Dio_Ipw.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : GPIO
  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 DIO_IPW_H
  25. #define DIO_IPW_H
  26. /**
  27. * @file Dio_Ipw.h
  28. *
  29. * @internal
  30. * @defgroup DIO_IPW Dio IPW
  31. * @{
  32. */
  33. #ifdef __cplusplus
  34. extern "C"{
  35. #endif
  36. /*=================================================================================================
  37. * INCLUDE FILES
  38. * 1) system and project includes
  39. * 2) needed interfaces from external units
  40. * 3) internal and external interfaces from this unit
  41. =================================================================================================*/
  42. #include "Gpio_Dio_Ip.h"
  43. /*=================================================================================================
  44. * SOURCE FILE VERSION INFORMATION
  45. =================================================================================================*/
  46. #define DIO_VENDOR_ID_IPW_H 43
  47. #define DIO_AR_RELEASE_MAJOR_VERSION_IPW_H 4
  48. #define DIO_AR_RELEASE_MINOR_VERSION_IPW_H 4
  49. #define DIO_AR_RELEASE_REVISION_VERSION_IPW_H 0
  50. #define DIO_SW_MAJOR_VERSION_IPW_H 1
  51. #define DIO_SW_MINOR_VERSION_IPW_H 0
  52. #define DIO_SW_PATCH_VERSION_IPW_H 0
  53. /*=================================================================================================
  54. * FILE VERSION CHECKS
  55. =================================================================================================*/
  56. /* Check if Dio_Ipw header file and Gpio_Dio_Ip header file are of the same vendor */
  57. #if (DIO_VENDOR_ID_IPW_H != GPIO_DIO_IP_VENDOR_ID_H)
  58. #error "Dio_Ipw.h and Gpio_Dio_Ip.h have different vendor ids"
  59. #endif
  60. /* Check if Dio_Ipw header file and Gpio_Dio_Ip header file are of the same Autosar version */
  61. #if ((DIO_AR_RELEASE_MAJOR_VERSION_IPW_H != GPIO_DIO_IP_AR_RELEASE_MAJOR_VERSION_H) || \
  62. (DIO_AR_RELEASE_MINOR_VERSION_IPW_H != GPIO_DIO_IP_AR_RELEASE_MINOR_VERSION_H) || \
  63. (DIO_AR_RELEASE_REVISION_VERSION_IPW_H != GPIO_DIO_IP_AR_RELEASE_REVISION_VERSION_H) \
  64. )
  65. #error "AutoSar Version Numbers of Dio_Ipw.h and Gpio_Dio_Ip.h are different"
  66. #endif
  67. /* Check if Dio_Ipw header file and Gpio_Dio_Ip header file are of the same Software version */
  68. #if ((DIO_SW_MAJOR_VERSION_IPW_H != GPIO_DIO_IP_SW_MAJOR_VERSION_H) || \
  69. (DIO_SW_MINOR_VERSION_IPW_H != GPIO_DIO_IP_SW_MINOR_VERSION_H) || \
  70. (DIO_SW_PATCH_VERSION_IPW_H != GPIO_DIO_IP_SW_PATCH_VERSION_H) \
  71. )
  72. #error "Software Version Numbers of Dio_Ipw.h and Gpio_Dio_Ip.h are different"
  73. #endif
  74. /*=================================================================================================
  75. * CONSTANTS
  76. =================================================================================================*/
  77. /*=================================================================================================
  78. * DEFINES AND MACROS
  79. =================================================================================================*/
  80. /** Bit mask for the leftmost channel in a port*/
  81. #if (STD_ON == DIO_DEV_ERROR_DETECT)
  82. #define DIO_BIT1_LEFTMOST_MASK_U32 ((uint32)1U)
  83. #define DIO_CHECK_CHANNEL_VALIDITY(ChannelId) (DIO_BIT1_LEFTMOST_MASK_U32<<((ChannelId) & GPIO_DIO_IP_CHANNEL_MASK_U32))
  84. #endif
  85. #define DIO_PORTID_SHIFT_U8 ((uint8)5U)
  86. #define DIO_PORTID_EXTRACT(ChannelId) ((ChannelId) >> DIO_PORTID_SHIFT_U8)
  87. /*=================================================================================================
  88. * ENUMS
  89. =================================================================================================*/
  90. /*=================================================================================================
  91. * STRUCTURES AND OTHER TYPEDEFS
  92. =================================================================================================*/
  93. #if (STD_ON == DIO_DEV_ERROR_DETECT)
  94. #ifdef CPU_TYPE
  95. #if (CPU_TYPE == CPU_TYPE_64)
  96. /**
  97. * @brief size of pointer type. on CPU_TYPE_64, the size is 64bits.
  98. */
  99. typedef uint64 pointerSizeType;
  100. #elif (CPU_TYPE == CPU_TYPE_32)
  101. /**
  102. * @brief size of pointer type. on CPU_TYPE_32, the size is 32bits.
  103. */
  104. typedef uint32 pointerSizeType;
  105. #elif (CPU_TYPE == CPU_TYPE_16)
  106. /**
  107. * @brief size of pointer type. on CPU_TYPE_16, the size is 16bits.
  108. */
  109. typedef uint16 pointerSizeType;
  110. #endif
  111. #endif
  112. #endif
  113. /*=================================================================================================
  114. * GLOBAL VARIABLE DECLARATIONS
  115. =================================================================================================*/
  116. /*=================================================================================================
  117. * FUNCTION PROTOTYPES
  118. =================================================================================================*/
  119. #define DIO_START_SEC_CODE
  120. #include "Dio_MemMap.h"
  121. /**
  122. * @brief Mapping macro between low level layer and high level layer.
  123. *
  124. */
  125. Dio_LevelType Dio_Ipw_ReadChannel(Dio_ChannelType ChannelId);
  126. /**
  127. * @brief Mapping macro between low level layer and high level layer.
  128. *
  129. */
  130. void Dio_Ipw_WriteChannel(Dio_ChannelType ChannelId, Dio_LevelType Level);
  131. #if (STD_ON == DIO_FLIP_CHANNEL_API)
  132. /**
  133. * @brief Mapping macro between low level layer and high level layer.
  134. *
  135. */
  136. Dio_LevelType Dio_Ipw_FlipChannel(Dio_ChannelType ChannelId);
  137. #endif /* (STD_ON == DIO_FLIP_CHANNEL_API) */
  138. /**
  139. * @brief Mapping macro between low level layer and high level layer.
  140. *
  141. */
  142. Dio_PortLevelType Dio_Ipw_ReadPort(Dio_PortType PortId);
  143. /**
  144. * @brief Mapping macro between low level layer and high level layer.
  145. *
  146. */
  147. void Dio_Ipw_WritePort(Dio_PortType PortId,Dio_PortLevelType Level);
  148. /**
  149. * @brief Mapping macro between low level layer and high level layer.
  150. *
  151. */
  152. Dio_PortLevelType Dio_Ipw_ReadChannelGroup(const Dio_ChannelGroupType * pChannelGroupIdPtr);
  153. /**
  154. * @brief Mapping macro between low level layer and high level layer.
  155. *
  156. */
  157. void Dio_Ipw_WriteChannelGroup(const Dio_ChannelGroupType * pChannelGroupIdPtr,Dio_PortLevelType Level);
  158. #if (STD_ON == DIO_MASKEDWRITEPORT_API)
  159. /**
  160. * @brief Mapping macro between low level layer and high level layer.
  161. *
  162. */
  163. void Dio_Ipw_MaskedWritePort(Dio_PortType PortId,Dio_PortLevelType Level,Dio_PortLevelType Mask);
  164. #endif /* (STD_ON == DIO_MASKEDWRITEPORT_API) */
  165. #define DIO_STOP_SEC_CODE
  166. #include "Dio_MemMap.h"
  167. #ifdef __cplusplus
  168. }
  169. #endif
  170. #endif /* DIO_IPW_H */
  171. /** @} */