FlexCAN_Ip_VS_0_PBcfg.c 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral : FLEXCAN
  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. /**
  25. * @file FlexCAN_IP_PBcfg.c
  26. *
  27. * @addtogroup FlexCAN
  28. * @{
  29. */
  30. #ifdef __cplusplus
  31. extern "C"{
  32. #endif
  33. /*==================================================================================================
  34. * INCLUDE FILES
  35. * 1) system and project includes
  36. * 2) needed interfaces from external units
  37. * 3) internal and external interfaces from this unit
  38. ==================================================================================================*/
  39. #include "FlexCAN_Ip_Types.h"
  40. #if (FLEXCAN_IP_FEATURE_HAS_DMA_ENABLE == STD_ON)
  41. #include "Dma_Ip.h"
  42. #endif
  43. /*==================================================================================================
  44. * SOURCE FILE VERSION INFORMATION
  45. ==================================================================================================*/
  46. #define FLEXCAN_IP_VENDOR_ID_VS_0_PBCFG_C 43
  47. #define FLEXCAN_IP_AR_RELEASE_MAJOR_VERSION_VS_0_PBCFG_C 4
  48. #define FLEXCAN_IP_AR_RELEASE_MINOR_VERSION_VS_0_PBCFG_C 4
  49. #define FLEXCAN_IP_AR_RELEASE_REVISION_VERSION_VS_0_PBCFG_C 0
  50. #define FLEXCAN_IP_SW_MAJOR_VERSION_VS_0_PBCFG_C 1
  51. #define FLEXCAN_IP_SW_MINOR_VERSION_VS_0_PBCFG_C 0
  52. #define FLEXCAN_IP_SW_PATCH_VERSION_VS_0_PBCFG_C 0
  53. /*==================================================================================================
  54. * FILE VERSION CHECKS
  55. ==================================================================================================*/
  56. /* Check if current file and FlexCAN_Ip_Types header file are of the same vendor */
  57. #if (FLEXCAN_IP_VENDOR_ID_VS_0_PBCFG_C != FLEXCAN_IP_TYPES_VENDOR_ID_H)
  58. #error "FlexCAN_Ip_VS_0_PBcfg.c and FlexCAN_Ip_Types.h have different vendor ids"
  59. #endif
  60. /* Check if current file and FlexCAN_Ip_Types header file are of the same Autosar version */
  61. #if ((FLEXCAN_IP_AR_RELEASE_MAJOR_VERSION_VS_0_PBCFG_C != FLEXCAN_IP_TYPES_AR_RELEASE_MAJOR_VERSION_H) || \
  62. (FLEXCAN_IP_AR_RELEASE_MINOR_VERSION_VS_0_PBCFG_C != FLEXCAN_IP_TYPES_AR_RELEASE_MINOR_VERSION_H) || \
  63. (FLEXCAN_IP_AR_RELEASE_REVISION_VERSION_VS_0_PBCFG_C != FLEXCAN_IP_TYPES_AR_RELEASE_REVISION_VERSION_H) \
  64. )
  65. #error "AutoSar Version Numbers of FlexCAN_Ip_VS_0_PBcfg.c and FlexCAN_Ip_Types.h are different"
  66. #endif
  67. /* Check if current file and FlexCAN_Ip_Types header file are of the same Software version */
  68. #if ((FLEXCAN_IP_SW_MAJOR_VERSION_VS_0_PBCFG_C != FLEXCAN_IP_TYPES_SW_MAJOR_VERSION_H) || \
  69. (FLEXCAN_IP_SW_MINOR_VERSION_VS_0_PBCFG_C != FLEXCAN_IP_TYPES_SW_MINOR_VERSION_H) || \
  70. (FLEXCAN_IP_SW_PATCH_VERSION_VS_0_PBCFG_C != FLEXCAN_IP_TYPES_SW_PATCH_VERSION_H) \
  71. )
  72. #error "Software Version Numbers of FlexCAN_Ip_VS_0_PBcfg.c and FlexCAN_Ip_Types.h are different"
  73. #endif
  74. #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
  75. /* Checks against current file and Dma_Ip.h */
  76. #if (FLEXCAN_IP_FEATURE_HAS_DMA_ENABLE == STD_ON)
  77. #if ((FLEXCAN_IP_AR_RELEASE_MAJOR_VERSION_VS_0_PBCFG_C != DMA_IP_AR_RELEASE_MAJOR_VERSION_H) || \
  78. (FLEXCAN_IP_AR_RELEASE_MINOR_VERSION_VS_0_PBCFG_C != DMA_IP_AR_RELEASE_MINOR_VERSION_H) \
  79. )
  80. #error "AUTOSAR Version Numbers of FlexCAN_Ip_VS_0_PBcfg.c and Dma_Ip.h are different"
  81. #endif
  82. #endif
  83. #endif
  84. /*==================================================================================================
  85. * GLOBAL FUNCTION PROTOTYPES
  86. ==================================================================================================*/
  87. #define CAN_START_SEC_CODE
  88. #include "Can_MemMap.h"
  89. extern void Can_CommonIrqCallback(uint8 u8Instance, Flexcan_Ip_EventType event, uint32 u32buffIdx, const Flexcan_Ip_StateType *driverState);
  90. extern void Can_ErrorIrqCallback(uint8 u8Instance, Flexcan_Ip_EventType event, uint32 u32ErrStatus, const Flexcan_Ip_StateType *driverState);
  91. #define CAN_STOP_SEC_CODE
  92. #include "Can_MemMap.h"
  93. /*==================================================================================================
  94. * GLOBAL VARIABLE DECLARATIONS
  95. ==================================================================================================*/
  96. /*==================================================================================================
  97. * GLOBAL CONSTANTS
  98. ==================================================================================================*/
  99. #define CAN_START_SEC_CONFIG_DATA_UNSPECIFIED
  100. #include "Can_MemMap.h"
  101. const Flexcan_Ip_ConfigType Flexcan_aCtrlConfigPB_VS_0[1U]=
  102. {
  103. /* Can Hardware Channel FLEXCAN_0 */
  104. {
  105. /* Number Of Message Buffer used .max_num_mb */
  106. (uint8)18U,
  107. /*Can Hw filter count* .num_id_filters */
  108. (Flexcan_Ip_RxFifoIdFilterNumType)((8U >> 3U) - 1U),
  109. /* Legacy FIFO ENABLED .is_rx_fifo_needed */
  110. (boolean)TRUE,
  111. #if (FLEXCAN_IP_FEATURE_HAS_ENHANCED_RX_FIFO == STD_ON)
  112. /* The number of standard ID filter elements */
  113. 0U,
  114. /* The number of extended ID filter elements */
  115. 0U,
  116. /* The number of enhanced Rx FIFO watermark */
  117. -1U,
  118. /* The Enhanced Rx FIFO feature is enabled or not. */
  119. (boolean)FALSE,
  120. #endif
  121. /* Loopback enabled .flexcanMode */
  122. FLEXCAN_NORMAL_MODE,
  123. /* Controller Options .ctrlOptions */
  124. (uint32)( FLEXCAN_IP_BUSOFF_RECOVERY_U32 |FLEXCAN_IP_EACEN_U32),
  125. /* Can FD RamBlock specified .payload */
  126. {
  127. FLEXCAN_PAYLOAD_SIZE_8
  128. },
  129. /* Can FD enabled .fd_enable */
  130. (boolean)FALSE,
  131. #if (FLEXCAN_IP_FEATURE_HAS_PE_CLKSRC_SELECT == STD_ON)
  132. /* Can PE clock selected .is_pe_clock */
  133. (boolean)TRUE,
  134. #endif
  135. /* Cbt support .extCbtEnable */
  136. (boolean)FALSE,
  137. /* BRS for FD .bitRateSwitch */
  138. (boolean)FALSE,
  139. /* Values for normal baudrate .bitrate */
  140. {
  141. (uint8)2U,
  142. (uint8)5U,
  143. (uint8)5U,
  144. (uint16)11,
  145. (uint8)3U
  146. },
  147. /* Values for CBT baudrate .bitrate_cbt */
  148. {
  149. (uint8)5U,
  150. (uint8)4U,
  151. (uint8)5U,
  152. (uint16)11U,
  153. (uint8)0U
  154. },
  155. /* Fifo Transfer Type .transfer_type */
  156. FLEXCAN_RXFIFO_USING_POLLING,
  157. #if (FLEXCAN_IP_FEATURE_HAS_DMA_ENABLE == STD_ON)
  158. /* DMA channel number used for transfers. */
  159. (uint8)0U,
  160. #endif
  161. /* Controller Callback .Callback */
  162. Can_CommonIrqCallback,
  163. /* Error Callback .ErrorCallback */
  164. Can_ErrorIrqCallback
  165. }
  166. };
  167. /* PN array configuration */
  168. const Flexcan_Ip_PnConfigType Flexcan_aPnConfigPB_VS_0[1U]=
  169. {
  170. {
  171. /* Wakeup timeout enable .bWakeUpTimeout */
  172. (boolean)FALSE,
  173. /* Wakeup on mactch enable .bWakeUpMatch */
  174. (boolean)TRUE,
  175. /* The number of matches needed before generating an wake up event .u16numMatches */
  176. (uint16)2U,
  177. /* Defines a timeout value that generates an wake up event if wakeUpTimeout is true .u16matchTimeout */
  178. (uint16)0,
  179. /* Defines the filtering scheme used .eFilterComb */
  180. FLEXCAN_FILTER_ID_NTIMES,
  181. /* The configuration of the first ID filter .idFilter1 */
  182. {
  183. /* Specifies if the ID is standard or extended .bExtendedId */
  184. (boolean)TRUE,
  185. /* Specifies if the frame is standard or remote .bRemoteFrame */
  186. (boolean)FALSE,
  187. /* Specifies the ID value .u32Id */
  188. (uint32)0U
  189. },
  190. /* The configuration of the first ID filter .idFilter2 */
  191. {
  192. /* Specifies if the ID is standard or extended .bExtendedId */
  193. (boolean)TRUE,
  194. /* Specifies if the frame is standard or remote .bRemoteFrame */
  195. (boolean)TRUE,
  196. /* Specifies the ID value .u32Id */
  197. (boolean)0U,
  198. },
  199. /* Defines the ID filtering scheme .eIdFilterType */
  200. FLEXCAN_FILTER_MATCH_GEQ,
  201. /* Defines the payload filtering scheme. .ePayloadFilterType */
  202. FLEXCAN_FILTER_MATCH_EXACT,
  203. /* The configuration of the payload filter .payloadFilter */
  204. {
  205. (uint8)0U,
  206. (uint8)0U,
  207. {0U},
  208. {0U}
  209. }
  210. }
  211. };
  212. #define CAN_STOP_SEC_CONFIG_DATA_UNSPECIFIED
  213. #include "Can_MemMap.h"
  214. #ifdef __cplusplus
  215. }
  216. #endif
  217. /** @} */