Skip to content

Commit 6198692

Browse files
authored
Merge branch 'develop' into basic-changes
2 parents 5431461 + 6129df6 commit 6198692

File tree

72 files changed

+1220
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1220
-155
lines changed

erpc_c/config/erpc_config.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Copyright (c) 2016, Freescale Semiconductor, Inc.
33
* Copyright 2016-2020 NXP
4+
* Copyright 2020 ACRIOS Systems s.r.o.
45
* All rights reserved.
56
*
67
*
@@ -43,6 +44,12 @@
4344

4445
#define ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED (0) //!< Do not use MCMGR for MU ISR management.
4546
#define ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED (1) //!< Use MCMGR for MU ISR management.
47+
48+
#define ERPC_PRE_POST_ACTION_DISABLED (0) //!< Pre post shim callbacks functions disabled.
49+
#define ERPC_PRE_POST_ACTION_ENABLED (1) //!< Pre post shim callback functions enabled.
50+
51+
#define ERPC_PRE_POST_ACTION_DEFAULT_DISABLED (0) //!< Pre post shim default callbacks functions disabled.
52+
#define ERPC_PRE_POST_ACTION_DEFAULT_ENABLED (1) //!< Pre post shim default callback functions enabled.
4653
//@}
4754

4855
//! @name Configuration options
@@ -119,6 +126,22 @@
119126
//#define ERPC_TRANSPORT_MU_USE_MCMGR ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED
120127
//@}
121128

129+
//! @def ERPC_PRE_POST_ACTION
130+
//!
131+
//! Enable eRPC pre and post callback functions shim code. Take look into "erpc_pre_post_action.h". Can be used for
132+
//! detection of eRPC call freeze, ... Default set to ERPC_PRE_POST_ACTION_DISABLED.
133+
//!
134+
//! Uncomment for using pre post callback feature.
135+
//#define ERPC_PRE_POST_ACTION (ERPC_PRE_POST_ACTION_ENABLED)
136+
137+
//! @def ERPC_PRE_POST_ACTION_DEFAULT
138+
//!
139+
//! Enable eRPC pre and post default callback functions. Take look into "erpc_setup_extensions.h". Can be used for
140+
//! detection of eRPC call freeze, ... Default set to ERPC_PRE_POST_ACTION_DEFAULT_DISABLED.
141+
//!
142+
//! Uncomment for using pre post default callback feature.
143+
//#define ERPC_PRE_POST_ACTION_DEFAULT (ERPC_PRE_POST_ACTION_DEFAULT_ENABLED)
144+
122145
/*! @} */
123146
#endif // _ERPC_CONFIG_H_
124147
////////////////////////////////////////////////////////////////////////////////

erpc_c/infra/erpc_arbitrated_client_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class ArbitratedClientManager : public ClientManager
7272
virtual void performClientRequest(RequestContext &request);
7373

7474
//! @brief This method is not used with this class.
75-
void setTransport(Transport *transport) {}
75+
void setTransport(Transport *transport) { (void)transport; }
7676
};
7777

7878
} // namespace erpc

erpc_c/infra/erpc_client_manager.h

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
33
* Copyright 2016-2017 NXP
4+
* Copyright 2020 ACRIOS Systems s.r.o.
45
* All rights reserved.
56
*
67
*
@@ -11,11 +12,9 @@
1112
#define _EMBEDDED_RPC__CLIENT_MANAGER_H_
1213

