First public contribution.
1 // Copyright (c) 1996-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\bootldr.h
19 #error File ID not specified
22 #include "bootloader_variantconfig.h"
24 #define BOOTLDR_VERSION_MAJOR 1
25 #define BOOTLDR_VERSION_MINOR 11
27 #ifndef PLATFORM_BUILD
28 #define PLATFORM_BUILD 0
37 GLREF_C void BootFault(TUint aId, TInt aLine, char aFileName[]);
38 #define BOOT_FAULT() BootFault(FILE_ID,__LINE__, __FILE__ )
39 #define TEST(c) ((void)((c)||(BOOT_FAULT(),0)))
40 #define CHECK(c) ((void)(((c)==0)||(RDebug::Print(_L("Error %d at line %d\n"),(c),__LINE__),BOOT_FAULT(),0)))
42 //#define _DEBUG_CORELDR_ 1
44 #ifdef _DEBUG_CORELDR_
45 #define DEBUG_PRINT(m) PrintToScreen m; \
48 #define DEBUG_PRINT(m)
51 #define TROM_LOADER_HEADER_SIZE 0x100
53 GLREF_D TInt LoadDrive;
54 GLREF_D TInt LoadFile;
55 GLREF_D TInt LoadSize;
56 GLREF_D TInt ImageSize;
57 GLREF_D TInt ImageReadProgress;
58 GLREF_D TBool ImageHeaderPresent;
59 GLREF_D TBool ImageZip;
60 GLREF_D TBool LoadToFlash;
61 GLREF_D TBool FlashBootLoader;
62 GLREF_D TBuf<256> FileName;
63 GLREF_D TUint32 RamBootPhys;
64 GLREF_D TUint32 * ActualDestinationAddress;
65 GLREF_D TInt SerialDownloadPort;
66 GLREF_D TBps SerialBaud;
67 GLREF_D RFile bootFile;
68 GLREF_D TInt FileSize;
69 GLREF_D TBool ImageDeflated;
70 GLREF_D TBool RomLoaderHeaderExists;
71 GLREF_D TBusLocalDrive LocDrv;
72 GLREF_D TBool LocDrvChg;
73 GLREF_D TInt64 LocDrvPos;
84 GLREF_D TLoadDevice LoadDevice;
86 typedef TInt (*TInputFunc)(TUint8* aDest, TInt& aLength);
87 GLREF_D TInputFunc InputFunction;
89 typedef void (*TCloseInputFunc)();
90 GLREF_D TCloseInputFunc CloseInputFunction;
92 inline TInt ReadInputData(TUint8* aDest, TInt& aLength)
93 { return (*InputFunction)(aDest,aLength); }
94 inline void CloseInput()
95 { (*CloseInputFunction)(); }
98 GLREF_C TInt LoadDriver(const TDesC& aName, TBool aPdd);
100 // Graphical screen methods
101 GLREF_C void PrintToScreen(TRefByValue<const TDesC> aFmt,...);
102 GLREF_C void InitDisplay();
103 GLREF_C void ClearScreen();
104 GLREF_C void PutChar(TUint aChar);
105 GLREF_C void PutString(const TDesC& aBuf);
106 GLREF_C void InitProgressBar(TInt aId, TUint aLimit, const TDesC& aTitle);
107 GLREF_C void UpdateProgressBar(TInt aId, TUint aProgress);
110 GLREF_C void StartMenu();
111 GLREF_C void EnableMenu();
112 GLREF_C void DisableMenu();
114 // Fundamental download methods
115 GLREF_C void DoDownload();
116 GLREF_C TInt DoZipDownload(RFile &aBootFile);
117 GLREF_C TInt DoDeflateDownload();
118 GLREF_C void Restart(TInt aCode);
121 GLREF_C TBool SearchDrives();
122 GLREF_C TInt ReadFromFile(TUint8* aDest, TInt& aLength);
123 GLREF_C void CloseFile();
124 GLREF_C TInt GetInnerCompression(TBool &aImageDeflated, TBool &aRomLoaderHeaderExists);
126 // Local Drive Raw Access
127 GLREF_C TBool SearchDrivesRaw();
128 GLREF_C TInt ReadFromLocalDrive(TUint8* aDest, TInt& aLength);
129 GLREF_C void CloseLocalDrive();
132 GLREF_C TInt InitSerialDownload(TInt aPort);
135 GLREF_C TInt InitFlashWrite();
136 GLREF_C void NotifyDataAvailable(TInt aTotalAmount);
137 GLREF_C void NotifyDownloadComplete();
139 // USB Mass Storage download
140 GLREF_C void TryUSBMS();
141 GLREF_C TBool StartUSBMS();
143 // Variant supplied methods
144 GLREF_C void VariantInit();
145 GLREF_C void ReadConfig();
146 GLREF_C void WriteConfig();
148 inline TLinAddr DestinationAddress()
149 { return (TLinAddr)ActualDestinationAddress; }