|
nrfxlib API 2.8.99
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
7#ifndef _NRF_RPC_COMMON_H_
8#define _NRF_RPC_COMMON_H_
25#define __NRF_RPC_CONCAT(_x, _y) _x ## _y
40#define NRF_RPC_CONCAT(_x, _y) \
41 __NRF_RPC_CONCAT(_x, _y)
46#define __NRF_RPC_STRINGIFY(_x) #_x
58#define NRF_RPC_STRINGIFY(_x) \
59 __NRF_RPC_STRINGIFY(_x)
70#define NRF_RPC_CONTAINER_OF(_ptr, _type, _field_name) \
71 ((_type *)(((uint8_t *)_ptr) - offsetof(_type, _field_name)))
74#define __NRF_RPC_STATIC_ASSERT(_expr, _msg) \
75 _Static_assert(_expr, _msg)
77#define __NRF_RPC_STATIC_ASSERT(_expr, _msg) \
78 extern char (*_ignore(void))
87#define NRF_RPC_STATIC_ASSERT(_expr, _msg) \
88 __NRF_RPC_STATIC_ASSERT(_expr, _msg)
91#define __NRF_RPC_ASSERT(_expr) __ASSERT(_expr, "nRF RPC assertion failed")
94#define __NRF_RPC_ASSERT assert
101#define NRF_RPC_ASSERT(_expr) \
102 __NRF_RPC_ASSERT(_expr)
111#define NRF_RPC_AUTO_ARR(_name, _array_key) \
112 const uint8_t NRF_RPC_CONCAT(_name, _auto_arr_end) __used \
113 __attribute__((__section__(".nrf_rpc." _array_key ".c"))); \
114 const uint8_t *const _name __used \
115 __attribute__((__section__(".nrf_rpc." _array_key ".a"))) = \
116 &NRF_RPC_CONCAT(_name, _auto_arr_end)
125#define NRF_RPC_AUTO_ARR_ITEM(_type, _name, _array_key, _item_key) \
127 __attribute__((__section__(".nrf_rpc." _array_key ".b." _item_key)))
138#define NRF_RPC_AUTO_ARR_FOR(_it, _var, _array_ptr, _type) \
139 (_var) = (_type *)((const uint8_t *const *)(_array_ptr) + 1); \
140 (const uint8_t *const)_var < \
141 *(const uint8_t *const *)(_array_ptr); \
142 (_var) = (_type *)(_var) + 1, (void)_it
150#define NRF_RPC_AUTO_ARR_GET(_array_ptr, _index, _type) \
151 (((_type *)((const uint8_t *const *)(_array_ptr) + 1))[_index])