1 /* 2 * Copyright 2021-2024 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /** 8 * @file Mru_Ip_Types.h 9 * 10 * @brief MRU IP driver types header file. 11 * @details MRU IP driver types header file. 12 13 * @addtogroup MRU_IP_DRIVER Mru Ip Driver 14 * @{ 15 */ 16 17 #ifndef CDD_MRU_IP_TYPES_H 18 #define CDD_MRU_IP_TYPES_H 19 20 #ifdef __cplusplus 21 extern "C"{ 22 #endif 23 24 /*================================================================================================== 25 * INCLUDE FILES 26 * 1) system and project includes 27 * 2) needed interfaces from external units 28 * 3) internal and external interfaces from this unit 29 ==================================================================================================*/ 30 #include "Std_Types.h" 31 #include "Mru_Ip_Cfg.h" 32 33 /*================================================================================================== 34 * SOURCE FILE VERSION INFORMATION 35 ==================================================================================================*/ 36 #define CDD_PLATFORM_MRU_IP_TYPES_VENDOR_ID 43 37 #define CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MAJOR_VERSION 4 38 #define CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MINOR_VERSION 7 39 #define CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_REVISION_VERSION 0 40 #define CDD_PLATFORM_MRU_IP_TYPES_SW_MAJOR_VERSION 2 41 #define CDD_PLATFORM_MRU_IP_TYPES_SW_MINOR_VERSION 0 42 #define CDD_PLATFORM_MRU_IP_TYPES_SW_PATCH_VERSION 0 43 44 /*================================================================================================== 45 * FILE VERSION CHECKS 46 ==================================================================================================*/ 47 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK 48 /* Check if source file and Std_Types header file are of the same Autosar version */ 49 #if ((CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \ 50 (CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION) \ 51 ) 52 #error "AutoSar Version Numbers of Mru_Ip_Types.h and Std_Types.h are different" 53 #endif 54 #endif 55 56 /* Check if Mru_Ip_Types.h header file and Mru_Ip_Cfg.h configuration header file are of the same vendor */ 57 #if (CDD_PLATFORM_MRU_IP_TYPES_VENDOR_ID != CDD_PLATFORM_MRU_IP_VENDOR_ID_CFG) 58 #error "Mru_Ip_Types.h and Mru_Ip_Cfg.h have different vendor IDs" 59 #endif 60 /* Check if Mru_Ip_Types.h header file and Mru_Ip_Cfg.h configuration header file are of the same Autosar version */ 61 #if ((CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION_CFG) || \ 62 (CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MINOR_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION_CFG) || \ 63 (CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_REVISION_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION_CFG)) 64 #error "AutoSar Version Numbers of Mru_Ip_Types.h and Mru_Ip_Cfg.h are different" 65 #endif 66 /* Check if Mru_Ip_Types.h header file and Mru_Ip_Cfg.h configuration header file are of the same software version */ 67 #if ((CDD_PLATFORM_MRU_IP_TYPES_SW_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION_CFG) || \ 68 (CDD_PLATFORM_MRU_IP_TYPES_SW_MINOR_VERSION != CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION_CFG) || \ 69 (CDD_PLATFORM_MRU_IP_TYPES_SW_PATCH_VERSION != CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION_CFG)) 70 #error "Software Version Numbers of Mru_Ip_Types.h and Mru_Ip_Cfg.h are different" 71 #endif 72 /*================================================================================================== 73 * CONSTANTS 74 ==================================================================================================*/ 75 76 /*================================================================================================== 77 * DEFINES AND MACROS 78 ==================================================================================================*/ 79 80 /*================================================================================================== 81 * ENUMS 82 ==================================================================================================*/ 83 84 /*================================================================================================== 85 * STRUCTURES AND OTHER TYPEDEFS 86 ==================================================================================================*/ 87 88 /** 89 * @brief Mru Return values 90 * @details Return information after transmit or read mailbox. 91 * 92 */ 93 #define MRU_IP_STATUS_SUCCESS 0u /**< Successful operation. */ 94 #define MRU_IP_STATUS_FAIL 1u /**< Failed operation. */ 95 #define MRU_IP_STATUS_TIMEOUT 2u /**< Timeout operation. */ 96 /** 97 * @brief Mru Mailbox status 98 */ 99 #define MRU_IP_MAILBOX_INACTIVE 0u /**< Mailbox status is inactive. */ 100 #define MRU_IP_MAILBOX_ACTIVE 1u /**< Mailbox status is active. */ 101 102 /** @brief Type defining the possible return types. */ 103 typedef uint8 Mru_Ip_StatusType; 104 105 106 /** @brief Type defining the Mailbox status.*/ 107 typedef uint8 Mru_Ip_MBStatusType; 108 109 /** @brief Structure defining the data configuration for the transmitting channel. */ 110 typedef struct 111 { 112 uint8 NumTxMB; /**< The number of MailBox used. */ 113 volatile uint32 * const * MBAddList; /**< List of MailBox address used. */ 114 const uint8 * TxMBList; /**< List of MailBox used. */ 115 volatile uint32 * ChMBSTATAdd; /**< The data configuartion for MBSTAT register. */ 116 uint8 LastTxMBIndex; /**< Last MailBox which is enabled by receiver. */ 117 boolean bOverwriteMBEnb; /**< Allow overwriting to mailbox. */ 118 } Mru_Ip_TransmitChannelType; 119 120 /** @brief Structure defining channels information in a Mru instance for the reset instance. */ 121 typedef struct 122 { 123 uint32 MBStatusMask; /**< MB Status Mask. */ 124 volatile uint32 * ChMBSTATAdd; /**< Address of channel MBSTAT register. */ 125 }Mru_Ip_ResetChOfInsType; 126 127 /** @brief Structure defining the data configuration for the reset instance. */ 128 typedef struct 129 { 130 uint8 NumChannel; /**< The number of channel. */ 131 const Mru_Ip_ResetChOfInsType *MruResetChOfInsCfg; /**< Struct define channels information in a Mru instance . */ 132 } Mru_Ip_ResetInstanceType; 133 134 /** @brief ISR notification function type for receiving channel. */ 135 typedef void (*Mru_Ip_ReceiveNotificationType)(uint8 RxChannelId, const uint32 * RxBuffer, uint8 BufferSize); 136 137 /** @brief Structure defining the data configuration for the receiving channel. */ 138 typedef struct 139 { 140 uint8 ChannelId; /**< Channel Id of the receiving channel. */ 141 uint8 InstanceId; /**< Instance Id of the hardware unit. */ 142 uint8 ChannelIndex; /**< Channel Index. */ 143 uint8 NumRxMB; /**< The number of MailBox used. */ 144 const uint8 * ListRxMB; /**< The list of MailBox used. */ 145 volatile const uint32 * const * MBAddList; /**< List of MailBox address used. */ 146 uint32 * RxBuffer; /**< Receiving buffer. */ 147 Mru_Ip_ReceiveNotificationType ReceiveNotification; /**< Store pointer for ISR notification function */ 148 } Mru_Ip_ReceiveChannelType; 149 150 /** @brief Structure defining the pointer configuration link to the receiving channel configuration. */ 151 typedef struct 152 { 153 const Mru_Ip_ReceiveChannelType * ReceiveChCfg; /**< Receiving channel configuration */ 154 } Mru_Ip_MBLinkReceiveChannelType; 155 156 /** @brief Structure defining the configuration for the channel. */ 157 typedef struct 158 { 159 volatile uint32 * ChCFG0Add; /**< Address CH_CFG0 register. */ 160 uint32 ChCFG0; /**< The data configuartion for CH_CFG0 register. */ 161 volatile uint32 * ChCFG1Add; /**< Address CH_CFG1 register. */ 162 uint32 ChCFG1; /**< The data configuartion for CH_CFG1 register. */ 163 volatile uint32 * ChMBSTATAdd; /**< The data configuartion for MBSTAT register. */ 164 uint32 NumMailbox; /**< Number of Mailbox. */ 165 boolean bSkipInitChannel; /**< Skip the initialization of channel. */ 166 const Mru_Ip_MBLinkReceiveChannelType (* MBLinkReceiveChCfg)[NOTIFY_STATUS_COUNT]; /**< Link Mailbox to the receiving channel configuration corresponding to groups interrupt. */ 167 } Mru_Ip_ChannelCfgType; 168 169 /** @brief Structure defining information needed for MRU driver initialization. */ 170 typedef struct 171 { 172 uint8 InstanceId; /**< Instance Id of the hardware unit. */ 173 uint8 NumChannel; /**< Number of channel. */ 174 const Mru_Ip_ChannelCfgType * ChannelCfg; /**< The configuration of receiving channels */ 175 volatile const uint32 * NOTIFYAdd[NOTIFY_STATUS_COUNT]; 176 uint8 StateIndex; /**< State index for the HW unit */ 177 } Mru_Ip_ConfigType; 178 179 /** @brief Structure defining information needed for internal state of the driver. */ 180 typedef struct 181 { 182 const Mru_Ip_ConfigType * HWUnitConfig; /**< The HW unit configuration. */ 183 } Mru_Ip_StateStructureType; 184 /*================================================================================================== 185 * GLOBAL VARIABLE DECLARATIONS 186 ==================================================================================================*/ 187 188 /*================================================================================================== 189 * FUNCTION PROTOTYPES 190 ==================================================================================================*/ 191 192 #ifdef __cplusplus 193 } 194 #endif 195 196 #endif /*MRU_IP_TYPES*/ 197 198 /** @} */ 199