NetBurner 3.5.6
PDF Version |
Topics | |
Buffer Ownership States | |
Buffer State Flags | |
Classes | |
struct | pool_buffer |
Main buffer structure for network and serial communication. More... | |
class | buffer_list |
Doubly-linked list management for buffers. More... | |
class | fifo_buffer_storage |
FIFO buffer storage using linked pool buffers. More... | |
class | SMPoolPtr |
Smart pointer wrapper for automatic buffer management. More... | |
Functions | |
PoolPtr | GetBuffer () |
Allocate a software buffer for general use. | |
PoolPtr | GetFastBuffer () |
Allocate a software buffer, preferring the fast memory pool. | |
void | FreeBuffer (PoolPtr nbuf) |
Free a buffer and return it to the unused pool. | |
void | FreeBufferList (PoolPtr nbuf) |
Free a linked list of buffers. | |
void | IncUsageCount (PoolPtr pp) |
Increment the usage count of a buffer. | |
uint16_t | GetFreeCount () |
Returns the number of free buffers in the system. Buffers are used for both serial and network interfaces. | |
void | InitBuffers () |
Initialize the buffer system. | |
void | ShowBuffer (PoolPtr p) |
Display buffer contents and state information. | |
#include< buffers.h>
Functions associated with the buffers allocated for use by network interfaces and serial ports. If a system runs out of buffers it will no longer be able to send or receive network data.
void FreeBuffer | ( | PoolPtr | nbuf | ) |
#include <buffers.h>
Free a buffer and return it to the unused pool.
Decrements the buffer's usage count and returns it to the free pool when the count reaches zero. This allows safe sharing of buffers between multiple system components.
nbuf | Buffer to free |
void FreeBufferList | ( | PoolPtr | nbuf | ) |
#include <buffers.h>
Free a linked list of buffers.
Frees a chain of buffers linked by their pNextFifo_El pointers. Each buffer in the list will be returned to the unused pool.
nbuf | First buffer in the linked list to free |
PoolPtr GetBuffer | ( | ) |
#include <buffers.h>
Allocate a software buffer for general use.
Allocates a buffer from the system buffer pool for use by application software. The buffer will be marked with ownership state BO_SOFTWARE.
PoolPtr GetFastBuffer | ( | ) |
#include <buffers.h>
Allocate a software buffer, preferring the fast memory pool.
Similar to GetBuffer(), but attempts to allocate from the fast buffer pool first before falling back to the standard pool. Fast buffers may provide better performance for time-critical operations.
uint16_t GetFreeCount | ( | ) |
#include <buffers.h>
Returns the number of free buffers in the system. Buffers are used for both serial and network interfaces.
This function returns the number of free pool buffers, which are used for network and serial communication. The maximum number of buffers is defined in \nburn\nbrtos\include\constants.h
:
The size of each buffer is defined as:
If the number of free buffers reaches zero, then no further network communication will be possible until some buffers are freed. This is a good function to use as a debug tool for detecting buffer leaks in your application.
Serial ports also use buffers, which are allocated in constants.h:
Each serial port buffer is equal in size to an Ethernet buffer.
void IncUsageCount | ( | PoolPtr | pp | ) |
#include <buffers.h>
Increment the usage count of a buffer.
Increases the reference count for shared buffer usage. The buffer will not be freed until FreeBuffer() is called once for each reference (usage count reaches zero).
pp | Buffer to increment usage count |
void InitBuffers | ( | ) |
#include <buffers.h>
Initialize the buffer system.
Sets up the buffer pools and free lists. This function is called during system initialization and should not be called by application code.
void ShowBuffer | ( | PoolPtr | p | ) |
#include <buffers.h>
Display buffer contents and state information.
Prints detailed information about a buffer including its state, size, and data contents to stdout. Useful for debugging.
p | Buffer to display |