Lpspi_Ip_Cfg.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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 LPSPI_IP_CFG_H
  25. #define LPSPI_IP_CFG_H
  26. /**
  27. * @file Lpspi_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 LPSPI_DRIVER_CONFIGURATION Lpspi 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 "Lpspi_Ip_VS_0_PBcfg.h"
  49. #include "S32K146_LPSPI.h"
  50. /*==================================================================================================
  51. * SOURCE FILE VERSION INFORMATION
  52. ==================================================================================================*/
  53. #define LPSPI_IP_VENDOR_ID_CFG 43
  54. #define LPSPI_IP_AR_RELEASE_MAJOR_VERSION_CFG 4
  55. #define LPSPI_IP_AR_RELEASE_MINOR_VERSION_CFG 4
  56. #define LPSPI_IP_AR_RELEASE_REVISION_VERSION_CFG 0
  57. #define LPSPI_IP_SW_MAJOR_VERSION_CFG 1
  58. #define LPSPI_IP_SW_MINOR_VERSION_CFG 0
  59. #define LPSPI_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 ((LPSPI_IP_AR_RELEASE_MAJOR_VERSION_CFG != MCAL_AR_RELEASE_MAJOR_VERSION) || \
  66. (LPSPI_IP_AR_RELEASE_MINOR_VERSION_CFG != MCAL_AR_RELEASE_MINOR_VERSION))
  67. #error "AutoSar Version Numbers of Lpspi_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 ((LPSPI_IP_AR_RELEASE_MAJOR_VERSION_CFG != OSIF_AR_RELEASE_MAJOR_VERSION) || \
  71. (LPSPI_IP_AR_RELEASE_MINOR_VERSION_CFG != OSIF_AR_RELEASE_MINOR_VERSION))
  72. #error "AutoSar Version Numbers of Lpspi_Ip_Cfg.h and OsIf.h are different"
  73. #endif
  74. #endif
  75. /* Check if Lpspi_Ip_VS_0_PBcfg header file and Spi configuration header file are of the same vendor */
  76. #if (LPSPI_IP_VS_0_VENDOR_ID_PBCFG != LPSPI_IP_VENDOR_ID_CFG)
  77. #error "Lpspi_Ip_VS_0_PBcfg.h and Lpspi_Ip_Cfg.h have different vendor IDs"
  78. #endif
  79. /* Check if Lpspi_Ip_VS_0_PBcfg header file and Spi configuration header file are of the same Autosar version */
  80. #if ((LPSPI_IP_VS_0_AR_RELEASE_MAJOR_VERSION_PBCFG != LPSPI_IP_AR_RELEASE_MAJOR_VERSION_CFG) || \
  81. (LPSPI_IP_VS_0_AR_RELEASE_MINOR_VERSION_PBCFG != LPSPI_IP_AR_RELEASE_MINOR_VERSION_CFG) || \
  82. (LPSPI_IP_VS_0_AR_RELEASE_REVISION_VERSION_PBCFG != LPSPI_IP_AR_RELEASE_REVISION_VERSION_CFG))
  83. #error "AutoSar Version Numbers of Lpspi_Ip_VS_0_PBcfg.h and Lpspi_Ip_Cfg.h are different"
  84. #endif
  85. /* Check if Lpspi_Ip_VS_0_PBcfg header file and Spi configuration header file are of the same software version */
  86. #if ((LPSPI_IP_VS_0_SW_MAJOR_VERSION_PBCFG != LPSPI_IP_SW_MAJOR_VERSION_CFG) || \
  87. (LPSPI_IP_VS_0_SW_MINOR_VERSION_PBCFG != LPSPI_IP_SW_MINOR_VERSION_CFG) || \
  88. (LPSPI_IP_VS_0_SW_PATCH_VERSION_PBCFG != LPSPI_IP_SW_PATCH_VERSION_CFG))
  89. #error "Software Version Numbers of Lpspi_Ip_VS_0_PBcfg.h and Lpspi_Ip_Cfg.h are different"
  90. #endif
  91. /*==================================================================================================
  92. * CONSTANTS
  93. ==================================================================================================*/
  94. #define LPSPI_IP_CONFIG_EXT \
  95. LPSPI_IP_CONFIG_VS_0_PB \
  96. /** @brief Total number of SpiPhyUnit configured. */
  97. #define LPSPI_IP_NUMBER_OF_INSTANCES (1U)
  98. /** @brief Number of FIFO entries supported */
  99. #define LPSPI_IP_FIFO_SIZE_U8 ((uint8)4U)
  100. /** @brief HWUnits enabled/disabled */
  101. #define LPSPI_IP_2_ENABLED (STD_ON)
  102. #define LPSPI_IP_SLAVE_SUPPORT ((STD_OFF))
  103. /**
  104. * @brief Defines if transfers are made using DMA or FIFO.
  105. * @details Defines if transfers are made using DMA or FIFO.
  106. */
  107. #define LPSPI_IP_DMA_USED (STD_OFF)
  108. /**
  109. * @brief If enabled, allows dual MCU clock configuration settings.
  110. * @details If enabled, allows dual MCU clock configuration settings.
  111. */
  112. #define LPSPI_IP_DUAL_CLOCK_MODE (STD_OFF)
  113. /**
  114. * @brief Enable Dma Fast transfer support.
  115. * @details When SpiAutosarExt/SpiEnableDmaFastTransferSupport = TRUE,
  116. * the SPI driver can be supported to transfer multiple Jobs, Channels and CPU used only for processing end of Sequence transfer.
  117. */
  118. #define LPSPI_IP_ENABLE_DMAFASTTRANSFER_SUPPORT (STD_OFF)
  119. /**
  120. * @brief Enable User Mode Support.
  121. * @details When SpiAutosarExt/SpiEnableUserModeSupport = TRUE,
  122. * the SPI driver can be executed from both supervisor and user mode.
  123. *
  124. * @api
  125. */
  126. #define LPSPI_IP_ENABLE_USER_MODE_SUPPORT (STD_OFF)
  127. #ifndef MCAL_ENABLE_USER_MODE_SUPPORT
  128. #ifdef LPSPI_IP_ENABLE_USER_MODE_SUPPORT
  129. #if (STD_ON == LPSPI_IP_ENABLE_USER_MODE_SUPPORT)
  130. #error MCAL_ENABLE_USER_MODE_SUPPORT is not enabled. For running Spi in user mode the MCAL_ENABLE_USER_MODE_SUPPORT needs to be defined
  131. #endif /* (STD_ON == LPSPI_IP_ENABLE_USER_MODE_SUPPORT) */
  132. #endif /* ifdef MCAL_ENABLE_USER_MODE_SUPPORT */
  133. #endif /* ifndef MCAL_ENABLE_USER_MODE_SUPPORT*/
  134. /**
  135. * @brief SPI registers is controlled by REG_PROT IP.
  136. */
  137. #define LPSPI_IP_REG_PROT_AVAILABLE (STD_OFF)
  138. #if (STD_ON == LPSPI_IP_REG_PROT_AVAILABLE)
  139. /**
  140. * @brief The protection size
  141. */
  142. #define LPSPI_IP_PROT_MEM_U32 ((uint32)4U)
  143. #endif
  144. /**
  145. * @brief Maximum of frame size supported.
  146. */
  147. #define LPSPI_IP_FRAMESIZE_MAX_U8 ((uint8)32U)
  148. /**
  149. * @brief Minimum of frame size supported.
  150. */
  151. #define LPSPI_IP_FRAMESIZE_MIN_U8 ((uint8)4U)
  152. /**
  153. * @brief Define Timeout Method.
  154. * @details Define a certain timeout method from OsIf will be used in the driver.
  155. */
  156. #define LPSPI_IP_TIMEOUT_METHOD (OSIF_COUNTER_DUMMY)
  157. /**
  158. * @brief Switches ON or OFF for the detection and reporting of development errors(API parameter checking) at IP level.
  159. */
  160. /** @implements LPSPI_IP_DEV_ERROR_DETECT_define */
  161. #define LPSPI_IP_DEV_ERROR_DETECT (STD_OFF)
  162. /**
  163. * @brief Half duplex supported.
  164. */
  165. /** @implements LPSPI_IP_HALF_DUPLEX_MODE_SUPPORT_define */
  166. #define LPSPI_IP_HALF_DUPLEX_MODE_SUPPORT (STD_OFF)
  167. /**
  168. * @brief Defines the "Number of Loops" timeout.
  169. * @details Defines the "Number of Loops" timeout used Spi_AsyncTransmitHalfDuplex in half duplex mode
  170. * during the wait on TX transmission to complete before start next channel that in receive mode or latest channel in job.
  171. * One timeout unit means that no TX or RX was executed(the IF statements are returning FALSE).
  172. */
  173. #define LPSPI_IP_HALF_DUPLEX_TIMEOUT_COUNTER ((uint32)(50000))
  174. /*==================================================================================================
  175. * DEFINES AND MACROS
  176. ==================================================================================================*/
  177. /*==================================================================================================
  178. * ENUMS
  179. ==================================================================================================*/
  180. /*==================================================================================================
  181. * STRUCTURES AND OTHER TYPEDEFS
  182. ==================================================================================================*/
  183. /*==================================================================================================
  184. * GLOBAL VARIABLE DECLARATIONS
  185. ==================================================================================================*/
  186. /*==================================================================================================
  187. * FUNCTION PROTOTYPES
  188. ==================================================================================================*/
  189. #ifdef __cplusplus
  190. }
  191. #endif
  192. #endif
  193. /** @} */