os/kernelhwsrv/brdbootldr/ubootldr/inc/bootldr.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/brdbootldr/ubootldr/inc/bootldr.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,150 @@
     1.4 +// Copyright (c) 1996-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 +// bootldr\inc\bootldr.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef FILE_ID
    1.22 +#error File ID not specified
    1.23 +#endif
    1.24 +
    1.25 +#include "bootloader_variantconfig.h"
    1.26 +
    1.27 +#define BOOTLDR_VERSION_MAJOR 1
    1.28 +#define BOOTLDR_VERSION_MINOR 11
    1.29 +
    1.30 +#ifndef PLATFORM_BUILD
    1.31 +#define PLATFORM_BUILD 0
    1.32 +#endif
    1.33 +
    1.34 +#include <e32std.h>
    1.35 +#include <e32svr.h>
    1.36 +#include <e32cons.h>
    1.37 +#include <f32file.h>
    1.38 +#include <d32comm.h>
    1.39 +
    1.40 +GLREF_C void BootFault(TUint aId, TInt aLine, char aFileName[]);
    1.41 +#define BOOT_FAULT()	BootFault(FILE_ID,__LINE__, __FILE__ )
    1.42 +#define TEST(c)		((void)((c)||(BOOT_FAULT(),0)))
    1.43 +#define CHECK(c)	((void)(((c)==0)||(RDebug::Print(_L("Error %d at line %d\n"),(c),__LINE__),BOOT_FAULT(),0)))
    1.44 +
    1.45 +//#define _DEBUG_CORELDR_  1
    1.46 +
    1.47 +#ifdef _DEBUG_CORELDR_        
    1.48 +    #define DEBUG_PRINT(m) PrintToScreen m;	\
    1.49 +                           RDebug::Print m;
    1.50 +#else
    1.51 +    #define DEBUG_PRINT(m)
    1.52 +#endif    
    1.53 +
    1.54 +#define TROM_LOADER_HEADER_SIZE 0x100
    1.55 +
    1.56 +GLREF_D TInt LoadDrive;
    1.57 +GLREF_D TInt LoadFile;
    1.58 +GLREF_D TInt LoadSize;
    1.59 +GLREF_D TInt ImageSize;
    1.60 +GLREF_D TInt ImageReadProgress;
    1.61 +GLREF_D TBool ImageHeaderPresent;
    1.62 +GLREF_D TBool ImageZip;
    1.63 +GLREF_D TBool LoadToFlash;
    1.64 +GLREF_D TBool FlashBootLoader;
    1.65 +GLREF_D TBuf<256> FileName;
    1.66 +GLREF_D TUint32 RamBootPhys;
    1.67 +GLREF_D TUint32 * ActualDestinationAddress;
    1.68 +GLREF_D TInt SerialDownloadPort;
    1.69 +GLREF_D TBps SerialBaud;
    1.70 +GLREF_D RFile bootFile;
    1.71 +GLREF_D TInt FileSize;
    1.72 +GLREF_D TBool ImageDeflated;
    1.73 +GLREF_D TBool RomLoaderHeaderExists;
    1.74 +GLREF_D TBusLocalDrive LocDrv;
    1.75 +GLREF_D TBool LocDrvChg;
    1.76 +GLREF_D TInt64 LocDrvPos;
    1.77 +
    1.78 +enum TLoadDevice
    1.79 +	{
    1.80 +	ELoadDrive,
    1.81 +	ELoadSerial,
    1.82 +	ELoadUSBMS,
    1.83 +	EBootUSBMS,
    1.84 +	EBootEMMC
    1.85 +	};
    1.86 +
    1.87 +GLREF_D TLoadDevice LoadDevice;
    1.88 +
    1.89 +typedef TInt (*TInputFunc)(TUint8* aDest, TInt& aLength);
    1.90 +GLREF_D TInputFunc InputFunction;
    1.91 +
    1.92 +typedef void (*TCloseInputFunc)();
    1.93 +GLREF_D TCloseInputFunc CloseInputFunction;
    1.94 +
    1.95 +inline TInt ReadInputData(TUint8* aDest, TInt& aLength)
    1.96 +	{ return (*InputFunction)(aDest,aLength); }
    1.97 +inline void CloseInput()
    1.98 +	{ (*CloseInputFunction)(); }
    1.99 +
   1.100 +
   1.101 +GLREF_C TInt LoadDriver(const TDesC& aName, TBool aPdd);
   1.102 +
   1.103 +// Graphical screen methods
   1.104 +GLREF_C void PrintToScreen(TRefByValue<const TDesC> aFmt,...);
   1.105 +GLREF_C void InitDisplay();
   1.106 +GLREF_C void ClearScreen();
   1.107 +GLREF_C void PutChar(TUint aChar);
   1.108 +GLREF_C void PutString(const TDesC& aBuf);
   1.109 +GLREF_C void InitProgressBar(TInt aId, TUint aLimit, const TDesC& aTitle);
   1.110 +GLREF_C void UpdateProgressBar(TInt aId, TUint aProgress);
   1.111 +
   1.112 +// Menu
   1.113 +GLREF_C void StartMenu();
   1.114 +GLREF_C void EnableMenu();
   1.115 +GLREF_C void DisableMenu();
   1.116 +
   1.117 +// Fundamental download methods
   1.118 +GLREF_C void DoDownload();
   1.119 +GLREF_C TInt DoZipDownload(RFile &aBootFile);
   1.120 +GLREF_C TInt DoDeflateDownload();
   1.121 +GLREF_C void Restart(TInt aCode);
   1.122 +
   1.123 +// Media download
   1.124 +GLREF_C TBool SearchDrives();
   1.125 +GLREF_C TInt ReadFromFile(TUint8* aDest, TInt& aLength);
   1.126 +GLREF_C void CloseFile();
   1.127 +GLREF_C TInt GetInnerCompression(TBool &aImageDeflated, TBool &aRomLoaderHeaderExists);
   1.128 +
   1.129 +// Local Drive Raw Access
   1.130 +GLREF_C TBool SearchDrivesRaw();
   1.131 +GLREF_C TInt ReadFromLocalDrive(TUint8* aDest, TInt& aLength);
   1.132 +GLREF_C void CloseLocalDrive();
   1.133 +
   1.134 +// Serial download
   1.135 +GLREF_C TInt InitSerialDownload(TInt aPort);
   1.136 +
   1.137 +// NOR FLASH methods
   1.138 +GLREF_C TInt InitFlashWrite();
   1.139 +GLREF_C void NotifyDataAvailable(TInt aTotalAmount);
   1.140 +GLREF_C void NotifyDownloadComplete();
   1.141 +
   1.142 +// USB Mass Storage download
   1.143 +GLREF_C void TryUSBMS();
   1.144 +GLREF_C TBool StartUSBMS();
   1.145 +
   1.146 +// Variant supplied methods
   1.147 +GLREF_C void VariantInit();
   1.148 +GLREF_C void ReadConfig();
   1.149 +GLREF_C void WriteConfig();
   1.150 +
   1.151 +inline TLinAddr DestinationAddress()
   1.152 +	{ return (TLinAddr)ActualDestinationAddress; }
   1.153 +