|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Implementation of the pre-allocated CAN message buffer pool. More...
Functions | |
| void | CanBufferStore_initialize (void) |
| Clears all buffers and resets telemetry counters. | |
| can_msg_t * | CanBufferStore_allocate_buffer (void) |
| Allocates one can_msg_t buffer from the pool. | |
| void | CanBufferStore_free_buffer (can_msg_t *msg) |
| Returns a can_msg_t buffer to the pool. | |
| uint16_t | CanBufferStore_messages_allocated (void) |
| Returns the number of can_msg_t buffers currently allocated. | |
| uint16_t | CanBufferStore_messages_max_allocated (void) |
| Returns the peak allocation count since last reset. | |
| void | CanBufferStore_clear_max_allocated (void) |
| Resets the peak counter without affecting current allocations. | |
Implementation of the pre-allocated CAN message buffer pool.
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.
Single static array of can_msg_t buffers with first-fit allocation. Allocation and free operations toggle a per-slot flag and maintain running and peak counters for pool-size tuning. NOT thread-safe.
| void CanBufferStore_initialize | ( | void | ) |
Clears all buffers and resets telemetry counters.
Algorithm:
| can_msg_t * CanBufferStore_allocate_buffer | ( | void | ) |
Allocates one can_msg_t buffer from the pool.
Algorithm:
| void CanBufferStore_free_buffer | ( | can_msg_t * | msg | ) |
Returns a can_msg_t buffer to the pool.
Algorithm:
* @param msg Pointer to the buffer to free. NULL is safely ignored. *
| uint16_t CanBufferStore_messages_allocated | ( | void | ) |
Returns the number of can_msg_t buffers currently allocated.
| uint16_t CanBufferStore_messages_max_allocated | ( | void | ) |
Returns the peak allocation count since last reset.
| void CanBufferStore_clear_max_allocated | ( | void | ) |
Resets the peak counter without affecting current allocations.
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License