1 /* 2 * Copyright 2021-2023 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 #include "Mru_Ip_DeviceRegisters.h" 34 /*================================================================================================== 35 * SOURCE FILE VERSION INFORMATION 36 ==================================================================================================*/ 37 #define CDD_PLATFORM_MRU_IP_VENDOR_ID 43 38 #define CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION 4 39 #define CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION 7 40 #define CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION 0 41 #define CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION 1 42 #define CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION 0 43 #define CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION 0 44 /*================================================================================================== 45 * FILE VERSION CHECKS 46 ==================================================================================================*/ 47 /* Check if Mru_Ip.h and Mru_Ip_Types.h are of the same vendor */ 48 #if (CDD_PLATFORM_MRU_IP_VENDOR_ID != CDD_PLATFORM_MRU_IP_TYPES_VENDOR_ID) 49 #error "Mru_Ip.h and Mru_Ip_Types.h have different vendor ids" 50 #endif 51 /* Check if Mru_Ip.h file and Mru_Ip_Types.h file are of the same Autosar version */ 52 #if ((CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \ 53 (CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION != CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \ 54 (CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION != CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_REVISION_VERSION)) 55 #error "AutoSar Version Numbers of Mru_Ip.h and Mru_Ip_Types.h are different" 56 #endif 57 #if ((CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_TYPES_SW_MAJOR_VERSION) || \ 58 (CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION != CDD_PLATFORM_MRU_IP_TYPES_SW_MINOR_VERSION) || \ 59 (CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION != CDD_PLATFORM_MRU_IP_TYPES_SW_PATCH_VERSION)) 60 #error "Software Version Numbers of Mru_Ip.h and Mru_Ip_Types.h are different" 61 #endif 62 63 /* Check if Mru_Ip.h and Mru_Ip_DeviceRegisters.h are of the same vendor */ 64 #if (CDD_PLATFORM_MRU_IP_VENDOR_ID != CDD_PLATFORM_MRU_IP_DEVICE_REGISTERS_VENDOR_ID) 65 #error "Mru_Ip.h and Mru_Ip_Types.h have different vendor ids" 66 #endif 67 /* Check if Mru_Ip.h file and Mru_Ip_DeviceRegisters.h file are of the same Autosar version */ 68 #if ((CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_DEVICE_REGISTERS_AR_RELEASE_MAJOR_VERSION) || \ 69 (CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION != CDD_PLATFORM_MRU_IP_DEVICE_REGISTERS_AR_RELEASE_MINOR_VERSION) || \ 70 (CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION != CDD_PLATFORM_MRU_IP_DEVICE_REGISTERS_AR_RELEASE_REVISION_VERSION)) 71 #error "AutoSar Version Numbers of Mru_Ip.h and Mru_Ip_DeviceRegisters.h are different" 72 #endif 73 #if ((CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_DEVICE_REGISTERS_SW_MAJOR_VERSION) || \ 74 (CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION != CDD_PLATFORM_MRU_IP_DEVICE_REGISTERS_SW_MINOR_VERSION) || \ 75 (CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION != CDD_PLATFORM_MRU_IP_DEVICE_REGISTERS_SW_PATCH_VERSION)) 76 #error "Software Version Numbers of Mru_Ip.h and Mru_Ip_DeviceRegisters.h are different" 77 #endif 78 /*================================================================================================== 79 * CONSTANTS 80 ==================================================================================================*/ 81 /*================================================================================================== 82 * DEFINES AND MACROS 83 ==================================================================================================*/ 84 /*================================================================================================== 85 * ENUMS 86 ==================================================================================================*/ 87 /*================================================================================================== 88 * STRUCTURES AND OTHER TYPEDEFS 89 ==================================================================================================*/ 90 /*================================================================================================== 91 * GLOBAL VARIABLE DECLARATIONS 92 ==================================================================================================*/ 93 #define PLATFORM_START_SEC_CONFIG_DATA_UNSPECIFIED 94 #include "Platform_MemMap.h" 95 /** 96 * @brief Export the configurations. 97 */ 98 MRU_IP_CONFIG_EXT 99 100 #define PLATFORM_STOP_SEC_CONFIG_DATA_UNSPECIFIED 101 #include "Platform_MemMap.h" 102 /*================================================================================================== 103 * FUNCTION PROTOTYPES 104 ==================================================================================================*/ 105 #define PLATFORM_START_SEC_CODE 106 #include "Platform_MemMap.h" 107 108 /** 109 * @brief MRU peripheral initialization. 110 * @details The function initialize the MRU Unit specified in the configuration. 111 * 112 * @param[in] HWUnitConfigPtr - pointer to the specified MRU Unit configuration. 113 * 114 * @implements Mru_Ip_Init_Activity 115 */ 116 void Mru_Ip_Init(const Mru_Ip_ConfigType *HWUnitConfigPtr); 117 118 /** 119 * @brief MRU transmission. 120 * @details This function writes the data to Mailboxes using the channel specified. 121 * 122 * @param[in] TransmitChCfgPtr - pointer to the channel configuration where contains list of mailboxes to be written. 123 * @param[in] TxBufferPtr - pointer to transmit buffer. 124 * 125 * @return MRU_IP_STATUS_SUCCESS: Transmission command has been accepted. 126 * MRU_IP_STATUS_FAIL: Transmission command has not been accepted. 127 * 128 * @implements Mru_Ip_Transmit_Activity 129 */ 130 Mru_Ip_StatusType Mru_Ip_Transmit(const Mru_Ip_TransmitChannelType *TransmitChCfgPtr, 131 const uint32 *TxBufferPtr 132 ); 133 /*================================================================================================*/ 134 /** 135 * @brief MRU Read Mailbox. 136 * @details This function read the data from Mailboxes using the channel specified. 137 * 138 * @param[in] ReceiveChCfgPtr - Pointer for the receive channel configuration. 139 * @param[in] DataBufferPtr - Buffer pointer to receive data. 140 * @param[in] Timeout - Timeout value (Unit depend to timeout method). 141 * 142 * @return MRU_IP_STATUS_SUCCESS: Receive command has been accepted. 143 * MRU_IP_STATUS_FAIL: Receive command has not been accepted. 144 * MRU_IP_STATUS_TIMEOUT: Receive command has been timeout. 145 * 146 * @implements Mru_Ip_ReadMailbox_Activity 147 */ 148 Mru_Ip_StatusType Mru_Ip_ReadMailbox( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr, 149 uint32 *RxBufferPtr, 150 uint32 Timeout 151 ); 152 /*================================================================================================*/ 153 /** 154 * @brief Get mailbox status. 155 * @details This function get mailbox status of a specific channel. 156 * 157 * @param[in] ReceiveChCfgPtr Pointer for the receive channel configuration. 158 * 159 * @return Mru_Ip_MBStatusType 160 * @retval MRU_IP_MAILBOX_INACTIVE Mailbox status is inactive 161 * @retval MRU_IP_MAILBOX_ACTIVE Mailbox status is active 162 * 163 * @implements Mru_Ip_GetMailboxStatus_Activity 164 */ 165 Mru_Ip_MBStatusType Mru_Ip_GetMailboxStatus( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr ); 166 167 void Mru_Ip_IrqHandler(uint8 InstanceId, uint8 IntGroupId); 168 169 #define PLATFORM_STOP_SEC_CODE 170 #include "Platform_MemMap.h" 171 172 #ifdef __cplusplus 173 } 174 #endif 175 176 #endif /* MRU_IP_H */ 177 178 /** @} */ 179 180