#include "BBC/LLI_type.h"
Defines | |
| #define | FPA_K_WTO_NO_WAIT (0) |
| Timeout = 0, ie do not wait. | |
| #define | FPA_K_WTO_FOREVER (-1) |
| Wait forever. | |
Typedefs | |
| typedef enum _FPA_type | FPA_type |
| Typedef of the enumeration _FPA_type. | |
| typedef void(* | FPA_cb_init )(void *parameter, void *packet, int packet_size, int pcb_offset) |
| Initialization Call back signature. More... | |
| typedef _FPA_fcb | FPA_fcb |
| Typedef for struct _FPA_fcb. | |
| typedef _FPA_pcb | FPA_pcb |
| Typedef for struct _FPA_pcb. | |
Enumerations | |
| enum | _FPA_type { FPA_K_TYPE_NON_BLOCKING = LLI_K_TYPE_NON_BLOCKING, FPA_K_TYPE_FIFO_BLOCKING = LLI_K_TYPE_FIFO_BLOCKING, FPA_K_TYPE_PRIORITY_BLOCKING = LLI_K_TYPE_PRIORITY_BLOCKING } |
| The type of blocking to use when an allocation is attempted on an empty pool. More... | |
Functions | |
| int | FPA_fcb_sizeof (void) |
| Returns the size of the Fixed Packet Allocator control block. More... | |
| int | FPA_pcb_sizeof (void) |
| Returns the size of the Packet control block. More... | |
| int | FPA_init (FPA_fcb *fcb, char *buffer, int buf_size, int packet_size, int pcb_offset, FPA_type blocking, FPA_cb_init init_routine, void *init_parameter) |
| Configures a user supplied piece of memory as a collection of fixed size packets which can be allocated and deallocated. More... | |
| void * | FPA_get (FPA_fcb *fcb) |
| Get or allocate a packet from the free list. More... | |
| void * | FPA_getW (FPA_fcb *fcb, int timeout) |
| Get or allocate a packet from the free list with a blocking. More... | |
| int | FPA_free (FPA_fcb *fcb, void *packet) |
| Returns a previously allocated packet to the free list. More... | |
| int | FPA_destroy (FPA_fcb *fcb) |
| Releases any resources gathered at initialization time. More... | |
|
|
Initialization Call back signature.
The initialization callback signature is
void (*initialize)(void *usr_parameter,
void *packet,
int packet_size,
int pcb_offset)
where
usr_parameter: A user parameter passed transparently to the callback
packet: The packet to initialize
packet_size: The size of the packet
pcb_offset: Offset, in bytes to the Packet Control Block
|
|
|
The type of blocking to use when an allocation is attempted on an empty pool.
This determines how the FPA_getW() call will behave when an allocation is attempted on an empty pool. One can specify non-blocking or two types of blocking, either blocking in FIFO order or PRIORITY order. If a non- blocking type is requested, common practice would be to use the simpler FPA_get() routine, since it never waits. |
|
|
Releases any resources gathered at initialization time.
|
|
|
Returns the size of the Fixed Packet Allocator control block.
This call is for modularity reasons. The user can learn the size of memory needed by the FPA utility to manage a pool of packets without needing to know the details of how it is layed out. This could have also been achieved by having the FPA initialization routine allocate the control block, but this takes away the freedom of the user to control his own allocation and deallocation |
|
||||||||||||
|
Returns a previously allocated packet to the free list.
|
|
|
Get or allocate a packet from the free list.
|
|
||||||||||||
|
Get or allocate a packet from the free list with a blocking.
|
|
||||||||||||||||||||||||||||||||||||
|
Configures a user supplied piece of memory as a collection of fixed size packets which can be allocated and deallocated.
Various options allow the user to place where the control structure lives within the packet and determine the blocking style. The must usual choice for the placement of the packet control structure is at the beginning pcb_offset = 0, or at the end pcb_offset = -1, although the user is allowed to specify any offset, provided it is within the packet. The usual blocking style is FPA_K_TYPE_FIFO_BLOCKING.
|
|
|
Returns the size of the Packet control block.
|
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001