dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
circqueue.h
Go to the documentation of this file.
1 
7 /*
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16  * for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, see <http://www.gnu.org/licenses/>
20  *
21  * Additional note on redistribution: The copyright and license notices above
22  * must be maintained in each individual source file that is a derivative work
23  * of this source file; otherwise redistribution is prohibited.
24  */
25 
26 #ifndef _CIRCQUEUE_H
27 #define _CIRCQUEUE_H
28 
29 #include <pios.h>
30 #include <stdint.h>
31 
32 typedef struct circ_queue *circ_queue_t;
33 
34 circ_queue_t circ_queue_new(uint16_t elem_size, uint16_t num_elem);
35 
36 void *circ_queue_write_pos(circ_queue_t q, uint16_t *contig,
37  uint16_t *avail);
38 
39 int circ_queue_advance_write_multi(circ_queue_t q, uint16_t amt);
40 
41 int circ_queue_advance_write(circ_queue_t q);
42 
43 void *circ_queue_read_pos(circ_queue_t q, uint16_t *contig,
44  uint16_t *avail);
45 
46 void circ_queue_read_completed(circ_queue_t q);
47 
48 void circ_queue_read_completed_multi(circ_queue_t q, uint16_t num);
49 
50 uint16_t circ_queue_read_data(circ_queue_t q, void *buf, uint16_t num);
51 
52 uint16_t circ_queue_write_data(circ_queue_t q, const void *buf, uint16_t num);
53 
54 void circ_queue_clear(circ_queue_t q);
55 #endif
void circ_queue_read_completed(circ_queue_t q)
Definition: circqueue.c:256
Main PiOS header to include all the compiled in PiOS options.
uint16_t circ_queue_write_data(circ_queue_t q, const void *buf, uint16_t num)
Definition: circqueue.c:302
int circ_queue_advance_write(circ_queue_t q)
Definition: circqueue.c:192
struct circ_queue * circ_queue_t
Definition: circqueue.h:32
void * circ_queue_write_pos(circ_queue_t q, uint16_t *contig, uint16_t *avail)
Definition: circqueue.c:84
void * circ_queue_read_pos(circ_queue_t q, uint16_t *contig, uint16_t *avail)
Definition: circqueue.c:208
uint16_t num_elem
Definition: circqueue.c:30
circ_queue_t circ_queue_new(uint16_t elem_size, uint16_t num_elem)
Definition: circqueue.c:48
int circ_queue_advance_write_multi(circ_queue_t q, uint16_t amt)
Definition: circqueue.c:149
uint16_t circ_queue_read_data(circ_queue_t q, void *buf, uint16_t num)
Definition: circqueue.c:331
void circ_queue_clear(circ_queue_t q)
Definition: circqueue.c:246
void circ_queue_read_completed_multi(circ_queue_t q, uint16_t num)
Definition: circqueue.c:276
uint16_t elem_size
Definition: circqueue.c:29