nrfxlib API 3.3.99
Loading...
Searching...
No Matches
nrf_rpc_os_tmpl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef NRF_RPC_OS_H_
8#define NRF_RPC_OS_H_
9
10/*
11 * THIS IS A TEMPLATE FILE.
12 * It should be copied to a suitable location within the host environment into
13 * which Remote Procedure serialization is integrated, and the following macros
14 * should be provided with appropriate implementations.
15 */
16
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#define NRF_RPC_OS_WAIT_FOREVER -1
30#define NRF_RPC_OS_NO_WAIT 0
31
33struct nrf_rpc_os_event;
34
36struct nrf_rpc_os_mutex;
37
39struct nrf_rpc_os_msg;
40
46typedef void (*nrf_rpc_os_work_t)(const uint8_t *data, size_t len);
47
56
67void nrf_rpc_os_thread_pool_send(const uint8_t *data, size_t len);
68
75int nrf_rpc_os_event_init(struct nrf_rpc_os_event *event);
76
87void nrf_rpc_os_event_set(struct nrf_rpc_os_event *event);
88
98int nrf_rpc_os_event_wait(struct nrf_rpc_os_event *event, int32_t timeout);
99
106int nrf_rpc_os_mutex_init(struct nrf_rpc_os_mutex *mutex);
107
112void nrf_rpc_os_mutex_lock(struct nrf_rpc_os_mutex *mutex);
113
118void nrf_rpc_os_mutex_unlock(struct nrf_rpc_os_mutex *mutex);
119
126int nrf_rpc_os_msg_init(struct nrf_rpc_os_msg *msg);
127
138void nrf_rpc_os_msg_set(struct nrf_rpc_os_msg *msg, const uint8_t *data,
139 size_t len);
140
155void nrf_rpc_os_msg_get(struct nrf_rpc_os_msg *msg, struct nrf_rpc_os_mutex *mutex,
156 const uint8_t **data, size_t *len);
157
165
170void nrf_rpc_os_tls_set(void *data);
171
177
186
191void nrf_rpc_os_ctx_pool_release(uint32_t index);
192
193#ifdef __cplusplus
194}
195#endif
196
201#endif /* NRF_RPC_OS_H_ */
void nrf_rpc_os_thread_pool_send(const uint8_t *data, size_t len)
Send work to a thread pool.
void(* nrf_rpc_os_work_t)(const uint8_t *data, size_t len)
Work callback that will be called from thread pool.
Definition nrf_rpc_os_tmpl.h:46
int nrf_rpc_os_event_init(struct nrf_rpc_os_event *event)
Initialize event passing structure.
void nrf_rpc_os_mutex_lock(struct nrf_rpc_os_mutex *mutex)
Lock mutex.
int nrf_rpc_os_event_wait(struct nrf_rpc_os_event *event, int32_t timeout)
Wait for an event.
void nrf_rpc_os_tls_set(void *data)
Set TLS (Thread Local Storage) for nRF RPC.
void * nrf_rpc_os_tls_get(void)
Get TLS (Thread Local Storage) for nRF RPC.
int nrf_rpc_os_msg_init(struct nrf_rpc_os_msg *msg)
Initialize message passing structure.
uint64_t nrf_rpc_os_timestamp_get_now(void)
Get the current timestamp value.
void nrf_rpc_os_ctx_pool_release(uint32_t index)
Release context from context pool.
int nrf_rpc_os_mutex_init(struct nrf_rpc_os_mutex *mutex)
Initialize mutex structure.
void nrf_rpc_os_event_set(struct nrf_rpc_os_event *event)
Set an event.
void nrf_rpc_os_mutex_unlock(struct nrf_rpc_os_mutex *mutex)
Unlock mutex.
uint32_t nrf_rpc_os_ctx_pool_reserve()
Reserve one context from command context pool.
void nrf_rpc_os_msg_set(struct nrf_rpc_os_msg *msg, const uint8_t *data, size_t len)
Pass a message to a different therad.
void nrf_rpc_os_msg_get(struct nrf_rpc_os_msg *msg, struct nrf_rpc_os_mutex *mutex, const uint8_t **data, size_t *len)
Get a message.
int nrf_rpc_os_init(nrf_rpc_os_work_t callback)
nRF RPC OS-dependent initialization.