|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Pre-allocated pool of can_msg_t buffers (8-byte payload each). More...
Go to the source code of this file.
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. | |
Pre-allocated pool of can_msg_t buffers (8-byte payload each).
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.
Pool size is set at compile time via USER_DEFINED_CAN_MSG_BUFFER_DEPTH. All memory is allocated at startup - no dynamic allocation at runtime. Telemetry counters support pool-size tuning during development.
|
extern |
Clears all buffers and resets telemetry counters.
Algorithm:
|
extern |
Allocates one can_msg_t buffer from the pool.
Finds the first free slot, clears it, marks it allocated, and updates the peak telemetry counter.
Algorithm:
|
extern |
Returns a can_msg_t buffer to the pool.
| msg | Pointer to the buffer to free. NULL is safely ignored. |
Algorithm:
* @param msg Pointer to the buffer to free. NULL is safely ignored. *
|
extern |
Returns the number of can_msg_t buffers currently allocated.
|
extern |
Returns the peak allocation count since last reset.
|
extern |
Resets the peak counter without affecting current allocations.
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License