RPMsg-Lite User's Guide  Rev. 5.1.1
NXP Semiconductors
rpmsg_queue.h
1 /*
2  * Copyright (c) 2014, Mentor Graphics Corporation
3  * Copyright (c) 2015 Xilinx, Inc.
4  * Copyright (c) 2016 Freescale Semiconductor, Inc.
5  * Copyright 2016-2022 NXP
6  * Copyright 2021 ACRIOS Systems s.r.o.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef RPMSG_QUEUE_H_
35 #define RPMSG_QUEUE_H_
36 
37 #include "rpmsg_lite.h"
38 
41 
45 typedef void *rpmsg_queue_handle;
46 
47 /* RL_API_HAS_ZEROCOPY has to be enabled for RPMsg Queue to work */
48 #if defined(RL_API_HAS_ZEROCOPY) && (RL_API_HAS_ZEROCOPY == 1)
49 
50 /*******************************************************************************
51  * API
52  ******************************************************************************/
53 
54 /* Exported API functions */
55 
56 #if defined(__cplusplus)
57 extern "C" {
58 #endif
59 
71 int32_t rpmsg_queue_rx_cb(void *payload, uint32_t payload_len, uint32_t src, void *priv);
72 
85 #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)
87  uint8_t *queue_storage,
88  rpmsg_static_queue_ctxt *queue_ctxt);
89 #else
91 #endif
92 
104 int32_t rpmsg_queue_destroy(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_queue_handle q);
105 
130 int32_t rpmsg_queue_recv(struct rpmsg_lite_instance *rpmsg_lite_dev,
132  uint32_t *src,
133  char *data,
134  uint32_t maxlen,
135  uint32_t *len,
136  uintptr_t timeout);
137 
163 int32_t rpmsg_queue_recv_nocopy(struct rpmsg_lite_instance *rpmsg_lite_dev,
165  uint32_t *src,
166  char **data,
167  uint32_t *len,
168  uintptr_t timeout);
169 
184 int32_t rpmsg_queue_nocopy_free(struct rpmsg_lite_instance *rpmsg_lite_dev, void *data);
185 
194 
196 
197 #if defined(__cplusplus)
198 }
199 #endif
200 
201 #endif /* RL_API_HAS_ZEROCOPY */
202 
203 #endif /* RPMSG_QUEUE_H_ */
int32_t rpmsg_queue_recv(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_queue_handle q, uint32_t *src, char *data, uint32_t maxlen, uint32_t *len, uintptr_t timeout)
blocking receive function - blocking version of the received function that can be called from an RTOS...
Definition: rpmsg_lite.h:162
int32_t rpmsg_queue_recv_nocopy(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_queue_handle q, uint32_t *src, char **data, uint32_t *len, uintptr_t timeout)
blocking receive function - blocking version of the received function that can be called from an RTOS...
rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev)
Create a RPMsg queue which can be used for blocking reception.
int32_t rpmsg_queue_destroy(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_queue_handle q)
Destroy a queue and clean up. Do not destroy a queue which is registered with an active endpoint! ...
int32_t rpmsg_queue_nocopy_free(struct rpmsg_lite_instance *rpmsg_lite_dev, void *data)
This function frees a buffer previously returned by rpmsg_queue_recv_nocopy().
int32_t rpmsg_queue_rx_cb(void *payload, uint32_t payload_len, uint32_t src, void *priv)
This callback needs to be registered with an endpoint.
void * rpmsg_queue_handle
Rpmsg queue handle type.
Definition: rpmsg_queue.h:45
int32_t rpmsg_queue_get_current_size(rpmsg_queue_handle q)
This function returns the number of pending messages in the queue.