1 /* 2 * Copyright 2021-2024 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /** 8 * @file Mru_Ip.h 9 * 10 * @defgroup MRU_IP_DRIVER Mru Ip Driver 11 * @ingroup Platform 12 * 13 * @addtogroup MRU_IP_DRIVER Mru Ip Driver 14 * @{ 15 */ 16 17 #ifndef MRU_IP_H 18 #define MRU_IP_H 19 20 #ifdef __cplusplus 21 extern "C"{ 22 #endif 23 24 25 26 /*================================================================================================== 27 * INCLUDE FILES 28 * 1) system and project includes 29 * 2) needed interfaces from external units 30 * 3) internal and external interfaces from this unit 31 ==================================================================================================*/ 32 #include "Mru_Ip_Types.h" 33 /*================================================================================================== 34 * SOURCE FILE VERSION INFORMATION 35 ==================================================================================================*/ 36 #define CDD_PLATFORM_MRU_IP_VENDOR_ID 43 37 #define CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION 4 38 #define CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION 7 39 #define CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION 0 40 #define CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION 2 41 #define CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION 0 42 #define CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION 0 43 /*================================================================================================== 44 * FILE VERSION CHECKS 45 ==================================================================================================*/ 46 /* Check if Mru_Ip.h and Mru_Ip_Types.h are of the same vendor */ 47 #if (CDD_PLATFORM_MRU_IP_VENDOR_ID != CDD_PLATFORM_MRU_IP_TYPES_VENDOR_ID) 48 #error "Mru_Ip.h and Mru_Ip_Types.h have different vendor ids" 49 #endif 50 /* Check if Mru_Ip.h file and Mru_Ip_Types.h file are of the same Autosar version */ 51 #if ((CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \ 52 (CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION != CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \ 53 (CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION != CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_REVISION_VERSION)) 54 #error "AutoSar Version Numbers of Mru_Ip.h and Mru_Ip_Types.h are different" 55 #endif 56 #if ((CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_TYPES_SW_MAJOR_VERSION) || \ 57 (CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION != CDD_PLATFORM_MRU_IP_TYPES_SW_MINOR_VERSION) || \ 58 (CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION != CDD_PLATFORM_MRU_IP_TYPES_SW_PATCH_VERSION)) 59 #error "Software Version Numbers of Mru_Ip.h and Mru_Ip_Types.h are different" 60 #endif 61 62 /*================================================================================================== 63 * CONSTANTS 64 ==================================================================================================*/ 65 /*================================================================================================== 66 * DEFINES AND MACROS 67 ==================================================================================================*/ 68 /*================================================================================================== 69 * ENUMS 70 ==================================================================================================*/ 71 /*================================================================================================== 72 * STRUCTURES AND OTHER TYPEDEFS 73 ==================================================================================================*/ 74 /*================================================================================================== 75 * GLOBAL VARIABLE DECLARATIONS 76 ==================================================================================================*/ 77 #ifdef PLATFORM_IP_ENABLE_MRU 78 #if (PLATFORM_IP_ENABLE_MRU == STD_ON) 79 80 #define PLATFORM_START_SEC_CONFIG_DATA_UNSPECIFIED 81 #include "Platform_MemMap.h" 82 /** 83 * @brief Export the configurations. 84 */ 85 MRU_IP_CONFIG_EXT 86 87 #define PLATFORM_STOP_SEC_CONFIG_DATA_UNSPECIFIED 88 #include "Platform_MemMap.h" 89 /*================================================================================================== 90 * FUNCTION PROTOTYPES 91 ==================================================================================================*/ 92 #define PLATFORM_START_SEC_CODE 93 #include "Platform_MemMap.h" 94 95 /** 96 * @brief MRU peripheral initialization. 97 * @details The function initialize the MRU Unit specified in the configuration. 98 * 99 * @param[in] HWUnitConfigPtr - pointer to the specified MRU Unit configuration. 100 * 101 * @implements Mru_Ip_Init_Activity 102 */ 103 void Mru_Ip_Init(const Mru_Ip_ConfigType *HWUnitConfigPtr); 104 105 /** 106 * @brief MRU transmission. 107 * @details This function writes the data to Mailboxes using the channel specified. 108 * 109 * @param[in] TransmitChCfgPtr - pointer to the channel configuration where contains list of mailboxes to be written. 110 * @param[in] TxBufferPtr - pointer to transmit buffer. 111 * 112 * @return MRU_IP_STATUS_SUCCESS: Transmission command has been accepted. 113 * MRU_IP_STATUS_FAIL: Transmission command has not been accepted. 114 * 115 * @implements Mru_Ip_Transmit_Activity 116 */ 117 Mru_Ip_StatusType Mru_Ip_Transmit(const Mru_Ip_TransmitChannelType *TransmitChCfgPtr, 118 const uint32 *TxBufferPtr 119 ); 120 /*================================================================================================*/ 121 #if (STD_ON == MRU_IP_CHANNEL_RESET_API) 122 /** 123 * @brief MRU Reset transmit channel. 124 * @details This function reset mailboxs status which are used by transmit channel in configuration. 125 * 126 * @param[in] TransmitChCfgPtr - Pointer for the transmit channel configuration. 127 * 128 * @return void 129 * 130 * @implements Mru_Ip_ResetTransmitChannel_Activity 131 */ 132 void Mru_Ip_ResetTransmitChannel( const Mru_Ip_TransmitChannelType *TransmitChCfgPtr); 133 /** 134 * @brief MRU Reset receive channel. 135 * @details This function reset mailboxs status which are used by receive channel in configuration. 136 * 137 * @param[in] ReceiveChCfgPtr - Pointer for the receive channel configuration. 138 * 139 * @return void 140 * 141 * @implements Mru_Ip_ResetReceiveChannel_Activity 142 */ 143 void Mru_Ip_ResetReceiveChannel( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr ); 144 #endif 145 /*================================================================================================*/ 146 #if (STD_ON == MRU_IP_INSTANCE_RESET_API) 147 /** 148 * @brief Reset Mru Instance. 149 * @details This function reset all mailbox status in a Mru instance. 150 * 151 * @param[in] ResetInsCfgPtr – reset instance configuration pointer. 152 * 153 * @return void 154 * 155 * @implements Mru_Ip_ResetInstance_Activity 156 */ 157 void Mru_Ip_ResetInstance( const Mru_Ip_ResetInstanceType *ResetInsCfgPtr); 158 #endif 159 /*================================================================================================*/ 160 /** 161 * @brief MRU Read Mailbox. 162 * @details This function read the data from Mailboxes using the channel specified. 163 * 164 * @param[in] ReceiveChCfgPtr - Pointer for the receive channel configuration. 165 * @param[in] DataBufferPtr - Buffer pointer to receive data. 166 * @param[in] Timeout - Timeout value (Unit depend to timeout method). 167 * 168 * @return MRU_IP_STATUS_SUCCESS: Receive command has been accepted. 169 * MRU_IP_STATUS_TIMEOUT: Receive command has been timeout. 170 * 171 * @implements Mru_Ip_ReadMailbox_Activity 172 */ 173 Mru_Ip_StatusType Mru_Ip_ReadMailbox( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr, 174 uint32 *RxBufferPtr, 175 uint32 Timeout 176 ); 177 /*================================================================================================*/ 178 /** 179 * @brief Get mailbox status. 180 * @details This function get mailbox status of a specific channel. 181 * 182 * @param[in] ReceiveChCfgPtr Pointer for the receive channel configuration. 183 * 184 * @return Mru_Ip_MBStatusType 185 * @retval MRU_IP_MAILBOX_INACTIVE Mailbox status is inactive 186 * @retval MRU_IP_MAILBOX_ACTIVE Mailbox status is active 187 * 188 * @implements Mru_Ip_GetMailboxStatus_Activity 189 */ 190 Mru_Ip_MBStatusType Mru_Ip_GetMailboxStatus( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr ); 191 192 #if (STD_ON == MRU_IP_CHANNEL_ENABLE_API) 193 /** 194 * @brief MRU Enable channel. 195 * @details This function enable interrupt capability of a logical receive channel. 196 * 197 * @param[in] ReceiveChCfgPtr - Pointer for the receive channel configuration. 198 * 199 * @return Mru_Ip_StatusType 200 * @retval MRU_IP_STATUS_SUCCESS: Receive command has been accepted. 201 * MRU_IP_STATUS_FAIL: Receive command has not been accepted. 202 * 203 * @implements Mru_Ip_EnableChannel_Activity 204 */ 205 Mru_Ip_StatusType Mru_Ip_EnableChannel(const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr); 206 #endif 207 208 #if (STD_ON == MRU_IP_CHANNEL_DISABLE_API) 209 /** 210 * @brief MRU Disable channel. 211 * @details This function disable interrupt capability and Mru mailbox read functional of a logical receive channel. 212 * Before actual disabling logical Mru channel , Mru_Ip_DisableChannel 213 * will try to see if there is any on-going request is pending and execute it immediately. 214 * After disabling operation is done, any new request will be ignored. 215 * The pending interrupt inside interrupt controller cannot be cleared and will be treated like spurious interrupt. 216 * 217 * @param[in] ReceiveChCfgPtr - Pointer for the receive channel configuration. 218 * 219 * @return Mru_Ip_StatusType 220 * @retval MRU_IP_STATUS_SUCCESS: Receive command has been accepted. 221 * MRU_IP_STATUS_FAIL: Receive command has not been accepted. 222 * 223 * @implements Mru_Ip_DisableChannel_Activity 224 */ 225 Mru_Ip_StatusType Mru_Ip_DisableChannel(const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr); 226 #endif 227 228 void Mru_Ip_IrqHandler(uint8 InstanceId, uint8 IntGroupId); 229 230 #define PLATFORM_STOP_SEC_CODE 231 #include "Platform_MemMap.h" 232 233 #endif /* PLATFORM_IP_ENABLE_MRU == STD_ON)*/ 234 #endif /* PLATFORM_IP_ENABLE_MRU */ 235 236 #ifdef __cplusplus 237 } 238 #endif 239 240 #endif /* MRU_IP_H */ 241 242 /** @} */ 243 244