RTEMS  5.0.0
freechain.h
Go to the documentation of this file.
1 
8 /*
9  * Copyright (c) 2013 Gedare Bloom.
10  *
11  * The license and distribution terms for this file may be
12  * found in the file LICENSE in this distribution or at
13  * http://www.rtems.org/license/LICENSE.
14  */
15 
16 #ifndef _RTEMS_SCORE_FREECHAIN_H
17 #define _RTEMS_SCORE_FREECHAIN_H
18 
19 #include <rtems/score/basedefs.h>
20 #include <rtems/score/chainimpl.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
41 typedef void *( *Freechain_Allocator )( size_t size );
42 
46 typedef struct {
52 
66  Freechain_Control *freechain,
67  void *initial_nodes,
68  size_t number_nodes,
69  size_t node_size
70 )
71 {
73  &freechain->Free,
74  initial_nodes,
75  number_nodes,
76  node_size
77  );
78 }
79 
93 void *_Freechain_Get(
94  Freechain_Control *freechain,
95  Freechain_Allocator allocator,
96  size_t number_nodes_to_extend,
97  size_t node_size
98 );
99 
107 void _Freechain_Put(
108  Freechain_Control *freechain,
109  void *node
110 );
111 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif
119 /* end of include file */
void _Chain_Initialize(Chain_Control *the_chain, void *starting_address, size_t number_nodes, size_t node_size)
Initialize a chain header.
Definition: chain.c:26
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
Definition: chain.h:83
void * _Freechain_Get(Freechain_Control *freechain, Freechain_Allocator allocator, size_t number_nodes_to_extend, size_t node_size)
Gets a node from the freechain.
Definition: freechain.c:24
RTEMS_INLINE_ROUTINE void _Freechain_Initialize(Freechain_Control *freechain, void *initial_nodes, size_t number_nodes, size_t node_size)
Initializes a freechain.
Definition: freechain.h:65
Chain_Control Free
Chain of free nodes.
Definition: freechain.h:50
void _Freechain_Put(Freechain_Control *freechain, void *node)
Puts a node back onto the freechain.
Definition: freechain.c:50
void *(* Freechain_Allocator)(size_t size)
Allocator function.
Definition: freechain.h:41
Chain Handler API.
Basic Definitions.
unsigned size
Definition: tte.h:74
The freechain control.
Definition: freechain.h:46