1 /*
2 * Copyright 2021-2024 NXP
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7 /**
8 * @file Mru_Ip.c
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 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif
21
22 /*==================================================================================================
23 * INCLUDE FILES
24 * 1) system and project includes
25 * 2) needed interfaces from external units
26 * 3) internal and external interfaces from this unit
27 ==================================================================================================*/
28 #include "Mcal.h"
29 #include "SchM_Platform.h"
30 #include "Mru_Ip.h"
31 #include "OsIf.h"
32 #if (STD_ON == MRU_IP_DEV_ERROR_DETECT)
33 #include "Devassert.h"
34 #endif
35
36 /*==================================================================================================
37 * SOURCE FILE VERSION INFORMATION
38 ==================================================================================================*/
39 #define CDD_PLATFORM_MRU_IP_VENDOR_ID_C 43
40 #define CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION_C 4
41 #define CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION_C 7
42 #define CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION_C 0
43 #define CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION_C 2
44 #define CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION_C 0
45 #define CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION_C 0
46 /*==================================================================================================
47 * FILE VERSION CHECKS
48 ==================================================================================================*/
49 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
50 /* Check if current file and Mcal header file are of the same Autosar version */
51 #if ((CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION_C != MCAL_AR_RELEASE_MAJOR_VERSION) || \
52 (CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION_C != MCAL_AR_RELEASE_MINOR_VERSION))
53 #error "AutoSar Version Numbers of Mru_Ip.c and Mcal.h are different"
54 #endif
55 #endif
56
57 /* Check if Mru_Ip.h and Mru_Ip.c are of the same vendor */
58 #if (CDD_PLATFORM_MRU_IP_VENDOR_ID != CDD_PLATFORM_MRU_IP_VENDOR_ID_C)
59 #error "Mru_Ip.h and Mru_Ip.c have different vendor ids"
60 #endif
61 /* Check if Mru_Ip.h file and Mru_Ip.c file are of the same Autosar version */
62 #if ((CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION_C) || \
63 (CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION_C) || \
64 (CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION_C))
65 #error "AutoSar Version Numbers of Mru_Ip.h and Mru_Ip.c are different"
66 #endif
67 #if ((CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION_C) || \
68 (CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION != CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION_C) || \
69 (CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION != CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION_C))
70 #error "Software Version Numbers of Mru_Ip.h and Mru_Ip.c are different"
71 #endif
72
73 /* Check if OsIf.h and Mru_Ip.c are of the same vendor */
74 #if (OSIF_VENDOR_ID != CDD_PLATFORM_MRU_IP_VENDOR_ID_C)
75 #error "OsIf.h and Mru_Ip.c have different vendor ids"
76 #endif
77 /* Check if OsIf.h file and Mru_Ip.c file are of the same Autosar version */
78 #if ((OSIF_AR_RELEASE_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_MAJOR_VERSION_C) || \
79 (OSIF_AR_RELEASE_MINOR_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_MINOR_VERSION_C) || \
80 (OSIF_AR_RELEASE_REVISION_VERSION != CDD_PLATFORM_MRU_IP_AR_RELEASE_REVISION_VERSION_C))
81 #error "AutoSar Version Numbers of OsIf.h and Mru_Ip.c are different"
82 #endif
83 #if ((OSIF_SW_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_SW_MAJOR_VERSION_C) || \
84 (OSIF_SW_MINOR_VERSION != CDD_PLATFORM_MRU_IP_SW_MINOR_VERSION_C) || \
85 (OSIF_SW_PATCH_VERSION != CDD_PLATFORM_MRU_IP_SW_PATCH_VERSION_C))
86 #error "Software Version Numbers of OsIf.h and Mru_Ip.c are different"
87 #endif
88
89 /*==================================================================================================
90 * LOCAL FUNCTIONS
91 ==================================================================================================*/
92 #ifdef PLATFORM_IP_ENABLE_MRU
93 #if (PLATFORM_IP_ENABLE_MRU == STD_ON)
94
95 #if ((STD_ON == MRU_IP_ENABLE_USER_MODE_SUPPORT) && (defined (MCAL_ENABLE_USER_MODE_SUPPORT)))
96 #define Call_Mru_Ip_Init(pHWUnitConfigPtr) \
97 OsIf_Trusted_Call1param(Mru_Ip_Init_Privileged,(pHWUnitConfigPtr))
98 #define Call_Mru_Ip_Transmit(pTransmitChCfgPtr,pTxBufferPtr) \
99 OsIf_Trusted_Call_Return2param(Mru_Ip_Transmit_Privileged,(pTransmitChCfgPtr),(pTxBufferPtr))
100 #if (STD_ON == MRU_IP_CHANNEL_RESET_API)
101 #define Call_Mru_Ip_ResetTransmitChannel(pTransmitChCfgPtr) \
102 OsIf_Trusted_Call1param(Mru_Ip_ResetTransmitChannel_Privileged,(pTransmitChCfgPtr))
103 #define Call_Mru_Ip_ResetReceiveChannel(pReceiveChCfgPtr) \
104 OsIf_Trusted_Call1param(Mru_Ip_ResetReceiveChannel_Privileged,(pReceiveChCfgPtr))
105 #endif
106 #if (STD_ON == MRU_IP_INSTANCE_RESET_API)
107 #define Call_Mru_Ip_ResetInstance(pResetInsCfgPtr) \
108 OsIf_Trusted_Call1param(Mru_Ip_ResetInstance_Privileged,(pResetInsCfgPtr))
109 #endif
110 #define Call_Mru_Ip_ReadMailbox(ReceiveChCfgPtr,RxBufferPtr,Timeout) \
111 OsIf_Trusted_Call_Return3param(Mru_Ip_ReadMailbox_Privileged,(ReceiveChCfgPtr),(RxBufferPtr),(Timeout))
112 #define Call_Mru_Ip_GetMailboxStatus(ReceiveChCfgPtr) \
113 OsIf_Trusted_Call_Return1param(Mru_Ip_GetMailboxStatus_Privileged,(ReceiveChCfgPtr))
114 #if (STD_ON == MRU_IP_CHANNEL_ENABLE_API)
115 #define Call_Mru_Ip_EnableChannel(ReceiveChCfgPtr) \
116 OsIf_Trusted_Call_Return1param(Mru_Ip_EnableChannel_Privileged,(ReceiveChCfgPtr))
117 #endif
118 #if (STD_ON == MRU_IP_CHANNEL_DISABLE_API)
119 #define Call_Mru_Ip_DisableChannel(ReceiveChCfgPtr) \
120 OsIf_Trusted_Call_Return1param(Mru_Ip_DisableChannel_Privileged,(ReceiveChCfgPtr))
121 #endif
122 #else /*STD_ON == MRU_IP_ENABLE_USER_MODE_SUPPORT*/
123 #define Call_Mru_Ip_Init(pHWUnitConfigPtr) \
124 Mru_Ip_Init_Privileged((pHWUnitConfigPtr))
125 #define Call_Mru_Ip_Transmit(pTransmitChCfgPtr,pTxBufferPtr) \
126 Mru_Ip_Transmit_Privileged((pTransmitChCfgPtr),(pTxBufferPtr))
127 #if (STD_ON == MRU_IP_CHANNEL_RESET_API)
128 #define Call_Mru_Ip_ResetTransmitChannel(pTransmitChCfgPtr) \
129 Mru_Ip_ResetTransmitChannel_Privileged((pTransmitChCfgPtr))
130 #define Call_Mru_Ip_ResetReceiveChannel(pReceiveChCfgPtr) \
131 Mru_Ip_ResetReceiveChannel_Privileged((pReceiveChCfgPtr))
132 #endif
133 #if (STD_ON == MRU_IP_INSTANCE_RESET_API)
134 #define Call_Mru_Ip_ResetInstance(pResetInsCfgPtr) \
135 Mru_Ip_ResetInstance_Privileged((pResetInsCfgPtr))
136 #endif
137 #define Call_Mru_Ip_ReadMailbox(ReceiveChCfgPtr,RxBufferPtr,Timeout) \
138 Mru_Ip_ReadMailbox_Privileged((ReceiveChCfgPtr),(RxBufferPtr),(Timeout))
139 #define Call_Mru_Ip_GetMailboxStatus(ReceiveChCfgPtr) \
140 Mru_Ip_GetMailboxStatus_Privileged((ReceiveChCfgPtr))
141 #if (STD_ON == MRU_IP_CHANNEL_ENABLE_API)
142 #define Call_Mru_Ip_EnableChannel(ReceiveChCfgPtr) \
143 Mru_Ip_EnableChannel_Privileged((ReceiveChCfgPtr))
144 #endif
145 #if (STD_ON == MRU_IP_CHANNEL_DISABLE_API)
146 #define Call_Mru_Ip_DisableChannel(ReceiveChCfgPtr) \
147 Mru_Ip_DisableChannel_Privileged((ReceiveChCfgPtr))
148 #endif
149 #endif /*STD_ON == MRU_IP_ENABLE_USER_MODE_SUPPORT*/
150 /*==================================================================================================
151 * LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
152 ==================================================================================================*/
153
154 /*==================================================================================================
155 * LOCAL MACROS
156 ==================================================================================================*/
157
158 /*==================================================================================================
159 * LOCAL CONSTANTS
160 ==================================================================================================*/
161
162 /*==================================================================================================
163 * LOCAL VARIABLES
164 ==================================================================================================*/
165
166 /*==================================================================================================
167 * GLOBAL CONSTANTS
168 ==================================================================================================*/
169
170 /*==================================================================================================
171 GLOBAL VARIABLES
172 ==================================================================================================*/
173
174 #define PLATFORM_START_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
175 #include "Platform_MemMap.h"
176
177 VAR_SEC_NOCACHE(Mru_Ip_axStateStructure) Mru_Ip_StateStructureType Mru_Ip_axStateStructure[MRU_IP_NUMBER_OF_INSTANCES];
178
179 VAR_SEC_NOCACHE(Mru_Ip_apxStateStructureArray) Mru_Ip_StateStructureType* Mru_Ip_apxStateStructureArray[MRU_IP_NUMBER_OF_INSTANCES];
180
181 #define PLATFORM_STOP_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
182 #include "Platform_MemMap.h"
183 /*==================================================================================================
184 * LOCAL FUNCTION PROTOTYPES
185 ==================================================================================================*/
186 #define PLATFORM_START_SEC_CODE
187 #include "Platform_MemMap.h"
188
189 /*==================================================================================================
190 * LOCAL FUNCTIONS
191 ==================================================================================================*/
192 static void Mru_Ip_IrqHandlerReceiveMb(const Mru_Ip_ChannelCfgType * ChannelConfig, uint8 IntGroupId);
193 static void Mru_Ip_ProcessActiveMb(const Mru_Ip_ReceiveChannelType * pReceiveChConfig,
194 volatile uint32 *pu32ChMbStatAddr,
195 uint32 u32MbIndex);
196 void Mru_Ip_Init_Privileged(const Mru_Ip_ConfigType *HWUnitConfigPtr);
197 Mru_Ip_StatusType Mru_Ip_Transmit_Privileged( const Mru_Ip_TransmitChannelType *TransmitChCfgPtr,
198 const uint32 *TxBufferPtr
199 );
200 #if (STD_ON == MRU_IP_CHANNEL_RESET_API)
201 void Mru_Ip_ResetTransmitChannel_Privileged( const Mru_Ip_TransmitChannelType *TransmitChCfgPtr );
202 void Mru_Ip_ResetReceiveChannel_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr );
203 #endif
204 #if (STD_ON == MRU_IP_INSTANCE_RESET_API)
205 void Mru_Ip_ResetInstance_Privileged( const Mru_Ip_ResetInstanceType *ResetInsCfgPtr );
206 #endif
207 Mru_Ip_StatusType Mru_Ip_ReadMailbox_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr,
208 uint32 *RxBufferPtr,
209 uint32 Timeout
210 );
211 Mru_Ip_MBStatusType Mru_Ip_GetMailboxStatus_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr );
212 #if (STD_ON == MRU_IP_CHANNEL_ENABLE_API)
213 Mru_Ip_StatusType Mru_Ip_EnableChannel_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr);
214 #endif
215 #if (STD_ON == MRU_IP_CHANNEL_DISABLE_API)
216 Mru_Ip_StatusType Mru_Ip_DisableChannel_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr);
217 #endif
218 /*================================================================================================*/
Mru_Ip_Init_Privileged(const Mru_Ip_ConfigType * HWUnitConfigPtr)219 void Mru_Ip_Init_Privileged(const Mru_Ip_ConfigType *HWUnitConfigPtr)
220 {
221 Mru_Ip_StateStructureType* State;
222 uint8 InstanceId = 0u;
223 uint8 CfgIndex = 0u;
224
225 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
226 DevAssert(NULL_PTR != HWUnitConfigPtr);
227 #endif
228 InstanceId = HWUnitConfigPtr->InstanceId;
229 State = Mru_Ip_apxStateStructureArray[InstanceId];
230 Mru_Ip_apxStateStructureArray[InstanceId] = &Mru_Ip_axStateStructure[HWUnitConfigPtr->StateIndex];
231 State = Mru_Ip_apxStateStructureArray[InstanceId];
232 State->HWUnitConfig = HWUnitConfigPtr;
233
234 for(CfgIndex = 0u; CfgIndex < HWUnitConfigPtr->NumChannel; CfgIndex++)
235 {
236 if((NULL_PTR != HWUnitConfigPtr->ChannelCfg[CfgIndex].MBLinkReceiveChCfg) &&
237 (FALSE == HWUnitConfigPtr->ChannelCfg[CfgIndex].bSkipInitChannel))
238 {
239 /* Enables the channel configuration before writing to registers */
240 *HWUnitConfigPtr->ChannelCfg[CfgIndex].ChCFG0Add = MRU_IP_CH_CFG0_CHE_MASK;
241 /* Update channel CFG1 */
242 *HWUnitConfigPtr->ChannelCfg[CfgIndex].ChCFG1Add = HWUnitConfigPtr->ChannelCfg[CfgIndex].ChCFG1;
243 /* Update channel CFG0 */
244 *HWUnitConfigPtr->ChannelCfg[CfgIndex].ChCFG0Add = HWUnitConfigPtr->ChannelCfg[CfgIndex].ChCFG0 | MRU_IP_CH_CFG0_CHE_MASK;
245 }
246 }
247 }
248 /*================================================================================================*/
Mru_Ip_Transmit_Privileged(const Mru_Ip_TransmitChannelType * TransmitChCfgPtr,const uint32 * TxBufferPtr)249 Mru_Ip_StatusType Mru_Ip_Transmit_Privileged( const Mru_Ip_TransmitChannelType *TransmitChCfgPtr,
250 const uint32 *TxBufferPtr
251 )
252 {
253 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
254 DevAssert(NULL_PTR != TransmitChCfgPtr);
255 DevAssert(NULL_PTR != TxBufferPtr);
256 #endif
257 uint8 BufferIndex = 0u;
258 Mru_Ip_StatusType Status = MRU_IP_STATUS_SUCCESS;
259 uint32 LastMbStatus = (*(TransmitChCfgPtr->ChMBSTATAdd)>> (TransmitChCfgPtr->LastTxMBIndex)) & MRU_IP_CH_MBSTAT_MBS0_MASK;
260
261 /* In case overwriting is not allowed, need to check flag of last transmission MailBox,
262 new data will be only wrote to Maiboxes if flag is cleared by receiver. */
263 if ((TRUE == TransmitChCfgPtr->bOverwriteMBEnb ) || (0U == LastMbStatus ))
264 {
265 /* Write data from Tx buffer to mailboxes */
266 for(BufferIndex = 0u; BufferIndex < TransmitChCfgPtr->NumTxMB; BufferIndex++)
267 {
268 *TransmitChCfgPtr->MBAddList[BufferIndex] = TxBufferPtr[BufferIndex];
269 }
270 }
271 else
272 {
273 Status = MRU_IP_STATUS_FAIL;
274 }
275
276 return Status;
277 }
278 /*================================================================================================*/
279 #if (STD_ON == MRU_IP_CHANNEL_RESET_API)
Mru_Ip_ResetTransmitChannel_Privileged(const Mru_Ip_TransmitChannelType * TransmitChCfgPtr)280 void Mru_Ip_ResetTransmitChannel_Privileged( const Mru_Ip_TransmitChannelType *TransmitChCfgPtr)
281 {
282 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
283 DevAssert(NULL_PTR != TransmitChCfgPtr);
284 #endif
285 uint8 MailboxUsedNum= TransmitChCfgPtr->NumTxMB;
286 uint8 Mailbox_Idx = 0U;
287 uint8 MailboxId = 0U;
288
289 SchM_Enter_Platform_PLATFORM_EXCLUSIVE_AREA_09();
290 for(Mailbox_Idx = 0; Mailbox_Idx < MailboxUsedNum ; Mailbox_Idx++)
291 {
292 MailboxId = TransmitChCfgPtr->TxMBList[Mailbox_Idx]; /* Get mailbox ID is used*/
293 *TransmitChCfgPtr->ChMBSTATAdd = MRU_IP_CH_MBSTAT_MBS0_MASK << MailboxId ; /* Clear mailbox status */
294 }
295 SchM_Exit_Platform_PLATFORM_EXCLUSIVE_AREA_09();
296 }
297 /*================================================================================================*/
Mru_Ip_ResetReceiveChannel_Privileged(const Mru_Ip_ReceiveChannelType * ReceiveChCfgPtr)298 void Mru_Ip_ResetReceiveChannel_Privileged(const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr )
299 {
300 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
301 DevAssert(NULL_PTR != ReceiveChCfgPtr);
302 #endif
303 uint8 InstanceId = ReceiveChCfgPtr->InstanceId;
304 uint8 ChannelIdx = ReceiveChCfgPtr->ChannelIndex;
305 uint8 MailboxUsedNum= ReceiveChCfgPtr->NumRxMB;
306 const Mru_Ip_ChannelCfgType * ChannelConfig = NULL_PTR;
307 const Mru_Ip_StateStructureType* State = Mru_Ip_apxStateStructureArray[InstanceId];
308 uint8 Mailbox_Idx = 0U;
309 uint8 MailboxId = 0U;
310
311 ChannelConfig = &State->HWUnitConfig->ChannelCfg[ChannelIdx];
312 SchM_Enter_Platform_PLATFORM_EXCLUSIVE_AREA_10();
313 for(Mailbox_Idx = 0; Mailbox_Idx < MailboxUsedNum ; Mailbox_Idx++)
314 {
315 MailboxId = ReceiveChCfgPtr->ListRxMB[Mailbox_Idx]; /* Get mailbox ID is used*/
316 *ChannelConfig->ChMBSTATAdd = MRU_IP_CH_MBSTAT_MBS0_MASK << MailboxId ; /* Clear mailbox status */
317 }
318 SchM_Exit_Platform_PLATFORM_EXCLUSIVE_AREA_10();
319 }
320 #endif /* STD_ON == MRU_IP_CHANNEL_RESET_API */
321 /*================================================================================================*/
322 #if (STD_ON == MRU_IP_INSTANCE_RESET_API)
Mru_Ip_ResetInstance_Privileged(const Mru_Ip_ResetInstanceType * ResetInsCfgPtr)323 void Mru_Ip_ResetInstance_Privileged(const Mru_Ip_ResetInstanceType *ResetInsCfgPtr )
324 {
325 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
326 DevAssert(NULL_PTR != ResetInsCfgPtr);
327 #endif
328 uint8 MruChannelNum = ResetInsCfgPtr->NumChannel;
329 uint8 ChannelIdx = 0;
330 uint32 MBStatusMask= 0;
331
332 SchM_Enter_Platform_PLATFORM_EXCLUSIVE_AREA_11();
333 /* Reset all MB channel in Mru instance id */
334 for (ChannelIdx = 0 ; ChannelIdx < MruChannelNum ; ChannelIdx++)
335 {
336 MBStatusMask = ResetInsCfgPtr->MruResetChOfInsCfg[ChannelIdx].MBStatusMask;
337 /* Clear all mailbox status on the channel */
338 *ResetInsCfgPtr->MruResetChOfInsCfg[ChannelIdx].ChMBSTATAdd = MBStatusMask;
339 }
340 SchM_Exit_Platform_PLATFORM_EXCLUSIVE_AREA_11();
341 }
342 #endif /* STD_ON == MRU_IP_INSTANCE_RESET_API */
343 /*================================================================================================*/
Mru_Ip_ReadMailbox_Privileged(const Mru_Ip_ReceiveChannelType * ReceiveChCfgPtr,uint32 * RxBufferPtr,uint32 Timeout)344 Mru_Ip_StatusType Mru_Ip_ReadMailbox_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr,
345 uint32 *RxBufferPtr,
346 uint32 Timeout
347 )
348 {
349 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
350 DevAssert(NULL_PTR != ReceiveChCfgPtr);
351 DevAssert(NULL_PTR != RxBufferPtr);
352 #endif
353 uint32 CurrentTicks = 0u;
354 uint32 ElapsedTicks = 0u;
355 uint32 TimeoutTicks = OsIf_MicrosToTicks(Timeout, PLATFORM_TIMEOUT_TYPE);
356 Mru_Ip_StatusType Status = MRU_IP_STATUS_SUCCESS;
357 uint8 InstanceId = ReceiveChCfgPtr->InstanceId;
358 uint8 ChannelIdx = ReceiveChCfgPtr->ChannelIndex;
359 uint32 MailboxStatus = 0u;
360 const Mru_Ip_ChannelCfgType * ChannelConfig = NULL_PTR;
361 uint8 LastRxMailboxIdx = ReceiveChCfgPtr->NumRxMB -1U;
362 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
363 DevAssert((sint8)LastRxMailboxIdx >= (sint8)0);
364 #endif
365 uint8 LastRxMailbox= (uint8)(ReceiveChCfgPtr->ListRxMB[LastRxMailboxIdx]); /* Last mailbox used in ReceiveChCfgPtr */
366 const Mru_Ip_StateStructureType* State = Mru_Ip_apxStateStructureArray[InstanceId];
367 uint8 MbIdx=0;
368
369 ChannelConfig = &State->HWUnitConfig->ChannelCfg[ChannelIdx];
370 /* Get last mailbox status */
371 MailboxStatus = *ChannelConfig->ChMBSTATAdd;
372 /* Get current ticks */
373 CurrentTicks = OsIf_GetCounter(PLATFORM_TIMEOUT_TYPE);
374 while(( 0U == ((MRU_IP_CH_MBSTAT_MBS0_MASK<<LastRxMailbox) & MailboxStatus)) && (ElapsedTicks < TimeoutTicks))
375 {
376 MailboxStatus = *ChannelConfig->ChMBSTATAdd;
377 ElapsedTicks += OsIf_GetElapsed(&CurrentTicks, PLATFORM_TIMEOUT_TYPE);
378 /* Check last mailbox status */
379 }
380
381 /* Check last mailbox status */
382 if(( 0U != ((MRU_IP_CH_MBSTAT_MBS0_MASK<<LastRxMailbox) & MailboxStatus)) && (ElapsedTicks < TimeoutTicks))
383 {
384 /*Last MB in ReceiveChCfgPtr is active*/
385 for(MbIdx=0; MbIdx < ReceiveChCfgPtr->NumRxMB; MbIdx++)
386 {
387 /* Copy data from Mailbox to buffer */
388 RxBufferPtr[MbIdx] = *ReceiveChCfgPtr->MBAddList[MbIdx];
389 }
390 /* Clear Mailbox Status*/
391 *ChannelConfig->ChMBSTATAdd = (uint32)(MRU_IP_CH_MBSTAT_MBS0_MASK << LastRxMailbox);
392 /* Call notification function */
393 if(NULL_PTR != ReceiveChCfgPtr->ReceiveNotification)
394 {
395 ReceiveChCfgPtr->ReceiveNotification(ReceiveChCfgPtr->ChannelId,
396 RxBufferPtr,
397 ReceiveChCfgPtr->NumRxMB
398 );
399 }
400 }
401 else
402 {
403 Status = MRU_IP_STATUS_TIMEOUT;
404 }
405 return Status;
406 }
407
Mru_Ip_GetMailboxStatus_Privileged(const Mru_Ip_ReceiveChannelType * ReceiveChCfgPtr)408 Mru_Ip_MBStatusType Mru_Ip_GetMailboxStatus_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr )
409 {
410 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
411 DevAssert(NULL_PTR != ReceiveChCfgPtr);
412 #endif
413 Mru_Ip_MBStatusType MbStatus = MRU_IP_MAILBOX_INACTIVE;
414 uint8 InstanceId = ReceiveChCfgPtr->InstanceId;
415 uint8 ChannelIdx = ReceiveChCfgPtr->ChannelIndex;
416 uint32 MailboxStatus = 0u;
417 const Mru_Ip_ChannelCfgType * ChannelConfig = NULL_PTR;
418 uint8 LastRxMailboxIdx = ReceiveChCfgPtr->NumRxMB -1U;
419 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
420 DevAssert((sint8)LastRxMailboxIdx >= (sint8)0);
421 #endif
422 uint8 LastRxMailbox= (uint8)(ReceiveChCfgPtr->ListRxMB[LastRxMailboxIdx]); /* Last mailbox used in ReceiveChCfgPtr */
423 const Mru_Ip_StateStructureType* State = Mru_Ip_apxStateStructureArray[InstanceId];
424
425 ChannelConfig = &State->HWUnitConfig->ChannelCfg[ChannelIdx];
426 MailboxStatus = *ChannelConfig->ChMBSTATAdd;
427 /* Check last mailbox status */
428 if( 0U != ((MRU_IP_CH_MBSTAT_MBS0_MASK<<LastRxMailbox) & MailboxStatus))
429 {
430 /*Last MB in ReceiveChCfgPtr is active*/
431 MbStatus = MRU_IP_MAILBOX_ACTIVE;
432 }
433
434 return MbStatus;
435 }
436
437 #if (STD_ON == MRU_IP_CHANNEL_ENABLE_API)
Mru_Ip_EnableChannel_Privileged(const Mru_Ip_ReceiveChannelType * ReceiveChCfgPtr)438 Mru_Ip_StatusType Mru_Ip_EnableChannel_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr)
439 {
440 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
441 DevAssert(NULL_PTR != ReceiveChCfgPtr);
442 #endif
443 const Mru_Ip_ChannelCfgType * ChannelConfig = NULL_PTR;
444 uint8 RxMailboxUsedNum= ReceiveChCfgPtr->NumRxMB;
445 uint8 LastRxMailboxId= ReceiveChCfgPtr->ListRxMB[RxMailboxUsedNum -1];
446 const Mru_Ip_StateStructureType* State = Mru_Ip_apxStateStructureArray[ReceiveChCfgPtr->InstanceId];
447 uint32 LastMailboxEnableBitMask = (MRU_IP_CH_CFG0_MBE0_MASK << LastRxMailboxId);
448 Mru_Ip_StatusType Status = MRU_IP_STATUS_SUCCESS;
449 uint32 LastMailboxEnableBitValue = 0U ;
450
451 if (0U < RxMailboxUsedNum)
452 {
453 ChannelConfig = &State->HWUnitConfig->ChannelCfg[ReceiveChCfgPtr->ChannelIndex];
454 /* Get latest mailbox enable bit of ReceiveChCfgPtr */
455 LastMailboxEnableBitValue= *(ChannelConfig->ChCFG0Add) & LastMailboxEnableBitMask ;
456 if(0U == LastMailboxEnableBitValue) /* Last Mailbox Enable Bit is disable */
457 {
458 SchM_Enter_Platform_PLATFORM_EXCLUSIVE_AREA_07();
459 /* Enable latest Mailbox which is used by ReceiveChCfgPtr */
460 *ChannelConfig->ChCFG0Add |= LastMailboxEnableBitMask;
461 SchM_Exit_Platform_PLATFORM_EXCLUSIVE_AREA_07();
462 }
463 else
464 {
465 /* Last Mailbox Enable Bit is enabled already*/
466 }
467 }
468 else
469 {
470 Status = MRU_IP_STATUS_FAIL;
471 }
472 return Status;
473 }
474
475 #endif /* STD_ON == MRU_IP_CHANNEL_ENABLE_API*/
476
477 #if (STD_ON == MRU_IP_CHANNEL_DISABLE_API)
Mru_Ip_DisableChannel_Privileged(const Mru_Ip_ReceiveChannelType * ReceiveChCfgPtr)478 Mru_Ip_StatusType Mru_Ip_DisableChannel_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr)
479 {
480 #if (MRU_IP_DEV_ERROR_DETECT == STD_ON)
481 DevAssert(NULL_PTR != ReceiveChCfgPtr);
482 #endif
483 uint8 InstanceId = ReceiveChCfgPtr->InstanceId;
484 uint8 ChannelIdx = ReceiveChCfgPtr->ChannelIndex;
485 const Mru_Ip_ChannelCfgType * ChannelConfig = NULL_PTR;
486 uint8 RxMailboxUsedNum= ReceiveChCfgPtr->NumRxMB;
487 uint8 LastRxMailboxId= ReceiveChCfgPtr->ListRxMB[RxMailboxUsedNum -1];
488 uint32 LastMailboxStatusBitMask = (MRU_IP_CH_MBSTAT_MBS0_MASK << LastRxMailboxId);
489 const Mru_Ip_StateStructureType* State = Mru_Ip_apxStateStructureArray[InstanceId];
490 volatile uint32 * ChMBSTATAddr; /* Mailbox status address*/
491 uint8 RxMailbox_Idx = 0U;
492 Mru_Ip_StatusType Status = MRU_IP_STATUS_SUCCESS;
493
494 if (0U < RxMailboxUsedNum)
495 {
496 ChannelConfig = &State->HWUnitConfig->ChannelCfg[ChannelIdx];
497 ChMBSTATAddr = ChannelConfig->ChMBSTATAdd;
498
499 SchM_Enter_Platform_PLATFORM_EXCLUSIVE_AREA_08();
500 /* Disable latest Mailbox which is used by ReceiveChCfgPtr */
501 *ChannelConfig->ChCFG0Add &= ~(MRU_IP_CH_CFG0_MBE0_MASK << LastRxMailboxId);
502 SchM_Exit_Platform_PLATFORM_EXCLUSIVE_AREA_08();
503
504 if( 0U != (*ChMBSTATAddr & LastMailboxStatusBitMask )) /* If Mailbox status is active */
505 {
506 for (RxMailbox_Idx =0 ; RxMailbox_Idx < RxMailboxUsedNum ; RxMailbox_Idx++)
507 {
508 /* Read Rx mailboxs data which are used in ReceiveChCfgPtr*/
509 ReceiveChCfgPtr->RxBuffer[RxMailbox_Idx] = *ReceiveChCfgPtr->MBAddList[RxMailbox_Idx];
510 }
511 /* Clear Latest Mailbox Status*/
512 *ChMBSTATAddr = (uint32)LastMailboxStatusBitMask;
513 /* Call notification function */
514 if(NULL_PTR != ReceiveChCfgPtr->ReceiveNotification)
515 {
516 ReceiveChCfgPtr->ReceiveNotification(ReceiveChCfgPtr->ChannelId,
517 ReceiveChCfgPtr->RxBuffer,
518 ReceiveChCfgPtr->NumRxMB
519 );
520 }
521 }
522 }
523 else
524 {
525 Status = MRU_IP_STATUS_FAIL;
526 }
527 return Status;
528 }
529 #endif /* STD_ON == MRU_IP_CHANNEL_DISABLE_API*/
530 /**
531 * @brief MRU peripheral initialization.
532 * @details The function initialize the MRU Unit specified in the configuration.
533 *
534 * @param[in] HWUnitConfigPtr - pointer to the specified MRU Unit configuration.
535 *
536 * @implements Mru_Ip_Init_Activity
537 */
Mru_Ip_Init(const Mru_Ip_ConfigType * HWUnitConfigPtr)538 void Mru_Ip_Init(const Mru_Ip_ConfigType *HWUnitConfigPtr)
539 {
540 Call_Mru_Ip_Init(HWUnitConfigPtr);
541 }
542
543 /**
544 * @brief MRU transmission.
545 * @details This function writes the data to Mailboxes using the channel specified.
546 *
547 * @param[in] TransmitChCfgPtr - pointer to the channel configuration where contains list of mailboxes to be written.
548 * @param[in] TxBufferPtr - pointer to transmit buffer.
549 *
550 * @return MRU_IP_STATUS_SUCCESS: Transmission command has been accepted.
551 * MRU_IP_STATUS_FAIL: Transmission command has not been accepted.
552 *
553 * @implements Mru_Ip_Transmit_Activity
554 */
Mru_Ip_Transmit(const Mru_Ip_TransmitChannelType * TransmitChCfgPtr,const uint32 * TxBufferPtr)555 Mru_Ip_StatusType Mru_Ip_Transmit( const Mru_Ip_TransmitChannelType *TransmitChCfgPtr,
556 const uint32 *TxBufferPtr
557 )
558 {
559 return (Mru_Ip_StatusType)Call_Mru_Ip_Transmit(TransmitChCfgPtr, TxBufferPtr);
560 }
561
562 #if (STD_ON == MRU_IP_CHANNEL_RESET_API)
563 /**
564 * @brief Reset transmit channel.
565 * @details This function reset mailboxs status which are used by transmit channel in configuration.
566 *
567 * @param[in] TransmitChCfgPtr - Pointer for the transmit channel configuration.
568 *
569 * @return void.
570 *
571 * @implements Mru_Ip_ResetTransmitChannel_Activity
572 */
Mru_Ip_ResetTransmitChannel(const Mru_Ip_TransmitChannelType * TransmitChCfgPtr)573 void Mru_Ip_ResetTransmitChannel( const Mru_Ip_TransmitChannelType *TransmitChCfgPtr
574 )
575 {
576 Call_Mru_Ip_ResetTransmitChannel(TransmitChCfgPtr);
577 }
578 /**
579 * @brief Reset receive channel.
580 * @details This function reset mailboxs status which are used by receive channel in configuration.
581 *
582 * @param[in] ReceiveChCfgPtr - Pointer for the receive channel configuration.
583 *
584 * @return void.
585 *
586 * @implements Mru_Ip_ResetReceiveChannel_Activity
587 */
Mru_Ip_ResetReceiveChannel(const Mru_Ip_ReceiveChannelType * ReceiveChCfgPtr)588 void Mru_Ip_ResetReceiveChannel( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr
589 )
590 {
591 Call_Mru_Ip_ResetReceiveChannel(ReceiveChCfgPtr);
592 }
593 #endif /* STD_ON == MRU_IP_CHANNEL_RESET_API */
594
595
596 #if (STD_ON == MRU_IP_INSTANCE_RESET_API)
597 /**
598 * @brief Reset Mru Instance.
599 * @details This function reset all mailbox status in a Mru instance.
600 *
601 * @param[in] ResetInsCfgPtr – Reset instance ID which is defined in generated code
602 *
603 * @return void.
604 *
605 * @implements Mru_Ip_ResetInstance_Activity
606 */
Mru_Ip_ResetInstance(const Mru_Ip_ResetInstanceType * ResetInsCfgPtr)607 void Mru_Ip_ResetInstance( const Mru_Ip_ResetInstanceType *ResetInsCfgPtr)
608 {
609 Call_Mru_Ip_ResetInstance(ResetInsCfgPtr);
610 }
611 #endif
612 /**
613 * @brief MRU Read Mailbox.
614 * @details This function read the data from Mailboxes using the channel specified with polling mode.
615 *
616 * @param[in] ReceiveChCfgPtr - Pointer for the receive channel configuration.
617 * @param[in] RxBufferPtr - Buffer pointer to receive data.
618 * @param[in] Timeout - time-out
619 *
620 * @return MRU_IP_STATUS_SUCCESS: Receive command has been accepted.
621 * MRU_IP_STATUS_TIMEOUT: Receive command has been timeout.
622 *
623 * @implements Mru_Ip_ReadMailbox_Activity
624 */
Mru_Ip_ReadMailbox(const Mru_Ip_ReceiveChannelType * ReceiveChCfgPtr,uint32 * RxBufferPtr,uint32 Timeout)625 Mru_Ip_StatusType Mru_Ip_ReadMailbox( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr,
626 uint32 *RxBufferPtr,
627 uint32 Timeout
628 )
629 {
630 return (Mru_Ip_StatusType)Call_Mru_Ip_ReadMailbox(ReceiveChCfgPtr, RxBufferPtr, Timeout);
631 }
632
633 /**
634 * @brief Get mailbox status.
635 * @details This function get mailbox status of a specific channel.
636 *
637 * @param[in] ReceiveChCfgPtr Pointer for the receive channel configuration.
638 *
639 * @return Mru_Ip_MBStatusType
640 * @retval MRU_IP_MAILBOX_INACTIVE Mailbox status is inactive
641 * @retval MRU_IP_MAILBOX_ACTIVE Mailbox status is active
642 *
643 * @implements Mru_Ip_GetMailboxStatus_Activity
644 */
Mru_Ip_GetMailboxStatus(const Mru_Ip_ReceiveChannelType * ReceiveChCfgPtr)645 Mru_Ip_MBStatusType Mru_Ip_GetMailboxStatus( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr )
646 {
647 return (Mru_Ip_MBStatusType)Call_Mru_Ip_GetMailboxStatus(ReceiveChCfgPtr);
648 }
649
650 #if (STD_ON == MRU_IP_CHANNEL_ENABLE_API)
651 /**
652 * @brief MRU Enable channel.
653 * @details This function enable interrupt capability of a logical receive channel.
654 *
655 * @param[in] ReceiveChCfgPtr - Pointer for the receive channel configuration.
656 *
657 * @return Mru_Ip_StatusType
658 * @retval MRU_IP_STATUS_SUCCESS: Receive command has been accepted.
659 * MRU_IP_STATUS_FAIL: Receive command has not been accepted.
660 *
661 * @implements Mru_Ip_EnableChannel_Activity
662 */
Mru_Ip_EnableChannel(const Mru_Ip_ReceiveChannelType * ReceiveChCfgPtr)663 Mru_Ip_StatusType Mru_Ip_EnableChannel(const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr)
664 {
665 return (Mru_Ip_StatusType)Call_Mru_Ip_EnableChannel(ReceiveChCfgPtr);
666 }
667 #endif /*STD_ON == MRU_IP_CHANNEL_ENABLE_API*/
668
669 #if (STD_ON == MRU_IP_CHANNEL_DISABLE_API)
670 /**
671 * @brief MRU Disable channel.
672 * @details This function disable interrupt capability and Mru mailbox read functional of a logical receive channel.
673 * Before actual disabling logical Mru channel , Mru_Ip_DisableChannel
674 * will try to see if there is any on-going request is pending and execute it immediately.
675 * After disabling operation is done, any new request will be ignored.
676 * The pending interrupt inside interrupt controller cannot be cleared and will be treated like spurious interrupt.
677 *
678 * @param[in] ReceiveChCfgPtr - Pointer for the receive channel configuration.
679 *
680 * @return Mru_Ip_StatusType
681 * @retval MRU_IP_STATUS_SUCCESS: Receive command has been accepted.
682 * MRU_IP_STATUS_FAIL: Receive command has not been accepted.
683 *
684 * @implements Mru_Ip_DisableChannel_Activity
685 */
Mru_Ip_DisableChannel(const Mru_Ip_ReceiveChannelType * ReceiveChCfgPtr)686 Mru_Ip_StatusType Mru_Ip_DisableChannel(const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr)
687 {
688 return (Mru_Ip_StatusType)Call_Mru_Ip_DisableChannel(ReceiveChCfgPtr);
689 }
690 #endif /*STD_ON == MRU_IP_CHANNEL_DISABLE_API*/
691 /**
692 * @brief This function is called by MRU ISRs.
693 * @details This function will process MRU interrupts.
694 *
695 * @param[in] InstanceId Instance Id of the hardware unit.
696 * @param[in] IntGroupId Interrupt group Id of the hardware unit.
697 *
698 * @implements Mru_Ip_IrqHandler_Activity
699 */
Mru_Ip_IrqHandler(uint8 InstanceId,uint8 IntGroupId)700 void Mru_Ip_IrqHandler(uint8 InstanceId, uint8 IntGroupId)
701 {
702 const Mru_Ip_StateStructureType* State = Mru_Ip_apxStateStructureArray[InstanceId];
703 uint8 ChannelIdx = 0u;
704 uint32 NotifyStatus = 0u;
705 const Mru_Ip_ChannelCfgType * ChannelConfig = NULL_PTR;
706
707 /* Processing channels notification */
708 NotifyStatus = *State->HWUnitConfig->NOTIFYAdd[IntGroupId];
709 for(ChannelIdx = 0u; ChannelIdx < State->HWUnitConfig->NumChannel; ChannelIdx++)
710 {
711 if((NotifyStatus & MRU_IP_NOTIFY_CH1_IS_MASK) != 0u)
712 {
713 ChannelConfig = &State->HWUnitConfig->ChannelCfg[ChannelIdx];
714 if((*ChannelConfig->ChCFG0Add & MRU_IP_CH_CFG0_IE_MASK) != 0u)
715 {
716 /* Receive mail box */
717 Mru_Ip_IrqHandlerReceiveMb(ChannelConfig, IntGroupId);
718 }
719 else
720 {
721 /* Channel enable interrupt flag is not set, nothing to do */
722 }
723 }
724 else
725 {
726 /* Channel status flag is not set, nothing to do */
727 }
728 NotifyStatus = NotifyStatus >> 1u;
729 }
730 }
731
732 /**
733 * @brief This function is called by MRU ISRs.
734 * @details This function will process MRU interrupts.
735 *
736 * @param[in] InstanceId Instance Id of the hardware unit.
737 * @param[in] IntGroupId Interrupt group Id of the hardware unit.
738 *
739 * @implementsMru_Ip_IrqHandlerReceiveMb_Activity
740 */
Mru_Ip_IrqHandlerReceiveMb(const Mru_Ip_ChannelCfgType * ChannelConfig,uint8 IntGroupId)741 static void Mru_Ip_IrqHandlerReceiveMb(const Mru_Ip_ChannelCfgType * ChannelConfig, uint8 IntGroupId)
742 {
743 const Mru_Ip_MBLinkReceiveChannelType (* MBLinkReceiveChConfig)[NOTIFY_STATUS_COUNT];
744 volatile uint32 * ChMBSTATAddr;
745 uint32 MBStatus = 0u;
746 uint32 ChCFG1 = 0u;
747 uint32 MBIdx = 0u;
748 uint32 IntGroupCfg = ((uint32)IntGroupId) << MRU_IP_CH_CFG1_MBIC0_SHIFT;
749 const Mru_Ip_ReceiveChannelType * ReceiveChConfig = NULL_PTR;
750
751 MBLinkReceiveChConfig = ChannelConfig->MBLinkReceiveChCfg;
752 if(MBLinkReceiveChConfig != NULL_PTR)
753 {
754 ChMBSTATAddr = ChannelConfig->ChMBSTATAdd;
755 MBStatus = *ChMBSTATAddr;
756 ChCFG1 = *ChannelConfig->ChCFG1Add;
757 for(MBIdx = 0u; MBIdx < ChannelConfig->NumMailbox; MBIdx++)
758 {
759 if(((ChCFG1 & MRU_IP_CH_CFG1_MBIC0_MASK) == IntGroupCfg) && ((MBStatus & MRU_IP_CH_MBSTAT_MBS0_MASK) != 0u))
760 {
761 ReceiveChConfig = MBLinkReceiveChConfig[MBIdx][IntGroupId].ReceiveChCfg;
762 Mru_Ip_ProcessActiveMb(ReceiveChConfig, ChMBSTATAddr, MBIdx);
763 }
764 else
765 {
766 /* Mailbox status flag for current interrupt group is not set, nothing to do */
767 }
768 MBStatus = MBStatus >> MRU_CH_MBSTAT_MBS0_WIDTH;
769 ChCFG1 = ChCFG1 >> MRU_CH_CFG1_MBIC0_WIDTH;
770 }
771 }
772 else
773 {
774 /* the channel was not used by the driver, nothing to do */
775 }
776 }
777
778 /**
779 * @brief Process the active mailbox.
780 * @details This function process the active mailbox when ISR is called.
781 *
782 * @param[in] pReceiveChConfig Pointer of the receive channel configuration.
783 * @param[in] pu32ChMbStatAddr The address of the channel mailbox status register.
784 * @param[in] u32MbIndex Index of mailbox.
785 *
786 */
Mru_Ip_ProcessActiveMb(const Mru_Ip_ReceiveChannelType * pReceiveChConfig,volatile uint32 * pu32ChMbStatAddr,uint32 u32MbIndex)787 static void Mru_Ip_ProcessActiveMb(const Mru_Ip_ReceiveChannelType * pReceiveChConfig,
788 volatile uint32 *pu32ChMbStatAddr,
789 uint32 u32MbIndex)
790 {
791 uint8 u8BufferIdx;
792
793 if(pReceiveChConfig != NULL_PTR)
794 {
795 /* Copy data to RxBuffer */
796 for(u8BufferIdx = 0u; u8BufferIdx < pReceiveChConfig->NumRxMB; u8BufferIdx++)
797 {
798 pReceiveChConfig->RxBuffer[u8BufferIdx] = *pReceiveChConfig->MBAddList[u8BufferIdx];
799 }
800 /* To support unidirectional communication, transmitter core will check Mailbox flag of Receiver MRU is cleared for triggering next transmit session.
801 Mailbox flag should be clear after copy data to buffer and before call notification */
802 *pu32ChMbStatAddr = (uint32)(MRU_IP_CH_MBSTAT_MBS0_MASK << u32MbIndex);
803 /* Call notification function */
804 if(NULL_PTR != pReceiveChConfig->ReceiveNotification)
805 {
806 pReceiveChConfig->ReceiveNotification(pReceiveChConfig->ChannelId,
807 pReceiveChConfig->RxBuffer,
808 pReceiveChConfig->NumRxMB
809 );
810 }
811 }
812 else
813 {
814 /* the mailbox was not configured using current interrupt group, nothing to do */
815 }
816 }
817 #define PLATFORM_STOP_SEC_CODE
818 #include "Platform_MemMap.h"
819
820 #endif /* PLATFORM_IP_ENABLE_MRU == STD_ON)*/
821 #endif /* PLATFORM_IP_ENABLE_MRU */
822
823 #ifdef __cplusplus
824 }
825 #endif
826
827 /** @} */
828