os/kernelhwsrv/kerneltest/e32test/buffer/t_tbma.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/buffer/t_tbma.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,81 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32test\buffer\t_tbma.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __T_TBMA_H__
    1.22 +#define __T_TBMA_H__
    1.23 +
    1.24 +#include <e32test.h>
    1.25 +#include <e32atomics.h>
    1.26 +
    1.27 +#define TBMA_FAULT()	TBmaFault(__LINE__)
    1.28 +#define __ALLOC(x)		User::Alloc(x)
    1.29 +
    1.30 +extern void TBmaFault(TInt aLine);
    1.31 +
    1.32 +extern RTest test;
    1.33 +
    1.34 +// Copied from klib.h
    1.35 +class TBitMapAllocator
    1.36 +	{
    1.37 +public:
    1.38 +	IMPORT_C static TBitMapAllocator* New(TInt aSize, TBool aState);
    1.39 +	IMPORT_C TBitMapAllocator(TInt aSize, TBool aState);
    1.40 +	inline TInt Avail() const {return iAvail;}
    1.41 +	IMPORT_C TInt Alloc();
    1.42 +	IMPORT_C void Free(TInt aPos);
    1.43 +	IMPORT_C void Alloc(TInt aStart, TInt aLength);
    1.44 +	IMPORT_C void Free(TInt aStart, TInt aLength);
    1.45 +	IMPORT_C void SelectiveFree(TInt aStart, TInt aLength);
    1.46 +	IMPORT_C TBool NotFree(TInt aStart, TInt aLength) const;
    1.47 +	IMPORT_C TBool NotAllocated(TInt aStart, TInt aLength) const;
    1.48 +	IMPORT_C TInt AllocList(TInt aLength, TInt* aList);
    1.49 +	IMPORT_C TInt AllocConsecutive(TInt aLength, TBool aBestFit) const;
    1.50 +	IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit) const;
    1.51 +	IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit, TInt& aCarry, TInt& aRunLength) const;
    1.52 +	IMPORT_C TInt AllocAligned(TInt aLength, TInt aAlign, TInt aBase, TBool aBestFit, TInt& aCarry, TInt& aRunLength, TUint aOffset) const;
    1.53 +	IMPORT_C void CopyAlignedRange(const TBitMapAllocator* aA, TInt aFirst, TInt aLen);
    1.54 +public:
    1.55 +	TInt iAvail;			/**< @internalComponent */
    1.56 +	TUint32* iCheckFirst;	/**< @internalComponent */
    1.57 +	TInt iSize;				/**< @internalComponent */
    1.58 +	TUint32 iMap[1];		/**< @internalComponent */	// extend
    1.59 +	};
    1.60 +
    1.61 +class TBmaList
    1.62 +	{
    1.63 +public:
    1.64 +	static TBmaList* New(TInt aNumBmas);
    1.65 +	static TBmaList* New(const TBitMapAllocator& aBma, TInt aNumSplits, VA_LIST aList);
    1.66 +	TBmaList();
    1.67 +	~TBmaList();
    1.68 +	TInt AllocConsecutiveFF(TInt aLength);
    1.69 +	TInt AllocConsecutiveBF(TInt aLength);
    1.70 +	TInt AllocAlignedFF(TInt aLength, TInt aAlign);
    1.71 +	TInt AllocAlignedBF(TInt aLength, TInt aAlign);
    1.72 +public:
    1.73 +	TInt iNumBmas;
    1.74 +	TBitMapAllocator** iBmaList;
    1.75 +	TInt* iBaseList;
    1.76 +	};
    1.77 +
    1.78 +struct SRange
    1.79 +	{
    1.80 +	TInt iBase;
    1.81 +	TInt iLength;
    1.82 +	};
    1.83 +
    1.84 +#endif