author | Mike Kinghan <mikek@symbian.org> |
Thu, 25 Nov 2010 14:35:45 +0000 | |
branch | GCC_SURGE |
changeset 305 | 1ba12ef4ef89 |
parent 152 | 657f875b013e |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32test\buffer\t_tbma.h |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#ifndef __T_TBMA_H__ |
|
19 |
#define __T_TBMA_H__ |
|
20 |
||
21 |
#include <e32test.h> |
|
22 |
#include <e32atomics.h> |
|
23 |
||
24 |
#define TBMA_FAULT() TBmaFault(__LINE__) |
|
25 |
#define __ALLOC(x) User::Alloc(x) |
|
26 |
||
27 |
extern void TBmaFault(TInt aLine); |
|
28 |
||
29 |
extern RTest test; |
|
30 |
||
31 |
// Copied from klib.h |
|
32 |
class TBitMapAllocator |
|
33 |
{ |
|
34 |
public: |
|
35 |
IMPORT_C static TBitMapAllocator* New(TInt aSize, TBool aState); |
|
36 |
IMPORT_C TBitMapAllocator(TInt aSize, TBool aState); |
|
37 |
inline TInt Avail() const {return iAvail;} |
|
38 |
IMPORT_C TInt Alloc(); |
|
39 |
IMPORT_C void Free(TInt aPos); |
|
40 |
IMPORT_C void Alloc(TInt aStart, TInt aLength); |
|
41 |
IMPORT_C void Free(TInt aStart, TInt aLength); |
|
152
657f875b013e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
42 |
IMPORT_C TUint SelectiveAlloc(TInt aStart, TInt aLength); |
0 | 43 |
IMPORT_C void SelectiveFree(TInt aStart, TInt aLength); |
44 |
IMPORT_C TBool NotFree(TInt aStart, TInt aLength) const; |
|
45 |
IMPORT_C TBool NotAllocated(TInt aStart, TInt aLength) const; |
|
46 |
IMPORT_C TInt AllocList(TInt aLength, TInt* aList); |
|
47 |
IMPORT_C TInt AllocConsecutive(TInt aLength, TBool aBestFit) const; |
|
48 |
IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit) const; |
|
49 |
IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit, TInt& aCarry, TInt& aRunLength) const; |
|
50 |
IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit, TInt& aCarry, TInt& aRunLength, TUint aOffset) const; |
|
51 |
IMPORT_C void CopyAlignedRange(const TBitMapAllocator* aA, TInt aFirst, TInt aLen); |
|
52 |
public: |
|
53 |
TInt iAvail; /**< @internalComponent */ |
|
54 |
TUint32* iCheckFirst; /**< @internalComponent */ |
|
55 |
TInt iSize; /**< @internalComponent */ |
|
56 |
TUint32 iMap[1]; /**< @internalComponent */ // extend |
|
57 |
}; |
|
58 |
||
59 |
class TBmaList |
|
60 |
{ |
|
61 |
public: |
|
62 |
static TBmaList* New(TInt aNumBmas); |
|
63 |
static TBmaList* New(const TBitMapAllocator& aBma, TInt aNumSplits, VA_LIST aList); |
|
64 |
TBmaList(); |
|
65 |
~TBmaList(); |
|
66 |
TInt AllocConsecutiveFF(TInt aLength); |
|
67 |
TInt AllocConsecutiveBF(TInt aLength); |
|
68 |
TInt AllocAlignedFF(TInt aLength, TInt aAlign); |
|
69 |
TInt AllocAlignedBF(TInt aLength, TInt aAlign); |
|
70 |
public: |
|
71 |
TInt iNumBmas; |
|
72 |
TBitMapAllocator** iBmaList; |
|
73 |
TInt* iBaseList; |
|
74 |
}; |
|
75 |
||
76 |
struct SRange |
|
77 |
{ |
|
78 |
TInt iBase; |
|
79 |
TInt iLength; |
|
80 |
}; |
|
81 |
||
82 |
#endif |