5
Last change
on this file since 6b0a729b was
21275b58,
checked in by Sebastian Huber <sebastian.huber@…>, on 11/22/18 at 18:14:51
|
score: Static Objects_Information initialization
Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>. Provide default object
informations with zero objects via librtemscpu.a. This greatly
simplifies the workspace size estimate. RTEMS applications which do not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.
Close #3621.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ScoreFreechain |
---|
5 | * |
---|
6 | * @brief Freechain Handler Implementation |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2013 Gedare Bloom. |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/score/freechain.h> |
---|
22 | #include <rtems/score/assert.h> |
---|
23 | |
---|
24 | void *_Freechain_Get( |
---|
25 | Freechain_Control *freechain, |
---|
26 | Freechain_Allocator allocator, |
---|
27 | size_t number_nodes_to_extend, |
---|
28 | size_t node_size |
---|
29 | ) |
---|
30 | { |
---|
31 | _Assert( node_size >= sizeof( Chain_Node ) ); |
---|
32 | |
---|
33 | if ( _Chain_Is_empty( &freechain->Free ) && number_nodes_to_extend > 0 ) { |
---|
34 | void *starting_address; |
---|
35 | |
---|
36 | starting_address = ( *allocator )( number_nodes_to_extend * node_size ); |
---|
37 | number_nodes_to_extend *= ( starting_address != NULL ); |
---|
38 | |
---|
39 | _Chain_Initialize( |
---|
40 | &freechain->Free, |
---|
41 | starting_address, |
---|
42 | number_nodes_to_extend, |
---|
43 | node_size |
---|
44 | ); |
---|
45 | } |
---|
46 | |
---|
47 | return _Chain_Get_unprotected( &freechain->Free ); |
---|
48 | } |
---|
49 | |
---|
50 | void _Freechain_Put( Freechain_Control *freechain, void *node ) |
---|
51 | { |
---|
52 | if ( node != NULL ) { |
---|
53 | _Chain_Initialize_node( node ); |
---|
54 | _Chain_Prepend_unprotected( &freechain->Free, node ); |
---|
55 | } |
---|
56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.