Port_Ci_Port_Ip.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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_CI_PORT_IP_H
  25. #define PORT_CI_PORT_IP_H
  26. /**
  27. * @file Port_Ci_Port_Ip.h
  28. *
  29. * @defgroup Port_IPL Port IPL
  30. * @{
  31. */
  32. #if defined(__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 "StandardTypes.h"
  42. #include "Port_Ci_Port_Ip_Cfg.h"
  43. #include "Port_Ci_Port_Ip_Types.h"
  44. #include "Port_Ci_Port_Ip_Defines.h"
  45. #include <devassert.h>
  46. /*==================================================================================================
  47. * SOURCE FILE VERSION INFORMATION
  48. ==================================================================================================*/
  49. /**
  50. * @brief Parameters that shall be published within the Port driver header file and also in the
  51. * module description file
  52. * @details The integration of incompatible files shall be avoided.
  53. *
  54. */
  55. #define PORT_CI_PORT_IP_VENDOR_ID_H 43
  56. #define PORT_CI_PORT_IP_AR_RELEASE_MAJOR_VERSION_H 4
  57. #define PORT_CI_PORT_IP_AR_RELEASE_MINOR_VERSION_H 4
  58. #define PORT_CI_PORT_IP_AR_RELEASE_REVISION_VERSION_H 0
  59. #define PORT_CI_PORT_IP_SW_MAJOR_VERSION_H 1
  60. #define PORT_CI_PORT_IP_SW_MINOR_VERSION_H 0
  61. #define PORT_CI_PORT_IP_SW_PATCH_VERSION_H 0
  62. /*==================================================================================================
  63. * FILE VERSION CHECKS
  64. ==================================================================================================*/
  65. /* Check if the files Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Cfg.h are of the same vendor */
  66. #if (PORT_CI_PORT_IP_VENDOR_ID_H != PORT_CI_PORT_IP_VENDOR_ID_CFG_H)
  67. #error "Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Cfg.h have different vendor ids"
  68. #endif
  69. /* Check if the files Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Cfg.h are of the same Autosar version */
  70. #if ((PORT_CI_PORT_IP_AR_RELEASE_MAJOR_VERSION_H != PORT_CI_PORT_IP_AR_RELEASE_MAJOR_VERSION_CFG_H) || \
  71. (PORT_CI_PORT_IP_AR_RELEASE_MINOR_VERSION_H != PORT_CI_PORT_IP_AR_RELEASE_MINOR_VERSION_CFG_H) || \
  72. (PORT_CI_PORT_IP_AR_RELEASE_REVISION_VERSION_H != PORT_CI_PORT_IP_AR_RELEASE_REVISION_VERSION_CFG_H) \
  73. )
  74. #error "AutoSar Version Numbers of Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Cfg.h are different"
  75. #endif
  76. /* Check if the files Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Cfg.h are of the same software version */
  77. #if ((PORT_CI_PORT_IP_SW_MAJOR_VERSION_H != PORT_CI_PORT_IP_SW_MAJOR_VERSION_CFG_H) || \
  78. (PORT_CI_PORT_IP_SW_MINOR_VERSION_H != PORT_CI_PORT_IP_SW_MINOR_VERSION_CFG_H) || \
  79. (PORT_CI_PORT_IP_SW_PATCH_VERSION_H != PORT_CI_PORT_IP_SW_PATCH_VERSION_CFG_H) \
  80. )
  81. #error "Software Version Numbers of Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Cfg.h are different"
  82. #endif
  83. /* Check if the files Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Types.h are of the same vendor */
  84. #if (PORT_CI_PORT_IP_VENDOR_ID_H != PORT_CI_PORT_IP_VENDOR_ID_TYPES_H)
  85. #error "Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Types.h have different vendor ids"
  86. #endif
  87. /* Check if the files Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Types.h are of the same Autosar version */
  88. #if ((PORT_CI_PORT_IP_AR_RELEASE_MAJOR_VERSION_H != PORT_CI_PORT_IP_AR_RELEASE_MAJOR_VERSION_TYPES_H) || \
  89. (PORT_CI_PORT_IP_AR_RELEASE_MINOR_VERSION_H != PORT_CI_PORT_IP_AR_RELEASE_MINOR_VERSION_TYPES_H) || \
  90. (PORT_CI_PORT_IP_AR_RELEASE_REVISION_VERSION_H != PORT_CI_PORT_IP_AR_RELEASE_REVISION_VERSION_TYPES_H) \
  91. )
  92. #error "AutoSar Version Numbers of Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Types.h are different"
  93. #endif
  94. /* Check if the files Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Types.h are of the same software version */
  95. #if ((PORT_CI_PORT_IP_SW_MAJOR_VERSION_H != PORT_CI_PORT_IP_SW_MAJOR_VERSION_TYPES_H) || \
  96. (PORT_CI_PORT_IP_SW_MINOR_VERSION_H != PORT_CI_PORT_IP_SW_MINOR_VERSION_TYPES_H) || \
  97. (PORT_CI_PORT_IP_SW_PATCH_VERSION_H != PORT_CI_PORT_IP_SW_PATCH_VERSION_TYPES_H) \
  98. )
  99. #error "Software Version Numbers of Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Types.h are different"
  100. #endif
  101. /* Check if the files Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Defines.h are of the same vendor */
  102. #if (PORT_CI_PORT_IP_VENDOR_ID_H != PORT_CI_PORT_IP_VENDOR_ID_DEFINES_H)
  103. #error "Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Defines.h have different vendor ids"
  104. #endif
  105. /* Check if the files Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Defines.h are of the same Autosar version */
  106. #if ((PORT_CI_PORT_IP_AR_RELEASE_MAJOR_VERSION_H != PORT_CI_PORT_IP_AR_RELEASE_MAJOR_VERSION_DEFINES_H) || \
  107. (PORT_CI_PORT_IP_AR_RELEASE_MINOR_VERSION_H != PORT_CI_PORT_IP_AR_RELEASE_MINOR_VERSION_DEFINES_H) || \
  108. (PORT_CI_PORT_IP_AR_RELEASE_REVISION_VERSION_H != PORT_CI_PORT_IP_AR_RELEASE_REVISION_VERSION_DEFINES_H) \
  109. )
  110. #error "AutoSar Version Numbers of Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Defines.h are different"
  111. #endif
  112. /* Check if the files Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Defines.h are of the same software version */
  113. #if ((PORT_CI_PORT_IP_SW_MAJOR_VERSION_H != PORT_CI_PORT_IP_SW_MAJOR_VERSION_DEFINES_H) || \
  114. (PORT_CI_PORT_IP_SW_MINOR_VERSION_H != PORT_CI_PORT_IP_SW_MINOR_VERSION_DEFINES_H) || \
  115. (PORT_CI_PORT_IP_SW_PATCH_VERSION_H != PORT_CI_PORT_IP_SW_PATCH_VERSION_DEFINES_H) \
  116. )
  117. #error "Software Version Numbers of Port_Ci_Port_Ip.h and Port_Ci_Port_Ip_Defines.h are different"
  118. #endif
  119. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  120. /* Check if the files Port_Ci_Port_Ip.h and StandardTypes.h are of the same version */
  121. #if ((PORT_CI_PORT_IP_AR_RELEASE_MAJOR_VERSION_H != STD_AR_RELEASE_MAJOR_VERSION) || \
  122. (PORT_CI_PORT_IP_AR_RELEASE_MINOR_VERSION_H != STD_AR_RELEASE_MINOR_VERSION) \
  123. )
  124. #error "AutoSar Version Numbers of Port_Ci_Port_Ip.h and StandardTypes.h are different"
  125. #endif
  126. /* Check if the files Port_Ci_Port_Ip.h and Devassert.h are of the same version */
  127. #if ((PORT_CI_PORT_IP_AR_RELEASE_MAJOR_VERSION_H != DEVASSERT_AR_RELEASE_MAJOR_VERSION) || \
  128. (PORT_CI_PORT_IP_AR_RELEASE_MINOR_VERSION_H != DEVASSERT_AR_RELEASE_MINOR_VERSION) \
  129. )
  130. #error "AutoSar Version Numbers of Port_Ci_Port_Ip.h and Devassert.h are different"
  131. #endif
  132. #endif
  133. /*==================================================================================================
  134. * CONSTANTS
  135. ==================================================================================================*/
  136. #define PORT_START_SEC_CONST_32
  137. #include "Port_MemMap.h"
  138. extern PORT_Type * Port_au32PortCiPortBaseAddr[5];
  139. extern GPIO_Type * Port_au32PortCiGpioBaseAddr[5];
  140. #define PORT_STOP_SEC_CONST_32
  141. #include "Port_MemMap.h"
  142. /*==================================================================================================
  143. * DEFINES AND MACROS
  144. ==================================================================================================*/
  145. #if (PORT_CI_PORT_IP_DEV_ERROR_DETECT == STD_ON)
  146. #define PORT_CI_PORT_DEV_ASSERT(par) DevAssert(par)
  147. #else
  148. #define PORT_CI_PORT_DEV_ASSERT(par)
  149. #endif
  150. /*==================================================================================================
  151. * ENUMS
  152. ==================================================================================================*/
  153. /*==================================================================================================
  154. * STRUCTURES AND OTHER TYPEDEFS
  155. ==================================================================================================*/
  156. /*==================================================================================================
  157. * GLOBAL VARIABLE DECLARATIONS
  158. ==================================================================================================*/
  159. /*==================================================================================================
  160. * FUNCTION PROTOTYPES
  161. ==================================================================================================*/
  162. /* @brief Allocate defined section for PORT code. */
  163. #define PORT_START_SEC_CODE
  164. #include "Port_MemMap.h"
  165. /*!
  166. * @brief
  167. *
  168. * @details
  169. *
  170. *
  171. * @param[in]
  172. *
  173. * @return PCR
  174. *
  175. *
  176. **/
  177. uint32 Port_Ci_Port_Ip_ReadPCR(const PORT_Type * base, uint32 MscrInstance);
  178. /*!
  179. * @brief
  180. *
  181. * @details
  182. *
  183. *
  184. * @param[in]
  185. *
  186. * @return void
  187. *
  188. *
  189. **/
  190. void Port_Ci_Port_Ip_SetPCR(PORT_Type * base, uint32 MscrInstance, uint32 value);
  191. /*!
  192. * @brief
  193. *
  194. * @details
  195. *
  196. *
  197. * @param[in]
  198. *
  199. * @return void
  200. *
  201. *
  202. **/
  203. void Port_Ci_Port_Ip_SetPSOR(GPIO_Type * base, uint32 Pin);
  204. /*!
  205. * @brief
  206. *
  207. * @details
  208. *
  209. *
  210. * @param[in]
  211. *
  212. * @return void
  213. *
  214. *
  215. **/
  216. void Port_Ci_Port_Ip_SetPCOR(GPIO_Type * base, uint32 Pin);
  217. /*!
  218. * @brief
  219. *
  220. * @details
  221. *
  222. *
  223. * @param[in]
  224. *
  225. * @return void
  226. *
  227. *
  228. **/
  229. void Port_Ci_Port_Ip_SetPDDR(GPIO_Type * base, uint32 Pin);
  230. /*!
  231. * @brief
  232. *
  233. * @details
  234. *
  235. *
  236. * @param[in]
  237. *
  238. * @return void
  239. *
  240. *
  241. **/
  242. void Port_Ci_Port_Ip_ClearPDDR(GPIO_Type * base, uint32 Pin);
  243. #ifndef FEATURE_PORT_CI_PORT_IP_S32K11X_DERIVATIVE
  244. /*!
  245. * @brief
  246. *
  247. * @details
  248. *
  249. *
  250. * @param[in]
  251. *
  252. * @return void
  253. *
  254. *
  255. **/
  256. void Port_Ci_Port_Ip_SetPIDR(GPIO_Type * base, uint32 Pin);
  257. #endif
  258. /*!
  259. * @brief
  260. *
  261. * @details
  262. *
  263. *
  264. * @param[in]
  265. *
  266. * @return void
  267. *
  268. *
  269. **/
  270. void Port_Ci_Port_Ip_SetDFER(PORT_Type * base, uint32 pinMask);
  271. /*!
  272. * @brief Initializes the pins with the given configuration structure
  273. *
  274. * This function configures the pins with the options provided in the
  275. * provided structure.
  276. *
  277. * @param[in] pinCount The number of configured pins in structure
  278. * @param[in] config The configuration structure
  279. * @return The status of the operation
  280. */
  281. Port_Ci_Port_Ip_PortStatusType Port_Ci_Port_Ip_Init(uint32 pinCount,
  282. const Port_Ci_Port_Ip_PinSettingsConfig config[]);
  283. /*!
  284. * @brief Configures the pin muxing.
  285. *
  286. * This function configures the pin muxing.
  287. *
  288. * @param[in] base Port base pointer (PORTA, PORTB, PORTC, etc.)
  289. * @param[in] pin Port pin number
  290. * @param[in] mux Pin muxing slot selection
  291. */
  292. void Port_Ci_Port_Ip_SetMuxModeSel(PORT_Type * const base,
  293. uint32 pin,
  294. Port_Ci_Port_Ip_PortMux mux);
  295. /*!
  296. * @brief Enables digital filter for digital pin muxing
  297. *
  298. * This function enables digital filter feature for digital pin muxing
  299. *
  300. * @param[in] base Port base pointer (PORTA, PORTB, PORTC, etc.)
  301. * @param[in] pin Port pin number
  302. */
  303. void Port_Ci_Port_Ip_EnableDigitalFilter(PORT_Type * const base,
  304. uint32 pin);
  305. /*!
  306. * @brief Disables digital filter for digital pin muxing
  307. *
  308. * This function disables digital filter feature for digital pin muxing
  309. *
  310. * @param[in] base Port base pointer (PORTA, PORTB, PORTC, etc.)
  311. * @param[in] pin Port pin number
  312. */
  313. void Port_Ci_Port_Ip_DisableDigitalFilter(PORT_Type * const base,
  314. uint32 pin);
  315. /*!
  316. * @brief Configures digital filter for port with given configuration
  317. *
  318. * This function configures digital filter for port with given configuration
  319. *
  320. * Note: Updating the filter configuration must be done only after all filters are disabled.
  321. *
  322. * @param[in] base Port base pointer (PORTA, PORTB, PORTC, etc.)
  323. * @param[in] config the digital filter configuration struct
  324. */
  325. void Port_Ci_Port_Ip_ConfigDigitalFilter(PORT_Type * const base,
  326. const Port_Ci_Port_Ip_DigitalFilterConfigType * config);
  327. /*!
  328. * @brief Quickly configures multiple pins with the same pin configuration.
  329. *
  330. * This function quickly configures multiple pins within the one port for the same peripheral
  331. * function with the same pin configuration. Supports up to 16 pins with the lower or upper
  332. * half of pin registers at the same port.
  333. *
  334. * @param[in] base Port base pointer (PORTA, PORTB, PORTC, etc.)
  335. * @param[in] pins Pin mask where each bit represents one pin. For each bit:
  336. * - 0: pins corresponding to bits with value of '1' is updated with the value input
  337. * - 1: pins corresponding to bits with value of '0' is not updated with the value input
  338. * @param[in] value the config value will be updated for the pins are set to '1'
  339. * @param[in] halfPort the lower or upper half of pin registers at the same port
  340. */
  341. void Port_Ci_Port_Ip_SetGlobalPinControl(PORT_Type * const base,
  342. uint16 pins,
  343. uint16 value,
  344. Port_Ci_Port_Ip_PortGlobalControlPins halfPort);
  345. #define PORT_STOP_SEC_CODE
  346. #include "Port_MemMap.h"
  347. #if defined(__cplusplus)
  348. }
  349. #endif
  350. /** @} */
  351. #endif /* PORT_CI_PORT_IP_H */