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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [services/] [memalloc/] [common/] [v2_0/] [include/] [common.hxx] - Blame information for rev 232

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

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_MEMALLOC_COMMON_HXX
2
#define CYGONCE_MEMALLOC_COMMON_HXX
3
 
4
/*==========================================================================
5
//
6
//      common.hxx
7
//
8
//      Shared definitions used by memory allocators
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 Red Hat, 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 version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License along
26
// with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
//
29
// As a special exception, if other files instantiate templates or use macros
30
// or inline functions from this file, or you compile this file and link it
31
// with other works to produce a work based on this file, this file does not
32
// by itself cause the resulting work to be covered by the GNU General Public
33
// License. However the source code for this file must still be made available
34
// in accordance with section (3) of the GNU General Public License.
35
//
36
// This exception does not invalidate any other reasons why a work based on
37
// this file might be covered by the GNU General Public License.
38
//
39
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
// at http://sources.redhat.com/ecos/ecos-license/
41
// -------------------------------------------
42
//####ECOSGPLCOPYRIGHTEND####
43
//==========================================================================
44
//#####DESCRIPTIONBEGIN####
45
//
46
// Author(s):    jlarmour
47
// Contributors:
48
// Date:         2000-06-12
49
// Purpose:      Shared definitions used by memory allocators
50
// Description:
51
// Usage:        #include 
52
//
53
//
54
//####DESCRIPTIONEND####
55
//
56
//========================================================================*/
57
 
58
/* CONFIGURATION */
59
 
60
#include 
61
 
62
/* TYPE DEFINITIONS */
63
 
64
// struct Cyg_Mempool_Status is returned by the get_status() method of
65
// standard eCos memory allocators. After return from get_status(), any
66
// field of type T may be set to ((T)-1) to indicate that the information
67
// is not available or not applicable to this allocator.
68
 
69
 
70
class Cyg_Mempool_Status {
71
public:
72
    const cyg_uint8 *arenabase; // base address of entire pool
73
    cyg_int32   arenasize;      // total size of entire pool
74
    cyg_int32   freeblocks;     // number of chunks free for use
75
    cyg_int32   totalallocated; // total allocated space in bytes
76
    cyg_int32   totalfree;      // total space in bytes not in use
77
    cyg_int32   blocksize;      // block size if fixed block
78
    cyg_int32   maxfree;        // size of largest unused block
79
    cyg_int8    waiting;        // are there any threads waiting for memory?
80
    const cyg_uint8 *origbase;  // address of original region used when pool
81
                                // created
82
    cyg_int32   origsize;       // size of original region used when pool
83
                                // created
84
 
85
    // maxoverhead is the *maximum* per-allocation overhead imposed by
86
    // the allocator implementation. Note: this is rarely the typical
87
    // overhead which often depends on the size of the allocation requested.
88
    // It includes overhead due to alignment constraints. For example, if
89
    // maxfree and maxoverhead are available for this allocator, then an
90
    // allocation request of (maxfree-maxoverhead) bytes must always succeed
91
    // Unless maxoverhead is set to -1 of course, in which case the allocator
92
    // does not support reporting this information.
93
 
94
    cyg_int8    maxoverhead;
95
 
96
    void
97
    init() {
98
        arenabase       = (const cyg_uint8 *)-1;
99
        arenasize       = -1;
100
        freeblocks      = -1;
101
        totalallocated  = -1;
102
        totalfree       = -1;
103
        blocksize       = -1;
104
        maxfree         = -1;
105
        waiting         = -1;
106
        origbase        = (const cyg_uint8 *)-1;
107
        origsize        = -1;
108
        maxoverhead     = -1;
109
    }
110
 
111
    // constructor
112
    Cyg_Mempool_Status() { init(); }
113
};
114
 
115
// Flags to pass to get_status() methods to tell it which stat(s) is/are
116
// being requested
117
 
118
#define CYG_MEMPOOL_STAT_ARENABASE       (1<<0)
119
#define CYG_MEMPOOL_STAT_ARENASIZE       (1<<1)
120
#define CYG_MEMPOOL_STAT_FREEBLOCKS      (1<<2)
121
#define CYG_MEMPOOL_STAT_TOTALALLOCATED  (1<<3)
122
#define CYG_MEMPOOL_STAT_TOTALFREE       (1<<4)
123
#define CYG_MEMPOOL_STAT_BLOCKSIZE       (1<<5)
124
#define CYG_MEMPOOL_STAT_MAXFREE         (1<<6)
125
#define CYG_MEMPOOL_STAT_WAITING         (1<<7)
126
#define CYG_MEMPOOL_STAT_ORIGBASE        (1<<9)
127
#define CYG_MEMPOOL_STAT_ORIGSIZE        (1<<10)
128
#define CYG_MEMPOOL_STAT_MAXOVERHEAD     (1<<11)
129
 
130
// And an opaque type for any arguments with these flags
131
typedef cyg_uint16 cyg_mempool_status_flag_t;
132
 
133
 
134
#endif /* ifndef CYGONCE_MEMALLOC_COMMON_HXX */
135
/* EOF common.hxx */

powered by: WebSVN 2.1.0

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