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);
|
|
42 |
IMPORT_C void SelectiveFree(TInt aStart, TInt aLength);
|
|
43 |
IMPORT_C TBool NotFree(TInt aStart, TInt aLength) const;
|
|
44 |
IMPORT_C TBool NotAllocated(TInt aStart, TInt aLength) const;
|
|
45 |
IMPORT_C TInt AllocList(TInt aLength, TInt* aList);
|
|
46 |
IMPORT_C TInt AllocConsecutive(TInt aLength, TBool aBestFit) const;
|
|
47 |
IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit) const;
|
|
48 |
IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit, TInt& aCarry, TInt& aRunLength) const;
|
|
49 |
IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit, TInt& aCarry, TInt& aRunLength, TUint aOffset) const;
|
|
50 |
IMPORT_C void CopyAlignedRange(const TBitMapAllocator* aA, TInt aFirst, TInt aLen);
|
|
51 |
public:
|
|
52 |
TInt iAvail; /**< @internalComponent */
|
|
53 |
TUint32* iCheckFirst; /**< @internalComponent */
|
|
54 |
TInt iSize; /**< @internalComponent */
|
|
55 |
TUint32 iMap[1]; /**< @internalComponent */ // extend
|
|
56 |
};
|
|
57 |
|
|
58 |
class TBmaList
|
|
59 |
{
|
|
60 |
public:
|
|
61 |
static TBmaList* New(TInt aNumBmas);
|
|
62 |
static TBmaList* New(const TBitMapAllocator& aBma, TInt aNumSplits, VA_LIST aList);
|
|
63 |
TBmaList();
|
|
64 |
~TBmaList();
|
|
65 |
TInt AllocConsecutiveFF(TInt aLength);
|
|
66 |
TInt AllocConsecutiveBF(TInt aLength);
|
|
67 |
TInt AllocAlignedFF(TInt aLength, TInt aAlign);
|
|
68 |
TInt AllocAlignedBF(TInt aLength, TInt aAlign);
|
|
69 |
public:
|
|
70 |
TInt iNumBmas;
|
|
71 |
TBitMapAllocator** iBmaList;
|
|
72 |
TInt* iBaseList;
|
|
73 |
};
|
|
74 |
|
|
75 |
struct SRange
|
|
76 |
{
|
|
77 |
TInt iBase;
|
|
78 |
TInt iLength;
|
|
79 |
};
|
|
80 |
|
|
81 |
#endif
|