![]() |
Contiki-NG
|
Header file for the ringbufindex library. More...
#include "contiki.h"Go to the source code of this file.
Functions | |
| void | ringbufindex_init (struct ringbufindex *r, uint8_t size) |
| Initialize a ring buffer. | |
| int | ringbufindex_put (struct ringbufindex *r) |
| Put one element to the ring buffer. | |
| int | ringbufindex_peek_put (const struct ringbufindex *r) |
| Check if there is space to put an element. | |
| int | ringbufindex_get (struct ringbufindex *r) |
| Remove the first element and return its index. | |
| int | ringbufindex_peek_get (const struct ringbufindex *r) |
| Return the index of the first element which will be removed if calling ringbufindex_get. | |
| static int | ringbufindex_size (const struct ringbufindex *r) |
| Return the ring buffer size. | |
| static int | ringbufindex_elements (const struct ringbufindex *r) |
| Return the number of elements currently in the ring buffer. | |
| static int | ringbufindex_full (const struct ringbufindex *r) |
| Is the ring buffer full? | |
| static int | ringbufindex_empty (const struct ringbufindex *r) |
| Is the ring buffer empty? | |
Header file for the ringbufindex library.
Definition in file ringbufindex.h.
|
inlinestatic |
Return the number of elements currently in the ring buffer.
| r | Pinter to ringbufindex |
Definition at line 108 of file ringbufindex.h.
Referenced by ringbufindex_empty(), and tsch_queue_nbr_packet_count().
|
inlinestatic |
Is the ring buffer empty?
| 0 | Not empty |
| 1 | Empty |
Definition at line 130 of file ringbufindex.h.
References ringbufindex_elements().
Referenced by tsch_queue_is_empty().
|
inlinestatic |
Is the ring buffer full?
| 0 | Not full |
| 1 | Full |
Definition at line 119 of file ringbufindex.h.
| int ringbufindex_get | ( | struct ringbufindex * | r | ) |
Remove the first element and return its index.
| r | Pinter to ringbufindex |
| >= | 0 The index of the first element |
| -1 | No element in the ring buffer |
Definition at line 90 of file ringbufindex.c.
Referenced by tsch_queue_remove_packet_from_queue().
| void ringbufindex_init | ( | struct ringbufindex * | r, |
| uint8_t | size ) |
Initialize a ring buffer.
The size must be a power of two
| r | Pointer to ringbufindex |
| size | Size of ring buffer |
Definition at line 50 of file ringbufindex.c.
Referenced by tsch_queue_add_nbr().
| int ringbufindex_peek_get | ( | const struct ringbufindex * | r | ) |
Return the index of the first element which will be removed if calling ringbufindex_get.
| r | Pinter to ringbufindex |
| >= | 0 The index of the first element |
| -1 | No element in the ring buffer |
Definition at line 115 of file ringbufindex.c.
Referenced by tsch_queue_get_packet_for_nbr().
| int ringbufindex_peek_put | ( | const struct ringbufindex * | r | ) |
Check if there is space to put an element.
| r | Pinter to ringbufindex |
| >= | 0 The index where the next element is to be added. |
| -1 | Failure; the ring buffer is full |
Definition at line 78 of file ringbufindex.c.
Referenced by tsch_queue_add_packet(), tsch_rx_slot(), and tsch_tx_slot().
| int ringbufindex_put | ( | struct ringbufindex * | r | ) |
Put one element to the ring buffer.
| r | Pointer to ringbufindex |
| 0 | Failure; the ring buffer is full |
| 1 | Success; an element is added |
Definition at line 58 of file ringbufindex.c.
Referenced by tsch_queue_add_packet(), tsch_rx_slot(), and tsch_tx_slot().
|
inlinestatic |
Return the ring buffer size.
| r | Pinter to ringbufindex |
Definition at line 97 of file ringbufindex.h.