sl@0
|
1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// bootldr\inc\bootldr.h
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#ifndef FILE_ID
|
sl@0
|
19 |
#error File ID not specified
|
sl@0
|
20 |
#endif
|
sl@0
|
21 |
|
sl@0
|
22 |
#include "bootloader_variantconfig.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
#define BOOTLDR_VERSION_MAJOR 1
|
sl@0
|
25 |
#define BOOTLDR_VERSION_MINOR 11
|
sl@0
|
26 |
|
sl@0
|
27 |
#ifndef PLATFORM_BUILD
|
sl@0
|
28 |
#define PLATFORM_BUILD 0
|
sl@0
|
29 |
#endif
|
sl@0
|
30 |
|
sl@0
|
31 |
#include <e32std.h>
|
sl@0
|
32 |
#include <e32svr.h>
|
sl@0
|
33 |
#include <e32cons.h>
|
sl@0
|
34 |
#include <f32file.h>
|
sl@0
|
35 |
#include <d32comm.h>
|
sl@0
|
36 |
|
sl@0
|
37 |
GLREF_C void BootFault(TUint aId, TInt aLine, char aFileName[]);
|
sl@0
|
38 |
#define BOOT_FAULT() BootFault(FILE_ID,__LINE__, __FILE__ )
|
sl@0
|
39 |
#define TEST(c) ((void)((c)||(BOOT_FAULT(),0)))
|
sl@0
|
40 |
#define CHECK(c) ((void)(((c)==0)||(RDebug::Print(_L("Error %d at line %d\n"),(c),__LINE__),BOOT_FAULT(),0)))
|
sl@0
|
41 |
|
sl@0
|
42 |
//#define _DEBUG_CORELDR_ 1
|
sl@0
|
43 |
|
sl@0
|
44 |
#ifdef _DEBUG_CORELDR_
|
sl@0
|
45 |
#define DEBUG_PRINT(m) PrintToScreen m; \
|
sl@0
|
46 |
RDebug::Print m;
|
sl@0
|
47 |
#else
|
sl@0
|
48 |
#define DEBUG_PRINT(m)
|
sl@0
|
49 |
#endif
|
sl@0
|
50 |
|
sl@0
|
51 |
#define TROM_LOADER_HEADER_SIZE 0x100
|
sl@0
|
52 |
|
sl@0
|
53 |
GLREF_D TInt LoadDrive;
|
sl@0
|
54 |
GLREF_D TInt LoadFile;
|
sl@0
|
55 |
GLREF_D TInt LoadSize;
|
sl@0
|
56 |
GLREF_D TInt ImageSize;
|
sl@0
|
57 |
GLREF_D TInt ImageReadProgress;
|
sl@0
|
58 |
GLREF_D TBool ImageHeaderPresent;
|
sl@0
|
59 |
GLREF_D TBool ImageZip;
|
sl@0
|
60 |
GLREF_D TBool LoadToFlash;
|
sl@0
|
61 |
GLREF_D TBool FlashBootLoader;
|
sl@0
|
62 |
GLREF_D TBuf<256> FileName;
|
sl@0
|
63 |
GLREF_D TUint32 RamBootPhys;
|
sl@0
|
64 |
GLREF_D TUint32 * ActualDestinationAddress;
|
sl@0
|
65 |
GLREF_D TInt SerialDownloadPort;
|
sl@0
|
66 |
GLREF_D TBps SerialBaud;
|
sl@0
|
67 |
GLREF_D RFile bootFile;
|
sl@0
|
68 |
GLREF_D TInt FileSize;
|
sl@0
|
69 |
GLREF_D TBool ImageDeflated;
|
sl@0
|
70 |
GLREF_D TBool RomLoaderHeaderExists;
|
sl@0
|
71 |
GLREF_D TBusLocalDrive LocDrv;
|
sl@0
|
72 |
GLREF_D TBool LocDrvChg;
|
sl@0
|
73 |
GLREF_D TInt64 LocDrvPos;
|
sl@0
|
74 |
|
sl@0
|
75 |
enum TLoadDevice
|
sl@0
|
76 |
{
|
sl@0
|
77 |
ELoadDrive,
|
sl@0
|
78 |
ELoadSerial,
|
sl@0
|
79 |
ELoadUSBMS,
|
sl@0
|
80 |
EBootUSBMS,
|
sl@0
|
81 |
EBootEMMC
|
sl@0
|
82 |
};
|
sl@0
|
83 |
|
sl@0
|
84 |
GLREF_D TLoadDevice LoadDevice;
|
sl@0
|
85 |
|
sl@0
|
86 |
typedef TInt (*TInputFunc)(TUint8* aDest, TInt& aLength);
|
sl@0
|
87 |
GLREF_D TInputFunc InputFunction;
|
sl@0
|
88 |
|
sl@0
|
89 |
typedef void (*TCloseInputFunc)();
|
sl@0
|
90 |
GLREF_D TCloseInputFunc CloseInputFunction;
|
sl@0
|
91 |
|
sl@0
|
92 |
inline TInt ReadInputData(TUint8* aDest, TInt& aLength)
|
sl@0
|
93 |
{ return (*InputFunction)(aDest,aLength); }
|
sl@0
|
94 |
inline void CloseInput()
|
sl@0
|
95 |
{ (*CloseInputFunction)(); }
|
sl@0
|
96 |
|
sl@0
|
97 |
|
sl@0
|
98 |
GLREF_C TInt LoadDriver(const TDesC& aName, TBool aPdd);
|
sl@0
|
99 |
|
sl@0
|
100 |
// Graphical screen methods
|
sl@0
|
101 |
GLREF_C void PrintToScreen(TRefByValue<const TDesC> aFmt,...);
|
sl@0
|
102 |
GLREF_C void InitDisplay();
|
sl@0
|
103 |
GLREF_C void ClearScreen();
|
sl@0
|
104 |
GLREF_C void PutChar(TUint aChar);
|
sl@0
|
105 |
GLREF_C void PutString(const TDesC& aBuf);
|
sl@0
|
106 |
GLREF_C void InitProgressBar(TInt aId, TUint aLimit, const TDesC& aTitle);
|
sl@0
|
107 |
GLREF_C void UpdateProgressBar(TInt aId, TUint aProgress);
|
sl@0
|
108 |
|
sl@0
|
109 |
// Menu
|
sl@0
|
110 |
GLREF_C void StartMenu();
|
sl@0
|
111 |
GLREF_C void EnableMenu();
|
sl@0
|
112 |
GLREF_C void DisableMenu();
|
sl@0
|
113 |
|
sl@0
|
114 |
// Fundamental download methods
|
sl@0
|
115 |
GLREF_C void DoDownload();
|
sl@0
|
116 |
GLREF_C TInt DoZipDownload(RFile &aBootFile);
|
sl@0
|
117 |
GLREF_C TInt DoDeflateDownload();
|
sl@0
|
118 |
GLREF_C void Restart(TInt aCode);
|
sl@0
|
119 |
|
sl@0
|
120 |
// Media download
|
sl@0
|
121 |
GLREF_C TBool SearchDrives();
|
sl@0
|
122 |
GLREF_C TInt ReadFromFile(TUint8* aDest, TInt& aLength);
|
sl@0
|
123 |
GLREF_C void CloseFile();
|
sl@0
|
124 |
GLREF_C TInt GetInnerCompression(TBool &aImageDeflated, TBool &aRomLoaderHeaderExists);
|
sl@0
|
125 |
|
sl@0
|
126 |
// Local Drive Raw Access
|
sl@0
|
127 |
GLREF_C TBool SearchDrivesRaw();
|
sl@0
|
128 |
GLREF_C TInt ReadFromLocalDrive(TUint8* aDest, TInt& aLength);
|
sl@0
|
129 |
GLREF_C void CloseLocalDrive();
|
sl@0
|
130 |
|
sl@0
|
131 |
// Serial download
|
sl@0
|
132 |
GLREF_C TInt InitSerialDownload(TInt aPort);
|
sl@0
|
133 |
|
sl@0
|
134 |
// NOR FLASH methods
|
sl@0
|
135 |
GLREF_C TInt InitFlashWrite();
|
sl@0
|
136 |
GLREF_C void NotifyDataAvailable(TInt aTotalAmount);
|
sl@0
|
137 |
GLREF_C void NotifyDownloadComplete();
|
sl@0
|
138 |
|
sl@0
|
139 |
// USB Mass Storage download
|
sl@0
|
140 |
GLREF_C void TryUSBMS();
|
sl@0
|
141 |
GLREF_C TBool StartUSBMS();
|
sl@0
|
142 |
|
sl@0
|
143 |
// Variant supplied methods
|
sl@0
|
144 |
GLREF_C void VariantInit();
|
sl@0
|
145 |
GLREF_C void ReadConfig();
|
sl@0
|
146 |
GLREF_C void WriteConfig();
|
sl@0
|
147 |
|
sl@0
|
148 |
inline TLinAddr DestinationAddress()
|
sl@0
|
149 |
{ return (TLinAddr)ActualDestinationAddress; }
|
sl@0
|
150 |
|