Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // bootldr\inc\ymodem.h
21 #ifndef __KERNEL_MODE__
25 //#include <kernel/kernel.h>
29 const TUint8 SOH=0x01;
30 const TUint8 STX=0x02;
31 const TUint8 EOT=0x04;
32 const TUint8 ACK=0x06;
33 const TUint8 NAK=0x15;
34 const TUint8 CAN=0x18;
35 const TUint8 SUB=0x1A;
36 const TUint8 BIGC=0x43;
37 const TUint8 BIGG=0x47;
39 const TInt KErrZeroLengthPacket=-200;
40 const TInt KErrPacketTooShort=-201;
41 const TInt KErrBadPacketType=-202;
42 const TInt KErrCorruptSequenceNumber=-203;
43 const TInt KErrWrongSequenceNumber=-204;
44 const TInt KErrBadCrc=-205;
45 const TInt KErrBadTerminationPacket=-206;
47 const TInt KHeaderBufferSize=1024;
49 class YModem : public BASE
52 TInt StartDownload(TBool aG, TInt& aLength, TDes& aName);
53 TInt ReadPackets(TUint8*& aDest, TInt aLength);
55 // Support to deflated ROM Image
56 TInt GetInnerCompression(TBool &aImageDeflated, TBool &aRomLoaderHeaderExists);
57 TInt GetHeaderBufferContent(TUint8*& aDest, TInt& aLength);
58 TBool IsHeaderStored(void);
61 void UpdateCrc(const TUint8* aPtr, TInt aLength);
62 TInt CheckPacket(TUint8* aDest);
63 TInt ReadPacket(TDes8& aDest);
64 virtual TInt ReadBlock(TDes8& aDest)=0;
65 virtual void WriteC(TUint aChar)=0;
75 TBuf8<1040> iPacketBuf;
78 // Support to deflated ROM Image
79 TBuf8<KHeaderBufferSize> iHeaderBuf;
81 TInt iDataSizeInPuffer;