|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Circular FIFO queue for can_msg_t pointers. More...
Go to the source code of this file.
Functions | |
| void | CanBufferFifo_initialize (void) |
| Clears all FIFO slots and resets head and tail to zero. | |
| bool | CanBufferFifo_push (can_msg_t *new_msg) |
| Pushes a can_msg_t pointer onto the tail of the FIFO. | |
| can_msg_t * | CanBufferFifo_pop (void) |
| Removes and returns the oldest can_msg_t from the FIFO. | |
| uint8_t | CanBufferFifo_is_empty (void) |
| Returns non-zero if the FIFO is empty, zero if messages are present. | |
| uint16_t | CanBufferFifo_get_allocated_count (void) |
| Returns the number of can_msg_t pointers currently in the FIFO. | |
Circular FIFO queue for can_msg_t pointers.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Messages are allocated from CanBufferStore and pushed here for ordered processing. Uses one extra slot so head == tail always means empty.
|
extern |
Clears all FIFO slots and resets head and tail to zero.
Algorithm:
|
extern |
Pushes a can_msg_t pointer onto the tail of the FIFO.
| new_msg | Pointer to an allocated can_msg_t. |
Algorithm:
* @param new_msg Pointer to an allocated @ref can_msg_t. *
|
extern |
Removes and returns the oldest can_msg_t from the FIFO.
Caller is responsible for freeing the returned buffer with CanBufferStore_free_buffer() when processing is complete.
Algorithm:
|
extern |
Returns non-zero if the FIFO is empty, zero if messages are present.
|
extern |
Returns the number of can_msg_t pointers currently in the FIFO.
Handles the wraparound case where tail > head.
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License