brdbootldr/ubootldr/inc/unzip.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1998-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 // bootldr\inc\unzip.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __UNZIP_H__
       
    19 #define __UNZIP_H__
       
    20 #include <e32cmn.h>
       
    21 #include <f32file.h>
       
    22 
       
    23 #ifdef __KERNEL_MODE__
       
    24 #define	MALLOC(x)				Kern::Alloc(x)
       
    25 #define	FREE(x)					Kern::Free(x)
       
    26 #define WAIT_FOR_ANY_REQUEST()	Kern::WaitForAnyRequest()
       
    27 #else
       
    28 #include <e32std.h>
       
    29 #define	MALLOC(x)				User::Alloc(x)
       
    30 #define	FREE(x)					User::Free(x)
       
    31 #define WAIT_FOR_ANY_REQUEST()	User::WaitForAnyRequest()
       
    32 #define	WAIT_FOR_REQUEST(x)		User::WaitForRequest(x)
       
    33 #define DELAY(x)				User::After(x)
       
    34 #endif
       
    35 
       
    36 const TInt KZipLocalHeaderLen=30;
       
    37 const TInt KZipExtHeaderLen=16;
       
    38 const TUint KZipSignature=0x04034b50u;
       
    39 const TInt KZipWindowSize=0x8000;
       
    40 
       
    41 class TZipInfo
       
    42 	{
       
    43 public:
       
    44 	TInt iFlags;
       
    45 	TInt iMethod;
       
    46 	TUint iCrc;
       
    47 	TInt iCompressedSize;
       
    48 	TInt iUncompressedSize;
       
    49 	TInt iFileNameLength;
       
    50 	TInt iExtraLength;
       
    51 	TInt iNameOffset;
       
    52 	TInt iDataOffset;
       
    53 	TBuf<128> iName;
       
    54 	TUint iInBufSize;				// must be a power of 2
       
    55 	volatile TUint iFileBufW;
       
    56 	volatile TUint iFileBufR;
       
    57 	TUint iFileBufSize;				// must be a power of 2 and a multiple of iInBufSize
       
    58 	TUint8* iFileBuf;
       
    59 	TRequestStatus iProcessedHeader;
       
    60 	volatile TInt iHeaderDone;
       
    61 	TUint8* iOutBuf;
       
    62 	TInt iRemain;
       
    63 	TInt iThreadHandle;
       
    64 	TRequestStatus iThreadStatus;
       
    65 	};
       
    66 
       
    67 GLREF_C void AcceptUnzippedBlock(TZipInfo& aInfo, TUint8*& aOutPtr, TInt aError);
       
    68 GLREF_C TInt InitInfo(TZipInfo& a);
       
    69 GLREF_C TInt UnzipThread(TAny* aInfo);
       
    70 GLREF_C TInt ReadBlockToBuffer(TZipInfo& a, RFile &aBootFile);
       
    71 GLREF_C TInt ReadInputData(TUint8* aDest, TInt& aLength);
       
    72 GLREF_C TInt UnzipComplete(TZipInfo& a, TUint8* aOutPtr, TInt aError);
       
    73 #endif