196 you need to adopt the technique suggested below. The local media subsystem |
196 you need to adopt the technique suggested below. The local media subsystem |
197 will make the physical address available to the media driver. A call to <xref href="GUID-D84A9903-AE0F-3F54-8833-E8956A88E26C.dita#GUID-D84A9903-AE0F-3F54-8833-E8956A88E26C/GUID-DD6773B4-9EF5-322F-B53D-29174DF3B3BF"><apiname>TLocDrvRequest::IsPhysicalAddress()</apiname></xref> returns |
197 will make the physical address available to the media driver. A call to <xref href="GUID-D84A9903-AE0F-3F54-8833-E8956A88E26C.dita#GUID-D84A9903-AE0F-3F54-8833-E8956A88E26C/GUID-DD6773B4-9EF5-322F-B53D-29174DF3B3BF"><apiname>TLocDrvRequest::IsPhysicalAddress()</apiname></xref> returns |
198 true. </p> <p>Consider the following case. A request has been made to read |
198 true. </p> <p>Consider the following case. A request has been made to read |
199 1024 bytes from a media device that has a block size of 512 bytes. The 1024 |
199 1024 bytes from a media device that has a block size of 512 bytes. The 1024 |
200 bytes start at offset +256 on the media device. </p> <fig id="GUID-2689C022-180B-51EF-A02D-E63ACA832EB2"> |
200 bytes start at offset +256 on the media device. </p> <fig id="GUID-2689C022-180B-51EF-A02D-E63ACA832EB2"> |
201 <image href="GUID-647ADEDA-AB5A-548F-93C3-D099EAE6A030_d0e395231_href.png" placement="inline"/> |
201 <image href="GUID-647ADEDA-AB5A-548F-93C3-D099EAE6A030_d0e417027_href.png" placement="inline"/> |
202 </fig> <p>To get the first 256 bytes, you must read the first block of 512 |
202 </fig> <p>To get the first 256 bytes, you must read the first block of 512 |
203 bytes from the media device. This can corrupt the physical memory passed in |
203 bytes from the media device. This can corrupt the physical memory passed in |
204 the I/O request. The solution is to read the first block from the media device |
204 the I/O request. The solution is to read the first block from the media device |
205 into an intermediate buffer. Copy the 256 bytes from that buffer into the |
205 into an intermediate buffer. Copy the 256 bytes from that buffer into the |
206 physical memory passed in the I/O request. </p> <p>To get the last 256 bytes, |
206 physical memory passed in the I/O request. </p> <p>To get the last 256 bytes, |
231 PopulateScatterGatherList(physAddr, physLength); |
231 PopulateScatterGatherList(physAddr, physLength); |
232 } |
232 } |
233 |
233 |
234 return DoDataTransfer(pos, length);</codeblock> </section> |
234 return DoDataTransfer(pos, length);</codeblock> </section> |
235 </conbody><related-links> |
235 </conbody><related-links> |
236 <link> |
236 <link href="GUID-86082C0C-B0EE-5E7C-85B4-4A509066012F.dita"><linktext>MMC Porting |
237 <desc><xref href="GUID-E55B4FE5-517C-5A23-8ACA-E28EE202330B.dita#GUID-E55B4FE5-517C-5A23-8ACA-E28EE202330B/GUID-575211BC-BF66-5817-9825-EE402648D0CD">Register |
237 Implementation Tutorial</linktext></link> |
238 media driver support for physical addresses</xref></desc> |
|
239 </link> |
|
240 </related-links></concept> |
238 </related-links></concept> |