Flexio_Spi_Ip_Cfg.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : LPSPI
  5. * Dependencies :
  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_SPI_IP_CFG_H
  25. #define FLEXIO_SPI_IP_CFG_H
  26. /**
  27. * @file Flexio_Spi_Ip_Cfg.h
  28. * @version 1.0.0
  29. *
  30. * @brief AUTOSAR Spi - Spi configuration header file.
  31. * @details This file is the header containing all the necessary information for SPI
  32. * module configuration(s).
  33. * @addtogroup FLEXIO_DRIVER_CONFIGURATION Flexio_Spi Driver Configuration
  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. * 4) user callback header files
  45. ==================================================================================================*/
  46. #include "Mcal.h"
  47. #include "OsIf.h"
  48. #include "Flexio_Spi_Ip_VS_0_PBcfg.h"
  49. #include "S32K146_FLEXIO.h"
  50. /*==================================================================================================
  51. * SOURCE FILE VERSION INFORMATION
  52. ==================================================================================================*/
  53. #define FLEXIO_SPI_IP_VENDOR_ID_CFG 43
  54. #define FLEXIO_SPI_IP_AR_RELEASE_MAJOR_VERSION_CFG 4
  55. #define FLEXIO_SPI_IP_AR_RELEASE_MINOR_VERSION_CFG 4
  56. #define FLEXIO_SPI_IP_AR_RELEASE_REVISION_VERSION_CFG 0
  57. #define FLEXIO_SPI_IP_SW_MAJOR_VERSION_CFG 1
  58. #define FLEXIO_SPI_IP_SW_MINOR_VERSION_CFG 0
  59. #define FLEXIO_SPI_IP_SW_PATCH_VERSION_CFG 0
  60. /*==================================================================================================
  61. * FILE VERSION CHECKS
  62. ==================================================================================================*/
  63. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  64. /* Check if current file and Mcal header file are of the same Autosar version */
  65. #if ((FLEXIO_SPI_IP_AR_RELEASE_MAJOR_VERSION_CFG != MCAL_AR_RELEASE_MAJOR_VERSION) || \
  66. (FLEXIO_SPI_IP_AR_RELEASE_MINOR_VERSION_CFG != MCAL_AR_RELEASE_MINOR_VERSION))
  67. #error "AutoSar Version Numbers of Flexio_Spi_Ip_Cfg.h and Mcal.h are different"
  68. #endif
  69. /* Check if current file and OsIf header file are of the same Autosar version */
  70. #if ((FLEXIO_SPI_IP_AR_RELEASE_MAJOR_VERSION_CFG != OSIF_AR_RELEASE_MAJOR_VERSION) || \
  71. (FLEXIO_SPI_IP_AR_RELEASE_MINOR_VERSION_CFG != OSIF_AR_RELEASE_MINOR_VERSION))
  72. #error "AutoSar Version Numbers of Flexio_Spi_Ip_Cfg.h and OsIf.h are different"
  73. #endif
  74. #endif
  75. /* Check if Flexio_Spi_Ip_VS_0_PBcfg header file and Spi configuration header file are of the same vendor */
  76. #if (FLEXIO_SPI_IP_VS_0_VENDOR_ID_PBCFG != FLEXIO_SPI_IP_VENDOR_ID_CFG)
  77. #error "Flexio_Spi_Ip_VS_0_PBcfg.h and Flexio_Spi_Ip_Cfg.h have different vendor IDs"
  78. #endif
  79. /* Check if Flexio_Spi_Ip_VS_0_PBcfg header file and Spi configuration header file are of the same Autosar version */
  80. #if ((FLEXIO_SPI_IP_VS_0_AR_RELEASE_MAJOR_VERSION_PBCFG != FLEXIO_SPI_IP_AR_RELEASE_MAJOR_VERSION_CFG) || \
  81. (FLEXIO_SPI_IP_VS_0_AR_RELEASE_MINOR_VERSION_PBCFG != FLEXIO_SPI_IP_AR_RELEASE_MINOR_VERSION_CFG) || \
  82. (FLEXIO_SPI_IP_VS_0_AR_RELEASE_REVISION_VERSION_PBCFG != FLEXIO_SPI_IP_AR_RELEASE_REVISION_VERSION_CFG))
  83. #error "AutoSar Version Numbers of Flexio_Spi_Ip_VS_0_PBcfg.h and Flexio_Spi_Ip_Cfg.h are different"
  84. #endif
  85. /* Check if Flexio_Spi_Ip_VS_0_PBcfg header file and Spi configuration header file are of the same software version */
  86. #if ((FLEXIO_SPI_IP_VS_0_SW_MAJOR_VERSION_PBCFG != FLEXIO_SPI_IP_SW_MAJOR_VERSION_CFG) || \
  87. (FLEXIO_SPI_IP_VS_0_SW_MINOR_VERSION_PBCFG != FLEXIO_SPI_IP_SW_MINOR_VERSION_CFG) || \
  88. (FLEXIO_SPI_IP_VS_0_SW_PATCH_VERSION_PBCFG != FLEXIO_SPI_IP_SW_PATCH_VERSION_CFG))
  89. #error "Software Version Numbers of Flexio_Spi_Ip_VS_0_PBcfg.h and Flexio_Spi_Ip_Cfg.h are different"
  90. #endif
  91. /*==================================================================================================
  92. * CONSTANTS
  93. ==================================================================================================*/
  94. /**
  95. * @brief Flexio SPI supported enable.
  96. * @details Flexio SPI supported enable.
  97. */
  98. #define FLEXIO_SPI_IP_ENABLE (STD_OFF)
  99. #if (FLEXIO_SPI_IP_ENABLE == STD_ON)
  100. #define FLEXIO_SPI_IP_CONFIG_EXT \
  101. FLEXIO_SPI_IP_CONFIG_VS_0_PB \
  102. /** @brief Total number of SpiPhyUnit configured. */
  103. #define FLEXIO_SPI_IP_NUMBER_OF_INSTANCES (1U)
  104. /** @brief Total number of FLEXIO_SPI HW Unit are supported . */
  105. #define FLEXIO_SPI_IP_NUMBER_OF_HWUNIT_U8 (uint8)(2U)
  106. /** @brief Total number of Flexio instance. */
  107. #define FLEXIO_SPI_IP_INSTANCE_COUNT (FLEXIO_INSTANCE_COUNT)
  108. /** @brief HWUnits enabled/disabled */
  109. #define FLEXIO_SPI_IP_SLAVE_SUPPORT ((STD_OFF))
  110. /**
  111. * @brief Defines if transfers are made using DMA or FIFO.
  112. * @details Defines if transfers are made using DMA or FIFO.
  113. */
  114. #define FLEXIO_SPI_IP_DMA_USED (STD_OFF)
  115. /**
  116. * @brief If enabled, allows dual MCU clock configuration settings.
  117. * @details If enabled, allows dual MCU clock configuration settings.
  118. */
  119. #define FLEXIO_SPI_IP_DUAL_CLOCK_MODE (STD_OFF)
  120. /**
  121. * @brief Define Timeout Method.
  122. * @details Define a certain timeout method from OsIf will be used in the driver.
  123. */
  124. #define FLEXIO_SPI_IP_TIMEOUT_METHOD (OSIF_COUNTER_DUMMY)
  125. /**
  126. * @brief Enable User Mode Support.
  127. * @details When SpiAutosarExt/SpiEnableUserModeSupport = TRUE,
  128. * the SPI driver can be executed from both supervisor and user mode.
  129. *
  130. * @api
  131. */
  132. #define FLEXIO_SPI_IP_ENABLE_USER_MODE_SUPPORT (STD_OFF)
  133. /**
  134. * @brief Switches ON or OFF for the detection and reporting of development errors(API parameter checking) at IP level.
  135. */
  136. /** @implements FLEXIO_SPI_IP_DEV_ERROR_DETECT_define */
  137. #define FLEXIO_SPI_IP_DEV_ERROR_DETECT (STD_OFF)
  138. /**
  139. * @brief Maximum of frame size supported.
  140. */
  141. #define FLEXIO_SPI_IP_FRAMESIZE_MAX_U8 ((uint8)32U)
  142. /**
  143. * @brief Maximum of frame size supported.
  144. */
  145. #define FLEXIO_SPI_IP_FRAMESIZE_MIN_U8 ((uint8)4U)
  146. /** @brief Write to CTRL */
  147. #define FLEXIO_SPI_IP_CTRL_FLEXEN(x) FLEXIO_CTRL_FLEXEN(x)
  148. /** @brief Write to TIMCMP */
  149. #define FLEXIO_SPI_IP_TIMECMP_BAUDRATE_MASK_U32 ((uint32) 0x00FFu)
  150. #define FLEXIO_SPI_IP_TIMECMP_FRAMESIZE_MASK_U32 ((uint32) 0xFF00u)
  151. #define FLEXIO_SPI_IP_TIMCMP_CMP(x) FLEXIO_TIMCMP_CMP(x)
  152. /** @brief CPOL and CPHA selection */
  153. #define FLEXIO_SPI_IP_CPOL_LOW_U8 ((uint8) 0U)
  154. #define FLEXIO_SPI_IP_CPOL_HIGH_U8 ((uint8) 1U)
  155. #define FLEXIO_SPI_IP_CPHA_LEADING_U8 ((uint8) 0U)
  156. #define FLEXIO_SPI_IP_CPHA_TRAILING_U8 ((uint8) 1U)
  157. /** @brief Write to SHIFTCTL */
  158. #define FLEXIO_SPI_IP_SHIFTCTL_TIMSEL(x) FLEXIO_SHIFTCTL_TIMSEL(x)
  159. #define FLEXIO_SPI_IP_SHIFTCTL_PINSEL(x) FLEXIO_SHIFTCTL_PINSEL(x)
  160. #define FLEXIO_SPI_IP_SHIFTCTL_PINCFG(x) FLEXIO_SHIFTCTL_PINCFG(x)
  161. #define FLEXIO_SPI_IP_SHIFTCTL_SMOD(x) FLEXIO_SHIFTCTL_SMOD(x)
  162. #define FLEXIO_SPI_IP_SHIFTCTL_TIMPOL(x) FLEXIO_SHIFTCTL_TIMPOL(x)
  163. /** @brief Write to SHIFTCFG */
  164. #define FLEXIO_SPI_IP_SHIFTCFG_SSTOP(x) FLEXIO_SHIFTCFG_SSTOP(x)
  165. #define FLEXIO_SPI_IP_SHIFTCFG_SSTART(x) FLEXIO_SHIFTCFG_SSTART(x)
  166. #define FLEXIO_SPI_IP_TIMCFG_TIMDEC(x) FLEXIO_TIMCFG_TIMDEC(x)
  167. /** @brief Write to TIMCTL */
  168. #define FLEXIO_SPI_IP_TIMCTL_PINSEL(x) FLEXIO_TIMCTL_PINSEL(x)
  169. #define FLEXIO_SPI_IP_TIMCTL_TRGSEL(x) FLEXIO_TIMCTL_TRGSEL(x)
  170. #define FLEXIO_SPI_IP_TIMCTL_TRGSRC(x) FLEXIO_TIMCTL_TRGSRC(x)
  171. #define FLEXIO_SPI_IP_TIMCTL_TIMOD(x) FLEXIO_TIMCTL_TIMOD(x)
  172. #define FLEXIO_SPI_IP_TIMCTL_TRGPOL(x) FLEXIO_TIMCTL_TRGPOL(x)
  173. #define FLEXIO_SPI_IP_TIMCTL_PINPOL(x) FLEXIO_TIMCTL_PINPOL(x)
  174. #define FLEXIO_SPI_IP_TIMCTL_PINCFG(x) FLEXIO_TIMCTL_PINCFG(x)
  175. #define FLEXIO_SPI_IP_TIMCTL_ONETIM(x) FLEXIO_TIMCTL_ONETIM(x)
  176. /** @brief Write to TIMCFG */
  177. #define FLEXIO_SPI_IP_TIMCFG_TIMOUT(x) FLEXIO_TIMCFG_TIMOUT(x)
  178. #define FLEXIO_SPI_IP_TIMCFG_TIMDIS(x) FLEXIO_TIMCFG_TIMDIS(x)
  179. #define FLEXIO_SPI_IP_TIMCFG_TIMENA(x) FLEXIO_TIMCFG_TIMENA(x)
  180. #define FLEXIO_SPI_IP_TIMCFG_TIMRST(x) FLEXIO_TIMCFG_TIMRST(x)
  181. #define FLEXIO_SPI_IP_TIMCFG_DEFAULT_MASTER_VALUE ((uint32) 0x00000222u)
  182. #define FLEXIO_SPI_IP_TIMCFG_DEFAULT_SLAVE_CPHA0_VALUE ((uint32) 0x01200600u)
  183. #define FLEXIO_SPI_IP_TIMCFG_DEFAULT_SLAVE_CPHA1_VALUE ((uint32) 0x01206602u)
  184. /** @brief Write to SHIFTSIEN and SHIFTSDEN */
  185. #define FLEXIO_SPI_IP_SHIFTSIEN_SSIE(x) FLEXIO_SHIFTSIEN_SSIE(x)
  186. #define FLEXIO_SPI_IP_SHIFTSDEN_SSDE(x) FLEXIO_SHIFTSDEN_SSDE(x)
  187. /**
  188. * @brief Shifters and Timer index
  189. */
  190. #define FLEXIO_SPI_IP_SHIFTER_0_U8 ((uint8)0U)
  191. #define FLEXIO_SPI_IP_SHIFTER_1_U8 ((uint8)1U)
  192. #define FLEXIO_SPI_IP_SHIFTER_2_U8 ((uint8)2U)
  193. #define FLEXIO_SPI_IP_SHIFTER_3_U8 ((uint8)3U)
  194. #define FLEXIO_SPI_IP_SHIFTER_4_U8 ((uint8)4U)
  195. #define FLEXIO_SPI_IP_SHIFTER_5_U8 ((uint8)5U)
  196. #define FLEXIO_SPI_IP_SHIFTER_6_U8 ((uint8)6U)
  197. #define FLEXIO_SPI_IP_SHIFTER_7_U8 ((uint8)7U)
  198. #define FLEXIO_SPI_IP_TIMER_0_U8 ((uint8)0U)
  199. #define FLEXIO_SPI_IP_TIMER_1_U8 ((uint8)1U)
  200. #define FLEXIO_SPI_IP_TIMER_2_U8 ((uint8)2U)
  201. #define FLEXIO_SPI_IP_TIMER_3_U8 ((uint8)3U)
  202. #define FLEXIO_SPI_IP_TIMER_4_U8 ((uint8)4U)
  203. #define FLEXIO_SPI_IP_TIMER_5_U8 ((uint8)5U)
  204. #define FLEXIO_SPI_IP_TIMER_6_U8 ((uint8)6U)
  205. #define FLEXIO_SPI_IP_TIMER_7_U8 ((uint8)7U)
  206. #endif /*(FLEXIO_SPI_IP_ENABLE == STD_ON)*/
  207. /*==================================================================================================
  208. * DEFINES AND MACROS
  209. ==================================================================================================*/
  210. /*==================================================================================================
  211. * ENUMS
  212. ==================================================================================================*/
  213. /*==================================================================================================
  214. * STRUCTURES AND OTHER TYPEDEFS
  215. ==================================================================================================*/
  216. /*==================================================================================================
  217. * GLOBAL VARIABLE DECLARATIONS
  218. ==================================================================================================*/
  219. /*==================================================================================================
  220. * FUNCTION PROTOTYPES
  221. ==================================================================================================*/
  222. #ifdef __cplusplus
  223. }
  224. #endif
  225. #endif
  226. /** @} */