RZ Flexible Software Package Documentation  Release v4.3.0

 
Message Handling Unit in NonSecure (r_mhu_ns)

Functions

fsp_err_t R_MHU_NS_Open (mhu_ctrl_t *const p_ctrl, mhu_cfg_t const *const p_cfg)
 
fsp_err_t R_MHU_NS_MsgSend (mhu_ctrl_t *const p_ctrl, uint32_t const msg)
 
fsp_err_t R_MHU_NS_Close (mhu_ctrl_t *const p_ctrl)
 
fsp_err_t R_MHU_NS_CallbackSet (mhu_ctrl_t *const p_api_ctrl, void(*p_callback)(mhu_callback_args_t *), void *const p_context, mhu_callback_args_t *const p_callback_memory)
 
void R_MHU_NS_IsrSub (uint32_t irq)
 

Detailed Description

Driver for the MHU peripherals on RZ MPUs. This module implements the MHU Interface (for secure and non secure channels).

Overview

MHU is a function for message communication between Cortex-A55 and Cortex-M33 cores incorporated in RZ/G2L. Message communication is done by shared RAM (On-chip RAM) for passing message and response between CPUs and the function (MHU) for notifying when messages and responses are stored in the memory.

Features

The MHU_NS module supports the following features:

MHU_NS Basic Example

This is a basic example of minimal use of the MHU_NS in an application.

static uint32_t g_val;
void mhu_ns_basic_example (void)
{
fsp_err_t err;
uint32_t msg = 0x0;
/* Initializes the module. */
err = R_MHU_NS_Open(&g_mhu_ns0_ctrl, &g_mhu_ns0_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
/* Set the user callback. */
err = R_MHU_NS_CallbackSet(&g_mhu_ns0_ctrl, mhu_ns_example_callback, NULL, NULL);
assert(FSP_SUCCESS == err);
/* Send the data. */
err = R_MHU_NS_MsgSend(&g_mhu_ns0_ctrl, msg);
assert(FSP_SUCCESS == err);
/* De-initializes the module. */
err = R_MHU_NS_Close(&g_mhu_ns0_ctrl);
assert(FSP_SUCCESS == err);
}
void mhu_ns_example_callback (mhu_callback_args_t * p_args)
{
g_val = p_args->msg;
}

Classes

struct  st_mhu_ns_instance_ctrl
 
struct  st_mhu_ns_extended_cfg
 

Typedefs

typedef struct st_mhu_ns_instance_ctrl mhu_ns_instance_ctrl_t
 
typedef struct st_mhu_ns_extended_cfg mhu_ns_extended_cfg_t
 

Class Documentation

◆ RZG::st_mhu_ns_instance_ctrl

struct RZG::st_mhu_ns_instance_ctrl

Channel control block. DO NOT INITIALIZE. Initialization occurs when mhu_api_t::open is called.

Public Attributes

uint32_t open
 Indicates whether the open() API has been successfully called.
 
mhu_cfg_t const * p_cfg
 Pointer to instance configuration.
 
R_MHU0_Type * p_regs
 Base register for this channel.
 
uint32_t channel
 channel
 
mhu_send_type_t send_type
 Send Type: Message or Response.
 
uint32_t * p_shared_memory_tx
 Pointer to send data area.
 
uint32_t * p_shared_memory_rx
 Pointer to recv data area.
 
void(* p_callback )(mhu_callback_args_t *)
 Pointer to callback and optional working memory.
 
mhu_callback_args_t * p_callback_memory
 Pointer to non-secure memory that can be used to pass arguments to a callback in non-secure memory.
 
void * p_context
 Pointer to context to be passed into callback function.
 

◆ RZG::st_mhu_ns_extended_cfg

struct RZG::st_mhu_ns_extended_cfg

R_MHU_NS extended configuration

Class Members
void * p_reg Register base address for specified channel.

Typedef Documentation

◆ mhu_ns_instance_ctrl_t

Channel control block. DO NOT INITIALIZE. Initialization occurs when mhu_api_t::open is called. Please refer to the struct st_mhu_ns_instance_ctrl.

◆ mhu_ns_extended_cfg_t

R_MHU_NS extended configuration. Please refer to the struct st_mhu_ns_extended_cfg.

Function Documentation

◆ R_MHU_NS_Open()

fsp_err_t R_MHU_NS_Open ( mhu_ctrl_t *const  p_ctrl,
mhu_cfg_t const *const  p_cfg 
)

Initializes the MHU_NS module instance. Implements mhu_api_t::open.

Return values
FSP_SUCCESSInitialization was successful.
FSP_ERR_ASSERTIONA required input pointer is NULL.
FSP_ERR_ALREADY_OPENR_MHU_NS_Open has already been called for this p_ctrl.
FSP_ERR_INVALID_ARGUMENTThe specified IRQ number is invalid.
FSP_ERR_INVALID_CHANNELRequested channel number is not available on MHU_NS.

◆ R_MHU_NS_MsgSend()

fsp_err_t R_MHU_NS_MsgSend ( mhu_ctrl_t *const  p_ctrl,
uint32_t const  msg 
)

Send message via MHU. Implements mhu_api_t::msgSend.

Return values
FSP_SUCCESSSend message successfully.
FSP_ERR_ASSERTIONA required pointer was NULL.
FSP_ERR_NOT_OPENThe instance control structure is not opened.

◆ R_MHU_NS_Close()

fsp_err_t R_MHU_NS_Close ( mhu_ctrl_t *const  p_ctrl)

Disables interrupts, clears internal driver data. mhu_api_t::close.

Return values
FSP_SUCCESSMHU_NS closed.
FSP_ERR_ASSERTIONp_ctrl is NULL.
FSP_ERR_NOT_OPENThe instance control structure is not opened.

◆ R_MHU_NS_CallbackSet()

fsp_err_t R_MHU_NS_CallbackSet ( mhu_ctrl_t *const  p_api_ctrl,
void(*)(mhu_callback_args_t *)  p_callback,
void *const  p_context,
mhu_callback_args_t *const  p_callback_memory 
)

Updates the user callback with the option to provide memory for the callback argument structure. Implements mhu_api_t::callbackSet.

Return values
FSP_SUCCESSCallback updated successfully.
FSP_ERR_ASSERTIONA required pointer is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened.
FSP_ERR_NO_CALLBACK_MEMORYp_callback is non-secure and p_callback_memory is either secure or NULL.

◆ R_MHU_NS_IsrSub()

void RZG::R_MHU_NS_IsrSub ( uint32_t  irq)

MHU_NS receive interrupt sub function (for OpenAMP)

Parameters
[in]irqirq number for inter-core interrupt