15#ifndef NRF_RPC_CBKPROXY_H
16#define NRF_RPC_CBKPROXY_H
58#define NRF_RPC_CBKPROXY_HANDLER(...) \
59 _CBKPROXY_HANDLER_CAT(_CBKPROXY_HANDLER_, _CBKPROXY_HANDLER_CNT(__VA_ARGS__)) (__VA_ARGS__)
60#define _CBKPROXY_HANDLER_CNT2(a, b, c, d, e, f, ...) f
61#define _CBKPROXY_HANDLER_CNT(...) \
62 _CBKPROXY_HANDLER_CNT2(__VA_ARGS__, RET_PARAM, VOID_PARAM, RET_VOID, VOID_VOID)
63#define _CBKPROXY_HANDLER_CAT2(a, b) a ## b
64#define _CBKPROXY_HANDLER_CAT(a, b) _CBKPROXY_HANDLER_CAT2(a, b)
65#define _CBKPROXY_HANDLER_PAR1(...) \
66 uint32_t callback_slot, uint32_t _rsv0, uint32_t _rsv1, uint32_t _ret, __VA_ARGS__
67#define _CBKPROXY_HANDLER_PAR(p) (_CBKPROXY_HANDLER_PAR1 p)
68#define _CBKPROXY_HANDLER_ARG1(...) __VA_ARGS__, callback_slot
69#define _CBKPROXY_HANDLER_ARG(p) (_CBKPROXY_HANDLER_ARG1 p)
70#define _CBKPROXY_HANDLER_VOID_VOID(f, h) \
71 uint64_t f(uint32_t callback_slot, uint32_t _rsv0, uint32_t _rsv1, \
75 return (uint64_t)_ret << 32; \
77#define _CBKPROXY_HANDLER_RET_VOID(f, h, r) \
78 uint64_t f(uint32_t callback_slot, uint32_t _rsv0, uint32_t _rsv1, uint32_t _ret) \
80 BUILD_ASSERT(sizeof(r) <= 4, "Return value does not fit into uint32_t."); \
81 uint32_t _low_ret = (uint32_t)h(); \
82 return (uint64_t)_low_ret | ((uint64_t)_ret << 32); \
84#define _CBKPROXY_HANDLER_VOID_PARAM(f, h, p, a) \
85 uint64_t f _CBKPROXY_HANDLER_PAR(p) \
87 h _CBKPROXY_HANDLER_ARG(a); \
88 return (uint64_t)_ret << 32; \
90#define _CBKPROXY_HANDLER_RET_PARAM(f, h, r, p, a) \
91 uint64_t f _CBKPROXY_HANDLER_PAR(p) \
93 BUILD_ASSERT(sizeof(r) <= 4, "Return value does not fit into uint32_t."); \
94 uint32_t _low_ret = (uint32_t)h _CBKPROXY_HANDLER_ARG(a); \
95 return (uint64_t)_low_ret | ((uint64_t)_ret << 32); \
106#define NRF_RPC_CBKPROXY_HANDLER_DECL(...) _CBKPROXY_HANDLER_CAT(_CBKPROXY_HANDLER_DECL_, \
107 _CBKPROXY_HANDLER_DECL_CNT(__VA_ARGS__)) (__VA_ARGS__)
108#define _CBKPROXY_HANDLER_DECL_CNT(...) \
109 _CBKPROXY_HANDLER_CNT2(_, __VA_ARGS__, RET_PARAM, VOID_PARAM, RET_VOID, VOID_VOID)
110#define _CBKPROXY_HANDLER_DECL_VOID_VOID(f) \
111 uint64_t f(uint32_t callback_slot, uint32_t _rsv0, uint32_t _rsv1, uint32_t _ret)
112#define _CBKPROXY_HANDLER_DECL_RET_VOID(f, r) \
113 uint64_t f(uint32_t callback_slot, uint32_t _rsv0, uint32_t _rsv1, uint32_t _ret)
114#define _CBKPROXY_HANDLER_DECL_VOID_PARAM(f, p, a) \
115 uint64_t f _CBKPROXY_HANDLER_PAR(p)
116#define _CBKPROXY_HANDLER_DECL_RET_PARAM(f, r, p, a) \
117 uint64_t f _CBKPROXY_HANDLER_PAR(p)
int nrf_rpc_cbkproxy_in_set(void *callback)
Sets input callback proxy.
void * nrf_rpc_cbkproxy_out_get(int index, void *handler)
Get output callback proxy.
void * nrf_rpc_cbkproxy_in_get(int index)
Gets input callback proxy.