202
|
1 |
// Copyright (c) 2010 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 |
// TOC Partition Management for Embedded MMC devices
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __EMMC_TOC_H__
|
|
20 |
#define __EMMC_TOC_H__
|
|
21 |
|
|
22 |
#include <emmcptn.h>
|
|
23 |
|
|
24 |
// TOC item
|
|
25 |
const TUint KMaxItemNameLen = 12;
|
|
26 |
|
|
27 |
struct STocItem
|
|
28 |
{
|
|
29 |
TUint32 iStart;
|
|
30 |
TUint32 iSize;
|
|
31 |
TUint32 iFlags;
|
|
32 |
TUint32 iAlign;
|
|
33 |
TUint32 iLoadAddress;
|
|
34 |
TText8 iFileName[KMaxItemNameLen];
|
|
35 |
};
|
|
36 |
|
|
37 |
//- Constants ---------------------------------------------------------------
|
|
38 |
|
|
39 |
const TUint32 KTocStartSector = 1280; // TOC starts from 0xA0000 / 0x200
|
|
40 |
|
|
41 |
const TText8 KTocRofsName[] = "SOS-ROFS";
|
|
42 |
const TText8 KTocRofsName1[] = "SOS+ROFS";
|
|
43 |
const TText8 KTocRofsExtName[] = "SOS-ROFX";
|
|
44 |
const TText8 KTocRofsGeneric[] = "ROFS";
|
|
45 |
const TText8 KTocRomGeneric[] = "SOS+CORE";
|
|
46 |
|
|
47 |
const TText8 KTocCps[] = "SOS-CPS";
|
|
48 |
const TText8 KTocRofsExtGeneric[] = "ROFX";
|
|
49 |
const TText8 KTocSwap[] = "SOS-SWAP";
|
|
50 |
const TText8 KTocUserName[] = "SOS-USER";
|
|
51 |
const TText8 KTocCrashLog[] = "SOS-CRASH";
|
|
52 |
const TText8 KTocToc[] = "TOC";
|
|
53 |
const TText8 KTocSosToc[] = "SOS-TOC";
|
|
54 |
|
|
55 |
const TUint8 KMaxNbrOfTocItems = 16;
|
|
56 |
const TUint8 KXMaxNbrOfTocItems = 16;
|
|
57 |
const TUint32 KEndOfToc = 0xFFFFFFFFUL;
|
|
58 |
|
|
59 |
const TText8 KTocRofs1Generic[] = "ROFS1";
|
|
60 |
const TText8 KTocRofs2Generic[] = "ROFS2";
|
|
61 |
const TText8 KTocRofs3Generic[] = "ROFS3";
|
|
62 |
const TText8 KTocRofs4Generic[] = "ROFS4";
|
|
63 |
const TText8 KTocRofs5Generic[] = "ROFS5";
|
|
64 |
const TText8 KTocRofs6Generic[] = "ROFS6";
|
|
65 |
const TUint KNoOfROFSPartitions = 6;
|
|
66 |
|
|
67 |
const TInt KSectorShift = 9;
|
300
|
68 |
|
|
69 |
// Version Info const and enums
|
|
70 |
|
|
71 |
enum
|
|
72 |
{
|
|
73 |
EHalGroupNandMedia = 28
|
|
74 |
};
|
|
75 |
|
|
76 |
|
|
77 |
/**
|
|
78 |
The number of nand media attributes.
|
|
79 |
|
|
80 |
It is simply defined by its position in the enumeration.
|
|
81 |
*/
|
|
82 |
enum TNandMediaHalFunction
|
|
83 |
{
|
|
84 |
EEraseBlockSize=1, /// nand device block size
|
|
85 |
EIsEraseNeedBeforeWrite, /// erase command is mandatory before write
|
|
86 |
EAtomicWriteSize, /// minimal size of data what can be written
|
|
87 |
|
|
88 |
EGetVersionInfoItems=0x10, /// total amount of items in version info structure
|
|
89 |
EGetVersionInfo /// get version info structure array from media driver
|
|
90 |
};
|
|
91 |
|
|
92 |
|
|
93 |
/**
|
|
94 |
The nand media devices enumeration.
|
|
95 |
|
|
96 |
*/
|
|
97 |
enum
|
|
98 |
{
|
|
99 |
ENandMediaDevice1=1 /// nand device1
|
|
100 |
};
|
|
101 |
|
|
102 |
|
|
103 |
const TUint8 KMaxSectionItems = 32;
|
|
104 |
const TUint8 KMaxSectionNameLen = 12;
|
|
105 |
const TUint8 KMaxVersionInfoLen = 28;
|
|
106 |
|
|
107 |
const TUint32 KImageHeaderMagic = 0x31DEEAE8UL;
|
|
108 |
|
|
109 |
// Image header always located after BB5_CommonHeader
|
|
110 |
const TUint32 KImageHeaderOffset = 0x3D0;
|
|
111 |
|
|
112 |
struct TVersionInfoItem
|
|
113 |
{
|
|
114 |
TText8 iSectionName[KMaxSectionNameLen];
|
|
115 |
TUint32 iSectionMaxSize;
|
|
116 |
TUint32 iImageCompressedSize;
|
|
117 |
TUint32 iImageSize;
|
|
118 |
TText8 iVersion[KMaxVersionInfoLen];
|
|
119 |
};
|
|
120 |
|
|
121 |
|
|
122 |
// Image header
|
|
123 |
// It is added after BB5_Common_Header
|
|
124 |
struct TImageHeader
|
|
125 |
{
|
|
126 |
TUint32 iMagic;
|
|
127 |
TUint32 iImageCompressedSize;
|
|
128 |
TUint32 iImageSize;
|
|
129 |
TUint32 iLoadAddress;
|
|
130 |
TUint32 iReserved;
|
|
131 |
TText8 iVersion[KMaxVersionInfoLen];
|
|
132 |
};
|
|
133 |
|
|
134 |
|
202
|
135 |
/**
|
|
136 |
TOC access for kernel side clients.
|
|
137 |
*/
|
|
138 |
class Toc
|
|
139 |
{
|
|
140 |
public:
|
|
141 |
/**
|
|
142 |
* Search entry in TOC with aName as part of ItemName.
|
|
143 |
* @return KErrNone if successful
|
|
144 |
*/
|
|
145 |
TInt GetItemByName(const TText8* aName, STocItem& aItem);
|
|
146 |
|
|
147 |
public:
|
|
148 |
/** Array for keep whole TOC */
|
|
149 |
STocItem iTOC[KMaxNbrOfTocItems];
|
|
150 |
|
|
151 |
/** Offset of TOC from beginning*/
|
|
152 |
TUint32 iTocStartSector;
|
|
153 |
};
|
|
154 |
|
|
155 |
#endif // __EMMC_TOC_H__
|
|
156 |
|