Flexio_Mcl_Ip.c 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. /**
  25. * @file Flexio_Mcl_Ip.c
  26. *
  27. * @version 1.0.0
  28. *
  29. * @brief AUTOSAR Mcl - Flexio Common driver source file.
  30. * @details
  31. *
  32. * @addtogroup FLEXIO_IP_DRIVER FLEXIO IP Driver
  33. * @{
  34. */
  35. #ifdef __cplusplus
  36. extern "C"{
  37. #endif
  38. /*==================================================================================================
  39. * INCLUDE FILES
  40. * 1) system and project includes
  41. * 2) needed interfaces from external units
  42. * 3) internal and external interfaces from this unit
  43. ==================================================================================================*/
  44. #include "Flexio_Mcl_Ip.h"
  45. /*==================================================================================================
  46. * SOURCE FILE VERSION INFORMATION
  47. ==================================================================================================*/
  48. #define FLEXIO_MCL_IP_VENDOR_ID_C 43
  49. #define FLEXIO_MCL_IP_AR_RELEASE_MAJOR_VERSION_C 4
  50. #define FLEXIO_MCL_IP_AR_RELEASE_MINOR_VERSION_C 4
  51. #define FLEXIO_MCL_IP_AR_RELEASE_REVISION_VERSION_C 0
  52. #define FLEXIO_MCL_IP_SW_MAJOR_VERSION_C 1
  53. #define FLEXIO_MCL_IP_SW_MINOR_VERSION_C 0
  54. #define FLEXIO_MCL_IP_SW_PATCH_VERSION_C 0
  55. /*==================================================================================================
  56. * FILE VERSION CHECKS
  57. ==================================================================================================*/
  58. /* Check if Flexio_Mcl_Ip.c file and Flexio_Mcl_Ip.h file are of the same vendor */
  59. #if (FLEXIO_MCL_IP_VENDOR_ID_C != FLEXIO_MCL_IP_VENDOR_ID_H)
  60. #error "Flexio_Mcl_Ip.c and Flexio_Mcl_Ip.h have different vendor ids"
  61. #endif
  62. /* Check if Flexio_Mcl_Ip.c file and Flexio_Mcl_Ip.h file are of the same Autosar version */
  63. #if ((FLEXIO_MCL_IP_AR_RELEASE_MAJOR_VERSION_C != FLEXIO_MCL_IP_AR_RELEASE_MAJOR_VERSION_H) || \
  64. (FLEXIO_MCL_IP_AR_RELEASE_MINOR_VERSION_C != FLEXIO_MCL_IP_AR_RELEASE_MINOR_VERSION_H) || \
  65. (FLEXIO_MCL_IP_AR_RELEASE_REVISION_VERSION_C != FLEXIO_MCL_IP_AR_RELEASE_REVISION_VERSION_H) \
  66. )
  67. #error "AutoSar Version Numbers of Flexio_Mcl_Ip.c and Flexio_Mcl_Ip.h are different"
  68. #endif
  69. /* Check if Flexio_Mcl_Ip.c file and Flexio_Mcl_Ip.h file are of the same Software version */
  70. #if ((FLEXIO_MCL_IP_SW_MAJOR_VERSION_C != FLEXIO_MCL_IP_SW_MAJOR_VERSION_H) || \
  71. (FLEXIO_MCL_IP_SW_MINOR_VERSION_C != FLEXIO_MCL_IP_SW_MINOR_VERSION_H) || \
  72. (FLEXIO_MCL_IP_SW_PATCH_VERSION_C != FLEXIO_MCL_IP_SW_PATCH_VERSION_H) \
  73. )
  74. #error "Software Version Numbers of Flexio_Mcl_Ip.c and Flexio_Mcl_Ip.h are different"
  75. #endif
  76. /*==================================================================================================
  77. * LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
  78. ==================================================================================================*/
  79. /*==================================================================================================
  80. * LOCAL CONSTANTS
  81. ==================================================================================================*/
  82. /*==================================================================================================
  83. * LOCAL VARIABLES
  84. ==================================================================================================*/
  85. /*==================================================================================================
  86. * GLOBAL CONSTANTS
  87. ==================================================================================================*/
  88. /*==================================================================================================
  89. * GLOBAL VARIABLES
  90. ==================================================================================================*/
  91. /*==================================================================================================
  92. * LOCAL FUNCTION PROTOTYPES
  93. ==================================================================================================*/
  94. /*==================================================================================================
  95. * LOCAL FUNCTIONS
  96. ==================================================================================================*/
  97. /*==================================================================================================
  98. * GLOBAL FUNCTIONS PROTOTYPES
  99. ==================================================================================================*/
  100. #define MCL_START_SEC_CONST_UNSPECIFIED
  101. #include "Mcl_MemMap.h"
  102. /* Table of base addresses for FLEXIO instances. */
  103. FLEXIO_Type * const flexioBase[FLEXIO_INSTANCE_COUNT] = IP_FLEXIO_BASE_PTRS;
  104. #define MCL_STOP_SEC_CONST_UNSPECIFIED
  105. #include "Mcl_MemMap.h"
  106. #define MCL_START_SEC_VAR_CLEARED_BOOLEAN
  107. #include "Mcl_MemMap.h"
  108. /* Table of base addresses for FLEXIO instances. */
  109. boolean Flexio_Ip_IpIsInitialized[FLEXIO_INSTANCE_COUNT];
  110. #define MCL_STOP_SEC_VAR_CLEARED_BOOLEAN
  111. #include "Mcl_MemMap.h"
  112. /*==================================================================================================
  113. GLOBAL FUNCTIONS
  114. ==================================================================================================*/
  115. #define MCL_START_SEC_CODE
  116. #include "Mcl_MemMap.h"
  117. Flexio_Ip_CommonStatusType Flexio_Mcl_Ip_InitDevice(const Flexio_Ip_InstanceConfigType * const pFlexioInitType)
  118. {
  119. FLEXIO_Type *baseAddr;
  120. Flexio_Ip_CommonStatusType status = FLEXIO_IP_COMMON_STATUS_SUCCESS;
  121. uint8 LocInstance = pFlexioInitType->instance;
  122. boolean LocDebugEnable = pFlexioInitType->debugEnable;
  123. baseAddr = flexioBase[LocInstance];
  124. if(Flexio_Ip_IpIsInitialized[LocInstance] == TRUE)
  125. {
  126. status = FLEXIO_IP_COMMON_STATUS_FAIL;
  127. }
  128. /* Reset FlexIO module */
  129. Flexio_Mcl_Ip_Init(baseAddr);
  130. /* Enable module */
  131. Flexio_Mcl_Ip_SetEnable(baseAddr, TRUE);
  132. Flexio_Mcl_Ip_SetDebugEnable(baseAddr, LocDebugEnable);
  133. Flexio_Ip_IpIsInitialized[LocInstance] = TRUE;
  134. (void)status;
  135. return status;
  136. }
  137. /*
  138. * Function Name : FLEXIO_DRV_DeinitDevice
  139. * Description : De-initializes the FlexIO device
  140. */
  141. void Flexio_Mcl_Ip_DeinitDevice(uint32 instance)
  142. {
  143. FLEXIO_Type *baseAddr;
  144. baseAddr = flexioBase[instance];
  145. /* Reset FlexIO module */
  146. Flexio_Mcl_Ip_Init(baseAddr);
  147. Flexio_Ip_IpIsInitialized[instance] = FALSE;
  148. }
  149. #define MCL_STOP_SEC_CODE
  150. #include "Mcl_MemMap.h"
  151. #ifdef __cplusplus
  152. }
  153. #endif
  154. /** @} */