1 // © 2021 Qualcomm Innovation Center, Inc. All rights reserved.
2 //
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 // Appends a message to the tail of a message queue, if it is not full. If push
6 // is true or the buffer was previously below the not empty threshold, wake up
7 // receiver by asserting receiver virq. Return bool that indicates if queue is
8 // not full.
9 bool_result_t
10 msgqueue_send(msgqueue_t *msgqueue, size_t size, gvaddr_t data, bool push);
11 
12 // Fetch a message from the head of a message queue, if it is not empty. If the
13 // buffer was previously above the not full threshold, wake up the sender by
14 // asserting sender virq. Return size of received message and bool that
15 // indicates if queue is not empty.
16 receive_info_result_t
17 msgqueue_receive(msgqueue_t *msgqueue, gvaddr_t buffer, size_t max_size);
18 
19 // Removes all messages from message queue. If the message queue was previously
20 // not empty, deassert virq.
21 void
22 msgqueue_flush(msgqueue_t *msgqueue);
23 
24 // Modify notfull configuration of a message queue send interface. Any parameter
25 // passed in as MSGQUEUE_THRESHOLD_UNCHANGED indicates no change to the
26 // corresponding is requested.
27 error_t
28 msgqueue_configure_send(msgqueue_t *msgqueue, count_t notfull_thd,
29 			count_t notfull_delay);
30 
31 // Modify notemtpy configuration of a message queue receive interface. Any
32 // parameter passed in as MSGQUEUE_THRESHOLD_UNCHANGED indicates no change to
33 // the corresponding is requested. A notempty_thd special value of
34 // MSGQUEUE_THRESHOLD_MAXIMUM sets the threshold to the message queue’s depth.
35 error_t
36 msgqueue_configure_receive(msgqueue_t *msgqueue, count_t notempty_thd,
37 			   count_t notempty_delay);
38 
39 // Binds message queue send interface to a virtual interrupt.
40 error_t
41 msgqueue_bind_send(msgqueue_t *msgqueue, vic_t *vic, virq_t virq);
42 
43 // Binds message queue receive interface to a virtual interrupt.
44 error_t
45 msgqueue_bind_receive(msgqueue_t *msgqueue, vic_t *vic, virq_t virq);
46 
47 // Unbinds message queue send interface from a virtual interrupt.
48 void
49 msgqueue_unbind_send(msgqueue_t *msgqueue);
50 
51 // Unbinds message queue receive interface from a virtual interrupt.
52 void
53 msgqueue_unbind_receive(msgqueue_t *msgqueue);
54