1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
3 
4 #ifndef VCHIQ_UTIL_H
5 #define VCHIQ_UTIL_H
6 
7 #include <linux/types.h>
8 #include <linux/completion.h>
9 #include <linux/mutex.h>
10 #include <linux/bitops.h>
11 #include <linux/kthread.h>
12 #include <linux/wait.h>
13 #include <linux/vmalloc.h>
14 #include <linux/jiffies.h>
15 #include <linux/delay.h>
16 #include <linux/string.h>
17 #include <linux/interrupt.h>
18 #include <linux/random.h>
19 #include <linux/sched/signal.h>
20 #include <linux/ctype.h>
21 #include <linux/uaccess.h>
22 #include <linux/time.h>  /* for time_t */
23 #include <linux/slab.h>
24 
25 #include "vchiq_if.h"
26 
27 struct vchiu_queue {
28 	int size;
29 	int read;
30 	int write;
31 	int initialized;
32 
33 	struct completion pop;
34 	struct completion push;
35 
36 	struct vchiq_header **storage;
37 };
38 
39 extern int  vchiu_queue_init(struct vchiu_queue *queue, int size);
40 extern void vchiu_queue_delete(struct vchiu_queue *queue);
41 
42 extern int vchiu_queue_is_empty(struct vchiu_queue *queue);
43 
44 extern void vchiu_queue_push(struct vchiu_queue *queue,
45 			     struct vchiq_header *header);
46 
47 extern struct vchiq_header *vchiu_queue_peek(struct vchiu_queue *queue);
48 extern struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue);
49 
50 #endif
51