OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [services/] [memalloc/] [common/] [current/] [include/] [mfiximpl.hxx] - Blame information for rev 819

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#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
// ####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later
19
// version.
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
29
//
30
// As a special exception, if other files instantiate templates or use
31
// macros or inline functions from this file, or you compile this file
32
// and link it with other works to produce a work based on this file,
33
// this file does not by itself cause the resulting work to be covered by
34
// the GNU General Public License. However the source code for this file
35
// must still be made available in accordance with section (3) of the GNU
36
// General Public License v2.
37
//
38
// This exception does not invalidate any other reasons why a work based
39
// on this file might be covered by the GNU General Public License.
40
// -------------------------------------------
41
// ####ECOSGPLCOPYRIGHTEND####
42
//==========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):    hmt
46
// Contributors: jlarmour
47
// Date:         2000-06-12
48
// Purpose:      Define Mfiximpl class interface
49
// Description:  Inline class for constructing a fixed block allocator
50
// Usage:        #include 
51
//
52
//
53
//####DESCRIPTIONEND####
54
//
55
//==========================================================================
56
 
57
#include 
58
#include      // Common memory allocator infra
59
 
60
class Cyg_Mempool_Fixed_Implementation {
61
protected:
62
    // these constructors are explicitly disallowed
63
    Cyg_Mempool_Fixed_Implementation() {};
64
//    Cyg_Mempool_Fixed_Implementation( Cyg_Mempool_Fixed_Implementation &ref )
65
//    {};
66
    Cyg_Mempool_Fixed_Implementation &
67
    operator=( Cyg_Mempool_Fixed_Implementation &ref )
68
    { return ref; };
69
 
70
    cyg_uint32 *bitmap;
71
    cyg_int32 maptop;
72
    cyg_uint8  *mempool;
73
    cyg_int32 numblocks;
74
    cyg_int32 freeblocks;
75
    cyg_int32 blocksize;
76
    cyg_int32 firstfree;
77
    cyg_uint8  *top;
78
 
79
public:
80
    // THIS is the public API of memory pools generally that can have the
81
    // kernel oriented thread-safe package layer atop.
82
    //
83
    // The kernel package is a template whose type parameter is one of
84
    // these.  That is the reason there are superfluous parameters here and
85
    // more genereralization than might be expected in a fixed block
86
    // allocator.
87
 
88
    // Constructor: gives the base and size of the arena in which memory is
89
    // to be carved out, note that management structures are taken from the
90
    // same arena.  The alloc_unit may be any other param in general; it
91
    // comes through from the outer constructor unchanged.
92
    Cyg_Mempool_Fixed_Implementation(
93
        cyg_uint8 *base,
94
        cyg_int32 size,
95
        CYG_ADDRWORD alloc_unit );
96
 
97
    // Destructor
98
    ~Cyg_Mempool_Fixed_Implementation();
99
 
100
    // get some memory; size is ignored in a fixed block allocator
101
    cyg_uint8 *try_alloc( cyg_int32 size );
102
 
103
    // supposedly resize existing allocation. This is defined in the
104
    // fixed block allocator purely for API consistency. It will return
105
    // an error (false) for all values, except for the blocksize
106
    // returns true on success
107
    cyg_uint8 *
108
    resize_alloc( cyg_uint8 *alloc_ptr, cyg_int32 newsize,
109
                  cyg_int32 *oldsize=NULL );
110
 
111
    // free the memory back to the pool; size ignored here
112
    cyg_bool free( cyg_uint8 *p, cyg_int32 size );
113
 
114
    // Get memory pool status
115
    // flags is a bitmask of requested fields to fill in. The flags are
116
    // defined in common.hxx
117
    void get_status( cyg_mempool_status_flag_t /* flags */,
118
                     Cyg_Mempool_Status & /* status */ );
119
 
120
};
121
 
122
#include 
123
 
124
// -------------------------------------------------------------------------
125
#endif // ifndef CYGONCE_MEMALLOC_MFIXIMPL_HXX
126
// EOF mfiximpl.hxx

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.