1 /*
2  * Copyright 2021-2023 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 "StandardTypes.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             1
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 current file and StandardTypes 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     #error "AutoSar Version Numbers of Mru_Ip_Types.h and StandardTypes.h are different"
52     #endif
53 #endif
54 
55 /* Check if Mru_Ip_Types.h header file and Mru_Ip_Cfg.h configuration header file are of the same vendor */
56 #if (CDD_PLATFORM_MRU_IP_TYPES_VENDOR_ID != CDD_PLATFORM_MRU_IP_VENDOR_ID_CFG)
57     #error "Mru_Ip_Types.h and Mru_Ip_Cfg.h have different vendor IDs"
58 #endif
59     /* Check if Mru_Ip_Types.h header file and Mru_Ip_Cfg.h  configuration header file are of the same Autosar version */
60 #if ((CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION_CFG) || \
61      (CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MINOR_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION_CFG) || \
62      (CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_REVISION_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION_CFG))
63 #error "AutoSar Version Numbers of Mru_Ip_Types.h and Mru_Ip_Cfg.h are different"
64 #endif
65 /* Check if Mru_Ip_Types.h header file and Mru_Ip_Cfg.h configuration header file are of the same software version */
66 #if ((CDD_PLATFORM_MRU_IP_TYPES_SW_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION_CFG) || \
67      (CDD_PLATFORM_MRU_IP_TYPES_SW_MINOR_VERSION != CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION_CFG) || \
68      (CDD_PLATFORM_MRU_IP_TYPES_SW_PATCH_VERSION != CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION_CFG))
69 #error "Software Version Numbers of Mru_Ip_Types.h and Mru_Ip_Cfg.h are different"
70 #endif
71 /*==================================================================================================
72 *                                            CONSTANTS
73 ==================================================================================================*/
74 
75 /*==================================================================================================
76 *                                       DEFINES AND MACROS
77 ==================================================================================================*/
78 
79 /*==================================================================================================
80 *                                              ENUMS
81 ==================================================================================================*/
82 
83 /*==================================================================================================
84 *                                  STRUCTURES AND OTHER TYPEDEFS
85 ==================================================================================================*/
86 
87 /**
88  * @brief      Mru Return values
89  * @details    Return information after transmit or read mailbox.
90  *
91  */
92  #define  MRU_IP_STATUS_SUCCESS   0u /**< Successful operation. */
93  #define  MRU_IP_STATUS_FAIL      1u /**< Failed operation. */
94  #define  MRU_IP_STATUS_TIMEOUT   2u /**< Timeout operation. */
95 /**
96  * @brief      Mru Mailbox status
97  */
98 #define MRU_IP_MAILBOX_INACTIVE   0u /**< Mailbox status is inactive. */
99 #define MRU_IP_MAILBOX_ACTIVE     1u /**< Mailbox status is active. */
100 
101 /** @brief   Type defining the possible return types. */
102 typedef uint8 Mru_Ip_StatusType;
103 
104 
105 /** @brief   Type defining the Mailbox status.*/
106 typedef uint8 Mru_Ip_MBStatusType;
107 
108 /** @brief   Structure defining the data configuration for the transmitting channel. */
109 typedef struct
110 {
111    uint8 NumTxMB;                         /**< The number of MailBox used. */
112    volatile uint32 * const * MBAddList;   /**< List of MailBox address used. */
113    volatile uint32 * ChMBSTATAdd;         /**< The data configuartion for MBSTAT register. */
114    uint8 LastTxMBIndex;                   /**< Last MailBox which is enabled by receiver. */
115    boolean bOverwriteMBEnb;               /**< Allow overwriting to mailbox. */
116 } Mru_Ip_TransmitChannelType;
117 
118 /** @brief   ISR notification function type for receiving channel. */
119 typedef void (*Mru_Ip_ReceiveNotificationType)(uint8 RxChannelId, const uint32 * RxBuffer, uint8 BufferSize);
120 
121 /** @brief   Structure defining the data configuration for the receiving channel. */
122 typedef struct
123 {
124    uint8 ChannelId;                                      /**< Channel Id of the receiving channel. */
125    uint8 InstanceId;                                     /**< Instance Id of the hardware unit. */
126    uint8 ChannelIndex;                                   /**< Channel Index. */
127    uint8 NumRxMB;                                        /**< The number of MailBox used. */
128    uint8 * ListRxMB;                                     /**< The list of MailBox used. */
129    volatile const uint32 * const * MBAddList;                    /**< List of MailBox address used. */
130    uint32 * RxBuffer;                                    /**< Receiving buffer. */
131    Mru_Ip_ReceiveNotificationType ReceiveNotification;   /**< Store pointer for ISR notification function */
132 } Mru_Ip_ReceiveChannelType;
133 
134 /** @brief   Structure defining the pointer configuration link to the receiving channel configuration. */
135 typedef struct
136 {
137    const Mru_Ip_ReceiveChannelType * ReceiveChCfg;   /**< Receiving channel configuration */
138 } Mru_Ip_MBLinkReceiveChannelType;
139 
140 /** @brief   Structure defining the configuration for the channel. */
141 typedef struct
142 {
143    volatile uint32 * ChCFG0Add;                    /**< Address CH_CFG0 register. */
144    uint32 ChCFG0;                                  /**< The data configuartion for CH_CFG0 register. */
145    volatile uint32 * ChCFG1Add;                    /**< Address CH_CFG1 register. */
146    uint32 ChCFG1;                                  /**< The data configuartion for CH_CFG1 register. */
147    volatile uint32 * ChMBSTATAdd;                  /**< The data configuartion for MBSTAT register. */
148    uint32 NumMailbox;                              /**< Number of Mailbox. */
149    const Mru_Ip_MBLinkReceiveChannelType (* MBLinkReceiveChCfg)[NUMBER_OF_INTERRUPT_GROUP]; /**< Link Mailbox to the receiving channel configuration corresponding to groups interrupt. */
150 } Mru_Ip_ChannelCfgType;
151 
152 /** @brief   Structure defining information needed for MRU driver initialization. */
153 typedef struct
154 {
155    uint8 InstanceId;                               /**< Instance Id of the hardware unit. */
156    uint8 NumChannel;                               /**< Number of channel. */
157    const Mru_Ip_ChannelCfgType * ChannelCfg;       /**< The configuration of receiving channels  */
158    volatile const uint32 * NOTIFYAdd[NOTIFY_STATUS_COUNT];
159    uint8 StateIndex;                               /**< State index for the HW unit  */
160 } Mru_Ip_ConfigType;
161 
162 /** @brief   Structure defining information needed for internal state of the driver. */
163 typedef struct
164 {
165    const Mru_Ip_ConfigType * HWUnitConfig;         /**< The HW unit configuration. */
166 } Mru_Ip_StateStructureType;
167 /*==================================================================================================
168 *                                  GLOBAL VARIABLE DECLARATIONS
169 ==================================================================================================*/
170 
171 /*==================================================================================================
172 *                                       FUNCTION PROTOTYPES
173 ==================================================================================================*/
174 
175 #ifdef __cplusplus
176 }
177 #endif
178 
179 #endif /*MRU_IP_TYPES*/
180 
181 /** @} */
182