1314
#ifdef __cplusplus
15+
#include "erpc_client_server_common.h"
1416
#include "erpc_codec.h"
1517
#include "erpc_config_internal.h"
16-
#if ERPC_MESSAGE_LOGGING
17-
#include "erpc_message_loggers.h"
18-
#endif
1918
#if ERPC_NESTED_CALLS
2019
#include "erpc_server.h"
2120
#include "erpc_threading.h"
@@ -51,11 +50,7 @@ class Server;
5150
*
5251
* @ingroup infra_client
5352
*/
54-
#if ERPC_MESSAGE_LOGGING
55-
class ClientManager : public MessageLoggers
56-
#else
57-
class ClientManager
58-
#endif
53+
class ClientManager : public ClientServerCommon
5954
{
6055
public:
6156
/*!
@@ -64,17 +59,15 @@ class ClientManager
6459
* This function initializes object attributes.
6560
*/
6661
ClientManager(void)
67-
: m_messageFactory(NULL)
62+
: ClientServerCommon()
63+
, m_messageFactory(NULL)
6864
, m_codecFactory(NULL)
6965
, m_transport(NULL)
7066
, m_sequence(0)
7167
, m_errorHandler(NULL)
7268
#if ERPC_NESTED_CALLS
7369
, m_server(NULL)
7470
, m_serverThreadId(NULL)
75-
#endif
76-
#if ERPC_MESSAGE_LOGGING
77-
, MessageLoggers()
7871
#endif
7972
{
8073
}
@@ -228,10 +221,10 @@ class RequestContext
228221
* @param[in] codec Set in inout codec.
229222
* @param[in] isOneway Set information if codec is only oneway or bidirectional.
230223
*/
231-
RequestContext(uint32_t sequence, Codec *codec, bool isOneway)
224+
RequestContext(uint32_t sequence, Codec *codec, bool argIsOneway)
232225
: m_sequence(sequence)
233226
, m_codec(codec)
234-
, m_oneway(isOneway)
227+
, m_oneway(argIsOneway)
235228
{
236229
}
237230

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright 2020 NXP
3+
* Copyright 2020 ACRIOS Systems s.r.o.
4+
* All rights reserved.
5+
*
6+
*
7+
* SPDX-License-Identifier: BSD-3-Clause
8+
*/
9+
10+
#ifndef _EMBEDDED_RPC__CLIENTSERVERCOMMON_H_
11+
#define _EMBEDDED_RPC__CLIENTSERVERCOMMON_H_
12+
13+
#include "erpc_config_internal.h"
14+
#if ERPC_MESSAGE_LOGGING
15+
#include "erpc_message_loggers.h"
16+
#endif
17+
#if ERPC_PRE_POST_ACTION
18+
#include "erpc_pre_post_action.h"
19+
#endif
20+
21+
/*!
22+
* @addtogroup infra_transport
23+
* @{
24+
* @file
25+
*/
26+
27+
////////////////////////////////////////////////////////////////////////////////
28+
// Classes
29+
////////////////////////////////////////////////////////////////////////////////
30+
31+
namespace erpc {
32+
33+
/*!
34+
* @brief Common class inheritand by client and server class.
35+
*
36+
* @ingroup infra_utility
37+
*/
38+
class ClientServerCommon
39+
#if ERPC_MESSAGE_LOGGING
40+
# ifdef ERPC_OTHER_INHERITANCE
41+
,
42+
# else
43+
# define ERPC_OTHER_INHERITANCE 1
44+
:
45+
# endif
46+
public MessageLoggers
47+
#endif
48+
#if ERPC_PRE_POST_ACTION
49+
# ifdef ERPC_OTHER_INHERITANCE
50+
,
51+
# else
52+
# define ERPC_OTHER_INHERITANCE 1
53+
:
54+
# endif
55+
public PrePostAction
56+
#endif
57+
{
58+
public:
59+
/*!
60+
* @brief ClientServerCommon constructor.
61+
*/
62+
ClientServerCommon(void)
63+
#ifdef ERPC_OTHER_INHERITANCE
64+
# undef ERPC_OTHER_INHERITANCE
65+
#endif
66+
#if ERPC_MESSAGE_LOGGING
67+
# ifdef ERPC_OTHER_INHERITANCE
68+
,
69+
# else
70+
# define ERPC_OTHER_INHERITANCE 1
71+
:
72+
# endif
73+
MessageLoggers()
74+
#endif
75+
#if ERPC_PRE_POST_ACTION
76+
# ifdef ERPC_OTHER_INHERITANCE
77+
,
78+
# else
79+
# define ERPC_OTHER_INHERITANCE 1
80+
:
81+
# endif
82+
PrePostAction()
83+
#endif
84+
{};
85+
86+
/*!
87+
* @brief ClientServerCommon destructor
88+
*/
89+
~ClientServerCommon(void){};
90+
};
91+
92+
} // namespace erpc
93+
94+
/*! @} */
95+
96+
#endif // _EMBEDDED_RPC__CLIENTSERVERCOMMON_H_
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2020 NXP
3+
* Copyright 2020 ACRIOS Systems s.r.o.
4+
* All rights reserved.
5+
*
6+
*
7+
* SPDX-License-Identifier: BSD-3-Clause
8+
*/
9+
10+
#include "erpc_pre_post_action.h"
11+
#include "erpc_config_internal.h"
12+
#if ERPC_PRE_POST_ACTION_DEFAULT
13+
#include "erpc_setup_extensions.h"
14+
#endif
15+
16+
using namespace erpc;
17+
using namespace std;
18+
19+
////////////////////////////////////////////////////////////////////////////////
20+
// Code
21+
////////////////////////////////////////////////////////////////////////////////
22+
23+
void PrePostAction::addPreCB(pre_post_action_cb preCB)
24+
{
25+
if (preCB)
26+
{
27+
m_preCB = preCB;
28+
}
29+
#if ERPC_PRE_POST_ACTION_DEFAULT
30+
else
31+
{
32+
m_preCB = erpc_pre_cb_default;
33+
}
34+
#endif
35+
}
36+
37+
void PrePostAction::addPostCB(pre_post_action_cb postCB)
38+
{
39+
if (postCB)
40+
{
41+
m_postCB = postCB;
42+
}
43+
#if ERPC_PRE_POST_ACTION_DEFAULT
44+
else
45+
{
46+
m_postCB = erpc_post_cb_default;
47+
}
48+
#endif
49+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Copyright 2020 NXP
3+
* Copyright 2020 ACRIOS Systems s.r.o.
4+
* All rights reserved.
5+
*
6+
*
7+
* SPDX-License-Identifier: BSD-3-Clause
8+
*/
9+
10+
#ifndef _EMBEDDED_RPC__PREPOSTACTION_H_
11+
#define _EMBEDDED_RPC__PREPOSTACTION_H_
12+
13+
#ifdef __cplusplus
14+
#include <cstddef>
15+
/*!
16+
* @addtogroup infra_transport
17+
* @{
18+
* @file
19+
*/
20+
extern "C" {
21+
#endif
22+
23+
typedef void (*pre_post_action_cb)(void);
24+
25+
#ifdef __cplusplus
26+
}
27+
28+
////////////////////////////////////////////////////////////////////////////////
29+
// Classes
30+
////////////////////////////////////////////////////////////////////////////////
31+
32+
namespace erpc {
33+
34+
/*!
35+
* @brief Client and server may used cb functions before and after rpc call.
36+
*
37+
* @ingroup infra_utility
38+
*/
39+
class PrePostAction
40+
{
41+
public:
42+
/*!
43+
* @brief PrePostAction constructor.
44+
*/
45+
PrePostAction()
46+
: m_preCB(NULL)
47+
, m_postCB(NULL){};
48+
49+
/*!
50+
* @brief This function sets "before eRPC call start" callback function.
51+
*
52+
* @param[in] preCB Pointer for callback function. When NULL and ERPC_PRE_POST_ACTION_DEFAULT
53+
* is enabled then default function will be set.
54+
*/
55+
void addPreCB(pre_post_action_cb preCB);
56+
57+
/*!
58+
* @brief This function sets "after eRPC call finish" callback function.
59+
*
60+
* @param[in] postCB Pointer for callback function. When NULL and ERPC_PRE_POST_ACTION_DEFAULT
61+
* is enabled then default function will be set.
62+
*/
63+
void addPostCB(pre_post_action_cb postCB);
64+
65+
/*!
66+
* @brief This function returns "before eRPC call start" callback function.
67+
*
68+
* @return preCB Pointer for callback function.
69+
*/
70+
pre_post_action_cb getPreCB() { return m_preCB; }
71+
72+
/*!
73+
* @brief This function returns "after eRPC call finish" callback function.
74+
*
75+
* @return postCB Pointer for callback function.
76+
*/
77+
pre_post_action_cb getPostCB() { return m_postCB; }
78+
79+
/*!
80+
* @brief PrePostAction destructor
81+
*/
82+
~PrePostAction(void){};
83+
84+
protected:
85+
pre_post_action_cb m_preCB; /*!< Pointer to "before eRPC call start" callback function. */
86+
pre_post_action_cb m_postCB; /*!< Pointer to after eRPC call finish" callback function. */
87+
};
88+
89+
} // namespace erpc
90+
91+
/*! @} */
92+
93+
#endif
94+
95+
#endif // _EMBEDDED_RPC__PREPOSTACTION_H_

0 commit comments

Comments
 (0)