|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-90B5FDD9-7D59-5035-BF53-2B177655DCD6" xml:lang="en"><title>Migration |
|
13 Tutorial: Demand Paging and Internal MMC Cards</title><shortdesc>Explains how to change the MMC media driver for when demand paging |
|
14 is used.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <p>Demand paging is a change made from Symbian platform v9.3 to how the Kernel |
|
16 uses RAM and storage media. This topic </p> |
|
17 <p>For general information on migrating media drivers, see <xref href="GUID-EB2566BD-8F65-5A81-B215-E8B05CFE21C3.dita">Migration |
|
18 Tutorial: Demand Paging and Media Drivers</xref>. </p> |
|
19 <section id="GUID-D99E59FE-2515-49F5-9C55-580D1F2AD6A8"><title>PSL changes</title> <p>ROM and code paging can be enabled |
|
20 for a Multi Media Card (MMC) provided the card is non-removable. Removing |
|
21 a card would result in a kernel fault whenever the next page-in request is |
|
22 issued. </p> <p>As the MMC media driver is entirely generic, a way of returning |
|
23 the paging related information contained in <i>variantmedia.def</i> to the |
|
24 generic part of the MMC stack is required. This is achieved by modifying the |
|
25 Platform Specific Layer (PSL) of the MMC stack to implement the <xref href="GUID-B5193656-9819-3E00-A335-EEF1726115A5.dita#GUID-B5193656-9819-3E00-A335-EEF1726115A5/GUID-7DAC0CF1-4AFE-3F68-8488-632535783A80"><apiname>DMMCStack::MDemandPagingInfo</apiname></xref> interface |
|
26 method: </p> <codeblock id="GUID-7B1FA673-641B-54C7-BC6B-DCDBE25297B8" xml:space="preserve">class DMMCStack : public Dbase |
|
27 { |
|
28 public: |
|
29 // etc… |
|
30 }; |
|
31 |
|
32 /** |
|
33 Demand paging support |
|
34 @see KInterfaceDemandPagingInfo |
|
35 */ |
|
36 |
|
37 class TDemandPagingInfo |
|
38 { |
|
39 public: |
|
40 const TInt* iPagingDriveList; |
|
41 TInt iDriveCount; |
|
42 TUint iPagingType; |
|
43 TInt iReadShift; |
|
44 TUint iNumPages; |
|
45 TBool iWriteProtected; |
|
46 TUint iSpare[3]; |
|
47 }; |
|
48 |
|
49 class MDemandPagingInfo |
|
50 { |
|
51 public: |
|
52 virtual TInt DemandPagingInfo(TDemandPagingInfo& aInfo) = 0; |
|
53 // etc… |
|
54 };</codeblock> <p>This example is taken from the H4 HRP <i>VariantMedia.def</i> changes: </p> <codeblock id="GUID-DD8297C4-6033-5AB1-838C-F0DFE1C7C749" xml:space="preserve">// Variant parameters for the MMC Controller (EPBUSMMC.DLL) |
|
55 #define MMC_DRIVECOUNT 1 |
|
56 #define MMC_DRIVELIST 1 |
|
57 #define MMC_NUMMEDIA 1 |
|
58 #define MMC_DRIVENAME "MultiMediaCard0" |
|
59 |
|
60 #define MMC_PAGING_TYPE DPagingDevice::ERom | DPagingDevice::ECode |
|
61 #define MMC_PAGEDRIVELIST 1 // code paging from User Data |
|
62 #define MMC_PAGEDRIVECOUNT 1 |
|
63 #define MMC_NUM_PAGES 8</codeblock> <p>This example is from H4 MMC |
|
64 stack class definition: </p> <codeblock id="GUID-FC2E902E-E98C-5E0E-9337-D3D5BB14FBB6" xml:space="preserve">class DDemandPagingInfo : public DMMCStack::MDemandPagingInfo |
|
65 { |
|
66 public: |
|
67 virtual TInt DemandPagingInfo(DMMCStack::TDemandPagingInfo& aInfo); |
|
68 }; |
|
69 |
|
70 |
|
71 class DOmapMMCStack : public DCardStack |
|
72 { |
|
73 public: |
|
74 virtual void GetInterface(TInterfaceId aInterfaceId, MInterface*& aInterfacePtr); |
|
75 // etc… |
|
76 private: |
|
77 DDemandPagingInfo* iDemandPagingInfo; |
|
78 // etc… |
|
79 };</codeblock> <p>This example is from H4 MMC stack class implementation: </p> <codeblock id="GUID-824160DE-295D-5BA2-B2BE-A5590301B9EA" xml:space="preserve">TInt DOmapMMCStack::Init() |
|
80 { |
|
81 if((iDemandPagingInfo = new DDemandPagingInfo()) == NULL) |
|
82 return KErrNoMemory; |
|
83 // etc… |
|
84 } |
|
85 |
|
86 void DOmapMMCStack::GetInterface(TInterfaceId aInterfaceId, MInterface*& aInterfacePtr) |
|
87 { |
|
88 if (aInterfaceId == KInterfaceDemandPagingInfo) |
|
89 aInterfacePtr = (DMMCStack::MInterface*) iDemandPagingInfo; |
|
90 // etc… |
|
91 } |
|
92 |
|
93 TInt DDemandPagingInfo::DemandPagingInfo(DMMCStack::TDemandPagingInfo& aDemandPagingInfo) |
|
94 { |
|
95 static const TInt pagingDriveNumbers[MMC_PAGEDRIVECOUNT] = {MMC_PAGEDRIVELIST}; |
|
96 |
|
97 aDemandPagingInfo.iPagingDriveList = pagingDriveNumbers; |
|
98 aDemandPagingInfo.iDriveCount = MMC_PAGEDRIVECOUNT; |
|
99 aDemandPagingInfo.iPagingType = MMC_PAGING_TYPE; |
|
100 aDemandPagingInfo.iReadShift = 9; |
|
101 aDemandPagingInfo.iNumPages = MMC_NUM_PAGES; |
|
102 return KErrNone; |
|
103 }</codeblock> </section> |
|
104 <section id="GUID-6389CCE7-339D-4F41-B875-4636C5993C6C"><title>Preparing an internal MMC card for ROM paging - MMCLoader</title> <p>To |
|
105 support ROM paging from an internal card, the MMCLoader utility is used to |
|
106 write the ROM image to the card. MMCLoader can be found in <filepath>e32utils/mmcloader</filepath>. </p> <p>The |
|
107 paged image is written as a normal file under the FAT file system. For paging |
|
108 to work however, the images file’s clusters must all be contiguous so, before |
|
109 doing anything else, MMCLoader formats the card. It then writes the paged |
|
110 part of the ROM to a file and checks that the file’s clusters are contiguous, |
|
111 which is normally the case as the card has just been formatted. A pointer |
|
112 to the image file is stored in the boot sector. When the board is rebooted |
|
113 the MMC/SD media driver reads the boot sector and uses this pointer to determine |
|
114 where the image file starts so that it can begin to satisfy paging requests. </p> <p>MMCLoader |
|
115 takes the filename of the original ROM image file as an input. It then splits |
|
116 the given file into unpaged and paged files. The following code fragment shows |
|
117 the syntax: </p> <codeblock id="GUID-0CFE9814-4FEA-5FF1-9027-82E207596C68" xml:space="preserve">Syntax: mmcloader <RomSrcFileName> <UnPagedRomDstFileName> <PagedRomDstFileName> |
|
118 Eg: mmcloader z:\\core.img d:\\sys$rom.bin d:\\sys$rom.pag</codeblock> </section> |
|
119 </conbody></concept> |