Port_Ipw.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : PORT_CI
  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 PORT_IPW_H
  25. #define PORT_IPW_H
  26. /**
  27. * @file Port_Ipw.h
  28. * @internal
  29. * @defgroup Port_IPW Port IPW
  30. * @{
  31. */
  32. #ifdef __cplusplus
  33. extern "C"{
  34. #endif
  35. /*=================================================================================================
  36. * INCLUDE FILES
  37. * 1) system and project includes
  38. * 2) needed interfaces from external units
  39. * 3) internal and external interfaces from this unit
  40. =================================================================================================*/
  41. #include "Port_Ci_Port_Ip.h"
  42. #include "Port_Cfg.h"
  43. /*=================================================================================================
  44. * SOURCE FILE VERSION INFORMATION
  45. =================================================================================================*/
  46. /**
  47. * @brief Parameters that shall be published within the Port driver header file and also in the
  48. * module description file
  49. * @details The integration of incompatible files shall be avoided.
  50. *
  51. */
  52. #define PORT_VENDOR_ID_IPW_H 43
  53. #define PORT_AR_RELEASE_MAJOR_VERSION_IPW_H 4
  54. #define PORT_AR_RELEASE_MINOR_VERSION_IPW_H 4
  55. #define PORT_AR_RELEASE_REVISION_VERSION_IPW_H 0
  56. #define PORT_SW_MAJOR_VERSION_IPW_H 1
  57. #define PORT_SW_MINOR_VERSION_IPW_H 0
  58. #define PORT_SW_PATCH_VERSION_IPW_H 0
  59. /*=================================================================================================
  60. * FILE VERSION CHECKS
  61. =================================================================================================*/
  62. /* Check if the files Port_Ipw.h and Port_Ci_Port_Ip.h are of the same vendor */
  63. #if (PORT_VENDOR_ID_IPW_H != PORT_CI_PORT_IP_VENDOR_ID_H)
  64. #error "Port_Ipw.h and Port_Ci_Port_Ip.h have different vendor ids"
  65. #endif
  66. /* Check if the files Port_Ipw.h and Port_Ci_Port_Ip.h are of the same Autosar version */
  67. #if ((PORT_AR_RELEASE_MAJOR_VERSION_IPW_H != PORT_CI_PORT_IP_AR_RELEASE_MAJOR_VERSION_H) || \
  68. (PORT_AR_RELEASE_MINOR_VERSION_IPW_H != PORT_CI_PORT_IP_AR_RELEASE_MINOR_VERSION_H) || \
  69. (PORT_AR_RELEASE_REVISION_VERSION_IPW_H != PORT_CI_PORT_IP_AR_RELEASE_REVISION_VERSION_H) \
  70. )
  71. #error "AutoSar Version Numbers of Port_Ipw.h and Port_Ci_Port_Ip.h are different"
  72. #endif
  73. /* Check if the files Port_Ipw.h and Port_Ci_Port_Ip.h are of the same software version */
  74. #if ((PORT_SW_MAJOR_VERSION_IPW_H != PORT_CI_PORT_IP_SW_MAJOR_VERSION_H) || \
  75. (PORT_SW_MINOR_VERSION_IPW_H != PORT_CI_PORT_IP_SW_MINOR_VERSION_H) || \
  76. (PORT_SW_PATCH_VERSION_IPW_H != PORT_CI_PORT_IP_SW_PATCH_VERSION_H) \
  77. )
  78. #error "Software Version Numbers of Port_Ipw.h and Port_Ci_Port_Ip.h are different"
  79. #endif
  80. /* Check if the files Port_Ipw.h and Port_Cfg.h are of the same vendor */
  81. #if (PORT_VENDOR_ID_IPW_H != PORT_VENDOR_ID_CFG_H)
  82. #error "Port_Ipw.h and Port_Cfg.h have different vendor ids"
  83. #endif
  84. /* Check if the files Port_Ipw.h and Port_Cfg.h are of the same Autosar version */
  85. #if ((PORT_AR_RELEASE_MAJOR_VERSION_IPW_H != PORT_AR_RELEASE_MAJOR_VERSION_CFG_H) || \
  86. (PORT_AR_RELEASE_MINOR_VERSION_IPW_H != PORT_AR_RELEASE_MINOR_VERSION_CFG_H) || \
  87. (PORT_AR_RELEASE_REVISION_VERSION_IPW_H != PORT_AR_RELEASE_REVISION_VERSION_CFG_H) \
  88. )
  89. #error "AutoSar Version Numbers of Port_Ipw.h and Port_Cfg.h are different"
  90. #endif
  91. /* Check if the files Port_Ipw.h and Port_Cfg.h are of the same software version */
  92. #if ((PORT_SW_MAJOR_VERSION_IPW_H != PORT_SW_MAJOR_VERSION_CFG_H) || \
  93. (PORT_SW_MINOR_VERSION_IPW_H != PORT_SW_MINOR_VERSION_CFG_H) || \
  94. (PORT_SW_PATCH_VERSION_IPW_H != PORT_SW_PATCH_VERSION_CFG_H) \
  95. )
  96. #error "Software Version Numbers of Port_Ipw.h and Port_Cfg.h are different"
  97. #endif
  98. /*=================================================================================================
  99. * CONSTANTS
  100. =================================================================================================*/
  101. /*=================================================================================================
  102. * DEFINES AND MACROS
  103. =================================================================================================*/
  104. #define PORT_MODE_BIT_OFFSET_MASK_U8 ((uint8)0x0F)
  105. #define PORT_PIN_LEVEL_LOW_U8 ((uint8)0) /**< @brief Sets port pin in '0' logic. */
  106. #define PORT_PIN_LEVEL_HIGH_U8 ((uint8)1) /**< @brief Sets port pin in '1' logic. */
  107. #define PORT_CI_PCR_ALT_MODE_U32 (0x00000700UL)
  108. #define PORT_CI_BIT_OFFSET_MASK_U8 ((uint8)0x0F)
  109. /* @brief PCR bit offset */
  110. #define PORT_CI_PCR_ALT_MODE_OFFSET_U32 ((uint32)8)
  111. /*=================================================================================================
  112. * ENUMS
  113. =================================================================================================*/
  114. /*=================================================================================================
  115. * STRUCTURES AND OTHER TYPEDEFS
  116. =================================================================================================*/
  117. /*=================================================================================================
  118. * GLOBAL VARIABLE DECLARATIONS
  119. =================================================================================================*/
  120. /*=================================================================================================
  121. * FUNCTION PROTOTYPES
  122. =================================================================================================*/
  123. #define PORT_START_SEC_CODE
  124. #include "Port_MemMap.h"
  125. /*!
  126. * @brief
  127. * @details
  128. *
  129. * @param[in]
  130. *
  131. * @return void
  132. **/
  133. void Port_Ipw_SetGpioDirChangeability
  134. (
  135. uint16 PadID,
  136. boolean bStatus
  137. );
  138. /*!
  139. * @brief
  140. * @details
  141. *
  142. * @param[in]
  143. *
  144. * @return void
  145. **/
  146. void Port_Ipw_SetGpioPadOutput
  147. (
  148. Port_PinType PinIndex,
  149. const Port_ConfigType * pConfigPtr
  150. );
  151. /*!
  152. * @brief Initializes the PORT CI IP Driver
  153. * @details The function Port_Ipw_Init will initialize ALL ports and port pins with the
  154. * configuration set pointed to by the parameter pConfigPtr.
  155. *
  156. * @param[in] pConfigPtr A pointer to the structure which contains initialization parameters
  157. *
  158. * @return void
  159. *
  160. *
  161. **/
  162. void Port_Ipw_Init
  163. (
  164. const Port_ConfigType * pConfigPtr
  165. );
  166. #if (STD_ON == PORT_SET_PIN_DIRECTION_API) || (STD_ON == PORT_SET_PIN_MODE_API)
  167. /*!
  168. * @brief Sets the port pin direction
  169. * @details Sets the pin direction at runtime, changing it only if the pin is configurated as
  170. * changeable.
  171. *
  172. * @param[in] PinIndex Pin ID number
  173. * @param[in] eDirection Port Pin direction
  174. * @param[in] pConfigPtr A pointer to the structure which contains initialization parameters
  175. *
  176. * @return Error code after execution
  177. * @retval 0 No error occured
  178. * @retval 1 Pin direction cannot be changed
  179. *
  180. *
  181. **/
  182. Std_ReturnType Port_Ipw_SetPinDirection
  183. (
  184. Port_PinType PinIndex,
  185. Port_PinDirectionType eDirection,
  186. const Port_ConfigType * pConfigPtr
  187. );
  188. #endif /* (STD_ON == PORT_SET_PIN_DIRECTION_API) || (STD_ON == PORT_SET_PIN_MODE_API) */
  189. #if defined(PORT_SET_2_PINS_DIRECTION_API) && (STD_ON == PORT_SET_2_PINS_DIRECTION_API)
  190. /**
  191. * @brief Sets the port direction for 2 pins
  192. * @details Sets the pin direction at runtime, changing it only if the pins are configured as
  193. * changeable.
  194. *
  195. * @param[in] Pin1Index Pin1 ID number
  196. * @param[in] Pin2Index Pin2 ID number
  197. * @param[in] eDirection Port Pin direction
  198. * @param[in] pConfigPtr A pointer to the structure which contains initialization parameters
  199. *
  200. * @return Error code after execution
  201. * @retval 0 No error occured
  202. * @retval 1 Pin direction cannot be changed
  203. *
  204. * @pre Port_Init must have been called
  205. * @post none
  206. */
  207. Std_ReturnType Port_Ipw_Set2PinsDirection
  208. (
  209. Port_PinType Pin1Index,
  210. Port_PinType Pin2Index,
  211. Port_PinDirectionType eDirection,
  212. const Port_ConfigType * pConfigPtr
  213. );
  214. #endif /* defined(PORT_SET_2_PINS_DIRECTION_API) && (STD_ON == PORT_SET_2_PINS_DIRECTION_API) */
  215. #if (STD_ON == PORT_SET_PIN_MODE_API)
  216. /*!
  217. * @brief Sets the port pin mode.
  218. *
  219. * @details The function @p Port_Ipw_SetPinMode will set the port pin mode of the
  220. * referenced pin during runtime.
  221. *
  222. * @param[in] PinIndex Pin ID number.
  223. * @param[in] PinMode New Port Pin mode to be set on port pin.
  224. * @param[in] pConfigPtr Pointer to the initialization data structure
  225. *
  226. * @return void
  227. *
  228. **/
  229. Std_ReturnType Port_Ipw_SetPinMode
  230. (
  231. Port_PinType PinIndex,
  232. Port_PinModeType PinMode,
  233. const Port_ConfigType * pConfigPtr
  234. );
  235. #endif /* (STD_ON == PORT_SET_PIN_MODE_API) */
  236. /*!
  237. * @brief Refreshes port direction.
  238. * @details This service shall refresh the direction of all configured ports to the configured
  239. * direction. The PORT driver shall exclude from refreshing those port pins that are
  240. * configured as pin direction changeable during runtime.
  241. *
  242. * @param[in] numPins Number of pins to be refreshed
  243. *
  244. * @return void
  245. *
  246. *
  247. **/
  248. void Port_Ipw_RefreshPortDirection
  249. (
  250. const Port_ConfigType * pConfigPtr
  251. );
  252. #ifdef PORT_SET_AS_UNUSED_PIN_API
  253. #if (STD_ON == PORT_SET_AS_UNUSED_PIN_API)
  254. /*!
  255. * @brief Set as unused pin.
  256. * @details This function shall configure the referenced pin with all
  257. * the properties specified in the NotUsedPortPin container.
  258. *
  259. * @param[in] PinIndex Pin ID number.
  260. * @param[in] pConfigPtr A pointer to the structure which contains initialization parameters
  261. *
  262. * @return void
  263. *
  264. **/
  265. void Port_Ipw_SetAsUnusedPin
  266. (
  267. Port_PinType PinIndex,
  268. const Port_ConfigType * pConfigPtr
  269. );
  270. /*!
  271. * @brief Set as used pin.
  272. * @details This function shall configure the referenced pin with
  273. * all the properties that where set during the Port_Init operation.
  274. *
  275. * @param[in] PinIndex Pin ID number.
  276. * @param[in] pConfigPtr A pointer to the structure which contains initialization parameters
  277. *
  278. * @return void
  279. *
  280. *
  281. **/
  282. void Port_Ipw_SetAsUsedPin
  283. (
  284. Port_PinType PinIndex,
  285. const Port_ConfigType * pConfigPtr
  286. );
  287. #endif /* (STD_ON == PORT_SET_AS_UNUSED_PIN_API) */
  288. #endif
  289. #ifdef PORT_RESET_PIN_MODE_API
  290. #if (STD_ON == PORT_RESET_PIN_MODE_API)
  291. /*!
  292. * @brief reset the port pin mode.
  293. *
  294. * @details The function @p Port_Ipw_ResetPinMode will reset the port pin mode of the
  295. * referenced pin during runtime.
  296. *
  297. *
  298. * @param[in] PinIndex Pin ID number.
  299. * @param[in] pConfigPtr Pointer to the initialization data structure
  300. *
  301. * @return void
  302. *
  303. *
  304. **/
  305. void Port_Ipw_ResetPinMode
  306. (
  307. Port_PinType PinIndex,
  308. const Port_ConfigType * pConfigPtr
  309. );
  310. #endif /* (STD_ON == PORT_RESET_PIN_MODE_API) */
  311. #endif
  312. #define PORT_STOP_SEC_CODE
  313. #include "Port_MemMap.h"
  314. #ifdef __cplusplus
  315. }
  316. #endif
  317. #endif /*PORT_IPW_H*/
  318. /** @} */