Flexio_Mcl_Ip_HwAccess.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : DMA,CACHE,TRGMUX,FLEXIO
  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 FLEXIO_IP_HW_ACCESS_H
  25. #define FLEXIO_IP_HW_ACCESS_H
  26. /**
  27. * @file Flexio_Ip_hw_access.h
  28. * @version 1.0.0
  29. *
  30. * @brief AUTOSAR Mcl - Low level header of Mcl driver.
  31. * @details This file contains declarations of the functions defined by AutoSAR.
  32. *
  33. * @addtogroup FLEXIO_IP_DRIVER FLEXIO IP Driver
  34. * @{
  35. */
  36. #ifdef __cplusplus
  37. extern "C"{
  38. #endif
  39. /*==================================================================================================
  40. * INCLUDE FILES
  41. * 1) system and project includes
  42. * 2) needed interfaces from external units
  43. * 3) internal and external interfaces from this unit
  44. ==================================================================================================*/
  45. #include "Flexio_Mcl_Ip_Cfg_DeviceRegisters.h"
  46. #include "Flexio_Mcl_Ip_Cfg_Defines.h"
  47. /*==================================================================================================
  48. * SOURCE FILE VERSION INFORMATION
  49. ==================================================================================================*/
  50. #define FLEXIO_IP_HW_ACCESS_VENDOR_ID_H 43
  51. #define FLEXIO_IP_HW_ACCESS_MODULE_ID_H 255
  52. #define FLEXIO_IP_HW_ACCESS_AR_RELEASE_MAJOR_VERSION_H 4
  53. #define FLEXIO_IP_HW_ACCESS_AR_RELEASE_MINOR_VERSION_H 4
  54. #define FLEXIO_IP_HW_ACCESS_AR_RELEASE_REVISION_VERSION_H 0
  55. #define FLEXIO_IP_HW_ACCESS_SW_MAJOR_VERSION_H 1
  56. #define FLEXIO_IP_HW_ACCESS_SW_MINOR_VERSION_H 0
  57. #define FLEXIO_IP_HW_ACCESS_SW_PATCH_VERSION_H 0
  58. /*==================================================================================================
  59. FILE VERSION CHECKS
  60. ==================================================================================================*/
  61. /* Check if Flexio_Mcl_Ip_HwAccess.h file and Flexio_Mcl_Ip_Cfg_DeviceRegisters.h file are of the same vendor */
  62. #if (FLEXIO_IP_HW_ACCESS_VENDOR_ID_H != FLEXIO_MCL_IP_CFG_DEVICEREGISTERS_VENDOR_ID_H)
  63. #error "Flexio_Mcl_Ip_HwAccess.h and Flexio_Mcl_Ip_Cfg_DeviceRegisters.h have different vendor ids"
  64. #endif
  65. /* Check if Flexio_Mcl_Ip_HwAccess.h file and Flexio_Mcl_Ip_Cfg_DeviceRegisters.h file are of the same Autosar version */
  66. #if ((FLEXIO_IP_HW_ACCESS_AR_RELEASE_MAJOR_VERSION_H != FLEXIO_MCL_IP_CFG_DEVICEREGISTERS_AR_RELEASE_MAJOR_VERSION_H) || \
  67. (FLEXIO_IP_HW_ACCESS_AR_RELEASE_MINOR_VERSION_H != FLEXIO_MCL_IP_CFG_DEVICEREGISTERS_AR_RELEASE_MINOR_VERSION_H) || \
  68. (FLEXIO_IP_HW_ACCESS_AR_RELEASE_REVISION_VERSION_H != FLEXIO_MCL_IP_CFG_DEVICEREGISTERS_AR_RELEASE_REVISION_VERSION_H) \
  69. )
  70. #error "AutoSar Version Numbers of Flexio_Mcl_Ip_HwAccess.h and Flexio_Mcl_Ip_Cfg_DeviceRegisters.h are different"
  71. #endif
  72. /* Check if Flexio_Mcl_Ip_HwAccess.h file and Flexio_Mcl_Ip_Cfg_DeviceRegisters.h file are of the same Software version */
  73. #if ((FLEXIO_IP_HW_ACCESS_SW_MAJOR_VERSION_H != FLEXIO_MCL_IP_CFG_DEVICEREGISTERS_SW_MAJOR_VERSION_H) || \
  74. (FLEXIO_IP_HW_ACCESS_SW_MINOR_VERSION_H != FLEXIO_MCL_IP_CFG_DEVICEREGISTERS_SW_MINOR_VERSION_H) || \
  75. (FLEXIO_IP_HW_ACCESS_SW_PATCH_VERSION_H != FLEXIO_MCL_IP_CFG_DEVICEREGISTERS_SW_PATCH_VERSION_H) \
  76. )
  77. #error "Software Version Numbers of Flexio_Mcl_Ip_HwAccess.h and Flexio_Mcl_Ip_Cfg_DeviceRegisters.h are different"
  78. #endif
  79. /*==================================================================================================
  80. * CONSTANTS
  81. ==================================================================================================*/
  82. /*==================================================================================================
  83. * DEFINES AND MACROS
  84. ==================================================================================================*/
  85. /*==================================================================================================
  86. * ENUMS
  87. ==================================================================================================*/
  88. /* Shift clock polarity options */
  89. typedef enum
  90. {
  91. FLEXIO_TIMER_POLARITY_POSEDGE = 0x00U, /*!< Shift on positive edge of Shift clock */
  92. FLEXIO_TIMER_POLARITY_NEGEDGE = 0x01U, /*!< Shift on negative edge of Shift clock */
  93. } Flexio_Mcl_Ip_TimerPolarityType;
  94. /* Pin polarity options */
  95. typedef enum
  96. {
  97. FLEXIO_PIN_POLARITY_HIGH = 0x00U, /*!< Pin is active high */
  98. FLEXIO_PIN_POLARITY_LOW = 0x01U, /*!< Pin is active low */
  99. } Flexio_Mcl_Ip_PinPolarityType;
  100. /* Pin configuration options */
  101. typedef enum
  102. {
  103. FLEXIO_PIN_CONFIG_DISABLED = 0x00U, /*!< Shifter pin output disabled */
  104. FLEXIO_PIN_CONFIG_OPEN_DRAIN = 0x01U, /*!< Shifter pin open drain or bidirectional output enable */
  105. FLEXIO_PIN_CONFIG_BIDIR_OUTPUT = 0x02U, /*!< Shifter pin bidirectional output data */
  106. FLEXIO_PIN_CONFIG_OUTPUT = 0x03U, /*!< Shifter pin output */
  107. } Flexio_Mcl_Ip_PinConfigType;
  108. /* Shifter mode options */
  109. typedef enum
  110. {
  111. FLEXIO_SHIFTER_MODE_DISABLED = 0x00U,
  112. FLEXIO_SHIFTER_MODE_RECEIVE = 0x01U,
  113. FLEXIO_SHIFTER_MODE_TRANSMIT = 0x02U,
  114. FLEXIO_SHIFTER_MODE_MATCH_STORE = 0x04U,
  115. FLEXIO_SHIFTER_MODE_MATCH_CONTINUOUS = 0x05U,
  116. } Flexio_Mcl_Ip_ShifterModeType;
  117. /* Shifter input source options */
  118. typedef enum
  119. {
  120. FLEXIO_SHIFTER_SOURCE_PIN = 0x00U,
  121. FLEXIO_SHIFTER_SOURCE_SHIFTER = 0x01U,
  122. } Flexio_Mcl_Ip_ShifterSourceType;
  123. /* Read/Write mode for shifter buffer */
  124. typedef enum
  125. {
  126. FLEXIO_SHIFTER_RW_MODE_NORMAL = 0x00U,
  127. FLEXIO_SHIFTER_RW_MODE_BIT_SWAP = 0x01U,
  128. } Flexio_Mcl_Ip_ShifterBufferModeType;
  129. /* Trigger polarity */
  130. typedef enum
  131. {
  132. FLEXIO_TRIGGER_POLARITY_HIGH = 0x00U, /*!< Trigger is active high */
  133. FLEXIO_TRIGGER_POLARITY_LOW = 0x01U, /*!< Trigger is active low */
  134. } Flexio_Mcl_Ip_TriggerPolarityType;
  135. /* Trigger sources */
  136. typedef enum
  137. {
  138. FLEXIO_TRIGGER_SOURCE_EXTERNAL = 0x00U, /*!< External trigger selected */
  139. FLEXIO_TRIGGER_SOURCE_INTERNAL = 0x01U, /*!< Internal trigger selected */
  140. } Flexio_Mcl_Ip_TriggerSourceType;
  141. /* Timer mode options */
  142. typedef enum
  143. {
  144. FLEXIO_TIMER_MODE_DISABLED = 0x00U, /*!< Timer Disabled. */
  145. FLEXIO_TIMER_MODE_8BIT_BAUD = 0x01U, /*!< Dual 8-bit counters baud/bit mode. */
  146. FLEXIO_TIMER_MODE_8BIT_PWM = 0x02U, /*!< Dual 8-bit counters PWM mode. */
  147. FLEXIO_TIMER_MODE_16BIT = 0x03U, /*!< Single 16-bit counter mode. */
  148. FLEXIO_TIMER_MODE_16BIT_DIS = 0x04U, /*!< Single 16-bit counter disable mode. */
  149. FLEXIO_TIMER_MODE_8BIT_DUAL = 0x05U, /*!< Dual 8-bit counters word mode. */
  150. FLEXIO_TIMER_MODE_8BIT_DUAL_PWM = 0x06U, /*!< Dual 8-bit counters PWM low mode. */
  151. FLEXIO_TIMER_16BIT_INPUT_CAPTURE_MODE = 0x07U, /*!< Single 16-bit input capture mode. */
  152. } Flexio_Mcl_Ip_TimerModeType;
  153. /* Timer initial output options */
  154. typedef enum
  155. {
  156. FLEXIO_TIMER_INITOUT_ONE = 0x00U, /*!< Timer output is logic one when enabled, unaffected by timer reset. */
  157. FLEXIO_TIMER_INITOUT_ZERO = 0x01U, /*!< Timer output is logic zero when enabled, unaffected by timer reset. */
  158. FLEXIO_TIMER_INITOUT_ONE_RESET = 0x02U, /*!< Timer output is logic one when enabled and on timer reset. */
  159. FLEXIO_TIMER_INITOUT_ZERO_RESET = 0x03U, /*!< Timer output is logic zero when enabled and on timer reset. */
  160. } Flexio_Mcl_Ip_TimerOutputType;
  161. /* Timer decrement options */
  162. typedef enum
  163. {
  164. FLEXIO_TIMER_DECREMENT_CLK_SHIFT_TMR = 0x00U, /*!< Decrement counter on FlexIO clock, Shift clock equals Timer output. */
  165. FLEXIO_TIMER_DECREMENT_TRG_SHIFT_TMR = 0x01U, /*!< Decrement counter on Trigger input (both edges), Shift clock equals Timer output. */
  166. FLEXIO_TIMER_DECREMENT_PIN_SHIFT_PIN = 0x02U, /*!< Decrement counter on Pin input (both edges), Shift clock equals Pin input. */
  167. FLEXIO_TIMER_DECREMENT_TRG_SHIFT_TRG = 0x03U, /*!< Decrement counter on Trigger input (both edges), Shift clock equals Trigger input. */
  168. } Flexio_Mcl_Ip_TimerDecrementType;
  169. /* Timer reset options */
  170. typedef enum
  171. {
  172. FLEXIO_TIMER_RESET_NEVER = 0x00U, /*!< Timer never reset. */
  173. FLEXIO_TIMER_RESET_PIN_OUT = 0x02U, /*!< Timer reset on Timer Pin equal to Timer Output. */
  174. FLEXIO_TIMER_RESET_TRG_OUT = 0x03U, /*!< Timer reset on Timer Trigger equal to Timer Output. */
  175. FLEXIO_TIMER_RESET_PIN_RISING = 0x04U, /*!< Timer reset on Timer Pin rising edge. */
  176. FLEXIO_TIMER_RESET_TRG_RISING = 0x06U, /*!< Timer reset on Trigger rising edge. */
  177. FLEXIO_TIMER_RESET_TRG_BOTH = 0x07U, /*!< Timer reset on Trigger rising or falling edge. */
  178. } Flexio_Mcl_Ip_TimerResetType;
  179. /* Timer disable options */
  180. typedef enum
  181. {
  182. FLEXIO_TIMER_DISABLE_NEVER = 0x00U, /*!< Timer never disabled. */
  183. FLEXIO_TIMER_DISABLE_TIM_DISABLE = 0x01U, /*!< Timer disabled on Timer N-1 disable. */
  184. FLEXIO_TIMER_DISABLE_TIM_CMP = 0x02U, /*!< Timer disabled on Timer compare. */
  185. FLEXIO_TIMER_DISABLE_TIM_CMP_TRG_LOW = 0x03U, /*!< Timer disabled on Timer compare and Trigger Low. */
  186. FLEXIO_TIMER_DISABLE_PIN = 0x04U, /*!< Timer disabled on Pin rising or falling edge. */
  187. FLEXIO_TIMER_DISABLE_PIN_TRG_HIGH = 0x05U, /*!< Timer disabled on Pin rising or falling edge provided Trigger is high. */
  188. FLEXIO_TIMER_DISABLE_TRG = 0x06U, /*!< Timer disabled on Trigger falling edge. */
  189. } Flexio_Mcl_Ip_TimerDisableType;
  190. /* Timer disable options */
  191. typedef enum
  192. {
  193. FLEXIO_TIMER_ENABLE_ALWAYS = 0x00U, /*!< Timer always enabled. */
  194. FLEXIO_TIMER_ENABLE_TIM_ENABLE = 0x01U, /*!< Timer enabled on Timer N-1 enable. */
  195. FLEXIO_TIMER_ENABLE_TRG_HIGH = 0x02U, /*!< Timer enabled on Trigger high. */
  196. FLEXIO_TIMER_ENABLE_TRG_PIN_HIGH = 0x03U, /*!< Timer enabled on Trigger high and Pin high. */
  197. FLEXIO_TIMER_ENABLE_PIN_POSEDGE = 0x04U, /*!< Timer enabled on Pin rising edge. */
  198. FLEXIO_TIMER_ENABLE_PIN_POSEDGE_TRG_HIGH = 0x05U, /*!< Timer enabled on Pin rising edge and Trigger high. */
  199. FLEXIO_TIMER_ENABLE_TRG_POSEDGE = 0x06U, /*!< Timer enabled on Trigger rising edge. */
  200. FLEXIO_TIMER_ENABLE_TRG_EDGE = 0x07U, /*!< Timer enabled on Trigger rising or falling edge. */
  201. } Flexio_Mcl_Ip_TimerEnableType;
  202. /* Timer stop bit options */
  203. typedef enum
  204. {
  205. FLEXIO_TIMER_STOP_BIT_DISABLED = 0x00U, /*!< Stop bit disabled. */
  206. FLEXIO_TIMER_STOP_BIT_TIM_CMP = 0x01U, /*!< Stop bit is enabled on timer compare. */
  207. FLEXIO_TIMER_STOP_BIT_TIM_DIS = 0x02U, /*!< Stop bit is enabled on timer disable. */
  208. FLEXIO_TIMER_STOP_BIT_TIM_CMP_DIS = 0x03U, /*!< Stop bit is enabled on timer compare and disable. */
  209. } Flexio_Mcl_Ip_TimerStopType;
  210. /* Timer stop bit options - for Transmit, Receive or Match Store modes only */
  211. typedef enum
  212. {
  213. FLEXIO_SHIFTER_STOP_BIT_DISABLED = 0x00U,
  214. FLEXIO_SHIFTER_STOP_BIT_0 = 0x02U,
  215. FLEXIO_SHIFTER_STOP_BIT_1 = 0x03U,
  216. } Flexio_Mcl_Ip_ShifterStopType;
  217. /* Timer start bit options - for Transmit, Receive or Match Store modes only */
  218. typedef enum
  219. {
  220. FLEXIO_SHIFTER_START_BIT_DISABLED = 0x00U,
  221. FLEXIO_SHIFTER_START_BIT_DISABLED_SH = 0x01U,
  222. FLEXIO_SHIFTER_START_BIT_0 = 0x02U,
  223. FLEXIO_SHIFTER_START_BIT_1 = 0x03U,
  224. } Flexio_Mcl_Ip_ShifterStartType;
  225. /* Timer start bit options */
  226. typedef enum
  227. {
  228. FLEXIO_TIMER_START_BIT_DISABLED = 0x00U, /*!< Start bit disabled. */
  229. FLEXIO_TIMER_START_BIT_ENABLED = 0x01U, /*!< Start bit enabled. */
  230. } Flexio_Mcl_Ip_TimerStartType;
  231. /*==================================================================================================
  232. * STRUCTURES AND OTHER TYPEDEFS
  233. ==================================================================================================*/
  234. /*==================================================================================================
  235. * GLOBAL VARIABLE DECLARATIONS
  236. ==================================================================================================*/
  237. /*==================================================================================================
  238. * FUNCTION PROTOTYPES
  239. ==================================================================================================*/
  240. #define MCL_START_SEC_CODE
  241. #include "Mcl_MemMap.h"
  242. void Flexio_Mcl_Ip_SetSoftwareReset(FLEXIO_Type *baseAddr, boolean enable);
  243. void Flexio_Mcl_Ip_SetDebugEnable(FLEXIO_Type *baseAddr, boolean enable);
  244. void Flexio_Mcl_Ip_SetEnable(FLEXIO_Type *baseAddr, boolean enable);
  245. boolean Flexio_Mcl_Ip_GetShifterStatus(const FLEXIO_Type *baseAddr, uint8 shifter);
  246. uint32 Flexio_Mcl_Ip_GetAllShifterStatus(const FLEXIO_Type *baseAddr);
  247. void Flexio_Mcl_Ip_ClearShifterStatus(FLEXIO_Type *baseAddr, uint8 shifter);
  248. #if (FLEXIO_MCL_IP_PIN_STS_IS_AVAILABLE == STD_ON)
  249. uint32 Flexio_Mcl_Ip_GetAllPinsStatus(const FLEXIO_Type *baseAddr);
  250. #endif
  251. boolean Flexio_Mcl_Ip_GetShifterErrorStatus(const FLEXIO_Type *baseAddr, uint8 shifter);
  252. uint32 Flexio_Mcl_Ip_GetAllShifterErrorStatus(const FLEXIO_Type *baseAddr);
  253. void Flexio_Mcl_Ip_ClearShifterErrorStatus(FLEXIO_Type *baseAddr, uint8 shifter);
  254. boolean Flexio_Mcl_Ip_GetTimerStatus(const FLEXIO_Type *baseAddr, uint8 timer);
  255. boolean Flexio_Mcl_Ip_GetTimerInterruptEnable(const FLEXIO_Type *baseAddr, uint8 timer);
  256. uint32 Flexio_Mcl_Ip_GetAllTimerStatus(const FLEXIO_Type *baseAddr);
  257. void Flexio_Mcl_Ip_ClearTimerStatus(FLEXIO_Type *baseAddr, uint8 timer);
  258. uint32 Flexio_Mcl_Ip_GetAllShifterInterrupt(const FLEXIO_Type *baseAddr);
  259. uint32 Flexio_Mcl_Ip_GetAllShifterErrorInterrupt(const FLEXIO_Type *baseAddr);
  260. void Flexio_Mcl_Ip_SetShifterErrorInterrupt(FLEXIO_Type *baseAddr, uint8 interruptMask, boolean enable);
  261. void Flexio_Mcl_Ip_SetShifterInterrupt(FLEXIO_Type *baseAddr, uint8 interruptMask, boolean enable);
  262. void Flexio_Mcl_Ip_SetShifterDMARequest(FLEXIO_Type *baseAddr, uint8 requestMask, boolean enable);
  263. uint32 Flexio_Mcl_Ip_GetAllTimerInterrupt(const FLEXIO_Type *baseAddr);
  264. void Flexio_Mcl_Ip_SetTimerInterrupt(FLEXIO_Type *baseAddr, uint8 interruptMask, boolean enable);
  265. #if (FLEXIO_MCL_IP_TIMERSDEN_IS_AVAILABLE == STD_ON)
  266. void Flexio_Mcl_Ip_SetTimerDMARequest(FLEXIO_Type *baseAddr, uint8 requestMask, boolean enable);
  267. #endif
  268. void Flexio_Mcl_Ip_Init(FLEXIO_Type *baseAddr);
  269. #if (FLEXIO_MCL_IP_PIN_STS_IS_AVAILABLE == STD_ON)
  270. void Flexio_Mcl_Ip_ClearPinStatus(FLEXIO_Type *baseAddr, uint8 pin);
  271. uint32 Flexio_Mcl_Ip_GetAllPinsInterrupt(const FLEXIO_Type *baseAddr);
  272. #endif
  273. #define MCL_STOP_SEC_CODE
  274. #include "Mcl_MemMap.h"
  275. #ifdef __cplusplus
  276. }
  277. #endif
  278. /** @} */
  279. #endif /* FLEXIO_IP_HW_ACCESS_H */