comparison packages/services/memalloc/common/current/include/mfiximpl.hxx @ 115:6ed91473a1cd ecos-sw-2000-08-21

Merge from eCos master repository on 2000-08-21-22:40:54-BST
author jlarmour
date Fri, 25 Aug 2000 17:32:38 +0000
parents
children e0c0827131d1
comparison
equal deleted inserted replaced
114:5ad2b71d525e 115:6ed91473a1cd
1 #ifndef CYGONCE_MEMALLOC_MFIXIMPL_HXX
2 #define CYGONCE_MEMALLOC_MFIXIMPL_HXX
3
4 //==========================================================================
5 //
6 // mfiximpl.hxx
7 //
8 // Memory pool with fixed block class declarations
9 //
10 //==========================================================================
11 //####COPYRIGHTBEGIN####
12 //
13 // -------------------------------------------
14 // The contents of this file are subject to the Red Hat eCos Public License
15 // Version 1.1 (the "License"); you may not use this file except in
16 // compliance with the License. You may obtain a copy of the License at
17 // http://www.redhat.com/
18 //
19 // Software distributed under the License is distributed on an "AS IS"
20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
21 // License for the specific language governing rights and limitations under
22 // the License.
23 //
24 // The Original Code is eCos - Embedded Configurable Operating System,
25 // released September 30, 1998.
26 //
27 // The Initial Developer of the Original Code is Red Hat.
28 // Portions created by Red Hat are
29 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
30 // All Rights Reserved.
31 // -------------------------------------------
32 //
33 //####COPYRIGHTEND####
34 //==========================================================================
35 //#####DESCRIPTIONBEGIN####
36 //
37 // Author(s): hmt
38 // Contributors: jlarmour
39 // Date: 2000-06-12
40 // Purpose: Define Mfiximpl class interface
41 // Description: Inline class for constructing a fixed block allocator
42 // Usage: #include <cyg/memalloc/mfiximpl.hxx>
43 //
44 //
45 //####DESCRIPTIONEND####
46 //
47 //==========================================================================
48
49 #include <cyg/infra/cyg_type.h>
50 #include <cyg/memalloc/common.hxx> // Common memory allocator infra
51
52 class Cyg_Mempool_Fixed_Implementation {
53 protected:
54 // these constructors are explicitly disallowed
55 Cyg_Mempool_Fixed_Implementation() {};
56 // Cyg_Mempool_Fixed_Implementation( Cyg_Mempool_Fixed_Implementation &ref )
57 // {};
58 Cyg_Mempool_Fixed_Implementation &
59 operator=( Cyg_Mempool_Fixed_Implementation &ref )
60 { return ref; };
61
62 cyg_uint32 *bitmap;
63 cyg_int32 maptop;
64 cyg_uint8 *mempool;
65 cyg_int32 numblocks;
66 cyg_int32 freeblocks;
67 cyg_int32 blocksize;
68 cyg_int32 firstfree;
69 cyg_uint8 *top;
70
71 public:
72 // THIS is the public API of memory pools generally that can have the
73 // kernel oriented thread-safe package layer atop.
74 //
75 // The kernel package is a template whose type parameter is one of
76 // these. That is the reason there are superfluous parameters here and
77 // more genereralization than might be expected in a fixed block
78 // allocator.
79
80 // Constructor: gives the base and size of the arena in which memory is
81 // to be carved out, note that management structures are taken from the
82 // same arena. The alloc_unit may be any other param in general; it
83 // comes through from the outer constructor unchanged.
84 Cyg_Mempool_Fixed_Implementation(
85 cyg_uint8 *base,
86 cyg_int32 size,
87 CYG_ADDRWORD alloc_unit );
88
89 // Destructor
90 ~Cyg_Mempool_Fixed_Implementation();
91
92 // get some memory; size is ignored in a fixed block allocator
93 cyg_uint8 *try_alloc( cyg_int32 size );
94
95 // supposedly resize existing allocation. This is defined in the
96 // fixed block allocator purely for API consistency. It will return
97 // an error (false) for all values, except for the blocksize
98 // returns true on success
99 cyg_uint8 *
100 resize_alloc( cyg_uint8 *alloc_ptr, cyg_int32 newsize,
101 cyg_int32 *oldsize=NULL );
102
103 // free the memory back to the pool; size ignored here
104 cyg_bool free( cyg_uint8 *p, cyg_int32 size );
105
106 // Get memory pool status
107 // flags is a bitmask of requested fields to fill in. The flags are
108 // defined in common.hxx
109 void get_status( cyg_mempool_status_flag_t /* flags */,
110 Cyg_Mempool_Status & /* status */ );
111
112 };
113
114 #include <cyg/memalloc/mfiximpl.inl>
115
116 // -------------------------------------------------------------------------
117 #endif // ifndef CYGONCE_MEMALLOC_MFIXIMPL_HXX
118 // EOF mfiximpl.hxx