1 /*
2  * Copyright 2021-2023 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 #ifndef MRU_IP_TRUSTEDFUNCTIONS_H
7 #define MRU_IP_TRUSTEDFUNCTIONS_H
8 
9 /**
10 *   @file Mru_Ip_TrustedFunctions.h
11 *
12 *   @addtogroup Mru_Ip Mru IPV Driver
13 *   @{
14 */
15 
16 /*==================================================================================================
17 *                                        INCLUDE FILES
18 ==================================================================================================*/
19 #include "Mru_Ip_Types.h"
20 
21 /*==================================================================================================
22 *                              SOURCE FILE VERSION INFORMATION
23 ==================================================================================================*/
24 #define CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_VENDOR_ID                      43
25 #define CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_AR_RELEASE_MAJOR_VERSION       4
26 #define CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_AR_RELEASE_MINOR_VERSION       7
27 #define CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_AR_RELEASE_REVISION_VERSION    0
28 #define CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_SW_MAJOR_VERSION               1
29 #define CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_SW_MINOR_VERSION               0
30 #define CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_SW_PATCH_VERSION               0
31 
32 /*==================================================================================================
33 *                                     FILE VERSION CHECKS
34 ==================================================================================================*/
35 /* Check if Mpu_R52_Ip_TrustedFunctions.h and Mpu_R52_Ip_Cfg.h are of the same vendor */
36 #if (CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_VENDOR_ID != CDD_PLATFORM_MRU_IP_TYPES_VENDOR_ID)
37     #error "Mpu_R52_Ip_TrustedFunctions.h and Mru_Ip_Types.h have different vendor ids"
38 #endif
39 /* Check if Mpu_R52_Ip_TrustedFunctions.h file and Mpu_R52_Ip_Cfg.h file are of the same Autosar version */
40 #if ((CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_AR_RELEASE_MAJOR_VERSION    != CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
41      (CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_AR_RELEASE_MINOR_VERSION    != CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
42      (CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_AR_RELEASE_REVISION_VERSION != CDD_PLATFORM_MRU_IP_TYPES_AR_RELEASE_REVISION_VERSION) \
43     )
44      #error "AUTOSAR Version Numbers of Mpu_R52_Ip_TrustedFunctions.h and Mru_Ip_Types.h are different"
45 #endif
46 /* Check if Mpu_R52_Ip_TrustedFunctions.h file and Mpu_R52_Ip_Cfg.h file are of the same Software version */
47 #if ((CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_SW_MAJOR_VERSION != CDD_PLATFORM_MRU_IP_TYPES_SW_MAJOR_VERSION) || \
48      (CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_SW_MINOR_VERSION != CDD_PLATFORM_MRU_IP_TYPES_SW_MINOR_VERSION) || \
49      (CDD_PLATFORM_MPU_R52_IP_TRUSTEDFUNCTIONS_SW_PATCH_VERSION != CDD_PLATFORM_MRU_IP_TYPES_SW_PATCH_VERSION) \
50     )
51     #error "Software Version Numbers of Mpu_R52_Ip_TrustedFunctions.h and Mru_Ip_Types.h are different"
52 #endif
53 
54 /*==================================================================================================
55 *                                      FUNCTION PROTOTYPES
56 ==================================================================================================*/
57 
58 #if defined(__cplusplus)
59 extern "C" {
60 #endif
61 
62 #define PLATFORM_START_SEC_CODE
63 #include "Platform_MemMap.h"
64 
65 #if ((STD_ON == MRU_IP_ENABLE_USER_MODE_SUPPORT) && (defined (MCAL_ENABLE_USER_MODE_SUPPORT)))
66 /**
67 * @brief            MRU peripheral initialization.
68 * @details          The function initialize the MRU Unit specified in the configuration.
69 *
70 * @param[in]        HWUnitConfigPtr -  pointer to the specified MRU Unit configuration.
71 */
72 extern void Mru_Ip_Init_Privileged(const Mru_Ip_ConfigType *HWUnitConfigPtr);
73 
74 /**
75 * @brief            MRU transmission.
76 * @details          This function writes the data to Mailboxes using the channel specified.
77 *
78 * @param[in]        TransmitChCfgPtr - pointer to the channel configuration where contains list of mailboxes to be written.
79 * @param[in]        TxBufferPtr - pointer to transmit buffer.
80 *
81 * @return           MRU_IP_STATUS_SUCCESS: Transmission command has been accepted.
82 *                   MRU_IP_STATUS_FAIL: Transmission command has not been accepted.
83 */
84 extern Mru_Ip_StatusType Mru_Ip_Transmit_Privileged( const Mru_Ip_TransmitChannelType *TransmitChCfgPtr,
85                                                      const uint32 *TxBufferPtr
86                                                    );
87 
88 /**
89 * @brief            MRU Read Mailbox.
90 * @details          This function read the data from Mailboxes using the channel specified with polling mode.
91 *
92 * @param[in]        ReceiveChCfgPtr - Pointer for the receive channel configuration.
93 * @param[in]        RxBufferPtr - Buffer pointer to receive data.
94 * @param[in]        Timeout - time-out
95 *
96 * @return           MRU_IP_STATUS_SUCCESS: Receive command has been accepted.
97 *                   MRU_IP_STATUS_FAIL: Receive command has not been accepted.
98 *                   MRU_IP_STATUS_TIMEOUT: Receive command has been timeout.
99 */
100 extern Mru_Ip_StatusType Mru_Ip_ReadMailbox_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr,
101                                                         uint32 *RxBufferPtr,
102                                                         uint32 Timeout
103                                                       );
104 
105 /**
106 * @brief   Get mailbox status.
107 * @details This function get mailbox status of a specific channel.
108 *
109 * @param[in]      ReceiveChCfgPtr       Pointer for the receive channel configuration.
110 *
111 * @return Mru_Ip_MBStatusType
112 * @retval MRU_IP_MAILBOX_INACTIVE       Mailbox status is inactive
113 * @retval MRU_IP_MAILBOX_ACTIVE         Mailbox status is active
114 */
115 extern Mru_Ip_MBStatusType Mru_Ip_GetMailboxStatus_Privileged( const Mru_Ip_ReceiveChannelType *ReceiveChCfgPtr );
116 
117 #endif /* MRU_IP_ENABLE_USER_MODE_SUPPORT == STD_ON */
118 #define PLATFORM_STOP_SEC_CODE
119 #include "Platform_MemMap.h"
120 
121 #if defined(__cplusplus)
122 }
123 #endif /* __cplusplus*/
124 
125 /*! @} */
126 
127 #endif /* MRU_IP_TRUSTEDFUNCTIONS_H */
128