1 /*
2 * Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6 
7 /*******************************************************************************************************************//**
8  * @addtogroup MHU_NS
9  * @{
10  **********************************************************************************************************************/
11 
12 /***********************************************************************************************************************
13  * Includes
14  **********************************************************************************************************************/
15 #include "r_mhu_api.h"
16 #include "r_mhu_ns_cfg.h"
17 
18 #ifndef R_MHU_NS_H
19  #define R_MHU_NS_H
20 
21 /* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
22 FSP_HEADER
23 
24 /***********************************************************************************************************************
25  * Macro definitions
26  **********************************************************************************************************************/
27 
28 /*************************************************************************************************
29  * Type defines
30  *************************************************************************************************/
31 
32 /** Channel control block. DO NOT INITIALIZE.  Initialization occurs when @ref mhu_api_t::open is called. */
33 typedef struct st_mhu_ns_instance_ctrl
34 {
35     uint32_t          open;             ///< Indicates whether the open() API has been successfully called.
36     mhu_cfg_t const * p_cfg;            ///< Pointer to instance configuration
37     R_MHU0_Type     * p_regs;           ///< Base register for this channel
38 
39     uint32_t        channel;            ///< channel
40     mhu_send_type_t send_type;          ///< Send Type: Message or Response
41     uint32_t      * p_shared_memory_tx; ///< Pointer to send data area
42     uint32_t      * p_shared_memory_rx; ///< Pointer to recv data area
43 
44  #if BSP_TZ_SECURE_BUILD
45     bool callback_is_secure;            ///< p_callback is in secure memory
46  #endif
47 
48     /* Pointer to callback and optional working memory */
49     void (* p_callback)(mhu_callback_args_t *);
50 
51     /* Pointer to non-secure memory that can be used to pass arguments to a callback in non-secure memory. */
52     mhu_callback_args_t * p_callback_memory;
53 
54     /* Pointer to context to be passed into callback function */
55     void const * p_context;
56 } mhu_ns_instance_ctrl_t;
57 
58 /**********************************************************************************************************************
59  * Exported global variables
60  **********************************************************************************************************************/
61 
62 /** @cond INC_HEADER_DEFS_SEC */
63 /** Filled in Interface API structure for this Instance. */
64 extern const mhu_api_t g_mhu_ns_on_mhu_ns;
65 
66 /** @endcond */
67 
68 /***********************************************************************************************************************
69  * Public APIs
70  **********************************************************************************************************************/
71 fsp_err_t R_MHU_NS_Open(mhu_ctrl_t * p_ctrl, mhu_cfg_t const * const p_cfg);
72 
73 fsp_err_t R_MHU_NS_MsgSend(mhu_ctrl_t * const p_ctrl, uint32_t const msg);
74 
75 fsp_err_t R_MHU_NS_Close(mhu_ctrl_t * const p_ctrl);
76 
77 fsp_err_t R_MHU_NS_CallbackSet(mhu_ctrl_t * const          p_api_ctrl,
78                                void (                    * p_callback ) (mhu_callback_args_t *),
79                                void const * const          p_context,
80                                mhu_callback_args_t * const p_callback_memory);
81 
82 void R_MHU_NS_IsrSub(uint32_t irq);
83 
84 /** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
85 FSP_FOOTER
86 
87 #endif                                 /* R_MHU_NS_H */
88 
89 /*******************************************************************************************************************//**
90  * @} (end defgroup MHU_NS)
91  **********************************************************************************************************************/
92