diff -r 000000000000 -r a41df078684a brdbootldr/ubootldr/inflate2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/brdbootldr/ubootldr/inflate2.h Mon Oct 19 15:55:17 2009 +0100 @@ -0,0 +1,171 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// base\omap_hrp\h4_bootloader\inflate2.h +// +// + + +#include + +#ifndef __INFLATE2_H__ +#define __INFLATE2_H__ + +#define __CONFIGURABLE_F32_LOADER_INFLATE_WINDOW_SIZE__ 0x8000 + +// inflate +const TInt KInflateWindowSize=__CONFIGURABLE_F32_LOADER_INFLATE_WINDOW_SIZE__ ; + + +typedef struct + { + TUint iPhysicalSector; + TUint iSemiPhysicalSector; + } TNandReadInfo; + +//for asm mem copy +//#define __JUMP(cc,r) asm("mov"#cc " pc, "#r ) +//#define __POPRET(rlist) asm("ldmfd sp!, {"##rlist##"pc} ") + +void memcpy1(TAny*, const TAny*, TUint); +void memset1(void *, int, unsigned); +TInt memcmp1(const TUint8* aTrg, const TUint8* aSrc, TInt aLength); + +void leds(TUint32); +extern "C" void memdump(TUint32* aAddr, TUint32* aEnd); + +#ifdef __cplusplus +extern "C" { +#endif +extern void countout(void); +extern void charout(TUint8 aChar); + +extern void WriteW(TUint32); +extern void WriteB(TUint8); +extern void mmuoff(void); +#ifdef __cplusplus +} +#endif + + + +/** Bit input stream. Good for reading bit streams for packed, compressed or huffman + data algorithms. +*/ +class TBitInput + { +public: + TBitInput(); + TBitInput(const TUint8* aPtr, TInt aLength, TInt aOffset=0); + void Set(const TUint8* aPtr, TInt aLength, TInt aOffset=0); +// + TUint ReadL(); + TUint ReadL(TInt aSize); + TUint HuffmanL(const TUint32* aTree); +private: + virtual void UnderflowL(); +private: + TInt iCount; + TUint iBits; + TInt iRemain; + const TUint32* volatile iPtr; + }; + +const TInt KHuffTerminate=0x0001; +const TUint32 KBranch1=sizeof(TUint32)<<16; + + +/** Huffman code toolkit. + + This class builds a huffman encoding from a frequency table and builds + a decoding tree from a code-lengths table + + The encoding generated is based on the rule that given two symbols s1 and s2, with + code length l1 and l2, and huffman codes h1 and h2: + + if l1