|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Pre-allocated message pool for OpenLCB buffer management. More...
Go to the source code of this file.
Functions | |
| void | OpenLcbBufferStore_initialize (void) |
| Initializes the buffer store. | |
| openlcb_msg_t * | OpenLcbBufferStore_allocate_buffer (payload_type_enum payload_type) |
| Allocates a buffer from the specified pool. | |
| void | OpenLcbBufferStore_free_buffer (openlcb_msg_t *msg) |
| Decrements the reference count; frees the buffer when it reaches zero. | |
| void | OpenLcbBufferStore_inc_reference_count (openlcb_msg_t *msg) |
| Increments the reference count on an allocated buffer. | |
| uint16_t | OpenLcbBufferStore_basic_messages_allocated (void) |
| Returns the number of BASIC messages currently allocated. | |
| uint16_t | OpenLcbBufferStore_basic_messages_max_allocated (void) |
| Returns the peak number of BASIC messages allocated simultaneously. | |
| uint16_t | OpenLcbBufferStore_datagram_messages_allocated (void) |
| Returns the number of DATAGRAM messages currently allocated. | |
| uint16_t | OpenLcbBufferStore_datagram_messages_max_allocated (void) |
| Returns the peak number of DATAGRAM messages allocated simultaneously. | |
| uint16_t | OpenLcbBufferStore_snip_messages_allocated (void) |
| Returns the number of SNIP messages currently allocated. | |
| uint16_t | OpenLcbBufferStore_snip_messages_max_allocated (void) |
| Returns the peak number of SNIP messages allocated simultaneously. | |
| uint16_t | OpenLcbBufferStore_stream_messages_allocated (void) |
| Returns the number of STREAM messages currently allocated. | |
| uint16_t | OpenLcbBufferStore_stream_messages_max_allocated (void) |
| Returns the peak number of STREAM messages allocated simultaneously. | |
| void | OpenLcbBufferStore_clear_max_allocated (void) |
| Resets all peak allocation counters to zero. | |
Pre-allocated message pool for OpenLCB buffer management.
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.
Provides fixed-size pools for BASIC, DATAGRAM, SNIP, and STREAM message types. All memory is allocated at startup; there is no dynamic allocation at runtime. Reference counting lets the same buffer be held by multiple queues simultaneously. Must be initialized before any other OpenLCB module.
|
extern |
Initializes the buffer store.
Clears all message structures, links payloads, and resets counters. Must be called once at startup before any allocation.
Algorithm:
|
extern |
Allocates a buffer from the specified pool.
| payload_type | payload_type_enum (BASIC, DATAGRAM, SNIP, or STREAM). |
Algorithm:
* @param payload_type Type of buffer requested (BASIC, DATAGRAM, SNIP, or STREAM) *
|
extern |
Decrements the reference count; frees the buffer when it reaches zero.
| msg | Pointer to the openlcb_msg_t to release (NULL is safe). |
Algorithm:
* @param msg Pointer to @ref openlcb_msg_t to release (NULL is safe) *
|
extern |
Increments the reference count on an allocated buffer.
| msg | Pointer to the openlcb_msg_t to share. |
|
extern |
Returns the number of BASIC messages currently allocated.
|
extern |
Returns the peak number of BASIC messages allocated simultaneously.
|
extern |
Returns the number of DATAGRAM messages currently allocated.
|
extern |
Returns the peak number of DATAGRAM messages allocated simultaneously.
|
extern |
Returns the number of SNIP messages currently allocated.
|
extern |
Returns the peak number of SNIP messages allocated simultaneously.
|
extern |
Returns the number of STREAM messages currently allocated.
|
extern |
Returns the peak number of STREAM messages allocated simultaneously.
|
extern |
Resets all peak allocation counters to zero.
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License