Dio_Cfg.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  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_CFG_H
  25. #define DIO_CFG_H
  26. /**
  27. * @file Dio_Cfg.h
  28. * @implements Dio_Cfg.h_Artifact
  29. *
  30. * @defgroup DIO_CFG Dio Cfg
  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 "StandardTypes.h"
  43. /*=================================================================================================
  44. * SOURCE FILE VERSION INFORMATION
  45. =================================================================================================*/
  46. #define DIO_VENDOR_ID_CFG_H 43
  47. #define DIO_AR_RELEASE_MAJOR_VERSION_CFG_H 4
  48. #define DIO_AR_RELEASE_MINOR_VERSION_CFG_H 4
  49. #define DIO_AR_RELEASE_REVISION_VERSION_CFG_H 0
  50. #define DIO_SW_MAJOR_VERSION_CFG_H 1
  51. #define DIO_SW_MINOR_VERSION_CFG_H 0
  52. #define DIO_SW_PATCH_VERSION_CFG_H 0
  53. /*=================================================================================================
  54. * FILE VERSION CHECKS
  55. =================================================================================================*/
  56. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  57. /* StandardTypes.h version check start */
  58. #if ((DIO_AR_RELEASE_MAJOR_VERSION_CFG_H != STD_AR_RELEASE_MAJOR_VERSION) || \
  59. (DIO_AR_RELEASE_MINOR_VERSION_CFG_H != STD_AR_RELEASE_MINOR_VERSION) \
  60. )
  61. #error "AUTOSAR Version Numbers of Dio_Cfg.h and StandardTypes.h are different"
  62. #endif
  63. /* StandardTypes.h version check end */
  64. #endif
  65. /*=================================================================================================
  66. * CONSTANTS
  67. =================================================================================================*/
  68. /**
  69. * @brief Enable or Disable Development Error Detection.
  70. *
  71. * @implements DIO_DEV_ERROR_DETECT_define
  72. */
  73. #define DIO_DEV_ERROR_DETECT (STD_OFF)
  74. /**
  75. * @brief Function @p Dio_GetVersionInfo() enable switch.
  76. *
  77. * @implements DIO_VERSION_INFO_API_define
  78. */
  79. #define DIO_VERSION_INFO_API (STD_OFF)
  80. /**
  81. * @brief Function @p Dio_FlipChannel() enable switch.
  82. */
  83. #define DIO_FLIP_CHANNEL_API (STD_ON)
  84. /**
  85. * @brief Function @p Dio_MaskedWritePort() enable switch.
  86. */
  87. #define DIO_MASKEDWRITEPORT_API (STD_OFF)
  88. /**
  89. * @brief Reversed port functionality enable switch.
  90. *
  91. * @implements DIO_REVERSEPORTBITS_define
  92. */
  93. #define DIO_REVERSEPORTBITS (STD_OFF)
  94. /**
  95. * @brief Undefined pins masking enable switch.
  96. */
  97. #define DIO_READZERO_UNDEFINEDPORTS (STD_OFF)
  98. /**
  99. * @brief The number of partition on the platform.
  100. *
  101. * @note Used for channel, port and channel group validation.
  102. */
  103. /**
  104. * @brief Enable/Disable multiocre function from the driver
  105. */
  106. #define DIO_MULTICORE_ENABLED (STD_OFF)
  107. /**
  108. * @brief Number of implemented ports.
  109. *
  110. * @note Used for channel, port and channel group validation.
  111. */
  112. #define DIO_NUM_PORTS_U16 ((uint16)0x5)
  113. /**
  114. * @brief The number of partition on the port
  115. *
  116. * @note Used for port validation.
  117. */
  118. #define DIO_PORT_PARTITION_U16 ((uint16)5U)
  119. /**
  120. * @brief Number of channels available on the implemented ports.
  121. *
  122. * @note Used for channel validation.
  123. */
  124. #if (STD_ON == DIO_DEV_ERROR_DETECT)
  125. #define DIO_NUM_CHANNELS_U16 ((uint16)139U)
  126. #endif
  127. /**
  128. * @brief The number of partition on the channel.
  129. *
  130. * @note Used for channel validation.
  131. */
  132. #define DIO_CHANNEL_PARTITION_U16 ((uint16)140U)
  133. /**
  134. * @brief Mask representing no available channels on a port.
  135. *
  136. * @note Used for channel validation.
  137. */
  138. #if (STD_ON == DIO_DEV_ERROR_DETECT)
  139. #define DIO_NO_AVAILABLE_CHANNELS_U16 ((Dio_PortLevelType)0x0U)
  140. #endif
  141. /**
  142. * @brief Mask representing the maximum valid offset for a channel group.
  143. *
  144. * @note Used for channel group validation.
  145. */
  146. #if (STD_ON == DIO_DEV_ERROR_DETECT)
  147. #define DIO_MAX_VALID_OFFSET_U8 ((uint8)0x1FU)
  148. #endif
  149. /**
  150. * @brief Enables or disables the access to a hardware register from user mode
  151. * USER_MODE_SOFT_LOCKING: All reads to hw registers will be done via REG_PROT, user mode access
  152. * SUPERVISOR_MODE_SOFT_LOCKING: Locks the access to the registers only for supervisor mode
  153. *
  154. * @note Currently, no register protection mechanism is used for Dio driver.
  155. */
  156. #define DIO_USER_MODE_SOFT_LOCKING (STD_OFF)
  157. /**
  158. * @brief Dio driver Pre-Compile configuration switch.
  159. */
  160. #define DIO_PRECOMPILE_SUPPORT
  161. /**
  162. * @brief Support for User mode.
  163. * If this parameter has been configured to 'STD_ON', the Dio driver code can be executed from both supervisor and user mode.
  164. *
  165. */
  166. #define DIO_ENABLE_USER_MODE_SUPPORT (STD_OFF)
  167. #ifndef MCAL_ENABLE_USER_MODE_SUPPORT
  168. #ifdef DIO_ENABLE_USER_MODE_SUPPORT
  169. #if (STD_ON == DIO_ENABLE_USER_MODE_SUPPORT)
  170. #error MCAL_ENABLE_USER_MODE_SUPPORT is not enabled. For running Dio in user mode the MCAL_ENABLE_USER_MODE_SUPPORT needs to be defined
  171. #endif /* (STD_ON == DIO_ENABLE_USER_MODE_SUPPORT) */
  172. #endif /* ifdef DIO_ENABLE_USER_MODE_SUPPORT*/
  173. #endif /* ifndef MCAL_ENABLE_USER_MODE_SUPPORT */
  174. /*=================================================================================================
  175. * DEFINES AND MACROS
  176. =================================================================================================*/
  177. /**
  178. * @brief Symbolic name for the configuration Dio_ConfigPC.
  179. *
  180. */
  181. #define Dio_ConfigPC (Dio_Config)
  182. /* ========== DioConfig ========== */
  183. /* ---------- DioPort_A ---------- */
  184. /**
  185. * @brief Symbolic name for the port DioPort_A.
  186. *
  187. */
  188. #define DioConf_DioPort_DioPort_A ((uint8)0x00U)
  189. /**
  190. * @brief Symbolic name for the channel PTA11_GPIO_OUT_MCU_HIGH_OUT1_CTRL.
  191. *
  192. */
  193. #define DioConf_DioChannel_PTA11_GPIO_OUT_MCU_HIGH_OUT1_CTRL ((uint16)0x000bU)
  194. /**
  195. * @brief Symbolic name for the channel PTA6_GPIO_OUT_MCU_4G_POW_EN.
  196. *
  197. */
  198. #define DioConf_DioChannel_PTA6_GPIO_OUT_MCU_4G_POW_EN ((uint16)0x0006U)
  199. /**
  200. * @brief Symbolic name for the channel PTA7_GPIO_OUT_MCU_4G_PWRKEY.
  201. *
  202. */
  203. #define DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY ((uint16)0x0007U)
  204. /**
  205. * @brief Symbolic name for the channel PTA10_GPIO_IN_OUT_MCU_BATT_IIC_SDA.
  206. *
  207. */
  208. #define DioConf_DioChannel_PTA10_GPIO_IN_OUT_MCU_BATT_IIC_SDA ((uint16)0x000aU)
  209. /**
  210. * @brief Symbolic name for the channel PTA0_GPIO_IN_MCU_PWR_INPUT_SIGNAL.
  211. *
  212. */
  213. #define DioConf_DioChannel_PTA0_GPIO_IN_MCU_PWR_INPUT_SIGNAL ((uint16)0x0000U)
  214. /**
  215. * @brief Symbolic name for the channel PTA1_GPIO_OUT_MCU_BAT_PWR_EN.
  216. *
  217. */
  218. #define DioConf_DioChannel_PTA1_GPIO_OUT_MCU_BAT_PWR_EN ((uint16)0x0001U)
  219. /* ---------- DioPort_B ---------- */
  220. /**
  221. * @brief Symbolic name for the port DioPort_B.
  222. *
  223. */
  224. #define DioConf_DioPort_DioPort_B ((uint8)0x01U)
  225. /**
  226. * @brief Symbolic name for the channel PTB0_GPIO_IN_MCU_WAKEUP1.
  227. *
  228. */
  229. #define DioConf_DioChannel_PTB0_GPIO_IN_MCU_WAKEUP1 ((uint16)0x0020U)
  230. /**
  231. * @brief Symbolic name for the channel PTB1_GPIO_IN_MCU_4G_STATUS.
  232. *
  233. */
  234. #define DioConf_DioChannel_PTB1_GPIO_IN_MCU_4G_STATUS ((uint16)0x0021U)
  235. /**
  236. * @brief Symbolic name for the channel PTB2_GPIO_IN_MCU_4G_RI.
  237. *
  238. */
  239. #define DioConf_DioChannel_PTB2_GPIO_IN_MCU_4G_RI ((uint16)0x0022U)
  240. /**
  241. * @brief Symbolic name for the channel PTB4_GPIO_OUT_MCU_RS485_EN.
  242. *
  243. */
  244. #define DioConf_DioChannel_PTB4_GPIO_OUT_MCU_RS485_EN ((uint16)0x0024U)
  245. /* ---------- DioPort_C ---------- */
  246. /**
  247. * @brief Symbolic name for the port DioPort_C.
  248. *
  249. */
  250. #define DioConf_DioPort_DioPort_C ((uint8)0x02U)
  251. /**
  252. * @brief Symbolic name for the channel PTC16_GPIO_OUT_MCU_CAN1_STB.
  253. *
  254. */
  255. #define DioConf_DioChannel_PTC16_GPIO_OUT_MCU_CAN1_STB ((uint16)0x0050U)
  256. /**
  257. * @brief Symbolic name for the channel PTC17_GPIO_OUT_MCU_CAN0_STB.
  258. *
  259. */
  260. #define DioConf_DioChannel_PTC17_GPIO_OUT_MCU_CAN0_STB ((uint16)0x0051U)
  261. /**
  262. * @brief Symbolic name for the channel PTC5_GPIO_IN_OUT_MCU_BATT_IIC_SCK.
  263. *
  264. */
  265. #define DioConf_DioChannel_PTC5_GPIO_IN_OUT_MCU_BATT_IIC_SCK ((uint16)0x0045U)
  266. /* ---------- DioPort_D ---------- */
  267. /**
  268. * @brief Symbolic name for the port DioPort_D.
  269. *
  270. */
  271. #define DioConf_DioPort_DioPort_D ((uint8)0x03U)
  272. /**
  273. * @brief Symbolic name for the channel PTD0_GPIO_OUT_MCU_GPS_RESET.
  274. *
  275. */
  276. #define DioConf_DioChannel_PTD0_GPIO_OUT_MCU_GPS_RESET ((uint16)0x0060U)
  277. /**
  278. * @brief Symbolic name for the channel PTD1_GPIO_OUT_MCU_GPS_POW_EN.
  279. *
  280. */
  281. #define DioConf_DioChannel_PTD1_GPIO_OUT_MCU_GPS_POW_EN ((uint16)0x0061U)
  282. /**
  283. * @brief Symbolic name for the channel PTD2_GPIO_OUT_MCU_4G_DTR.
  284. *
  285. */
  286. #define DioConf_DioChannel_PTD2_GPIO_OUT_MCU_4G_DTR ((uint16)0x0062U)
  287. /**
  288. * @brief Symbolic name for the channel PTD3_GPIO_OUT_MCU_4G_RESET.
  289. *
  290. */
  291. #define DioConf_DioChannel_PTD3_GPIO_OUT_MCU_4G_RESET ((uint16)0x0063U)
  292. /**
  293. * @brief Symbolic name for the channel PTD15_GPIO_OUT_MCU_HIGH_OUT2_CTRL.
  294. *
  295. */
  296. #define DioConf_DioChannel_PTD15_GPIO_OUT_MCU_HIGH_OUT2_CTRL ((uint16)0x006fU)
  297. /**
  298. * @brief Symbolic name for the channel PTD16_GPIO_OUT_MCU_LOW_DRV_EN.
  299. *
  300. */
  301. #define DioConf_DioChannel_PTD16_GPIO_OUT_MCU_LOW_DRV_EN ((uint16)0x0070U)
  302. /* ---------- DioPort_E ---------- */
  303. /**
  304. * @brief Symbolic name for the port DioPort_E.
  305. *
  306. */
  307. #define DioConf_DioPort_DioPort_E ((uint8)0x04U)
  308. /**
  309. * @brief Symbolic name for the channel PTE2_GPIO_IN_MCU_WAKEUP2.
  310. *
  311. */
  312. #define DioConf_DioChannel_PTE2_GPIO_IN_MCU_WAKEUP2 ((uint16)0x0082U)
  313. /**
  314. * @brief Symbolic name for the channel PTE0_GPIO_OUT_MCU_LED1.
  315. *
  316. */
  317. #define DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1 ((uint16)0x0080U)
  318. /**
  319. * @brief Symbolic name for the channel PTE1_GPIO_OUT_MCU_LED2.
  320. *
  321. */
  322. #define DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2 ((uint16)0x0081U)
  323. /**
  324. * @brief Symbolic name for the channel PTE7_GPIO_OUT_MCU_LED3.
  325. *
  326. */
  327. #define DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3 ((uint16)0x0087U)
  328. /**
  329. * @brief Symbolic name for the channel PTE10_GPIO_IN_MCU_CHRG_STATE.
  330. *
  331. */
  332. #define DioConf_DioChannel_PTE10_GPIO_IN_MCU_CHRG_STATE ((uint16)0x008aU)
  333. /*=================================================================================================
  334. * ENUMS
  335. =================================================================================================*/
  336. /*=================================================================================================
  337. * STRUCTURES AND OTHER TYPEDEFS
  338. =================================================================================================*/
  339. /**
  340. * @brief Type of a DIO port representation.
  341. *
  342. * @implements Dio_PortType_typedef
  343. */
  344. typedef uint8 Dio_PortType;
  345. /**
  346. * @brief Type of a DIO channel representation.
  347. *
  348. * @implements Dio_ChannelType_typedef
  349. */
  350. typedef uint16 Dio_ChannelType;
  351. /**
  352. * @brief Type of a DIO port levels representation.
  353. *
  354. * @implements Dio_PortLevelType_typedef
  355. */
  356. typedef uint32 Dio_PortLevelType;
  357. /**
  358. * @brief Type of a DIO channel levels representation.
  359. *
  360. * @implements Dio_LevelType_typedef
  361. */
  362. typedef uint8 Dio_LevelType;
  363. /**
  364. * @brief Type of a DIO channel group representation.
  365. *
  366. * @implements Dio_ChannelGroupType_struct
  367. */
  368. typedef struct
  369. {
  370. Dio_PortType port; /**< @brief Port identifier. */
  371. uint8 u8offset; /**< @brief Bit offset within the port. */
  372. Dio_PortLevelType mask; /**< @brief Group mask. */
  373. } Dio_ChannelGroupType;
  374. /**
  375. * @brief Type of a DIO configuration structure.
  376. *
  377. * @note In this implementation there is no need for a configuration
  378. * structure there is only a dummy field, it is recommended
  379. * to initialize this field to zero.
  380. *
  381. * @implements Dio_ConfigType_struct
  382. */
  383. typedef struct
  384. {
  385. uint8 u8NumChannelGroups; /**< @brief Number of channel groups in configuration */
  386. const Dio_ChannelGroupType * pChannelGroupList; /**< @brief
  387. Pointer to list of channel groups in configuration */
  388. const uint32 * pau32Dio_ChannelToPartitionMap; /**< @brief Pointer to channel to partition mapping */
  389. const uint32 * pau32Dio_PortToPartitionMap; /**< @brief Pointer to port to partition mapping */
  390. } Dio_ConfigType;
  391. /*=================================================================================================
  392. * GLOBAL VARIABLE DECLARATIONS
  393. =================================================================================================*/
  394. #define DIO_START_SEC_CONST_32
  395. #include "Dio_MemMap.h"
  396. /**
  397. * @brief Array containing list of mapping channel for partition
  398. */
  399. extern const uint32 au32Dio_ChannelToPartitionMap[DIO_CHANNEL_PARTITION_U16];
  400. /**
  401. * @brief Array containing list of mapping port for partition
  402. */
  403. extern const uint32 au32Dio_PortToPartitionMap[DIO_PORT_PARTITION_U16];
  404. /**
  405. * @brief Array of bitmaps of output pins available per port
  406. */
  407. extern const Dio_PortLevelType Dio_aAvailablePinsForWrite[DIO_NUM_PORTS_U16];
  408. /**
  409. * @brief Array of bitmaps of input pins available per port
  410. */
  411. extern const Dio_PortLevelType Dio_aAvailablePinsForRead[DIO_NUM_PORTS_U16];
  412. #define DIO_STOP_SEC_CONST_32
  413. #include "Dio_MemMap.h"
  414. /*=================================================================================================
  415. * FUNCTION PROTOTYPES
  416. =================================================================================================*/
  417. #ifdef __cplusplus
  418. }
  419. #endif
  420. #endif /* DIO_CFG_H */
  421. /** @} */