RPMsg-Lite User's Guide  Rev. 2.2.0
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 NXP
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  * 3. Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived from this
18  * software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef _RPMSG_QUEUE_H
34 #define _RPMSG_QUEUE_H
35 
36 #include "rpmsg_lite.h"
37 
40 
44 typedef void *rpmsg_queue_handle;
45 
46 /* RL_API_HAS_ZEROCOPY has to be enabled for RPMsg Queue to work */
47 #if defined(RL_API_HAS_ZEROCOPY) && (RL_API_HAS_ZEROCOPY == 1)
48 
49 /*******************************************************************************
50  * API
51  ******************************************************************************/
52 
53 /* Exported API functions */
54 
55 #if defined(__cplusplus)
56 extern "C" {
57 #endif
58 
70 int rpmsg_queue_rx_cb(void *payload, int payload_len, unsigned long src, void *priv);
71 
83 
95 int rpmsg_queue_destroy(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_queue_handle q);
96 
121 int rpmsg_queue_recv(struct rpmsg_lite_instance *rpmsg_lite_dev,
123  unsigned long *src,
124  char *data,
125  int maxlen,
126  int *len,
127  unsigned long timeout);
128 
154 int rpmsg_queue_recv_nocopy(struct rpmsg_lite_instance *rpmsg_lite_dev,
156  unsigned long *src,
157  char **data,
158  int *len,
159  unsigned long timeout);
160 
175 int rpmsg_queue_nocopy_free(struct rpmsg_lite_instance *rpmsg_lite_dev, void *data);
176 
185 
187 
188 #if defined(__cplusplus)
189 }
190 #endif
191 
192 #endif /* RL_API_HAS_ZEROCOPY */
193 
194 #endif /* _RPMSG_QUEUE_H */
int 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! ...
int rpmsg_queue_recv(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_queue_handle q, unsigned long *src, char *data, int maxlen, int *len, unsigned long timeout)
blocking receive function - blocking version of the received function that can be called from an RTOS...
Definition: rpmsg_lite.h:124
int 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().
rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev)
Create a RPMsg queue which can be used for blocking reception.
int rpmsg_queue_recv_nocopy(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_queue_handle q, unsigned long *src, char **data, int *len, unsigned long timeout)
blocking receive function - blocking version of the received function that can be called from an RTOS...
int rpmsg_queue_get_current_size(rpmsg_queue_handle q)
This function returns the number of pending messages in the queue.
int rpmsg_queue_rx_cb(void *payload, int payload_len, unsigned long src, void *priv)
This callback needs to be registered with an endpoint.
void * rpmsg_queue_handle
Rpmsg queue handle type.
Definition: rpmsg_queue.h:44