Revision: 201003
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 18 Jan 2010 21:31:10 +0200
changeset 45 329ab0095843
parent 44 36bfc973b146
child 46 0bf4040442f9
Revision: 201003 Kit: 201003
brdbootldr/ubootldr/inflate.c
bsptemplate/asspandvariant/template_assp/dma.mmp
bsptemplate/asspandvariant/template_assp/dmapsl.cpp
kernel/eka/bld.inf
kernel/eka/bmarm/dma2u.def
kernel/eka/compsupp/bld.inf
kernel/eka/compsupp/compsupp.iby
kernel/eka/compsupp/gcce/gcce.h
kernel/eka/compsupp/rvct.h
kernel/eka/compsupp/rvct/aeabidiv0.cpp
kernel/eka/compsupp/rvct/aeabimem.cpp
kernel/eka/compsupp/rvct/call_via_rx/r0.cpp
kernel/eka/compsupp/rvct/call_via_rx/r1.cpp
kernel/eka/compsupp/rvct/call_via_rx/r2.cpp
kernel/eka/compsupp/rvct/call_via_rx/r3.cpp
kernel/eka/compsupp/rvct/call_via_rx/r4.cpp
kernel/eka/compsupp/rvct/call_via_rx/r5.cpp
kernel/eka/compsupp/rvct/call_via_rx/r6.cpp
kernel/eka/compsupp/rvct/call_via_rx/r7.cpp
kernel/eka/compsupp/rvct/dfpaeabi.mmp
kernel/eka/compsupp/rvct/dfpaeabi_common.mmh
kernel/eka/compsupp/rvct/dfpaeabi_vfpv2.mmp
kernel/eka/compsupp/rvct/dfprvct-thunk.cpp
kernel/eka/compsupp/rvct/dfprvct-thunk.mmp
kernel/eka/compsupp/rvct/dfprvct.cpp
kernel/eka/compsupp/rvct/dfprvct.mmp
kernel/eka/compsupp/rvct/dfprvct_common.mmh
kernel/eka/compsupp/rvct/dfprvct_vfpv2.mmp
kernel/eka/compsupp/rvct/dllexp.cpp
kernel/eka/compsupp/rvct/drtaeabi.cpp
kernel/eka/compsupp/rvct/drtaeabi.mmp
kernel/eka/compsupp/rvct/drtrvct.mmp
kernel/eka/compsupp/rvct/drtrvct_common.mmh
kernel/eka/compsupp/rvct/drtrvct_vfpv2.mmp
kernel/eka/compsupp/rvct/ksrt.mmp
kernel/eka/compsupp/rvct/no_extras.cpp
kernel/eka/compsupp/rvct/rtabort.cpp
kernel/eka/compsupp/rvct/rtdiv0.cpp
kernel/eka/compsupp/rvct/rtexit.cpp
kernel/eka/compsupp/rvct/rtlib.cpp
kernel/eka/compsupp/rvct/rtraise.cpp
kernel/eka/compsupp/rvct/sftfpini.cpp
kernel/eka/compsupp/rvct/type_info.cpp
kernel/eka/compsupp/rvct/ucppfini.cpp
kernel/eka/compsupp/rvct/ucppinit.cpp
kernel/eka/compsupp/rvct/usrt.mmp
kernel/eka/compsupp/rvct2_0/callviar0.cpp
kernel/eka/compsupp/rvct2_0/callviar1.cpp
kernel/eka/compsupp/rvct2_0/callviar2.cpp
kernel/eka/compsupp/rvct2_0/callviar3.cpp
kernel/eka/compsupp/rvct2_0/callviar4.cpp
kernel/eka/compsupp/rvct2_0/callviar5.cpp
kernel/eka/compsupp/rvct2_0/callviar6.cpp
kernel/eka/compsupp/rvct2_0/callviar7.cpp
kernel/eka/compsupp/rvct2_0/cppinit.h
kernel/eka/compsupp/rvct2_0/dllexp.cpp
kernel/eka/compsupp/rvct2_0/ksrt.mmp
kernel/eka/compsupp/rvct2_0/rtabort.cpp
kernel/eka/compsupp/rvct2_0/rtdiv0.cpp
kernel/eka/compsupp/rvct2_0/rte32dll.cpp
kernel/eka/compsupp/rvct2_0/rtexit.cpp
kernel/eka/compsupp/rvct2_0/rtlib.cpp
kernel/eka/compsupp/rvct2_0/rtopdel.cpp
kernel/eka/compsupp/rvct2_0/rtopnew.cpp
kernel/eka/compsupp/rvct2_0/rtraise.cpp
kernel/eka/compsupp/rvct2_0/rvct2_0.h
kernel/eka/compsupp/rvct2_0/sftfpini.cpp
kernel/eka/compsupp/rvct2_0/ucppfini.cpp
kernel/eka/compsupp/rvct2_0/ucppinit.cpp
kernel/eka/compsupp/rvct2_0/udfp.mmp
kernel/eka/compsupp/rvct2_0/udfpfrce.cpp
kernel/eka/compsupp/rvct2_0/udrt.mmp
kernel/eka/compsupp/rvct2_0/udrtfrce.cpp
kernel/eka/compsupp/rvct2_0/usrt.mmp
kernel/eka/compsupp/rvct2_1/aeabidiv0.cpp
kernel/eka/compsupp/rvct2_1/aeabimem.cia
kernel/eka/compsupp/rvct2_1/callviar0.cpp
kernel/eka/compsupp/rvct2_1/callviar1.cpp
kernel/eka/compsupp/rvct2_1/callviar2.cpp
kernel/eka/compsupp/rvct2_1/callviar3.cpp
kernel/eka/compsupp/rvct2_1/callviar4.cpp
kernel/eka/compsupp/rvct2_1/callviar5.cpp
kernel/eka/compsupp/rvct2_1/callviar6.cpp
kernel/eka/compsupp/rvct2_1/callviar7.cpp
kernel/eka/compsupp/rvct2_1/cppinit.h
kernel/eka/compsupp/rvct2_1/dfpaeabi.cpp
kernel/eka/compsupp/rvct2_1/dfpaeabi.mmp
kernel/eka/compsupp/rvct2_1/dfprvct2_1-thunk.cpp
kernel/eka/compsupp/rvct2_1/dfprvct2_1-thunk.mmp
kernel/eka/compsupp/rvct2_1/dfprvct2_1.cpp
kernel/eka/compsupp/rvct2_1/dfprvct2_1.mmp
kernel/eka/compsupp/rvct2_1/dllexp.cpp
kernel/eka/compsupp/rvct2_1/drtaeabi.cpp
kernel/eka/compsupp/rvct2_1/drtaeabi.mmp
kernel/eka/compsupp/rvct2_1/drtrvct2_1.cpp
kernel/eka/compsupp/rvct2_1/drtrvct2_1.mmp
kernel/eka/compsupp/rvct2_1/ksrt.mmp
kernel/eka/compsupp/rvct2_1/ksrt2_1.mmp
kernel/eka/compsupp/rvct2_1/rtabort.cpp
kernel/eka/compsupp/rvct2_1/rtdiv0.cpp
kernel/eka/compsupp/rvct2_1/rte32dll.cpp
kernel/eka/compsupp/rvct2_1/rtexit.cpp
kernel/eka/compsupp/rvct2_1/rtlib.cpp
kernel/eka/compsupp/rvct2_1/rtopdel.cpp
kernel/eka/compsupp/rvct2_1/rtopnew.cpp
kernel/eka/compsupp/rvct2_1/rtraise.cpp
kernel/eka/compsupp/rvct2_1/rvct2_1.h
kernel/eka/compsupp/rvct2_1/sftfpini.cpp
kernel/eka/compsupp/rvct2_1/ucppfini.cpp
kernel/eka/compsupp/rvct2_1/ucppinit.cpp
kernel/eka/compsupp/rvct2_1/ucppinit_aeabi.cpp
kernel/eka/compsupp/rvct2_1/usrt.mmp
kernel/eka/compsupp/rvct2_1/usrt2_1.mmp
kernel/eka/compsupp/rvct2_2/aeabidiv0.cpp
kernel/eka/compsupp/rvct2_2/aeabimem.cia
kernel/eka/compsupp/rvct2_2/callviar0.cpp
kernel/eka/compsupp/rvct2_2/callviar1.cpp
kernel/eka/compsupp/rvct2_2/callviar2.cpp
kernel/eka/compsupp/rvct2_2/callviar3.cpp
kernel/eka/compsupp/rvct2_2/callviar4.cpp
kernel/eka/compsupp/rvct2_2/callviar5.cpp
kernel/eka/compsupp/rvct2_2/callviar6.cpp
kernel/eka/compsupp/rvct2_2/callviar7.cpp
kernel/eka/compsupp/rvct2_2/cppinit.h
kernel/eka/compsupp/rvct2_2/dfpaeabi.cpp
kernel/eka/compsupp/rvct2_2/dfpaeabi.mmp
kernel/eka/compsupp/rvct2_2/dfpaeabi_common.mmh
kernel/eka/compsupp/rvct2_2/dfpaeabi_vfpv2.mmp
kernel/eka/compsupp/rvct2_2/dfprvct2_2-thunk.cpp
kernel/eka/compsupp/rvct2_2/dfprvct2_2-thunk.mmp
kernel/eka/compsupp/rvct2_2/dfprvct2_2.cpp
kernel/eka/compsupp/rvct2_2/dfprvct2_2.mmp
kernel/eka/compsupp/rvct2_2/dfprvct2_2_common.mmh
kernel/eka/compsupp/rvct2_2/dfprvct2_2_vfpv2.mmp
kernel/eka/compsupp/rvct2_2/dllexp.cpp
kernel/eka/compsupp/rvct2_2/drtaeabi.cpp
kernel/eka/compsupp/rvct2_2/drtaeabi.mmp
kernel/eka/compsupp/rvct2_2/drtrvct2_2.cpp
kernel/eka/compsupp/rvct2_2/drtrvct2_2.mmp
kernel/eka/compsupp/rvct2_2/drtrvct2_2_common.mmh
kernel/eka/compsupp/rvct2_2/drtrvct2_2_vfpv2.mmp
kernel/eka/compsupp/rvct2_2/ksrt2_2.mmp
kernel/eka/compsupp/rvct2_2/rtabort.cpp
kernel/eka/compsupp/rvct2_2/rtdiv0.cpp
kernel/eka/compsupp/rvct2_2/rte32dll.cpp
kernel/eka/compsupp/rvct2_2/rtexit.cpp
kernel/eka/compsupp/rvct2_2/rtlib.cpp
kernel/eka/compsupp/rvct2_2/rtopdel.cpp
kernel/eka/compsupp/rvct2_2/rtopnew.cpp
kernel/eka/compsupp/rvct2_2/rtraise.cpp
kernel/eka/compsupp/rvct2_2/rvct2_2.h
kernel/eka/compsupp/rvct2_2/sftfpini.cpp
kernel/eka/compsupp/rvct2_2/type_info.cpp
kernel/eka/compsupp/rvct2_2/ucppfini.cpp
kernel/eka/compsupp/rvct2_2/ucppinit.cpp
kernel/eka/compsupp/rvct2_2/ucppinit_aeabi.cpp
kernel/eka/compsupp/rvct2_2/usrt2_2.mmp
kernel/eka/compsupp/rvct3_1/aeabidiv0.cpp
kernel/eka/compsupp/rvct3_1/aeabimem.cia
kernel/eka/compsupp/rvct3_1/call_via_rx/r0.cpp
kernel/eka/compsupp/rvct3_1/call_via_rx/r1.cpp
kernel/eka/compsupp/rvct3_1/call_via_rx/r2.cpp
kernel/eka/compsupp/rvct3_1/call_via_rx/r3.cpp
kernel/eka/compsupp/rvct3_1/call_via_rx/r4.cpp
kernel/eka/compsupp/rvct3_1/call_via_rx/r5.cpp
kernel/eka/compsupp/rvct3_1/call_via_rx/r6.cpp
kernel/eka/compsupp/rvct3_1/call_via_rx/r7.cpp
kernel/eka/compsupp/rvct3_1/dfpaeabi.mmp
kernel/eka/compsupp/rvct3_1/dfpaeabi_common.mmh
kernel/eka/compsupp/rvct3_1/dfpaeabi_vfpv2.mmp
kernel/eka/compsupp/rvct3_1/dfprvct.cpp
kernel/eka/compsupp/rvct3_1/dfprvct.mmp
kernel/eka/compsupp/rvct3_1/dfprvct_common.mmh
kernel/eka/compsupp/rvct3_1/dfprvct_vfpv2.mmp
kernel/eka/compsupp/rvct3_1/dllexp.cpp
kernel/eka/compsupp/rvct3_1/drtaeabi.cpp
kernel/eka/compsupp/rvct3_1/drtaeabi.mmp
kernel/eka/compsupp/rvct3_1/drtrvct.mmp
kernel/eka/compsupp/rvct3_1/drtrvct_common.mmh
kernel/eka/compsupp/rvct3_1/drtrvct_vfpv2.mmp
kernel/eka/compsupp/rvct3_1/ksrt.mmp
kernel/eka/compsupp/rvct3_1/no_extras.cpp
kernel/eka/compsupp/rvct3_1/rtabort.cpp
kernel/eka/compsupp/rvct3_1/rtdiv0.cpp
kernel/eka/compsupp/rvct3_1/rtexit.cpp
kernel/eka/compsupp/rvct3_1/rtraise.cpp
kernel/eka/compsupp/rvct3_1/sftfpini.cpp
kernel/eka/compsupp/rvct3_1/type_info.cpp
kernel/eka/compsupp/rvct3_1/ucppfini.cpp
kernel/eka/compsupp/rvct3_1/ucppinit.cpp
kernel/eka/compsupp/rvct3_1/usrt.mmp
kernel/eka/compsupp/symaehabi/basics.h
kernel/eka/compsupp/symaehabi/callfirstprocessfn.cpp
kernel/eka/compsupp/symaehabi/symbian_rtti.cpp
kernel/eka/compsupp/symaehabi/symbian_support.cpp
kernel/eka/compsupp/symaehabi/symbian_support.h
kernel/eka/compsupp/symcpp/rtopdel.cpp
kernel/eka/compsupp/symcpp/rtopnew.cpp
kernel/eka/compsupp/symcpp/scppnwdl.mmp
kernel/eka/compsupp/symcpp/symcpp.h
kernel/eka/drivers/bsp/bld.inf
kernel/eka/drivers/dma/dma2_lib.mmp
kernel/eka/drivers/dma/dma2_pil.cpp
kernel/eka/drivers/dma/dma2_shared.cpp
kernel/eka/drivers/dma/dmapil.cpp
kernel/eka/drivers/hcr/hcr_debug.h
kernel/eka/drivers/hcr/hcr_hai.h
kernel/eka/drivers/hcr/hcr_pil.h
kernel/eka/drivers/hcr/hcr_uids.h
kernel/eka/eabi/dma2u.def
kernel/eka/include/cpudefs.h
kernel/eka/include/d32comm.h
kernel/eka/include/d32public.h
kernel/eka/include/d32usbdi_errors.h
kernel/eka/include/drivers/dma.h
kernel/eka/include/drivers/dma.inl
kernel/eka/include/drivers/dma_compat.inl
kernel/eka/include/drivers/dma_hai.h
kernel/eka/include/drivers/dma_hai.inl
kernel/eka/include/drivers/dma_v1.h
kernel/eka/include/drivers/dma_v1.inl
kernel/eka/include/drivers/dma_v2.h
kernel/eka/include/drivers/dma_v2.inl
kernel/eka/include/drivers/dmadefs.h
kernel/eka/include/e32ver.h
kernel/eka/include/kernel/arm/bootcpu.inc
kernel/eka/include/kernel/cache_maintenance.h
kernel/eka/include/kernel/kernel.h
kernel/eka/include/nkern/nk_cpu.h
kernel/eka/include/nkern/nk_priv.h
kernel/eka/include/nkernsmp/nk_priv.h
kernel/eka/kernel/arm/cache_external.cpp
kernel/eka/kernel/arm/cache_maintenancev7.cia
kernel/eka/kernel/sipc.cpp
kernel/eka/kernel/skernel.cpp
kernel/eka/kernel/sshbuf.cpp
kernel/eka/kernel/sthread.cpp
kernel/eka/kernel/sutils.cpp
kernel/eka/memmodel/epoc/flexible/arm/xsched.cia
kernel/eka/memmodel/epoc/flexible/mmu/arm/xmmu.cpp
kernel/eka/memmodel/epoc/flexible/mmu/mmu.cpp
kernel/eka/memmodel/epoc/flexible/mmu/x86/xmmu.cpp
kernel/eka/memmodel/epoc/flexible/mprocess.cpp
kernel/eka/memmodel/epoc/flexible/mshbuf.cpp
kernel/eka/memmodel/epoc/flexible/x86/xsched.cia
kernel/eka/memmodel/epoc/mmubase/ramalloc.cpp
kernel/eka/memmodel/epoc/moving/arm/xmmu.cpp
kernel/eka/memmodel/epoc/moving/mchunk.cpp
kernel/eka/nkern/arm/ncutils.cia
kernel/eka/nkern/nk_timer.cpp
kernel/eka/nkernsmp/nk_irq.cpp
kernel/eka/release.txt
kernel/eka/rombuild/btrace.iby
kernel/eka/rombuild/ubootldr.oby
kerneltest/e32test/defrag/d_pagemove.cpp
kerneltest/e32test/defrag/d_pagemove.h
kerneltest/e32test/dma/d_dma.cpp
kerneltest/e32test/dma/t_dma.cpp
kerneltest/e32test/dmav2/cap_reqs.h
kerneltest/e32test/dmav2/d_dma2.cpp
kerneltest/e32test/dmav2/d_dma2.h
kerneltest/e32test/dmav2/d_dma2_cmn.cpp
kerneltest/e32test/dmav2/dma_api_tests.cpp
kerneltest/e32test/dmav2/self_test.cpp
kerneltest/e32test/dmav2/t_dma2.cpp
kerneltest/e32test/dmav2/t_dma2.h
kerneltest/e32test/dmav2/test_cases.cpp
kerneltest/e32test/dmav2/test_thread.cpp
kerneltest/e32test/dmav2/test_thread.h
kerneltest/e32test/group/bld.inf
kerneltest/e32test/group/d_dma2.mmp
kerneltest/e32test/group/d_dma2_compat.mmp
kerneltest/e32test/group/d_dma_compat.mmp
kerneltest/e32test/group/smpsafea.mmp
kerneltest/e32test/group/smpsafeb.mmp
kerneltest/e32test/group/smpsafec.mmp
kerneltest/e32test/group/smpsafed.mmp
kerneltest/e32test/group/smpsafee.mmp
kerneltest/e32test/group/smpsafexa.mmp
kerneltest/e32test/group/t_alias_remove.mmp
kerneltest/e32test/group/t_dma2.mmp
kerneltest/e32test/group/t_smpsafe.mmp
kerneltest/e32test/group/t_smpsoakspin.mmp
kerneltest/e32test/misc/inflate.c
kerneltest/e32test/misc/t_cputime.cpp
kerneltest/e32test/mmu/t_alias_remove.cpp
kerneltest/e32test/smpsoak/t_smpsoak.cpp
kerneltest/e32test/smpsoak/t_smpsoakspin.cpp
kerneltest/e32test/system/t_dobject.cpp
kerneltest/e32test/thread/smpsafe.cpp
kerneltest/f32test/bench/t_notify_perf_impl.cpp
kerneltest/f32test/demandpaging/t_clamp.cpp
kerneltest/f32test/demandpaging/t_denyclamp.cpp
kerneltest/f32test/filesystem/automounter/t_automounter.cpp
kerneltest/f32test/plugins/version_2/inc/modifier_plugin.h
kerneltest/f32test/plugins/version_2/inc/plugincommon.h
kerneltest/f32test/plugins/version_2/src/modifier_plugin.cpp
kerneltest/f32test/plugins/version_2/src/premodifier_plugin.cpp
kerneltest/f32test/plugins/version_2/src/t_plugin_v2.cpp
userlibandfileserver/fileserver/automounter/automounter.mmp
userlibandfileserver/fileserver/bmarm/efileu.def
userlibandfileserver/fileserver/bwins/efileu.def
userlibandfileserver/fileserver/bx86/efileu.def
userlibandfileserver/fileserver/eabi/efileu.def
userlibandfileserver/fileserver/fs_utils/bit_vector.cpp
userlibandfileserver/fileserver/fs_utils/bit_vector.h
userlibandfileserver/fileserver/fs_utils/filesystem_utils.cpp
userlibandfileserver/fileserver/fs_utils/filesystem_utils.h
userlibandfileserver/fileserver/fs_utils/filesystem_utils.inl
userlibandfileserver/fileserver/group/base_f32.mrp
userlibandfileserver/fileserver/group/release.txt
userlibandfileserver/fileserver/inc/F32plugin.h
userlibandfileserver/fileserver/inc/f32file.h
userlibandfileserver/fileserver/inc/f32notification.h
userlibandfileserver/fileserver/inc/f32ver.h
userlibandfileserver/fileserver/inc/filesystem_utils.h
userlibandfileserver/fileserver/inc/filesystem_utils.inl
userlibandfileserver/fileserver/sfat32/common_constants.h
userlibandfileserver/fileserver/sfat32/efat32.mmp
userlibandfileserver/fileserver/sfat32/fat_table32.cpp
userlibandfileserver/fileserver/sfat32/filesystem_fat.h
userlibandfileserver/fileserver/sfat32/inc/fat_table32.h
userlibandfileserver/fileserver/sfat32/inc/sl_scandrv.h
userlibandfileserver/fileserver/sfat32/inc/sl_std.h
userlibandfileserver/fileserver/sfat32/inc/sl_std.inl
userlibandfileserver/fileserver/sfat32/ram_fat_table32.cpp
userlibandfileserver/fileserver/sfat32/sl_fatcache.h
userlibandfileserver/fileserver/sfat32/sl_fatcache.inl
userlibandfileserver/fileserver/sfat32/sl_mnt.cpp
userlibandfileserver/fileserver/sfat32/sl_scan32.cpp
userlibandfileserver/fileserver/sfat32/sl_utl.cpp
userlibandfileserver/fileserver/sfile/sf_drv.cpp
userlibandfileserver/fileserver/sfile/sf_memory_client.cpp
userlibandfileserver/fileserver/sfile/sf_memory_man.h
userlibandfileserver/fileserver/sfile/sf_ops.h
userlibandfileserver/fileserver/sfile/sf_plugin_shim.cpp
userlibandfileserver/fileserver/sfsrv/cl_clamp.cpp
userlibandfileserver/fileserver/sfsrv/cl_cli.cpp
userlibandfileserver/fileserver/sfsrv/cl_plugin.cpp
userlibandfileserver/fileserver/swins/elocal.cpp
--- a/brdbootldr/ubootldr/inflate.c	Thu Jan 07 13:38:45 2010 +0200
+++ b/brdbootldr/ubootldr/inflate.c	Mon Jan 18 21:31:10 2010 +0200
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /* inflate.c -- Not copyrighted 1992 by Mark Adler
    version c10p1, 10 January 1993 */
 
--- a/bsptemplate/asspandvariant/template_assp/dma.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/bsptemplate/asspandvariant/template_assp/dma.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -12,7 +12,7 @@
 //
 // Description:
 // template/template_assp/dma.mmp
-// 
+//
 //
 
 #include		<variant.mmh>
@@ -27,17 +27,19 @@
 noexportlibrary
 
 sourcepath		../../../kernel/eka/drivers/dma
-source			dmapil.cpp
+source			dma2_pil.cpp dma2_shared.cpp
 
 sourcepath		.
 source			dmapsl.cpp
 
 library			VariantTarget(katemplate,lib)
 
-deffile			../../../kernel/eka/~/dma.def
+deffile			../../../kernel/eka/~/dma2.def
 
 epocallowdlldata
 
 capability		all
 
 VENDORID 0x70000001
+
+MACRO DMA_APIV2
--- a/bsptemplate/asspandvariant/template_assp/dmapsl.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/bsptemplate/asspandvariant/template_assp/dmapsl.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -11,23 +11,26 @@
 // Contributors:
 //
 // Description:
-// template\template_assp\dmapsl.cpp
+// bsptemplate/asspvariant/template_assp/dmapsl.cpp
 // Template DMA Platform Specific Layer (PSL).
-// 
+//
 //
 
 
 #include <kernel/kern_priv.h>
 #include <template_assp.h>									// /assp/template_assp/
+
 #include <drivers/dma.h>
+#include <drivers/dma_hai.h>
+
 
 // Debug support
-static const char KDmaPanicCat[] = "DMA PSL";
+static const char KDmaPanicCat[] = "DMA PSL - " __FILE__;
 
-static const TInt KMaxTransferLen = 0x1FE0;					// max transfer length for this DMAC
-static const TInt KMemAlignMask = 7;				  // memory addresses passed to DMAC must be multiple of 8
-static const TInt KChannelCount = 16;						// we got 16 channels
-static const TInt KDesCount = 1024;							// DMA descriptor count
+static const TInt KMaxTransferLen = 0x1FE0;	// max transfer length for this DMAC
+static const TInt KMemAlignMask = 7; // memory addresses passed to DMAC must be multiple of 8
+static const TInt KChannelCount = 16;			// we got 16 channels
+static const TInt KDesCount = 160;				// Initial DMA descriptor count
 
 
 class TDmaDesc
@@ -49,6 +52,9 @@
 // Test Support
 //////////////////////////////////////////////////////////////////////////////
 
+/**
+TO DO: Fill in to provide information to the V1 test harness (t_dma.exe)
+*/
 TDmaTestInfo TestInfo =
 	{
 	0,
@@ -71,6 +77,26 @@
 	return TestInfo;
 	}
 
+/**
+TO DO: Fill in to provide information to the V2 test harness (t_dma2.exe)
+*/
+TDmaV2TestInfo TestInfov2 =
+	{
+	0,
+	0,
+	0,
+	0,
+	{0},
+	0,
+	{0},
+	0,
+	{0}
+	};
+
+EXPORT_C const TDmaV2TestInfo& DmaTestInfoV2()
+	{
+	return TestInfov2;
+	}
 
 //////////////////////////////////////////////////////////////////////////////
 // Helper Functions
@@ -85,14 +111,14 @@
 	}
 
 
-static TUint32 DcmdReg(TInt aCount, TUint aFlags, TUint32 aPslInfo)
+static TUint32 DmaCmdReg(TUint aCount, TUint aFlags, TUint32 aSrcPslInfo, TUint32 aDstPslInfo)
 //
 // Returns value to set in DMA command register or in descriptor command field.
 //
 	{
 	// TO DO: Construct CMD word from input values.
 	// The return value should reflect the actual control word.
-	return (aCount | aFlags | aPslInfo);
+	return (aCount | aFlags | aSrcPslInfo | aDstPslInfo);
 	}
 
 
@@ -119,14 +145,15 @@
 	TInt Create();
 private:
 	// from TDmac (PIL pure virtual)
-	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr);
 	virtual void StopTransfer(const TDmaChannel& aChannel);
 	virtual TBool IsIdle(const TDmaChannel& aChannel);
-	virtual TInt MaxTransferSize(TDmaChannel& aChannel, TUint aFlags, TUint32 aPslInfo);
-	virtual TUint MemAlignMask(TDmaChannel& aChannel, TUint aFlags, TUint32 aPslInfo);
+	virtual TUint MaxTransferLength(TDmaChannel& aChannel, TUint aSrcFlags,
+									TUint aDstFlags, TUint32 aPslInfo);
+	virtual TUint AddressAlignMask(TDmaChannel& aChannel, TUint aSrcFlags,
+								   TUint aDstFlags, TUint32 aPslInfo);
 	// from TDmac (PIL virtual)
-	virtual void InitHwDes(const SDmaDesHdr& aHdr, TUint32 aSrc, TUint32 aDest, TInt aCount,
- 						   TUint aFlags, TUint32 aPslInfo, TUint32 aCookie);
+	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr);
+	virtual TInt InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
 	virtual void ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr);
 	virtual void AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr,
 							 const SDmaDesHdr& aNewHdr);
@@ -140,15 +167,16 @@
 	TTemplateSgChannel iChannels[KChannelCount];
 	};
 
+
 static TTemplateDmac Controller;
 
+
 const TDmac::SCreateInfo TTemplateDmac::KInfo =
 	{
-	KChannelCount,
-	KDesCount,
-	TDmac::KCapsBitHwDes,
-	sizeof(TDmaDesc),
-	EMapAttrSupRw | EMapAttrFullyBlocking
+	ETrue,													// iCapsHwDes
+	KDesCount,												// iDesCount
+	sizeof(TDmaDesc),										// iDesSize
+	EMapAttrSupRw | EMapAttrFullyBlocking					// iDesChunkAttribs
 	};
 
 
@@ -173,7 +201,7 @@
 			{
 			TDmaDesc* pD = HdrToHwDes(*iFreeHdr);
 			iChannels[i].iTmpDes = pD;
-			iChannels[i].iTmpDesPhysAddr = DesLinToPhys(pD);
+			iChannels[i].iTmpDesPhysAddr = HwDesLinToPhys(pD);
 			iFreeHdr = iFreeHdr->iNext;
 			}
 		r = Interrupt::Bind(EAsspIntIdDma, Isr, this);
@@ -237,9 +265,10 @@
 	}
 
 
-TInt TTemplateDmac::MaxTransferSize(TDmaChannel& /*aChannel*/, TUint /*aFlags*/, TUint32 /*aPslInfo*/)
+TUint TTemplateDmac::MaxTransferLength(TDmaChannel& /*aChannel*/, TUint /*aSrcFlags*/,
+									   TUint /*aDstFlags*/, TUint32 /*aPslInfo*/)
 //
-// Returns the maximum transfer size for a given transfer.
+// Returns the maximum transfer length in bytes for a given transfer.
 //
 	{
 	// TO DO: Determine the proper return value, based on the arguments.
@@ -249,7 +278,8 @@
 	}
 
 
-TUint TTemplateDmac::MemAlignMask(TDmaChannel& /*aChannel*/, TUint /*aFlags*/, TUint32 /*aPslInfo*/)
+TUint TTemplateDmac::AddressAlignMask(TDmaChannel& aChannel, TUint /*aSrcFlags*/,
+									  TUint /*aDstFlags*/, TUint32 /*aPslInfo*/)
 //
 // Returns the memory buffer alignment restrictions mask for a given transfer.
 //
@@ -261,12 +291,12 @@
 	}
 
 
-void TTemplateDmac::InitHwDes(const SDmaDesHdr& aHdr, TUint32 aSrc, TUint32 aDest, TInt aCount,
-							  TUint aFlags, TUint32 aPslInfo, TUint32 /*aCookie*/)
+TInt TTemplateDmac::InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs)
 //
-// Sets up (from a passed in request) the descriptor with that fragment's source and destination address,
-// the fragment size, and the (driver/DMA controller) specific transfer parameters (mem/peripheral,
-// burst size, transfer width).
+// Sets up (from a passed in request) the descriptor with that fragment's
+// source and destination address, the fragment size, and the (driver/DMA
+// controller) specific transfer parameters (mem/peripheral, burst size,
+// transfer width).
 //
 	{
 	TDmaDesc* pD = HdrToHwDes(aHdr);
@@ -276,10 +306,15 @@
 	// Unaligned descriptor? Bug in generic layer!
 	__DMA_ASSERTD(IsHwDesAligned(pD));
 
-	pD->iSrcAddr = (aFlags & KDmaPhysAddrSrc) ? aSrc : Epoc::LinearToPhysical(aSrc);
-	pD->iDestAddr = (aFlags & KDmaPhysAddrDest) ? aDest : Epoc::LinearToPhysical(aDest);
-	pD->iCmd = DcmdReg(aCount, aFlags, aPslInfo);
+	const TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
+	const TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
+	pD->iSrcAddr  = (src.iFlags & KDmaPhysAddr) ? src.iAddr : Epoc::LinearToPhysical(src.iAddr);
+	pD->iDestAddr = (dst.iFlags & KDmaPhysAddr) ? dst.iAddr : Epoc::LinearToPhysical(dst.iAddr);
+	pD->iCmd = DmaCmdReg(aTransferArgs.iTransferCount, aTransferArgs.iFlags,
+					   src.iPslTargetInfo, dst.iPslTargetInfo);
 	pD->iDescAddr = TDmaDesc::KStopBitMask;
+
+	return KErrNone;
 	}
 
 
@@ -299,7 +334,7 @@
 
 	// TO DO: Modify pD->iCmd so that no end-of-transfer interrupt gets raised any longer.
 
-	pD->iDescAddr = DesLinToPhys(pN);
+	pD->iDescAddr = HwDesLinToPhys(pN);
 	}
 
 
@@ -319,7 +354,7 @@
 	// Unaligned descriptor? Bug in generic layer!
 	__DMA_ASSERTD(IsHwDesAligned(pL) && IsHwDesAligned(pN));
 
-	TPhysAddr newPhys = DesLinToPhys(pN);
+	TPhysAddr newPhys = HwDesLinToPhys(pN);
 
 	const TInt irq = NKern::DisableAllInterrupts();
 	StopTransfer(aChannel);
@@ -363,7 +398,7 @@
 
 	// TO DO: Implement the behaviour described above, call HandleIsr().
 
-	HandleIsr(me.iChannels[5], 0);							// Example
+	HandleIsr(me.iChannels[5], EDmaCallbackRequestCompletion, ETrue); // Example
 
 	}
 
@@ -381,7 +416,7 @@
 // Channel Opening/Closing (Channel Allocator)
 //////////////////////////////////////////////////////////////////////////////
 
-TDmaChannel* DmaChannelMgr::Open(TUint32 aOpenId)
+TDmaChannel* DmaChannelMgr::Open(TUint32 aOpenId, TBool /*aDynChannel*/, TUint /*aPriority*/)
 //
 //
 //
@@ -392,7 +427,9 @@
 
 	TDmaChannel* pC = Controller.iChannels + aOpenId;
 	if (pC->IsOpened())
+		{
 		pC = NULL;
+		}
 	else
 		{
 		pC->iController = &Controller;
@@ -403,7 +440,7 @@
 	}
 
 
-void DmaChannelMgr::Close(TDmaChannel* /* aChannel */)
+void DmaChannelMgr::Close(TDmaChannel* /*aChannel*/)
 //
 //
 //
@@ -412,7 +449,7 @@
 	}
 
 
-TInt DmaChannelMgr::StaticExtension(TInt /* aCmd */, TAny* /* aArg */)
+TInt DmaChannelMgr::StaticExtension(TInt /*aCmd*/, TAny* /*aArg*/)
 //
 //
 //
@@ -432,5 +469,10 @@
 	{
 	__KTRACE_OPT2(KBOOT, KDMA, Kern::Printf("Starting DMA Extension"));
 
+	const TInt r = DmaChannelMgr::Initialise();
+	if (r != KErrNone)
+		{
+		return r;
+		}
 	return Controller.Create();
 	}
--- a/kernel/eka/bld.inf	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/bld.inf	Mon Jan 18 21:31:10 2010 +0200
@@ -201,7 +201,14 @@
 include/drivers/ethernet.h						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
 include/drivers/ethernet.inl					SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
 include/drivers/dma.h							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
-include/drivers/dma.inl							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
+include/drivers/dma_v1.h						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
+include/drivers/dma_v1.inl						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
+include/drivers/dma_v2.h						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
+include/drivers/dma_v2.inl						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
+include/drivers/dmadefs.h						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
+include/drivers/dma_compat.inl					SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
+include/drivers/dma_hai.h						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
+include/drivers/dma_hai.inl						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
 include/drivers/iic.h							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
 include/drivers/iic.inl							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
 include/drivers/iic_channel.h					SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/)
@@ -340,6 +347,7 @@
 include/d32soundsc.inl							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(d32soundsc.inl)
 include/e32msgqueue.h							SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(e32msgqueue.h)
 include/e32msgqueue.inl							SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(e32msgqueue.inl)
+include/d32public.h								SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(d32public.h)
 include/d32usbcshared.h							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(d32usbcshared.h)
 include/d32usbcshared.inl						SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(d32usbcshared.inl)
 include/d32usbcsc.h								SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(d32usbcsc.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/bmarm/dma2u.def	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,45 @@
+EXPORTS
+	__18TDmaTransferConfigUlUiUiUiiiUiUi13TDmaBurstSizeUiUii @ 1 NONAME ; TDmaTransferConfig::TDmaTransferConfig(unsigned long, unsigned int, unsigned int, unsigned int, int, int, unsigned int, unsigned int, TDmaBurstSize, unsigned int, unsigned int, int)
+	CancelAll__11TDmaChannel @ 2 NONAME R3UNUSED ; TDmaChannel::CancelAll(void)
+	Close__11TDmaChannel @ 3 NONAME R3UNUSED ; TDmaChannel::Close(void)
+	DisableDstElementCounting__11DDmaRequest @ 4 NONAME R3UNUSED ; DDmaRequest::DisableDstElementCounting(void)
+	DisableSrcElementCounting__11DDmaRequest @ 5 NONAME R3UNUSED ; DDmaRequest::DisableSrcElementCounting(void)
+	DmaTestInfoV2__Fv @ 6 NONAME R3UNUSED ; DmaTestInfoV2(void)
+	DmaTestInfo__Fv @ 7 NONAME R3UNUSED ; DmaTestInfo(void)
+	DmacCaps__11TDmaChannel @ 8 NONAME R3UNUSED ; TDmaChannel::DmacCaps(void)
+	DstFragmentCount__11DDmaRequest @ 9 NONAME R3UNUSED ; DDmaRequest::DstFragmentCount(void)
+	EnableDstElementCounting__11DDmaRequesti @ 10 NONAME R3UNUSED ; DDmaRequest::EnableDstElementCounting(int)
+	EnableSrcElementCounting__11DDmaRequesti @ 11 NONAME R3UNUSED ; DDmaRequest::EnableSrcElementCounting(int)
+	ExpandDesList__11DDmaRequesti @ 12 NONAME R3UNUSED ; DDmaRequest::ExpandDesList(int)
+	ExpandDstDesList__11DDmaRequesti @ 13 NONAME R3UNUSED ; DDmaRequest::ExpandDstDesList(int)
+	ExpandSrcDesList__11DDmaRequesti @ 14 NONAME R3UNUSED ; DDmaRequest::ExpandSrcDesList(int)
+	Extension__11TDmaChanneliPv @ 15 NONAME R3UNUSED ; TDmaChannel::Extension(int, void *)
+	FailNext__11TDmaChanneli @ 16 NONAME R3UNUSED ; TDmaChannel::FailNext(int)
+	FragmentCount__11DDmaRequest @ 17 NONAME R3UNUSED ; DDmaRequest::FragmentCount(void)
+	Fragment__11DDmaRequestRC16TDmaTransferArgs @ 18 NONAME R3UNUSED ; DDmaRequest::Fragment(TDmaTransferArgs const &)
+	Fragment__11DDmaRequestUlUliUiUl @ 19 NONAME ; DDmaRequest::Fragment(unsigned long, unsigned long, int, unsigned int, unsigned long)
+	FreeDesList__11DDmaRequest @ 20 NONAME R3UNUSED ; DDmaRequest::FreeDesList(void)
+	FreeDstDesList__11DDmaRequest @ 21 NONAME R3UNUSED ; DDmaRequest::FreeDstDesList(void)
+	FreeSrcDesList__11DDmaRequest @ 22 NONAME R3UNUSED ; DDmaRequest::FreeSrcDesList(void)
+	IsrRedoRequest__11TDmaChannelUlUlUiUli @ 23 NONAME ; TDmaChannel::IsrRedoRequest(unsigned long, unsigned long, unsigned int, unsigned long, int)
+	LinkToChannel__11TDmaChannelP11TDmaChannel @ 24 NONAME R3UNUSED ; TDmaChannel::LinkToChannel(TDmaChannel *)
+	MaxTransferLength__11TDmaChannelUiUiUl @ 25 NONAME ; TDmaChannel::MaxTransferLength(unsigned int, unsigned int, unsigned long)
+	MissNextInterrupts__11TDmaChanneli @ 26 NONAME R3UNUSED ; TDmaChannel::MissNextInterrupts(int)
+	Open__11TDmaChannelRCQ211TDmaChannel11SCreateInfoRP11TDmaChannel @ 27 NONAME R3UNUSED ; TDmaChannel::Open(TDmaChannel::SCreateInfo const &, TDmaChannel *&)
+	Pause__11TDmaChannel @ 28 NONAME R3UNUSED ; TDmaChannel::Pause(void)
+	Queue__11DDmaRequest @ 29 NONAME R3UNUSED ; DDmaRequest::Queue(void)
+	Resume__11TDmaChannel @ 30 NONAME R3UNUSED ; TDmaChannel::Resume(void)
+	SrcFragmentCount__11DDmaRequest @ 31 NONAME R3UNUSED ; DDmaRequest::SrcFragmentCount(void)
+	StaticExtension__11TDmaChanneliPv @ 32 NONAME R3UNUSED ; TDmaChannel::StaticExtension(int, void *)
+	TotalNumDstElementsTransferred__11DDmaRequest @ 33 NONAME R3UNUSED ; DDmaRequest::TotalNumDstElementsTransferred(void)
+	TotalNumSrcElementsTransferred__11DDmaRequest @ 34 NONAME R3UNUSED ; DDmaRequest::TotalNumSrcElementsTransferred(void)
+	"_._11DDmaRequest" @ 35 NONAME R3UNUSED ; DDmaRequest::~DDmaRequest(void)
+	__11DDmaRequestR11TDmaChannelPFQ211DDmaRequest7TResultPv_vPvi @ 36 NONAME ; DDmaRequest::DDmaRequest(TDmaChannel &, void (*)(DDmaRequest::TResult, void *), void *, int)
+	__11DDmaRequestR11TDmaChannelPFUi10TDmaResultPvP10SDmaDesHdr_vPvUi @ 37 NONAME ; DDmaRequest::DDmaRequest(TDmaChannel &, void (*)(unsigned int, TDmaResult, void *, SDmaDesHdr *), void *, unsigned int)
+	__16TDmaTransferArgs @ 38 NONAME R3UNUSED ; TDmaTransferArgs::TDmaTransferArgs(void)
+	__16TDmaTransferArgsRC18TDmaTransferConfigT1UlUiUi15TDmaGraphicsOpsUl @ 39 NONAME ; TDmaTransferArgs::TDmaTransferArgs(TDmaTransferConfig const &, TDmaTransferConfig const &, unsigned long, unsigned int, unsigned int, TDmaGraphicsOps, unsigned long)
+	__16TDmaTransferArgsUiUiUiUiUiUi12TDmaAddrModeUiUi13TDmaBurstSizeUi15TDmaGraphicsOpsUl @ 40 NONAME ; TDmaTransferArgs::TDmaTransferArgs(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, TDmaAddrMode, unsigned int, unsigned int, TDmaBurstSize, unsigned int, TDmaGraphicsOps, unsigned long)
+	__18TDmaTransferConfig @ 41 NONAME R3UNUSED ; TDmaTransferConfig::TDmaTransferConfig(void)
+	__18TDmaTransferConfigUlUi12TDmaAddrModeUi13TDmaBurstSizeUiUiUii @ 42 NONAME ; TDmaTransferConfig::TDmaTransferConfig(unsigned long, unsigned int, TDmaAddrMode, unsigned int, TDmaBurstSize, unsigned int, unsigned int, unsigned int, int)
+	AddressAlignMask__11TDmaChannelUiUiUl @ 43 NONAME ; TDmaChannel::AddressAlignMask(unsigned int, unsigned int, unsigned long)
+
--- a/kernel/eka/compsupp/bld.inf	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/bld.inf	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* Compiler runtime support.
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Compiler runtime support.
+// 
+//
 
 PRJ_PLATFORMS
 
--- a/kernel/eka/compsupp/compsupp.iby	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/compsupp.iby	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,21 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file contains the compiler's run-time support libraries.
-*
-*/
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file contains the compiler's run-time support libraries.
+// 
+//
 
+// Make the file acceptable to "e32/rombuild/rom.bat."
 #if defined(COMPSUPP_DIR) && defined(BUILD)
 #   define ABI_DIR      \Epoc32\Release\##COMPSUPP_DIR
 #   define DEBUG_DIR    BUILD
--- a/kernel/eka/compsupp/gcce/gcce.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/gcce/gcce.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* e32\compsupp\gcce\gcce.h
-* This is the preinclude file for the GCC-E compiler
-* It contains all the compiler specific definitions required by the SOS source
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\compsupp\gcce\gcce.h
+// This is the preinclude file for the GCC-E compiler
+// It contains all the compiler specific definitions required by the SOS source
+// 
+//
 
 /**
  @file
--- a/kernel/eka/compsupp/rvct.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This is the preinclude file for the RVCT compiler. It contains all the compiler
-* specific definitions required by the Symbian OS source code.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the preinclude file for the RVCT compiler. It contains all the compiler
+// specific definitions required by the Symbian OS source code.
+// 
+//
 
 /**
  @file
--- a/kernel/eka/compsupp/rvct/aeabidiv0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/aeabidiv0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtaeabi.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtaeabi.dll.
+// 
+//
 
 #include <e32std.h>
 
--- a/kernel/eka/compsupp/rvct/aeabimem.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/aeabimem.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtaeabi.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtaeabi.dll.
+// 
+//
 
 #include <e32cmn.h>
 
--- a/kernel/eka/compsupp/rvct/call_via_rx/r0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/call_via_rx/r0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct/call_via_rx/r1.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/call_via_rx/r1.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct/call_via_rx/r2.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/call_via_rx/r2.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct/call_via_rx/r3.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/call_via_rx/r3.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct/call_via_rx/r4.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/call_via_rx/r4.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct/call_via_rx/r5.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/call_via_rx/r5.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct/call_via_rx/r6.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/call_via_rx/r6.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct/call_via_rx/r7.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/call_via_rx/r7.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct/dfpaeabi.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/dfpaeabi.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfpaeabi_common.mmh"
 
@@ -22,7 +19,7 @@
 target          dfpaeabi.dll
 
 start armcc
-    #if defined(ARMCC_3_1)
+    #if defined(ARMCC_3_1) || defined(ARMCC_4_0)
     ARMLIBS     fj_5s.l
 
     #else
--- a/kernel/eka/compsupp/rvct/dfpaeabi_common.mmh	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/dfpaeabi_common.mmh	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 targettype      dll
 
@@ -26,7 +23,7 @@
     armrt
     arminc
 
-    #if defined(ARMCC_3_1)
+    #if defined(ARMCC_3_1) || defined(ARMCC_4_0)
     armlibs     c_5.l
 
     #else
--- a/kernel/eka/compsupp/rvct/dfpaeabi_vfpv2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/dfpaeabi_vfpv2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfpaeabi_common.mmh"
 
@@ -24,7 +21,7 @@
 noexportlibrary
 
 start armcc
-    #if defined (ARMCC_3_1)
+    #if defined (ARMCC_3_1) || defined(ARMCC_4_0)
     armlibs     fj_5v.l
 
     #else
--- a/kernel/eka/compsupp/rvct/dfprvct-thunk.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/dfprvct-thunk.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,20 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
+// This file is part of dfprvct-thunk.dll.
+//
 
 
 extern "C"
--- a/kernel/eka/compsupp/rvct/dfprvct-thunk.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/dfprvct-thunk.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,18 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// 
+//
 
 target 			dfprvct-thunk.dll
 targettype		dll
--- a/kernel/eka/compsupp/rvct/dfprvct.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/dfprvct.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,18 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of dfprvct.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of dfprvct.dll.
+//
 
 #if __ARMCC_VERSION > 300000
 
--- a/kernel/eka/compsupp/rvct/dfprvct.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/dfprvct.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfprvct_common.mmh"
 
--- a/kernel/eka/compsupp/rvct/dfprvct_common.mmh	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/dfprvct_common.mmh	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 
 targettype      dll
--- a/kernel/eka/compsupp/rvct/dfprvct_vfpv2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/dfprvct_vfpv2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfprvct_common.mmh"
 
--- a/kernel/eka/compsupp/rvct/dllexp.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/dllexp.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 
 extern "C" void __DLL_Export_Table__() { }  // This function (and the whole file)
--- a/kernel/eka/compsupp/rvct/drtaeabi.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/drtaeabi.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtaeabi.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtaeabi.dll.
+// 
+//
 
 
 #include <e32std.h>
--- a/kernel/eka/compsupp/rvct/drtaeabi.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/drtaeabi.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 target          drtaeabi.dll
 targettype      dll
@@ -38,7 +35,7 @@
     armrt
     arminc
 
-    #if defined(ARMCC_3_1)
+    #if defined(ARMCC_3_1) || defined(ARMCC_4_0)
     armlibs     c_5.l cpprt_5.l h_5.l
 
     #elif defined(ARMCC_2_2)
--- a/kernel/eka/compsupp/rvct/drtrvct.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/drtrvct.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "drtrvct_common.mmh"
 
--- a/kernel/eka/compsupp/rvct/drtrvct_common.mmh	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/drtrvct_common.mmh	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 targettype      dll
 
--- a/kernel/eka/compsupp/rvct/drtrvct_vfpv2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/drtrvct_vfpv2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "drtrvct_common.mmh"
 
--- a/kernel/eka/compsupp/rvct/ksrt.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/ksrt.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #if defined(ARMCC_2_2)
 target          ksrt2_2.lib
--- a/kernel/eka/compsupp/rvct/no_extras.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/no_extras.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of all compsupp DLLs. It makes the linker issue an error
-* message if semihosting or heap functions get pulled in from RVCT's libraries.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of all compsupp DLLs. It makes the linker issue an error
+// message if semihosting or heap functions get pulled in from RVCT's libraries.
+// 
+//
 
 #if __ARMCC_VERSION > 300000
 #pragma import(__use_no_semihosting)
--- a/kernel/eka/compsupp/rvct/rtabort.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/rtabort.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll
+// 
+//
 
 #include <e32std.h>
 
--- a/kernel/eka/compsupp/rvct/rtdiv0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/rtdiv0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
+// 
+//
 
 #include <e32std.h>
 
--- a/kernel/eka/compsupp/rvct/rtexit.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/rtexit.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll
+// 
+//
 
 #include <e32std.h>
 
--- a/kernel/eka/compsupp/rvct/rtlib.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/rtlib.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,18 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
+//
 
 #include <e32std.h>
 
--- a/kernel/eka/compsupp/rvct/rtraise.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/rtraise.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
+// 
+//
 
 #include <e32std.h>
 #include <signal.h> // Will be found among RVCT's header files.
--- a/kernel/eka/compsupp/rvct/sftfpini.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/sftfpini.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
+// 
+//
 
 #include <e32std.h>
 
--- a/kernel/eka/compsupp/rvct/type_info.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/type_info.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtaeabi.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtaeabi.dll.
+// 
+//
 
 
 #include <typeinfo>
--- a/kernel/eka/compsupp/rvct/ucppfini.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/ucppfini.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib (but not ksrt.lib).
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib (but not ksrt.lib).
+// 
+//
 
 
 extern "C" {
--- a/kernel/eka/compsupp/rvct/ucppinit.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/ucppinit.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 
 extern "C" __asm void __cpp_initialize__aeabi_()
--- a/kernel/eka/compsupp/rvct/usrt.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct/usrt.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,20 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* usrt.mpp
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// usrt.mpp
+// 
+//
 
 #if defined(ARMCC_2_2)
 target          usrt2_2.lib
--- a/kernel/eka/compsupp/rvct2_0/callviar0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/callviar0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_0/callviar1.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/callviar1.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_0/callviar2.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/callviar2.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_0/callviar3.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/callviar3.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_0/callviar4.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/callviar4.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_0/callviar5.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/callviar5.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_0/callviar6.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/callviar6.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_0/callviar7.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/callviar7.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_0/cppinit.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/cppinit.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 /**
  @file
--- a/kernel/eka/compsupp/rvct2_0/dllexp.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/dllexp.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C" {
 
--- a/kernel/eka/compsupp/rvct2_0/ksrt.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/ksrt.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* KSRT.MPP
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// KSRT.MPP
+// 
+//
 
 ALWAYS_BUILD_AS_ARM
 
--- a/kernel/eka/compsupp/rvct2_0/rtabort.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/rtabort.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_0/rtdiv0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/rtdiv0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_0/rte32dll.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/rte32dll.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -2,21 +2,20 @@
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
 
-
 #include <e32std.h>
 #include <e32std_private.h>
 
--- a/kernel/eka/compsupp/rvct2_0/rtexit.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/rtexit.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* function the runtime can call to exit process, 'finalizing'
-* the runtime library but avoiding atexit processing.
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// function the runtime can call to exit process, 'finalizing'
+// the runtime library but avoiding atexit processing.
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_0/rtlib.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/rtlib.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* initialize and shutdown (low-level) runtime.
-* these are intended to go in user side static runtime lib
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// initialize and shutdown (low-level) runtime.
+// these are intended to go in user side static runtime lib
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_0/rtopdel.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/rtopdel.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
+//#include <stddef.h>
 #include <e32std.h>
 #include <e32std_private.h>
 //#include <e32math.h>
--- a/kernel/eka/compsupp/rvct2_0/rtopnew.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/rtopnew.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
+//#include <stddef.h>
 #include <e32std.h>
 #include <e32std_private.h>
 //#include <e32math.h>
--- a/kernel/eka/compsupp/rvct2_0/rtraise.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/rtraise.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* function the runtime can call to 'raise an exception'
-*
-*/
-
+// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// function the runtime can call to 'raise an exception'
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_0/rvct2_0.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/rvct2_0.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* e32\compsupp\rvct2_0\rvct2_0.h
-* This is the preinclude file for the rvct 2.0 compiler
-* It contains all the compiler specific definitions required by the SOS source
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\compsupp\rvct2_0\rvct2_0.h
+// This is the preinclude file for the rvct 2.0 compiler
+// It contains all the compiler specific definitions required by the SOS source
+// 
+//
 
 
 #if defined(__PRODUCT_INCLUDE__)
--- a/kernel/eka/compsupp/rvct2_0/sftfpini.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/sftfpini.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_0/ucppfini.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/ucppfini.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* toplevel destruction routines for 'user side' code compiled 
-* with the ARMEDG compiler.
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// toplevel destruction routines for 'user side' code compiled 
+// with the ARMEDG compiler.
+// 
+//
 
 #include "cppinit.h"
 
--- a/kernel/eka/compsupp/rvct2_0/ucppinit.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/ucppinit.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* toplevel initialization/destruction routines for 'user side' code compiled 
-* with the ARMEDG compiler. intended for static linking
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// toplevel initialization/destruction routines for 'user side' code compiled 
+// with the ARMEDG compiler. intended for static linking
+// 
+//
 
 #include "cppinit.h"
 
--- a/kernel/eka/compsupp/rvct2_0/udfp.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/udfp.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* UDFP.MPP
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// UDFP.MPP
+// 
+//
 
 TARGET 			udfp.dll
 
--- a/kernel/eka/compsupp/rvct2_0/udfpfrce.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/udfpfrce.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This function is simple a way to for these EXPORT statements into
-* the .in file. These symbols will therefore be referenced from
-* the export table and so **forced** into the udfp.dll 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This function is simple a way to for these EXPORT statements into
+// the .in file. These symbols will therefore be referenced from
+// the export table and so **forced** into the udfp.dll 
+// 
+//
 
 __asm void __rt_exporter_dummy(void)
 {
--- a/kernel/eka/compsupp/rvct2_0/udrt.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/udrt.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* UDRT.MPP
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// UDRT.MPP
+// 
+//
 
 TARGET 			udrt.dll
 
--- a/kernel/eka/compsupp/rvct2_0/udrtfrce.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/udrtfrce.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This function is simple a way to for these EXPORT statements into
-* the .in file. These symbols will therefore be referenced from
-* the export table and so **forced** into the udrt.dll 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This function is simple a way to for these EXPORT statements into
+// the .in file. These symbols will therefore be referenced from
+// the export table and so **forced** into the udrt.dll 
+// 
+//
 
 __asm void __rt_exporter_dummy(void)
 {
--- a/kernel/eka/compsupp/rvct2_0/usrt.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_0/usrt.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* USRT.MPP
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// USRT.MPP
+// 
+//
 
 TARGET 			usrt.lib
 
--- a/kernel/eka/compsupp/rvct2_1/aeabidiv0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/aeabidiv0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_1/aeabimem.cia	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/aeabimem.cia	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32cmn.h>
 
--- a/kernel/eka/compsupp/rvct2_1/callviar0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/callviar0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_1/callviar1.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/callviar1.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_1/callviar2.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/callviar2.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_1/callviar3.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/callviar3.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_1/callviar4.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/callviar4.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_1/callviar5.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/callviar5.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_1/callviar6.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/callviar6.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_1/callviar7.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/callviar7.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_1/cppinit.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/cppinit.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 /**
  @file
--- a/kernel/eka/compsupp/rvct2_1/dfpaeabi.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/dfpaeabi.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This function is simple a way to get these EXPORT statements into
-* the .in file. These symbols will therefore be referenced from
-* the export table and so **forced** into the DLL
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This function is simple a way to get these EXPORT statements into
+// the .in file. These symbols will therefore be referenced from
+// the export table and so **forced** into the DLL
+// 
+//
 
 __asm void __rt_exporter_dummy(void)
 {
--- a/kernel/eka/compsupp/rvct2_1/dfpaeabi.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/dfpaeabi.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 TARGET 			dfpaeabi.dll
 
--- a/kernel/eka/compsupp/rvct2_1/dfprvct2_1-thunk.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/dfprvct2_1-thunk.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* Thunks for RVCT synonyms for AEABI functions
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Thunks for RVCT synonyms for AEABI functions
+// 
+//
 
 extern "C" double __aeabi_l2d(long long val);
 extern "C" double __aeabi_ul2d(unsigned long long val);
--- a/kernel/eka/compsupp/rvct2_1/dfprvct2_1-thunk.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/dfprvct2_1-thunk.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 target 			dfprvct2_1-thunk.dll
 
--- a/kernel/eka/compsupp/rvct2_1/dfprvct2_1.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/dfprvct2_1.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This function is simple a way to get these EXPORT statements into
-* the .in file. These symbols will therefore be referenced from
-* the export table and so **forced** into the DLL
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This function is simple a way to get these EXPORT statements into
+// the .in file. These symbols will therefore be referenced from
+// the export table and so **forced** into the DLL
+// 
+//
 
 __asm void __rt_exporter_dummy(void)
 {
--- a/kernel/eka/compsupp/rvct2_1/dfprvct2_1.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/dfprvct2_1.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 target 			dfprvct2_1.dll
 
--- a/kernel/eka/compsupp/rvct2_1/dllexp.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/dllexp.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C" {
 
--- a/kernel/eka/compsupp/rvct2_1/drtaeabi.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/drtaeabi.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,24 +1,22 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* In preparation for fully CPPABI and RTABI compliant version of RVCT 2.1
-* This function is simple a way to get these EXPORT statements into
-* the .in file. These symbols will therefore be referenced from
-* the export table and so **forced** into the DLL
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// In preparation for fully CPPABI and RTABI compliant version of RVCT 2.1
+// This function is simple a way to get these EXPORT statements into
+// the .in file. These symbols will therefore be referenced from
+// the export table and so **forced** into the DLL
+// 
+//
 
 __asm void __rt_exporter_dummy(void)
 {
--- a/kernel/eka/compsupp/rvct2_1/drtaeabi.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/drtaeabi.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 TARGET 			drtaeabi.dll
 
--- a/kernel/eka/compsupp/rvct2_1/drtrvct2_1.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/drtrvct2_1.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This function is simple a way to get these EXPORT statements into
-* the .in file. These symbols will therefore be referenced from
-* the export table and so **forced** into the DLL 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This function is simple a way to get these EXPORT statements into
+// the .in file. These symbols will therefore be referenced from
+// the export table and so **forced** into the DLL 
+// 
+//
 
 __asm void __rt_exporter_dummy(void)
 {
--- a/kernel/eka/compsupp/rvct2_1/drtrvct2_1.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/drtrvct2_1.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 TARGET 			drtrvct2_1.dll
 
--- a/kernel/eka/compsupp/rvct2_1/ksrt.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/ksrt.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* KSRT.MPP
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// KSRT.MPP
+// 
+//
 
 ALWAYS_BUILD_AS_ARM
 
--- a/kernel/eka/compsupp/rvct2_1/ksrt2_1.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/ksrt2_1.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* KSRT.MPP
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// KSRT.MPP
+// 
+//
 
 ALWAYS_BUILD_AS_ARM
 
--- a/kernel/eka/compsupp/rvct2_1/rtabort.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/rtabort.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_1/rtdiv0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/rtdiv0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_1/rte32dll.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/rte32dll.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -2,21 +2,20 @@
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
 
-
 #include <e32std.h>
 #include <e32std_private.h>
 
--- a/kernel/eka/compsupp/rvct2_1/rtexit.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/rtexit.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* function the runtime can call to exit process, 'finalizing'
-* the runtime library but avoiding atexit processing.
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// function the runtime can call to exit process, 'finalizing'
+// the runtime library but avoiding atexit processing.
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_1/rtlib.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/rtlib.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* initialize and shutdown (low-level) runtime.
-* these are intended to go in user side static runtime lib
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// initialize and shutdown (low-level) runtime.
+// these are intended to go in user side static runtime lib
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_1/rtopdel.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/rtopdel.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
+//#include <stddef.h>
 #include <e32std.h>
 #include <e32std_private.h>
 //#include <e32math.h>
--- a/kernel/eka/compsupp/rvct2_1/rtopnew.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/rtopnew.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
+//#include <stddef.h>
 #include <e32std.h>
 #include <e32std_private.h>
 //#include <e32math.h>
--- a/kernel/eka/compsupp/rvct2_1/rtraise.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/rtraise.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* function the runtime can call to 'raise an exception'
-*
-*/
-
+// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// function the runtime can call to 'raise an exception'
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_1/rvct2_1.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/rvct2_1.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* e32\compsupp\rvct2_1\rvct2_1.h
-* This is the preinclude file for the rvct 2.1 compiler
-* It contains all the compiler specific definitions required by the SOS source
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\compsupp\rvct2_1\rvct2_1.h
+// This is the preinclude file for the rvct 2.1 compiler
+// It contains all the compiler specific definitions required by the SOS source
+// 
+//
 
 /**
  @file
--- a/kernel/eka/compsupp/rvct2_1/sftfpini.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/sftfpini.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_1/ucppfini.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/ucppfini.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* toplevel destruction routines for 'user side' code compiled 
-* with the ARMEDG compiler.
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// toplevel destruction routines for 'user side' code compiled 
+// with the ARMEDG compiler.
+// 
+//
 
 #include "cppinit.h"
 
--- a/kernel/eka/compsupp/rvct2_1/ucppinit.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/ucppinit.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* toplevel initialization/destruction routines for 'user side' code compiled 
-* with the ARMEDG compiler. intended for static linking
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// toplevel initialization/destruction routines for 'user side' code compiled 
+// with the ARMEDG compiler. intended for static linking
+// 
+//
 
 #include "cppinit.h"
 
--- a/kernel/eka/compsupp/rvct2_1/ucppinit_aeabi.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/ucppinit_aeabi.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* toplevel initialization/destruction routines for 'user side' code compiled 
-* with the ARMCC EABI compiler. intended for static linking
-*
-*/
-
+// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// toplevel initialization/destruction routines for 'user side' code compiled 
+// with the ARMCC EABI compiler. intended for static linking
+// 
+//
 
 extern "C" {
 
--- a/kernel/eka/compsupp/rvct2_1/usrt.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/usrt.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* USRT.MPP
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// USRT.MPP
+// 
+//
 
 TARGET 			usrt.lib
 
--- a/kernel/eka/compsupp/rvct2_1/usrt2_1.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_1/usrt2_1.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* USRT.MPP
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// USRT.MPP
+// 
+//
 
 TARGET 			usrt2_1.lib
 
--- a/kernel/eka/compsupp/rvct2_2/aeabidiv0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/aeabidiv0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_2/aeabimem.cia	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/aeabimem.cia	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32cmn.h>
 
--- a/kernel/eka/compsupp/rvct2_2/callviar0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/callviar0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_2/callviar1.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/callviar1.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_2/callviar2.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/callviar2.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_2/callviar3.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/callviar3.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_2/callviar4.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/callviar4.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_2/callviar5.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/callviar5.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_2/callviar6.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/callviar6.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_2/callviar7.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/callviar7.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C"
 {		
--- a/kernel/eka/compsupp/rvct2_2/cppinit.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/cppinit.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 /**
  @file
--- a/kernel/eka/compsupp/rvct2_2/dfpaeabi.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dfpaeabi.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This function is simple a way to get these EXPORT statements into
-* the .in file. These symbols will therefore be referenced from
-* the export table and so **forced** into the DLL
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This function is simple a way to get these EXPORT statements into
+// the .in file. These symbols will therefore be referenced from
+// the export table and so **forced** into the DLL
+// 
+//
 
 __asm void __rt_exporter_dummy(void)
 {
--- a/kernel/eka/compsupp/rvct2_2/dfpaeabi.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dfpaeabi.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfpaeabi_common.mmh"
 
--- a/kernel/eka/compsupp/rvct2_2/dfpaeabi_common.mmh	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dfpaeabi_common.mmh	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 TARGETTYPE		dll
 
--- a/kernel/eka/compsupp/rvct2_2/dfpaeabi_vfpv2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dfpaeabi_vfpv2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfpaeabi_common.mmh"
 
--- a/kernel/eka/compsupp/rvct2_2/dfprvct2_2-thunk.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dfprvct2_2-thunk.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* dfprvct2_1-thunk.cpp
-* Thunks for RVCT synonyms for AEABI functions
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// dfprvct2_1-thunk.cpp
+// Thunks for RVCT synonyms for AEABI functions
+// 
+//
 
 extern "C" double __aeabi_l2d(long long val);
 extern "C" double __aeabi_ul2d(unsigned long long val);
--- a/kernel/eka/compsupp/rvct2_2/dfprvct2_2-thunk.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dfprvct2_2-thunk.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* dfprvct2_1-thunk.mmp
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// dfprvct2_1-thunk.mmp
+// 
+//
 
 target 			dfprvct2_2-thunk.dll
 
--- a/kernel/eka/compsupp/rvct2_2/dfprvct2_2.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dfprvct2_2.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,24 +1,22 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* DFPRVCT2_1.CPP
-* This function is simple a way to get these EXPORT statements into
-* the .in file. These symbols will therefore be referenced from
-* the export table and so **forced** into the DLL
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// DFPRVCT2_1.CPP
+// This function is simple a way to get these EXPORT statements into
+// the .in file. These symbols will therefore be referenced from
+// the export table and so **forced** into the DLL
+// 
+//
 
 __asm void __rt_exporter_dummy(void)
 {
--- a/kernel/eka/compsupp/rvct2_2/dfprvct2_2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dfprvct2_2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfprvct2_2_common.mmh"
 
--- a/kernel/eka/compsupp/rvct2_2/dfprvct2_2_common.mmh	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dfprvct2_2_common.mmh	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* dfprvct2_2_common.mmp
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// dfprvct2_2_common.mmp
+// 
+//
 
 targettype		dll
 
--- a/kernel/eka/compsupp/rvct2_2/dfprvct2_2_vfpv2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dfprvct2_2_vfpv2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfprvct2_2_common.mmh"
 
--- a/kernel/eka/compsupp/rvct2_2/dllexp.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/dllexp.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern "C" {
 
--- a/kernel/eka/compsupp/rvct2_2/drtaeabi.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/drtaeabi.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 extern char * _ZTVN10__cxxabiv123__fundamental_type_infoE;
 extern const char * const  $Sub$$_ZTSv = "v";
--- a/kernel/eka/compsupp/rvct2_2/drtaeabi.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/drtaeabi.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 TARGET 			drtaeabi.dll
 
--- a/kernel/eka/compsupp/rvct2_2/drtrvct2_2.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/drtrvct2_2.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This function is simple a way to get these EXPORT statements into
-* the .in file. These symbols will therefore be referenced from
-* the export table and so **forced** into the DLL 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This function is simple a way to get these EXPORT statements into
+// the .in file. These symbols will therefore be referenced from
+// the export table and so **forced** into the DLL 
+// 
+//
 
 __asm void __rt_exporter_dummy(void)
 {
--- a/kernel/eka/compsupp/rvct2_2/drtrvct2_2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/drtrvct2_2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "drtrvct2_2_common.mmh"
 
--- a/kernel/eka/compsupp/rvct2_2/drtrvct2_2_common.mmh	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/drtrvct2_2_common.mmh	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* DRTRVCT2_2_COMMON.MMP
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// DRTRVCT2_2_COMMON.MMP
+// 
+//
 
 TARGETTYPE		dll
 
--- a/kernel/eka/compsupp/rvct2_2/drtrvct2_2_vfpv2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/drtrvct2_2_vfpv2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "drtrvct2_2_common.mmh"
 
--- a/kernel/eka/compsupp/rvct2_2/ksrt2_2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/ksrt2_2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* KSRT2_2.MPP
-* This version is used to support RVCT 2.2 builds.
-* Here the init_array (|SHT$$INIT_ARRAY$$Base|) contains pointers rather than offsets. 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// KSRT2_2.MPP
+// This version is used to support RVCT 2.2 builds.
+// Here the init_array (|SHT$$INIT_ARRAY$$Base|) contains pointers rather than offsets. 
+// 
+//
 
 ALWAYS_BUILD_AS_ARM
 
--- a/kernel/eka/compsupp/rvct2_2/rtabort.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/rtabort.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_2/rtdiv0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/rtdiv0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_2/rte32dll.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/rte32dll.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -2,21 +2,20 @@
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
 
-
 #include <e32std.h>
 #include <e32std_private.h>
 
--- a/kernel/eka/compsupp/rvct2_2/rtexit.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/rtexit.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* function the runtime can call to exit process, 'finalizing'
-* the runtime library but avoiding atexit processing.
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// function the runtime can call to exit process, 'finalizing'
+// the runtime library but avoiding atexit processing.
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_2/rtlib.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/rtlib.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* initialize and shutdown (low-level) runtime.
-* these are intended to go in user side static runtime lib
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// initialize and shutdown (low-level) runtime.
+// these are intended to go in user side static runtime lib
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_2/rtopdel.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/rtopdel.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_2/rtopnew.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/rtopnew.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_2/rtraise.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/rtraise.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* function the runtime can call to 'raise an exception'
-*
-*/
-
+// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// function the runtime can call to 'raise an exception'
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_2/rvct2_2.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/rvct2_2.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* e32\compsupp\rvct2_2\rvct2_2.h
-* This is the preinclude file for the rvct 2.2 compiler
-* It contains all the compiler specific definitions required by the SOS source
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\compsupp\rvct2_2\rvct2_2.h
+// This is the preinclude file for the rvct 2.2 compiler
+// It contains all the compiler specific definitions required by the SOS source
+// 
+//
 
 /**
  @file
--- a/kernel/eka/compsupp/rvct2_2/sftfpini.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/sftfpini.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct2_2/type_info.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/type_info.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -2,20 +2,19 @@
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
-
 #include <typeinfo>
 
 EXPORT_C bool std::type_info::operator==(const std::type_info& rhs) const
--- a/kernel/eka/compsupp/rvct2_2/ucppfini.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/ucppfini.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* toplevel destruction routines for 'user side' code compiled 
-* with the ARMEDG compiler.
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// toplevel destruction routines for 'user side' code compiled 
+// with the ARMEDG compiler.
+// 
+//
 
 #include "cppinit.h"
 
--- a/kernel/eka/compsupp/rvct2_2/ucppinit.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/ucppinit.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* toplevel initialization/destruction routines for 'user side' code compiled 
-* with the ARMEDG compiler. intended for static linking
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// toplevel initialization/destruction routines for 'user side' code compiled 
+// with the ARMEDG compiler. intended for static linking
+// 
+//
 
 #include "cppinit.h"
 
--- a/kernel/eka/compsupp/rvct2_2/ucppinit_aeabi.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/ucppinit_aeabi.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,24 +1,22 @@
-/*
-* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* toplevel initialization/destruction routines for 'user side' code compiled 
-* with the ARMCC EABI compiler. intended for static linking
-* The code supports 2.2 both bpabi and non-bpabi. The values in .init_array are
-* pointers in both environments, so the library is common to both.
-*
-*/
-
+// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// toplevel initialization/destruction routines for 'user side' code compiled 
+// with the ARMCC EABI compiler. intended for static linking
+// The code supports 2.2 both bpabi and non-bpabi. The values in .init_array are
+// pointers in both environments, so the library is common to both.
+// 
+//
 
 extern "C" {
 
--- a/kernel/eka/compsupp/rvct2_2/usrt2_2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct2_2/usrt2_2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,23 +1,21 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* USRT2_2.MPP
-* This version is used to support RVCT 2.2 builds.
-* Here the init_array (|SHT$$INIT_ARRAY$$Base|) contains pointers rather than offsets. 
-*
-*/
-
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// USRT2_2.MPP
+// This version is used to support RVCT 2.2 builds.
+// Here the init_array (|SHT$$INIT_ARRAY$$Base|) contains pointers rather than offsets. 
+// 
+//
 
 TARGET 			usrt2_2.lib
 
--- a/kernel/eka/compsupp/rvct3_1/aeabidiv0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/aeabidiv0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtaeabi.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtaeabi.dll.
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct3_1/aeabimem.cia	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/aeabimem.cia	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtaeabi.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtaeabi.dll.
+// 
+//
 
 #include <e32cmn.h>
 
--- a/kernel/eka/compsupp/rvct3_1/call_via_rx/r0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/call_via_rx/r0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct3_1/call_via_rx/r1.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/call_via_rx/r1.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct3_1/call_via_rx/r2.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/call_via_rx/r2.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct3_1/call_via_rx/r3.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/call_via_rx/r3.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct3_1/call_via_rx/r4.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/call_via_rx/r4.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct3_1/call_via_rx/r5.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/call_via_rx/r5.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct3_1/call_via_rx/r6.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/call_via_rx/r6.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct3_1/call_via_rx/r7.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/call_via_rx/r7.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 extern "C"
 {       
--- a/kernel/eka/compsupp/rvct3_1/dfpaeabi.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/dfpaeabi.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfpaeabi_common.mmh"
 
--- a/kernel/eka/compsupp/rvct3_1/dfpaeabi_common.mmh	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/dfpaeabi_common.mmh	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 
 targettype      dll
--- a/kernel/eka/compsupp/rvct3_1/dfpaeabi_vfpv2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/dfpaeabi_vfpv2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfpaeabi_common.mmh"
 
--- a/kernel/eka/compsupp/rvct3_1/dfprvct.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/dfprvct.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,24 +1,22 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of dfprvct.dll.
-* According to the EABI:
-* 1. "long int" is the same as "int", and
-* 2. "long double" is the same as "double".
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of dfprvct.dll.
+// According to the EABI:
+// 1. "long int" is the same as "int", and
+// 2. "long double" is the same as "double".
+// 
+//
 
 
 __asm void __Symbian_exporter_dummy_1()
--- a/kernel/eka/compsupp/rvct3_1/dfprvct.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/dfprvct.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfprvct_common.mmh"
 
--- a/kernel/eka/compsupp/rvct3_1/dfprvct_common.mmh	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/dfprvct_common.mmh	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 
 targettype      dll
--- a/kernel/eka/compsupp/rvct3_1/dfprvct_vfpv2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/dfprvct_vfpv2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "dfprvct_common.mmh"
 
--- a/kernel/eka/compsupp/rvct3_1/dllexp.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/dllexp.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 
 extern "C" void __DLL_Export_Table__() { }  // This function (and the whole file)
--- a/kernel/eka/compsupp/rvct3_1/drtaeabi.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/drtaeabi.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtaeabi.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtaeabi.dll.
+// 
+//
 
 
 #include <e32std.h>
--- a/kernel/eka/compsupp/rvct3_1/drtaeabi.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/drtaeabi.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 
 target              drtaeabi.dll
--- a/kernel/eka/compsupp/rvct3_1/drtrvct.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/drtrvct.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "drtrvct_common.mmh"
 
--- a/kernel/eka/compsupp/rvct3_1/drtrvct_common.mmh	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/drtrvct_common.mmh	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 targettype          dll
 
--- a/kernel/eka/compsupp/rvct3_1/drtrvct_vfpv2.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/drtrvct_vfpv2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 #include "drtrvct_common.mmh"
 
--- a/kernel/eka/compsupp/rvct3_1/ksrt.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/ksrt.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,17 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
 
 target          ksrt3_1.lib
 targettype      klib
--- a/kernel/eka/compsupp/rvct3_1/no_extras.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/no_extras.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of all compsupp DLLs. It makes the linker issue an error
-* message if semihosting or heap functions get pulled in from RVCT's libraries.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of all compsupp DLLs. It makes the linker issue an error
+// message if semihosting or heap functions get pulled in from RVCT's libraries.
+// 
+//
 
 
 #pragma import(__use_no_semihosting)
--- a/kernel/eka/compsupp/rvct3_1/rtabort.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/rtabort.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct3_1/rtdiv0.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/rtdiv0.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct3_1/rtexit.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/rtexit.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct3_1/rtraise.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/rtraise.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct3_1/sftfpini.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/sftfpini.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of drtrvct.dll and drtrvct_vfpv2.dll.
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/rvct3_1/type_info.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/type_info.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -2,20 +2,19 @@
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
-
 #include <typeinfo>
 
 EXPORT_C bool std::type_info::operator==(const std::type_info& rhs) const
--- a/kernel/eka/compsupp/rvct3_1/ucppfini.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/ucppfini.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib (but not ksrt.lib).
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib (but not ksrt.lib).
+// 
+//
 
 
 extern "C" {
--- a/kernel/eka/compsupp/rvct3_1/ucppinit.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/ucppinit.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of usrt.lib and ksrt.lib.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
 
 
 extern "C" {
--- a/kernel/eka/compsupp/rvct3_1/usrt.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/rvct3_1/usrt.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* usrt.mpp
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// usrt.mpp
+// 
+//
 
 target          usrt3_1.lib
 targettype      lib
--- a/kernel/eka/compsupp/symaehabi/basics.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/symaehabi/basics.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* e32/compsupp/symaehabi/basics.h
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32/compsupp/symaehabi/basics.h
+// 
+//
 
 
 #define __NEW // lie about this
--- a/kernel/eka/compsupp/symaehabi/callfirstprocessfn.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/symaehabi/callfirstprocessfn.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* e32\compsupp\symaehabi\callfirstprocessfn.cpp
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\compsupp\symaehabi\callfirstprocessfn.cpp
+// 
+//
 
 #include "unwind_env.h"
 #include "unwinder.h"
--- a/kernel/eka/compsupp/symaehabi/symbian_rtti.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/symaehabi/symbian_rtti.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* e32/compsupp/symaehabi/symbian_rtti.cpp
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32/compsupp/symaehabi/symbian_rtti.cpp
+// 
+//
 
 #include "cxxabi.h"
 #include "unwind_env.h"
--- a/kernel/eka/compsupp/symaehabi/symbian_support.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/symaehabi/symbian_support.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* e32/compsupp/symaehabi/symbian_support.cpp
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32/compsupp/symaehabi/symbian_support.cpp
+// 
+//
 
 /* Environment: */
 #include "unwind_env.h"
--- a/kernel/eka/compsupp/symaehabi/symbian_support.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/symaehabi/symbian_support.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* e32/compsupp/symaehabi/symbian_support.h
-*
-*/
-
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32/compsupp/symaehabi/symbian_support.h
+// 
+//
 
 
 #ifndef SYMBIAN_SUPPORT_H
--- a/kernel/eka/compsupp/symcpp/rtopdel.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/symcpp/rtopdel.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of scppnwdl.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of scppnwdl.dll.
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/symcpp/rtopnew.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/symcpp/rtopnew.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,19 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This file is part of scppnwdl.dll.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of scppnwdl.dll.
+// 
+//
 
 #include <e32std.h>
 #include <e32std_private.h>
--- a/kernel/eka/compsupp/symcpp/scppnwdl.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/symcpp/scppnwdl.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,22 +1,20 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* Creates scppnwdl.dll which implements Symbian's global operator new and global
-* operator delete.
-*
-*/
-
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Creates scppnwdl.dll which implements Symbian's global operator new and global
+// operator delete.
+// 
+//
 
 TARGET 			scppnwdl.dll
 
--- a/kernel/eka/compsupp/symcpp/symcpp.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/compsupp/symcpp/symcpp.h	Mon Jan 18 21:31:10 2010 +0200
@@ -1,21 +1,21 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-* This is a preinclude file for the Symbian C++ specific defintions for RVCT.
-*
-*/
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is a preinclude file for the Symbian C++ specific defintions for RVCT.
+// 
+//
 
+// Deal with operator new issues here
 #ifdef __cplusplus
 namespace std {
 	struct nothrow_t { };
--- a/kernel/eka/drivers/bsp/bld.inf	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/drivers/bsp/bld.inf	Mon Jan 18 21:31:10 2010 +0200
@@ -37,6 +37,7 @@
 #if !defined(WINS) 
 #if !defined(X86)
 ../dma/dma_lib
+../dma/dma2_lib
 #endif
 #endif
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/drivers/dma/dma2_lib.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,30 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\drivers\dma\dma2_lib.mmp
+// 
+//
+
+target			dma2.lib
+targettype		implib
+linkas			dma.dll
+
+#if defined(EABI)
+deffile				../../eabi/dma2.def 
+#elif defined(GCC32)
+deffile				../../bmarm/dma2.def 
+#endif
+
+VENDORID 0x70000001
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/drivers/dma/dma2_pil.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,2311 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32/drivers/dma2_pil.cpp
+// DMA Platform Independent Layer (PIL)
+//
+//
+
+#include <drivers/dma.h>
+#include <drivers/dma_hai.h>
+
+#include <kernel/kern_priv.h>
+
+
+// Symbian Min() & Max() are broken, so we have to define them ourselves
+inline TUint Min(TUint aLeft, TUint aRight)
+	{return(aLeft < aRight ? aLeft : aRight);}
+inline TUint Max(TUint aLeft, TUint aRight)
+	{return(aLeft > aRight ? aLeft : aRight);}
+
+
+// Uncomment the following #define only when freezing the DMA2 export library.
+//#define __FREEZE_DMA2_LIB
+#ifdef __FREEZE_DMA2_LIB
+TInt DmaChannelMgr::StaticExtension(TInt, TAny*) {return 0;}
+TDmaChannel* DmaChannelMgr::Open(TUint32, TBool, TUint) {return 0;}
+void DmaChannelMgr::Close(TDmaChannel*) {}
+EXPORT_C const TDmaTestInfo& DmaTestInfo() {static TDmaTestInfo a; return a;}
+EXPORT_C const TDmaV2TestInfo& DmaTestInfoV2() {static TDmaV2TestInfo a; return a;}
+#endif	// #ifdef __FREEZE_DMA2_LIB
+
+
+static const char KDmaPanicCat[] = "DMA " __FILE__;
+
+//////////////////////////////////////////////////////////////////////
+// DmaChannelMgr
+//
+// Wait, Signal, and Initialise are defined here in the PIL.
+// Open, Close and Extension must be defined in the PSL.
+
+NFastMutex DmaChannelMgr::Lock;
+
+
+void DmaChannelMgr::Wait()
+	{
+	NKern::FMWait(&Lock);
+	}
+
+
+void DmaChannelMgr::Signal()
+	{
+	NKern::FMSignal(&Lock);
+	}
+
+
+TInt DmaChannelMgr::Initialise()
+	{
+	return KErrNone;
+	}
+
+
+class TDmaCancelInfo : public SDblQueLink
+	{
+public:
+	TDmaCancelInfo();
+	void Signal();
+public:
+	NFastSemaphore iSem;
+	};
+
+
+TDmaCancelInfo::TDmaCancelInfo()
+	: iSem(0)
+	{
+	iNext = this;
+	iPrev = this;
+	}
+
+
+void TDmaCancelInfo::Signal()
+	{
+	TDmaCancelInfo* p = this;
+	FOREVER
+		{
+		TDmaCancelInfo* next = (TDmaCancelInfo*)p->iNext;
+		if (p!=next)
+			p->Deque();
+		NKern::FSSignal(&p->iSem);	// Don't dereference p after this
+		if (p==next)
+			break;
+		p = next;
+		}
+	}
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+#ifdef __DMASIM__
+#ifdef __WINS__
+typedef TLinAddr TPhysAddr;
+#endif
+static inline TPhysAddr LinToPhys(TLinAddr aLin) {return aLin;}
+#else
+static inline TPhysAddr LinToPhys(TLinAddr aLin) {return Epoc::LinearToPhysical(aLin);}
+#endif
+
+//
+// Return minimum of aMaxSize and size of largest physically contiguous block
+// starting at aLinAddr.
+//
+static TInt MaxPhysSize(TLinAddr aLinAddr, const TInt aMaxSize)
+	{
+	const TPhysAddr physBase = LinToPhys(aLinAddr);
+	TLinAddr lin = aLinAddr;
+	TInt size = 0;
+	for (;;)
+		{
+		// Round up the linear address to the next MMU page boundary
+		const TLinAddr linBoundary = Kern::RoundToPageSize(lin + 1);
+		size += linBoundary - lin;
+		if (size >= aMaxSize)
+			return aMaxSize;
+		if ((physBase + size) != LinToPhys(linBoundary))
+			return size;
+		lin = linBoundary;
+		}
+	}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// TDmac
+
+TDmac::TDmac(const SCreateInfo& aInfo)
+	: iMaxDesCount(aInfo.iDesCount),
+	  iAvailDesCount(aInfo.iDesCount),
+	  iHdrPool(NULL),
+#ifndef __WINS__
+	  iHwDesChunk(NULL),
+#endif
+	  iDesPool(NULL),
+	  iDesSize(aInfo.iDesSize),
+	  iCapsHwDes(aInfo.iCapsHwDes),
+	  iFreeHdr(NULL)
+	{
+	__DMA_ASSERTD(iMaxDesCount > 0);
+	__DMA_ASSERTD(iDesSize > 0);
+	}
+
+
+//
+// Second-phase c'tor
+//
+TInt TDmac::Create(const SCreateInfo& aInfo)
+	{
+	iHdrPool = new SDmaDesHdr[iMaxDesCount];
+	if (iHdrPool == NULL)
+		{
+		return KErrNoMemory;
+		}
+
+	TInt r = AllocDesPool(aInfo.iDesChunkAttribs);
+	if (r != KErrNone)
+		{
+		return KErrNoMemory;
+		}
+
+	// Link all descriptor headers together on the free list
+	iFreeHdr = iHdrPool;
+	for (TInt i = 0; i < iMaxDesCount - 1; i++)
+		iHdrPool[i].iNext = iHdrPool + i + 1;
+	iHdrPool[iMaxDesCount-1].iNext = NULL;
+
+	__DMA_INVARIANT();
+	return KErrNone;
+	}
+
+
+TDmac::~TDmac()
+	{
+	__DMA_INVARIANT();
+
+	FreeDesPool();
+	delete[] iHdrPool;
+	}
+
+
+void TDmac::Transfer(const TDmaChannel& /*aChannel*/, const SDmaDesHdr& /*aHdr*/)
+	{
+	// TDmac needs to override this function if it has reported the channel
+	// type for which the PIL calls it.
+	__DMA_CANT_HAPPEN();
+	}
+
+
+void TDmac::Transfer(const TDmaChannel& /*aChannel*/, const SDmaDesHdr& /*aSrcHdr*/,
+					 const SDmaDesHdr& /*aDstHdr*/)
+	{
+	// TDmac needs to override this function if it has reported the channel
+	// type for which the PIL calls it.
+	__DMA_CANT_HAPPEN();
+	}
+
+
+TInt TDmac::PauseTransfer(const TDmaChannel& /*aChannel*/)
+	{
+	// TDmac needs to override this function if it has reported support for
+	// channel pausing/resuming.
+	return KErrNotSupported;
+	}
+
+
+TInt TDmac::ResumeTransfer(const TDmaChannel& /*aChannel*/)
+	{
+	// TDmac needs to override this function if it has reported support for
+	// channel pausing/resuming.
+	return KErrNotSupported;
+	}
+
+
+TInt TDmac::AllocDesPool(TUint aAttribs)
+	{
+	// Calling thread must be in CS
+	__ASSERT_CRITICAL;
+	TInt r;
+	if (iCapsHwDes)
+		{
+		const TInt size = iMaxDesCount * iDesSize;
+#ifdef __WINS__
+		(void)aAttribs;
+		iDesPool = new TUint8[size];
+		r = iDesPool ? KErrNone : KErrNoMemory;
+#else
+		// Chunk not mapped as supervisor r/w user none? incorrect mask passed by PSL
+		__DMA_ASSERTD((aAttribs & EMapAttrAccessMask) == EMapAttrSupRw);
+		TPhysAddr phys;
+		r = Epoc::AllocPhysicalRam(size, phys);
+		if (r == KErrNone)
+			{
+			r = DPlatChunkHw::New(iHwDesChunk, phys, size, aAttribs);
+			if (r == KErrNone)
+				{
+				iDesPool = (TAny*)iHwDesChunk->LinearAddress();
+				__KTRACE_OPT(KDMA, Kern::Printf("descriptor hw chunk created lin=0x%08X phys=0x%08X, size=0x%X",
+												iHwDesChunk->iLinAddr, iHwDesChunk->iPhysAddr, size));
+				}
+			else
+				Epoc::FreePhysicalRam(phys, size);
+			}
+#endif
+		}
+	else
+		{
+		iDesPool = new TDmaTransferArgs[iMaxDesCount];
+		r = iDesPool ? KErrNone : KErrNoMemory;
+		}
+	return r;
+	}
+
+
+void TDmac::FreeDesPool()
+	{
+	// Calling thread must be in CS
+	__ASSERT_CRITICAL;
+	if (iCapsHwDes)
+		{
+#ifdef __WINS__
+		delete[] iDesPool;
+#else
+		if (iHwDesChunk)
+			{
+			const TPhysAddr phys = iHwDesChunk->PhysicalAddress();
+			const TInt size = iHwDesChunk->iSize;
+			iHwDesChunk->Close(NULL);
+			Epoc::FreePhysicalRam(phys, size);
+			}
+#endif
+		}
+	else
+		{
+		Kern::Free(iDesPool);
+		}
+	}
+
+
+//
+// Prealloc the given number of descriptors.
+//
+TInt TDmac::ReserveSetOfDes(TInt aCount)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmac::ReserveSetOfDes count=%d", aCount));
+	__DMA_ASSERTD(aCount > 0);
+	TInt r = KErrTooBig;
+	Wait();
+	if (iAvailDesCount - aCount >= 0)
+		{
+		iAvailDesCount -= aCount;
+		r = KErrNone;
+		}
+	Signal();
+	__DMA_INVARIANT();
+	return r;
+	}
+
+
+//
+// Return the given number of preallocated descriptors to the free pool.
+//
+void TDmac::ReleaseSetOfDes(TInt aCount)
+	{
+	__DMA_ASSERTD(aCount >= 0);
+	Wait();
+	iAvailDesCount += aCount;
+	Signal();
+	__DMA_INVARIANT();
+	}
+
+
+//
+// Queue DFC and update word used to communicate with channel DFC.
+//
+// Called in interrupt context by PSL.
+//
+void TDmac::HandleIsr(TDmaChannel& aChannel, TUint aEventMask, TBool aIsComplete)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmac::HandleIsr"));
+
+	// Function needs to be called by PSL in ISR context
+	__DMA_ASSERTD(NKern::CurrentContext() == NKern::EInterrupt);
+
+	// First the ISR callback stuff
+
+	// Is this a transfer completion notification?
+	if (aEventMask & EDmaCallbackRequestCompletion)
+		{
+		// If so, has the client requested an ISR callback?
+		if (__e32_atomic_load_acq32(&aChannel.iIsrCbRequest))
+			{
+			__KTRACE_OPT(KDMA, Kern::Printf("ISR callback"));
+
+			// Since iIsrCbRequest was set no threads will be
+			// modifying the request queue.
+			const DDmaRequest* const req = _LOFF(aChannel.iReqQ.First(), DDmaRequest, iLink);
+
+			// We expect the request to have requested
+			// ISR callback
+			__NK_ASSERT_DEBUG(req->iIsrCb);
+
+			TDmaCallback const cb = req->iDmaCb;
+			TAny* const arg = req->iDmaCbArg;
+			// Execute the client callback
+			(*cb)(EDmaCallbackRequestCompletion,
+				  (aIsComplete ? EDmaResultOK : EDmaResultError),
+				  arg,
+				  NULL);
+			// Now let's see if the callback rescheduled the transfer request
+			// (see TDmaChannel::IsrRedoRequest()).
+			const TBool redo = aChannel.iRedoRequest;
+			aChannel.iRedoRequest = EFalse;
+			const TBool stop = __e32_atomic_load_acq32(&aChannel.iIsrDfc) &
+				(TUint32)TDmaChannel::KCancelFlagMask;
+			// There won't be another ISR callback if this callback didn't
+			// reschedule the request, or the client cancelled all requests, or
+			// this callback rescheduled the request with a DFC callback.
+			if (!redo || stop || !req->iIsrCb)
+				{
+				__e32_atomic_store_rel32(&aChannel.iIsrCbRequest, EFalse);
+				}
+			if (redo && !stop)
+				{
+				// We won't queue the channel DFC in this case and just return.
+				__KTRACE_OPT(KDMA, Kern::Printf("CB rescheduled xfer -> no DFC"));
+				return;
+				}
+			// Not redoing or being cancelled means we've been calling the
+			// request's ISR callback for the last time. We're going to
+			// complete the request via the DFC in the usual way.
+			}
+		}
+
+	// Now queue a DFC if necessary. The possible scenarios are:
+	// a) DFC not queued (orig == 0)              -> update iIsrDfc + queue DFC
+	// b) DFC queued, not running yet (orig != 0) -> just update iIsrDfc
+	// c) DFC running / iIsrDfc not reset yet (orig != 0) -> just update iIsrDfc
+	// d) DFC running / iIsrDfc already reset (orig == 0) -> update iIsrDfc + requeue DFC
+
+	// Set error flag if necessary.
+	const TUint32 inc = aIsComplete ? 1u : TUint32(TDmaChannel::KErrorFlagMask) | 1u;
+
+	// Add 'inc' (interrupt count increment + poss. error flag) to 'iIsrDfc' if
+	// cancel flag is not set, do nothing otherwise. Assign original value of
+	// 'iIsrDfc' to 'orig' in any case.
+	const TUint32 orig = __e32_atomic_tau_ord32(&aChannel.iIsrDfc,
+												TUint32(TDmaChannel::KCancelFlagMask),
+												0,
+												inc);
+
+	// As transfer should be suspended when an error occurs, we
+	// should never get there with the error flag already set.
+	__DMA_ASSERTD((orig & inc & (TUint32)TDmaChannel::KErrorFlagMask) == 0);
+
+	if (orig == 0)
+		{
+		aChannel.iDfc.Add();
+		}
+	}
+
+
+TInt TDmac::InitDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmac::InitDes"));
+	TInt r;
+	if (iCapsHwDes)
+		{
+		__KTRACE_OPT(KDMA, Kern::Printf("iCaps.iHwDescriptors"));
+		r = InitHwDes(aHdr, aTransferArgs);
+		}
+	else
+		{
+		TDmaTransferArgs& args = HdrToDes(aHdr);
+		args = aTransferArgs;
+		r = KErrNone;
+		}
+	return r;
+	}
+
+
+TInt TDmac::InitHwDes(const SDmaDesHdr& /*aHdr*/, const TDmaTransferArgs& /*aTransferArgs*/)
+	{
+	// concrete controller must override if SDmacCaps::iHwDescriptors set
+	__DMA_CANT_HAPPEN();
+	return KErrGeneral;
+	}
+
+
+TInt TDmac::InitSrcHwDes(const SDmaDesHdr& /*aHdr*/, const TDmaTransferArgs& /*aTransferArgs*/)
+	{
+	// concrete controller must override if SDmacCaps::iAsymHwDescriptors set
+	__DMA_CANT_HAPPEN();
+	return KErrGeneral;
+	}
+
+
+TInt TDmac::InitDstHwDes(const SDmaDesHdr& /*aHdr*/, const TDmaTransferArgs& /*aTransferArgs*/)
+	{
+	// concrete controller must override if SDmacCaps::iAsymHwDescriptors set
+	__DMA_CANT_HAPPEN();
+	return KErrGeneral;
+	}
+
+
+TInt TDmac::UpdateDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr, TUint32 aDstAddr,
+					  TUint aTransferCount, TUint32 aPslRequestInfo)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmac::UpdateDes"));
+	TInt r;
+	if (iCapsHwDes)
+		{
+		__KTRACE_OPT(KDMA, Kern::Printf("iCaps.iHwDescriptors"));
+		r = UpdateHwDes(aHdr, aSrcAddr, aDstAddr, aTransferCount, aPslRequestInfo);
+		}
+	else
+		{
+		TDmaTransferArgs& args = HdrToDes(aHdr);
+		if (aSrcAddr != KPhysAddrInvalid)
+			args.iSrcConfig.iAddr = aSrcAddr;
+		if (aDstAddr != KPhysAddrInvalid)
+			args.iDstConfig.iAddr = aDstAddr;
+		if (aTransferCount)
+			args.iTransferCount = aTransferCount;
+		if (aPslRequestInfo)
+			args.iPslRequestInfo = aPslRequestInfo;
+		r = KErrNone;
+		}
+	return r;
+	}
+
+
+TInt TDmac::UpdateHwDes(const SDmaDesHdr& /*aHdr*/, TUint32 /*aSrcAddr*/, TUint32 /*aDstAddr*/,
+						TUint /*aTransferCount*/, TUint32 /*aPslRequestInfo*/)
+	{
+	// concrete controller must override if SDmacCaps::iHwDescriptors set
+	__DMA_CANT_HAPPEN();
+	return KErrGeneral;
+	}
+
+
+TInt TDmac::UpdateSrcHwDes(const SDmaDesHdr& /*aHdr*/, TUint32 /*aSrcAddr*/,
+						   TUint /*aTransferCount*/, TUint32 /*aPslRequestInfo*/)
+	{
+	// concrete controller must override if SDmacCaps::iAsymHwDescriptors set
+	__DMA_CANT_HAPPEN();
+	return KErrGeneral;
+	}
+
+
+TInt TDmac::UpdateDstHwDes(const SDmaDesHdr& /*aHdr*/, TUint32 /*aDstAddr*/,
+						   TUint /*aTransferCount*/, TUint32 /*aPslRequestInfo*/)
+	{
+	// concrete controller must override if SDmacCaps::iAsymHwDescriptors set
+	__DMA_CANT_HAPPEN();
+	return KErrGeneral;
+	}
+
+
+void TDmac::ChainHwDes(const SDmaDesHdr& /*aHdr*/, const SDmaDesHdr& /*aNextHdr*/)
+	{
+	// concrete controller must override if SDmacCaps::iHwDescriptors set
+	__DMA_CANT_HAPPEN();
+	}
+
+
+void TDmac::AppendHwDes(const TDmaChannel& /*aChannel*/, const SDmaDesHdr& /*aLastHdr*/,
+						const SDmaDesHdr& /*aNewHdr*/)
+	{
+ 	// concrete controller must override if SDmacCaps::iHwDescriptors set
+	__DMA_CANT_HAPPEN();
+	}
+
+
+void TDmac::AppendHwDes(const TDmaChannel& /*aChannel*/,
+						const SDmaDesHdr& /*aSrcLastHdr*/, const SDmaDesHdr& /*aSrcNewHdr*/,
+						const SDmaDesHdr& /*aDstLastHdr*/, const SDmaDesHdr& /*aDstNewHdr*/)
+	{
+	// concrete controller must override if SDmacCaps::iAsymHwDescriptors set
+	__DMA_CANT_HAPPEN();
+	}
+
+
+void TDmac::UnlinkHwDes(const TDmaChannel& /*aChannel*/, SDmaDesHdr& /*aHdr*/)
+	{
+ 	// concrete controller must override if SDmacCaps::iHwDescriptors set
+	__DMA_CANT_HAPPEN();
+	}
+
+
+void TDmac::ClearHwDes(const SDmaDesHdr& /*aHdr*/)
+	{
+	// default implementation - NOP; concrete controller may override
+	return;
+	}
+
+
+TInt TDmac::LinkChannels(TDmaChannel& /*a1stChannel*/, TDmaChannel& /*a2ndChannel*/)
+	{
+	// default implementation - NOP; concrete controller may override
+	return KErrNotSupported;
+	}
+
+
+TInt TDmac::UnlinkChannel(TDmaChannel& /*aChannel*/)
+	{
+	// default implementation - NOP; concrete controller may override
+	return KErrNotSupported;
+	}
+
+
+TInt TDmac::FailNext(const TDmaChannel& /*aChannel*/)
+	{
+	// default implementation - NOP; concrete controller may override
+	return KErrNotSupported;
+	}
+
+
+TInt TDmac::MissNextInterrupts(const TDmaChannel& /*aChannel*/, TInt /*aInterruptCount*/)
+	{
+	// default implementation - NOP; concrete controller may override
+	return KErrNotSupported;
+	}
+
+
+TInt TDmac::Extension(TDmaChannel& /*aChannel*/, TInt /*aCmd*/, TAny* /*aArg*/)
+	{
+	// default implementation - NOP; concrete controller may override
+	return KErrNotSupported;
+	}
+
+
+TUint32 TDmac::HwDesNumDstElementsTransferred(const SDmaDesHdr& /*aHdr*/)
+	{
+ 	// Concrete controller must override if SDmacCaps::iHwDescriptors set.
+	__DMA_CANT_HAPPEN();
+	return 0;
+	}
+
+
+TUint32 TDmac::HwDesNumSrcElementsTransferred(const SDmaDesHdr& /*aHdr*/)
+	{
+ 	// Concrete controller must override if SDmacCaps::iHwDescriptors set.
+	__DMA_CANT_HAPPEN();
+	return 0;
+	}
+
+
+#ifdef _DEBUG
+
+void TDmac::Invariant()
+	{
+	Wait();
+	__DMA_ASSERTD(0 <= iAvailDesCount && iAvailDesCount <= iMaxDesCount);
+	__DMA_ASSERTD(! iFreeHdr || IsValidHdr(iFreeHdr));
+	for (TInt i = 0; i < iMaxDesCount; i++)
+		__DMA_ASSERTD(iHdrPool[i].iNext == NULL || IsValidHdr(iHdrPool[i].iNext));
+	Signal();
+	}
+
+
+TBool TDmac::IsValidHdr(const SDmaDesHdr* aHdr)
+	{
+	return (iHdrPool <= aHdr) && (aHdr < iHdrPool + iMaxDesCount);
+	}
+
+#endif
+
+
+
+
+//
+// Internal compat version, used by legacy Fragment()
+//
+TDmaTransferConfig::TDmaTransferConfig(TUint32 aAddr, TUint aFlags, TBool aAddrInc)
+	: iAddr(aAddr),
+	  iAddrMode(aAddrInc ? KDmaAddrModePostIncrement : KDmaAddrModeConstant),
+	  iElementSize(0),
+	  iElementsPerFrame(0),
+	  iElementsPerPacket(0),
+	  iFramesPerTransfer(0),
+	  iElementSkip(0),
+	  iFrameSkip(0),
+	  iBurstSize(KDmaBurstSizeAny),
+	  iFlags(aFlags),
+	  iSyncFlags(KDmaSyncAuto),
+	  iPslTargetInfo(0),
+	  iRepeatCount(0),
+	  iDelta(~0u),
+	  iReserved(0)
+	{
+	}
+
+
+
+//
+// Internal compat version, used by legacy Fragment()
+//
+TDmaTransferArgs::TDmaTransferArgs(TUint32 aSrc, TUint32 aDest, TInt aCount,
+								   TUint aFlags, TUint32 aPslInfo)
+	: iSrcConfig(aSrc, RequestFlags2SrcConfigFlags(aFlags), (aFlags & KDmaIncSrc)),
+	  iDstConfig(aDest, RequestFlags2DstConfigFlags(aFlags), (aFlags & KDmaIncDest)),
+	  iTransferCount(aCount),
+	  iGraphicsOps(KDmaGraphicsOpNone),
+	  iColour(0),
+	  iFlags(0),
+	  iChannelPriority(KDmaPriorityNone),
+	  iPslRequestInfo(aPslInfo),
+	  iDelta(~0u),
+	  iReserved1(0),
+	  iChannelCookie(0),
+	  iReserved2(0)
+	{
+	}
+
+
+//
+// As DDmaRequest is derived from DBase, the initializations with zero aren't
+// strictly necessary here, but this way it's nicer.
+//
+EXPORT_C DDmaRequest::DDmaRequest(TDmaChannel& aChannel, TCallback aCb,
+								  TAny* aCbArg, TInt aMaxTransferSize)
+	: iChannel(aChannel),
+	  iCb(aCb),
+	  iCbArg(aCbArg),
+	  iDmaCb(NULL),
+	  iDmaCbArg(NULL),
+	  iIsrCb(EFalse),
+	  iDesCount(0),
+	  iFirstHdr(NULL),
+	  iLastHdr(NULL),
+	  iSrcDesCount(0),
+	  iSrcFirstHdr(NULL),
+	  iSrcLastHdr(NULL),
+	  iDstDesCount(0),
+	  iDstFirstHdr(NULL),
+	  iDstLastHdr(NULL),
+	  iQueued(EFalse),
+	  iMaxTransferSize(aMaxTransferSize),
+	  iTotalNumSrcElementsTransferred(0),
+	  iTotalNumDstElementsTransferred(0)
+	{
+	iChannel.iReqCount++;
+	__DMA_ASSERTD(0 <= aMaxTransferSize);
+	__DMA_INVARIANT();
+	}
+
+
+//
+// As DDmaRequest is derived from DBase, the initializations with zero aren't
+// strictly necessary here, but this way it's nicer.
+//
+EXPORT_C DDmaRequest::DDmaRequest(TDmaChannel& aChannel, TDmaCallback aDmaCb,
+								  TAny* aCbArg, TUint aMaxTransferSize)
+	: iChannel(aChannel),
+	  iCb(NULL),
+	  iCbArg(NULL),
+	  iDmaCb(aDmaCb),
+	  iDmaCbArg(aCbArg),
+	  iIsrCb(EFalse),
+	  iDesCount(0),
+	  iFirstHdr(NULL),
+	  iLastHdr(NULL),
+	  iSrcDesCount(0),
+	  iSrcFirstHdr(NULL),
+	  iSrcLastHdr(NULL),
+	  iDstDesCount(0),
+	  iDstFirstHdr(NULL),
+	  iDstLastHdr(NULL),
+	  iQueued(EFalse),
+	  iMaxTransferSize(aMaxTransferSize),
+	  iTotalNumSrcElementsTransferred(0),
+	  iTotalNumDstElementsTransferred(0)
+	{
+	__e32_atomic_add_ord32(&iChannel.iReqCount, 1);
+	__DMA_INVARIANT();
+	}
+
+
+EXPORT_C DDmaRequest::~DDmaRequest()
+	{
+	__DMA_ASSERTD(!iQueued);
+	__DMA_INVARIANT();
+	FreeDesList();
+	__e32_atomic_add_ord32(&iChannel.iReqCount, TUint32(-1));
+	}
+
+
+EXPORT_C TInt DDmaRequest::Fragment(TUint32 aSrc, TUint32 aDest, TInt aCount,
+									TUint aFlags, TUint32 aPslInfo)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::Fragment thread %O "
+									"src=0x%08X dest=0x%08X count=%d flags=0x%X psl=0x%08X",
+									&Kern::CurrentThread(), aSrc, aDest, aCount, aFlags, aPslInfo));
+	__DMA_ASSERTD(aCount > 0);
+
+	TDmaTransferArgs args(aSrc, aDest, aCount, aFlags, aPslInfo);
+
+	return Frag(args);
+	}
+
+
+EXPORT_C TInt DDmaRequest::Fragment(const TDmaTransferArgs& aTransferArgs)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::Fragment thread %O", &Kern::CurrentThread()));
+
+	// Writable temporary working copy of the transfer arguments.
+	// We need this because we may have to modify some fields before passing it
+	// to the PSL (for example iChannelCookie, iTransferCount,
+	// iDstConfig::iAddr, and iSrcConfig::iAddr).
+	TDmaTransferArgs args(aTransferArgs);
+
+	return Frag(args);
+	}
+
+
+TUint DDmaRequest::GetTransferCount(const TDmaTransferArgs& aTransferArgs)
+	{
+	const TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
+	const TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
+
+	TUint count = aTransferArgs.iTransferCount;
+	if (count == 0)
+		{
+		__KTRACE_OPT(KDMA, Kern::Printf("iTransferCount == 0"));
+		count = src.iElementSize * src.iElementsPerFrame *
+			src.iFramesPerTransfer;
+		const TUint dst_cnt = dst.iElementSize * dst.iElementsPerFrame *
+			dst.iFramesPerTransfer;
+		if (count != dst_cnt)
+			{
+			__KTRACE_OPT(KPANIC, Kern::Printf("Error: (count != dst_cnt)"));
+			return 0;
+			}
+		}
+	else
+		{
+		__KTRACE_OPT(KDMA, Kern::Printf("iTransferCount == %d", count));
+		// Client shouldn't specify contradictory or incomplete things
+		if (src.iElementSize != 0)
+			{
+			if ((count % src.iElementSize) != 0)
+				{
+				__KTRACE_OPT(KPANIC,
+							 Kern::Printf("Error: ((count %% src.iElementSize) != 0)"));
+				return 0;
+				}
+			if (src.iElementsPerFrame != 0)
+				{
+				if ((src.iElementSize * src.iElementsPerFrame * src.iFramesPerTransfer) != count)
+					{
+					__KTRACE_OPT(KPANIC,
+								 Kern::Printf("Error: ((src.iElementSize * "
+											  "src.iElementsPerFrame * "
+											  "src.iFramesPerTransfer) != count)"));
+					return 0;
+					}
+				}
+			}
+		else
+			{
+			if (src.iElementsPerFrame != 0)
+				{
+				__KTRACE_OPT(KPANIC,
+							 Kern::Printf("Error: (src.iElementsPerFrame != 0)"));
+				return 0;
+				}
+			if (src.iFramesPerTransfer != 0)
+				{
+				__KTRACE_OPT(KPANIC,
+							 Kern::Printf("Error: (src.iFramesPerTransfer != 0)"));
+				return 0;
+				}
+			if (src.iElementsPerPacket != 0)
+				{
+				__KTRACE_OPT(KPANIC,
+							 Kern::Printf("Error: (src.iElementsPerPacket != 0)"));
+				return 0;
+				}
+			}
+		if (dst.iElementSize != 0)
+			{
+			if ((count % dst.iElementSize) != 0)
+				{
+				__KTRACE_OPT(KPANIC,
+							 Kern::Printf("Error: ((count %% dst.iElementSize) != 0)"));
+				return 0;
+				}
+			if (dst.iElementsPerFrame != 0)
+				{
+				if ((dst.iElementSize * dst.iElementsPerFrame * dst.iFramesPerTransfer) != count)
+					{
+					__KTRACE_OPT(KPANIC,
+								 Kern::Printf("Error: ((dst.iElementSize * "
+											  "dst.iElementsPerFrame * "
+											  "dst.iFramesPerTransfer) != count)"));
+					return 0;
+					}
+				}
+			}
+		else
+			{
+			if (dst.iElementsPerFrame != 0)
+				{
+				__KTRACE_OPT(KPANIC,
+							 Kern::Printf("Error: (dst.iElementsPerFrame != 0)"));
+				return 0;
+				}
+			if (dst.iFramesPerTransfer != 0)
+				{
+				__KTRACE_OPT(KPANIC,
+							 Kern::Printf("Error: (dst.iFramesPerTransfer != 0)"));
+				return 0;
+				}
+			if (dst.iElementsPerPacket != 0)
+				{
+				__KTRACE_OPT(KPANIC,
+							 Kern::Printf("Error: (dst.iElementsPerPacket != 0)"));
+				return 0;
+				}
+			}
+		}
+	return count;
+	}
+
+
+TInt DDmaRequest::Frag(TDmaTransferArgs& aTransferArgs)
+	{
+	__DMA_ASSERTD(!iQueued);
+
+	// Transfer count checks
+	const TUint count = GetTransferCount(aTransferArgs);
+	if (count == 0)
+		{
+		return KErrArgument;
+		}
+
+	const TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
+	const TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
+
+	// Ask the PSL what the maximum length possible for this transfer is
+	TUint max_xfer_len = iChannel.MaxTransferLength(src.iFlags, dst.iFlags,
+													aTransferArgs.iPslRequestInfo);
+	if (iMaxTransferSize)
+		{
+		// User has set a size cap
+		__KTRACE_OPT(KDMA, Kern::Printf("iMaxTransferSize != 0"));
+		__DMA_ASSERTA((iMaxTransferSize <= max_xfer_len) || (max_xfer_len == 0));
+		max_xfer_len = iMaxTransferSize;
+		}
+	else
+		{
+		// User doesn't care about max size
+		if (max_xfer_len == 0)
+			{
+			// No maximum imposed by controller
+			max_xfer_len = count;
+			}
+		}
+
+	// ISR callback requested?
+	const TBool isr_cb = (aTransferArgs.iFlags & KDmaRequestCallbackFromIsr);
+	if (isr_cb)
+		{
+		// Requesting an ISR callback w/o supplying one?
+		if (!iDmaCb)
+			{
+			return KErrArgument;
+			}
+		}
+
+	// Set the channel cookie for the PSL
+	aTransferArgs.iChannelCookie = iChannel.PslId();
+
+	// Now the actual fragmentation
+	TInt r;
+	if (iChannel.iDmacCaps->iAsymHwDescriptors)
+		{
+		r = FragAsym(aTransferArgs, count, max_xfer_len);
+		}
+	else
+		{
+		r = FragSym(aTransferArgs, count, max_xfer_len);
+		}
+
+	if (r == KErrNone)
+		{
+		iIsrCb = isr_cb;
+		}
+
+	__DMA_INVARIANT();
+	return r;
+	};
+
+
+TInt DDmaRequest::FragSym(TDmaTransferArgs& aTransferArgs, TUint aCount,
+						  TUint aMaxTransferLen)
+	{
+	TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
+	TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
+
+	const TBool mem_src = (src.iFlags & KDmaMemAddr);
+	const TBool mem_dst = (dst.iFlags & KDmaMemAddr);
+
+	const TUint align_mask_src = iChannel.AddressAlignMask(src.iFlags,
+														   src.iElementSize,
+														   aTransferArgs.iPslRequestInfo);
+	const TUint align_mask_dst = iChannel.AddressAlignMask(dst.iFlags,
+														   dst.iElementSize,
+														   aTransferArgs.iPslRequestInfo);
+	// Memory buffers must satisfy alignment constraint
+	__DMA_ASSERTD(!mem_src || ((src.iAddr & align_mask_src) == 0));
+	__DMA_ASSERTD(!mem_dst || ((dst.iAddr & align_mask_dst) == 0));
+
+	const TUint max_aligned_len = (aMaxTransferLen &
+								   ~(Max(align_mask_src, align_mask_dst)));
+	// Client and PSL sane?
+	__DMA_ASSERTD(max_aligned_len > 0);
+
+	FreeDesList();			   // revert any previous fragmentation attempt
+	TInt r;
+	do
+		{
+		// Allocate fragment
+		r = ExpandDesList(/*1*/);
+		if (r != KErrNone)
+			{
+			FreeDesList();
+			break;
+			}
+		// Compute fragment size
+		TUint c = Min(aMaxTransferLen, aCount);
+		if (mem_src && !(src.iFlags & KDmaPhysAddr))
+			{
+			__KTRACE_OPT(KDMA, Kern::Printf("mem_src && !(src.iFlags & KDmaPhysAddr)"));
+			// @@@ Should also take into account (src.iFlags & KDmaMemIsContiguous)!
+			c = MaxPhysSize(src.iAddr, c);
+			}
+		if (mem_dst && !(dst.iFlags & KDmaPhysAddr))
+			{
+			__KTRACE_OPT(KDMA, Kern::Printf("mem_dst && !(dst.iFlags & KDmaPhysAddr)"));
+			// @@@ Should also take into account (dst.iFlags & KDmaMemIsContiguous)!
+			c = MaxPhysSize(dst.iAddr, c);
+			}
+		if ((mem_src || mem_dst) && (c < aCount) && (c > max_aligned_len))
+			{
+			// This is not the last fragment of a transfer to/from memory.
+			// We must round down the fragment size so the next one is
+			// correctly aligned.
+			__KTRACE_OPT(KDMA, Kern::Printf("(mem_src || mem_dst) && (c < aCount) && (c > max_aligned_len)"));
+			c = max_aligned_len;
+			}
+
+		// TODO: Make sure an element or frame on neither src or dst side
+		// (which can be of different sizes) never straddles a DMA subtransfer.
+		// (This would be a fragmentation error by the PIL.)
+
+		// Set transfer count for the PSL
+		aTransferArgs.iTransferCount = c;
+		__KTRACE_OPT(KDMA, Kern::Printf("this fragm.: %d (0x%x) total remain.: %d (0x%x)",
+										c, c, aCount, aCount));
+		// Initialise fragment
+		r = iChannel.iController->InitDes(*iLastHdr, aTransferArgs);
+		if (r != KErrNone)
+			{
+			FreeDesList();
+			break;
+			}
+		// Update for next iteration
+		aCount -= c;
+		if (mem_src)
+			src.iAddr += c;
+		if (mem_dst)
+			dst.iAddr += c;
+		}
+	while (aCount > 0);
+
+	return r;
+	}
+
+
+TInt DDmaRequest::FragAsym(TDmaTransferArgs& aTransferArgs, TUint aCount,
+						   TUint aMaxTransferLen)
+	{
+	TInt r = FragAsymSrc(aTransferArgs, aCount, aMaxTransferLen);
+	if (r != KErrNone)
+		{
+		FreeSrcDesList();
+		return r;
+		}
+	r = FragAsymDst(aTransferArgs, aCount, aMaxTransferLen);
+	if (r != KErrNone)
+		{
+		FreeSrcDesList();
+		FreeDstDesList();
+		}
+	return r;
+	}
+
+
+TInt DDmaRequest::FragAsymSrc(TDmaTransferArgs& aTransferArgs, TUint aCount,
+							  TUint aMaxTransferLen)
+	{
+	TDmaTransferConfig& src = aTransferArgs.iSrcConfig;
+
+	const TBool mem_src = (src.iFlags & KDmaMemAddr);
+
+	const TUint align_mask = iChannel.AddressAlignMask(src.iFlags,
+													   src.iElementSize,
+													   aTransferArgs.iPslRequestInfo);
+	// Memory buffers must satisfy alignment constraint
+	__DMA_ASSERTD(!mem_src || ((src.iAddr & align_mask) == 0));
+
+	const TUint max_aligned_len = (aMaxTransferLen & ~align_mask);
+	__DMA_ASSERTD(max_aligned_len > 0);				  // bug in PSL if not true
+
+	FreeSrcDesList();
+	TInt r;
+	do
+		{
+		// Allocate fragment
+		r = ExpandSrcDesList(/*1*/);
+		if (r != KErrNone)
+			{
+			break;
+			}
+		// Compute fragment size
+		TUint c = Min(aMaxTransferLen, aCount);
+		if (mem_src && !(src.iFlags & KDmaPhysAddr))
+			{
+			__KTRACE_OPT(KDMA, Kern::Printf("mem_src && !(src.iFlags & KDmaPhysAddr)"));
+			c = MaxPhysSize(src.iAddr, c);
+			}
+		if (mem_src && (c < aCount) && (c > max_aligned_len))
+			{
+			// This is not the last fragment of a transfer from memory.
+			// We must round down the fragment size so the next one is
+			// correctly aligned.
+			__KTRACE_OPT(KDMA, Kern::Printf("mem_src && (c < aCount) && (c > max_aligned_len)"));
+			c = max_aligned_len;
+			}
+		// Set transfer count for the PSL
+		aTransferArgs.iTransferCount = c;
+		__KTRACE_OPT(KDMA, Kern::Printf("this fragm.: %d (0x%x) total remain.: %d (0x%x)",
+										c, c, aCount, aCount));
+		// Initialise fragment
+		r = iChannel.iController->InitSrcHwDes(*iSrcLastHdr, aTransferArgs);
+		if (r != KErrNone)
+			{
+			break;
+			}
+		// Update for next iteration
+		aCount -= c;
+		if (mem_src)
+			src.iAddr += c;
+		}
+	while (aCount > 0);
+
+	return r;
+	}
+
+
+TInt DDmaRequest::FragAsymDst(TDmaTransferArgs& aTransferArgs, TUint aCount,
+							  TUint aMaxTransferLen)
+	{
+	TDmaTransferConfig& dst = aTransferArgs.iDstConfig;
+
+	const TBool mem_dst = (dst.iFlags & KDmaMemAddr);
+
+	const TUint align_mask = iChannel.AddressAlignMask(dst.iFlags,
+													   dst.iElementSize,
+													   aTransferArgs.iPslRequestInfo);
+	// Memory buffers must satisfy alignment constraint
+	__DMA_ASSERTD(!mem_dst || ((dst.iAddr & align_mask) == 0));
+
+	const TUint max_aligned_len = (aMaxTransferLen & ~align_mask);
+	__DMA_ASSERTD(max_aligned_len > 0);				  // bug in PSL if not true
+
+	FreeDstDesList();
+	TInt r;
+	do
+		{
+		// Allocate fragment
+		r = ExpandDstDesList(/*1*/);
+		if (r != KErrNone)
+			{
+			break;
+			}
+		// Compute fragment size
+		TUint c = Min(aMaxTransferLen, aCount);
+		if (mem_dst && !(dst.iFlags & KDmaPhysAddr))
+			{
+			__KTRACE_OPT(KDMA, Kern::Printf("mem_dst && !(dst.iFlags & KDmaPhysAddr)"));
+			c = MaxPhysSize(dst.iAddr, c);
+			}
+		if (mem_dst && (c < aCount) && (c > max_aligned_len))
+			{
+			// This is not the last fragment of a transfer to memory.
+			// We must round down the fragment size so the next one is
+			// correctly aligned.
+			__KTRACE_OPT(KDMA, Kern::Printf("mem_dst && (c < aCount) && (c > max_aligned_len)"));
+			c = max_aligned_len;
+			}
+		// Set transfer count for the PSL
+		aTransferArgs.iTransferCount = c;
+		__KTRACE_OPT(KDMA, Kern::Printf("this fragm.: %d (0x%x) total remain.: %d (0x%x)",
+										c, c, aCount, aCount));
+		// Initialise fragment
+		r = iChannel.iController->InitDstHwDes(*iDstLastHdr, aTransferArgs);
+		if (r != KErrNone)
+			{
+			break;
+			}
+		// Update for next iteration
+		aCount -= c;
+		if (mem_dst)
+			dst.iAddr += c;
+		}
+	while (aCount > 0);
+
+	return r;
+	}
+
+
+EXPORT_C TInt DDmaRequest::Queue()
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaRequest::Queue thread %O", &Kern::CurrentThread()));
+	__DMA_ASSERTD(iDesCount > 0);	// Not configured? Call Fragment() first!
+	__DMA_ASSERTD(!iQueued);
+
+	// Append request to queue and link new descriptor list to existing one.
+	iChannel.Wait();
+
+	TInt r = KErrGeneral;
+	const TBool ch_isr_cb = __e32_atomic_load_acq32(&iChannel.iIsrCbRequest);
+	if (ch_isr_cb)
+		{
+		// Client mustn't try to queue any new request while one with an ISR
+		// callback is already queued on this channel. This is to make sure
+		// that the channel's Transfer() function is not called by both the ISR
+		// and the client thread at the same time.
+		__KTRACE_OPT(KPANIC, Kern::Printf("An ISR cb request exists - not queueing"));
+		}
+	else if (iIsrCb && !iChannel.IsQueueEmpty())
+		{
+		// Client mustn't try to queue an ISR callback request whilst any
+		// others are still queued on this channel. This is to make sure that
+		// the ISR callback doesn't get executed together with the DFC(s) of
+		// any previous request(s).
+		__KTRACE_OPT(KPANIC, Kern::Printf("Request queue not empty - not queueing"));
+		}
+	else if (iChannel.iIsrDfc & (TUint32)TDmaChannel::KCancelFlagMask)
+		{
+		__KTRACE_OPT(KPANIC, Kern::Printf("Channel requests cancelled - not queueing"));
+		}
+	else
+		{
+		iQueued = ETrue;
+		iChannel.iReqQ.Add(&iLink);
+		// iChannel.iNullPtr points to iChannel.iCurHdr for an empty queue
+		*iChannel.iNullPtr = iFirstHdr;
+		iChannel.iNullPtr = &(iLastHdr->iNext);
+		if (iIsrCb)
+			{
+			// Since we've made sure that there is no other request in the
+			// queue before this, the only thing of relevance is the channel
+			// DFC which might yet have to complete for the previous request,
+			// and this function might indeed have been called from there via
+			// the client callback. This should be all right though as once
+			// we've set the following flag no further Queue()'s will be
+			// possible.
+			__e32_atomic_store_rel32(&iChannel.iIsrCbRequest, ETrue);
+			}
+		iChannel.DoQueue(const_cast<const DDmaRequest&>(*this));
+		r = KErrNone;
+		}
+	iChannel.Signal();
+
+	__DMA_INVARIANT();
+	return r;
+	}
+
+
+EXPORT_C TInt DDmaRequest::ExpandDesList(TInt aCount)
+	{
+	return ExpandDesList(aCount, iDesCount, iFirstHdr, iLastHdr);
+	}
+
+
+EXPORT_C TInt DDmaRequest::ExpandSrcDesList(TInt aCount)
+	{
+	return ExpandDesList(aCount, iSrcDesCount, iSrcFirstHdr, iSrcLastHdr);
+	}
+
+
+EXPORT_C TInt DDmaRequest::ExpandDstDesList(TInt aCount)
+	{
+	return ExpandDesList(aCount, iDstDesCount, iDstFirstHdr, iDstLastHdr);
+	}
+
+
+TInt DDmaRequest::ExpandDesList(TInt aCount, TInt& aDesCount,
+								SDmaDesHdr*& aFirstHdr,
+								SDmaDesHdr*& aLastHdr)
+	{
+	__DMA_ASSERTD(!iQueued);
+	__DMA_ASSERTD(aCount > 0);
+
+	if (aCount > iChannel.iAvailDesCount)
+		{
+		return KErrTooBig;
+		}
+
+	iChannel.iAvailDesCount -= aCount;
+	aDesCount += aCount;
+
+	TDmac& c = *(iChannel.iController);
+	c.Wait();
+
+	if (aFirstHdr == NULL)
+		{
+		// Handle an empty list specially to simplify the following loop
+		aFirstHdr = aLastHdr = c.iFreeHdr;
+		c.iFreeHdr = c.iFreeHdr->iNext;
+		--aCount;
+		}
+	else
+		{
+		aLastHdr->iNext = c.iFreeHdr;
+		}
+
+	// Remove as many descriptors and headers from the free pool as necessary
+	// and ensure hardware descriptors are chained together.
+	while (aCount-- > 0)
+		{
+		__DMA_ASSERTD(c.iFreeHdr != NULL);
+		if (c.iCapsHwDes)
+			{
+			c.ChainHwDes(*aLastHdr, *(c.iFreeHdr));
+			}
+		aLastHdr = c.iFreeHdr;
+		c.iFreeHdr = c.iFreeHdr->iNext;
+		}
+
+	c.Signal();
+
+	aLastHdr->iNext = NULL;
+
+	__DMA_INVARIANT();
+	return KErrNone;
+	}
+
+
+EXPORT_C void DDmaRequest::FreeDesList()
+	{
+	FreeDesList(iDesCount, iFirstHdr, iLastHdr);
+	}
+
+
+EXPORT_C void DDmaRequest::FreeSrcDesList()
+	{
+	FreeDesList(iSrcDesCount, iSrcFirstHdr, iSrcLastHdr);
+	}
+
+
+EXPORT_C void DDmaRequest::FreeDstDesList()
+	{
+	FreeDesList(iDstDesCount, iDstFirstHdr, iDstLastHdr);
+	}
+
+
+void DDmaRequest::FreeDesList(TInt& aDesCount, SDmaDesHdr*& aFirstHdr, SDmaDesHdr*& aLastHdr)
+	{
+	__DMA_ASSERTD(!iQueued);
+
+	if (aDesCount > 0)
+		{
+		iChannel.iAvailDesCount += aDesCount;
+		TDmac& c = *(iChannel.iController);
+		const SDmaDesHdr* hdr = aFirstHdr;
+		while (hdr)
+			{
+			c.ClearHwDes(*hdr);
+			hdr = hdr->iNext;
+			};
+		c.Wait();
+		aLastHdr->iNext = c.iFreeHdr;
+		c.iFreeHdr = aFirstHdr;
+		c.Signal();
+		aFirstHdr = aLastHdr = NULL;
+		aDesCount = 0;
+		}
+	}
+
+
+EXPORT_C void DDmaRequest::EnableSrcElementCounting(TBool /*aResetElementCount*/)
+	{
+	// Not yet implemented.
+	return;
+	}
+
+
+EXPORT_C void DDmaRequest::EnableDstElementCounting(TBool /*aResetElementCount*/)
+	{
+	// Not yet implemented.
+	return;
+	}
+
+
+EXPORT_C void DDmaRequest::DisableSrcElementCounting()
+	{
+	// Not yet implemented.
+	return;
+	}
+
+
+EXPORT_C void DDmaRequest::DisableDstElementCounting()
+	{
+	// Not yet implemented.
+	return;
+	}
+
+
+EXPORT_C TUint32 DDmaRequest::TotalNumSrcElementsTransferred()
+	{
+	// Not yet implemented.
+
+	// So far largely bogus code (just to touch some symbols)...
+	iTotalNumSrcElementsTransferred = 0;
+	TDmac& c = *(iChannel.iController);
+	if (c.iCapsHwDes)
+		{
+		for (const SDmaDesHdr* pH = iFirstHdr; pH != NULL; pH = pH->iNext)
+			{
+			iTotalNumSrcElementsTransferred += c.HwDesNumDstElementsTransferred(*pH);
+			}
+		}
+	else
+		{
+		// Do something different for pseudo descriptors...
+		}
+	return iTotalNumSrcElementsTransferred;
+	}
+
+
+EXPORT_C TUint32 DDmaRequest::TotalNumDstElementsTransferred()
+	{
+	// Not yet implemented.
+	return iTotalNumDstElementsTransferred;
+	}
+
+
+EXPORT_C TInt DDmaRequest::FragmentCount()
+	{
+	return FragmentCount(iFirstHdr);
+	}
+
+
+EXPORT_C TInt DDmaRequest::SrcFragmentCount()
+	{
+	return FragmentCount(iSrcFirstHdr);
+	}
+
+
+EXPORT_C TInt DDmaRequest::DstFragmentCount()
+	{
+	return FragmentCount(iDstFirstHdr);
+	}
+
+
+TInt DDmaRequest::FragmentCount(const SDmaDesHdr* aHdr)
+	{
+	TInt count = 0;
+	for (const SDmaDesHdr* pH = aHdr; pH != NULL; pH = pH->iNext)
+		{
+		count++;
+		}
+	return count;
+	}
+
+
+//
+// Called when request is removed from request queue in channel
+//
+inline void DDmaRequest::OnDeque()
+	{
+	iQueued = EFalse;
+	iLastHdr->iNext = NULL;
+	iChannel.DoUnlink(*iLastHdr);
+	}
+
+
+#ifdef _DEBUG
+void DDmaRequest::Invariant()
+	{
+	iChannel.Wait();
+	__DMA_ASSERTD(LOGICAL_XOR(iCb, iDmaCb));
+	if (iChannel.iDmacCaps->iAsymHwDescriptors)
+		{
+		__DMA_ASSERTD((0 <= iSrcDesCount) && (iSrcDesCount <= iChannel.iMaxDesCount) &&
+					  (0 <= iDstDesCount) && (iDstDesCount <= iChannel.iMaxDesCount));
+		if (iSrcDesCount == 0)
+			{
+			__DMA_ASSERTD(iDstDesCount == 0);
+			__DMA_ASSERTD(!iQueued);
+			__DMA_ASSERTD(!iSrcFirstHdr && !iSrcLastHdr &&
+						  !iDstFirstHdr && !iDstLastHdr);
+			}
+		else
+			{
+			__DMA_ASSERTD(iChannel.iController->IsValidHdr(iSrcFirstHdr));
+			__DMA_ASSERTD(iChannel.iController->IsValidHdr(iSrcLastHdr));
+			__DMA_ASSERTD(iChannel.iController->IsValidHdr(iDstFirstHdr));
+			__DMA_ASSERTD(iChannel.iController->IsValidHdr(iDstLastHdr));
+			}
+		}
+	else
+		{
+		__DMA_ASSERTD((0 <= iDesCount) && (iDesCount <= iChannel.iMaxDesCount));
+		if (iDesCount == 0)
+			{
+			__DMA_ASSERTD(!iQueued);
+			__DMA_ASSERTD(!iFirstHdr && !iLastHdr);
+			}
+		else
+			{
+			__DMA_ASSERTD(iChannel.iController->IsValidHdr(iFirstHdr));
+			__DMA_ASSERTD(iChannel.iController->IsValidHdr(iLastHdr));
+			}
+		}
+	iChannel.Signal();
+	}
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////////
+// TDmaChannel
+
+_LIT(KDmaChannelMutex, "DMA-Channel");
+
+TDmaChannel::TDmaChannel()
+	: iController(NULL),
+	  iDmacCaps(NULL),
+	  iPslId(0),
+	  iDynChannel(EFalse),
+	  iPriority(KDmaPriorityNone),
+	  iCurHdr(NULL),
+	  iNullPtr(&iCurHdr),
+	  iDfc(Dfc, NULL, 0),
+	  iMaxDesCount(0),
+	  iAvailDesCount(0),
+	  iIsrDfc(0),
+	  iReqQ(),
+	  iReqCount(0),
+	  iCancelInfo(NULL),
+	  iRedoRequest(EFalse),
+	  iIsrCbRequest(EFalse)
+	{
+	const TInt r = Kern::MutexCreate(iMutex, KDmaChannelMutex, KMutexOrdDmaChannel);
+	__DMA_ASSERTA(r == KErrNone);
+
+#ifndef __WINS__
+	// On the emulator this code is called from within the codeseg mutex.
+	// The invariant tries to hold the dma channel mutex, but this is not allowed
+	__DMA_INVARIANT();
+#endif
+	}
+
+
+TDmaChannel::~TDmaChannel()
+	{
+	Kern::SafeClose((DObject*&)iMutex, NULL);
+	}
+
+
+//
+// static member function
+//
+EXPORT_C TInt TDmaChannel::Open(const SCreateInfo& aInfo, TDmaChannel*& aChannel)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Open thread %O", &Kern::CurrentThread()));
+
+	__DMA_ASSERTD(aInfo.iDesCount >= 1);
+	__DMA_ASSERTD(aInfo.iPriority <= KDmaPriority8);
+	__DMA_ASSERTD(aInfo.iDfcQ != NULL);
+	__DMA_ASSERTD(aInfo.iDfcPriority < KNumDfcPriorities);
+
+	aChannel = NULL;
+
+	DmaChannelMgr::Wait();
+	TDmaChannel* pC = DmaChannelMgr::Open(aInfo.iCookie, aInfo.iDynChannel, aInfo.iPriority);
+	DmaChannelMgr::Signal();
+	if (!pC)
+		{
+		return KErrInUse;
+		}
+	__DMA_ASSERTD(pC->iController != NULL);
+	__DMA_ASSERTD(pC->iDmacCaps != NULL);
+	__DMA_ASSERTD(pC->iController->iCapsHwDes == pC->DmacCaps().iHwDescriptors);
+	// PSL needs to set iDynChannel if and only if dynamic channel was requested
+	__DMA_ASSERTD(!LOGICAL_XOR(aInfo.iDynChannel, pC->iDynChannel));
+
+	const TInt r = pC->iController->ReserveSetOfDes(aInfo.iDesCount);
+	if (r != KErrNone)
+		{
+		pC->Close();
+		return r;
+		}
+	pC->iAvailDesCount = pC->iMaxDesCount = aInfo.iDesCount;
+
+	new (&pC->iDfc) TDfc(&Dfc, pC, aInfo.iDfcQ, aInfo.iDfcPriority);
+
+	aChannel = pC;
+
+#ifdef _DEBUG
+	pC->Invariant();
+#endif
+	__KTRACE_OPT(KDMA, Kern::Printf("opened channel %d", pC->iPslId));
+	return KErrNone;
+	}
+
+
+EXPORT_C void TDmaChannel::Close()
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Close %d iReqCount=%d", iPslId, iReqCount));
+	__DMA_ASSERTD(IsQueueEmpty());
+	__DMA_ASSERTD(iReqCount == 0);
+
+	// Descriptor leak? -> bug in request code
+	__DMA_ASSERTD(iAvailDesCount == iMaxDesCount);
+
+	__DMA_ASSERTD(!iRedoRequest);
+	__DMA_ASSERTD(!iIsrCbRequest);
+
+	iController->ReleaseSetOfDes(iMaxDesCount);
+	iAvailDesCount = iMaxDesCount = 0;
+
+	DmaChannelMgr::Wait();
+	DmaChannelMgr::Close(this);
+	// The following assignment will be removed once IsOpened() has been
+	// removed. That's because 'this' shouldn't be touched any more once
+	// Close() has returned from the PSL.
+	iController = NULL;
+	DmaChannelMgr::Signal();
+	}
+
+
+EXPORT_C TInt TDmaChannel::LinkToChannel(TDmaChannel* aChannel)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::LinkToChannel thread %O",
+									&Kern::CurrentThread()));
+	if (aChannel)
+		{
+		return iController->LinkChannels(*this, *aChannel);
+		}
+	else
+		{
+		return iController->UnlinkChannel(*this);
+		}
+	}
+
+
+EXPORT_C TInt TDmaChannel::Pause()
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Pause thread %O",
+									&Kern::CurrentThread()));
+	return iController->PauseTransfer(*this);
+	}
+
+
+EXPORT_C TInt TDmaChannel::Resume()
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::Resume thread %O",
+									&Kern::CurrentThread()));
+	return iController->ResumeTransfer(*this);
+	}
+
+
+EXPORT_C void TDmaChannel::CancelAll()
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::CancelAll thread %O channel - %d",
+									&Kern::CurrentThread(), iPslId));
+	NThread* const nt = NKern::CurrentThread();
+	TBool wait = EFalse;
+	TDmaCancelInfo cancelinfo;
+	TDmaCancelInfo* waiters = NULL;
+
+	NKern::ThreadEnterCS();
+	Wait();
+
+	NThreadBase* const dfc_nt = iDfc.Thread();
+	// Shouldn't be NULL (i.e. an IDFC)
+	__DMA_ASSERTD(dfc_nt);
+
+	__e32_atomic_store_ord32(&iIsrDfc, (TUint32)KCancelFlagMask);
+	// ISRs after this point will not post a DFC, however a DFC may already be
+	// queued or running or both.
+	if (!IsQueueEmpty())
+		{
+		// There is a transfer in progress. It may complete before the DMAC
+		// has stopped, but the resulting ISR will not post a DFC.
+		// ISR should not happen after this function returns.
+		iController->StopTransfer(*this);
+
+		ResetStateMachine();
+
+		// Clean-up the request queue.
+		SDblQueLink* pL;
+		while ((pL = iReqQ.GetFirst()) != NULL)
+			{
+			DDmaRequest* pR = _LOFF(pL, DDmaRequest, iLink);
+			pR->OnDeque();
+			}
+		}
+	if (dfc_nt == nt)
+		{
+		// DFC runs in this thread, so just cancel it and we're finished
+		iDfc.Cancel();
+
+		// If other calls to CancelAll() are waiting for the DFC, release them here
+		waiters = iCancelInfo;
+		iCancelInfo = NULL;
+
+		// Reset the ISR count
+		__e32_atomic_store_rel32(&iIsrDfc, 0);
+		}
+	else
+		{
+		// DFC runs in another thread. Make sure it's queued and then wait for it to run.
+		if (iCancelInfo)
+			{
+			// Insert cancelinfo into the list so that it precedes iCancelInfo
+			cancelinfo.InsertBefore(iCancelInfo);
+			}
+		else
+			{
+			iCancelInfo = &cancelinfo;
+			}
+		wait = ETrue;
+		iDfc.Enque();
+		}
+
+	Signal();
+
+	if (waiters)
+		{
+		waiters->Signal();
+		}
+	else if (wait)
+		{
+		NKern::FSWait(&cancelinfo.iSem);
+		}
+
+ 	NKern::ThreadLeaveCS();
+	__DMA_INVARIANT();
+	}
+
+
+EXPORT_C TInt TDmaChannel::IsrRedoRequest(TUint32 aSrcAddr, TUint32 aDstAddr,
+										  TUint aTransferCount,
+										  TUint32 aPslRequestInfo,
+										  TBool aIsrCb)
+	{
+	__KTRACE_OPT(KDMA,
+				 Kern::Printf("TDmaChannel::IsrRedoRequest src=0x%08x, "
+							  "dst=0x%08x, count=%d, pslInfo=0x%08x, isrCb=%d",
+							  aSrcAddr, aDstAddr, aTransferCount, aPslRequestInfo,
+							  aIsrCb));
+	// Function needs to be called in ISR context.
+	__DMA_ASSERTD(NKern::CurrentContext() == NKern::EInterrupt);
+
+	__DMA_ASSERTD(!iReqQ.IsEmpty());
+	__DMA_ASSERTD(iIsrCbRequest);
+
+#ifdef _DEBUG
+	if ((aSrcAddr != KPhysAddrInvalid) && (aSrcAddr == aDstAddr))
+		{
+		__KTRACE_OPT(KPANIC,
+					 Kern::Printf("Error: Updating src & dst to same address: 0x%08x",
+								  aSrcAddr));
+		return KErrArgument;
+		}
+#endif
+
+	// We assume here that the just completed request is the first one in the
+	// queue, i.e. that even if there is more than one request in the queue,
+	// their respective last and first (hw) descriptors are *not* linked.
+	// (Although that's what apparently happens in TDmaSgChannel::DoQueue() /
+	// TDmac::AppendHwDes() @@@).
+	DDmaRequest* const pCurReq = _LOFF(iReqQ.First(), DDmaRequest, iLink);
+	TInt r;
+
+	if (iDmacCaps->iAsymHwDescriptors)
+		{
+		// We don't allow multiple-descriptor chains to be updated here
+		__DMA_ASSERTD((pCurReq->iSrcDesCount == 1) && (pCurReq->iDstDesCount == 1));
+		// Adjust parameters if necessary (asymmetrical s/g variety)
+		const SDmaDesHdr* const pSrcFirstHdr = pCurReq->iSrcFirstHdr;
+		if ((aSrcAddr != KPhysAddrInvalid) || aTransferCount || aPslRequestInfo)
+			{
+			r = iController->UpdateSrcHwDes(*pSrcFirstHdr, aSrcAddr,
+											aTransferCount, aPslRequestInfo);
+			if (r != KErrNone)
+				{
+				__KTRACE_OPT(KPANIC, Kern::Printf("Src descriptor updating failed in PSL"));
+				return r;
+				}
+			}
+		const SDmaDesHdr* const pDstFirstHdr = pCurReq->iDstFirstHdr;
+		if ((aDstAddr != KPhysAddrInvalid) || aTransferCount || aPslRequestInfo)
+			{
+			r = iController->UpdateDstHwDes(*pDstFirstHdr, aSrcAddr,
+											aTransferCount, aPslRequestInfo);
+			if (r != KErrNone)
+				{
+				__KTRACE_OPT(KPANIC, Kern::Printf("Dst descriptor updating failed in PSL"));
+				return r;
+				}
+			}
+		// Reschedule the request
+		iController->Transfer(*this, *pSrcFirstHdr, *pDstFirstHdr);
+		}
+	else
+		{
+		// We don't allow multiple-descriptor chains to be updated here
+		__DMA_ASSERTD(pCurReq->iDesCount == 1);
+		// Adjust parameters if necessary (symmetrical s/g and non-s/g variety)
+		const SDmaDesHdr* const pFirstHdr = pCurReq->iFirstHdr;
+		if ((aSrcAddr != KPhysAddrInvalid) || (aDstAddr != KPhysAddrInvalid) ||
+			aTransferCount || aPslRequestInfo)
+			{
+			r = iController->UpdateDes(*pFirstHdr, aSrcAddr, aDstAddr,
+									   aTransferCount, aPslRequestInfo);
+			if (r != KErrNone)
+				{
+				__KTRACE_OPT(KPANIC, Kern::Printf("Descriptor updating failed"));
+				return r;
+				}
+			}
+		// Reschedule the request
+		iController->Transfer(*this, *pFirstHdr);
+		}
+
+	if (!aIsrCb)
+		{
+		// Not another ISR callback please
+		pCurReq->iIsrCb = aIsrCb;
+		}
+	iRedoRequest = ETrue;
+
+	return KErrNone;
+	}
+
+
+EXPORT_C TInt TDmaChannel::FailNext(TInt /*aFragmentCount*/)
+	{
+	return iController->FailNext(*this);
+	}
+
+
+EXPORT_C TInt TDmaChannel::MissNextInterrupts(TInt aInterruptCount)
+	{
+	return iController->MissNextInterrupts(*this, aInterruptCount);
+	}
+
+
+EXPORT_C TInt TDmaChannel::Extension(TInt aCmd, TAny* aArg)
+	{
+	return iController->Extension(*this, aCmd, aArg);
+	}
+
+
+//
+// static member function
+//
+EXPORT_C TInt TDmaChannel::StaticExtension(TInt aCmd, TAny* aArg)
+	{
+	return DmaChannelMgr::StaticExtension(aCmd, aArg);
+	}
+
+
+EXPORT_C TUint TDmaChannel::MaxTransferLength(TUint aSrcFlags, TUint aDstFlags,
+											  TUint32 aPslInfo)
+	{
+	return iController->MaxTransferLength(*this, aSrcFlags, aDstFlags, aPslInfo);
+	}
+
+
+EXPORT_C TUint TDmaChannel::AddressAlignMask(TUint aTargetFlags, TUint aElementSize,
+											 TUint32 aPslInfo)
+	{
+	return iController->AddressAlignMask(*this, aTargetFlags, aElementSize, aPslInfo);
+	}
+
+
+EXPORT_C const SDmacCaps& TDmaChannel::DmacCaps()
+	{
+	return *iDmacCaps;
+	}
+
+
+//
+// DFC callback function (static member).
+//
+void TDmaChannel::Dfc(TAny* aArg)
+	{
+	static_cast<TDmaChannel*>(aArg)->DoDfc();
+	}
+
+
+//
+// This is quite a long function, but what can you do...
+//
+void TDmaChannel::DoDfc()
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("TDmaChannel::DoDfc thread %O channel - %d",
+									&Kern::CurrentThread(), iPslId));
+	Wait();
+
+	// Atomically fetch and reset the number of DFCs queued by the ISR and the
+	// error flag. Leave the cancel flag alone for now.
+	const TUint32 w = __e32_atomic_and_ord32(&iIsrDfc, (TUint32)KCancelFlagMask);
+	TUint32 count = w & KDfcCountMask;
+	const TBool error = w & (TUint32)KErrorFlagMask;
+	TBool stop = w & (TUint32)KCancelFlagMask;
+	__DMA_ASSERTD((count > 0) || stop);
+
+	__DMA_ASSERTD(!iRedoRequest); // We shouldn't be here if this is true
+
+	while (count && !stop)
+		{
+		--count;
+
+		__DMA_ASSERTD(!iReqQ.IsEmpty());
+
+		// If an error occurred it must have been reported on the last
+		// interrupt since transfers are suspended after an error.
+		DDmaRequest::TResult const res = (count == 0 && error) ?
+			DDmaRequest::EError : DDmaRequest::EOk;
+		DDmaRequest* pCompletedReq = NULL;
+		DDmaRequest* const pCurReq = _LOFF(iReqQ.First(), DDmaRequest, iLink);
+
+		if (res == DDmaRequest::EOk)
+			{
+			// Update state machine, current fragment, completed fragment and
+			// tell the DMAC to transfer the next fragment if necessary.
+			SDmaDesHdr* pCompletedHdr = NULL;
+			DoDfc(const_cast<const DDmaRequest&>(*pCurReq), pCompletedHdr);
+
+			// If just completed last fragment from current request, switch to
+			// next request (if any).
+			if (pCompletedHdr == pCurReq->iLastHdr)
+				{
+				pCompletedReq = pCurReq;
+				pCurReq->iLink.Deque();
+				if (iReqQ.IsEmpty())
+					iNullPtr = &iCurHdr;
+				pCompletedReq->OnDeque();
+				}
+			}
+		else
+			{
+			pCompletedReq = pCurReq;
+			}
+
+		if (pCompletedReq && !pCompletedReq->iIsrCb)
+			{
+			// Don't execute ISR callbacks here (they have already been called)
+			DDmaRequest::TCallback const cb = pCompletedReq->iCb;
+			if (cb)
+				{
+				// Old style callback
+				TAny* const arg = pCompletedReq->iCbArg;
+				Signal();
+				__KTRACE_OPT(KDMA, Kern::Printf("Client CB res=%d", res));
+				(*cb)(res, arg);
+				Wait();
+				}
+			else
+				{
+				// New style callback
+				TDmaCallback const ncb = pCompletedReq->iDmaCb;
+				if (ncb)
+					{
+					TAny* const arg = pCompletedReq->iDmaCbArg;
+					TDmaResult const result = (res == DDmaRequest::EOk) ?
+						EDmaResultOK : EDmaResultError;
+					Signal();
+					__KTRACE_OPT(KDMA, Kern::Printf("Client CB result=%d", result));
+					(*ncb)(EDmaCallbackRequestCompletion, result, arg, NULL);
+					Wait();
+					}
+				}
+			}
+		else
+			{
+			// Allow another thread in, in case they are trying to cancel
+			Flash();
+			}
+		stop = __e32_atomic_load_acq32(&iIsrDfc) & (TUint32)KCancelFlagMask;
+		}
+
+	// Some interrupts may be missed (double-buffer and scatter-gather
+	// controllers only) if two or more transfers complete while interrupts are
+	// disabled in the CPU. If this happens, the framework will go out of sync
+	// and leave some orphaned requests in the queue.
+	//
+	// To ensure correctness we handle this case here by checking that the request
+	// queue is empty when all transfers have completed and, if not, cleaning up
+	// and notifying the client of the completion of the orphaned requests.
+	//
+	// Note that if some interrupts are missed and the controller raises an
+	// error while transferring a subsequent fragment, the error will be reported
+	// on a fragment which was successfully completed.  There is no easy solution
+	// to this problem, but this is okay as the only possible action following a
+	// failure is to flush the whole queue.
+	if (stop)
+		{
+		// If another thread set the cancel flag, it should have
+		// cleaned up the request queue
+		__DMA_ASSERTD(IsQueueEmpty());
+
+		TDmaCancelInfo* const waiters = iCancelInfo;
+		iCancelInfo = NULL;
+
+		// make sure DFC doesn't run again until a new request completes
+		iDfc.Cancel();
+
+		// reset the ISR count - new requests can now be processed
+		__e32_atomic_store_rel32(&iIsrDfc, 0);
+
+		Signal();
+
+		// release threads doing CancelAll()
+		waiters->Signal();
+		}
+	else if (!error && !iReqQ.IsEmpty() && iController->IsIdle(*this))
+		{
+#ifdef __SMP__
+		// On an SMP system we must call stop transfer, it will block until
+		// any ISRs have completed so that the system does not spuriously
+		// attempt to recover from a missed interrupt.
+		//
+		// On an SMP system it is possible for the code here to execute
+		// concurrently with the DMA ISR. It is therefore possible that at this
+		// point the previous transfer has already completed (so that IsIdle
+		// reports true), but that the ISR has not yet queued a DFC. Therefore
+		// we must wait for the ISR to complete.
+		//
+		// StopTransfer should have no other side effect, given that the
+		// channel is already idle.
+		iController->StopTransfer(*this); // should block till ISR completion
+#endif
+
+		const TBool cleanup = !iDfc.Queued();
+		if(cleanup)
+			{
+			__KTRACE_OPT(KDMA, Kern::Printf("Missed interrupt(s) - draining request queue"));
+			ResetStateMachine();
+
+			// Move orphaned requests to temporary queue so channel queue can
+			// accept new requests.
+			SDblQue q;
+			q.MoveFrom(&iReqQ);
+
+			SDblQueLink* pL;
+			while ((pL = q.GetFirst()) != NULL)
+				{
+				DDmaRequest* const pR = _LOFF(pL, DDmaRequest, iLink);
+				__KTRACE_OPT(KDMA, Kern::Printf("Removing request from queue and notifying client"));
+				pR->OnDeque();
+				// Old style callback
+				DDmaRequest::TCallback const cb = pR->iCb;
+				if (cb)
+					{
+					TAny* const arg = pR->iCbArg;
+					Signal();
+					(*cb)(DDmaRequest::EOk, arg);
+					Wait();
+					}
+				else
+					{
+					// New style callback
+					TDmaCallback const ncb = pR->iDmaCb;
+					if (ncb)
+						{
+						TAny* const arg = pR->iDmaCbArg;
+						Signal();
+						(*ncb)(EDmaCallbackRequestCompletion, EDmaResultOK, arg, NULL);
+						Wait();
+						}
+					}
+				}
+			}
+		Signal();
+		}
+	else
+		Signal();
+
+	__DMA_INVARIANT();
+	}
+
+
+//
+// Reset state machine only, request queue is unchanged */
+//
+void TDmaChannel::ResetStateMachine()
+	{
+	DoCancelAll();
+	iCurHdr = NULL;
+	iNullPtr = &iCurHdr;
+	}
+
+
+void TDmaChannel::DoQueue(const DDmaRequest& /*aReq*/)
+	{
+	// Must be overridden
+	__DMA_CANT_HAPPEN();
+	}
+
+
+//
+// Unlink the last item of a LLI chain from the next chain.
+// Default implementation does nothing. This is overridden by scatter-gather
+// channels.
+//
+void TDmaChannel::DoUnlink(SDmaDesHdr& /*aHdr*/)
+	{
+	}
+
+
+void TDmaChannel::DoDfc(const DDmaRequest& /*aCurReq*/, SDmaDesHdr*& /*aCompletedHdr*/)
+	{
+	// To make sure this version of the function isn't called for channels for
+	// which it isn't appropriate (and which therefore don't override it) we
+	// put this check in here.
+	__DMA_CANT_HAPPEN();
+	}
+
+
+void TDmaChannel::DoDfc(const DDmaRequest& /*aCurReq*/, SDmaDesHdr*& /*aSrcCompletedHdr*/,
+						SDmaDesHdr*& /*aDstCompletedHdr*/)
+	{
+	// To make sure this version of the function isn't called for channels for
+	// which it isn't appropriate (and which therefore don't override it) we
+	// put this check in here.
+	__DMA_CANT_HAPPEN();
+	}
+
+
+#ifdef _DEBUG
+void TDmaChannel::Invariant()
+	{
+	Wait();
+
+	__DMA_ASSERTD(iReqCount >= 0);
+
+	__DMA_ASSERTD(iCurHdr == NULL || iController->IsValidHdr(iCurHdr));
+
+	// should always point to NULL pointer ending fragment queue
+	__DMA_ASSERTD(*iNullPtr == NULL);
+
+	__DMA_ASSERTD((0 <= iAvailDesCount) && (iAvailDesCount <= iMaxDesCount));
+
+	__DMA_ASSERTD(LOGICAL_XOR(iCurHdr, IsQueueEmpty()));
+	if (iCurHdr == NULL)
+		{
+		__DMA_ASSERTD(iNullPtr == &iCurHdr);
+		}
+
+	Signal();
+	}
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////////
+// TDmaSbChannel
+
+void TDmaSbChannel::DoQueue(const DDmaRequest& /*aReq*/)
+	{
+	if (iState != ETransferring)
+		{
+		iController->Transfer(*this, *iCurHdr);
+		iState = ETransferring;
+		}
+	}
+
+
+void TDmaSbChannel::DoCancelAll()
+	{
+	__DMA_ASSERTD(iState == ETransferring);
+	iState = EIdle;
+	}
+
+
+void TDmaSbChannel::DoDfc(const DDmaRequest& /*aCurReq*/, SDmaDesHdr*& aCompletedHdr)
+	{
+	__DMA_ASSERTD(iState == ETransferring);
+	aCompletedHdr = iCurHdr;
+	iCurHdr = iCurHdr->iNext;
+	if (iCurHdr != NULL)
+		{
+		iController->Transfer(*this, *iCurHdr);
+		}
+	else
+		{
+		iState = EIdle;
+		}
+	}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// TDmaDbChannel
+
+void TDmaDbChannel::DoQueue(const DDmaRequest& aReq)
+	{
+	switch (iState)
+		{
+	case EIdle:
+		iController->Transfer(*this, *iCurHdr);
+		if (iCurHdr->iNext)
+			{
+			iController->Transfer(*this, *(iCurHdr->iNext));
+			iState = ETransferring;
+			}
+		else
+			iState = ETransferringLast;
+		break;
+	case ETransferring:
+		// nothing to do
+		break;
+	case ETransferringLast:
+		iController->Transfer(*this, *(aReq.iFirstHdr));
+		iState = ETransferring;
+		break;
+	default:
+		__DMA_CANT_HAPPEN();
+		}
+	}
+
+
+void TDmaDbChannel::DoCancelAll()
+	{
+	iState = EIdle;
+	}
+
+
+void TDmaDbChannel::DoDfc(const DDmaRequest& /*aCurReq*/, SDmaDesHdr*& aCompletedHdr)
+	{
+	aCompletedHdr = iCurHdr;
+	iCurHdr = iCurHdr->iNext;
+	switch (iState)
+		{
+	case ETransferringLast:
+		iState = EIdle;
+		break;
+	case ETransferring:
+		if (iCurHdr->iNext == NULL)
+			iState = ETransferringLast;
+		else
+			iController->Transfer(*this, *(iCurHdr->iNext));
+		break;
+	default:
+		__DMA_CANT_HAPPEN();
+		}
+	}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// TDmaSgChannel
+
+void TDmaSgChannel::DoQueue(const DDmaRequest& aReq)
+	{
+	if (iState == ETransferring)
+		{
+		__DMA_ASSERTD(!aReq.iLink.Alone());
+		DDmaRequest* pReqPrev = _LOFF(aReq.iLink.iPrev, DDmaRequest, iLink);
+		iController->AppendHwDes(*this, *(pReqPrev->iLastHdr), *(aReq.iFirstHdr));
+		}
+	else
+		{
+		iController->Transfer(*this, *(aReq.iFirstHdr));
+		iState = ETransferring;
+		}
+	}
+
+
+void TDmaSgChannel::DoCancelAll()
+	{
+	__DMA_ASSERTD(iState == ETransferring);
+	iState = EIdle;
+	}
+
+
+void TDmaSgChannel::DoUnlink(SDmaDesHdr& aHdr)
+	{
+	iController->UnlinkHwDes(*this, aHdr);
+	}
+
+
+void TDmaSgChannel::DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr)
+	{
+	__DMA_ASSERTD(iState == ETransferring);
+	aCompletedHdr = aCurReq.iLastHdr;
+	iCurHdr = aCompletedHdr->iNext;
+	iState = (iCurHdr != NULL) ? ETransferring : EIdle;
+	}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// TDmaAsymSgChannel
+
+void TDmaAsymSgChannel::DoQueue(const DDmaRequest& aReq)
+	{
+	if (iState == ETransferring)
+		{
+		__DMA_ASSERTD(!aReq.iLink.Alone());
+		DDmaRequest* pReqPrev = _LOFF(aReq.iLink.iPrev, DDmaRequest, iLink);
+		iController->AppendHwDes(*this,
+								 *(pReqPrev->iSrcLastHdr), *(aReq.iSrcFirstHdr),
+								 *(pReqPrev->iDstLastHdr), *(aReq.iDstFirstHdr));
+		}
+	else
+		{
+		iController->Transfer(*this, *(aReq.iSrcFirstHdr), *(aReq.iDstFirstHdr));
+		iState = ETransferring;
+		}
+	}
+
+
+void TDmaAsymSgChannel::DoCancelAll()
+	{
+	__DMA_ASSERTD(iState == ETransferring);
+	iState = EIdle;
+	}
+
+
+void TDmaAsymSgChannel::DoUnlink(SDmaDesHdr& aHdr)
+	{
+	iController->UnlinkHwDes(*this, aHdr);
+	}
+
+
+void TDmaAsymSgChannel::DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aSrcCompletedHdr,
+							  SDmaDesHdr*& aDstCompletedHdr)
+	{
+	__DMA_ASSERTD(iState == ETransferring);
+	aSrcCompletedHdr = aCurReq.iSrcLastHdr;
+	iSrcCurHdr = aSrcCompletedHdr->iNext;
+	aDstCompletedHdr = aCurReq.iDstLastHdr;
+	iDstCurHdr = aDstCompletedHdr->iNext;
+	// Must be either both NULL or none of them.
+	__DMA_ASSERTD(!LOGICAL_XOR(iSrcCurHdr, iDstCurHdr));
+	iState = (iSrcCurHdr != NULL) ? ETransferring : EIdle;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/drivers/dma/dma2_shared.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,210 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32/drivers/dma2_shared.cpp
+// DMA Platform Independent Layer (PIL)
+//
+//
+
+#include <drivers/dmadefs.h>
+
+
+//
+// Exported default constructor.
+//
+#ifdef DMA_APIV2
+KEXPORT_C
+#endif
+TDmaTransferConfig::TDmaTransferConfig()
+	: iAddr(0),
+	  iAddrMode(KDmaAddrModeConstant),
+	  iElementSize(0),
+	  iElementsPerFrame(0),
+	  iElementsPerPacket(0),
+	  iFramesPerTransfer(0),
+	  iElementSkip(0),
+	  iFrameSkip(0),
+	  iBurstSize(KDmaBurstSizeAny),
+	  iFlags(0),
+	  iSyncFlags(KDmaSyncAuto),
+	  iPslTargetInfo(0),
+	  iRepeatCount(0),
+	  iDelta(~0u),
+	  iReserved(0)
+	{
+	}
+
+
+//
+// General use version.
+//
+#ifdef DMA_APIV2
+KEXPORT_C
+#endif
+TDmaTransferConfig::TDmaTransferConfig(
+	TUint32 aAddr,
+	TUint aTransferFlags,
+	TDmaAddrMode aAddrMode,
+	TUint aSyncFlags,
+	TDmaBurstSize aBurstSize,
+	TUint aElementSize,
+	TUint aElementsPerPacket,
+	TUint aPslTargetInfo,
+	TInt aRepeatCount
+	)
+	:
+	iAddr(aAddr),
+	iAddrMode(aAddrMode),
+	iElementSize(aElementSize),
+	iElementsPerFrame(0),
+	iElementsPerPacket(aElementsPerPacket),
+	iFramesPerTransfer(0),
+	iElementSkip(0),
+	iFrameSkip(0),
+	iBurstSize(aBurstSize),
+	iFlags(aTransferFlags),
+	iSyncFlags(aSyncFlags),
+	iPslTargetInfo(aPslTargetInfo),
+	iRepeatCount(aRepeatCount),
+	iDelta(~0u),
+	iReserved(0)
+	{
+	}
+
+
+//
+// 1D/2D version.
+//
+#ifdef DMA_APIV2
+KEXPORT_C
+#endif
+TDmaTransferConfig::TDmaTransferConfig(
+	TUint32 aAddr,
+	TUint aElementSize,
+	TUint aElementsPerFrame,
+	TUint aFramesPerTransfer,
+	TInt aElementSkip,
+	TInt aFrameSkip,
+	TUint aTransferFlags,
+	TUint aSyncFlags,
+	TDmaBurstSize aBurstSize,
+	TUint aElementsPerPacket,
+	TUint aPslTargetInfo,
+	TInt aRepeatCount
+	)
+	:
+	iAddr(aAddr),
+	iAddrMode( // deduce transfer mode from skips
+		(aFrameSkip != 0) ? KDmaAddrMode2DIndex :
+		(aElementSkip != 0)? KDmaAddrMode1DIndex :
+		KDmaAddrModePostIncrement),
+	iElementSize(aElementSize),
+	iElementsPerFrame(aElementsPerFrame),
+	iElementsPerPacket(aElementsPerPacket),
+	iFramesPerTransfer(aFramesPerTransfer),
+	iElementSkip(aElementSkip),
+	iFrameSkip(aFrameSkip),
+	iBurstSize(aBurstSize),
+	iFlags(aTransferFlags),
+	iSyncFlags(aSyncFlags),
+	iPslTargetInfo(aPslTargetInfo),
+	iRepeatCount(aRepeatCount),
+	iDelta(~0u),
+	iReserved(0)
+	{
+	}
+
+
+//
+// Exported default constructor.
+//
+#ifdef DMA_APIV2
+KEXPORT_C
+#endif
+TDmaTransferArgs::TDmaTransferArgs()
+	: iTransferCount(0),
+	  iGraphicsOps(KDmaGraphicsOpNone),
+	  iFlags(0),
+	  iChannelPriority(KDmaPriorityNone),
+	  iPslRequestInfo(0),
+	  iDelta(~0u),
+	  iReserved1(0),
+	  iChannelCookie(0),
+	  iReserved2(0)
+	{
+	}
+
+
+//
+// .
+//
+#ifdef DMA_APIV2
+KEXPORT_C
+#endif
+TDmaTransferArgs::TDmaTransferArgs (
+	TUint aSrcAddr,
+	TUint aDstAddr,
+	TUint aCount,
+	TUint aDmaTransferFlags,
+	TUint aDmaSyncFlags,
+	TUint aDmaPILFlags,
+	TDmaAddrMode aMode,
+	TUint aElementSize,
+	TUint aChannelPriority,
+	TDmaBurstSize aBurstSize,
+	TUint aPslRequestInfo,
+	TDmaGraphicsOps aGraphicOp,
+	TUint32 aColour
+	)
+	:
+	iSrcConfig(aSrcAddr, aDmaTransferFlags, aMode, aDmaSyncFlags, aBurstSize, aElementSize),
+	iDstConfig(aDstAddr, aDmaTransferFlags, aMode, aDmaSyncFlags, aBurstSize, aElementSize),
+	iTransferCount(aCount),
+	iGraphicsOps(aGraphicOp),
+	iColour(aColour),
+	iFlags(aDmaPILFlags),
+	iChannelPriority(aChannelPriority),
+	iPslRequestInfo(aPslRequestInfo)
+	{
+	}
+
+
+//
+// .
+//
+#ifdef DMA_APIV2
+KEXPORT_C
+#endif
+TDmaTransferArgs::TDmaTransferArgs(
+	const TDmaTransferConfig& aSrc,
+	const TDmaTransferConfig& aDst,
+	TUint32 aFlags,
+	TUint aChannelPriority,
+	TUint aPslRequestInfo,
+	TDmaGraphicsOps aGraphicOp,
+	TUint32 aColour
+	)
+	: iSrcConfig(aSrc),
+	  iDstConfig(aDst),
+	  iTransferCount(0),
+	  iGraphicsOps(aGraphicOp),
+	  iColour(aColour),
+	  iFlags(aFlags),
+	  iChannelPriority(aChannelPriority),
+	  iPslRequestInfo(aPslRequestInfo),
+	  iDelta(~0u),
+	  iReserved1(0),
+	  iChannelCookie(0),
+	  iReserved2(0)
+	{
+	}
--- a/kernel/eka/drivers/dma/dmapil.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/drivers/dma/dmapil.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -475,6 +475,15 @@
 
 	// append request to queue and link new descriptor list to existing one.
 	iChannel.Wait();
+
+	TUint32 req_count = iChannel.iQueuedRequests++;
+	if (req_count == 0)
+		{
+		iChannel.Signal();
+		iChannel.QueuedRequestCountChanged();
+		iChannel.Wait();
+		}
+
 	if (!(iChannel.iIsrDfc & (TUint32)TDmaChannel::KCancelFlagMask))
 		{
 		iQueued = ETrue;
@@ -482,8 +491,18 @@
 		*iChannel.iNullPtr = iFirstHdr;
 		iChannel.iNullPtr = &(iLastHdr->iNext);
 		iChannel.DoQueue(*this);
+		iChannel.Signal();
 		}
-	iChannel.Signal();
+	else
+		{
+		// Someone is cancelling all requests...
+		req_count = --iChannel.iQueuedRequests;
+		iChannel.Signal();
+		if (req_count == 0)
+			{
+			iChannel.QueuedRequestCountChanged();
+			}
+		}
 
 	__DMA_INVARIANT();
 	}
@@ -586,14 +605,19 @@
 
 
 TDmaChannel::TDmaChannel()
-	: iNullPtr(&iCurHdr),
-	  iDfc(Dfc, NULL, 0)
+	: iController(NULL),
+	  iPslId(0),
+	  iCurHdr(NULL),
+	  iNullPtr(&iCurHdr),
+	  iDfc(Dfc, NULL, 0),
+	  iMaxDesCount(0),
+	  iAvailDesCount(0),
+	  iIsrDfc(0),
+	  iReqQ(),
+	  iReqCount(0),
+	  iQueuedRequests(0),
+	  iCancelInfo(NULL)
 	{
-	// iController = NULL;
-	// iPslId = 0;
-	// iCurHdr = NULL;
-	// iMaxDesCount = iAvailDesCount = 0;
-	// iReqCount = 0;
 	__DMA_INVARIANT();
 	}
 
@@ -640,6 +664,8 @@
 	__DMA_ASSERTD(IsQueueEmpty());
 	__DMA_ASSERTD(iReqCount == 0);
 
+	__DMA_ASSERTD(iQueuedRequests == 0);
+
 	// descriptor leak? bug in request code
 	__DMA_ASSERTD(iAvailDesCount == iMaxDesCount);
 
@@ -665,8 +691,10 @@
 	TBool wait = FALSE;
 	TDmaCancelInfo c;
 	TDmaCancelInfo* waiters = 0;
+
 	NKern::ThreadEnterCS();
 	Wait();
+	const TUint32 req_count_before = iQueuedRequests;
 	NThreadBase* dfcnt = iDfc.Thread();
 	__e32_atomic_store_ord32(&iIsrDfc, (TUint32)KCancelFlagMask);
 	// ISRs after this point will not post a DFC, however a DFC may already be queued or running or both
@@ -683,6 +711,7 @@
 		SDblQueLink* pL;
 		while ((pL = iReqQ.GetFirst()) != NULL)
 			{
+			iQueuedRequests--;
 			DDmaRequest* pR = _LOFF(pL, DDmaRequest, iLink);
 			pR->OnDeque();
 			}
@@ -709,12 +738,21 @@
 		wait = TRUE;
 		iDfc.Enque();
 		}
+	const TUint32 req_count_after = iQueuedRequests;
 	Signal();
 	if (waiters)
 		waiters->Signal();
 	if (wait)
 		NKern::FSWait(&c.iSem);
  	NKern::ThreadLeaveCS();
+
+	// Only call PSL if there were requests queued when we entered AND there
+	// are now no requests left on the queue.
+	if ((req_count_before != 0) && (req_count_after == 0))
+		{
+		QueuedRequestCountChanged();
+		}
+
 	__DMA_INVARIANT();
 	}
 
@@ -740,6 +778,8 @@
 	const TBool error = w & (TUint32)KErrorFlagMask;
 	TBool stop = w & (TUint32)KCancelFlagMask;
 	__DMA_ASSERTD(count>0 || stop);
+	const TUint32 req_count_before = iQueuedRequests;
+	TUint32 req_count_after = 0;
 
 	while(count && !stop)
 		{
@@ -767,6 +807,7 @@
 				{
 				pCompletedReq = pCurReq;
 				pCurReq->iLink.Deque();
+				iQueuedRequests--;
 				if (iReqQ.IsEmpty())
 					iNullPtr = &iCurHdr;
 				pCompletedReq->OnDeque();
@@ -814,6 +855,7 @@
 		// reset the ISR count - new requests can now be processed
 		__e32_atomic_store_rel32(&iIsrDfc, 0);
 
+		req_count_after = iQueuedRequests;
 		Signal();
 
 		// release threads doing CancelAll()
@@ -832,6 +874,7 @@
 		SDblQueLink* pL;
 		while ((pL = q.GetFirst()) != NULL)
 			{
+			iQueuedRequests--;
 			DDmaRequest* pR = _LOFF(pL, DDmaRequest, iLink);
 			__KTRACE_OPT(KDMA, Kern::Printf("Removing request from queue and notifying client"));
 			pR->OnDeque();
@@ -844,10 +887,22 @@
 				Wait();
 				}
 			}
+		req_count_after = iQueuedRequests;
 		Signal();
 		}
 	else
+		{
+		req_count_after = iQueuedRequests;
 		Signal();
+		}
+
+	// Only call PSL if there were requests queued when we entered AND there
+	// are now no requests left on the queue (after also having executed all
+	// client callbacks).
+	if ((req_count_before != 0) && (req_count_after == 0))
+		{
+		QueuedRequestCountChanged();
+		}
 
 	__DMA_INVARIANT();
 	}
@@ -870,6 +925,21 @@
 	{
 	}
 
+
+/** PSL may override */
+void TDmaChannel::QueuedRequestCountChanged()
+	{
+#ifdef _DEBUG
+	Wait();
+	__KTRACE_OPT(KDMA,
+				 Kern::Printf("TDmaChannel::QueuedRequestCountChanged() %d",
+							  iQueuedRequests));
+	__DMA_ASSERTA(iQueuedRequests >= 0);
+	Signal();
+#endif
+	}
+
+
 #ifdef _DEBUG
 
 void TDmaChannel::Invariant()
--- a/kernel/eka/drivers/hcr/hcr_debug.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/drivers/hcr/hcr_debug.h	Mon Jan 18 21:31:10 2010 +0200
@@ -12,6 +12,7 @@
 //
 // Description:
 // Hardware Configuration Repository Platform Independent Layer (PIL)
+// Contains debugging macros used in PIL and PSL source code of HCR.
 //
 
 #ifndef HCR_DEBUG_H
--- a/kernel/eka/drivers/hcr/hcr_hai.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/drivers/hcr/hcr_hai.h	Mon Jan 18 21:31:10 2010 +0200
@@ -12,6 +12,8 @@
 //
 // Description:
 // Hardware Configuration Respoitory Platform Independent Layer (PIL)
+// Contains the hardware abstraction interface implemented in the variant PSL
+// HCR kernel extension project.
 //
 
 /** 
--- a/kernel/eka/drivers/hcr/hcr_pil.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/drivers/hcr/hcr_pil.h	Mon Jan 18 21:31:10 2010 +0200
@@ -12,11 +12,15 @@
 //
 // Description:
 // Hardware Configuration Respoitory Platform Independent Layer (PIL)
+// Contains internal definitions for the PIL software of the HCR component
+// which includes the singleton class that contains the algorithms and the
+// TRepository hierachy that encapsulated the repository data in all its forms
+// hiding the specifics from the algoritms in the singleton HCRInternal object.
 //
 
 /**
 @file hcr_pil.h
-Kernel side definitions for the HCR Platform Indepent Layer. 
+Kernel side definitions for the HCR Platform Independent Layer. 
 
 @internalTechnology
 */
--- a/kernel/eka/drivers/hcr/hcr_uids.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/drivers/hcr/hcr_uids.h	Mon Jan 18 21:31:10 2010 +0200
@@ -12,6 +12,8 @@
 //
 // Description:
 // Hardware Configuration Respoitory Platform Independent Layer (PIL)
+// Contains the registry of UIDs allocated to the HCR component from 
+// Symbian Foundation and what they are used for.
 //
 
 /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/eabi/dma2u.def	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,69 @@
+EXPORTS
+	_Z11DmaTestInfov @ 1 NONAME
+	_Z13DmaTestInfoV2v @ 2 NONAME
+	_ZN11DDmaRequest11FreeDesListEv @ 3 NONAME
+	_ZN11DDmaRequest13ExpandDesListEi @ 4 NONAME
+	_ZN11DDmaRequest13FragmentCountEv @ 5 NONAME
+	_ZN11DDmaRequest14FreeDstDesListEv @ 6 NONAME
+	_ZN11DDmaRequest14FreeSrcDesListEv @ 7 NONAME
+	_ZN11DDmaRequest16DstFragmentCountEv @ 8 NONAME
+	_ZN11DDmaRequest16ExpandDstDesListEi @ 9 NONAME
+	_ZN11DDmaRequest16ExpandSrcDesListEi @ 10 NONAME
+	_ZN11DDmaRequest16SrcFragmentCountEv @ 11 NONAME
+	_ZN11DDmaRequest24EnableDstElementCountingEi @ 12 NONAME
+	_ZN11DDmaRequest24EnableSrcElementCountingEi @ 13 NONAME
+	_ZN11DDmaRequest25DisableDstElementCountingEv @ 14 NONAME
+	_ZN11DDmaRequest25DisableSrcElementCountingEv @ 15 NONAME
+	_ZN11DDmaRequest30TotalNumDstElementsTransferredEv @ 16 NONAME
+	_ZN11DDmaRequest30TotalNumSrcElementsTransferredEv @ 17 NONAME
+	_ZN11DDmaRequest5QueueEv @ 18 NONAME
+	_ZN11DDmaRequest8FragmentERK16TDmaTransferArgs @ 19 NONAME
+	_ZN11DDmaRequest8FragmentEmmijm @ 20 NONAME
+	_ZN11DDmaRequestC1ER11TDmaChannelPFvNS_7TResultEPvES3_i @ 21 NONAME
+	_ZN11DDmaRequestC1ER11TDmaChannelPFvj10TDmaResultPvP10SDmaDesHdrES3_j @ 22 NONAME
+	_ZN11DDmaRequestC2ER11TDmaChannelPFvNS_7TResultEPvES3_i @ 23 NONAME
+	_ZN11DDmaRequestC2ER11TDmaChannelPFvj10TDmaResultPvP10SDmaDesHdrES3_j @ 24 NONAME
+	_ZN11DDmaRequestD0Ev @ 25 NONAME
+	_ZN11DDmaRequestD1Ev @ 26 NONAME
+	_ZN11DDmaRequestD2Ev @ 27 NONAME
+	_ZN11TDmaChannel13LinkToChannelEPS_ @ 28 NONAME
+	_ZN11TDmaChannel14IsrRedoRequestEmmjmi @ 29 NONAME
+	_ZN11TDmaChannel15StaticExtensionEiPv @ 30 NONAME
+	_ZN11TDmaChannel16AddressAlignMaskEjjm @ 31 NONAME
+	_ZN11TDmaChannel17MaxTransferLengthEjjm @ 32 NONAME
+	_ZN11TDmaChannel18MissNextInterruptsEi @ 33 NONAME
+	_ZN11TDmaChannel4OpenERKNS_11SCreateInfoERPS_ @ 34 NONAME
+	_ZN11TDmaChannel5CloseEv @ 35 NONAME
+	_ZN11TDmaChannel5PauseEv @ 36 NONAME
+	_ZN11TDmaChannel6ResumeEv @ 37 NONAME
+	_ZN11TDmaChannel8DmacCapsEv @ 38 NONAME
+	_ZN11TDmaChannel8FailNextEi @ 39 NONAME
+	_ZN11TDmaChannel9CancelAllEv @ 40 NONAME
+	_ZN11TDmaChannel9ExtensionEiPv @ 41 NONAME
+	_ZN16TDmaTransferArgsC1ERK18TDmaTransferConfigS2_mjj15TDmaGraphicsOpsm @ 42 NONAME
+	_ZN16TDmaTransferArgsC1Ejjjjjj12TDmaAddrModejj13TDmaBurstSizej15TDmaGraphicsOpsm @ 43 NONAME
+	_ZN16TDmaTransferArgsC1Ev @ 44 NONAME
+	_ZN16TDmaTransferArgsC2ERK18TDmaTransferConfigS2_mjj15TDmaGraphicsOpsm @ 45 NONAME
+	_ZN16TDmaTransferArgsC2Ejjjjjj12TDmaAddrModejj13TDmaBurstSizej15TDmaGraphicsOpsm @ 46 NONAME
+	_ZN16TDmaTransferArgsC2Ev @ 47 NONAME
+	_ZN18TDmaTransferConfigC1Emj12TDmaAddrModej13TDmaBurstSizejjji @ 48 NONAME
+	_ZN18TDmaTransferConfigC1Emjjjiijj13TDmaBurstSizejji @ 49 NONAME
+	_ZN18TDmaTransferConfigC1Ev @ 50 NONAME
+	_ZN18TDmaTransferConfigC2Emj12TDmaAddrModej13TDmaBurstSizejjji @ 51 NONAME
+	_ZN18TDmaTransferConfigC2Emjjjiijj13TDmaBurstSizejji @ 52 NONAME
+	_ZN18TDmaTransferConfigC2Ev @ 53 NONAME
+	_ZTI11DDmaRequest @ 54 NONAME
+	_ZTI11TDmaChannel @ 55 NONAME
+	_ZTI13TDmaDbChannel @ 56 NONAME
+	_ZTI13TDmaSbChannel @ 57 NONAME
+	_ZTI13TDmaSgChannel @ 58 NONAME
+	_ZTI17TDmaAsymSgChannel @ 59 NONAME
+	_ZTI5TDmac @ 60 NONAME
+	_ZTV11DDmaRequest @ 61 NONAME
+	_ZTV11TDmaChannel @ 62 NONAME
+	_ZTV13TDmaDbChannel @ 63 NONAME
+	_ZTV13TDmaSbChannel @ 64 NONAME
+	_ZTV13TDmaSgChannel @ 65 NONAME
+	_ZTV17TDmaAsymSgChannel @ 66 NONAME
+	_ZTV5TDmac @ 67 NONAME
+
--- a/kernel/eka/include/cpudefs.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/cpudefs.h	Mon Jan 18 21:31:10 2010 +0200
@@ -618,6 +618,11 @@
 #endif
 #endif
 
+// Macro used to get the caller of the function containing a CHECK_PRECONDITIONS()
+#if defined(__ARMCC_VERSION) && __ARMCC_VERSION >= 200000
+#define PRECOND_FUNCTION_CALLER		__return_address()
+#endif
+
 #if !defined(__CPU_ARM_HAS_LDREX_STREX_V6K)
 #if defined(__CPU_ARM_HAS_LDREX_STREX)
 #define	__ATOMIC64_USE_SLOW_EXEC__
@@ -639,6 +644,15 @@
 #define	__crash()						asm("int 0xff " : : : "memory")
 #endif
 
+#ifdef __VC32__
+// Not available in the version of MSVC normally used
+// #define PRECOND_FUNCTION_CALLER		((TLinAddr)_ReturnAddress())
+#endif
+
 #endif	// __CPU_X86
 
+#ifdef __GCC32__
+#define PRECOND_FUNCTION_CALLER		((TLinAddr)__builtin_return_address(0))
 #endif
+
+#endif
--- a/kernel/eka/include/d32comm.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/d32comm.h	Mon Jan 18 21:31:10 2010 +0200
@@ -27,6 +27,7 @@
 #define __D32COMM_H__
 #include <e32cmn.h>
 #include <e32ver.h>
+#include <d32public.h>
 
 /**
  Enumeration of number of data bits for serial port configuration.
@@ -107,12 +108,6 @@
 	ESIREnable,ESIRDisable,
 	};
 
-enum TFlowControl
-	{
-	EFlowControlOn,EFlowControlOff
-	};
-//
-
 const TInt KConfigMaxTerminators=4;
 // DTE Constants
 const TUint KConfigObeyXoff=0x01;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/d32public.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,37 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32\include\d32public.h
+//
+// D32 enums that are depended on by public headers.
+// 
+//
+
+/**
+@file
+@publishedAll
+@released
+*/
+
+#ifndef __D32PUBLIC_H__
+#define __D32PUBLIC_H__
+
+
+enum TFlowControl
+	{
+	EFlowControlOn,EFlowControlOff
+	};
+
+
+#endif // __D32PUBLIC_H__
+
--- a/kernel/eka/include/d32usbdi_errors.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/d32usbdi_errors.h	Mon Jan 18 21:31:10 2010 +0200
@@ -62,6 +62,14 @@
 const TInt KErrUsbRemoteWakeupAlreadyDisabled = -6661;
 const TInt KErrUsbAlreadyResumed              = -6662;
 
+/*
+The following two codes are used to indicate attachment/detachment of some malfunction 
+USB peripherals, which behaviour don't comply with USB specification. For example, some 
+hubs drive their upstream port VBus, however such behaviour is not allowed according to USB specification. 
+*/
+const TInt KErrUsbBadDeviceAttached           = -6663;
+const TInt KEventUsbBadDeviceDetached         = -6664;
+
 namespace UsbdiPanics
 	{
 	_LIT(KUsbHubDriverPanicCat, "USBHubDriver");
--- a/kernel/eka/include/drivers/dma.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/drivers/dma.h	Mon Jan 18 21:31:10 2010 +0200
@@ -11,794 +11,20 @@
 // Contributors:
 //
 // Description:
-// e32\include\drivers\dma.h
-// DMA framework API
-// 
+// include/drivers/dma.h
+// DMA Framework - Client API definition.
+//
 //
 
 #ifndef __DMA_H__
 #define __DMA_H__
 
-#include <kernel/kern_priv.h>
 
-
-//////////////////////////////////////////////////////////////////////////////
-// Debug Support - KDmaPanicCat is defined in each source file
-
-#define __DMA_ASSERTD(e) __ASSERT_DEBUG(e, Kern::Fault(KDmaPanicCat, __LINE__))
-#define __DMA_ASSERTA(e) __ASSERT_ALWAYS(e, Kern::Fault(KDmaPanicCat, __LINE__))
-#ifdef _DEBUG
-#define __DMA_CANT_HAPPEN() Kern::Fault(KDmaPanicCat, __LINE__)
-#define __DMA_DECLARE_INVARIANT public: void Invariant();
-#define __DMA_INVARIANT() Invariant()
+#ifndef DMA_APIV2
+# include <drivers/dma_v1.h>
 #else
-#define __DMA_CANT_HAPPEN()
-#define __DMA_DECLARE_INVARIANT
-#define __DMA_INVARIANT()
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////////
-// INTERFACE EXPOSED TO DEVICE-DRIVERS
-//////////////////////////////////////////////////////////////////////////////
-
-/**
-Bitmasks used for configuring a DMA request.
-
-In general, specify KDmaMemSrc|KDmaIncSrc (resp. KDmaMemDest|KDmaIncDest) if
-the source (resp. destination) is a memory buffer and clear
-KDmaMemSrc|KDmaIncSrc (resp. KDmaMemDest|KDmaIncDest) if the source
-(resp. destination) is a peripheral.
-
-If the location is given as a physical address (rather than a linear one)
-then also specify KDmaPhysAddrSrc and/or KDmaPhysAddrDest.
-
-The EKA1 "Fill Mode" can be implemented by omitting KDmaIncSrc.
-
-Some peripherals may require a post-increment address mode.
-
-@see DDmaRequest::Fragment
-@publishedPartner
-@released
-*/
-
-enum TDmaRequestFlags
-	{
-	/** Source is address of memory buffer */
-	KDmaMemSrc       = 0x01,
-	/** Destination is address of memory buffer */
-	KDmaMemDest      = 0x02,
-	/** Source address must be post-incremented during transfer */
-	KDmaIncSrc       = 0x04,
-	/** Destination address must be post-incremented during transfer */
-	KDmaIncDest      = 0x08,
-	/** Source address is a physical address (as opposed to a linear one) */
-	KDmaPhysAddrSrc  = 0x10,
-	/** Destination address is a physical address (as opposed to a linear one) */
-	KDmaPhysAddrDest = 0x20,
-	/** Request a different max transfer size (for instance for test purposes) */
-	KDmaAltTransferLen = 0x40
-	};
-
-
-//////////////////////////////////////////////////////////////////////////////
-
-class TDmaChannel;
-struct SDmaDesHdr;
-
-/** A DMA request is a list of fragments small enough to be transferred in one go
-	by the DMAC.
-
-	In general, fragmentation is done in the framework by calling Fragment() but
-	clients with special needs can allocate a blank descriptor list with
-	ExpandDesList() and customise it to fit their needs.
-
-	Clients should not set attributes directly, but should use the various functions
-	instead.
-
-	This class has not been designed to be called from several concurrent threads.
-	Multithreaded clients must implement their own locking scheme (via DMutex).
-
-	Fast mutexes are used internally to protect data structures accessed both
-	by the client thread and the DFC thread.  Therefore no fast mutex can be held
-	when calling a request function.
-
-	@publishedPartner
-	@released
- */
-class DDmaRequest : public DBase
-	{
-	friend class TDmaChannel;
-public:
-	/** The outcome of the transfer */
-	enum TResult {EBadResult=0, EOk, EError};
-	/** The signature of the completion/failure callback function */
-	typedef void (*TCallback)(TResult, TAny*);
-public:
-   
-    /**
-    Create a new transfer request. 
-
-    @param aChannel The channel this request is bound to.
-    @param aCb      Callback function called on transfer completion or failure (in channel
-                    DFC context).  Can be NULL.
-    @param aCbArg   Argument passed to callback function.
-    @param aMaxTransferSize Maximum fragment size.  If not specified, defaults to the maximum size
-           supported by the DMA controller for the type of transfer that is later scheduled.
-    */
-	IMPORT_C DDmaRequest(TDmaChannel& aChannel, TCallback aCb=NULL, TAny* aCbArg=NULL, TInt aMaxTransferSize=0);
-	
-	
-	/**
-    Destructor.
-
-    Assume the request is not being transferred or pending.
-    */
-	IMPORT_C ~DDmaRequest();
-	
-	
-	/**
-    Split request into a list of fragments small enough to be fed to the DMAC.
-
-    The size of each fragment is smaller than or equal to the maximum transfer size
-    supported by the DMAC.  If the source and/or destination is memory, each
-    fragment points to memory which is physically contiguous.
-
-    The kind of transfer to perform is specified via a set of flags used by a PIL
-    and a magic cookie passed to the PSL.  If the source (resp. destination) is a
-    peripheral, aSrc (resp. aDest) is treated as a magic cookie by the PIL and
-    passed straight to the PSL.
-
-    The request can be uninitialised or may have been fragmented previously.  The
-    previous configuration if any is lost whether or not the function succeeds.
-
-    @param aSrc     Source memory buffer linear address or peripheral magic cookie.
-    @param aDest    Destination memory buffer linear address or peripheral magic cookie.
-    @param aCount   Number of bytes to transfer.
-    @param aFlags   Bitmask characterising the transfer.
-    @param aPslInfo Hardware-specific information passed to PSL.
-
-    @return KErrNone if success. KErrArgument if aFlags and/or aPslInfo are invalid when finding
-    the maximum transfer size. May also fail if running out of descriptors.
-
-    @pre The request is not being transferred or pending.
-    @pre The various parameters must be valid.  The PIL or PSL will fault the
-    kernel if not.
-
-    @see TDmaRequestFlags
-    */
-	IMPORT_C TInt Fragment(TUint32 aSrc, TUint32 aDest, TInt aCount, TUint aFlags, TUint32 aPslInfo);
-	
-	
-	/**
-    Transfer asynchronously this request.
-
-    If this request's channel is idle, the request is transferred immediately.
-    Otherwise, it is queued and transferred later.
-
-    The client is responsible for ensuring cache consistency before and/or after the
-    transfer if necessary.
-    */
-	IMPORT_C void Queue();
-	
-
-    /**
-    Append new descriptor(s) to existing list.
-
-    Clients needing to build a custom descriptor list should call this function to
-    allocate the list and access the resulting list through iFirstHdr and iLastHdr.
-
-    Clients should not change the value of iFirstHdr, iLastHdr and the iNext field
-    of the descriptor headers to ensure descriptors can be deallocated. Clients
-    are free to change hardware descriptors, including chaining, in whatever way
-    suit them.
-
-    Assume the request is not being transferred or pending.
-
-    @param aCount Number of descriptors to append.
-
-    @return KErrNone or KErrTooBig if not enough descriptors available.
-    */
-	IMPORT_C TInt ExpandDesList(TInt aCount=1);
-	
-	
-	/**
-    Free resources associated with this request.
-
-    Assume the request is not being transferred or pending.
-    */
-	IMPORT_C void FreeDesList();
-private:
-	inline void OnDeque();
-public:
-	// WARNING: The following attributes are accessed both in client and DFC
-	// context and so accesses must be protected with the channel lock.
-	TDmaChannel& iChannel;		/**< The channel this request is bound to */
-	volatile TCallback iCb;		/**< Called on completion/failure (can be NULL) */
-	TAny* volatile iCbArg;		/**< Callback argument */
-	TInt iDesCount;				/**< The number of fragments in list */
-	SDmaDesHdr* iFirstHdr;		/**< The first fragment in the list (or NULL) */
-	SDmaDesHdr* iLastHdr;		/**< The last fragment in the list (or NULL) */
-	SDblQueLink iLink;			/**< The link on channel queue of pending requests */
-	TBool iQueued;				/**< Indicates whether request is pending or being transferred */
-	TInt iMaxTransferSize;		/**< Defaults to DMA controller max. transfer size */
-	__DMA_DECLARE_INVARIANT
-	};
-
-
-//////////////////////////////////////////////////////////////////////////////
-
-class TDmac;
-class DmaChannelMgr;
-
-/** DMA channel base class.
-
-	This class has not been designed to be called from several concurrent
-	client threads.  Multithreaded clients must implement their own locking
-	scheme (via DMutex).
-
-	Fast mutexes are used internally to protect data structures accessed both
-	by the client thread and the DFC one.  Therefore no fast mutex can be held
-	when calling a channel function.
-
-	Must be allocated in BSS because it relies on being zeroed at
-	creation-time.  If the PSL really needs to allocate channels on the kernel
-	heap, it must manually zero-initialises the instances.  This can be
-	achieved either by allocating raw memory and using placement new, or by
-	wrapping channels into a DBase-derived wrapper.
-
-	@publishedPartner
-	@released
- */
-class TDmaCancelInfo;
-class TDmaChannel
-	{
-	friend class DDmaRequest;
-	friend class TDmac;
-	friend class DmaChannelMgr;
-public:
-	/**  Information passed by client when opening channel */
-	struct SCreateInfo
-		{
-		/** Identifier used by PSL to select channel to open */
-		TUint32 iCookie;
-		/** Number of descriptors this channel can use */
-		TInt iDesCount;
-		/** DFC queue used to service DMA interrupts.  The DFC thread
-			priority must be higher than any client thread priority to
-			avoid a situation where a transfer completes while being
-			cancelled and another transfer is started before the DFC
-			thread gets a chance to run.  This would lead to a stray
-			DFC.
-		*/
-		TDfcQue* iDfcQ;
-		/** DFC priority */
-		TUint8 iDfcPriority;
-		};
-public:
-    /**
- 	Opens the DMA channel.
-
- 	Channel selection is done by the hardware-specific layer using a cookie passed in
- 	via aInfo.
-
- 	The client should not delete the returned pointer as the framework owns
- 	channel objects.  However, the client should explicitly close the channel when
- 	finished with it.
-
-	@param aInfo    Information passed by caller to select and configure channel.
- 	@param aChannel Point to open channel on successful return.  NULL otherwise.
-
- 	@return KErrNone or standard error code.
- 	*/
-	IMPORT_C static TInt Open(const SCreateInfo& aInfo, TDmaChannel*& aChannel);
-	
-	
-	/**
- 	Closes a previously opened DMA channel.
-
- 	Assume the channel is idle and all requests have been deleted.
- 	*/
-	IMPORT_C void Close();
-	
-	
-	/**
- 	Cancels the current request and all the pending ones.
- 	*/
-	IMPORT_C void CancelAll();
-	inline TBool IsOpened() const;
-	inline TBool IsQueueEmpty() const;
-	inline TUint32 PslId() const;
-	inline TInt FailNext(TInt aFragmentCount);
-	inline TInt MissNextInterrupts(TInt aInterruptCount);
-	inline TInt Extension(TInt aCmd, TAny* aArg);
-	
-	/**
-	This is a function that allows the Platform Specific Layer (PSL) to extend the DMA API
-	with new channel-independent operations.
-
-	@param aCmd Command identifier.  Negative values are reserved for Symbian use.
-	@param aArg PSL-specific.
-	
-	@return KErrNotSupported if aCmd is not supported; a  PSL specific value otherwise.
- 	*/
-	IMPORT_C TInt StaticExtension(TInt aCmd, TAny* aArg);
-	inline const TDmac* Controller() const;
-	inline TInt MaxTransferSize(TUint aFlags, TUint32 aPslInfo);
-	inline TUint MemAlignMask(TUint aFlags, TUint32 aPslInfo);
-protected:
-	// Interface with state machines
-	TDmaChannel();
-	virtual void DoQueue(DDmaRequest& aReq) = 0;
-	virtual void DoCancelAll() = 0;
-	virtual void DoUnlink(SDmaDesHdr& aHdr);
-	virtual void DoDfc(DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr) = 0;
-#if defined(__CPU_ARM) && !defined(__EABI__)
-	inline virtual ~TDmaChannel() {}	// kill really annoying warning
-#endif
-private:
-	static void Dfc(TAny*);
-	void DoDfc();
-	inline void Wait();
-	inline void Signal();
-	inline TBool Flash();
-	void ResetStateMachine();
-protected:
-	TDmac* iController;										// DMAC this channel belongs to (NULL when closed)
-	TUint32 iPslId;											// unique identifier provided by PSL
-	NFastMutex iLock;										// for data accessed in both client & DFC context
-	SDmaDesHdr* iCurHdr;									// fragment being transferred or NULL
-	SDmaDesHdr** iNullPtr;									// Pointer to NULL pointer following last fragment
-	TDfc iDfc;												// transfer completion/failure DFC
-	TInt iMaxDesCount;										// maximum number of allocable descriptors
-	TInt iAvailDesCount;									// available number of descriptors
-	volatile TUint32 iIsrDfc;								// Interface between ISR and DFC:
-	enum { KErrorFlagMask = 0x80000000 };					// bit 31 - error flag
-	enum { KCancelFlagMask = 0x40000000 };					// bit 30 - cancel flag
-	enum { KDfcCountMask = 0x3FFFFFFF };					// bits 0-29 - number of queued DFCs
-	SDblQue iReqQ;											// being/about to be transferred request queue
-	TInt iReqCount;											// number of requests attached to this channel
-private:
-	TDmaCancelInfo* iCancelInfo;
-	__DMA_DECLARE_INVARIANT
-	};
-
-
-//////////////////////////////////////////////////////////////////////////////
-// PIL-PSL INTERFACE
-//////////////////////////////////////////////////////////////////////////////
-
-/**
-Generic DMA descriptor used if the DMAC does not have support for hardware
-descriptor.
-@see DDmaRequest::Fragment
-@publishedPartner
-@released
-*/
-
-struct SDmaPseudoDes
-	{
-	/** Source linear address or peripheral cookie */
-	TUint32 iSrc;
-	/** Destination linear address or peripheral cookie */
-	TUint32 iDest;
-	/** Number of bytes to transfer */
-	TInt iCount;
-	/** @see TDmaRequestFlags */
-	TUint iFlags;
-	/** PSL-specific information provided by client */
-	TUint32 iPslInfo;
-	/** The same as TDmaChannel::SCreateInfo.iCookie */
-	TUint32 iCookie;
-	};
-
-
-/**
-Each hardware or pseudo descriptor is associated with a header.  Headers are
-needed because hardware descriptors can not easily be extended to store
-additional information.
-@publishedPartner
-@released
-*/
-
-struct SDmaDesHdr
-	{
-	SDmaDesHdr* iNext;
-	};
+# include <drivers/dma_v2.h>
+#endif	// #ifndef DMA_APIV2
 
 
-/**
-Interface used by PIL to open and close DMA channels.
-
-Must be implemented by PSL.
-@publishedPartner
-@released
-*/
-
-class DmaChannelMgr
-	{
-public:
-	/** Opens a channel using a client-provided identifier.
-		This function must be implemented by the PSL.
-		@param	aOpenId Magic cookie passed by client
-				This may identify the channel (if a static channel
-				allocation scheme is used) or may indicate some
-				properties which the channel must possess (if a dynamic
-				channel allocation scheme is used). It may be set to
-				zero always if dynamic allocation is used and all
-				channels are equivalent.
-		@return	Pointer to channel if available, NULL otherwise.
-		@pre	The PIL calls this function with a global fast mutex held to
-				avoid race conditions.
-		@post	If a non-NULL pointer is returned, the object pointed to has its
-				iController and iPslId members set to valid states.
-				iController should point to the controller handling that channel.
-				iPslId should contain a value uniquely identifying the channel -
-				it is used only for debug tracing by PIL. It can be given any
-				convenient value by PSL	(channel index, I/O port address, ...).
-	*/
-	static TDmaChannel* Open(TUint32 aOpenId);
-
-	/** Performs platform-specific operations when a channel is closed.
-		This function must be implemented by the PSL but the implementation can be
-		a no-op.
-		@param aChannel The channel to close
-		@pre The PIL calls this function with a global fast mutex held to
-			avoid race conditions.
-	*/
-	static void Close(TDmaChannel* aChannel);
-
-	/** Function allowing PSL to extend DMA API with new channel-independent operations.
-		This function must be implemented by the PSL.
-		@param aCmd Command identifier.  Negative values are reserved for Symbian use.
-		@param aArg PSL-specific
-		@return KErrNotSupported if aCmd is not supported.  PSL-specific value otherwise.
-	 */
-	static TInt StaticExtension(TInt aCmd, TAny* aArg);
-
-	static inline void Wait();
-	static inline void Signal();
-private:
-	static NFastMutex Lock;
-	};
-
-
-//////////////////////////////////////////////////////////////////////////////
-
-/**
- Abstract base class representing a DMA controller.
-
- The class has two purposes.
-
- First, it is a container for channels, descriptors and descriptor headers.
-
- Second, it exposes a set of virtual functions implemented by
- the PSL (platform-specific layer).
- These functions are the main interfaces between
- the PIL (platform-independent layer) and PSL.
-
- Must be allocated in BSS because it relies on being zeroed at creation-time.
-
- @publishedPartner
- @released
- */
-
-class TDmac
-	{
-	friend class DmaChannelMgr;
-// protected: VC++ complains when building PSL if following decl is protected
-public:
-	/** Data required for creating a new instance */
-	struct SCreateInfo
-		{
-		/** Number of channels in controller */
-		TInt iChannelCount;
-        /** Maximum number of descriptors (shared by all channels) */
-		TInt iDesCount;
-		/** Bitmask.  The only supported value is KCapsBitHwDes (hardware
-			descriptors used). */
-		TUint32 iCaps;
-		/** Size of individual descriptors.  Use sizeof(SDmaPseudoDes) for
-		 	single-buffer and double-buffer controllers. */
-		TInt iDesSize;
-		/** Bitmask used when creating the hardware chunk storing the descriptor
-			pool. Used only for hardware descriptors. The access part must be
-			EMapAttrSupRw.  If the chunk is cached and/or buffered, the PSL must
-			flush the data cache and/or drain the write buffer in InitHwDes()
-			and related functions.
-		 	@see TMappingAttributes
-		 */
-		TUint iDesChunkAttribs;
-		};
-public:
-	TInt Create(const SCreateInfo& aInfo);
-	virtual ~TDmac();
-	TInt ReserveSetOfDes(TInt aCount);
-	void ReleaseSetOfDes(TInt aCount);
-	void InitDes(const SDmaDesHdr& aHdr, TUint32 aSrc, TUint32 aDest, TInt aCount,
-				 TUint aFlags, TUint32 aPslInfo, TUint32 aCookie);
-	inline SDmaPseudoDes& HdrToDes(const SDmaDesHdr& aHdr) const;
-	inline TAny* HdrToHwDes(const SDmaDesHdr& aHdr) const;
-	inline TUint32 DesLinToPhys(TAny* aDes) const;
-	inline void Wait();
-	inline void Signal();
-protected:
-	TDmac(const SCreateInfo& aInfo);
-
-public:
-	/**
-	Called by PIL when one fragment (single-buffer and double-buffer DMACs) or
-	list of fragments (scatter/gather DMAC) is to be transferred.
-
-	Called when	initiating a new transfer and also, for double-buffer DMACs, for
-	configuring the next fragment to transfer while the current one is
-	ongoing. Must always be implemented by PSL.
-	@param aChannel The channel to use
-	@param aHdr Header associated with fragment to transfer
-	*/
-	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr) = 0;
-
-	/**
-    Called by PIL to suspend transfer on a given channel.
-
-    The suspension must occur synchronously as the PSL assumes the channel
-    is suspended after calling this function. Must always be implemented by PSL.
-	@param aChannel The channel to suspend
-	*/
-	virtual void StopTransfer(const TDmaChannel& aChannel) = 0;
-
-	/**
-	Called by PIL to check whether a DMA channel is idle.
-	@param aChannel The channel to test
-	@return ETrue if channel idle, EFalse if transferring.
-	 */
-	virtual TBool IsIdle(const TDmaChannel& aChannel) = 0;
-
-	/**
-	Called by PIL to retrieve from the PSL the maximum transfer size based on the
-	parameters passed.
-	@param aChannel Channel to be used for the transfer
-	@param aFlags Bitmask characterising transfer
-	@param aPslInfo Cookie passed by client and used by PSL
-	@return 0 if invalid argument(s), -1 if transfer size not limited, the maximum
-	transfer size otherwise.
-	*/
-	virtual TInt MaxTransferSize(TDmaChannel& aChannel, TUint aFlags, TUint32 aPslInfo) = 0;
-
-	/**
-	Called by PIL to retrieve from the PSL the memory alignment mask based on the
-	parameters passed. Some DMA controllers impose alignment constraints on the base
-	address of memory buffers. This mask is AND'ed against memory addresses computed
-	during fragmentation.
-	@param aChannel Channel to be used for the transfer
-	@param aFlags Bitmask characterising transfer
-	@param aPslInfo Cookie passed by client and used by PSL
-	@return A value representing the alignment mask (e.g. 3 if buffer must be 4-byte aligned)
-	*/
-	virtual TUint MemAlignMask(TDmaChannel& aChannel, TUint aFlags, TUint32 aPslInfo) = 0;
-
-	/**
-    Called by PIL during fragmentation to initialise a hardware descriptor.
-
-    The PSL must assume the descriptor is the last in the chain and so set the
-	interrupt bit and set the next descriptor field to an end of chain marker.
-	Must be implemented by PSL if and only if the DMAC supports hardware
-	descriptors.
-	@param aHdr Header associated with hardware descriptor to initialise
-	@param aSrc Transfer source
-	@param aDest Transfer destination
-	@param aCount Number of bytes to transfer (<= max. size supported by DMAC)
-	@param aFlags Bitmask characterising transfer
-	@param aPslInfo Cookie passed by client and used by PSL
-	@param aCookie the channel selection cookie
-	@see DDmaRequest::Fragment
-	*/
-	virtual void InitHwDes(const SDmaDesHdr& aHdr, TUint32 aSrc, TUint32 aDest, TInt aCount,
-						   TUint aFlags, TUint32 aPslInfo, TUint32 aCookie);
-
-	/**
-	Called by PIL, when fragmenting a request, to append a new hardware
-	descriptor to an existing descriptor chain.
-
-	Must clear the interrupt bit of	the descriptor associated with aHdr.
-	Must be implemented by PSL if and only if the DMAC supports hardware descriptors.
-	@param aHdr Header associated with last fragment in chain
-	@param aNextHdr Header associated with fragment to append
-	*/
-	virtual void ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr);
-
-	/**
-	Called by PIL when queuing a new request while the channel is running.
-
-	Must append the first hardware descriptor of the new request to the last
-	descriptor in the existing chain. Must be implemented by PSL if and only if
-	the DMAC supports hardware descriptors.
-	@param aChannel The channel where the transfer takes place
-	@param aLastHdr Header associated with last hardware descriptor in chain
-	@param aNewHdr Header associated with first hardware descriptor in new request
-	*/
-	virtual void AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr,
-							 const SDmaDesHdr& aNewHdr);
-
-	/**
-	Called by PIL when completing or cancelling a request to cause the PSL to unlink
-	the last item in the h/w descriptor chain from a subsequent chain that it was
-	possibly linked to. Must be implemented by the PSL if and only if the DMAC supports
-	hardware descriptors.
-
-	@param aChannel The channel where the request (and thus the descriptor) was queued
-	@param aHdr Header associated with last h/w descriptor in completed/cancelled chain
-	*/
-	virtual void UnlinkHwDes(const TDmaChannel& aChannel, SDmaDesHdr& aHdr);
-
-	/**
-	Called by test harness to force an error when the next fragment is
-	transferred.
-
-	Must be implemented by the PSL only if possible.
-	@param aChannel The channel where the error is to occur.
-	@return KErrNone if implemented.  The default PIL implementation returns
-	KErrNotSupported and the test harness knows how to deal with that.
-	*/
-	virtual TInt FailNext(const TDmaChannel& aChannel);
-
-	/**
-	Called by test harness to force the DMA controller to miss one or
-	more interrupts.
-
-	Must be implemented by the PSL only if possible.
-	@param aChannel The channel where the error is to occur
-	@param aInterruptCount The number of interrupt to miss.
-	@return KErrNone if implemented.  The default PIL implementation returns
-	KErrNotSupported and the test harness knows how to deal with that.
-	*/
-	virtual TInt MissNextInterrupts(const TDmaChannel& aChannel, TInt aInterruptCount);
-
-	/** Function allowing platform-specific layer to extend channel API with
-		new channel-specific operations.
-		@param aChannel Channel to operate on
-		@param aCmd Command identifier.  Negative values are reserved for Symbian use.
-		@param aArg PSL-specific
-		@return KErrNotSupported if aCmd is not supported.  PSL-specific value otherwise.
-		@see TDmaChannel::Extension
-	*/
-	virtual TInt Extension(TDmaChannel& aChannel, TInt aCmd, TAny* aArg);
-
-protected:
-	static void HandleIsr(TDmaChannel& aChannel, TBool aIsComplete);
-private:
-	TInt AllocDesPool(TUint aAttribs);
-	void FreeDesPool();
-private:
-	NFastMutex iLock;			 // protect descriptor reservation and allocation
-	const TInt iMaxDesCount;	 // initial number of descriptors and headers
-	TInt iAvailDesCount;		 // current available number of descriptors and headers
-	SDmaDesHdr* iHdrPool;		 // descriptor header dynamic array
-#ifndef __WINS__
-	DPlatChunkHw* iHwDesChunk;	 // chunk for hardware descriptor pool
-#endif
-	TAny* iDesPool;				 // hardware or pseudo descriptor dynamic array
-	const TInt iDesSize;		 // descriptor size in bytes
-public:
-	const TUint iCaps;  		 /*< what is supported by DMA controller */
-	enum {KCapsBitHwDes = 1};	 /*< hardware descriptors supported */
-	SDmaDesHdr* iFreeHdr;		 /*< head of unallocated descriptors linked list */
-#ifdef _DEBUG
-	TBool IsValidHdr(const SDmaDesHdr* aHdr);
-#endif
-	__DMA_DECLARE_INVARIANT
-	};
-
-
-//////////////////////////////////////////////////////////////////////////////
-
-/**
-Single-buffer DMA channel.
-
-Can be instantiated or further derived by PSL.  Not
-intended to be instantiated by client device drivers.
-@publishedPartner
-@released
-*/
-
-class TDmaSbChannel : public TDmaChannel
-	{
-private:
-	virtual void DoQueue(DDmaRequest& aReq);
-	virtual void DoCancelAll();
-	virtual void DoDfc(DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
-private:
-	TBool iTransferring;
-	};
-
-
-/**
-Double-buffer DMA channel.
-
-Can be instantiated or further derived by PSL.  Not
-intended to be instantiated by client device drivers.
-@publishedPartner
-@released
-*/
-
-class TDmaDbChannel : public TDmaChannel
-	{
-private:
-	virtual void DoQueue(DDmaRequest& aReq);
-	virtual void DoCancelAll();
-	virtual void DoDfc(DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
-private:
-	enum { EIdle = 0, ETransferring, ETransferringLast } iState;
-	};
-
-
-/**
-Scatter-gather DMA channel.
-
-Can be instantiated or further derived by PSL.
-Not intended to be instantiated by client device drivers.
-@publishedPartner
-@released
-*/
-
-class TDmaSgChannel : public TDmaChannel
-	{
-private:
-	virtual void DoQueue(DDmaRequest& aReq);
-	virtual void DoCancelAll();
-	virtual void DoUnlink(SDmaDesHdr& aHdr);
-	virtual void DoDfc(DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
-private:
-	TBool iTransferring;
-	};
-
-
-//////////////////////////////////////////////////////////////////////////////
-// INTERFACE WITH TEST HARNESS
-//////////////////////////////////////////////////////////////////////////////
-
-/**
-Set of information used by test harness.
-@publishedPartner
-@released
-*/
-
-struct TDmaTestInfo
-	{
-	/** Maximum transfer size in byte */
-	TInt iMaxTransferSize;
-	/** 3->Memory buffers must be 4-byte aligned, 7->8-byte aligned, ... */
-	TUint iMemAlignMask;
-	/** Cookie to pass to DDmaRequest::Fragment for memory-memory transfer*/
-	TUint32 iMemMemPslInfo;
-	/** Number of test single-buffer channels */
-	TInt iMaxSbChannels;
-	/** Pointer to array containing single-buffer test channel ids */
-	TUint32* iSbChannels;
-	/** Number of test double-buffer channels */
-	TInt iMaxDbChannels;
-	/** Pointer to array containing double-buffer test channel ids */
-	TUint32* iDbChannels;
-	/** Number of test scatter-gather channels */
-	TInt iMaxSgChannels;
-	/** Pointer to array containing scatter-gather test channel ids */
-	TUint32* iSgChannels;
-	};
-
-
-/**
-Provides access to test information structure stored in the PSL.
-
-Must be implemented by the PSL.
-@publishedPartner
-@released
-*/
-
-IMPORT_C const TDmaTestInfo& DmaTestInfo();
-
-
-//////////////////////////////////////////////////////////////////////////////
-
-#include <drivers/dma.inl>
-
-#endif
+#endif	// #ifndef __DMA_H__
--- a/kernel/eka/include/drivers/dma.inl	Thu Jan 07 13:38:45 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// e32\include\drivers\dma.inl
-// DMA framework public inline functions
-// This file should not be modified when porting the DMA framework to
-// new hardware.
-// TDmaChannel
-// 
-// WARNING: This file contains some APIs which are internal and are subject
-//          to change without noticed. Such APIs should therefore not be used
-//          outside the Kernel and Hardware Services package.
-//
-
-inline void TDmaChannel::Wait()
-	{
-	NKern::FMWait(&iLock);
-	}
-
-inline void TDmaChannel::Signal()
-	{
-	NKern::FMSignal(&iLock);
-	}
-
-inline TBool TDmaChannel::Flash()
-	{
-	return NKern::FMFlash(&iLock);
-	}
-
-inline TBool TDmaChannel::IsOpened() const
-	{
-	return iController != NULL;
-	}
-
-inline TBool TDmaChannel::IsQueueEmpty() const
-	{
-	return const_cast<TDmaChannel*>(this)->iReqQ.IsEmpty();
-	}
-
-inline TUint32 TDmaChannel::PslId() const
-	{
-	return iPslId;
-	}
-
-inline TInt TDmaChannel::FailNext(TInt /*aFragmentCount*/)
-	{
-	return iController->FailNext(*this);
-	}
-
-inline TInt TDmaChannel::MissNextInterrupts(TInt aInterruptCount)
-	{
-	return iController->MissNextInterrupts(*this, aInterruptCount);
-	}
-
-/** Function allowing platform-specific layer to extend API with new
-	channel-specific operations.
- 	@param aCmd Command identifier.  Negative values are reserved for Symbian use.
-	@param aArg PSL-specific
-	@return KErrNotSupported if aCmd is not supported.  PSL-specific value otherwise.
- */
-
-inline TInt TDmaChannel::Extension(TInt aCmd, TAny* aArg)
-	{
-	return iController->Extension(*this, aCmd, aArg);
-	}
-
-inline const TDmac* TDmaChannel::Controller() const
-	{
-	return iController;
-	}
-
-inline TInt TDmaChannel::MaxTransferSize(TUint aFlags, TUint32 aPslInfo)
-	{
-	return iController->MaxTransferSize(*this, aFlags, aPslInfo);
-	}
-
-inline TUint TDmaChannel::MemAlignMask(TUint aFlags, TUint32 aPslInfo)
-	{
-	return iController->MemAlignMask(*this, aFlags, aPslInfo);
-	}
-
-// DDmaRequest
-
-/** Called when request is removed from request queue in channel */
-
-inline void DDmaRequest::OnDeque()
-	{
-	iQueued = EFalse;
-	iLastHdr->iNext = NULL;
-	iChannel.DoUnlink(*iLastHdr);
-	}
-
-// TDmac
-
-inline void TDmac::Wait()
-	{
-	NKern::FMWait(&iLock);
-	}
-
-inline void TDmac::Signal()
-	{
-	NKern::FMSignal(&iLock);
-	}
-
-inline SDmaPseudoDes& TDmac::HdrToDes(const SDmaDesHdr& aHdr) const
-	{
-	return static_cast<SDmaPseudoDes*>(iDesPool)[&aHdr - iHdrPool];
-	}
-
-inline TAny* TDmac::HdrToHwDes(const SDmaDesHdr& aHdr) const
-	{
-	return static_cast<TUint8*>(iDesPool) + iDesSize*(&aHdr - iHdrPool);
-	}
-
-inline TUint32 TDmac::DesLinToPhys(TAny* aDes) const
-	{
-#ifdef __WINS__
-	(void)aDes;
-	return 0xDEADBEEF;
-#else
-	return iHwDesChunk->iPhysAddr + ((TLinAddr)aDes - iHwDesChunk->iLinAddr);
-#endif
-	}
-
-// DmaChannelMgr
-
-inline void DmaChannelMgr::Wait()
-	{
-	NKern::FMWait(&Lock);
-	}
-
-inline void DmaChannelMgr::Signal()
-	{
-	NKern::FMSignal(&Lock);
-	}
-
-//---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/drivers/dma_compat.inl	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,62 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// include/drivers/dma_compat.inl
+// DMA Framework - Client API definition.
+//
+// Inline implementations of functions which (originally) exposed DMA HAI
+// details that are now, after the header file split into dma_v2.h and
+// dma_hai.h, no longer meant to be visible to DMA clients. This file is only
+// included for DMA_APIV2 clients.
+//
+// This file is not meant to be a permanent one, and may eventually be removed
+// together with the deprecated functions it implements.
+//
+//
+
+
+inline const TDmac* TDmaChannel::Controller() const
+	{
+	return iController;
+	}
+
+static inline TUint32 RequestFlags2SrcConfigFlags(TUint aFlags)
+	{
+	TUint32 flags = (aFlags & KDmaMemSrc) ? KDmaMemAddr : 0;
+	flags |= (aFlags & KDmaPhysAddrSrc) ? KDmaPhysAddr : 0;
+	return flags;
+	}
+
+static inline TUint32 RequestFlags2DstConfigFlags(TUint aFlags)
+	{
+	TUint32 flags = (aFlags & KDmaMemDest) ? KDmaMemAddr : 0;
+	flags |= (aFlags & KDmaPhysAddrDest) ? KDmaPhysAddr : 0;
+	return flags;
+	}
+
+inline TInt TDmaChannel::MaxTransferSize(TUint aFlags, TUint32 aPslInfo)
+	{
+	TUint src_flags = RequestFlags2SrcConfigFlags(aFlags);
+	TUint dst_flags = RequestFlags2DstConfigFlags(aFlags);
+	return MaxTransferLength(src_flags, dst_flags, aPslInfo);
+	}
+
+inline TUint TDmaChannel::MemAlignMask(TUint aFlags, TUint32 aPslInfo)
+	{
+	TUint src_flags = RequestFlags2SrcConfigFlags(aFlags);
+	TUint dst_flags = RequestFlags2DstConfigFlags(aFlags);
+	return AddressAlignMask(src_flags, dst_flags, aPslInfo);
+	}
+
+
+// ---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/drivers/dma_hai.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,870 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// include/drivers/dma_hai.h
+// DMA Framework - Symbian Hardware Abstraction Interface (SHAI).
+//
+//
+
+#ifndef __DMA_HAI_H__
+#define __DMA_HAI_H__
+
+
+#include <kernel/kern_priv.h>
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+/** Interface used by PIL to open and close DMA channels.
+
+	Must be implemented by the PSL.
+
+	@publishedPartner
+	@released
+*/
+class DmaChannelMgr
+	{
+public:
+	/** Opens a channel using a client-provided identifier.
+
+		This function must be implemented by the PSL.
+
+		@param aOpenId PSL-specific magic cookie passed by client. This could
+		identify the channel exactly (by being just the channel number), or at
+		least sufficiently (for example for use with a certain peripheral), or
+		it may indicate some properties which the channel must possess. It may
+		be set to zero always if all channels are equivalent.
+
+		@param aDynChannel ETrue if the Open call is for a dynamic channel. A
+		dynamic channel is not exclusively reserved for just one client, and
+		further Open calls for more dynamic channels should succeed as long as
+		certain resources (but not including the number of available physical
+		channels) are not exceeded. Different transfer requests on this dynamic
+		channel may be serviced using different actual channels.
+
+		@param aPriority The desired channel priority as requested by the
+		client. This may be an actual hardware priority or a
+		platform-independent value. Not being able to satisfy the requested
+		value is not a reason for the PSL to return NULL. This parameter may be
+		ignored if aDynChannel is passed as ETrue. An overriding per-transfer
+		priority may be requested by a client later via
+		TDmaTransferArgs::iChannelPriority.
+		@see SDmacCaps::iChannelPriorities
+		@see TDmaPriority
+
+		@return Pointer to channel if available, NULL otherwise. It should not
+		be NULL if the Open call was for a dynamic channel unless a processing
+		error occurred.
+
+		@pre The PIL calls this function with a global fast mutex held to avoid
+		race conditions.
+
+		@post If a non-NULL pointer is returned, the object pointed to has its
+		iController, iDmacCaps, iPslId, iDynChannel and iPriority members set
+		to valid states.
+
+		iController should point to the controller handling the
+		channel.
+
+		iDmacCaps should point to a SDmacCaps structure containing values
+		relating to this particular channel.
+
+		iPslId should contain a value uniquely identifying the channel - the
+		PIL assigns this value later during request fragmentation to
+		TDmaTransferArgs::iChannelCookie. It can be given any convenient value
+		by the PSL (channel index, I/O port address, etc.).
+
+		iDynChannel should be set to ETrue by the PSL if a dynamic channel was
+		requested and has been opened.
+
+		If applicable, iPriority should contain the actual hardware priority
+		that has been configured or reserved. Otherwise it may be left at its
+		default value TDmaPriority::KDmaPriorityNone.
+	*/
+	static TDmaChannel* Open(TUint32 aOpenId, TBool aDynChannel, TUint aPriority);
+
+	/** Performs platform-specific operations when a channel is closed.
+
+		If aChannel was opened as a dynamic channel then this call is a sign
+		that there is a client which does not intend to queue any further
+		transfer requests via this channel.
+
+		This function must be implemented by the PSL but the implementation can
+		be a no-op.
+
+		@param aChannel The channel to close
+
+		@pre The PIL calls this function with a global fast mutex held to avoid
+		race conditions.
+	*/
+	static void Close(TDmaChannel* aChannel);
+
+	/** Function allowing PSL to extend DMA API with new channel-independent
+		operations.
+
+		This function must be implemented by the PSL.
+
+		@param aCmd Command identifier. Negative values are reserved for FW
+		internal use.
+
+		@param aArg PSL-specific
+
+		@return KErrNotSupported if aCmd is not supported. PSL-specific value
+		otherwise.
+	 */
+	static TInt StaticExtension(TInt aCmd, TAny* aArg);
+
+	/** Acquires the channel manager lock. Called by the PIL before opening and
+		closing a channel.
+	*/
+	static void Wait();
+
+	/** Releases the channel manager lock. Called by the PIL after opening and
+		closing a channel.
+	*/
+	static void Signal();
+
+private:
+	/** Declared, defined, and called by PSL's DECLARE_STANDARD_EXTENSION(). */
+	friend TInt InitExtension();
+
+	/** Must be called in the DMA DLL entry point. */
+	static TInt Initialise();
+
+	static NFastMutex Lock;
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+/** Abstract base class representing a DMA controller.
+
+	The class has two purposes.
+
+	First, it is a container for channels, descriptors and descriptor headers.
+
+	Second, it exposes a set of virtual functions implemented by the PSL
+	(platform-specific layer).
+
+	These functions are the main interfaces between the PIL
+	(platform-independent layer) and PSL.
+
+	@publishedPartner
+	@released
+*/
+class TDmac
+	{
+	friend class DmaChannelMgr;
+
+protected:
+	/** Data required for creating a new instance */
+	struct SCreateInfo
+		{
+		/** True if DMAC uses hardware descriptors (i.e. supports
+			scatter/gather mode).
+		*/
+		TBool iCapsHwDes;
+		/** Initial maximum number of descriptors and headers (shared by all
+			channels) to be allocated by the PIL. If at run time more
+			descriptors are needed then they will be dynamically allocated and
+			added to the available pool.
+
+			The PSL may consider a number of factors when providing this
+			initial value, such as the number of channels on this controller,
+			the maximum transfer size per descriptor and also likely usage
+			scenarios for the platform or device (number of drivers using DMA,
+			their traffic patterns, simultaneity of operations, etc.).
+		*/
+		TInt iDesCount;
+		/** Size of individual descriptors. Use sizeof(TDmaTransferArgs) for
+		 	single-buffer and double-buffer (i.e. non-s/g) controllers.
+		*/
+		TInt iDesSize;
+		/** Bitmask used when creating the memory chunk storing the descriptor
+			pool. Used only for hardware descriptors.
+
+			The access part must be EMapAttrSupRw. If the chunk is cached
+			and/or buffered, the PSL must flush the data cache and/or drain the
+			write buffer in InitHwDes() and related functions.
+
+			The physical start address of the chunk will always be MMU page
+		 	size aligned.
+
+		 	@see TMappingAttributes
+		 */
+		TUint iDesChunkAttribs;
+		};
+
+	/** Base class constructor. */
+	TDmac(const SCreateInfo& aInfo);
+
+	/** Base class 2nd-phase constructor. */
+	TInt Create(const SCreateInfo& aInfo);
+
+public:
+	/** Base class virtual destructor. */
+	virtual ~TDmac();
+
+	/** Allocates a number of headers (and hence also descriptors) from the
+		header/descriptor pools. Called by the PIL but may also be used by the
+		PSL.
+	*/
+	TInt ReserveSetOfDes(TInt aCount);
+
+	/** Returns previously allocated headers (and hence also descriptors) to
+		the header/descriptor pools. Called by the PIL but may also be used by
+		the PSL.
+	*/
+	void ReleaseSetOfDes(TInt aCount);
+
+	/** Called by the PIL during request fragmentation to fill a descriptor or
+		pseudo descriptor with transfer arguments.
+	*/
+	TInt InitDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
+
+	/** Called by the PIL in TDmaChannel::IsrRedoRequest() if any of the
+		latter's arguments is non-zero.
+	*/
+	TInt UpdateDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr, TUint32 aDstAddr,
+				   TUint aTransferCount, TUint32 aPslRequestInfo);
+
+	/** Returns a reference to the associated pseudo descriptor for a given
+		descriptor header. For use by PIL and PSL.
+	*/
+	inline TDmaTransferArgs& HdrToDes(const SDmaDesHdr& aHdr) const;
+
+	/** Returns a reference to the associated hardware descriptor for a given
+		descriptor header. For use by PIL and PSL.
+	*/
+	inline TAny* HdrToHwDes(const SDmaDesHdr& aHdr) const;
+
+	/** Returns the physical address of the hardware descriptor
+		pointed to by aDes. For use by PIL and PSL.
+	*/
+	inline TUint32 HwDesLinToPhys(TAny* aDes) const;
+
+	/** Called by the PIL to acquire the controller lock which protects the
+		header and descriptor pools.
+	*/
+	inline void Wait();
+
+	/** Called by the PIL to release the controller lock which protects the
+		header and descriptor pools.
+	*/
+	inline void Signal();
+
+public:
+	/** Called by PIL when one fragment (single-buffer and double-buffer DMACs)
+		or list of fragments (scatter/gather DMAC) is to be transferred.
+
+		Called when initiating a new transfer and also, for double-buffer
+		DMACs, for configuring the next fragment to transfer while the current
+		one is ongoing.
+
+		The function must be implemented by the PSL if
+		SCreateInfo::iCaps::iAsymHwDescriptors is reported as false.
+
+		@note This function may be called in thread or ISR context by the PIL
+
+		@param aChannel The channel to use.
+		@param aHdr Header associated with fragment to transfer.
+	*/
+	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr);
+
+	/** Called by PIL when two lists of fragments (scatter/gather DMAC with
+		asymmetrical linked-list capability) are to be transferred.
+
+		Called when initiating a new transfer.
+
+		The function must be implemented by the PSL if
+		SDmaCaps::iAsymHwDescriptors is reported as true.
+
+		@note This function may be called in thread or ISR context by the PIL
+
+		@param aChannel The channel to use.
+		@param aSrcHdr Header associated with descriptor to transfer on the
+		source side.
+		@param aDstHdr Header associated with descriptor to transfer on the
+		destination side.
+	*/
+	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aSrcHdr,
+						  const SDmaDesHdr& aDstHdr);
+
+	/** Called by PIL to stop a transfer on a given channel.
+
+		The stopping must occur synchronously as the PIL assumes the channel
+		is halted after calling this function. A channel stopped via this
+		function is not intended to be resumed. Function must always be
+		implemented by the PSL.
+
+		@param aChannel The channel to stop
+		@post The channel will be idle
+		@post No interrupt will occur from this channel until a new
+		request is queued.
+	*/
+	virtual void StopTransfer(const TDmaChannel& aChannel) = 0;
+
+	/** Called by PIL to pause (suspend) a transfer on a given channel.
+
+		A paused channel transfer must be able to be resumed by calling
+		ResumeTransfer().
+
+		The function must be implemented by the PSL if
+		SDmacCaps::iChannelPauseAndResume is reported as true.
+
+		@return KErrNone if the transfer has been paused successfully,
+		KErrCompletion if the transfer was already paused, KErrGeneral
+		if a general error occurred preventing a successful outcome.
+
+		@post No interrupt will occur from this channel until it is
+		resumed.
+	 */
+	virtual TInt PauseTransfer(const TDmaChannel& aChannel);
+
+	/** Called by PIL to resume a paused (suspended) transfer on a given
+		channel.
+
+		Resume() can be called when the transfer is paused as a result of a
+		previous call to PauseTransfer() or because the DMAC has encountered a
+		Pause bit in a H/W descriptor.
+
+		The function must be implemented by the PSL if
+		SDmacCaps::iChannelPauseAndResume is reported as true.
+
+		@return KErrNone if the transfer has been resumed successfully,
+		KErrCompletion if there was no paused transfer, KErrGeneral
+		if a general error occurred preventing a successful outcome.
+	 */
+	virtual TInt ResumeTransfer(const TDmaChannel& aChannel);
+
+	/** Called by PIL to check whether a DMA channel is idle.
+
+		'Idle' here means that the channel is ultimately stopped, for example
+		because the transfer has finished, or an error was encountered, or it
+		was manually stopped, but not because it was manually suspended (aka
+		'paused'), or it is waiting for a request line assertion to start the
+		transfer.
+
+		@param aChannel The channel to test
+
+		@return ETrue if channel idle, EFalse if transferring.
+	*/
+	virtual TBool IsIdle(const TDmaChannel& aChannel) = 0;
+
+	/** Called by PIL to retrieve from the PSL the maximum transfer length
+		based on the parameters passed.
+
+		@param aChannel Channel to be used for the transfer
+		@param aSrcFlags Bitmask characterising transfer source
+		@see TDmaTransferArgs::iSrcConfig::iFlags
+		@param aDstFlags Bitmask characterising transfer destination
+		@see TDmaTransferArgs::iDstConfig::iFlags
+		@param aPslInfo Cookie passed by client and used by the PSL
+		@see TDmaTransferArgs::iPslRequestInfo
+
+		@return 0 if transfer length is not limited, the maximum transfer
+		length in bytes otherwise.
+	*/
+	virtual TUint MaxTransferLength(TDmaChannel& aChannel, TUint aSrcFlags,
+									TUint aDstFlags, TUint32 aPslInfo) = 0;
+
+	/** Called by PIL to retrieve from the PSL the memory alignment mask based
+		on the parameters passed. Some DMA controllers impose alignment
+		constraints on the base address of memory buffers. This mask is AND'ed
+		against memory addresses computed during fragmentation.
+
+		The PIL will call this function separately for source and destination.
+
+		An assumption is that the PSL doesn't need to know if a call to this
+		function is for the source or the destination side, i.e. both ports
+		are, as far as the alignment is concerned, equivalent. All that matters
+		are the values of the relevant configuration parameters.
+
+		Another assumption is that the alignment requirement for a port on a
+		DMAC with potentially different values for source and destination does
+		not depend on the configuration of the respective other port.
+
+		@param aChannel Channel used for the transfer
+		@param aTargetFlags Bitmask characterising transfer source or
+		destination
+		@see TDmaTransferArgs::iSrcConfig::iFlags
+		@see TDmaTransferArgs::iDstConfig::iFlags
+		@param aElementSize Element size used for the transfer. May be zero if
+		not known or 'don't care'.
+		@param aPslInfo Cookie passed by client and used by the PSL
+		@see TDmaTransferArgs::iPslRequestInfo
+
+		@return A value representing the alignment mask (e.g. 3 if buffer must
+		be 4-byte aligned)
+	*/
+	virtual TUint AddressAlignMask(TDmaChannel& aChannel, TUint aTargetFlags,
+								   TUint aElementSize, TUint32 aPslInfo) = 0;
+
+	/** Called by PIL during fragmentation to initialise a hardware descriptor.
+
+		The PSL must assume the descriptor is the last in the chain and so set
+		the interrupt bit and set the next descriptor field to an end of chain
+		marker.
+
+		The function must be implemented by the PSL if and only if the DMAC
+		supports hardware descriptors and SDmaCaps::iAsymHwDescriptors is
+		reported as false.
+
+		@param aHdr Header associated with the hardware descriptor to
+		initialise
+		@param aTransferArgs The transfer parameters for this descriptor
+
+		@return KErrNone if the descriptor was successfully initialized,
+		KErrArgument if any of the transfer arguments were detected to be
+		invalid, KErrGeneral if a general error occurred preventing a
+		successful outcome.
+	*/
+	virtual TInt InitHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
+
+	/** Called by PIL during fragmentation to initialise a hardware descriptor
+		on the source side of an asymmetric linked list.
+
+		The function must be implemented by the PSL if
+		SDmaCaps::iAsymHwDescriptors is reported as true.
+
+		@param aHdr Header associated with the hardware descriptor to
+		initialise
+		@param aTransferArgs The transfer parameters for this descriptor. Only
+		the elements relating to the source side should be relevant to the
+		implementation.
+
+		@return KErrNone if the descriptor was successfully initialized,
+		KErrArgument if any of the transfer arguments were detected to be
+		invalid, KErrGeneral if a general error occurred preventing a
+		successful outcome.
+	*/
+	virtual TInt InitSrcHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
+
+	/** Called by PIL during fragmentation to initialise a hardware descriptor
+		on the destination side of an asymmetric linked list.
+
+		The function must be implemented by the PSL if
+		SDmaCaps::iAsymHwDescriptors is reported as true.
+
+		@param aHdr Header associated with the hardware descriptor to
+		initialise
+		@param aTransferArgs The transfer parameters for this descriptor. Only
+		the elements relating to the destination side should be relevant to the
+		implementation.
+
+		@return KErrNone if the descriptor was successfully initialized,
+		KErrArgument if any of the transfer arguments were detected to be
+		invalid, KErrGeneral if a general error occurred preventing a
+		successful outcome.
+	*/
+	virtual TInt InitDstHwDes(const SDmaDesHdr& aHdr, const TDmaTransferArgs& aTransferArgs);
+
+	/** Called by the PIL in ISR context to change specific fields in a
+		hardware descriptor.
+
+		The function must be implemented by the PSL if and only if the DMAC
+		supports hardware descriptors and SDmaCaps::iAsymHwDescriptors is
+		reported as false.
+
+		@param aHdr Header associated with the hardware descriptor to be
+		updated
+		@param aSrcAddr @see TDmaTransferArgs::iSrcConfig::iAddr
+		@param aDstAddr @see TDmaTransferArgs::iDstConfig::iAddr
+		@param aTransferCount @see TDmaTransferArgs::iTransferCount
+		@param aPslRequestInfo @see TDmaTransferArgs::iPslRequestInfo
+
+		Since Epoc::LinearToPhysical() cannot be called in ISR context the
+		addresses passed into this function are always physical ones, i.e.
+		TDmaTransferFlags::KDmaPhysAddr is implied.
+
+		@return KErrNone if the descriptor was successfully modified,
+		KErrArgument if any of the transfer arguments were detected to be
+		invalid, KErrGeneral if a general error occurred preventing a
+		successful outcome.
+	*/
+	virtual TInt UpdateHwDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr, TUint32 aDstAddr,
+							 TUint aTransferCount, TUint32 aPslRequestInfo);
+
+	/** Called by the PIL in ISR context to change specific fields in a
+		hardware descriptor.
+
+		The function must be implemented by the PSL if
+		SDmaCaps::iAsymHwDescriptors is reported as true.
+
+		@param aHdr Header associated with the hardware descriptor to be
+		updated
+		@param aSrcAddr @see TDmaTransferArgs::iSrcConfig::iAddr
+		@param aTransferCount @see TDmaTransferArgs::iTransferCount
+		@param aPslRequestInfo @see TDmaTransferArgs::iPslRequestInfo
+
+		Since Epoc::LinearToPhysical() cannot be called in ISR context the
+		address passed into this function is always a physical ones, i.e.
+		TDmaTransferFlags::KDmaPhysAddr is implied.
+
+		@return KErrNone if the descriptor was successfully modified,
+		KErrArgument if any of the transfer arguments were detected to be
+		invalid, KErrGeneral if a general error occurred preventing a
+		successful outcome.
+	*/
+	virtual TInt UpdateSrcHwDes(const SDmaDesHdr& aHdr, TUint32 aSrcAddr,
+								TUint aTransferCount, TUint32 aPslRequestInfo);
+
+	/** Called by the PIL in ISR context to change specific fields in a
+		hardware descriptor.
+
+		The function must be implemented by the PSL if
+		SDmaCaps::iAsymHwDescriptors is reported as true.
+
+		@param aHdr Header associated with the hardware descriptor to be
+		updated
+		@param aDstAddr @see TDmaTransferArgs::iDstConfig::iAddr
+		@param aTransferCount @see TDmaTransferArgs::iTransferCount
+		@param aPslRequestInfo @see TDmaTransferArgs::iPslRequestInfo
+
+		Since Epoc::LinearToPhysical() cannot be called in ISR context the
+		address passed into this function is always a physical ones, i.e.
+		TDmaTransferFlags::KDmaPhysAddr is implied.
+
+		@return KErrNone if the descriptor was successfully modified,
+		KErrArgument if any of the transfer arguments were detected to be
+		invalid, KErrGeneral if a general error occurred preventing a
+		successful outcome.
+	*/
+	virtual TInt UpdateDstHwDes(const SDmaDesHdr& aHdr, TUint32 aDstAddr,
+								TUint aTransferCount, TUint32 aPslRequestInfo);
+
+	/** Called by PIL, when fragmenting a request, to append a new hardware
+		descriptor to an existing descriptor chain. May also be called by
+		clients who wish to create their own descriptor chains.
+
+		Must clear the interrupt bit of the descriptor associated with aHdr.
+
+		The function must be implemented by the PSL if and only if the DMAC
+		supports hardware descriptors.
+
+		@param aHdr Header associated with last fragment in chain
+		@param aNextHdr Header associated with fragment to append
+	*/
+	virtual void ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr);
+
+	/** Called by PIL when queuing a new request while the channel is running.
+
+		Must append the first hardware descriptor of the new request to the
+		last descriptor in the existing chain.
+
+		The function must be implemented by the PSL if and only if the DMAC
+		supports hardware descriptors.
+
+		@param aChannel The channel where the transfer takes place
+		@param aLastHdr Header associated with last hardware descriptor in
+		chain
+		@param aNewHdr Header associated with first hardware descriptor in new
+		request
+	*/
+	virtual void AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr,
+							 const SDmaDesHdr& aNewHdr);
+
+	/** Called by PIL when queuing a new request while the channel is running.
+
+		Must append the first hardware descriptor of the new request to the
+		last descriptor in the existing chain.
+
+		The function must be implemented by the PSL if
+		SDmaCaps::iAsymHwDescriptors is reported as true.
+
+		@param aChannel The channel where the transfer takes place
+		@param aSrcLastHdr Header associated with the last descriptor in the
+		source side chain
+		@param aSrcNewHdr Header associated with the first source side
+		descriptor of the new request
+		@param aDstLastHdr Header associated with the last descriptor in the
+		destination side chain
+		@param aDstNewHdr Header associated with the first destination side
+		descriptor of the new request
+	*/
+	virtual void AppendHwDes(const TDmaChannel& aChannel,
+							 const SDmaDesHdr& aSrcLastHdr, const SDmaDesHdr& aSrcNewHdr,
+							 const SDmaDesHdr& aDstLastHdr, const SDmaDesHdr& aDstNewHdr);
+
+	/** Called by PIL when completing or cancelling a request to cause the PSL
+		to unlink the last item in the h/w descriptor chain from a subsequent
+		chain that it was possibly linked to.
+
+		The function must be implemented by the PSL if and only if the DMAC
+		supports hardware descriptors.
+
+		@param aChannel The channel where the request (and thus the descriptor)
+		was queued
+		@param aHdr Header associated with last h/w descriptor in
+		completed / cancelled chain
+	*/
+	virtual void UnlinkHwDes(const TDmaChannel& aChannel, SDmaDesHdr& aHdr);
+
+	/** Called by PIL when freeing descriptors back to the shared pool in
+		FreeDesList(). The PSL inside ClearHwDes() can clear the contents of
+		the h/w descriptor.
+
+		This may be necessary if the PSL implementation uses the h/w descriptor
+		as another header which in turn points to the actual DMA h/w descriptor
+		(aka LLI).
+
+		The function may be implemented by the PSL if the DMAC supports
+		hardware descriptors.
+
+		@param aHdr Header associated with the h/w descriptor being freed.
+	 */
+	virtual void ClearHwDes(const SDmaDesHdr& aHdr);
+
+	/** Called by PIL to logically link two physical channels.
+
+		The function must be implemented by the PSL if the DMAC supports
+		logical channel linking.
+
+		@see SDmacCaps::iChannelLinking
+
+		@param a1stChannel The channel which is to be linked to another channel
+		@param a2ndChannel The channel the first one is to be linked to
+
+		@return KErrNone if the two channels have been linked successfully,
+		KErrCompletion if a1stChannel was already linked to a2ndChannel,
+		KErrArgument if a1stChannel was already linked to a different channel,
+		KErrGeneral if a general error occurred preventing a successful
+		outcome. The default PIL implementation returns KErrNotSupported.
+	 */
+	virtual TInt LinkChannels(TDmaChannel& a1stChannel, TDmaChannel& a2ndChannel);
+
+	/** Called by PIL to logically unlink a physical channel from its linked-to
+		successor.
+
+		The function must be implemented by the PSL if the DMAC supports
+		logical channel linking.
+
+		@see SDmacCaps::iChannelLinking
+
+		@param aChannel The channel which is to be unlinked from its successor
+
+		@return KErrNone if the channel has been unlinked successfully,
+		KErrCompletion if the channel was not linked to another channel,
+		KErrGeneral if a general error occurred preventing a successful
+		outcome. The default PIL implementation returns KErrNotSupported.
+	 */
+	virtual TInt UnlinkChannel(TDmaChannel& aChannel);
+
+	/** Called by a test harness to force an error when the next fragment is
+		transferred.
+
+		Must be implemented by the PSL only if possible.
+
+		@param aChannel The channel where the error is to occur.
+
+		@return KErrNone if implemented. The default PIL implementation
+		returns KErrNotSupported.
+	*/
+	virtual TInt FailNext(const TDmaChannel& aChannel);
+
+	/** Called by a test harness to force the DMA controller to miss one or
+		more interrupts.
+
+		The function must be implemented by the PSL only if possible.
+
+		@param aChannel The channel where the error is to occur
+		@param aInterruptCount The number of interrupt to miss.
+
+		@return KErrNone if implemented. The default PIL implementation
+		returns KErrNotSupported.
+	*/
+	virtual TInt MissNextInterrupts(const TDmaChannel& aChannel, TInt aInterruptCount);
+
+	/** Function allowing platform-specific layer to extend channel API with
+		new channel-specific operations.
+
+		@see TDmaChannel::ChannelExtension
+
+		@param aChannel Channel to operate on
+		@param aCmd Command identifier. Negative values are reserved for use by
+		Nokia.
+		@param aArg PSL-specific argument
+
+		@return KErrNotSupported if aCmd is not supported. PSL-specific value
+		otherwise.
+	*/
+	virtual TInt Extension(TDmaChannel& aChannel, TInt aCmd, TAny* aArg);
+
+	/** Called by the PIL to query the number of elements that have so far been
+		transferred by the hardware descriptor associated with aHdr at the
+		source port.
+
+		If SDmacCaps::iAsymHwDescriptors is true then the PIL will call this
+		function only for source-side descriptors, and the PSL should fault the
+		kernel if this is not the case.
+
+		The function must be implemented (i.e. overridden) by the PSL if and
+		only if the DMAC supports hardware descriptors.
+
+		@param aHdr Descriptor header associated with the hardware descriptor
+		to be queried
+
+		@return The number of elements that have been transferred by the
+		hardware descriptor associated with aHdr at the source port
+	*/
+	virtual TUint32 HwDesNumSrcElementsTransferred(const SDmaDesHdr& aHdr);
+
+	/** Called by the PIL to query the number of elements that have so far been
+		transferred by the hardware descriptor associated with aHdr at the
+		destination port.
+
+		If SDmacCaps::iAsymHwDescriptors is true then the PIL will call this
+		function only for destination-side descriptors, and the PSL should
+		panic if this is not the case.
+
+		The function must be implemented (i.e. overridden) by the PSL if and
+		only if the DMAC supports hardware descriptors.
+
+		@param aHdr Descriptor header associated with the hardware descriptor
+		to be queried
+
+		@return The number of elements that have been transferred by the
+		hardware descriptor associated with aHdr at the destination port
+	*/
+	virtual TUint32 HwDesNumDstElementsTransferred(const SDmaDesHdr& aHdr);
+
+protected:
+	/** Called by the PSL in interrupt context upon a channel interrupt event.
+
+		@param aChannel The channel the ISR relates to
+		@param aEventMask Bitmask of one or more TDmaCallbackType values
+		@param aIsComplete Set to ETrue if no error was encountered
+	 */
+	static void HandleIsr(TDmaChannel& aChannel, TUint aEventMask, TBool aIsComplete);
+
+private:
+	/** Called in Create() */
+	TInt AllocDesPool(TUint aAttribs);
+
+	/** Called in ~TDmac() */
+	void FreeDesPool();
+
+private:
+	NFastMutex iLock;			 // protect descriptor reservation and allocation
+	const TInt iMaxDesCount;	 // initial number of descriptors and headers
+	TInt iAvailDesCount;		 // current available number of descriptors and headers
+	SDmaDesHdr* iHdrPool;		 // descriptor header dynamic array
+#ifndef __WINS__
+	DPlatChunkHw* iHwDesChunk;	 // chunk for hardware descriptor pool
+#endif
+	TAny* iDesPool;				 // hardware or pseudo descriptor dynamic array
+	const TInt iDesSize;		 // descriptor size in bytes
+
+public:
+	const TBool iCapsHwDes;		 /*< True if DMAC uses h/w descriptors */
+	SDmaDesHdr* iFreeHdr;		 /*< head of unallocated descriptors linked list */
+
+#ifdef _DEBUG
+	/** Tests whether aHdr points into the descriptor header array. */
+	TBool IsValidHdr(const SDmaDesHdr* aHdr);
+#endif
+	__DMA_DECLARE_INVARIANT
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+/** Single-buffer DMA channel.
+
+	Can be instantiated or further derived by the PSL.
+
+	@publishedPartner
+	@released
+*/
+class TDmaSbChannel : public TDmaChannel
+	{
+private:
+	virtual void DoQueue(const DDmaRequest& aReq);
+	virtual void DoCancelAll();
+	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
+private:
+	enum {EIdle = 0, ETransferring} iState;
+	};
+
+
+/** Double-buffer DMA channel.
+
+	Can be instantiated or further derived by the PSL.
+
+	@publishedPartner
+	@released
+*/
+class TDmaDbChannel : public TDmaChannel
+	{
+private:
+	virtual void DoQueue(const DDmaRequest& aReq);
+	virtual void DoCancelAll();
+	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
+private:
+	enum {EIdle = 0, ETransferring, ETransferringLast} iState;
+	};
+
+
+/** Scatter-gather DMA channel.
+
+	Can be instantiated or further derived by the PSL.
+
+	@publishedPartner
+	@released
+*/
+class TDmaSgChannel : public TDmaChannel
+	{
+private:
+	virtual void DoQueue(const DDmaRequest& aReq);
+	virtual void DoCancelAll();
+	virtual void DoUnlink(SDmaDesHdr& aHdr);
+	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
+private:
+	enum {EIdle = 0, ETransferring} iState;
+	};
+
+
+/** Scatter-gather DMA channel with asymmetric linked-lists.
+
+	Can be instantiated or further derived by the PSL.
+
+	@publishedPartner
+	@released
+*/
+class TDmaAsymSgChannel : public TDmaChannel
+	{
+private:
+	virtual void DoQueue(const DDmaRequest& aReq);
+	virtual void DoCancelAll();
+	virtual void DoUnlink(SDmaDesHdr& aHdr);
+	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aSrcCompletedHdr,
+					   SDmaDesHdr*& aDstCompletedHdr);
+private:
+	SDmaDesHdr* iSrcCurHdr;		   // source fragment being transferred or NULL
+	SDmaDesHdr** iSrcNullPtr; // Pointer to NULL pointer following last source fragment
+	SDmaDesHdr* iDstCurHdr;	  // destination fragment being transferred or NULL
+	SDmaDesHdr** iDstNullPtr; // Pointer to NULL pointer following last destination fragment
+	enum {EIdle = 0, ETransferring} iState;
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+#include <drivers/dma_hai.inl>
+
+
+#endif	// #ifndef __DMA_HAI_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/drivers/dma_hai.inl	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,54 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// include/drivers/dma_hai.inl
+// DMA Framework - Symbian Hardware Abstraction Interface (SHAI).
+//
+//
+
+
+// TDmac
+
+inline void TDmac::Wait()
+	{
+	NKern::FMWait(&iLock);
+	}
+
+inline void TDmac::Signal()
+	{
+	NKern::FMSignal(&iLock);
+	}
+
+inline TDmaTransferArgs& TDmac::HdrToDes(const SDmaDesHdr& aHdr) const
+	{
+	return static_cast<TDmaTransferArgs*>(iDesPool)[&aHdr - iHdrPool];
+	}
+
+inline TAny* TDmac::HdrToHwDes(const SDmaDesHdr& aHdr) const
+	{
+	return static_cast<TUint8*>(iDesPool) + iDesSize * (&aHdr - iHdrPool);
+	}
+
+inline TUint32 TDmac::HwDesLinToPhys(TAny* aDes) const
+	{
+#ifdef __WINS__
+	(void)aDes;
+	return 0xDEADBEEF;
+#else
+	return iHwDesChunk->iPhysAddr +
+		(reinterpret_cast<TLinAddr>(aDes) - iHwDesChunk->iLinAddr);
+#endif
+	}
+
+
+// ---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/drivers/dma_v1.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,834 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0""
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// include/drivers/dma_v1.h
+// DMA Framework API v1
+//
+// NB: DMA clients should never include this file directly, but only ever the
+// generic header file <drivers/dma.h>.
+//
+
+#ifndef __DMA_H__
+#error "dma_v1.h must'n be included directly - use <drivers/dma.h> instead"
+#endif	// #ifndef __DMA_H__
+
+#ifndef __DMA_V1_H__
+#define __DMA_V1_H__
+
+#include <kernel/kern_priv.h>
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Debug Support - KDmaPanicCat is defined in each source file
+
+#define __DMA_ASSERTD(e) __ASSERT_DEBUG(e, Kern::Fault(KDmaPanicCat, __LINE__))
+#define __DMA_ASSERTA(e) __ASSERT_ALWAYS(e, Kern::Fault(KDmaPanicCat, __LINE__))
+#ifdef _DEBUG
+#define __DMA_CANT_HAPPEN() Kern::Fault(KDmaPanicCat, __LINE__)
+#define __DMA_DECLARE_INVARIANT public: void Invariant();
+#define __DMA_INVARIANT() Invariant()
+#else
+#define __DMA_CANT_HAPPEN()
+#define __DMA_DECLARE_INVARIANT
+#define __DMA_INVARIANT()
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////////
+// INTERFACE EXPOSED TO DEVICE-DRIVERS
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+Bitmasks used for configuring a DMA request.
+
+In general, specify KDmaMemSrc|KDmaIncSrc (resp. KDmaMemDest|KDmaIncDest) if
+the source (resp. destination) is a memory buffer and clear
+KDmaMemSrc|KDmaIncSrc (resp. KDmaMemDest|KDmaIncDest) if the source
+(resp. destination) is a peripheral.
+
+If the location is given as a physical address (rather than a linear one)
+then also specify KDmaPhysAddrSrc and/or KDmaPhysAddrDest.
+
+The EKA1 "Fill Mode" can be implemented by omitting KDmaIncSrc.
+
+Some peripherals may require a post-increment address mode.
+
+@see DDmaRequest::Fragment
+@publishedPartner
+@released
+*/
+
+enum TDmaRequestFlags
+	{
+	/** Source is address of memory buffer */
+	KDmaMemSrc       = 0x01,
+	/** Destination is address of memory buffer */
+	KDmaMemDest      = 0x02,
+	/** Source address must be post-incremented during transfer */
+	KDmaIncSrc       = 0x04,
+	/** Destination address must be post-incremented during transfer */
+	KDmaIncDest      = 0x08,
+	/** Source address is a physical address (as opposed to a linear one) */
+	KDmaPhysAddrSrc  = 0x10,
+	/** Destination address is a physical address (as opposed to a linear one) */
+	KDmaPhysAddrDest = 0x20,
+	/** Request a different max transfer size (for instance for test purposes) */
+	KDmaAltTransferLen = 0x40
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class TDmaChannel;
+struct SDmaDesHdr;
+
+/** A DMA request is a list of fragments small enough to be transferred in one go
+	by the DMAC.
+
+	In general, fragmentation is done in the framework by calling Fragment() but
+	clients with special needs can allocate a blank descriptor list with
+	ExpandDesList() and customise it to fit their needs.
+
+	Clients should not set attributes directly, but should use the various functions
+	instead.
+
+	This class has not been designed to be called from several concurrent threads.
+	Multithreaded clients must implement their own locking scheme (via DMutex).
+
+	Fast mutexes are used internally to protect data structures accessed both
+	by the client thread and the DFC thread.  Therefore no fast mutex can be held
+	when calling a request function.
+
+	@publishedPartner
+	@released
+ */
+class DDmaRequest : public DBase
+	{
+	friend class TDmaChannel;
+public:
+	/** The outcome of the transfer */
+	enum TResult {EBadResult=0, EOk, EError};
+	/** The signature of the completion/failure callback function */
+	typedef void (*TCallback)(TResult, TAny*);
+public:
+   
+    /**
+    Create a new transfer request. 
+
+    @param aChannel The channel this request is bound to.
+    @param aCb      Callback function called on transfer completion or failure (in channel
+                    DFC context).  Can be NULL.
+    @param aCbArg   Argument passed to callback function.
+    @param aMaxTransferSize Maximum fragment size.  If not specified, defaults to the maximum size
+           supported by the DMA controller for the type of transfer that is later scheduled.
+    */
+	IMPORT_C DDmaRequest(TDmaChannel& aChannel, TCallback aCb=NULL, TAny* aCbArg=NULL, TInt aMaxTransferSize=0);
+	
+	
+	/**
+    Destructor.
+
+    Assume the request is not being transferred or pending.
+    */
+	IMPORT_C ~DDmaRequest();
+	
+	
+	/**
+    Split request into a list of fragments small enough to be fed to the DMAC.
+
+    The size of each fragment is smaller than or equal to the maximum transfer size
+    supported by the DMAC.  If the source and/or destination is memory, each
+    fragment points to memory which is physically contiguous.
+
+    The kind of transfer to perform is specified via a set of flags used by a PIL
+    and a magic cookie passed to the PSL.  If the source (resp. destination) is a
+    peripheral, aSrc (resp. aDest) is treated as a magic cookie by the PIL and
+    passed straight to the PSL.
+
+    The request can be uninitialised or may have been fragmented previously.  The
+    previous configuration if any is lost whether or not the function succeeds.
+
+    @param aSrc     Source memory buffer linear address or peripheral magic cookie.
+    @param aDest    Destination memory buffer linear address or peripheral magic cookie.
+    @param aCount   Number of bytes to transfer.
+    @param aFlags   Bitmask characterising the transfer.
+    @param aPslInfo Hardware-specific information passed to PSL.
+
+    @return KErrNone if success. KErrArgument if aFlags and/or aPslInfo are invalid when finding
+    the maximum transfer size. May also fail if running out of descriptors.
+
+    @pre The request is not being transferred or pending.
+    @pre The various parameters must be valid.  The PIL or PSL will fault the
+    kernel if not.
+
+    @see TDmaRequestFlags
+    */
+	IMPORT_C TInt Fragment(TUint32 aSrc, TUint32 aDest, TInt aCount, TUint aFlags, TUint32 aPslInfo);
+	
+	
+	/**
+    Transfer asynchronously this request.
+
+    If this request's channel is idle, the request is transferred immediately.
+    Otherwise, it is queued and transferred later.
+
+    The client is responsible for ensuring cache consistency before and/or after the
+    transfer if necessary.
+    */
+	IMPORT_C void Queue();
+	
+
+    /**
+    Append new descriptor(s) to existing list.
+
+    Clients needing to build a custom descriptor list should call this function to
+    allocate the list and access the resulting list through iFirstHdr and iLastHdr.
+
+    Clients should not change the value of iFirstHdr, iLastHdr and the iNext field
+    of the descriptor headers to ensure descriptors can be deallocated. Clients
+    are free to change hardware descriptors, including chaining, in whatever way
+    suit them.
+
+    Assume the request is not being transferred or pending.
+
+    @param aCount Number of descriptors to append.
+
+    @return KErrNone or KErrTooBig if not enough descriptors available.
+    */
+	IMPORT_C TInt ExpandDesList(TInt aCount=1);
+	
+	
+	/**
+    Free resources associated with this request.
+
+    Assume the request is not being transferred or pending.
+    */
+	IMPORT_C void FreeDesList();
+private:
+	inline void OnDeque();
+public:
+	// WARNING: The following attributes are accessed both in client and DFC
+	// context and so accesses must be protected with the channel lock.
+	TDmaChannel& iChannel;		/**< The channel this request is bound to */
+	volatile TCallback iCb;		/**< Called on completion/failure (can be NULL) */
+	TAny* volatile iCbArg;		/**< Callback argument */
+	TInt iDesCount;				/**< The number of fragments in list */
+	SDmaDesHdr* iFirstHdr;		/**< The first fragment in the list (or NULL) */
+	SDmaDesHdr* iLastHdr;		/**< The last fragment in the list (or NULL) */
+	SDblQueLink iLink;			/**< The link on channel queue of pending requests */
+	TBool iQueued;				/**< Indicates whether request is pending or being transferred */
+	TInt iMaxTransferSize;		/**< Defaults to DMA controller max. transfer size */
+	__DMA_DECLARE_INVARIANT
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class TDmac;
+class DmaChannelMgr;
+
+/** DMA channel base class.
+
+	This class has not been designed to be called from several concurrent
+	client threads.  Multithreaded clients must implement their own locking
+	scheme (via DMutex).
+
+	Fast mutexes are used internally to protect data structures accessed both
+	by the client thread and the DFC one.  Therefore no fast mutex can be held
+	when calling a channel function.
+
+	Must be allocated in BSS because it relies on being zeroed at
+	creation-time.  If the PSL really needs to allocate channels on the kernel
+	heap, it must manually zero-initialises the instances.  This can be
+	achieved either by allocating raw memory and using placement new, or by
+	wrapping channels into a DBase-derived wrapper.
+
+	@publishedPartner
+	@released
+ */
+class TDmaCancelInfo;
+class TDmaChannel
+	{
+	friend class DDmaRequest;
+	friend class TDmac;
+	friend class DmaChannelMgr;
+public:
+	/**  Information passed by client when opening channel */
+	struct SCreateInfo
+		{
+		/** Identifier used by PSL to select channel to open */
+		TUint32 iCookie;
+		/** Number of descriptors this channel can use */
+		TInt iDesCount;
+		/** DFC queue used to service DMA interrupts.  The DFC thread
+			priority must be higher than any client thread priority to
+			avoid a situation where a transfer completes while being
+			cancelled and another transfer is started before the DFC
+			thread gets a chance to run.  This would lead to a stray
+			DFC.
+		*/
+		TDfcQue* iDfcQ;
+		/** DFC priority */
+		TUint8 iDfcPriority;
+		};
+public:
+    /**
+ 	Opens the DMA channel.
+
+ 	Channel selection is done by the hardware-specific layer using a cookie passed in
+ 	via aInfo.
+
+ 	The client should not delete the returned pointer as the framework owns
+ 	channel objects.  However, the client should explicitly close the channel when
+ 	finished with it.
+
+	@param aInfo    Information passed by caller to select and configure channel.
+ 	@param aChannel Point to open channel on successful return.  NULL otherwise.
+
+ 	@return KErrNone or standard error code.
+ 	*/
+	IMPORT_C static TInt Open(const SCreateInfo& aInfo, TDmaChannel*& aChannel);
+	
+	
+	/**
+ 	Closes a previously opened DMA channel.
+
+ 	Assume the channel is idle and all requests have been deleted.
+ 	*/
+	IMPORT_C void Close();
+	
+	
+	/**
+ 	Cancels the current request and all the pending ones.
+ 	*/
+	IMPORT_C void CancelAll();
+	inline TBool IsOpened() const;
+	inline TBool IsQueueEmpty() const;
+	inline TUint32 PslId() const;
+	inline TInt FailNext(TInt aFragmentCount);
+	inline TInt MissNextInterrupts(TInt aInterruptCount);
+	inline TInt Extension(TInt aCmd, TAny* aArg);
+	
+	/**
+	This is a function that allows the Platform Specific Layer (PSL) to extend the DMA API
+	with new channel-independent operations.
+
+	@param aCmd Command identifier.  Negative values are reserved for Symbian use.
+	@param aArg PSL-specific.
+	
+	@return KErrNotSupported if aCmd is not supported; a  PSL specific value otherwise.
+ 	*/
+	IMPORT_C TInt StaticExtension(TInt aCmd, TAny* aArg);
+	inline const TDmac* Controller() const;
+	inline TInt MaxTransferSize(TUint aFlags, TUint32 aPslInfo);
+	inline TUint MemAlignMask(TUint aFlags, TUint32 aPslInfo);
+protected:
+	// Interface with state machines
+	TDmaChannel();
+	virtual void DoQueue(DDmaRequest& aReq) = 0;
+	virtual void DoCancelAll() = 0;
+	virtual void DoUnlink(SDmaDesHdr& aHdr);
+	virtual void DoDfc(DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr) = 0;
+	/**
+	   This function allows the Platform Specific Layer (PSL) to control the
+	   power management of the channel or its controller by overriding the
+	   PIL's default implementation (which does nothing) and making appropriate
+	   use of the Power Resource Manager (PRM).
+
+	   The function gets called by the PIL whenever the channel's queued
+	   requests count has changed in a significant way, either before the
+	   channel's Transfer() method is invoked for a request on a previously
+	   empty request queue, or immediately after the request count has become
+	   zero because of request cancellation or completion.
+
+	   Depending on the current value of iQueuedRequests, the PSL may power
+	   down or power up the channel. Note that iQueuedRequests gets accessed
+	   and changed by different threads, so the PSL needs to take the usual
+	   precautions when evaluating the variable's value.
+
+	   None of the internal DMA framework mutexes is being held by the PIL when
+	   calling this function.
+
+	   @see iQueuedRequests
+	 */
+	virtual void QueuedRequestCountChanged();
+#if defined(__CPU_ARM) && !defined(__EABI__)
+	inline virtual ~TDmaChannel() {}	// kill really annoying warning
+#endif
+private:
+	static void Dfc(TAny*);
+	void DoDfc();
+	inline void Wait();
+	inline void Signal();
+	inline TBool Flash();
+	void ResetStateMachine();
+protected:
+	TDmac* iController;										// DMAC this channel belongs to (NULL when closed)
+	TUint32 iPslId;											// unique identifier provided by PSL
+	NFastMutex iLock;										// for data accessed in both client & DFC context
+	SDmaDesHdr* iCurHdr;									// fragment being transferred or NULL
+	SDmaDesHdr** iNullPtr;									// Pointer to NULL pointer following last fragment
+	TDfc iDfc;												// transfer completion/failure DFC
+	TInt iMaxDesCount;										// maximum number of allocable descriptors
+	TInt iAvailDesCount;									// available number of descriptors
+	volatile TUint32 iIsrDfc;								// Interface between ISR and DFC:
+	enum { KErrorFlagMask = 0x80000000 };					// bit 31 - error flag
+	enum { KCancelFlagMask = 0x40000000 };					// bit 30 - cancel flag
+	enum { KDfcCountMask = 0x3FFFFFFF };					// bits 0-29 - number of queued DFCs
+	SDblQue iReqQ;											// being/about to be transferred request queue
+	TInt iReqCount;											// number of requests attached to this channel
+	TInt iQueuedRequests; 									// number of requests currently queued on this channel
+private:
+	TDmaCancelInfo* iCancelInfo;
+	__DMA_DECLARE_INVARIANT
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// PIL-PSL INTERFACE
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+Generic DMA descriptor used if the DMAC does not have support for hardware
+descriptor.
+@see DDmaRequest::Fragment
+@publishedPartner
+@released
+*/
+
+struct SDmaPseudoDes
+	{
+	/** Source linear address or peripheral cookie */
+	TUint32 iSrc;
+	/** Destination linear address or peripheral cookie */
+	TUint32 iDest;
+	/** Number of bytes to transfer */
+	TInt iCount;
+	/** @see TDmaRequestFlags */
+	TUint iFlags;
+	/** PSL-specific information provided by client */
+	TUint32 iPslInfo;
+	/** The same as TDmaChannel::SCreateInfo.iCookie */
+	TUint32 iCookie;
+	};
+
+
+/**
+Each hardware or pseudo descriptor is associated with a header.  Headers are
+needed because hardware descriptors can not easily be extended to store
+additional information.
+@publishedPartner
+@released
+*/
+
+struct SDmaDesHdr
+	{
+	SDmaDesHdr* iNext;
+	};
+
+
+/**
+Interface used by PIL to open and close DMA channels.
+
+Must be implemented by PSL.
+@publishedPartner
+@released
+*/
+
+class DmaChannelMgr
+	{
+public:
+	/** Opens a channel using a client-provided identifier.
+		This function must be implemented by the PSL.
+		@param	aOpenId Magic cookie passed by client
+				This may identify the channel (if a static channel
+				allocation scheme is used) or may indicate some
+				properties which the channel must possess (if a dynamic
+				channel allocation scheme is used). It may be set to
+				zero always if dynamic allocation is used and all
+				channels are equivalent.
+		@return	Pointer to channel if available, NULL otherwise.
+		@pre	The PIL calls this function with a global fast mutex held to
+				avoid race conditions.
+		@post	If a non-NULL pointer is returned, the object pointed to has its
+				iController and iPslId members set to valid states.
+				iController should point to the controller handling that channel.
+				iPslId should contain a value uniquely identifying the channel -
+				it is used only for debug tracing by PIL. It can be given any
+				convenient value by PSL	(channel index, I/O port address, ...).
+	*/
+	static TDmaChannel* Open(TUint32 aOpenId);
+
+	/** Performs platform-specific operations when a channel is closed.
+		This function must be implemented by the PSL but the implementation can be
+		a no-op.
+		@param aChannel The channel to close
+		@pre The PIL calls this function with a global fast mutex held to
+			avoid race conditions.
+	*/
+	static void Close(TDmaChannel* aChannel);
+
+	/** Function allowing PSL to extend DMA API with new channel-independent operations.
+		This function must be implemented by the PSL.
+		@param aCmd Command identifier.  Negative values are reserved for Symbian use.
+		@param aArg PSL-specific
+		@return KErrNotSupported if aCmd is not supported.  PSL-specific value otherwise.
+	 */
+	static TInt StaticExtension(TInt aCmd, TAny* aArg);
+
+	static inline void Wait();
+	static inline void Signal();
+private:
+	static NFastMutex Lock;
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+ Abstract base class representing a DMA controller.
+
+ The class has two purposes.
+
+ First, it is a container for channels, descriptors and descriptor headers.
+
+ Second, it exposes a set of virtual functions implemented by
+ the PSL (platform-specific layer).
+ These functions are the main interfaces between
+ the PIL (platform-independent layer) and PSL.
+
+ Must be allocated in BSS because it relies on being zeroed at creation-time.
+
+ @publishedPartner
+ @released
+ */
+
+class TDmac
+	{
+	friend class DmaChannelMgr;
+// protected: VC++ complains when building PSL if following decl is protected
+public:
+	/** Data required for creating a new instance */
+	struct SCreateInfo
+		{
+		/** Number of channels in controller */
+		TInt iChannelCount;
+        /** Maximum number of descriptors (shared by all channels) */
+		TInt iDesCount;
+		/** Bitmask.  The only supported value is KCapsBitHwDes (hardware
+			descriptors used). */
+		TUint32 iCaps;
+		/** Size of individual descriptors.  Use sizeof(SDmaPseudoDes) for
+		 	single-buffer and double-buffer controllers. */
+		TInt iDesSize;
+		/** Bitmask used when creating the hardware chunk storing the descriptor
+			pool. Used only for hardware descriptors. The access part must be
+			EMapAttrSupRw.  If the chunk is cached and/or buffered, the PSL must
+			flush the data cache and/or drain the write buffer in InitHwDes()
+			and related functions.
+		 	@see TMappingAttributes
+		 */
+		TUint iDesChunkAttribs;
+		};
+public:
+	TInt Create(const SCreateInfo& aInfo);
+	virtual ~TDmac();
+	TInt ReserveSetOfDes(TInt aCount);
+	void ReleaseSetOfDes(TInt aCount);
+	void InitDes(const SDmaDesHdr& aHdr, TUint32 aSrc, TUint32 aDest, TInt aCount,
+				 TUint aFlags, TUint32 aPslInfo, TUint32 aCookie);
+	inline SDmaPseudoDes& HdrToDes(const SDmaDesHdr& aHdr) const;
+	inline TAny* HdrToHwDes(const SDmaDesHdr& aHdr) const;
+	inline TUint32 DesLinToPhys(TAny* aDes) const;
+	inline void Wait();
+	inline void Signal();
+protected:
+	TDmac(const SCreateInfo& aInfo);
+
+public:
+	/**
+	Called by PIL when one fragment (single-buffer and double-buffer DMACs) or
+	list of fragments (scatter/gather DMAC) is to be transferred.
+
+	Called when	initiating a new transfer and also, for double-buffer DMACs, for
+	configuring the next fragment to transfer while the current one is
+	ongoing. Must always be implemented by PSL.
+	@param aChannel The channel to use
+	@param aHdr Header associated with fragment to transfer
+	*/
+	virtual void Transfer(const TDmaChannel& aChannel, const SDmaDesHdr& aHdr) = 0;
+
+	/**
+    Called by PIL to suspend transfer on a given channel.
+
+    The suspension must occur synchronously as the PSL assumes the channel
+    is suspended after calling this function. Must always be implemented by PSL.
+	@param aChannel The channel to suspend
+	*/
+	virtual void StopTransfer(const TDmaChannel& aChannel) = 0;
+
+	/**
+	Called by PIL to check whether a DMA channel is idle.
+	@param aChannel The channel to test
+	@return ETrue if channel idle, EFalse if transferring.
+	 */
+	virtual TBool IsIdle(const TDmaChannel& aChannel) = 0;
+
+	/**
+	Called by PIL to retrieve from the PSL the maximum transfer size based on the
+	parameters passed.
+	@param aChannel Channel to be used for the transfer
+	@param aFlags Bitmask characterising transfer
+	@param aPslInfo Cookie passed by client and used by PSL
+	@return 0 if invalid argument(s), -1 if transfer size not limited, the maximum
+	transfer size otherwise.
+	*/
+	virtual TInt MaxTransferSize(TDmaChannel& aChannel, TUint aFlags, TUint32 aPslInfo) = 0;
+
+	/**
+	Called by PIL to retrieve from the PSL the memory alignment mask based on the
+	parameters passed. Some DMA controllers impose alignment constraints on the base
+	address of memory buffers. This mask is AND'ed against memory addresses computed
+	during fragmentation.
+	@param aChannel Channel to be used for the transfer
+	@param aFlags Bitmask characterising transfer
+	@param aPslInfo Cookie passed by client and used by PSL
+	@return A value representing the alignment mask (e.g. 3 if buffer must be 4-byte aligned)
+	*/
+	virtual TUint MemAlignMask(TDmaChannel& aChannel, TUint aFlags, TUint32 aPslInfo) = 0;
+
+	/**
+    Called by PIL during fragmentation to initialise a hardware descriptor.
+
+    The PSL must assume the descriptor is the last in the chain and so set the
+	interrupt bit and set the next descriptor field to an end of chain marker.
+	Must be implemented by PSL if and only if the DMAC supports hardware
+	descriptors.
+	@param aHdr Header associated with hardware descriptor to initialise
+	@param aSrc Transfer source
+	@param aDest Transfer destination
+	@param aCount Number of bytes to transfer (<= max. size supported by DMAC)
+	@param aFlags Bitmask characterising transfer
+	@param aPslInfo Cookie passed by client and used by PSL
+	@param aCookie the channel selection cookie
+	@see DDmaRequest::Fragment
+	*/
+	virtual void InitHwDes(const SDmaDesHdr& aHdr, TUint32 aSrc, TUint32 aDest, TInt aCount,
+						   TUint aFlags, TUint32 aPslInfo, TUint32 aCookie);
+
+	/**
+	Called by PIL, when fragmenting a request, to append a new hardware
+	descriptor to an existing descriptor chain.
+
+	Must clear the interrupt bit of	the descriptor associated with aHdr.
+	Must be implemented by PSL if and only if the DMAC supports hardware descriptors.
+	@param aHdr Header associated with last fragment in chain
+	@param aNextHdr Header associated with fragment to append
+	*/
+	virtual void ChainHwDes(const SDmaDesHdr& aHdr, const SDmaDesHdr& aNextHdr);
+
+	/**
+	Called by PIL when queuing a new request while the channel is running.
+
+	Must append the first hardware descriptor of the new request to the last
+	descriptor in the existing chain. Must be implemented by PSL if and only if
+	the DMAC supports hardware descriptors.
+	@param aChannel The channel where the transfer takes place
+	@param aLastHdr Header associated with last hardware descriptor in chain
+	@param aNewHdr Header associated with first hardware descriptor in new request
+	*/
+	virtual void AppendHwDes(const TDmaChannel& aChannel, const SDmaDesHdr& aLastHdr,
+							 const SDmaDesHdr& aNewHdr);
+
+	/**
+	Called by PIL when completing or cancelling a request to cause the PSL to unlink
+	the last item in the h/w descriptor chain from a subsequent chain that it was
+	possibly linked to. Must be implemented by the PSL if and only if the DMAC supports
+	hardware descriptors.
+
+	@param aChannel The channel where the request (and thus the descriptor) was queued
+	@param aHdr Header associated with last h/w descriptor in completed/cancelled chain
+	*/
+	virtual void UnlinkHwDes(const TDmaChannel& aChannel, SDmaDesHdr& aHdr);
+
+	/**
+	Called by test harness to force an error when the next fragment is
+	transferred.
+
+	Must be implemented by the PSL only if possible.
+	@param aChannel The channel where the error is to occur.
+	@return KErrNone if implemented.  The default PIL implementation returns
+	KErrNotSupported and the test harness knows how to deal with that.
+	*/
+	virtual TInt FailNext(const TDmaChannel& aChannel);
+
+	/**
+	Called by test harness to force the DMA controller to miss one or
+	more interrupts.
+
+	Must be implemented by the PSL only if possible.
+	@param aChannel The channel where the error is to occur
+	@param aInterruptCount The number of interrupt to miss.
+	@return KErrNone if implemented.  The default PIL implementation returns
+	KErrNotSupported and the test harness knows how to deal with that.
+	*/
+	virtual TInt MissNextInterrupts(const TDmaChannel& aChannel, TInt aInterruptCount);
+
+	/** Function allowing platform-specific layer to extend channel API with
+		new channel-specific operations.
+		@param aChannel Channel to operate on
+		@param aCmd Command identifier.  Negative values are reserved for Symbian use.
+		@param aArg PSL-specific
+		@return KErrNotSupported if aCmd is not supported.  PSL-specific value otherwise.
+		@see TDmaChannel::Extension
+	*/
+	virtual TInt Extension(TDmaChannel& aChannel, TInt aCmd, TAny* aArg);
+
+protected:
+	static void HandleIsr(TDmaChannel& aChannel, TBool aIsComplete);
+private:
+	TInt AllocDesPool(TUint aAttribs);
+	void FreeDesPool();
+private:
+	NFastMutex iLock;			 // protect descriptor reservation and allocation
+	const TInt iMaxDesCount;	 // initial number of descriptors and headers
+	TInt iAvailDesCount;		 // current available number of descriptors and headers
+	SDmaDesHdr* iHdrPool;		 // descriptor header dynamic array
+#ifndef __WINS__
+	DPlatChunkHw* iHwDesChunk;	 // chunk for hardware descriptor pool
+#endif
+	TAny* iDesPool;				 // hardware or pseudo descriptor dynamic array
+	const TInt iDesSize;		 // descriptor size in bytes
+public:
+	const TUint iCaps;  		 /*< what is supported by DMA controller */
+	enum {KCapsBitHwDes = 1};	 /*< hardware descriptors supported */
+	SDmaDesHdr* iFreeHdr;		 /*< head of unallocated descriptors linked list */
+#ifdef _DEBUG
+	TBool IsValidHdr(const SDmaDesHdr* aHdr);
+#endif
+	__DMA_DECLARE_INVARIANT
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+Single-buffer DMA channel.
+
+Can be instantiated or further derived by PSL.  Not
+intended to be instantiated by client device drivers.
+@publishedPartner
+@released
+*/
+
+class TDmaSbChannel : public TDmaChannel
+	{
+private:
+	virtual void DoQueue(DDmaRequest& aReq);
+	virtual void DoCancelAll();
+	virtual void DoDfc(DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
+private:
+	TBool iTransferring;
+	};
+
+
+/**
+Double-buffer DMA channel.
+
+Can be instantiated or further derived by PSL.  Not
+intended to be instantiated by client device drivers.
+@publishedPartner
+@released
+*/
+
+class TDmaDbChannel : public TDmaChannel
+	{
+private:
+	virtual void DoQueue(DDmaRequest& aReq);
+	virtual void DoCancelAll();
+	virtual void DoDfc(DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
+private:
+	enum { EIdle = 0, ETransferring, ETransferringLast } iState;
+	};
+
+
+/**
+Scatter-gather DMA channel.
+
+Can be instantiated or further derived by PSL.
+Not intended to be instantiated by client device drivers.
+@publishedPartner
+@released
+*/
+
+class TDmaSgChannel : public TDmaChannel
+	{
+private:
+	virtual void DoQueue(DDmaRequest& aReq);
+	virtual void DoCancelAll();
+	virtual void DoUnlink(SDmaDesHdr& aHdr);
+	virtual void DoDfc(DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
+private:
+	TBool iTransferring;
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// INTERFACE WITH TEST HARNESS
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+Set of information used by test harness.
+@publishedPartner
+@released
+*/
+
+struct TDmaTestInfo
+	{
+	/** Maximum transfer size in bytes for all channels (ie. the minimum of all channels' maximum size)*/
+	TInt iMaxTransferSize;
+	/** 3->Memory buffers must be 4-byte aligned, 7->8-byte aligned, ... */
+	TUint iMemAlignMask;
+	/** Cookie to pass to DDmaRequest::Fragment for memory-memory transfer*/
+	TUint32 iMemMemPslInfo;
+	/** Number of test single-buffer channels */
+	TInt iMaxSbChannels;
+	/** Pointer to array containing single-buffer test channel ids */
+	TUint32* iSbChannels;
+	/** Number of test double-buffer channels */
+	TInt iMaxDbChannels;
+	/** Pointer to array containing double-buffer test channel ids */
+	TUint32* iDbChannels;
+	/** Number of test scatter-gather channels */
+	TInt iMaxSgChannels;
+	/** Pointer to array containing scatter-gather test channel ids */
+	TUint32* iSgChannels;
+	};
+
+
+/**
+Provides access to test information structure stored in the PSL.
+
+Must be implemented by the PSL.
+@publishedPartner
+@released
+*/
+
+IMPORT_C const TDmaTestInfo& DmaTestInfo();
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+#include <drivers/dma_v1.inl>
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/drivers/dma_v1.inl	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,147 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0""
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// include/drivers/dma_v1.inl
+// DMA framework public inline functions
+// This file should not be modified when porting the DMA framework to
+// new hardware.
+// TDmaChannel
+// 
+// WARNING: This file contains some APIs which are internal and are subject
+//          to change without noticed. Such APIs should therefore not be used
+//          outside the Kernel and Hardware Services package.
+//
+
+inline void TDmaChannel::Wait()
+	{
+	NKern::FMWait(&iLock);
+	}
+
+inline void TDmaChannel::Signal()
+	{
+	NKern::FMSignal(&iLock);
+	}
+
+inline TBool TDmaChannel::Flash()
+	{
+	return NKern::FMFlash(&iLock);
+	}
+
+inline TBool TDmaChannel::IsOpened() const
+	{
+	return iController != NULL;
+	}
+
+inline TBool TDmaChannel::IsQueueEmpty() const
+	{
+	return const_cast<TDmaChannel*>(this)->iReqQ.IsEmpty();
+	}
+
+inline TUint32 TDmaChannel::PslId() const
+	{
+	return iPslId;
+	}
+
+inline TInt TDmaChannel::FailNext(TInt /*aFragmentCount*/)
+	{
+	return iController->FailNext(*this);
+	}
+
+inline TInt TDmaChannel::MissNextInterrupts(TInt aInterruptCount)
+	{
+	return iController->MissNextInterrupts(*this, aInterruptCount);
+	}
+
+/** Function allowing platform-specific layer to extend API with new
+	channel-specific operations.
+ 	@param aCmd Command identifier.  Negative values are reserved for Symbian use.
+	@param aArg PSL-specific
+	@return KErrNotSupported if aCmd is not supported.  PSL-specific value otherwise.
+ */
+
+inline TInt TDmaChannel::Extension(TInt aCmd, TAny* aArg)
+	{
+	return iController->Extension(*this, aCmd, aArg);
+	}
+
+inline const TDmac* TDmaChannel::Controller() const
+	{
+	return iController;
+	}
+
+inline TInt TDmaChannel::MaxTransferSize(TUint aFlags, TUint32 aPslInfo)
+	{
+	return iController->MaxTransferSize(*this, aFlags, aPslInfo);
+	}
+
+inline TUint TDmaChannel::MemAlignMask(TUint aFlags, TUint32 aPslInfo)
+	{
+	return iController->MemAlignMask(*this, aFlags, aPslInfo);
+	}
+
+// DDmaRequest
+
+/** Called when request is removed from request queue in channel */
+
+inline void DDmaRequest::OnDeque()
+	{
+	iQueued = EFalse;
+	iLastHdr->iNext = NULL;
+	iChannel.DoUnlink(*iLastHdr);
+	}
+
+// TDmac
+
+inline void TDmac::Wait()
+	{
+	NKern::FMWait(&iLock);
+	}
+
+inline void TDmac::Signal()
+	{
+	NKern::FMSignal(&iLock);
+	}
+
+inline SDmaPseudoDes& TDmac::HdrToDes(const SDmaDesHdr& aHdr) const
+	{
+	return static_cast<SDmaPseudoDes*>(iDesPool)[&aHdr - iHdrPool];
+	}
+
+inline TAny* TDmac::HdrToHwDes(const SDmaDesHdr& aHdr) const
+	{
+	return static_cast<TUint8*>(iDesPool) + iDesSize*(&aHdr - iHdrPool);
+	}
+
+inline TUint32 TDmac::DesLinToPhys(TAny* aDes) const
+	{
+#ifdef __WINS__
+	(void)aDes;
+	return 0xDEADBEEF;
+#else
+	return iHwDesChunk->iPhysAddr + ((TLinAddr)aDes - iHwDesChunk->iLinAddr);
+#endif
+	}
+
+// DmaChannelMgr
+
+inline void DmaChannelMgr::Wait()
+	{
+	NKern::FMWait(&Lock);
+	}
+
+inline void DmaChannelMgr::Signal()
+	{
+	NKern::FMSignal(&Lock);
+	}
+
+//---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/drivers/dma_v2.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,1135 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0""
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// include/drivers/dma_v2.h
+// DMA Framework - Client API v2 definition.
+//
+// NB: DMA clients should never include this file directly, but only ever the
+// generic header file <drivers/dma.h>.
+//
+
+#ifndef __DMA_H__
+#error "dma_v2.h must'n be included directly - use <drivers/dma.h> instead"
+#endif	// #ifndef __DMA_H__
+
+#ifndef __DMA_V2_H__
+#define __DMA_V2_H__
+
+
+#include <kernel/kernel.h>
+#include <drivers/dmadefs.h>
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Debug Support - KDmaPanicCat is defined in each source file
+
+#define __DMA_ASSERTD(e) __ASSERT_DEBUG(e, Kern::Fault(KDmaPanicCat, __LINE__))
+#define __DMA_ASSERTA(e) __ASSERT_ALWAYS(e, Kern::Fault(KDmaPanicCat, __LINE__))
+#ifdef _DEBUG
+#define __DMA_CANT_HAPPEN() Kern::Fault(KDmaPanicCat, __LINE__)
+#define __DMA_DECLARE_INVARIANT public: void Invariant();
+#define __DMA_INVARIANT() Invariant()
+#else
+#define __DMA_CANT_HAPPEN()
+#define __DMA_DECLARE_INVARIANT
+#define __DMA_INVARIANT()
+#endif
+
+
+//////////////////////////////////////////////////////////////////////////////
+// INTERFACE EXPOSED TO DEVICE-DRIVERS
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** Bitmasks used for configuring a DMA request.
+
+	In general, specify KDmaMemSrc|KDmaIncSrc (resp. KDmaMemDest|KDmaIncDest)
+	if the source (resp. destination) is a memory buffer and clear
+	KDmaMemSrc|KDmaIncSrc (resp. KDmaMemDest|KDmaIncDest) if the source
+	(resp. destination) is a peripheral.
+
+	If the location is given as a physical address (rather than a linear one)
+	then also specify KDmaPhysAddrSrc and/or KDmaPhysAddrDest.
+
+	The EKA1 "Fill Mode" can be implemented by omitting KDmaIncSrc.
+
+	Some peripherals may require a post-increment address mode.
+
+	@see DDmaRequest::Fragment
+	@publishedPartner
+	@released
+*/
+enum TDmaRequestFlags
+	{
+	// Note: This enum is only required for backwards compatibility with the
+	// old DMA framework, it can be removed once this is no longer needed.
+
+	/** Source is address of memory buffer */
+	KDmaMemSrc       = 0x01,
+	/** Destination is address of memory buffer */
+	KDmaMemDest      = 0x02,
+	/** Source address must be post-incremented during transfer */
+	KDmaIncSrc       = 0x04,
+	/** Destination address must be post-incremented during transfer */
+	KDmaIncDest      = 0x08,
+	/** Source address is a physical address (as opposed to a linear one) */
+	KDmaPhysAddrSrc  = 0x10,
+	/** Destination address is a physical address (as opposed to a linear one) */
+	KDmaPhysAddrDest = 0x20,
+	/** Request a different max transfer size (for instance for test purposes) */
+	KDmaAltTransferLen = 0x40
+	};
+
+
+/** Each hardware or pseudo descriptor is associated with a header.  Headers
+	are needed because hardware descriptors can not easily be extended to store
+	additional information.
+
+	@publishedPartner
+	@released
+*/
+struct SDmaDesHdr
+	{
+	SDmaDesHdr* iNext;
+	};
+
+/** Pointer to signature of the new extended callback function.
+
+	TUint - bitmask of one or more TDmaCallbackType values
+	TDmaResult - just that
+	TAny* - was provided by client in DDmaRequest constructor
+	SDmaDesHdr* - points to header (and thus descriptor) which caused a
+	'descriptor completed' or 'descriptor paused' event.
+ */
+typedef void (*TDmaCallback)(TUint, TDmaResult, TAny*, SDmaDesHdr*);
+
+class TDmaChannel;
+
+/** A DMA request is a list of fragments small enough to be transferred in one go
+	by the DMAC.
+
+	In general, fragmentation is done in the framework by calling Fragment() but
+	clients with special needs can allocate a blank descriptor list with
+	ExpandDesList() and customise it to fit their needs.
+
+	Clients should not set attributes directly, but should use the various functions
+	instead.
+
+	This class has not been designed to be called from several concurrent threads.
+	Multithreaded clients must implement their own locking scheme (via DMutex).
+
+	Mutexes are used internally to protect data structures accessed both by the
+	client thread and the DFC thread. Therefore no fast mutex can be held when
+	calling a request function.
+
+	@publishedPartner
+	@released
+ */
+class DDmaRequest : public DBase
+	{
+	friend class TDmaChannel;
+
+public:
+	/** The outcome of the transfer
+
+		@deprecated
+		@see TDmaResult
+	*/
+	enum TResult {EBadResult=0, EOk, EError};
+	/** The signature of the completion/failure callback function
+
+		@deprecated
+		@see TDmaCallback
+	*/
+	typedef void (*TCallback)(TResult, TAny*);
+
+public:
+    /** Constructor.
+
+		Create a new transfer request.
+
+		@param aChannel The channel this request is bound to.
+		@param aCb Callback function called on transfer completion or failure
+		(in channel DFC context).  Can be NULL.
+		@param aCbArg   Argument passed to callback function.
+		@param aMaxTransferSize Maximum fragment size.  If not specified, defaults to the maximum size
+		supported by the DMA controller for the type of transfer that is later scheduled.
+
+		@deprecated
+    */
+	IMPORT_C DDmaRequest(TDmaChannel& aChannel, TCallback aCb=NULL, TAny* aCbArg=NULL,
+						 TInt aMaxTransferSize=0);
+
+
+	/** Constructor.
+
+		Create a new transfer request.
+
+		@param aChannel The channel this request is bound to.
+		@param aDmaCb Callback function called on transfer completion or
+		failure (in channel DFC or ISR context). Can be NULL.
+		@param aCbArg Argument passed to callback function.
+		@param aMaxTransferSize Maximum fragment size. If not specified,
+		defaults to the maximum size supported by the DMA controller for the
+		type of transfer that is later scheduled.
+	*/
+	IMPORT_C DDmaRequest(TDmaChannel& aChannel, TDmaCallback aDmaCb, TAny* aCbArg=NULL,
+						 TUint aMaxTransferSize=0);
+
+
+	/** Destructor.
+
+		Assume the request is not being transferred or pending.
+    */
+	IMPORT_C ~DDmaRequest();
+
+
+	/** Split request into a list of fragments small enough to be fed to the
+		DMAC.
+
+		The size of each fragment is smaller than or equal to the maximum
+		transfer size supported by the DMAC. If the source and/or destination
+		is memory, each fragment points to memory which is physically
+		contiguous.
+
+		The kind of transfer to perform is specified via a set of flags used by
+		a PIL and a magic cookie passed to the PSL. If the source
+		(resp. destination) is a peripheral, aSrc (resp. aDest) is treated as a
+		magic cookie by the PIL and passed straight to the PSL.
+
+		The request can be uninitialised or may have been fragmented
+		previously. The previous configuration if any is lost whether or not
+		the function succeeds.
+
+		@param aSrc Source memory buffer linear address or peripheral magic
+		cookie.
+		@param aDest Destination memory buffer linear address or peripheral
+		magic cookie.
+		@param aCount Number of bytes to transfer.
+		@param aFlags Bitmask characterising the transfer.
+		@param aPslInfo Hardware-specific information passed to PSL.
+
+		@return KErrNone if success. KErrArgument if aFlags and/or aPslInfo are
+		invalid when finding the maximum transfer size. May also fail if
+		running out of descriptors.
+
+		@pre The request is not being transferred or pending.
+		@pre The various parameters must be valid. The PIL or PSL will fault the
+		kernel if not.
+
+		@see TDmaRequestFlags
+
+		@deprecated
+    */
+	IMPORT_C TInt Fragment(TUint32 aSrc, TUint32 aDest, TInt aCount, TUint aFlags, TUint32 aPslInfo);
+
+
+	/** New version of the DMA request fragment function, to be used with the
+		TDmaTransferArgs structure.
+	*/
+	IMPORT_C TInt Fragment(const TDmaTransferArgs& aTransferArgs);
+
+
+	/** Transfer asynchronously this request.
+
+		If this request's channel is idle, the request is transferred
+		immediately. Otherwise, it is queued and transferred later.
+
+		The client is responsible for ensuring cache consistency before and/or
+		after the transfer if necessary.
+
+		@return KErrNone if success, KErrGeneral otherwise.
+    */
+	IMPORT_C TInt Queue();
+
+
+    /** Append new descriptor(s) to existing list.
+
+		Clients needing to build a custom descriptor list should call this
+		function to allocate the list and access the resulting list through
+		iFirstHdr and iLastHdr.
+
+		Clients should not change the value of iFirstHdr, iLastHdr and the
+		iNext field of the descriptor headers to ensure descriptors can be
+		deallocated. Clients are free to change hardware descriptors, including
+		chaining, in whatever way suit them.
+
+		Assume the request is not being transferred or pending.
+
+		@param aCount Number of descriptors to append.
+
+		@return KErrNone or standard error code.
+    */
+	IMPORT_C TInt ExpandDesList(TInt aCount=1);
+
+
+    /** Append new descriptor(s) to existing list. This function variant
+		operates on the source port descriptor chain.
+
+		Works like ExpandDesList except that it uses the iSrcFirstHdr and
+		iSrcLastHdr fields.
+
+		@see ExpandDesList
+
+		This function can only be used if SDmacCaps::iAsymHwDescriptors is
+		true, otherwise it will just return KErrGeneral.
+
+		@param aCount Number of descriptors to append.
+
+		@return KErrNone or standard error code.
+    */
+	IMPORT_C TInt ExpandSrcDesList(TInt aCount=1);
+
+
+    /** Append new descriptor(s) to existing list. This function variant
+		operates on the destination port descriptor chain.
+
+		Works like ExpandDesList except that it uses the iDstFirstHdr and
+		iDstLastHdr fields.
+
+		@see ExpandDesList
+
+		This function can only be used if SDmacCaps::iAsymHwDescriptors is
+		true, otherwise it will just return KErrGeneral.
+
+		@param aCount Number of descriptors to append.
+
+		@return KErrNone or standard error code.
+    */
+	IMPORT_C TInt ExpandDstDesList(TInt aCount=1);
+
+
+	/** Free resources associated with this request.
+
+		Assume the request is not being transferred or pending.
+    */
+	IMPORT_C void FreeDesList();
+
+
+	/** Free resources associated with this request. This function variant
+		operates on the source port descriptor chain.
+
+		@see FreeDesList
+
+		This function can only be used if SDmacCaps::iAsymHwDescriptors is
+		true, otherwise it will do nothing.
+    */
+	IMPORT_C void FreeSrcDesList();
+
+
+	/** Free resources associated with this request. This function variant
+		operates on the destination port descriptor chain.
+
+		@see FreeDesList
+
+		This function can only be used if SDmacCaps::iAsymHwDescriptors is
+		true, otherwise it will do nothing.
+    */
+	IMPORT_C void FreeDstDesList();
+
+
+	/** Enables the functionality for counting the transferred source
+		elements.
+
+		This function can be called at any time, but the enabled/disabled
+		status is checked by the framework only at two points in time.
+
+		The first one is after a request has been queued, and if it is enabled
+		then the counting will commence as soon as the transfer starts.
+
+		The second point is when Resume() is called for a paused transfer, and
+		in this case the following applies. If counting was enabled when the
+		transfer was paused and it is now disabled then the counting is stopped
+		at that point and the count value frozen. If counting was disabled when
+		the transfer was paused and it is now enabled then the counting will
+		commence when the transfer resumes. (The starting value will depend on
+		the argument of the enable function.) Otherwise nothing will change,
+		i.e. counting will either continue normally (enabled/enabled) or
+		neither stop nor continue (disabled/disabled).
+
+		Once a status has been set, it remains valid for the entire duration of
+		the transfer (and beyond, if it is not changed again).
+
+		@param aResetElementCount If ETrue (the default) then the count
+		variable will be reset to zero, otherwise it will retain its current
+		value.
+
+		@see Queue()
+		@see TotalNumSrcElementsTransferred()
+	*/
+	IMPORT_C void EnableSrcElementCounting(TBool aResetElementCount=ETrue);
+
+
+	/** Enables the functionality for counting the transferred destination
+		elements.
+
+		This function can be called at any time, but the enabled/disabled
+		status is checked by the framework only at two points in time.
+
+		The first one is after a request has been queued, and if it is enabled
+		then the counting will commence as soon as the transfer starts.
+
+		The second point is when Resume() is called for a paused transfer, and
+		in this case the following applies. If counting was enabled when the
+		transfer was paused and it is now disabled then the counting is stopped
+		at that point and the count value frozen. If counting was disabled when
+		the transfer was paused and it is now enabled then the counting will
+		commence when the transfer resumes. (The starting value will depend on
+		the argument of the enable function.) Otherwise nothing will change,
+		i.e. counting will either continue normally (enabled/enabled) or
+		neither stop nor continue (disabled/disabled).
+
+		Once a status has been set, it remains valid for the entire duration of
+		the transfer (and beyond, if it is not changed again).
+
+		@param aResetElementCount If ETrue (the default) then the count
+		variable will be reset to zero, otherwise it will retain its current
+		value.
+
+		@see Queue()
+		@see TotalNumDstElementsTransferred()
+	*/
+	IMPORT_C void EnableDstElementCounting(TBool aResetElementCount=ETrue);
+
+
+	/** Disables the functionality for counting the transferred source
+		elements.
+
+		This function can be called at any time, but the enabled/disabled
+		status is checked by the framework only at two points in time.
+
+		The first one is after a request has been queued, and if it is enabled
+		then the counting will commence as soon as the transfer starts.
+
+		The second point is when Resume() is called for a paused transfer, and
+		in this case the following applies. If counting was enabled when the
+		transfer was paused and it is now disabled then the counting is stopped
+		at that point and the count value frozen. If counting was disabled when
+		the transfer was paused and it is now enabled then the counting will
+		commence when the transfer resumes. (The starting value will depend on
+		the argument of the enable function.) Otherwise nothing will change,
+		i.e. counting will either continue normally (enabled/enabled) or
+		neither stop nor continue (disabled/disabled).
+
+		Once a status has been set, it remains valid for the entire duration of
+		the transfer (and beyond, if it is not changed again).
+
+		@see Queue()
+		@see TotalNumSrcElementsTransferred()
+	*/
+	IMPORT_C void DisableSrcElementCounting();
+
+
+	/** Disables the functionality for counting the transferred destination
+		elements.
+
+		This function can be called at any time, but the enabled/disabled
+		status is checked by the framework only at two points in time.
+
+		The first one is after a request has been queued, and if it is enabled
+		then the counting will commence as soon as the transfer starts.
+
+		The second point is when Resume() is called for a paused transfer, and
+		in this case the following applies. If counting was enabled when the
+		transfer was paused and it is now disabled then the counting is stopped
+		at that point and the count value frozen. If counting was disabled when
+		the transfer was paused and it is now enabled then the counting will
+		commence when the transfer resumes. (The starting value will depend on
+		the argument of the enable function.) Otherwise nothing will change,
+		i.e. counting will either continue normally (enabled/enabled) or
+		neither stop nor continue (disabled/disabled).
+
+		Once a status has been set, it remains valid for the entire duration of
+		the transfer (and beyond, if it is not changed again).
+
+		@see Queue()
+		@see TotalNumDstElementsTransferred()
+	*/
+	IMPORT_C void DisableDstElementCounting();
+
+
+	/** Returns the number of elements that have been transferred by this
+		transfer request at the source port.
+
+		To use this method, the counting functionality has to be explicitly
+		enabled, either before the transfer request is queued or while it is
+		paused.
+
+		@see EnableSrcElementCounting()
+		@see DisableSrcElementCounting()
+
+		This function should only be called after the transfer has finished
+		(completed with or without error, or because it was cancelled) or while
+		it is paused. Otherwise it may just return 0.
+
+		@return The number of elements that have been transferred by this
+		transfer request at the source port.
+	*/
+	IMPORT_C TUint32 TotalNumSrcElementsTransferred();
+
+
+	/** Returns the number of elements that have been transferred by this
+		transfer request at the destination port.
+
+		To use this method, the counting functionality has to be explicitly
+		enabled, either before the transfer request is queued or while it is
+		paused.
+
+		@see EnableDstElementCounting()
+		@see DisableDstElementCounting()
+
+		This function should only be called after the transfer has finished
+		(completed with or without error, or because it was cancelled) or while
+		it is paused. Otherwise it may just return 0.
+
+		@return The number of elements that have been transferred by this
+		transfer request at the destination port.
+	*/
+	IMPORT_C TUint32 TotalNumDstElementsTransferred();
+
+
+	/** Returns the number of fragments that this transfer request has been
+		split into.
+
+		This number will only be different from 0 once Fragment() has been
+		called or after descriptors have been manually allocated by the client
+		using ExpandDesList().
+
+		If SDmacCaps::iAsymHwDescriptors is true then this function will always
+		return 0, and SrcFragmentCount() / DstFragmentCount() should be used
+		instead.
+
+		@return The number of fragments (descriptors / pseudo descriptors) that
+		this transfer request has been split into.
+	 */
+	IMPORT_C TInt FragmentCount();
+
+	/** Returns the number of source port fragments that this transfer request
+		has been split into.
+
+		This number will only be different from 0 once Fragment() has been
+		called or after descriptors have been manually allocated by the client
+		using ExpandSrcDesList().
+
+		This function can only be used if SDmacCaps::iAsymHwDescriptors is
+		true, otherwise it will always return 0.
+
+		@return The number of source port fragments (descriptors) that this
+		transfer request has been split into.
+	 */
+	IMPORT_C TInt SrcFragmentCount();
+
+
+	/** Returns the number of destination port fragments that this transfer
+		request has been split into.
+
+		This number will only be different from 0 once Fragment() has been
+		called or after descriptors have been manually allocated by the client
+		using ExpandDstDesList().
+
+		This function can only be used if SDmacCaps::iAsymHwDescriptors is
+		true, otherwise it will always return 0.
+
+		@return The number of destination port fragments (descriptors) that
+		this transfer request has been split into.
+	 */
+	IMPORT_C TInt DstFragmentCount();
+
+private:
+	inline void OnDeque();
+	TUint GetTransferCount(const TDmaTransferArgs& aTransferArgs);
+	TInt Frag(TDmaTransferArgs& aTransferArgs);
+	TInt FragSym(TDmaTransferArgs& aTransferArgs, TUint aCount, TUint aMaxTransferLen);
+	TInt FragAsym(TDmaTransferArgs& aTransferArgs, TUint aCount, TUint aMaxTransferLen);
+	TInt FragAsymSrc(TDmaTransferArgs& aTransferArgs, TUint aCount, TUint aMaxTransferLen);
+	TInt FragAsymDst(TDmaTransferArgs& aTransferArgs, TUint aCount, TUint aMaxTransferLen);
+	TInt ExpandDesList(TInt aCount, TInt& aDesCount, SDmaDesHdr*& aFirstHdr,
+					   SDmaDesHdr*& aLastHdr);
+	void FreeDesList(TInt& aDesCount, SDmaDesHdr*& aFirstHdr, SDmaDesHdr*& aLastHdr);
+	TInt FragmentCount(const SDmaDesHdr* aHdr);
+
+public:
+	// WARNING: The following attributes are accessed both in client and DFC
+	// context and so accesses must be protected with the channel lock.
+	TDmaChannel& iChannel;		/**< The channel this request is bound to */
+	TCallback iCb;			 /**< Called on completion/failure (can be NULL) */
+	TAny* iCbArg;			 /**< Callback argument */
+	TDmaCallback iDmaCb;		// the new-style callback function
+	TAny* iDmaCbArg;			// the new-style callback arg
+	TBool iIsrCb;				// client wants callback in ISR context
+	TInt iDesCount;			   /**< The number of fragments in list */
+	SDmaDesHdr* iFirstHdr;	   /**< The first fragment in the list (or NULL) */
+	SDmaDesHdr* iLastHdr;	   /**< The last fragment in the list (or NULL) */
+	TInt iSrcDesCount;		   /**< The number of fragments in list */
+	SDmaDesHdr* iSrcFirstHdr;  /**< The first fragment in the list (or NULL) */
+	SDmaDesHdr* iSrcLastHdr;   /**< The last fragment in the list (or NULL) */
+	TInt iDstDesCount;		   /**< The number of fragments in list */
+	SDmaDesHdr* iDstFirstHdr;  /**< The first fragment in the list (or NULL) */
+	SDmaDesHdr* iDstLastHdr;   /**< The last fragment in the list (or NULL) */
+	SDblQueLink iLink;			/**< The link on channel queue of pending requests */
+	TBool iQueued;				/**< Indicates whether request is pending or being transferred */
+	TUint iMaxTransferSize;		/**< Defaults to DMA controller max. transfer size */
+
+	TUint32 iTotalNumSrcElementsTransferred;
+	TUint32 iTotalNumDstElementsTransferred;
+
+	__DMA_DECLARE_INVARIANT
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+class TDmac;
+class DmaChannelMgr;
+class TDmaCancelInfo;
+
+/** DMA channel base class.
+
+	Standard derived classes are provided for this channel (see
+	TDmaSbChannel, TDmaDbChannel, TDmaSgChannel, and TDmaAsymSgChannel).
+	The base-port implementor will only need to write their own derived
+	class if one of the standard classes is unsuitable.
+
+	This class has not been designed to be called from several concurrent
+	client threads. Multithreaded clients must implement their own locking
+	scheme (via DMutex).
+
+	Mutexes are used internally to protect data structures accessed both by the
+	client thread and the DFC one. Therefore no fast mutex can be held when
+	calling a channel function.
+
+	@publishedPartner
+	@released
+ */
+class TDmaChannel
+	{
+	friend class DDmaRequest;
+	friend class TDmac;
+	friend class DmaChannelMgr;
+public:
+
+	/** Information passed by client when opening a channel */
+	struct SCreateInfo
+		{
+		/** Default constructor. Initializes all fields with meaningful default
+			values.
+
+			Must be inline (for now) because exporting it would break existing
+			custom DMA libs as their clients would need the export which would
+			be missing from the custom .def files.
+		*/
+		SCreateInfo() : iPriority(KDmaPriorityNone), iDynChannel(EFalse) {};
+
+		/** Identifier used by PSL to select channel to open */
+		TUint32 iCookie;
+		/** Number of descriptors this channel can use.
+
+			This number is not used in the upgraded version of the DMA
+			framework and is kept there only for source compatibility. If the
+			client is certain that it will only ever use that version, then the
+			value passed here doesn't matter - the framework will ignore it.
+
+			@deprecated
+		 */
+		TInt iDesCount;
+		/** DFC queue used to service DMA interrupts.
+
+			The DFC thread priority must be higher than any client thread
+			priority to avoid a situation where a transfer completes while
+			being cancelled and another transfer is started before the DFC
+			thread gets a chance to run. This would lead to a stray DFC.
+		*/
+		TDfcQue* iDfcQ;
+		/** DFC priority */
+		TUint8 iDfcPriority;
+		/** Used by PSL to configure a channel priority (if possible).
+
+			The default is KDmaPriorityNone (the don't care value).
+
+		    @see TDmaPriority
+		*/
+		TUint iPriority;
+		/** Request a dynamic DMA channel.
+
+			If this is set to ETrue then the Open call is for a 'dynamic' as
+			opposed to a static and solely owned DMA channel. A number of
+			properties of the opened TDmaChannel object will be different in
+			that case.
+
+			The default value is EFalse.
+		 */
+		TBool iDynChannel;
+		};
+
+public:
+    /** Opens the DMA channel.
+
+		Channel selection is done by the hardware-specific layer using a cookie
+		passed in via aInfo.
+
+		The client should not delete the returned pointer as the framework owns
+		channel objects. However, the client should explicitly close the
+		channel when finished with it.
+
+		@param aInfo Information passed by caller to select and configure
+		channel.
+
+		@param aChannel Points to open channel on successful return. NULL
+		otherwise.
+
+		@return KErrNone or standard error code.
+ 	*/
+	IMPORT_C static TInt Open(const SCreateInfo& aInfo, TDmaChannel*& aChannel);
+
+
+	/** Closes a previously opened DMA channel.
+
+		Assumes the channel is idle and all requests have been deleted.
+
+		The call will cause the resources associated with this channel to be
+		released, and the pointer/reference to it mustn't therefore be accessed
+		any longer after the function has returned. The channel pointer should
+		be set to NULL by the client.
+ 	*/
+	IMPORT_C void Close();
+
+
+	/** Logically links this channel to the one specified as an argument, or,
+		if the argument is NULL, unlinks this channel.
+
+		The effect of channel linking is that once a transfer on this channel
+		has finished, instead of causing the associated client callback to be
+		called, 'aChannel' will be enabled by hardware and a preconfigured
+		transfer on that channel will start.
+
+		Note that conceptually 'linking' here always refers to the end of a
+		channel transfer, not the beginning, i.e. a channel can only be linked
+		once and always to a successor, never twice or to a predecessor. (This
+		does not preclude the possibility that two channels are linked in a
+		circular fashion.)
+
+		This function can only be used if the DMAC supports logical channel
+		linking.
+
+		@see SDmacCaps::iChannelLinking
+
+		@param aChannel Points to the channel this one should be linked to, or
+		NULL if this channel is to be unlinked from any other one.
+
+		@return KErrNone if the channel has been linked or unlinked
+		successfully, KErrCompletion if this channel was already linked to
+		aChannel or already unlinked, KErrNotSupported if the DMAC doesn't
+		support channel linking, KErrArgument if this channel was already
+		linked to a different channel, KErrGeneral if a general error occurred
+		preventing a successful outcome.
+	 */
+	IMPORT_C TInt LinkToChannel(TDmaChannel* aChannel);
+
+	/** Pauses an active transfer on this channel.
+
+		A paused channel transfer can be resumed by calling Resume() or it can
+		be stopped altogether by calling CancelAll().
+
+		@see TDmaChannel::Resume()
+
+		Function can only be used if the DMAC supports this functionality.
+
+		@see SDmacCaps::iChannelPauseAndResume
+
+		@return KErrNone if a transfer has been paused successfully,
+		KErrCompletion if a transfer was already paused, KErrNotSupported if
+		the DMAC doesn't support channel transfer pausing/resuming, KErrGeneral
+		if a general error occurred preventing a successful outcome.
+	 */
+	IMPORT_C TInt Pause();
+
+
+	/** Resumes a transfer on this channel that is paused.
+
+		Resume() can be called to resume channel operation when the transfer is
+		paused as a result of a previous call to Pause() or because the DMAC
+		has encountered a Pause bit in a H/W descriptor.
+
+		@see TDmaChannel::Pause()
+		@see TDmaCallbackType::EDmaCallbackLinkedListPaused
+
+		Function can only be used if the DMAC supports this functionality.
+
+		@see SDmacCaps::iChannelPauseAndResume
+
+		@return KErrNone if a paused transfer has been resumed successfully,
+		KErrCompletion if there was no paused transfer, KErrNotSupported if the
+		DMAC doesn't support channel transfer pausing/resuming, KErrGeneral if
+		a general error occurred preventing a successful outcome.
+	 */
+	IMPORT_C TInt Resume();
+
+
+	/** Cancels the current request and all the pending ones.
+	 */
+	IMPORT_C void CancelAll();
+
+
+	/** Returns the channel's maximum transfer length based on the passed
+		arguments.
+
+		@param aSrcFlags Bitmask characterising transfer source
+		@see TDmaTransferArgs::iSrcConfig::iFlags
+
+		@param aDstFlags Bitmask characterising transfer destination
+		@see TDmaTransferArgs::iDstConfig::iFlags
+
+		@param aPslInfo Cookie passed to the PSL
+		@see TDmaTransferArgs::iPslRequestInfo
+
+		@return 0 if transfer length is not limited, the maximum transfer
+		length in bytes otherwise.
+ 	*/
+	IMPORT_C TUint MaxTransferLength(TUint aSrcFlags, TUint aDstFlags, TUint32 aPslInfo);
+
+
+	/** Retrieves from the PSL the address / memory alignment mask based on the
+		parameters passed. Some DMA controllers impose alignment constraints on
+		the base address of memory buffers. This mask is AND'ed against memory
+		addresses computed during fragmentation.
+
+		This function needs to be called separately for source and destination.
+
+		@param aTargetFlags Bitmask characterising transfer source or
+		destination
+		@see TDmaTransferArgs::iSrcConfig::iFlags
+		@see TDmaTransferArgs::iDstConfig::iFlags
+
+		@param aElementSize Element size used for the transfer. Can be zero if
+		not known or 'don't care'.
+
+		@param aPslInfo Cookie passed to the PSL
+		@see TDmaTransferArgs::iPslRequestInfo
+
+		@return A value representing the alignment mask (e.g. 3 if buffer must
+		be 4-byte aligned)
+	 */
+	IMPORT_C TUint AddressAlignMask(TUint aTargetFlags, TUint aElementSize,
+									TUint32 aPslInfo);
+
+
+	/** Returns a reference to a structure containing the capabilities and
+		features of the DMA controller associated with this channel.
+
+		@return A reference to a structure containing the capabilities and
+		features of the DMA controller associated with this channel.
+	 */
+	IMPORT_C const SDmacCaps& DmacCaps();
+
+
+	/** Sets up once more the transfer request that has just completed, after
+		optionally having adjusted the transfer parameters as specified.
+
+		This function is meant to be called exclusively from a client-supplied
+		callback that is executed in ISR context, and only in response to a
+		transfer completion notification.
+
+		If this call returns to the caller with KErrNone then the framework's
+		ISR handler will subsequently not queue the channel DFC for this
+		completed request.
+
+		The parameters specify which changes the framework should apply to the
+		descriptors of the transfer request before rescheduling it. Arguments
+		for which no change is required should be passed as their default
+		values. The parameters correspond to those in the TDmaTransferArgs
+		struct as follows.
+
+		@param aSrcAddr @see TDmaTransferArgs::iSrcConfig::iAddr
+		@param aDstAddr @see TDmaTransferArgs::iDstConfig::iAddr
+		@param aTransferCount @see TDmaTransferArgs::iTransferCount
+		@param aPslRequestInfo @see TDmaTransferArgs::iPslRequestInfo
+		@param aIsrCb If set to ETrue (the default) then the callback of the
+		rescheduled request will again be called in ISR context
+
+		Since Epoc::LinearToPhysical() cannot be called in ISR context the
+		addresses passed into this function must be physical ones, i.e.
+		TDmaTransferFlags::KDmaPhysAddr is implied.
+
+		If an address refers to a memory target then
+		TDmaTransferFlags::KDmaMemIsContiguous is implied as well as no
+		fragmentation is possible at this point.
+
+		@pre Must only be called from a 'transfer complete' client callback in
+		ISR context.
+
+		@post Framework won't queue the channel DFC for the completed request
+		in success case.
+
+		@see DDmaRequest::DDmaRequest(TDmaChannel&, TDmaCallback, TAny*, TUint)
+		@see TDmaCallbackType::EDmaCallbackRequestCompletion
+		@see TDmaPILFlags::KDmaRequestCallbackFromIsr
+
+		@return KErrGeneral if there was an error, KErrNone otherwise.
+	 */
+	IMPORT_C TInt IsrRedoRequest(TUint32 aSrcAddr=KPhysAddrInvalid,
+								 TUint32 aDstAddr=KPhysAddrInvalid,
+								 TUint aTransferCount=0,
+								 TUint32 aPslRequestInfo=0,
+								 TBool aIsrCb=ETrue);
+
+
+	/** Tests whether the channel is currently opened.
+
+		@return ETrue if channel is currently opened, EFalse otherwise.
+
+		NB: This API should not be used any longer.
+
+		After calling TDmaChannel::Open() successfully the channel is
+		guaranteed to be open. Therefore there seems no good reason for this
+		API to exist.
+
+		@deprecated
+	 */
+	inline TBool IsOpened() const;
+
+
+	/** Tests whether the channel's request queue is currently empty.
+
+		@return ETrue if request queue is currently empty, EFalse otherwise.
+	 */
+	inline TBool IsQueueEmpty() const;
+
+
+	/** Returns a PSL-specific value which uniquely identifies this channel -
+		it is used for debug tracing by the PIL.
+
+		@return PSL-specific value which uniquely identifies this channel.
+	 */
+	inline TUint32 PslId() const;
+
+
+	/** Called by a test harness to force an error when the next fragment is
+		transferred.
+
+		@param aFragmentCount The number of consecutive fragments to fail
+	 */
+	IMPORT_C TInt FailNext(TInt aFragmentCount);
+
+
+	/** Called by a test harness to force the DMA controller to miss one or
+		more interrupts.
+
+		@param aInterruptCount The number of consecutive interrupts to miss
+	 */
+	IMPORT_C TInt MissNextInterrupts(TInt aInterruptCount);
+
+
+	/** Function allowing platform-specific layer to extend channel API with
+		new channel-specific operations.
+
+		@param aCmd Command identifier. Negative values are reserved for use by
+		Nokia.
+		@param aArg PSL-specific argument
+
+		@return KErrNotSupported if aCmd is not supported. PSL-specific value
+		otherwise.
+	 */
+	IMPORT_C TInt Extension(TInt aCmd, TAny* aArg);
+
+
+	/** This is a function that allows the Platform Specific Layer (PSL) to
+		extend the DMA API with new channel-independent operations.
+
+		@param aCmd Command identifier. Negative values are reserved for
+		Symbian use.
+		@param aArg PSL-specific.
+
+		@return KErrNotSupported if aCmd is not supported; a PSL specific value
+		otherwise.
+ 	*/
+	IMPORT_C TInt StaticExtension(TInt aCmd, TAny* aArg);
+
+
+	/** @deprecated
+		@see DmacCaps()
+	 */
+	inline const TDmac* Controller() const;
+
+	/** @deprecated
+		@see MaxTransferLength()
+	 */
+	inline TInt MaxTransferSize(TUint aFlags, TUint32 aPslInfo);
+
+	/** @deprecated
+		@see AddressAlignMask()
+	 */
+	inline TUint MemAlignMask(TUint aFlags, TUint32 aPslInfo);
+
+protected:
+	// Interface with state machines
+	TDmaChannel();
+
+	/** Called by the PIL when adding a new request to the channel's queue.
+		The implementation should update the channel's state as appropriate
+		and begin transfer of aReq if possible.
+
+		@param aReq The request which has been added to the queue
+	*/
+	virtual void DoQueue(const DDmaRequest& aReq);
+
+	/** Called by the PIL in response to a CancelAll call. It should update
+		the channel state appropriately.
+	*/
+	virtual void DoCancelAll() = 0;
+
+	/** This is called by the PIL when a DDmaRequest is removed from the
+		channel's queue. In general the implementation simply needs to unlink
+		the hardware descriptor corresponding to aHdr from the next.
+
+		Since the PIL links the hardware descriptor chains of adjacent queued
+		requests (for speed) it is necessary to break the chain when a request
+		is completed so that the request may be requeued by the client without
+		having called DDmaRequest::Fragment again.
+
+		@param aHdr The header for a descriptor, which must be unlinked
+		from its next descriptor (if there is one)
+	*/
+	virtual void DoUnlink(SDmaDesHdr& aHdr);
+
+	/** Called by the PIL whenever a transfer associated with aCurReq is
+		done. The implementation must advance the channel's state and
+		may transfer the next header if necessary (the provided
+		scatter-gather channel does not do this). It must also report
+		back which header was associated with the last transfer to
+		complete.
+
+		@param aCurReq The current request.
+		@param aCompletedHdr Must be set by the implementation to the header
+		of the last transfer to complete.
+	*/
+	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aCompletedHdr);
+
+	/** Called by the PIL whenever a transfer associated with aCurReq is
+		done. The implementation must advance the channel's state and
+		may start the transfer for the next headers if necessary (the
+		provided scatter-gather channels do not do this). If one
+		header has a successor but the other is the last in the chain it
+		is an error.
+
+		@note Must be implemented by PSL if channel uses asymmetric hardware
+		descriptors and is not derived from TDmaAsymSgChannel.
+
+		@param aCurReq The current request.
+
+		@param aSrcCompletedHdr Must be set by the implementation to
+		the header of the last source descriptor to complete.
+
+		@param aDstCompletedHdr Must be set by the implementation to
+		the header of the last destination descriptor to complete.
+	*/
+	virtual void DoDfc(const DDmaRequest& aCurReq, SDmaDesHdr*& aSrcCompletedHdr,
+					   SDmaDesHdr*& aDstCompletedHdr);
+
+	virtual ~TDmaChannel();
+
+private:
+	static void Dfc(TAny*);
+	void DoDfc();
+	inline void Wait();
+	inline void Signal();
+	inline void Flash();
+	void ResetStateMachine();
+
+protected:
+	TDmac* iController;		 // DMAC this channel belongs to (NULL when closed)
+	const SDmacCaps* iDmacCaps;	// what is supported by DMAC on this channel
+	TUint32 iPslId;			 // unique identifier provided by PSL
+	TBool iDynChannel;		 // this is a dynamically allocated channel
+	TUint iPriority;		 // hardware priority of this channel
+	DMutex* iMutex;			 // for data accessed in both client & DFC context
+	SDmaDesHdr* iCurHdr;	 // fragment being transferred or NULL
+	SDmaDesHdr** iNullPtr;	 // Pointer to NULL pointer following last fragment
+	TDfc iDfc;				  // transfer completion/failure DFC
+	TInt iMaxDesCount;		  // maximum number of allocable descriptors
+	TInt iAvailDesCount;	  // available number of descriptors
+	volatile TUint32 iIsrDfc; // Interface between ISR and DFC:
+	enum {KErrorFlagMask = 0x80000000};	   // bit 31 - error flag
+	enum {KCancelFlagMask = 0x40000000};   // bit 30 - cancel flag
+	enum {KDfcCountMask = 0x3FFFFFFF};	   // bits 0-29 - number of queued DFCs
+	SDblQue iReqQ;				 // being/about to be transferred request queue
+	TInt iReqCount;				 // number of requests attached to this channel
+private:
+	TDmaCancelInfo* iCancelInfo; // ...
+	TBool iRedoRequest;			 // client ISR callback wants a redo of request
+	TBool iIsrCbRequest;		 // request on queue using ISR callback
+
+	__DMA_DECLARE_INVARIANT
+	};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// INTERFACE WITH TEST HARNESS
+//////////////////////////////////////////////////////////////////////////////
+
+/** Set of information used by test harness.
+
+	@publishedPartner
+	@released
+*/
+struct TDmaTestInfo
+	{
+	/** Maximum transfer size in bytes for all channels (ie. the minimum of all channels' maximum size)*/
+	TUint iMaxTransferSize;
+	/** 3->Memory buffers must be 4-byte aligned, 7->8-byte aligned, ... */
+	TUint iMemAlignMask;
+	/** Cookie to pass to DDmaRequest::Fragment for memory-memory transfer*/
+	TUint32 iMemMemPslInfo;
+	/** Number of test single-buffer channels */
+	TInt iMaxSbChannels;
+	/** Pointer to array containing single-buffer test channel ids */
+	TUint32* iSbChannels;
+	/** Number of test double-buffer channels */
+	TInt iMaxDbChannels;
+	/** Pointer to array containing double-buffer test channel ids */
+	TUint32* iDbChannels;
+	/** Number of test scatter-gather channels */
+	TInt iMaxSgChannels;
+	/** Pointer to array containing scatter-gather test channel ids */
+	TUint32* iSgChannels;
+	};
+
+
+/** Provides access to test information structure stored in the PSL.
+
+	Must be implemented by the PSL.
+
+	@publishedPartner
+	@released
+*/
+IMPORT_C const TDmaTestInfo& DmaTestInfo();
+
+/** Provides access to test information structure stored in the PSL.
+
+	Must be implemented by the PSL.
+
+	@publishedPartner
+	@released
+*/
+IMPORT_C const TDmaV2TestInfo& DmaTestInfoV2();
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+#include <drivers/dma_compat.inl>
+#include <drivers/dma_v2.inl>
+
+
+#endif	// #ifndef __DMA_V2_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/drivers/dma_v2.inl	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,62 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0""
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// include/drivers/dma_v2.inl
+// DMA Framework - Client API v2 definition.
+//
+//
+// WARNING: This file contains some APIs which are internal and are subject
+//          to change without noticed. Such APIs should therefore not be used
+//          outside the Kernel and Hardware Services package.
+
+
+//
+// TDmaChannel
+//
+
+inline void TDmaChannel::Wait()
+	{
+	NKern::ThreadEnterCS();
+	Kern::MutexWait(*iMutex);
+	}
+
+inline void TDmaChannel::Signal()
+	{
+	Kern::MutexSignal(*iMutex);
+	NKern::ThreadLeaveCS();
+	}
+
+inline void TDmaChannel::Flash()
+	{
+	Kern::MutexSignal(*iMutex);
+	Kern::MutexWait(*iMutex);
+	}
+
+inline TBool TDmaChannel::IsOpened() const
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("Warning: TDmaChannel::IsOpened() is deprecated"));
+	return iController != NULL;
+	}
+
+inline TBool TDmaChannel::IsQueueEmpty() const
+	{
+	return const_cast<TDmaChannel*>(this)->iReqQ.IsEmpty();
+	}
+
+inline TUint32 TDmaChannel::PslId() const
+	{
+	return iPslId;
+	}
+
+
+// ---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/include/drivers/dmadefs.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,739 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// include/drivers/dmadefs.h
+// DMA Framework - General class, enum, constant and type definitions.
+//
+//
+
+#ifndef __DMADEFS_H__
+#define __DMADEFS_H__
+
+
+#include <e32def.h>
+
+
+/** The client request callback type */
+enum TDmaCallbackType
+	{
+	/** Transfer request completion callback */
+	EDmaCallbackRequestCompletion        = 0x01,
+	/** Transfer request completion callback - source side */
+	EDmaCallbackRequestCompletion_Src    = 0x02,
+	/** Transfer request completion callback - destination side */
+	EDmaCallbackRequestCompletion_Dst    = 0x04,
+
+	/** Descriptor completion callback */
+	EDmaCallbackDescriptorCompletion     = 0x08,
+	/** Descriptor completion callback - source side */
+	EDmaCallbackDescriptorCompletion_Src = 0x10,
+	/** Descriptor completion callback - destination side */
+	EDmaCallbackDescriptorCompletion_Dst = 0x20,
+
+	/** Frame completion callback */
+	EDmaCallbackFrameCompletion          = 0x40,
+	/** Frame completion callback - source side */
+	EDmaCallbackFrameCompletion_Src      = 0x80,
+	/** Frame completion callback - destination side */
+	EDmaCallbackFrameCompletion_Dst      = 0x100,
+
+	/** H/W descriptor pause event callback */
+	EDmaCallbackLinkedListPaused        = 0x200,
+	/** H/W descriptor pause event callback - source side */
+	EDmaCallbackLinkedListPaused_Src    = 0x400,
+	/** H/W descriptor pause event callback - destination side */
+	EDmaCallbackLinkedListPaused_Dst    = 0x800
+	};
+
+
+/** The outcome of the transfer request */
+enum TDmaResult
+	{
+	/** Completed without error */
+	EDmaResultOK = 0,
+	/** There was an error */
+	EDmaResultError
+	};
+
+
+
+/** To be used with address mode field of the DMA transfer config struct.
+
+	@see TDmaTransferConfig::iAddrMode
+*/
+enum TDmaAddrMode
+	{
+	/** Constant addressing. The address remains the same for consecutive
+		accesses.
+	*/
+	KDmaAddrModeConstant,
+	/** Post-increment addressing. The address increases by the element size
+		after each access.
+	*/
+	KDmaAddrModePostIncrement,
+	/** Post-decrement addressing. The address decreases by the element size
+		after each access.
+	*/
+	KDmaAddrModePostDecrement,
+	/** 1D-index addressing. The address always increases by the element size
+		plus the element skip value after each access.
+	*/
+	KDmaAddrMode1DIndex,
+	/** 2D-index addressing. The address increases by the element size plus the
+		element skip value - but only within a frame. Once a full frame has been
+		transferred, the address increases by the element size plus the element
+		skip value plus the frame skip value.
+	*/
+	KDmaAddrMode2DIndex
+	};
+
+
+/** To be used with the burst size field of the DMA transfer config struct.
+
+	@see SDmacCaps::iBurstTransactions
+	@see TDmaTransferConfig::iBurstSize
+*/
+enum TDmaBurstSize
+	{
+	/** Don't use burst transactions */
+	KDmaNoBursts     = -1,
+	/** Don't care (the default) */
+	KDmaBurstSizeAny = 0x00,
+	/** 4 bytes */
+	KDmaBurstSize4   = 0x04,
+	/** 8 bytes */
+	KDmaBurstSize8   = 0x08,
+	/** 16 bytes */
+	KDmaBurstSize16  = 0x10,
+	/** 32 bytes */
+	KDmaBurstSize32  = 0x20,
+	/** 64 bytes */
+	KDmaBurstSize64  = 0x40,
+	/** 128 bytes */
+	KDmaBurstSize128 = 0x80
+	};
+
+
+/** To be used with the flags field of the DMA transfer config struct.
+
+	@see TDmaTransferConfig::iFlags
+*/
+enum TDmaTransferFlags
+	{
+	/** Location is address of a memory buffer (as opposed to a peripheral or a
+		register).
+	*/
+	KDmaMemAddr                      = 0x01,
+	/** Address is a physical address (as opposed to a linear one).
+		If it is a memory address then KDmaMemIsContiguous will need to be set
+		as well.
+	 */
+	KDmaPhysAddr                     = 0x02,
+	/** Target memory is known to be physically contiguous, hence there is
+		no need for the framework to check for memory fragmentation.
+	*/
+	KDmaMemIsContiguous              = 0x04,
+	/** Don't use packed access (if possible) */
+	KDmaDontUsePacked                = 0x08,
+	/** Location is big endian (little endian if not set).
+
+		To have any effect, this flag requires the DMAC to support endianness
+		conversion.
+
+		@see SDmacCaps::iEndiannessConversion
+	*/
+	KDmaBigEndian                    = 0x10,
+	/** Don't do endianness conversion even if applicable.
+
+		To have any effect, this flag requires the DMAC to support endianness
+		conversion.
+
+		@see SDmacCaps::iEndiannessConversion
+	*/
+	KDmaLockEndian                   = 0x20,
+	/** Execute client request callback after each subtransfer (streaming /
+		loop case).
+
+		This option is only taken into account if the respective
+		TDmaTransferConfig::iRepeatCount is non-zero.
+
+		The callback will complete with a TDmaCallbackType of
+		EDmaCallbackRequestCompletion (even if the repeat counts for source and
+		destination are different), unless the flag
+		TDmaPILFlags::KDmaAsymCompletionCallback is set too, in which case what
+		is described there applies.
+	*/
+	KDmaCallbackAfterEveryTransfer   = 0x40,
+	/** Execute client request callback after each completed hardware
+		descriptor.
+
+		Requires the DMAC to support this feature. Unless the DMAC supports
+		asymmetric descriptor interrupts as well, this flag should not be set
+		on only one (source or destination) side.
+
+		@see SDmacCaps::iDescriptorInterrupt
+		@see SDmacCaps::iAsymDescriptorInterrupt
+	*/
+	KDmaCallbackAfterEveryDescriptor = 0x80,
+	/** Execute client request callback after each completed frame.
+
+		Requires the DMAC to support this feature. Unless the DMAC supports
+		asymmetric frame interrupts as well, this flag should not be set on
+		only one (source or destination) side.
+
+		@see SDmacCaps::iFrameInterrupt
+		@see SDmacCaps::iAsymFrameInterrupt
+	*/
+	KDmaCallbackAfterEveryFrame      = 0x100
+	};
+
+
+/** To be used with the synchronization flags field of a DMA transfer
+	config struct.
+
+	@see SDmacCaps::iSynchronizationTypes
+	@see TDmaTransferConfig::iSyncFlags
+*/
+enum TDmaTransferSyncFlags
+	{
+	/** Leave the decision on whether the transfer is hardware synchronized at
+		this end (either source or destination) to the Framework. This is the
+		default.
+	*/
+	KDmaSyncAuto        = 0x00,
+	/** Transfer is not hardware synchronized at this end (either source or
+		destination).
+	*/
+	KDmaSyncNone        = 0x01,
+	/** Transfer is hardware synchronized at this end (either source or
+		destination). This option can also be used on its own, without any
+		of the following sync sizes.
+	*/
+	KDmaSyncHere        = 0x02,
+	/** H/W synchronized at this end: transfer one ELEMENT (a number of
+		bytes, depending on the configured element size) per sync event.
+	*/
+	KDmaSyncSizeElement = 0x04,
+	/** H/W synchronized at this end: transfer one FRAME (a number of
+		elements, depending on the configured frame size) per sync event.
+	*/
+	KDmaSyncSizeFrame   = 0x08,
+	/** H/W synchronized at this end: transfer one BLOCK (a number of
+		frames, depending on the configured transfer size) per sync
+		event. This is the most common use case.
+	*/
+	KDmaSyncSizeBlock   = 0x10,
+	/** H/W synchronized at this end: transfer one PACKET (a number of
+		elements, depending on the configured packet size) per sync event.
+		In cases where the transfer block size is not a multiple of the
+		packet size the last packet will consist of the remaining elements.
+	*/
+	KDmaSyncSizePacket  = 0x20
+	};
+
+
+/** To be used with the Graphics operation field of a DMA transfer request.
+
+	@see TDmaTransferArgs::iGraphicsOps
+*/
+enum TDmaGraphicsOps
+	{
+	/** Don't use any graphics acceleration feature (the default) */
+	KDmaGraphicsOpNone            = 0x00,
+	/** Enable graphics acceleration feature 'Constant Fill' */
+	KDmaGraphicsOpConstantFill    = 0x01,
+	/** Enable graphics acceleration feature 'TransparentCopy' */
+	KDmaGraphicsOpTransparentCopy = 0x02
+	};
+
+
+/** To be used with the PIL flags field of a DMA transfer request.
+
+	@see TDmaTransferArgs::iFlags
+*/
+enum TDmaPILFlags
+	{
+	/** Request a different max transfer size (for instance for test
+		purposes).
+	*/
+	KDmaAltTransferLength         = 0x01,
+	/** Execute client request callback in ISR context instead of from a
+		DFC.
+	*/
+	KDmaRequestCallbackFromIsr    = 0x02,
+	/** Execute descriptor completion callback in ISR context instead of
+		from a DFC. This option is to be used in conjunction with the
+		TDmaTransferFlags::KDmaCallbackAfterEveryDescriptor flag.
+	*/
+	KDmaDescriptorCallbackFromIsr = 0x04,
+	/** Execute frame completion callback in ISR context instead of
+		from a DFC. This option is to be used in conjunction with the
+		TDmaTransferFlags::KDmaCallbackAfterEveryFrame flag.
+	*/
+	KDmaFrameCallbackFromIsr      = 0x08,
+	/** Execute the client request callback separately for source and
+		destination subtransfers.
+
+		This flag also determines the TDmaCallbackType value returned. If set,
+		the callback will complete with EDmaCallbackRequestCompletion_Src or
+		EDmaCallbackRequestCompletion_Dst, respectively, instead of with
+		EDmaCallbackRequestCompletion.
+
+		Requires the DMAC to support this feature.
+
+		@see SDmacCaps::iAsymCompletionInterrupt
+	*/
+	KDmaAsymCompletionCallback    = 0x10,
+	/** Execute the descriptor completion callback separately for source
+		and destination subtransfers.
+
+		This flag modifies the behaviour of the
+		TDmaTransferFlags::KDmaCallbackAfterEveryDescriptor flag and also
+		determines the TDmaCallbackType value returned. If set, the callback
+		will complete with EDmaCallbackDescriptorCompletion_Src or
+		EDmaCallbackDescriptorCompletion_Dst, respectively, instead of with
+		EDmaCallbackDescriptorCompletion.
+
+		Requires the DMAC to support this feature.
+
+		@see SDmacCaps::iAsymDescriptorInterrupt
+	*/
+	KDmaAsymDescriptorCallback    = 0x20,
+	/** Execute the frame completion callback separately for source and
+		destination subtransfers.
+
+		This flag modifies the behaviour of the
+		TDmaTransferFlags::KDmaCallbackAfterEveryFrame flag. If set, the
+		callback will complete with EDmaCallbackFrameCompletion_Src or
+		EDmaCallbackFrameCompletion_Dst, respectively, instead of with
+		EDmaCallbackFrameCompletion.
+
+		Requires the DMAC to support this feature.
+
+		@see SDmacCaps::iAsymFrameInterrupt
+	*/
+	KDmaAsymFrameCallback         = 0x40,
+	/** This transfer (only) should use the channel priority indicated by
+		TDmaTransferArgs::iChannelPriority.
+	*/
+	KDmaRequestChannelPriority    = 0x80
+	};
+
+
+/** Values which can be used with the priority field when opening a channel
+	and/or when fragmenting a transfer request.
+
+	@see TDmaChannel::SCreateInfo::iPriority
+	@see TDmaTransferArgs::iChannelPriority
+*/
+enum TDmaPriority
+	{
+	/** No transfer priority preference (don't care value) */
+	KDmaPriorityNone = 0x0,
+	/** Platform-independent transfer priority 1 (lowest) */
+	KDmaPriority1 = 0x80000001,
+	/** Platform-independent transfer priority 2 */
+	KDmaPriority2 = 0x80000002,
+	/** Platform-independent transfer priority 3 */
+	KDmaPriority3 = 0x80000003,
+	/** Platform-independent transfer priority 4 */
+	KDmaPriority4 = 0x80000004,
+	/** Platform-independent transfer priority 5 */
+	KDmaPriority5 = 0x80000005,
+	/** Platform-independent transfer priority 6 */
+	KDmaPriority6 = 0x80000006,
+	/** Platform-independent transfer priority 7 */
+	KDmaPriority7 = 0x80000007,
+	/** Platform-independent transfer priority 8 (highest) */
+	KDmaPriority8 = 0x80000008
+	};
+
+
+/** Contains the configuration values for either the source or the
+	destination side of a DMA transfer.
+
+	Note that some fields (notably iElementSize, iElementsPerFrame and
+	iFramesPerTransfer) may only differ between source and destination if
+	the underlying DMAC supports this.
+
+	@see SDmacCaps::iSrcDstAsymmetry
+	@see TDmaTransferArgs::iSrcConfig
+	@see TDmaTransferArgs::iDstConfig
+*/
+struct TDmaTransferConfig
+	{
+friend struct TDmaTransferArgs;
+
+	/** Default constructor. Initializes all fields with meaningful default
+		values.
+	*/
+#ifdef DMA_APIV2
+	KIMPORT_C
+#endif
+	TDmaTransferConfig();
+
+	/**	Intended for general use ie. not 2D or 1D transfers
+	 */
+#ifdef DMA_APIV2
+	KIMPORT_C
+#endif
+	TDmaTransferConfig (
+		TUint32 aAddr,
+		TUint aTransferFlags,
+		TDmaAddrMode aAddrMode = KDmaAddrModePostIncrement,
+		TUint aSyncFlags = KDmaSyncAuto,
+		TDmaBurstSize aBurstSize = KDmaBurstSizeAny,
+		TUint aElementSize = 0,
+		TUint aElementsPerPacket = 0,
+		TUint aPslTargetInfo = 0,
+		TInt aRepeatCount = 0
+		);
+
+	/**	Intended for 1D and 2D transfers
+	 */
+#ifdef DMA_APIV2
+	KIMPORT_C
+#endif
+	TDmaTransferConfig (
+		TUint32 aAddr,
+		TUint aElementSize,
+		TUint aElementsPerFrame,
+		TUint aFramesPerTransfer,
+		TInt aElementSkip,
+		TInt aFrameSkip,
+		TUint aTransferFlags,
+		TUint aSyncFlags = KDmaSyncAuto,
+		TDmaBurstSize aBurstSize = KDmaBurstSizeAny,
+		TUint aElementsPerPacket = 0,
+		TUint aPslTargetInfo = 0,
+		TInt aRepeatCount = 0
+		);
+
+	/** Transfer start address */
+	TUint32 iAddr;
+	/** Address mode */
+	TDmaAddrMode iAddrMode;
+	/** Element size in bytes (1/2/4/8) */
+	TUint iElementSize;
+	/** Number of elements per frame */
+	TUint iElementsPerFrame;
+	/** Number of elements per packet */
+	TUint iElementsPerPacket;
+	/** Number of frames to transfer (result is the transfer block) */
+	TUint iFramesPerTransfer;
+	/** Element skip in bytes (for addr modes E1DIndex or E2DIndex) */
+	TInt iElementSkip;
+	/** Frame skip in bytes (for addr mode E2DIndex) */
+	TInt iFrameSkip;
+	/** Use burst transactions of the specified size (in bytes)
+		@see TDmaBurstSize
+	*/
+	TInt iBurstSize;
+	/** PIL src/dst config flags.
+		@see TDmaTransferFlags
+	 */
+	TUint32 iFlags;
+	/** Transfer synchronization flags.
+		@see TDmaTransferSyncFlags
+	*/
+	TUint32 iSyncFlags;
+	/** Information passed to the PSL */
+	TUint iPslTargetInfo;
+	/** How often to repeat this (sub-)transfer:
+		0     no repeat (the default)
+		1..n  once / n times
+		-1     endlessly.
+	*/
+	TInt iRepeatCount;
+	/** Structure contents delta vector (usage tbd) */
+	TUint32 iDelta;
+	/** Reserved for future use */
+	TUint32 iReserved;
+
+private:
+	/** Private constructor. Initializes fields with the values passed in by
+		the legacy version of the DDmaRequest::Fragment() call.
+	*/
+	TDmaTransferConfig(TUint32 aAddr, TUint aFlags, TBool aAddrInc);
+	};
+
+
+/** To be used by the client to pass DMA transfer request details to the
+	framework.
+
+	Also used internally by the framework as a pseudo descriptor if the
+	controller doesn't support hardware descriptors (scatter/gather LLI).
+
+	@see DDmaRequest::Fragment
+*/
+struct TDmaTransferArgs
+	{
+	friend class DDmaRequest;
+	friend class TDmaChannel;
+	friend class TDmac;
+	friend class DmaChannelMgr;
+
+	/** Default constructor. Initializes all fields with meaningful default
+		values.
+	*/
+#ifdef DMA_APIV2
+	KIMPORT_C
+#endif
+	TDmaTransferArgs();
+
+	/**	For transfers where src and dst TDmaTransferConfig structs share some
+		of the same options ie. iDmaTransferFlags, iAddrMode, iSyncFlags,
+		iBurstSize, and iElementSize.
+
+		@param aSrcAddr
+		@param aDstAddr
+		@param aCount Number of bytes to transfer
+		@param aDmaTransferFlags Bitmask of TDmaTransferFlags for src and dst
+		@param aDmaSyncFlags Bitmask of TDmaTransferSyncFlags for src and dst
+		@param aMode Address mode for src and dst
+		@param aDmaPILFlags Bitmask of TDmaPILFlags
+		@param aElementSize In bytes (1/2/4/8) for src and dst
+		@param aChannelPriority
+		@param aBurstSize for src and dst
+		@param aPslRequestInfo Info word passed to the PSL
+		@param aGraphicOp Graphics operation to be executed
+		@param aColour Colour value for graphics operation
+	*/
+#ifdef DMA_APIV2
+	KIMPORT_C
+#endif
+	TDmaTransferArgs (
+		TUint aSrcAddr, TUint aDstAddr, TUint aCount,
+		TUint aDmaTransferFlags, TUint aDmaSyncFlags = KDmaSyncAuto,
+		TUint aDmaPILFlags = 0,
+		TDmaAddrMode aMode = KDmaAddrModePostIncrement, TUint aElementSize = 0,
+		TUint aChannelPriority = KDmaPriorityNone,
+		TDmaBurstSize aBurstSize = KDmaBurstSizeAny, TUint aPslRequestInfo = 0,
+		TDmaGraphicsOps aGraphicOp = KDmaGraphicsOpNone, TUint32 aColour = 0
+		);
+
+	/** For transfers needing specific options for source and destination
+		TDmaTransferConfig structs.
+
+		@param aSrc Configuration values for the source
+		@param aDst Configuration values for the destination
+		@param aFlags @see TDmaPILFlags
+		@param aChannelPriority Use for this request (only) the indicated
+		channel priority. Requires KDmaRequestChannelPriority to be set in
+		iFlags as well. @see TDmaPriority
+
+		@param aPslRequestInfo Info word passed to the PSL
+		@param aGraphicOp Graphics operation to be executed
+		@param aColour Colour value for graphics operation
+	*/
+#ifdef DMA_APIV2
+	KIMPORT_C
+#endif
+	TDmaTransferArgs (
+		const TDmaTransferConfig& aSrc,
+		const TDmaTransferConfig& aDst,
+		TUint32 aFlags = 0,
+		TUint aChannelPriority = KDmaPriorityNone,
+		TUint aPslRequestInfo = 0,
+		TDmaGraphicsOps aGraphicOp = KDmaGraphicsOpNone, TUint32 aColour = 0
+		);
+
+	/** Configuration values for the source */
+	TDmaTransferConfig iSrcConfig;
+	/** Configuration values for the destination */
+	TDmaTransferConfig iDstConfig;
+
+	/** Number of bytes to transfer (optional).
+
+		A non-zero value here must be consistent with iElementSize,
+		iElementsPerFrame and iFramesPerTransfer in iSrcConfig and iDstConfig
+		if the latter are specified as well (or instead, they may be left at
+		their default values of zero).
+
+		If zero, the PIL will fill in a value calculated from multiplying
+		iElementSize, iElementsPerFrame and iFramesPerTransfer in iSrcConfig,
+		so that the PSL can rely on it being always non-zero and valid.
+	 */
+	TUint iTransferCount;
+	/** Graphics operation to be executed */
+	TDmaGraphicsOps iGraphicsOps;
+	/** Colour value for graphics operations */
+	TUint32 iColour;
+	/** PIL common flags
+		@see TDmaPILFlags
+	*/
+	TUint32 iFlags;
+	/** Use for this request (only) the indicated channel priority.
+		Requires KDmaRequestChannelPriority to be set in iFlags as well.
+		@see TDmaPriority
+	*/
+	TUint iChannelPriority;
+	/** Info word passed to the PSL */
+	TUint iPslRequestInfo;
+
+	/** Structure contents delta vector (usage tbd) */
+	TUint32 iDelta;
+	/** Reserved for future use */
+	TUint32 iReserved1;
+
+private:
+	/** Private constructor. Initializes fields with the values passed in by
+		the legacy version of the DDmaRequest::Fragment() call.
+	*/
+	TDmaTransferArgs(TUint32 aSrcAddr, TUint32 aDstAddr, TInt aCount,
+					 TUint aFlags, TUint32 aPslInfo);
+	/** Stores the PSL cookie returned by TDmaChannel::PslId() at request
+		fragmentation time.
+		The value PslId() is often (but not necessarily) identical with the
+		client's TDmaChannel::SCreateInfo::iCookie, which gets passed by the
+		PIL into DmaChannelMgr::Open() as 'aOpenId'.
+	*/
+	TUint32 iChannelCookie;
+	/** Reserved for future use */
+	TUint32 iReserved2;
+	};
+
+
+/** DMAC capabilities info structure.
+
+	Instances are to be filled in by the PSL and then linked to via TDmaChannel
+	objects after they have been opened.
+
+	The contents may vary even between channels on the same DMAC (but will
+	remain constant for a given channel for the duration that it is open),
+	depending on static or dynamic factors which only the PSL knows about.
+
+	@see TDmaChannel::Open
+	@see TDmaChannel::DmacCaps
+*/
+struct SDmacCaps
+	{
+	/** DMAC supports n + 1 different channel priorities. */
+	TUint iChannelPriorities;
+	/** DMAC supports the pausing and resuming of channels. */
+	TBool iChannelPauseAndResume;
+	/** DMA addresses must be aligned on an element size boundary. */
+	TBool iAddrAlignedToElementSize;
+	/** DMAC supports 1D (element) index addressing in hardware. */
+	TBool i1DIndexAddressing;
+	/** DMAC supports 2D (frame) index addressing in hardware. */
+	TBool i2DIndexAddressing;
+	/** DMAC supports these transfer synchronization types (bitmap of values).
+
+		@see TDmaTransferSyncFlags
+	*/
+	TUint iSynchronizationTypes;
+	/** DMAC supports burst transactions with these sizes (bitmap of values).
+
+		@see TDmaBurstSize
+	*/
+	TUint iBurstTransactions;
+	/** DMAC supports a 'h/w descriptor complete' interrupt. */
+	TBool iDescriptorInterrupt;
+	/** DMAC supports a 'frame transfer complete' interrupt. */
+	TBool iFrameInterrupt;
+	/** DMAC supports a 'linked-list pause event' interrupt. */
+	TBool iLinkedListPausedInterrupt;
+	/** DMAC supports endianness conversion. */
+	TBool iEndiannessConversion;
+	/** DMAC supports these graphics operations (bitmap of values).
+
+		@see TDmaGraphicsOps
+	*/
+	TUint iGraphicsOps;
+	/** DMAC supports repeated transfers (loops). */
+	TBool iRepeatingTransfers;
+	/** DMAC supports logical channel linking (chaining). */
+	TBool iChannelLinking;
+	/** DMAC supports scatter/gather mode (linked list items). */
+	TBool iHwDescriptors;
+	/** DMAC supports asymmetric source and destination transfer
+		parameters (such as element size).
+	*/
+	TBool iSrcDstAsymmetry;
+	/** DMAC supports asymmetric h/w descriptor lists.
+
+		ETrue here requires ETrue for iHwDescriptors and iSrcDstAsymmetry as
+		well.
+	*/
+	TBool iAsymHwDescriptors;
+	/** DMAC with asymmetric descriptor support has the limitation that the
+		number of bytes transferred in source and destination must be equal in
+		every link segment (i.e. in each src/dst descriptor pair).
+
+		ETrue here requires ETrue for iAsymHwDescriptors as well.
+	*/
+	TBool iBalancedAsymSegments;
+	/** DMAC supports separate transfer completion notifications for source and
+		destination side subtransfers.
+
+		This capability is required for the asymmetric transfer completion
+		callback API feature.
+
+		@see TDmaPILFlags::KDmaAsymCompletionCallback
+	*/
+	TBool iAsymCompletionInterrupt;
+	/** DMAC supports separate descriptor completion notifications for source and
+		destination side.
+
+		This capability is required for the asymmetric descriptor completion
+		callback API feature.
+
+		ETrue here requires ETrue for both iDescriptorInterrupt and
+		iAsymHwDescriptors as well.
+
+		@see TDmaPILFlags::KDmaAsymDescriptorCallback
+	*/
+	TBool iAsymDescriptorInterrupt;
+	/** DMAC supports separate frame completion notifications for source and
+		destination side.
+
+		This capability is required for the asymmetric frame completion
+		callback API feature.
+
+		ETrue here requires ETrue for iFrameInterrupt as well.
+
+		@see TDmaPILFlags::KDmaAsymFrameCallback
+	*/
+	TBool iAsymFrameInterrupt;
+
+	/** Reserved for future use */
+	TUint32 iReserved[5];
+	};
+
+
+struct TDmaV2TestInfo
+	{
+	enum {KMaxChannels=32};
+	/** Maximum transfer size in bytes for all channels (ie. the minimum of all channels' maximum size)*/
+	TUint iMaxTransferSize;
+	/** 3->Memory buffers must be 4-byte aligned, 7->8-byte aligned, ... */
+	TUint iMemAlignMask;
+	/** Cookie to pass to DDmaRequest::Fragment for memory-memory transfer */
+	TUint32 iMemMemPslInfo;
+	/** Number of test single-buffer channels */
+	TInt iMaxSbChannels;
+	/** Pointer to array containing single-buffer test channel ids */
+	TUint32 iSbChannels[KMaxChannels];
+	/** Number of test double-buffer channels */
+	TInt iMaxDbChannels;
+	/** Pointer to array containing double-buffer test channel ids */
+	TUint32 iDbChannels[KMaxChannels];
+	/** Number of test scatter-gather channels */
+	TInt iMaxSgChannels;
+	/** Pointer to array containing scatter-gather test channel ids */
+	TUint32 iSgChannels[KMaxChannels];
+	};
+
+
+#endif	// #ifndef __DMADEFS_H__
--- a/kernel/eka/include/e32ver.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/e32ver.h	Mon Jan 18 21:31:10 2010 +0200
@@ -28,7 +28,7 @@
 
 const TInt KE32MajorVersionNumber=2;
 const TInt KE32MinorVersionNumber=0;
-const TInt KE32BuildVersionNumber=2058;
+const TInt KE32BuildVersionNumber=2063;
 
 const TInt KMachineConfigurationMajorVersionNumber=1;
 const TInt KMachineConfigurationMinorVersionNumber=0;
--- a/kernel/eka/include/kernel/arm/bootcpu.inc	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/kernel/arm/bootcpu.inc	Mon Jan 18 21:31:10 2010 +0200
@@ -363,10 +363,16 @@
 CFG_ASID_Present			SETL	{TRUE}
 CFG_Cpu_Has_CLZ				SETL	{TRUE}
 CFG_TEX						SETL	{TRUE}
+	IF	CFG_MMFlexible
+; flexible memory model doesn't use Write Through memory for internal mappings. 
+CFG_WriteThroughDisabled	SETL	{TRUE}
+	ELSE
+; multiple memory model uses Write Through memory for internal mappings unless erratum 399234 prevents us to do so 
 	IF  (:LNOT: :DEF: CFG_CPU_ARM1136_ERRATUM_399234_FIXED)
 CFG_WriteThroughDisabled	SETL	{TRUE}
 	ENDIF
-
+	ENDIF
+	
 	INIT_NUMERIC_CONSTANT	InitialMMUCR,	MMUCR_A+MMUCR_W+MMUCR_SBO+MMUCR_I+MMUCR_IT+MMUCR_DT
 	INIT_NUMERIC_CONSTANT	ExtraMMUCR,		MMUCR_M+MMUCR_C+MMUCR_V+MMUCR_Z+MMUCR_XP+MMUCR_U
 
--- a/kernel/eka/include/kernel/cache_maintenance.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/kernel/cache_maintenance.h	Mon Jan 18 21:31:10 2010 +0200
@@ -301,12 +301,16 @@
 	static void CleanAndInvalidate_DCache_All();
 
 /*
- * Synchronises a single line of cache(s) for instruction execution.
+ * Synchronises the ICache and DCache for instruction execution.
+ * Also invalidates the branch predictor array, this is architecture dependant:
+ *   ARM7: Invalidates aAddr and aAddr+2 (covering possible THUMB instructions)
+ *   ARM6: Invalidates the whole Branch Predictor Array
+ *
  * On SMP, only the running core is maintained.
  * 
- * @arg aAddr Virtual address that belongs to the cache line.
+ * @arg aAddr 32bit aligned virtual address that belongs to the cache line.
  * 
- * NOTE: On SMP this is guaranted NOT to broadcast to other cores.
+ * NOTE: On SMP this is guaranteed NOT to broadcast to other cores.
  * NOTE: It assumes the same line size for ICache and DCache
  */
 	static void IMB_CacheLine(TLinAddr aAddr);
--- a/kernel/eka/include/kernel/kernel.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/kernel/kernel.h	Mon Jan 18 21:31:10 2010 +0200
@@ -229,6 +229,7 @@
 
 
 const TUint8 KMutexOrdRamDrive			= KMutexOrdGeneral7; /**< @internalComponent */
+const TUint8 KMutexOrdDmaChannel		= 0x70; /**< @internalComponent */
 const TUint8 KMutexOrdShPool			= 0x68; /**< @internalComponent */
 const TUint8 KMutexOrdCodeSegLock		= 0x60; /**< @internalComponent */
 const TUint8 KMutexOrdPubSub2			= 0x5e; /**< @internalComponent */
--- a/kernel/eka/include/nkern/nk_cpu.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/nkern/nk_cpu.h	Mon Jan 18 21:31:10 2010 +0200
@@ -130,7 +130,7 @@
 	#endif
 	#endif
 
-	#if (defined(__CPU_ARM1136__) && defined(__CPU_ARM1136_ERRATUM_399234_FIXED)) || (defined(__CPU_ARM11MP__) && defined (__SMP__) )
+	#if (defined(__CPU_ARM1136__) && defined(__CPU_ARM1136_ERRATUM_399234_FIXED) && !defined(__MEMMODEL_FLEXIBLE__)) || (defined(__CPU_ARM11MP__) && defined (__SMP__) )
 	// Page tables on these platforms are either uncached or write through cached.
 	#else
 	// Page/directory tables are fully cached (write-back) on these platforms. 
--- a/kernel/eka/include/nkern/nk_priv.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/nkern/nk_priv.h	Mon Jan 18 21:31:10 2010 +0200
@@ -511,8 +511,18 @@
 */
 TBool InterruptsStatus(TBool aRequest);
 
+//declarations for the checking of kernel preconditions
 
-//declarations for the checking of kernel precoditions
+/**
+@internalComponent
+
+PRECOND_FUNCTION_CALLER is needed for __ASSERT_WITH_MESSAGE_ALWAYS(),
+so is outside the #ifdef _DEBUG.
+*/
+#ifndef PRECOND_FUNCTION_CALLER
+#define PRECOND_FUNCTION_CALLER		0
+#endif
+
 #ifdef _DEBUG
 
 /**
@@ -548,7 +558,7 @@
 /**
 @internalComponent
 */
-#define CHECK_PRECONDITIONS(mask,function) CheckPreconditions(mask,function,0)
+#define CHECK_PRECONDITIONS(mask,function) CheckPreconditions(mask,function,PRECOND_FUNCTION_CALLER)
 
 #ifdef __KERNEL_APIS_CONTEXT_CHECKS_FAULT__
 
@@ -557,7 +567,7 @@
 */
 #define __ASSERT_WITH_MESSAGE_DEBUG(cond,message,function) \
 			__ASSERT_DEBUG( (cond), ( \
-			DEBUGPRINT("Assertion failed: %s\nFunction: %s\n",message,function),\
+			DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER),\
 			NKFault(function, 0)))
 
 #else//!__KERNEL_APIS_CONTEXT_CHECKS_FAULT__
@@ -566,7 +576,7 @@
 */
 #define __ASSERT_WITH_MESSAGE_DEBUG(cond,message,function) \
 			__ASSERT_DEBUG( (cond), \
-			DEBUGPRINT("Assertion failed: %s\nFunction: %s\n",message,function))
+			DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER))
 
 
 #endif//__KERNEL_APIS_CONTEXT_CHECKS_FAULT__
@@ -588,7 +598,7 @@
 */
 #define __ASSERT_WITH_MESSAGE_ALWAYS(cond,message,function) \
 			__ASSERT_ALWAYS( (cond), ( \
-			DEBUGPRINT("Assertion failed: %s\nFunction: %s\n",message,function),\
+			DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER),\
 			NKFault(function, 0)))
 #else
 /**
@@ -596,7 +606,7 @@
 */
 #define __ASSERT_WITH_MESSAGE_ALWAYS(cond,message,function) \
 			__ASSERT_ALWAYS( (cond), \
-			DEBUGPRINT("Assertion failed: %s\nFunction: %s\n",message,function))
+			DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER))
 #endif//__KERNEL_APIS_CONTEXT_CHECKS_FAULT__
 #endif//(!defined (__KERNEL_APIS_CONTEXT_CHECKS_WARNING__)&&!defined (__KERNEL_APIS_CONTEXT_CHECKS_FAULT__))
 
--- a/kernel/eka/include/nkernsmp/nk_priv.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/include/nkernsmp/nk_priv.h	Mon Jan 18 21:31:10 2010 +0200
@@ -781,6 +781,17 @@
 
 
 //declarations for the checking of kernel preconditions
+
+/**
+@internalComponent
+
+PRECOND_FUNCTION_CALLER is needed for __ASSERT_WITH_MESSAGE_ALWAYS(),
+so is outside the #ifdef _DEBUG.
+*/
+#ifndef PRECOND_FUNCTION_CALLER
+#define PRECOND_FUNCTION_CALLER		0
+#endif
+
 #ifdef _DEBUG
 
 /**
@@ -816,7 +827,7 @@
 /**
 @internalComponent
 */
-#define CHECK_PRECONDITIONS(mask,function) CheckPreconditions(mask,function,0)
+#define CHECK_PRECONDITIONS(mask,function) CheckPreconditions(mask,function,PRECOND_FUNCTION_CALLER)
 
 #ifdef __KERNEL_APIS_CONTEXT_CHECKS_FAULT__
 
@@ -825,7 +836,7 @@
 */
 #define __ASSERT_WITH_MESSAGE_DEBUG(cond,message,function) \
 			__ASSERT_DEBUG( (cond), ( \
-			DEBUGPRINT("Assertion failed: %s\nFunction: %s\n",message,function),\
+			DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER),\
 			NKFault(function, 0)))
 
 #else//!__KERNEL_APIS_CONTEXT_CHECKS_FAULT__
@@ -834,7 +845,7 @@
 */
 #define __ASSERT_WITH_MESSAGE_DEBUG(cond,message,function) \
 			__ASSERT_DEBUG( (cond), \
-			DEBUGPRINT("Assertion failed: %s\nFunction: %s\n",message,function))
+			DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER))
 
 
 #endif//__KERNEL_APIS_CONTEXT_CHECKS_FAULT__
@@ -856,7 +867,7 @@
 */
 #define __ASSERT_WITH_MESSAGE_ALWAYS(cond,message,function) \
 			__ASSERT_ALWAYS( (cond), ( \
-			DEBUGPRINT("Assertion failed: %s\nFunction: %s\n",message,function),\
+			DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER),\
 			NKFault(function, 0)))
 #else
 /**
@@ -864,7 +875,7 @@
 */
 #define __ASSERT_WITH_MESSAGE_ALWAYS(cond,message,function) \
 			__ASSERT_ALWAYS( (cond), \
-			DEBUGPRINT("Assertion failed: %s\nFunction: %s\n",message,function))
+			DEBUGPRINT("Assertion failed: %s\nFunction: %s; called from: %08x\n",message,function,PRECOND_FUNCTION_CALLER))
 #endif//__KERNEL_APIS_CONTEXT_CHECKS_FAULT__
 #endif//(!defined (__KERNEL_APIS_CONTEXT_CHECKS_WARNING__)&&!defined (__KERNEL_APIS_CONTEXT_CHECKS_FAULT__))
 
--- a/kernel/eka/kernel/arm/cache_external.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/kernel/arm/cache_external.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -308,8 +308,8 @@
 
 void ExternalCache::AtomicSync()
 	{
-	CHECK_PRECONDITIONS(MASK_INTERRUPTS_DISABLED,"ExternalCache::AtomicCleanAndInvalidate");				
-	__KTRACE_OPT(KMMU,Kern::Printf("ExternalCache::AtomicCleanAndInvalidate"));
+	CHECK_PRECONDITIONS(MASK_INTERRUPTS_DISABLED,"ExternalCache::AtomicSync");
+	__KTRACE_OPT(KMMU,Kern::Printf("ExternalCache::AtomicSync"));
 
 #if defined(__ARM_PL310_CACHE__)
 	// On Pl310, we hold the lock while maintaining cache. Therefore, we cannot
--- a/kernel/eka/kernel/arm/cache_maintenancev7.cia	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/kernel/arm/cache_maintenancev7.cia	Mon Jan 18 21:31:10 2010 +0200
@@ -81,19 +81,20 @@
 
 __NAKED__ void InternalCache::IMB_CacheLine(TLinAddr /*aAddr*/)
 	{
-	asm("mov r1, #0 "); //will need zero reg for coprocessor instructions
-//--Round the address down to the start of line--//
+    //--Determine base address of cache line--//
 	asm("ldr r2, __DCacheInfoPoU ");
 	asm("ldrh r3, [r2, #%a0]" : : "i" _FOFF(SCacheInfo,iLineLength));
-	asm("sub ip, r3, #1 ");		// ip=mask for offset within line
-	asm("bic r0, r0, ip ");		// r0 = cache line base
+	asm("sub ip, r3, #1");		// ip=mask for offset within line
+	asm("bic r2, r0, ip");      // r2 = cache line base
 
-	DCCMVAU(r0);				// Clean DCache line to Point-of-Unification
-	ARM_DSBSY;
-	ICIMVAU(r0);
-	BPIMVA(r0);
-	ARM_DSBSH;
-	ARM_ISBSY;
+	DCCMVAU(r2);                // Clean DCache line to Point-of-Unification
+	ARM_DSBSY;                  // Data Sync Barrier (system)
+	ICIMVAU(r2);                // Invalidate Instruction cache line to Point-of-Unification
+	BPIMVA(r0);                 // Invalidate aAddr from Branch Predictor Array
+	asm("add r0, r0, #2");
+	BPIMVA(r0);                 // Invalidate possible THUMB instuction at aAddr+2 from Branch Predictor Array
+	ARM_DSBSH;                  // Data Sync Barrier (system)
+	ARM_ISBSY;                  // Instruction Sync Barrier
 	__JUMP(,lr);
 	}
 
--- a/kernel/eka/kernel/sipc.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/kernel/sipc.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -546,6 +546,8 @@
 	NKern::ThreadEnterCS();
 	NKern::UnlockSystem();
 	TInt r = KErrNone;
+	TBool anyPins = EFalse;
+	TPinArray pinArray = { { 0, 0, 0, 0 } };			// local, copy to heap later if used
 
 	for (TInt i = 0; descFlags != 0; ++i, argPinFlags >>= 1, descFlags >>= TIpcArgs::KBitsPerType)
  		{
@@ -561,19 +563,11 @@
 			TUint pinLength = desInfo.IsWriteable() ? desInfo.MaxLength() : desInfo.Length();
 			if (pinLength)
 				{
-				if (!iPinArray)
-					{
-					iPinArray = new TPinArray;
-					if (!iPinArray)
-						{
-						r = KErrNoMemory;
-						break;
-						}
-					}
-
 				// This will only create and pin if the descriptor data is paged.
 				// An out-of-memory error here means we fail the whole operation.
-				r = Kern::CreateAndPinVirtualMemory(iPinArray->iPinPtrs[i], desInfo.DataPtr(), pinLength);
+				r = Kern::CreateAndPinVirtualMemory(pinArray.iPinPtrs[i], desInfo.DataPtr(), pinLength);
+				if (pinArray.iPinPtrs[i])
+					anyPins = ETrue;
 				if (r == KErrNoMemory)
 					break;
 				if (r != KErrNone)
@@ -589,24 +583,27 @@
 			}
 		}
 
+	if (anyPins && r != KErrNoMemory)
+		{
+		iPinArray = new TPinArray (pinArray);
+		if (!iPinArray)
+			r = KErrNoMemory;
+		}
+
 	if (r == KErrNoMemory)
 		{
 		// Failed to pin everything so clean up any pin objects created.
 		// This will also unpin any pinned memory.
-		if (iPinArray)
-			{
-			UnpinMessageArguments(iPinArray);
-			delete iPinArray;
-			iPinArray = NULL;
-			}
+		UnpinMessageArguments(&pinArray);
 		}
 
 	NKern::LockSystem();
 
 	// Remove the access on the session.
 	if (aSession->TotalAccessDec() == DObject::EObjectDeleted)
-		{// This was the last access on the session and it has been deleted so 
-		// don't access any of its members.
+		{
+		// This was the last access on the session and it has been deleted
+		// so don't access any of its members.
 		r = KErrDisconnected;
 		}
 	NKern::ThreadLeaveCS();
--- a/kernel/eka/kernel/skernel.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/kernel/skernel.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1666,8 +1666,8 @@
 */
 EXPORT_C TUint8* Kern::ChunkUserBase(DChunk* aChunk, DThread* aThread)
 	{
-	CHECK_PRECONDITIONS(MASK_NO_FAST_MUTEX,"Kern::ChunkUserAddress");		
-	__KTRACE_OPT(KMMU,Kern::Printf("Kern::ChunkUserAddress aChunk=%08x, aThread=%08x",  aChunk, aThread));
+	CHECK_PRECONDITIONS(MASK_NO_FAST_MUTEX,"Kern::ChunkUserBase");
+	__KTRACE_OPT(KMMU,Kern::Printf("Kern::ChunkUserBase aChunk=%08x, aThread=%08x", aChunk, aThread));
 	NKern::LockSystem();
 	TUint8* r = aChunk->Base(aThread->iOwningProcess);
 	NKern::UnlockSystem();
--- a/kernel/eka/kernel/sshbuf.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/kernel/sshbuf.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -849,7 +849,7 @@
 */
 EXPORT_C TInt Kern::ShBufMakeHandleAndOpen(TShBuf* aBuf, DThread* aThread)
 	{
-	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL, "Kern::ShPoolMakeHandleAndOpen");
+	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL, "Kern::ShBufMakeHandleAndOpen");
 
 	if (!aThread)
 		aThread = TheCurrentThread;
--- a/kernel/eka/kernel/sthread.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/kernel/sthread.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1678,7 +1678,7 @@
 */
 EXPORT_C void Kern::SetRealtimeState(TThreadRealtimeState aNewState)
 	{
-	CHECK_PRECONDITIONS(MASK_THREAD_STANDARD,"Kern::RequestComplete");
+	CHECK_PRECONDITIONS(MASK_THREAD_STANDARD,"Kern::SetRealtimeState");
 	TheCurrentThread->SetRealtimeState(aNewState);
 	}
 
--- a/kernel/eka/kernel/sutils.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/kernel/sutils.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1924,8 +1924,8 @@
 EXPORT_C DProcess* Kern::ProcessFromId(TUint aId)
 	{
 	DObjectCon& processes=*K::Containers[EProcess];
-	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"Kern::ProcessFromId");				
-	__ASSERT_WITH_MESSAGE_MUTEX(processes.Lock(),"Process container mutex must be held","Kern::ThreadFromId");			
+	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"Kern::ProcessFromId");
+	__ASSERT_WITH_MESSAGE_MUTEX(processes.Lock(),"Process container mutex must be held","Kern::ProcessFromId");
 	//end of preconditions check
 	TInt c=processes.Count();
 	TInt i;
@@ -3033,10 +3033,17 @@
 		}
 	if (!m)
 		return KErrNone;
-	if (aFunction)
-		Kern::Printf("In function %s :-", aFunction);
-	else
-		Kern::Printf("At address %08x :-", aAddr);
+	if (aFunction && aAddr)
+		{
+		Kern::Printf("In function %s called from %08x :-", aFunction, aAddr);
+		}
+	else 
+		{
+		if (aFunction)
+			Kern::Printf("In function %s :-", aFunction);
+		else
+			Kern::Printf("At address %08x :-", aAddr);
+		}
 	if (m & MASK_NO_FAST_MUTEX)
 		Kern::Printf("Assertion failed: No fast mutex must be held");
 	if (m & MASK_NO_CRITICAL)
@@ -4431,7 +4438,7 @@
 */
 EXPORT_C TInt Kern::CreatePhysicalPinObject(TPhysicalPinObject*& aPinObject)
 	{
-	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"Kern::CreateVirtualPinObject");			
+	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"Kern::CreatePhysicalPinObject");
 	return M::CreatePhysicalPinObject(aPinObject);
 	}
 
--- a/kernel/eka/memmodel/epoc/flexible/arm/xsched.cia	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/arm/xsched.cia	Mon Jan 18 21:31:10 2010 +0200
@@ -176,10 +176,15 @@
 
 	// restore alias...
 	asm("got_alias:");
+	// Disable interrupts so setting the alias pde is must complete before
+	// Mmu::RemoveAliasesForPageTable() can execute the alias IPI and vice 
+	// versa.
+	__ASM_CLI();						// interrupts off
 	asm("ldr r8, [r3, #%a0]" : : "i" (_FOFF(DMemModelThread, iAliasPdePtr)-_FOFF(DThread, iNThread)) );
 	asm("ldr r7, [r3, #%a0]" : : "i" (_FOFF(DMemModelThread, iAliasPde)-_FOFF(DThread, iNThread)) );
 	asm("orr r6, r6, r4");				// put ASID into address for TLB flush later...
 	asm("str r7, [r8]");				// restore PDE for alias
+	__ASM_STI();						// interrupts back on
 	
 	CACHE_MAINTENANCE_PDE_PTE_UPDATED(r8);
 
--- a/kernel/eka/memmodel/epoc/flexible/mmu/arm/xmmu.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/arm/xmmu.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -439,7 +439,7 @@
 	{
 	// reuse existing functions rather than duplicating the logic
 	TPde pde = BlankPde(aAttributes);
-	TPde pte = BlankPte(aAttributes, aPteType);
+	TPte pte = BlankPte(aAttributes, aPteType);
 	return PageToSectionEntry(pte, pde);
 	}
 
@@ -882,11 +882,13 @@
 	// Now we have the os asid check access to kernel memory.
 	if(aAddr >= KUserMemoryLimit && osAsid != (TUint)KKernelOsAsid)
 		{
+		NKern::ThreadEnterCS();
+		MmuLock::Unlock();
 		if (!iAliasLinAddr)
 			{// Close the new reference as RemoveAlias won't do as iAliasLinAddr is not set.
-			aProcess->AsyncCloseOsAsid();
+			aProcess->AsyncCloseOsAsid();	// Asynchronous close as this method should be quick.
 			}
-		MmuLock::Unlock();
+		NKern::ThreadLeaveCS();
 		return KErrBadDescriptor; // prevent access to supervisor only memory
 		}
 
@@ -896,13 +898,15 @@
 		// address is in global section, don't bother aliasing it...
 		if (!iAliasLinAddr)
 			{// Close the new reference as not required.
-			aProcess->AsyncCloseOsAsid();
+			NKern::ThreadEnterCS();
+			MmuLock::Unlock();
+			aProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
+			NKern::ThreadLeaveCS();
 			}
 		else
 			{// Remove the existing alias as it is not required.
-			DoRemoveAlias(iAliasLinAddr);
+			DoRemoveAlias(iAliasLinAddr);	// Releases mmulock.
 			}
-		MmuLock::Unlock();
 		aAliasAddr = aAddr;
 		TInt maxSize = KChunkSize-(aAddr&KChunkMask);
 		aAliasSize = aSize<maxSize ? aSize : maxSize;
@@ -982,9 +986,7 @@
 		{
 		MmuLock::Lock();
 
-		DoRemoveAlias(addr);
-
-		MmuLock::Unlock();
+		DoRemoveAlias(addr);	// Unlocks mmulock.
 		}
 	}
 
@@ -993,6 +995,7 @@
 Remove the alias mapping.
 
 @pre Mmulock held
+@post MmuLock released.
 */
 void DMemModelThread::DoRemoveAlias(TLinAddr aAddr)
 	{
@@ -1011,10 +1014,16 @@
 	NKern::EndFreezeCpu(iCpuRestoreCookie);
 	iCpuRestoreCookie = -1;
 #endif
-	// Must close the os asid while the mmu lock is held to prevent it being 
-	// leaked, however this requires that it is closed asynchronously as can't
-	// delete os asid with mmu lock held.
-	iAliasProcess->AsyncCloseOsAsid();
+
+	// Must close the os asid while in critical section to prevent it being 
+	// leaked.  However, we can't hold the mmu lock so we have to enter an 
+	// explict crtical section. It is ok to release the mmu lock as the 
+	// iAliasLinAddr and iAliasProcess members are only ever updated by the 
+	// current thread.
+	NKern::ThreadEnterCS();
+	MmuLock::Unlock();
+	iAliasProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
+	NKern::ThreadLeaveCS();
 	}
 
 
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mmu.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mmu.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -701,6 +701,7 @@
 	//   which has a reference on it's process, which should own the address space!
 
 #ifdef __BROADCAST_CACHE_MAINTENANCE__
+	TInt aliasAsid = -1;
 	if (thread->iAliasLinAddr)
 		{
 		// If an alias is in effect, the the thread will be locked to the current CPU,
@@ -713,6 +714,12 @@
 			__KTRACE_OPT2(KPAGING,KPANIC,Kern::Printf("Fault with thread locked to current CPU! addr=0x%08x (%O pc=%x)",aFaultAddress,thread,aPc));
 			Exc::Fault(aExceptionInfo);
 			}
+		// Open a reference on the aliased process's os asid before removing the alias
+		// so that the address space can't be freed while we try to access its members.
+		aliasAsid = thread->iAliasProcess->TryOpenOsAsid();
+		// This should never fail as until we remove the alias there will 
+		// always be at least one reference on the os asid.
+		__NK_ASSERT_DEBUG(aliasAsid >= 0);
 		thread->RemoveAlias();
 		}
 #endif
@@ -783,6 +790,15 @@
 		DMemModelThread::RestoreAddressSpace();
 		}
 
+#ifdef __BROADCAST_CACHE_MAINTENANCE__
+	// Close any reference on the aliased process's os asid before we leave the
+	// critical section.
+	if (aliasAsid >= 0)
+		{
+		thread->iAliasProcess->CloseOsAsid();
+		}
+#endif
+
 	NKern::ThreadLeaveCS();  // thread will die now if CheckRealtimeThreadFault caused a panic
 
 	// deal with XTRAP_PAGING...
@@ -1284,6 +1300,56 @@
 	iCount = 0;
 	}
 
+#ifdef __SMP__
+/**
+Dummy IPI to be invoked when a thread's alias pde members are updated remotely
+by another thread.
+
+@internalComponent
+*/
+class TAliasIPI : public TGenericIPI
+	{
+public:
+	static void RefreshIsr(TGenericIPI*);
+	void RefreshAlias();
+	};
+
+
+/**
+Dummy isr method.
+*/
+void TAliasIPI::RefreshIsr(TGenericIPI*)
+	{
+	TRACE2(("TAliasIPI"));
+	}
+
+
+/**
+Queue the dummy IPI on all other processors.  This ensures that DoProcessSwitch will
+have completed updating iAliasPdePtr once this method returns.
+*/
+void TAliasIPI::RefreshAlias()
+	{
+	NKern::Lock();
+	QueueAllOther(&RefreshIsr);
+	NKern::Unlock();
+	WaitCompletion();
+	}
+
+
+/** 
+Perform a dummy ipi on all the other processors to ensure if any of them are 
+executing DoProcessSwitch they will see the new value of iAliasPde before they 
+update iAliasPdePtr or will finish updating iAliasPdePtr before we continue.  
+This works as DoProcessSwitch() has interrupts disabled while reading iAliasPde 
+and updating iAliasPdePtr.
+*/
+void BroadcastAliasRefresh()
+	{
+	TAliasIPI ipi;
+	ipi.RefreshAlias();
+	}
+#endif //__SMP__
 
 /**
 Remove any thread IPC aliases which use the specified page table.
@@ -1311,11 +1377,12 @@
 			TRACE2(("Thread %O RemoveAliasesForPageTable", this));
 			thread->iAliasPde = KPdeUnallocatedEntry;
 #ifdef __SMP__ // we need to also unmap the page table in case thread is running on another core...
-			// need Data Memory Barrier (DMB) here to make sure iAliasPde change is
-			// seen before we set the PDE entry, otherwise 'thread' may read old value
-			// and put it back
-			__e32_memory_barrier();
+
+			// Ensure other processors see the update to iAliasPde.
+			BroadcastAliasRefresh();
+
 			*thread->iAliasPdePtr = KPdeUnallocatedEntry;
+
 			SinglePdeUpdated(thread->iAliasPdePtr);
 			__NK_ASSERT_DEBUG((thread->iAliasLinAddr&KPageMask)==0);
 			// Invalidate the tlb for the page using os asid of the process that created the alias
@@ -1325,9 +1392,6 @@
 			// note, race condition with 'thread' updating its iAliasLinAddr is
 			// not a problem because 'thread' will not the be accessing the aliased
 			// region and will take care of invalidating the TLB.
-			// FIXME: There is still a race here. If the thread owning the alias reads the
-			// PDE before we clear thread->iAliasPde and writes it after we clear
-			// *thread->iAliasPdePtr the alias still ends up restored when it shouldn't be.
 #endif
 			}
 		MmuLock::Flash();
--- a/kernel/eka/memmodel/epoc/flexible/mmu/x86/xmmu.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/x86/xmmu.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -572,11 +572,13 @@
 	// Now we have the os asid check access to kernel memory.
 	if(aAddr >= KUserMemoryLimit && osAsid != (TUint)KKernelOsAsid)
 		{
+		NKern::ThreadEnterCS();
+		MmuLock::Unlock();
 		if (!iAliasLinAddr)
 			{// Close the new reference as RemoveAlias won't do as iAliasLinAddr is not set.
-			aProcess->AsyncCloseOsAsid();
+			aProcess->AsyncCloseOsAsid();	// Asynchronous close as this method should be quick.
 			}
-		MmuLock::Unlock();
+		NKern::ThreadLeaveCS();
 		return KErrBadDescriptor; // prevent access to supervisor only memory
 		}
 
@@ -586,13 +588,15 @@
 		// address is in global section, don't bother aliasing it...
 		if (!iAliasLinAddr)
 			{// Close the new reference as not required.
-			aProcess->AsyncCloseOsAsid();
+			NKern::ThreadEnterCS();
+			MmuLock::Unlock();
+			aProcess->AsyncCloseOsAsid();	// Asynchronous close as this method should be quick.
+			NKern::ThreadLeaveCS();
 			}
 		else
 			{// Remove the existing alias as it is not required.
-			DoRemoveAlias(iAliasLinAddr);
+			DoRemoveAlias(iAliasLinAddr);	// Releases mmulock.
 			}
-		MmuLock::Unlock();
 		aAliasAddr = aAddr;
 		TInt maxSize = KChunkSize-(aAddr&KChunkMask);
 		aAliasSize = aSize<maxSize ? aSize : maxSize;
@@ -666,9 +670,7 @@
 		{
 		MmuLock::Lock();
 
-		DoRemoveAlias(addr);
-
-		MmuLock::Unlock();
+		DoRemoveAlias(addr);	// Unlocks mmulock.
 		}
 	}
 
@@ -692,10 +694,16 @@
 	NKern::EndFreezeCpu(iCpuRestoreCookie);
 	iCpuRestoreCookie = -1;
 #endif
-	// Must close the os asid while the mmu lock is held to prevent it being 
-	// leaked, however this requires that it is closed asynchronously as can't
-	// delete os asid with mmu lock held.
-	iAliasProcess->AsyncCloseOsAsid();
+
+	// Must close the os asid while in critical section to prevent it being 
+	// leaked.  However, we can't hold the mmu lock so we have to enter an 
+	// explict crtical section. It is ok to release the mmu lock as the 
+	// iAliasLinAddr and iAliasProcess members are only ever updated by the 
+	// current thread.
+	NKern::ThreadEnterCS();
+	MmuLock::Unlock();
+	iAliasProcess->AsyncCloseOsAsid();	// Asynchronous close as this method should be quick.
+	NKern::ThreadLeaveCS();
 	}
 
 
--- a/kernel/eka/memmodel/epoc/flexible/mprocess.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mprocess.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -56,6 +56,7 @@
 	DProcess::Destruct();
 	}
 
+
 TInt DMemModelProcess::TryOpenOsAsid()
 	{
 	if (__e32_atomic_tas_ord32(&iOsAsidRefCount, 1, 1, 0))
@@ -65,6 +66,7 @@
 	return KErrDied;
 	}
 
+
 void DMemModelProcess::CloseOsAsid()
 	{
 	if (__e32_atomic_tas_ord32(&iOsAsidRefCount, 1, -1, 0) == 1)
@@ -73,6 +75,7 @@
 		}
 	}
 
+
 void DMemModelProcess::AsyncCloseOsAsid()
 	{
 	if (__e32_atomic_tas_ord32(&iOsAsidRefCount, 1, -1, 0) == 1)
@@ -81,6 +84,7 @@
 		}
 	}
 
+
 TInt DMemModelProcess::NewChunk(DChunk*& aChunk, SChunkCreateInfo& aInfo, TLinAddr& aRunAddr)
 	{
 	aChunk=NULL;
--- a/kernel/eka/memmodel/epoc/flexible/mshbuf.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mshbuf.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -766,7 +766,7 @@
 		++i;
 		}
 
-	__KTRACE_OPT(KMMU, Kern::Printf("<MemModelAlignedShPool::DestroyMappings"));
+	__KTRACE_OPT(KMMU, Kern::Printf("<DMemModelAlignedShPool::DestroyMappings"));
 
 	return r;
 	}
--- a/kernel/eka/memmodel/epoc/flexible/x86/xsched.cia	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/x86/xsched.cia	Mon Jan 18 21:31:10 2010 +0200
@@ -52,10 +52,15 @@
 	asm("jz done");
 
 	// restore alias...
+	// Disable interrupts so setting the alias pde is must complete before
+	// Mmu::RemoveAliasesForPageTable() can execute the alias IPI and vice 
+	// versa.
+	asm("cli ");					// turn off interrupts
 	asm("mov edx, [ebx+%0]": : "i"_FOFF(DMemModelThread,iAliasPdePtr));
 	asm("mov eax, [ebx+%0]": : "i"_FOFF(DMemModelThread,iAliasPde));
 	asm("mov [edx], eax");
 	asm("invlpg [ecx]");
+	asm("sti ");					// turn on interrupts
 
 	asm("done:");
 	asm("ret");
--- a/kernel/eka/memmodel/epoc/mmubase/ramalloc.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/memmodel/epoc/mmubase/ramalloc.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -2827,7 +2827,7 @@
 			{
 			Panic(EZonesCallbackErr);
 			}
-		CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL, "DRamAllocator::ZoneAllocPages");
+		CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL, "DRamAllocator::InitialCallback");
 		}
 	iZoneCallbackInitSent = ETrue;
 	}
--- a/kernel/eka/memmodel/epoc/moving/arm/xmmu.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/memmodel/epoc/moving/arm/xmmu.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -759,7 +759,7 @@
 // Call this with the system locked.
 //
 	{
-	__KTRACE_OPT(KMMU,Kern::Printf("ArmMmu::RemapPages() id=%d addr=%08x old=%08x new=%08x perm=%08x", aId, aAddr, aOldAddr, aNewAddr, aPtePerm));
+	__KTRACE_OPT(KMMU,Kern::Printf("ArmMmu::RemapPage() id=%d addr=%08x old=%08x new=%08x perm=%08x", aId, aAddr, aOldAddr, aNewAddr, aPtePerm));
 
 	TInt ptOffset=(aAddr&KChunkMask)>>KPageShift;			// entry number in page table
 	TPte* pPte=PageTable(aId)+ptOffset;						// address of PTE
@@ -785,7 +785,7 @@
 		}
 	else
 		{
-		__KTRACE_OPT(KMMU,Kern::Printf("ArmMmu::RemapPages() called on a non-4K page!"));
+		__KTRACE_OPT(KMMU,Kern::Printf("ArmMmu::RemapPage() called on a non-4K page!"));
 		Panic(ERemapPageFailed);
 		}
 	}
--- a/kernel/eka/memmodel/epoc/moving/mchunk.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/memmodel/epoc/moving/mchunk.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -728,7 +728,7 @@
 		}
 	if (iSize==0 && (iAttributes&EFixedAddress)==0)
 		{
-		__KTRACE_OPT(KMMU,Kern::Printf("DMemModelChunk::Adjust remove region"));
+		__KTRACE_OPT(KMMU,Kern::Printf("DMemModelChunk::DoDecommit remove region"));
 		NKern::LockSystem();
 		if (TLinAddr(iBase)==iHomeBase)
 			iBase=NULL;
--- a/kernel/eka/nkern/arm/ncutils.cia	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/nkern/arm/ncutils.cia	Mon Jan 18 21:31:10 2010 +0200
@@ -364,8 +364,9 @@
 	// set r2 = context id
 	asm("ldrb	r4, [lr, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
 	asm("mrs	r2, cpsr");
-	asm("and	r2, r2, #3");
+	asm("and	r2, r2, #0x0f");
 	asm("cmp	r2, #3");
+	asm("movhi	r2, #2");		// r2 = context ID => 1 for FIQ, 2 for IRQ/ABT/UND/SYS
 	asm("cmpeq	r4, #0");
 	asm("ldreq	r2, [lr, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
 
@@ -399,8 +400,9 @@
 	// set r2 = context id
 	asm("ldrb	r4, [lr, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
 	asm("mrs	r2, cpsr");
-	asm("and	r2, r2, #3");
+	asm("and	r2, r2, #0x0f");
 	asm("cmp	r2, #3");
+	asm("movhi	r2, #2");		// r2 = context ID => 1 for FIQ, 2 for IRQ/ABT/UND/SYS
 	asm("cmpeq	r4, #0");
 	asm("ldreq	r2, [lr, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
 
@@ -423,8 +425,9 @@
 	asm("stmdb	sp!, {lr}");
 	asm("ldrb	lr, [r12, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
 	asm("mrs	r4, cpsr");
-	asm("and	r4, r4, #3");
+	asm("and	r4, r4, #0x0f");
 	asm("cmp	r4, #3");
+	asm("movhi	r4, #2");		// r4 = context ID => 1 for FIQ, 2 for IRQ/ABT/UND/SYS
 	asm("cmpeq	lr, #0");
 	asm("ldreq	r4, [r12, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
 	asm("stmdb	sp!, {r4}");
@@ -469,8 +472,9 @@
 	asm("mrs	r2, cpsr");
 	// r2 = cpsr
 	asm("ldrb	lr, [r12, #%a0]" : : "i" _FOFF(TScheduler,iInIDFC));
-	asm("and	r4, r2, #3");
+	asm("and	r4, r2, #0x0f");
 	asm("cmp	r4, #3");
+	asm("movhi	r4, #2");		// r4 = context ID => 1 for FIQ, 2 for IRQ/ABT/UND/SYS
 	asm("cmpeq	lr, #0");
 	asm("ldreq	lr, [r12, #%a0]" : : "i" _FOFF(TScheduler,iKernCSLocked));
 	asm("ldreq	r4, [r12, #%a0]" : : "i" _FOFF(TScheduler,iCurrentThread));
@@ -525,7 +529,6 @@
 	__POPRET("r4-r6,");
 	}
 
-
 __NAKED__ EXPORT_C TBool BTrace::OutFiltered(TUint32 a0, TUint32 a1, TUint32 a2, TUint32 a3)
 	{
 	// fall through to OutFilteredX...
--- a/kernel/eka/nkern/nk_timer.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/nkern/nk_timer.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -460,7 +460,7 @@
 			// if first ordered queue entry expires in <32ms, queue the DFC to transfer
 			NTimer* pC=(NTimer*)iOrderedQ.First();
 #ifdef __EPOC32__
-			__ASSERT_WITH_MESSAGE_DEBUG(iMsCount<=pC->iTriggerTime, "iMsCount has exceeded pC->iTriggerTime; function called later than expected ","NKTimer::Tick()");
+			__ASSERT_WITH_MESSAGE_DEBUG(iMsCount<=pC->iTriggerTime, "iMsCount has exceeded pC->iTriggerTime; function called later than expected ","NTimerQ::Tick()");
 #endif
 			if (TInt(pC->iTriggerTime-iMsCount)<ENumTimerQueues)
 				doDfc=TRUE;
--- a/kernel/eka/nkernsmp/nk_irq.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/nkernsmp/nk_irq.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -743,7 +743,7 @@
 	{
 	TRACE_IRQ4(8, aId);
 	__KTRACE_OPT(KNKERN,DEBUGPRINT(">NKIU: ID=%08x", aId));
-	CHECK_PRECONDITIONS(MASK_THREAD_STANDARD,"NKern::InterruptBind");
+	CHECK_PRECONDITIONS(MASK_THREAD_STANDARD,"NKern::InterruptUnbind");
 	NIrq* pI;
 	NIrqHandler* pH;
 	TInt r = NIrq::FromHandle(aId, pI, pH);
--- a/kernel/eka/release.txt	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/release.txt	Mon Jan 18 21:31:10 2010 +0200
@@ -1,3 +1,111 @@
+Version 2.00.2063
+=================
+(Made by vfebvre 16/12/2009)
+
+1.	MichaelP
+	1.	DEFECT FIX: DEF143310: DMA Framework makes use of PRM difficult
+		Introduced new virtual DMA PIL function TDmaChannel::QueuedRequestCountChanged()
+		which can be overridden in a DMA PSL to implement channel/DMAC power management
+		functionality outside of any PIL mutexes. For details see the description in
+		/os/kernelhwsrv/kernel/eka/include/drivers/dma_v1.h.
+
+
+Version 2.00.2062
+=================
+(Made by vfebvre 15/12/2009)
+
+1.	cnotton
+	1.	MINOR_CHANGE Added a few missing headers for when SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT is enabled.
+
+
+Version 2.00.2061
+=================
+(Made by VincentF 14/12/2009)
+
+1.	gcochran
+	1.	DEF142419: Kernel doesn't flush prefetch buffer properly
+
+
+Version 2.00.2060
+=================
+(Made by VincentF 10/12/2009)
+
+1.	TomCosgrove
+	1.	MINOR_CHANGE: Fix function names given in various trace and precondition statements
+	2.	DEFECT FIX: DEF143168: Kernel precondition checks don't give any indication of the caller
+		Added compiler-specific macro PRECOND_FUNCTION_CALLER, defaulting to 0 if not present, and
+		use this in CHECK_PRECONDITIONS() and the various __ASSERT_WITH_MESSAGE_*() macros.  Also
+		updated CheckPreconditions() to print this address even if the function name is given (as
+		it is when called from the C macros).
+	3.	DEFECT FIX: DEF143237: SBTraceData::CheckFilter2() causes issues when executed with undefined CPU mode
+		Don't just take the CPSR & 0x03 to get the context value, since undef (etc) mode gets
+		confused with thread (normal supervisor) mode.  Instead, AND with 0x0f and set to 2 if
+		higher than 3.
+
+2.	DjordjeK
+	1.	DEFECT FIX: DEF143166: 	Default caching of page tables on 1136 flexible memory model is wrong
+		Fixed the problem with caching attributes (of page tables, code & exception vector) on 1136
+		running flexible memory model. Platforms other then 1136 are not affected.
+
+3.	kingbozhang
+	1.	DEFECT FIX: DEF142623: TKEA-7WJC4S:[OTG] A malfunctioning peripheral cannot be reported to the UI
+		This defect is some USB devices do not comply with USB2.0 spec. Because they drive VBus of
+		their upstream port, however, such behaviour is forbidden in USB2.0.
+
+4.	DaveGordon
+	1.	DEFECT FIX: DEF141546: T_CPUTIME fails on SMPPAGE/SMPDATAPAGE ROMs...
+		Improve test by making sure threads are bound to the right cores
+	2.	DEFECT FIX: DEF143303: Crash unpinning message descriptors
+		Pinning operation now uses an initialised local array to hold potential references to pin
+		objects, and then transfers them all into a heap-allocated object only if at least one
+		such reference was created, ensuring that the subsequent unpin sees only good values.
+
+5.	stmansfi
+	1.	MINOR_CHANGE Update header comments in HCR PIL files
+
+6.	vfebvre
+	1.	MINOR_CHANGE Rename Bld.inf to bld.inf (for DEF142518)
+
+7.	kunmitta
+	1.	MINOR_CHANGE Added library names in compsupp explicitly for RVCT4.0 linkage
+
+8.	cnotton
+	1.	MINOR_CHANGE Fixed T_SMPSOAKSPIN.CPP for e32svr.h.
+	2.	DEFECT FIX: DEF143216: btrace.iby does not load btracex.ldd as an extension
+
+
+Version 2.00.2059
+=================
+(Made by VincentF 03/12/2009)
+
+1.	MichaelP
+	1.	MILESTONE: GT0515, MS3.15
+		RM-RIM REQ417-52838:FEA417-62893 DMA Upgrade : Client Callback from ISR
+		Gaia Feature Release 428985 Package Release 428988
+	2.	DEFECT FIX: DEF143285: t_dma and t_dma2 test failures
+
+2.	MarkTa
+	1.	DEFECT FIX: DEF143220: Flexible memory model - Aliasing can cause the system to crash.
+		Fix various race conditions in the flexible memory model's handling of aliasing.
+
+3.	RyanHarkin
+	1.	MINOR_CHANGE: Removed SYMBIAN_BASE_USE_GCE from header.iby files as this broke the build
+	2.	MINOR_CHANGE: Tidy up naviengine.h and naviengine_priv.h
+	3.	MINOR_CHANGE: Update NaviEngine release.txt because nobody else has
+	4.	MINOR_CHANGE: Remove commented out code from csi.mmp
+	5.	MINOR_CHANGE: updated NaviEngine User Guide
+	6.	MINOR_CHANGE: Bootloader OBY file bootbinary directive fixed
+
+4.	RichardCo
+	1.	DEFECT FIX: DEF142738: T_SMPSAFE fails on SMP unicore
+
+5.	erifung
+	1.	DEFECT FIX: DEF142542: Bridge: t_dobject fails on 8500..
+
+6.	cnotton
+	1.	DEFECT FIX: DEF143224: Move TFlowControl to a published header
+
+
 Version 2.00.2058
 =================
 (Made by vinojose 03/12/2009)
@@ -9,31 +117,28 @@
 2.	NeilClifford
 	1.	DEFECT FIX: DEF143039: MedMMC should not use Cache for Physical Address Requests
 
-3.	RichardCo
-	1.	DEFECT FIX: DEF142738: T_SMPSAFE fails on SMP unicore
-
-4.	MarkTa
+3.	MarkTa
 	1.	DEFECT FIX: DEF143129: WDP - Allocating a demand paged page table can fault the system 
 		Implement on demand stealing of paged page tables when allocating paged page tables.
 
-5.	StephenSun
+4.	StephenSun
 	1.	DEFECT FIX: DEF142844: initialize SRP timeout
 
-6.	OliverStuart
+5.	OliverStuart
 	1.	DEFECT FIX: DEF142840: KERN-EXEC 3 panics in T_SHBUF_PERF
 		Must use kumemget to read TPtr8 from user memory.
 
-7.	LaneRoberts
+6.	LaneRoberts
 	1.	DEFECT FIX: DEF143152: NaviEngine ARM4 ROMs cannot be built
 
-8. ChrisBeale
+7. ChrisBeale
 	1.	DEFECT FIX: DEF143114: FMM thrashing monitor timer runs even when device is idle 
 
-9.	cnotton
+8.	cnotton
 	1.	MINOR_CHANGE: Fix SMP Soak test for Header File Relocation
 	2.	DEFECT FIX: DEF143183: CTS79_MCL_wk46: TB92_200945 symbian tests compilation errors
 
-10.	lanerobe
+9.	lanerobe
 	1.	DEFECT FIX: DEFECT FIX: DEF141811: T_MSTIM on Unicore SMP (Naviengine) Image
 
 Version 2.00.2057
--- a/kernel/eka/rombuild/btrace.iby	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/rombuild/btrace.iby	Mon Jan 18 21:31:10 2010 +0200
@@ -18,7 +18,7 @@
 #ifndef BTRACE_INCLUDED
 #define BTRACE_INCLUDED
 
-data=KERNEL_DIR\DEBUG_DIR\BTRACEX_LDD	\sys\bin\btracex.ldd
+ROM_IMAGE[0] extension[VARID]=KERNEL_DIR\DEBUG_DIR\BTRACEX_LDD	\sys\bin\btracex.ldd
 file=ABI_DIR\DEBUG_DIR\btracec.dll	\sys\bin\btracec.dll
 
 #endif
\ No newline at end of file
--- a/kernel/eka/rombuild/ubootldr.oby	Thu Jan 07 13:38:45 2010 +0200
+++ b/kernel/eka/rombuild/ubootldr.oby	Mon Jan 18 21:31:10 2010 +0200
@@ -20,7 +20,7 @@
 #include <rom\##VARIANT##\header.iby>
 
 files=
-bootbinary=\Epoc32\Release\##MAIN##\_##VARIANT##_bootloader_bootrom.bin
+bootbinary=\Epoc32\Release\##KMAIN##\_##VARIANT##_bootloader_bootrom.bin
 
 #include <rom\##VARIANT##\kernel.iby>
 #include "user.iby"
--- a/kerneltest/e32test/defrag/d_pagemove.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/defrag/d_pagemove.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -42,9 +42,6 @@
 const TInt KMinorVersionNumber=1;
 const TInt KBuildVersionNumber=1;
 
-
-_LIT(KLddName,"PageMove");
-
 class DPageMove;
 
 class DPageMoveFactory : public DLogicalDevice
@@ -104,7 +101,7 @@
 // Install the LDD - overriding pure virtual
 //
     {
-    return SetName(&KLddName);
+    return SetName(&KPageMoveLddName);
     }
 
 void DPageMoveFactory::GetCaps(TDes8& aDes) const
@@ -327,13 +324,18 @@
 	}
 
 
+#ifndef __MSVC6__ 	// VC6 can't cope with variable arguments in macros.
+#define KERN_PRINTF(x...) Kern::Printf(x)
+#endif
+
 //#define EXTRA_TRACE
 #ifdef EXTRA_TRACE
-#define KERN_PRINTF(x...) Kern::Printf(x)
+#define PRINTF(x)	x
 #else
-#define KERN_PRINTF(x...)
+#define PRINTF(x)
 #endif
 
+
 TInt DPageMove::KernelDataMovePerformance(void)
 {
 	const TInt KHeapPagesToMove = 2000;
@@ -364,7 +366,7 @@
 		heapArray[i] = i;
 		}
 
-	KERN_PRINTF("Testing Performance of Moving Kernel Data Pages");
+	PRINTF(KERN_PRINTF("Testing Performance of Moving Kernel Data Pages"));
 
 	TInt moveMode = EKMoveStack;
 	for (; moveMode < EKMoveModes; moveMode++)
@@ -379,14 +381,14 @@
 				baseAddr = pageAddr;
 				endAddr = _ALIGN_UP((TLinAddr)heapArray + heapArraySize, iPageSize);
 				actualHeapPages = (endAddr - baseAddr) / iPageSize;
-				KERN_PRINTF("heap baseAddr %x endAddr %x", baseAddr, endAddr);
+				PRINTF(KERN_PRINTF("heap baseAddr %x endAddr %x", baseAddr, endAddr));
 				break;
 
 			case EKMoveStack:
 				pageAddr = _ALIGN_DOWN((TLinAddr)stackArray, iPageSize);
 				baseAddr = pageAddr;
 				endAddr = _ALIGN_UP((TLinAddr)stackArray + KStackSize, iPageSize);
-				KERN_PRINTF("stack baseAddr %x endAddr %x", baseAddr, endAddr);
+				PRINTF(KERN_PRINTF("stack baseAddr %x endAddr %x", baseAddr, endAddr));
 				break;
 			}
 
--- a/kerneltest/e32test/defrag/d_pagemove.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/defrag/d_pagemove.h	Mon Jan 18 21:31:10 2010 +0200
@@ -23,6 +23,8 @@
 #endif
 
 
+_LIT(KPageMoveLddName,"d_pagemove");
+
 class TCapsPageMoveV01
 	{
 public:
@@ -66,7 +68,10 @@
 #ifndef __KERNEL_MODE__
 inline TInt RPageMove::Open()
 	{
-	return DoCreate(_L("PageMove"),TVersion(0,1,1),KNullUnit,NULL,NULL);
+	TInt r=User::LoadLogicalDevice(KPageMoveLddName);
+	if(r==KErrNone || r==KErrAlreadyExists)
+		r=DoCreate(KPageMoveLddName,TVersion(0,1,1),KNullUnit,NULL,NULL);
+	return r;
 	}
 
 inline TInt RPageMove::TryMovingKHeap()
--- a/kerneltest/e32test/dma/d_dma.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/dma/d_dma.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -128,6 +128,9 @@
 		if (r != KErrNone)
 			Epoc::FreePhysicalRam(phys, aSize);
 		iBufs[aIdx].iSize = aSize;
+		
+		__KTRACE_OPT(KDMA, Kern::Printf("TBufferMgr::Alloc buffer %d linAddr=0x%08x, physAddr=0x%08x, size=%d",
+					aIdx, Addr(aIdx), PhysAddr(aIdx), Size(aIdx)));
 		}
 	NKern::ThreadLeaveCS();
 	return r;
@@ -155,6 +158,8 @@
 
 #endif
 
+
+#ifndef DMA_APIV2
 static TInt FragmentCount(DDmaRequest* aRequest)
 	{
 	TInt count = 0;
@@ -162,6 +167,8 @@
 		count++;
 	return count;
 	}
+#endif
+
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -321,8 +328,11 @@
 		while (p < end)
 			if (*p++ != val)
 				{
-				__KTRACE_OPT(KDMA, Kern::Printf("Check DMA buffer failed offset: %d value: %d",
-												p-iBufMgr.Addr(i)-1, *(p-1)));
+#ifdef _DEBUG
+				const TUint8 prevValue = *(p-1);
+#endif
+				__KTRACE_OPT(KDMA, Kern::Printf("Check DMA buffer number %d failed at offset: %d value: %d(%c)",
+												i, p-iBufMgr.Addr(i)-1, prevValue, prevValue));
 				return EFalse;
 				}
 		return ETrue;
@@ -361,7 +371,11 @@
 		{
 		TInt reqIdx = (TInt)a1;
 		__ASSERT_DEBUG(0 <= reqIdx && reqIdx < KMaxRequests, Kern::PanicCurrentThread(KClientPanicCat, __LINE__));
+#ifdef DMA_APIV2
+		return iRequests[reqIdx]->FragmentCount();
+#else
 		return FragmentCount(iRequests[reqIdx]);
+#endif
 		}
 	case RTestDma::EMissInterrupts:
 		return iChannel->MissNextInterrupts((TInt)a1);
@@ -376,6 +390,8 @@
 	{
 	TBuf8<64> cmd;
 	Kern::KUDesGet(cmd, aDes);
+	__KTRACE_OPT(KDMA, Kern::Printf("DDmaTestChannel::Execute cmd=%S", &cmd));
+
 	const TText8* p = cmd.Ptr();
 	const TText8* pEnd = p + cmd.Length();
 	while (p<pEnd)
--- a/kerneltest/e32test/dma/t_dma.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/dma/t_dma.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -896,6 +896,7 @@
 		User::SetProcessCritical(User::ESystemCritical);
 		}
 
+
 	TInt r;
 #if defined(__DMASIM__) && defined(__WINS__)
 	test.Next(_L("Loading DMA simulator"));
@@ -906,15 +907,38 @@
 	test.Next(_L("Loading test LDD"));
 #ifdef __DMASIM__
 	r = User::LoadLogicalDevice(_L("D_DMASIM"));
+	test(r == KErrNone || r == KErrAlreadyExists);
 #else
-	r = User::LoadLogicalDevice(_L("D_DMA"));
-	if (r == KErrNotFound)
+	//load either the original test ldd, d_dma.ldd,
+	//or d_dma_compat.ldd - an ldd providing the same interface
+	//but linked against the new MHA dma framework
+	_LIT(KDma, "D_DMA.LDD");
+	r = User::LoadLogicalDevice(KDma);
+	const TBool dmaPresent = (r == KErrNone || r == KErrAlreadyExists);
+
+	_LIT(KDmaCompat, "D_DMA_COMPAT.LDD");
+	r = User::LoadLogicalDevice(KDmaCompat);
+	const TBool dmaCompatPresent = (r == KErrNone || r == KErrAlreadyExists);
+
+	if (!(dmaPresent || dmaCompatPresent))
 		{
-		test.Printf(_L("DMA not supported - test skipped\n"));
+		test.Printf(_L("DMA test driver not found - test skipped\n"));
 		return 0;
 		}
+	else if (dmaPresent && !dmaCompatPresent)
+		{
+		test.Printf(_L("Loaded %S\n"), &KDma);
+		}
+	else if (!dmaPresent && dmaCompatPresent)
+		{
+		test.Printf(_L("Loaded %S\n"), &KDmaCompat);
+		}
+	else
+		{
+		test.Printf(_L("The ROM contains %S and %S - only one should be present\n"), &KDma, &KDmaCompat);
+		test(EFalse);
+		}
 #endif
-	test(r == KErrNone || r == KErrAlreadyExists);
 
 	// Turn off evil lazy dll unloading
 	RLoader l;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/cap_reqs.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contains TDmaCapability and associated definitions.
+* These are used by the DMA tests in test_cases.cpp to express dependancies
+* on various DMA controller/channel capabilities
+*
+*/
+#ifndef __CAP_REQS_H__
+#define __CAP_REQS_H__
+
+#include <e32std.h>
+
+/**
+The various types of requirement on a
+value that can be specified by a TDmaCapability
+*/
+enum TCapsReqType
+		{
+		EEqual, EGTE /* >= */, ELTE /* <= */, EBitsSet, EBitsClear
+		};
+
+/**
+Enumerates all the various DMA channel capabilities
+*/
+enum TCapsReq
+		{
+		ENone,
+		EChannelPriorities,
+		EChannelPauseAndResume,
+		EAddrAlignedToElementSize,
+		E1DAddressing,
+		E2DAddressing,
+		ESynchronizationTypes,
+		EBurstTransactions,
+		EDescriptorInterrupt,
+		EFrameInterrupt,
+		ELinkedListPausedInterrupt,
+		EEndiannessConversion,
+		EGraphicsOps,
+		ERepeatingTransfers,
+		EChannelLinking,
+		EHwDescriptors,
+		ESrcDstAsymmetry,
+		EAsymHwDescriptors,
+		EBalancedAsymSegments,
+		EAsymCompletionInterrupt,
+		EAsymDescriptorInterrupt,
+		EAsymFrameInterrupt,
+		EPilVersion,
+		};
+
+enum TResult {ERun=0, ESkip=1, EFail=2}; //The ordering of these should not be changed
+
+struct SDmacCaps;
+struct TDmacTestCaps;
+
+/**
+Represents a requirement for some DMA capability
+to be either present or not present, less than, equal to, or
+greater than some value, or to have certain bits in a mask
+set or unset.
+*/
+struct TDmaCapability
+	{
+	TDmaCapability()
+		:iCapsReq(ENone), iCapsReqType(EEqual), iValue(ETrue), iFail(EFalse)
+		{}
+
+	TDmaCapability(TCapsReq aReq, TCapsReqType aReqType, TUint aValue, TBool aFail)
+		:iCapsReq(aReq), iCapsReqType(aReqType), iValue(aValue), iFail(aFail)
+		{}
+
+	static void SelfTest();
+
+	/**
+	Compares the requirements held in the struct
+	against those described in aChannelCaps and makes a decision
+	as to whether this test case should be run, skipped, or failed.
+	*/
+	TResult CompareToDmaCaps(const SDmacCaps& aChannelCaps) const;
+	TResult CompareToDmaCaps(const TDmacTestCaps& aChannelCaps) const;
+
+private:
+	TBool RequirementSatisfied(const SDmacCaps& aChannelCaps) const;
+	TBool RequirementSatisfied(const TDmacTestCaps& aChannelCaps) const;
+
+	TBool TestValue(TUint aValue) const;
+
+public:
+	TCapsReq		iCapsReq;
+	TCapsReqType	iCapsReqType;
+	TUint			iValue;
+	// if HW capability is not available:-
+	// 	ETrue - Fail the test
+	//	EFalse - Skip the test
+	TBool			iFail;
+	};
+
+//A set of DMA capability requirements
+const TDmaCapability none(ENone, EEqual, 0, ETrue);
+
+const TDmaCapability pauseRequired(EChannelPauseAndResume, EEqual, ETrue, ETrue);
+const TDmaCapability pauseRequired_skip(EChannelPauseAndResume, EEqual, ETrue, EFalse);
+const TDmaCapability pauseNotWanted(EChannelPauseAndResume, EEqual, EFalse, ETrue);
+
+const TDmaCapability hwDesNotWanted(EHwDescriptors, EEqual, EFalse, ETrue);
+const TDmaCapability hwDesNotWanted_skip(EHwDescriptors, EEqual, EFalse, EFalse);
+const TDmaCapability hwDesWanted(EHwDescriptors, EEqual, ETrue, ETrue);
+const TDmaCapability hwDesWanted_skip(EHwDescriptors, EEqual, ETrue, EFalse);
+
+const TDmaCapability cap_2DRequired(E2DAddressing, EEqual, ETrue, EFalse);
+
+const TDmaCapability capEqualV1(EPilVersion, EEqual, 1, EFalse);
+const TDmaCapability capEqualV2(EPilVersion, EEqual, 2, EFalse);
+const TDmaCapability capEqualV2Fatal(EPilVersion, EEqual, 2, ETrue);
+
+const TDmaCapability capAboveV1(EPilVersion, EGTE, 2, EFalse);
+const TDmaCapability capBelowV2(EPilVersion, ELTE, 1, EFalse);
+#endif // #ifdef __CAP_REQS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/d_dma2.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,1351 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Test driver for DMA V2 framework
+//
+//
+
+#include <kernel/kern_priv.h>
+#include <drivers/dma.h>
+#include "d_dma2.h"
+
+_LIT(KClientPanicCat, "D_DMA2");
+_LIT(KDFCThreadName,"D_DMA_DFC_THREAD");
+_LIT(KIsrCbDfcThreadName,"D_DMA_IsrCb_thread");
+const TInt KDFCThreadPriority=26;
+
+class TStopwatch
+	{
+public:
+	TStopwatch()
+		:iStart(0), iStop(0)
+		{}
+
+	void Start()
+		{iStart = NKern::FastCounter();}
+
+	void Stop()
+		{
+		iStop = NKern::FastCounter();
+
+		__KTRACE_OPT(KDMA, Kern::Printf(">TStopwatch::Stop FastCounter ticks: iStart=0x%lx iStop=0x%lx", iStart, iStop));
+		}
+
+	TUint64 ReadMicroSecs() const
+		{
+#ifndef __SMP__
+		TUint64 diff = 0;
+		if(iStart > iStop)
+			{
+			diff = (KMaxTUint64 - iStart) + iStop;
+			}
+		else
+			{
+			diff = iStop - iStart;
+			}
+		return FastCountToMicroSecs(diff);
+#else
+		//TODO On SMP it is possible for the value returned from
+		//NKern::FastCounter to depend on the current CPU (ie.
+		//NaviEngine)
+		//
+		//One solution would be to tie DFC's and ISR's to the same
+		//core as the client, but this would reduce the usefulness of
+		//SMP testing.
+		return 0;
+#endif
+		}
+private:
+
+	TUint64 FastCountToMicroSecs(TUint64 aCount) const
+		{
+		const TUint64 countsPerS = NKern::FastCounterFrequency();
+
+		TUint64 timeuS = (aCount*1000000)/countsPerS;
+		__KTRACE_OPT(KDMA, Kern::Printf(">TStopwatch::FastCountToMicroSecs FastCounter ticks: aCount=0x%lx countsPerS=0x%lx time=0x%lx", aCount, countsPerS, timeuS));
+		return timeuS;
+		}
+
+	TUint64 iStart;
+	TUint64 iStop;
+	};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class DClientDmaRequest;
+/**
+Driver channel. Only accessible by a single client thread
+*/
+class DDmaTestSession : public DLogicalChannelBase
+	{
+public:
+	DDmaTestSession();
+	virtual ~DDmaTestSession();
+protected:
+	// from DLogicalChannelBase
+	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
+	virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
+	virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
+private:
+	TInt DoGetInfo(TAny* aInfo);
+
+	TInt OpenDmaChannel(TUint aPslCookie, TUint& aDriverCookie);
+	TInt CloseDmaChannelByCookie(TUint aDriverCookie);
+	TInt PauseDmaChannelByCookie(TUint aDriverCookie);
+	TInt ResumeDmaChannelByCookie(TUint aDriverCookie);
+	TInt GetChannelCapsByCookie(TUint aDriverCookie, SDmacCaps& aChannelCaps);
+	TInt GetChannelCapsByCookie(TUint aDriverCookie, TDmacTestCaps& aChannelCaps);
+	TInt CancelAllByCookie(TUint aDriverCookie);
+	TInt IsrRedoRequestByCookie(TUint aDriverCookie,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb);
+	TInt IsQueueEmptyByCookie(TUint aDriverCookie, TBool& aQueueEmpty);		
+	TInt ChannelIsOpenedByCookie(TUint aDriverCookie, TBool& aChannelOpen);		
+	void CloseDmaChannelByIndex(TInt aIndex);
+	void CancelAllByIndex(TInt aIndex);
+	TInt PauseDmaChannelByIndex(TInt aIndex);
+	TInt ResumeDmaChannelByIndex(TInt aIndex);		
+	TInt IsrRedoRequestByIndex(TInt aIndex,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb);
+	TInt CreateSharedChunk();
+	TUint OpenSharedChunkHandle();
+
+	/**
+	Creates a new kernel-side DMA request object, associated with a previously
+	opened channel
+
+	@param aChannelCookie - A channel cookie as returned by OpenDmaChannel
+	@param aRequestCookie - On success will be a cookie by which the dma request can be referred to
+	@param aNewCallback - If true, then a new style DMA callback will be used
+	*/
+	TInt CreateDmaRequest(TUint aChannelCookie, TUint& aRequestCookie, TBool aNewCallback = EFalse, TInt aMaxFragmentSizeBytes=0);
+
+	//TODO what happens if a client closes a channel that
+	//it still has dma requests associated with?
+	
+	/**
+	Destroys a previously created dma request object
+	*/
+	TInt DestroyDmaRequestByCookie(TUint aRequestCookie);
+
+	void DestroyDmaRequestByIndex(TInt aIndex);
+
+
+	TInt CookieToChannelIndex(TUint aDriverCookie) const;
+	TInt CookieToRequestIndex(TUint aRequestCookie) const;
+
+	void FixupTransferArgs(TDmaTransferArgs& aTransferArgs) const;
+	TInt FragmentRequest(TUint aRequestCookie, const TDmaTransferArgs& aTransferArgs, TBool aLegacy=ETrue);
+
+	TInt QueueRequest(TUint aRequestCookie, TRequestStatus* aStatus, TCallbackRecord* aRecord, TUint64* aDurationMicroSecs);
+	DClientDmaRequest* RequestFromCookie(TUint aRequestCookie) const;
+	TInt RequestFragmentCount(TUint aRequestCookie);
+
+	TDmaV2TestInfo ConvertTestInfo(const TDmaTestInfo& aOldInfo) const;
+private:
+	DThread* iClient;
+	TDynamicDfcQue* iDfcQ;
+	TDynamicDfcQue* iIsrCallbackDfcQ; // Will be used by requests which complete with an ISR callback
+	static const TInt KMaxChunkSize = 8 * KMega;
+	TLinAddr iChunkBase;
+	DChunk* iChunk;
+
+	RPointerArray<TDmaChannel> iChannels;
+	RPointerArray<DClientDmaRequest> iClientDmaReqs;
+	};
+
+
+/**
+Allows a TClientRequest to be associated with a DDmaRequest
+*/
+class DClientDmaRequest : public DDmaRequest
+	{
+public:
+	static DClientDmaRequest* Construct(DThread* aClient, TDfcQue* const aDfcQ, TDmaChannel& aChannel, TBool aNewStyle=EFalse, TInt aMaxTransferSize=0);
+	~DClientDmaRequest();
+
+	TInt Queue(TRequestStatus* aRequestStatus, TCallbackRecord* aRecord, TUint64* aDurationMicroSecs);
+	void AddRequeArgs(const TIsrRequeArgsSet& aRequeArgSet);
+
+	TUint64 GetDuration()
+		{return iStopwatch.ReadMicroSecs();}
+
+protected:
+	TInt Create();
+	/** Construct with old style callback */
+	DClientDmaRequest(DThread* aClient, TDfcQue* const aDfcQ, TDmaChannel& aChannel, TInt aMaxTransferSize);
+
+	/** Construct with new style callback */
+	DClientDmaRequest(DThread* aClient, TDfcQue* const aDfcQ, TDmaChannel& aChannel, TBool aNewStyle, TInt aMaxTransferSize);
+
+private:
+	static void CallbackOldStyle(TResult aResult, TAny* aRequest);
+	static void Callback(TUint, TDmaResult, TAny*, SDmaDesHdr*);
+	static void CompleteCallback(TAny* aRequest);
+
+	void DoCallback(TUint, TDmaResult);
+	TBool RedoRequest();
+
+	//!< Used to return a TCallbackRecord and transfer time
+	TClientDataRequest2<TCallbackRecord, TUint64>* iClientDataRequest;
+
+	DThread* const iClient;
+	TDfcQue* const iDfcQ; //!< Use the DDmaTestSession's dfc queue
+	TDfc iDfc;
+
+	TStopwatch iStopwatch;
+	TIsrRequeArgsSet iIsrRequeArgSet;
+	};
+
+DClientDmaRequest* DClientDmaRequest::Construct(DThread* aClient, TDfcQue* const aDfcQ, TDmaChannel& aChannel, TBool aNewStyle, TInt aMaxTransferSize)
+	{
+	DClientDmaRequest* dmaRequest = NULL;
+	if(aNewStyle)
+		{
+#ifdef DMA_APIV2
+		dmaRequest = new DClientDmaRequest(aClient, aDfcQ, aChannel, aNewStyle, aMaxTransferSize);
+#else
+		TEST_FAULT; // if a new style dma request was requested it should have been caught earlier
+#endif
+		}
+	else
+		{
+		dmaRequest = new DClientDmaRequest(aClient, aDfcQ, aChannel, aMaxTransferSize);
+		}
+
+	if(dmaRequest == NULL)
+		{
+		return dmaRequest;
+		}
+
+	const TInt r = dmaRequest->Create();
+	if(r != KErrNone)
+		{
+		delete dmaRequest;
+		dmaRequest = NULL;
+		}
+	return dmaRequest;
+	}
+
+DClientDmaRequest::DClientDmaRequest(DThread* aClient, TDfcQue* const aDfcQ, TDmaChannel& aChannel, TInt aMaxFragmentSize)
+	:DDmaRequest(aChannel, &CallbackOldStyle, this, aMaxFragmentSize),
+	iClientDataRequest(NULL),
+	iClient(aClient),
+	iDfcQ(aDfcQ),
+	iDfc(CompleteCallback,NULL, iDfcQ, KMaxDfcPriority)
+	{
+	}
+#ifdef DMA_APIV2
+DClientDmaRequest::DClientDmaRequest(DThread* aClient, TDfcQue* const aDfcQ, TDmaChannel& aChannel, TBool /*aNewStyle*/, TInt aMaxFragmentSize)
+	:DDmaRequest(aChannel, &Callback, this, aMaxFragmentSize),
+	iClientDataRequest(NULL),
+	iClient(aClient),
+	iDfcQ(aDfcQ),
+	iDfc(CompleteCallback,NULL, iDfcQ, KMaxDfcPriority)
+	{
+	}
+#endif
+
+TInt DClientDmaRequest::Create()
+	{
+	return Kern::CreateClientDataRequest2(iClientDataRequest);
+	}
+
+DClientDmaRequest::~DClientDmaRequest()
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf(">DClientDmaRequest::~DClientDmaRequest")); 
+	if(iClientDataRequest)
+		{
+		Kern::DestroyClientRequest(iClientDataRequest);
+		}
+	}
+
+/**
+Queue the DClientDmaRequest.
+
+@param aRequestStatus Pointer to the client's request status
+@param aRecord Pointer to the user's TCallbackRecord, may be null
+@return
+   -KErrInUse The client request is in use
+   -KErrNone success
+*/
+TInt DClientDmaRequest::Queue(TRequestStatus* aRequestStatus, TCallbackRecord* aRecord, TUint64* aDurationMicroSecs)
+	{
+	__NK_ASSERT_ALWAYS(aRecord);
+	__NK_ASSERT_ALWAYS(aDurationMicroSecs);
+
+	//erase results from last transfer
+	iClientDataRequest->Data1().Reset();
+	iClientDataRequest->SetDestPtr1(aRecord);
+
+	iClientDataRequest->SetDestPtr2(aDurationMicroSecs);
+
+
+	TInt r = iClientDataRequest->SetStatus(aRequestStatus);
+	if(r != KErrNone)
+		{
+		return r;
+		}
+
+	iStopwatch.Start();
+#ifdef DMA_APIV2
+	r = DDmaRequest::Queue();
+#else
+	// old version of queue did not return an error code
+	DDmaRequest::Queue();
+	r = KErrNone;
+#endif
+
+	return r;
+	}
+
+void DClientDmaRequest::AddRequeArgs(const TIsrRequeArgsSet& aRequeArgSet)
+	{
+	iIsrRequeArgSet = aRequeArgSet;
+	}
+
+/**
+If a transfer complete callback in ISR context s received this will be
+called to redo the request with the first entry in the array
+
+@return ETrue If the redo was successful - indicates that another callback is comming
+*/
+TBool DClientDmaRequest::RedoRequest()
+	{
+	TIsrRequeArgs args = iIsrRequeArgSet.GetArgs();
+	const TInt r = args.Call(iChannel);
+	TCallbackRecord& record = iClientDataRequest->Data1();
+	record.IsrRedoResult(r);
+	return (r == KErrNone);
+	}
+
+
+/**
+Calls TDmaChannel::IsrRedoRequest on aChannel
+with this object's parameters
+*/
+TInt TIsrRequeArgs::Call(TDmaChannel& aChannel)
+	{
+#ifdef DMA_APIV2
+	return aChannel.IsrRedoRequest(iSrcAddr, iDstAddr, iTransferCount, iPslRequestInfo, iIsrCb);
+#else
+	TEST_FAULT;
+	return KErrNotSupported;
+#endif
+	}
+
+/**
+Check that both source and destination of ISR reque args will
+lie within the range specified by aStart and aSize.
+
+@param aStart The linear base address of the region
+@param aSize The size of the region
+*/
+TBool TIsrRequeArgs::CheckRange(TLinAddr aStart, TUint aSize) const
+	{
+	TUint physStart = Epoc::LinearToPhysical(aStart);
+	TEST_ASSERT(physStart != KPhysAddrInvalid);
+
+	TAddrRange chunk(physStart, aSize);
+	TBool sourceOk = (iSrcAddr == KPhysAddrInvalid) ? ETrue : chunk.Contains(SourceRange());
+
+	TBool destOk = (iDstAddr == KPhysAddrInvalid) ? ETrue : chunk.Contains(DestRange());
+
+	return sourceOk && destOk;
+	}
+
+TBool TIsrRequeArgsSet::CheckRange(TLinAddr aAddr, TUint aSize) const
+	{
+	for(TInt i=0; i<iCount; i++)
+		{
+		if(!iRequeArgs[i].CheckRange(aAddr, aSize))
+			return EFalse;
+		}
+	return ETrue;
+	}
+
+/**
+Translate an old style dma callback to a new-style one
+*/
+void DClientDmaRequest::CallbackOldStyle(TResult aResult, TAny* aArg)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf(">DClientDmaRequest::CallBackOldStyle: TResult result=%d", aResult));
+	TEST_ASSERT(aResult != EBadResult);
+	//translate result code
+	const TDmaResult result = (aResult == EOk) ? EDmaResultOK : EDmaResultError;
+
+	//call the new-style callback
+	Callback(EDmaCallbackRequestCompletion, result, aArg, NULL);
+	}
+
+
+/**
+The new style callback called by the DMA framework
+may be called in either thread or ISR context
+*/
+void DClientDmaRequest::Callback(TUint aCallbackType, TDmaResult aResult, TAny* aArg, SDmaDesHdr* aHdr)
+	{
+	const TInt context = NKern::CurrentContext();
+	__KTRACE_OPT(KDMA, Kern::Printf(">DClientDmaRequest::CallBack: TDmaResult result = %d, NKern::TContext context = %d", aResult, context));
+	
+	DClientDmaRequest& self = *reinterpret_cast<DClientDmaRequest*>(aArg);
+	self.DoCallback(aCallbackType, aResult);
+
+	// decide if callback is complete
+	const TBool transferComplete = aCallbackType & EDmaCallbackRequestCompletion;
+	if(!transferComplete)
+		{
+		return;
+		}
+
+	// If there are reque args then redo this request
+	// another callback would then be expected.
+	// Requests can only be re-queued in ISR context, but we
+	// do not check that here as it is up to the client to get
+	// it right - also, we want to test that the PIL catches this
+	// error
+	if(!self.iIsrRequeArgSet.IsEmpty())
+		{
+		// If redo call was succesful, return and wait for next call back
+		if(self.RedoRequest())
+			return;
+		}
+
+	switch(context)
+		{
+	case NKern::EThread:
+		{
+		CompleteCallback(aArg);
+		break;
+		}
+	case NKern::EInterrupt:
+		{
+		self.iDfc.iPtr = aArg;
+		self.iDfc.Add();
+		break;
+		}
+	case NKern::EIDFC: //fall-through
+	case NKern::EEscaped:
+	default:
+		TEST_FAULT;
+		}
+	}
+
+/**
+Log results of callback. May be called in either thread or ISR context
+*/
+void DClientDmaRequest::DoCallback(TUint aCallbackType, TDmaResult aResult)
+	{
+	iStopwatch.Stop(); //sucessive calls will simply over write the stop time
+
+	// This will always be done whether the client requested a
+	// callback record or not
+	TCallbackRecord& record = iClientDataRequest->Data1();
+	record.ProcessCallback(aCallbackType, aResult);
+	}
+
+/**
+This function may either be called directly or queued as a DFC
+*/
+void DClientDmaRequest::CompleteCallback(TAny* aArg)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf(">DClientDmaRequest::CompleteCallBack thread %O", &Kern::CurrentThread()));
+	__ASSERT_NOT_ISR;
+
+	DClientDmaRequest& self = *reinterpret_cast<DClientDmaRequest*>(aArg);
+
+	self.iClientDataRequest->Data2() = self.iStopwatch.ReadMicroSecs();
+
+	//Assert that we called SetRequestStatus on this object before
+	//queueing
+	__NK_ASSERT_DEBUG(self.iClientDataRequest->IsReady());
+
+	// This is an inelegant, temporary, solution to the following problem:
+	//
+	// If a dma request completes with an ISR callback the test
+	// framework will queue this function as a DFC which
+	// will then signal the user-side client. As a consequence of
+	// this the user side client may then decide to destroy this
+	// request. However, untill the DMA framework's DFC has run
+	// and called OnDeque() on this request, it is still considered as
+	// queued. Since it is possible that this DFC could run
+	// before the DMA fw's DFC, this request could get destroyed while
+	// it is stil queued, triggering a PIL assertion.
+	//
+	// The real fix is likely be for the PIL to call the callback
+	// twice, but with different arguments, once to annonunce the
+	// ISR and again to announce the dequeue.
+	//
+	// Here we poll and wait for this request to be dequeued. Note,
+	// this DFC is currently run on a separate DFC queue, otherwise
+	// it could get deadlocked. An alternative to polling would be
+	// to use DCondVar, but that would require PIL modification
+
+	if(NKern::CurrentThread() == self.iDfcQ->iThread)
+		{
+		// Only need to poll if we aren't on the channel's DFC queue
+		for(;;)
+			{
+			// once the request has been unqueued it
+			// can only be queued again by the client
+			const TBool queued = __e32_atomic_load_acq32(&self.iQueued);
+			if(!queued)
+				break;
+			__KTRACE_OPT(KDMA, Kern::Printf("Waiting for requeuest to be dequeued"));
+			NKern::Sleep(10);
+			}
+		}
+	else
+		{
+		// If we are on the channel's DFCQ we should be dequeued
+		// already
+		__NK_ASSERT_DEBUG(!__e32_atomic_load_acq32(&self.iQueued));
+		}
+
+	// We can always complete with KErrNone, the actual DMA result is
+	// logged in the TCallbackRecord
+	Kern::QueueRequestComplete(self.iClient, self.iClientDataRequest, KErrNone);
+	}
+
+const TInt DDmaTestSession::KMaxChunkSize;
+
+TInt DDmaTestSession::RequestUserHandle(DThread* aThread, TOwnerType aType)
+	{
+	if (aType!=EOwnerThread || aThread!=iClient)
+		return KErrAccessDenied;
+	return KErrNone;
+	}
+
+DDmaTestSession::DDmaTestSession()
+	: iClient(NULL), iDfcQ(NULL), iIsrCallbackDfcQ(NULL), iChunkBase(0), iChunk(NULL)
+	{}
+
+// called in thread critical section
+TInt DDmaTestSession::DoCreate(TInt /*aUnit*/, const TDesC8* aInfo, const TVersion& /*aVer*/)
+	{
+	__NK_ASSERT_ALWAYS(iDfcQ == NULL);
+	__NK_ASSERT_ALWAYS(iIsrCallbackDfcQ == NULL);
+
+	TInt r = Kern::DynamicDfcQCreate(iDfcQ, KDFCThreadPriority, KDFCThreadName);
+	if (r != KErrNone)
+		return r;
+	NKern::ThreadSetCpuAffinity((NThread*)(iDfcQ->iThread), KCpuAffinityAny);
+
+	r = Kern::DynamicDfcQCreate(iIsrCallbackDfcQ, KDFCThreadPriority, KIsrCbDfcThreadName);
+	if (r != KErrNone)
+		return r;
+	NKern::ThreadSetCpuAffinity((NThread*)(iIsrCallbackDfcQ->iThread), KCpuAffinityAny);
+
+	iClient = &Kern::CurrentThread();
+
+	r = CreateSharedChunk();
+	return r;
+	}
+
+DDmaTestSession::~DDmaTestSession()
+	{
+	//Destroy requests before channels
+	//or we will trigger an assertion
+	while(iClientDmaReqs.Count())
+		{
+		DestroyDmaRequestByIndex(0);
+		}
+	iClientDmaReqs.Close();
+
+	while(iChannels.Count())
+		{
+		CloseDmaChannelByIndex(0);
+		}
+	iChannels.Close();
+
+
+	if (iDfcQ)
+		{
+		iDfcQ->Destroy();
+		}
+
+	if (iIsrCallbackDfcQ)
+		{
+		iIsrCallbackDfcQ->Destroy();
+		}
+
+	if(iChunk)
+		{
+		Kern::ChunkClose(iChunk);
+		iChunk = NULL;
+		}
+	}
+
+TInt DDmaTestSession::Request(TInt aFunction, TAny* a1, TAny* a2)
+	{
+	__NK_ASSERT_DEBUG(&Kern::CurrentThread() == iClient);
+
+	switch (aFunction)
+		{
+	case RDmaSession::EOpenChannel:
+			{
+			TUint pslCookie = (TUint)a1;
+			TUint driverCookie = 0;
+			TInt r = OpenDmaChannel(pslCookie, driverCookie);	
+			umemput32(a2, &driverCookie, sizeof(TAny*));
+			return r;
+			}
+	case RDmaSession::ECloseChannel:
+			{
+			TUint driverCookie = reinterpret_cast<TUint>(a1);
+			TInt r = CloseDmaChannelByCookie(driverCookie);
+			return r;
+			}
+	case RDmaSession::EChannelCaps:
+			{
+			TUint driverCookie = reinterpret_cast<TUint>(a1);
+			TPckgBuf<TDmacTestCaps> capsBuf;
+			TInt r = GetChannelCapsByCookie(driverCookie, capsBuf());
+			Kern::KUDesPut(*reinterpret_cast<TDes8*>(a2), capsBuf);
+			return r;
+			}
+	case RDmaSession::EPauseChannel:
+			{
+			TUint driverCookie = reinterpret_cast<TUint>(a1);
+			TInt r = PauseDmaChannelByCookie(driverCookie);
+			return r;
+			}
+	case RDmaSession::EResumeChannel:
+			{
+			TUint driverCookie = reinterpret_cast<TUint>(a1);
+			TInt r = ResumeDmaChannelByCookie(driverCookie);
+			return r;
+			}
+	case RDmaSession::EFragmentCount:
+			{
+			TUint requestCookie = reinterpret_cast<TUint>(a1);
+			TInt r = RequestFragmentCount(requestCookie);
+			return r;
+			}
+	case RDmaSession::ERequestOpen:
+			{
+			RDmaSession::TRequestCreateArgs createArgs(0, EFalse, 0);
+			TPckg<RDmaSession::TRequestCreateArgs> package(createArgs);
+			Kern::KUDesGet(package, *reinterpret_cast<TDes8*>(a1));
+
+			const TUint channelCookie = createArgs.iChannelCookie;
+			TUint requestCookie = 0;
+
+			TInt r = CreateDmaRequest(channelCookie, requestCookie, createArgs.iNewStyle, createArgs.iMaxFragmentSize);
+
+			umemput32(a2, &requestCookie, sizeof(TAny*));
+			return r;
+			}
+	case RDmaSession::ERequestClose:
+			{
+			const TUint requestCookie = reinterpret_cast<TUint>(a1);
+			return DestroyDmaRequestByCookie(requestCookie);
+			}
+	case RDmaSession::EFragmentLegacy:
+	case RDmaSession::EFragment:
+			{
+			TPckgBuf<RDmaSession::TFragmentArgs> argsBuff;
+			Kern::KUDesGet(argsBuff, *reinterpret_cast<TDes8*>(a1));
+			const TUint requestCookie = argsBuff().iRequestCookie;
+
+			//must remove constness as we actually need to
+			//convert the src and dst offsets to addresses
+			TDmaTransferArgs& transferArgs = const_cast<TDmaTransferArgs&>(argsBuff().iTransferArgs);
+
+			//convert address offsets in to kernel virtual addresses
+			FixupTransferArgs(transferArgs);
+
+			TEST_ASSERT((TAddressParms(transferArgs).CheckRange(iChunkBase, iChunk->Size())));
+
+			TInt r = KErrGeneral;
+
+			TStopwatch clock;
+			clock.Start();
+			switch (aFunction)
+				{
+			case RDmaSession::EFragmentLegacy:
+				r = FragmentRequest(requestCookie, transferArgs, ETrue); break;
+			case RDmaSession::EFragment:
+				r = FragmentRequest(requestCookie, transferArgs, EFalse); break;
+			default:
+				TEST_FAULT;
+				}
+			clock.Stop();
+
+			const TUint64 time = clock.ReadMicroSecs();
+
+			TUint64* const timePtr = argsBuff().iDurationMicroSecs;
+			if(timePtr)
+				{
+				umemput(timePtr, &time, sizeof(time));
+				}
+			return r;
+			}
+	case RDmaSession::EQueueRequest:
+			{
+			TPckgBuf<RDmaSession::TQueueArgs> argsBuff;
+			Kern::KUDesGet(argsBuff, *reinterpret_cast<TDes8*>(a1));
+
+			//this is an Asynchronous request
+			const TUint requestCookie = argsBuff().iRequestCookie;
+			TRequestStatus* requestStatus = argsBuff().iStatus;
+			TCallbackRecord* callbackRec = argsBuff().iCallbackRecord;
+			TUint64* duration = argsBuff().iDurationMicroSecs;
+
+			TInt r = QueueRequest(requestCookie, requestStatus, callbackRec, duration);
+			if(r != KErrNone)
+				{
+				Kern::RequestComplete(requestStatus, r);
+				}
+			return r;
+			}	
+	case RDmaSession::EQueueRequestWithReque:
+			{
+			//TODO can common code with EQueueRequest be extracted?
+			TPckgBuf<RDmaSession::TQueueArgsWithReque> argsBuff;
+			Kern::KUDesGet(argsBuff, *reinterpret_cast<TDes8*>(a1));
+
+			//this is an Asynchronous request
+			const TUint requestCookie = argsBuff().iRequestCookie;
+			TRequestStatus* requestStatus = argsBuff().iStatus;
+			TCallbackRecord* callbackRec = argsBuff().iCallbackRecord;
+			TUint64* duration = argsBuff().iDurationMicroSecs;
+
+			TInt r = KErrNotFound;
+
+			DClientDmaRequest* const request = RequestFromCookie(requestCookie);
+			if(request != NULL)
+				{
+				argsBuff().iRequeSet.Fixup(iChunkBase);
+				//TODO reque args must be substituted in order to
+				//check the range. The original transfer args are not
+				//available when queue is called, they could
+				//however be stored within DClientDmaRequest
+				//TEST_ASSERT((argsBuff().iRequeSet.CheckRange(iChunkBase, iChunk->Size())));
+				request->AddRequeArgs(argsBuff().iRequeSet);
+
+				r = QueueRequest(requestCookie, requestStatus, callbackRec, duration);
+				}
+
+			if(r != KErrNone)
+				{
+				Kern::RequestComplete(requestStatus, r);
+				}
+			return r;
+			}
+	case RDmaSession::EIsrRedoRequest:
+			{
+			TPckgBuf<RDmaSession::TIsrRedoReqArgs> argsBuff;
+			Kern::KUDesGet(argsBuff, *reinterpret_cast<TDes8*>(a1));
+
+			const TUint driverCookie = argsBuff().iDriverCookie;
+			const TUint32 srcAddr = argsBuff().iSrcAddr;
+			const TUint32 dstAddr = argsBuff().iDstAddr;
+			const TInt transferCount = argsBuff().iTransferCount;
+			const TUint32 pslRequestInfo = argsBuff().iPslRequestInfo;
+			const TBool isrCb = argsBuff().iIsrCb;
+
+			TInt r = IsrRedoRequestByCookie(driverCookie,srcAddr,dstAddr,transferCount,pslRequestInfo,isrCb);
+			return r;
+			}
+	case RDmaSession::EIsOpened:
+			{
+			TUint driverCookie = (TUint)a1;
+			TBool channelOpen = EFalse;;
+			TInt r = ChannelIsOpenedByCookie(driverCookie,channelOpen);	
+			umemput32(a2, &channelOpen, sizeof(TAny*));
+			return r;		
+			}
+	case RDmaSession::EIsQueueEmpty:
+			{
+			TUint driverCookie = (TUint)a1;
+			TBool queueEmpty = EFalse;;
+			TInt r = IsQueueEmptyByCookie(driverCookie,queueEmpty);	
+			umemput32(a2, &queueEmpty, sizeof(TAny*));
+			return r;
+			}
+	case RDmaSession::ECancelAllChannel:
+			{
+			TUint driverCookie = reinterpret_cast<TUint>(a1);
+			TInt r = CancelAllByCookie(driverCookie);
+			return r;
+			}
+	case RDmaSession::EOpenSharedChunk:
+			{
+			return OpenSharedChunkHandle();
+			}
+	case RDmaSession::EGetTestInfo:
+			{
+#ifdef DMA_APIV2
+			TPckgC<TDmaV2TestInfo> package(DmaTestInfoV2());
+#else
+			TPckgC<TDmaV2TestInfo> package(ConvertTestInfo(DmaTestInfo()));
+#endif
+			Kern::KUDesPut(*reinterpret_cast<TDes8*>(a1), package);
+			return KErrNone;
+			}
+	default:
+		Kern::PanicCurrentThread(KClientPanicCat, __LINE__);
+		return KErrGeneral;
+		}
+	}
+
+TInt DDmaTestSession::OpenDmaChannel(TUint aPslCookie, TUint& aDriverCookie )
+	{
+	TDmaChannel::SCreateInfo info;
+	info.iCookie = aPslCookie;
+	info.iDfcQ = iDfcQ;
+	info.iDfcPriority = 3;
+	info.iDesCount = 128;
+
+	TDmaChannel* channel = NULL;
+
+	//cs so thread can't be killed between
+	//opening channel and adding to array
+	NKern::ThreadEnterCS();
+	TInt r = TDmaChannel::Open(info, channel);
+	if(KErrNone == r)
+		{
+		__NK_ASSERT_ALWAYS(channel);
+		
+		__KTRACE_OPT(KDMA, Kern::Printf("OpenDmaChannel: channel@ 0x%08x", channel)); 
+
+
+		TInt err = iChannels.Append(channel);
+		if(KErrNone == err)
+			{
+			aDriverCookie = reinterpret_cast<TUint>(channel);
+			}
+		else
+			{
+			channel->Close();
+			r = KErrNoMemory;
+			}
+		}
+	NKern::ThreadLeaveCS();
+
+	return r;
+	}
+
+TInt DDmaTestSession::CookieToChannelIndex(TUint aDriverCookie) const
+	{
+	const TInt r = iChannels.Find(reinterpret_cast<TDmaChannel*>(aDriverCookie));
+
+	if(r < 0)
+		{
+		__KTRACE_OPT(KDMA, Kern::Printf("CookieToChannelIndex: cookie 0x%08x not found!", aDriverCookie)); 
+		}
+	return r;
+	}
+
+TInt DDmaTestSession::CookieToRequestIndex(TUint aRequestCookie) const
+	{
+	const TInt r = iClientDmaReqs.Find(reinterpret_cast<DClientDmaRequest*>(aRequestCookie));
+
+	if(r < 0)
+		{
+		__KTRACE_OPT(KDMA, Kern::Printf("CookieToRequestIndex: cookie 0x%08x not found!", aRequestCookie)); 
+		}
+	return r;
+	}
+
+void DDmaTestSession::CloseDmaChannelByIndex(TInt aIndex)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("CloseDmaChannelByIndex: %d", aIndex)); 
+	__NK_ASSERT_DEBUG(aIndex < iChannels.Count()); 
+	// cs so client thread can't be killed between removing channel from
+	// array and closing it.
+	NKern::ThreadEnterCS();
+	TDmaChannel* channel = iChannels[aIndex];
+	iChannels.Remove(aIndex);
+	channel->Close();
+	NKern::ThreadLeaveCS();
+	}
+
+TInt DDmaTestSession::CloseDmaChannelByCookie(TUint aDriverCookie)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("CloseDmaChannelByCookie: 0x%08x", aDriverCookie)); 
+	const TInt index = CookieToChannelIndex(aDriverCookie);
+	
+	if(index >= 0)
+		{
+		CloseDmaChannelByIndex(index);
+		return KErrNone;
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+	}
+
+TInt DDmaTestSession::CancelAllByCookie(TUint aDriverCookie)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("CancelAllByCookie: 0x%08x", aDriverCookie)); 
+	const TInt index = CookieToChannelIndex(aDriverCookie);
+	
+	if(index >= 0)
+		{
+		CancelAllByIndex(index);
+		return KErrNone;
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+	}
+
+void DDmaTestSession::CancelAllByIndex(TInt aIndex)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("CancelAllByIndex: %d", aIndex)); 
+	__NK_ASSERT_DEBUG(aIndex < iChannels.Count()); 
+	
+	TDmaChannel* channel = iChannels[aIndex];
+	iChannels.Remove(aIndex);
+	channel->CancelAll();
+	}
+
+TInt DDmaTestSession::PauseDmaChannelByIndex(TInt aIndex)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("PauseDmaChannelByIndex: %d", aIndex)); 
+	__NK_ASSERT_DEBUG(aIndex < iChannels.Count()); 
+
+#ifdef DMA_APIV2
+	TDmaChannel* channel = iChannels[aIndex];
+	return channel->Pause();
+#else
+	return KErrNotSupported;
+#endif	
+	}
+
+TInt DDmaTestSession::PauseDmaChannelByCookie(TUint aDriverCookie)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("PauseDmaChannelByCookie: 0x%08x", aDriverCookie)); 
+	const TInt index = CookieToChannelIndex(aDriverCookie);
+	
+	if(index >= 0)
+		{
+		TInt r = PauseDmaChannelByIndex(index);
+		return r;
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+	}
+
+TInt DDmaTestSession::ResumeDmaChannelByIndex(TInt aIndex)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("ResumeDmaChannelByIndex: %d", aIndex)); 
+	__NK_ASSERT_DEBUG(aIndex < iChannels.Count()); 
+
+#ifdef DMA_APIV2
+	TDmaChannel* channel = iChannels[aIndex];
+	return channel->Resume();
+#else
+	return KErrNotSupported;
+#endif
+	}
+
+TInt DDmaTestSession::ResumeDmaChannelByCookie(TUint aDriverCookie)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("ResumeDmaChannelByCookie: 0x%08x", aDriverCookie)); 
+	const TInt index = CookieToChannelIndex(aDriverCookie);
+	
+	if(index >= 0)
+		{
+		TInt r = ResumeDmaChannelByIndex(index);
+		return r;
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+	}
+
+TInt DDmaTestSession::IsrRedoRequestByCookie(TUint aDriverCookie,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb)
+{
+	__KTRACE_OPT(KDMA, Kern::Printf("IsrRedoRequestByCookie: 0x%08x", aDriverCookie)); 
+	const TInt index = CookieToChannelIndex(aDriverCookie);
+	
+	if(index >= 0)
+		{
+		TInt r = IsrRedoRequestByIndex(index,aSrcAddr,aDstAddr,aTransferCount,aPslRequestInfo,aIsrCb);
+		return r;
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+}
+
+TInt DDmaTestSession::IsrRedoRequestByIndex(TInt aIndex,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("IsrRedoRequestByIndex: %d", aIndex)); 
+	__NK_ASSERT_DEBUG(aIndex < iChannels.Count()); 
+
+#ifdef DMA_APIV2
+	TDmaChannel* channel = iChannels[aIndex];
+	return channel->IsrRedoRequest(aSrcAddr,aDstAddr,aTransferCount,aPslRequestInfo,aIsrCb);
+#else
+	return KErrNotSupported;
+#endif
+	}
+
+/**
+aChannelCaps will be set to "NULL" values
+*/
+TInt DDmaTestSession::GetChannelCapsByCookie(TUint aDriverCookie, TDmacTestCaps& aChannelCaps)
+	{
+	SDmacCaps caps = {0,}; //initialise with NULL values
+	TInt r = GetChannelCapsByCookie(aDriverCookie, caps);
+
+	if(r == KErrNotSupported)
+		{
+		//If we can not query caps it means
+		//that we are using the v1 driver
+		//we construct a empty TDmacTestCaps
+		//but with an iPILVersion of 1
+		const TDmacTestCaps nullCapsV1(caps, 1);
+		aChannelCaps = nullCapsV1;
+		r = KErrNone;
+		}
+	else if(r == KErrNone)
+		{
+		const TDmacTestCaps capsV2(caps, 2);
+		aChannelCaps = capsV2;
+		}
+
+	return r;
+	}
+
+/**
+Will return the capabilities of the DMA channel.
+Querying SDmacCaps is not possible on V1 of the DMA framework.
+In that case an error of KErrNotSupported will be returned
+*/
+TInt DDmaTestSession::GetChannelCapsByCookie(TUint aDriverCookie, SDmacCaps& aChannelCaps)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("GetChannelCapsByCookie: 0x%08x", aDriverCookie)); 
+	const TInt index = CookieToChannelIndex(aDriverCookie);
+	if(index >= 0)
+		{
+#ifdef DMA_APIV2
+		aChannelCaps = iChannels[index]->DmacCaps();
+		return KErrNone;
+#else
+		return KErrNotSupported;
+#endif
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+	}
+
+TInt DDmaTestSession::IsQueueEmptyByCookie(TUint aDriverCookie, TBool& aQueueEmpty)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("IsQueueEmptyByCookie: 0x%08x", aDriverCookie)); 
+	const TInt index = CookieToChannelIndex(aDriverCookie);
+	
+	if(index >= 0)
+		{
+		aQueueEmpty=iChannels[index]->IsQueueEmpty();
+		return KErrNone;
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+	}
+
+TInt DDmaTestSession::ChannelIsOpenedByCookie(TUint aDriverCookie, TBool& aChannelOpen)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("ChannelIsOpenedByCookie: 0x%08x", aDriverCookie)); 
+	const TInt index = CookieToChannelIndex(aDriverCookie);
+	
+	if(index >= 0)
+		{
+		aChannelOpen=iChannels[index]->IsOpened();
+		return KErrNone;
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+	}
+
+TInt DDmaTestSession::CreateDmaRequest(TUint aChannelCookie, TUint& aRequestCookie, TBool aNewCallback, TInt aMaxFragmentSizeBytes)
+	{
+#ifndef DMA_APIV2
+	if(aNewCallback)
+		return KErrNotSupported;
+#endif
+
+	TInt channelIndex = CookieToChannelIndex(aChannelCookie);
+	if(channelIndex < 0)
+		return channelIndex;
+
+	NKern::ThreadEnterCS();
+	DClientDmaRequest* request = DClientDmaRequest::Construct(iClient, iIsrCallbackDfcQ, *iChannels[channelIndex], aNewCallback, aMaxFragmentSizeBytes);
+	if(request == NULL)
+		{
+		NKern::ThreadLeaveCS();
+		return KErrNoMemory;
+		}
+
+	TInt r = iClientDmaReqs.Append(request);
+	if(r == KErrNone)
+		{
+		aRequestCookie = reinterpret_cast<TUint>(request);
+		}
+	else
+		{
+		delete request;
+		}
+	NKern::ThreadLeaveCS();
+	
+	return r;
+	}
+
+TInt DDmaTestSession::DestroyDmaRequestByCookie(TUint aRequestCookie)
+	{
+	TInt requestIndex = CookieToRequestIndex(aRequestCookie);
+	if(requestIndex < 0)
+		return requestIndex;
+
+	DestroyDmaRequestByIndex(requestIndex);
+
+	return KErrNone;
+	}
+
+void DDmaTestSession::DestroyDmaRequestByIndex(TInt aIndex)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf("DestroyDmaRequestByIndex: %d", aIndex)); 
+	__NK_ASSERT_DEBUG(aIndex < iClientDmaReqs.Count()); 
+	NKern::ThreadEnterCS();
+
+	DClientDmaRequest* request = iClientDmaReqs[aIndex];
+	iClientDmaReqs.Remove(aIndex);
+	delete request;
+
+	NKern::ThreadLeaveCS();
+	}
+
+TInt DDmaTestSession::CreateSharedChunk()
+	{
+    // Enter critical section so we can't die and leak the objects we are creating
+    // I.e. the TChunkCleanup and DChunk (Shared Chunk)
+    NKern::ThreadEnterCS();
+
+    // Create the chunk
+    TChunkCreateInfo info;
+    info.iType         = TChunkCreateInfo::ESharedKernelSingle;
+    info.iMaxSize      = KMaxChunkSize;
+    info.iMapAttr      = EMapAttrFullyBlocking | EMapAttrUserRw;
+    info.iOwnsMemory   = ETrue;
+    info.iDestroyedDfc = NULL;
+
+    DChunk* chunk;
+	TUint32 mapAttr;
+    TInt r = Kern::ChunkCreate(info, chunk, iChunkBase, mapAttr);
+    if(r!=KErrNone)
+        {
+        NKern::ThreadLeaveCS();
+        return r;
+        }
+
+    // Map our device's memory into the chunk (at offset 0)
+	TUint32 physicalAddr;
+	r = Kern::ChunkCommitContiguous(chunk,0,KMaxChunkSize, physicalAddr);
+    if(r!=KErrNone)
+        {
+        // Commit failed so tidy-up...
+        Kern::ChunkClose(chunk);
+        }
+    else
+        {
+        iChunk = chunk;
+        }
+
+    // Can leave critical section now that we have saved pointers to created objects
+    NKern::ThreadLeaveCS();
+
+    return r;
+	}
+
+TUint DDmaTestSession::OpenSharedChunkHandle()
+	{
+	NKern::ThreadEnterCS();
+	const TInt r = Kern::MakeHandleAndOpen(NULL, iChunk);
+	NKern::ThreadLeaveCS();
+	return r;
+	}
+
+void DDmaTestSession::FixupTransferArgs(TDmaTransferArgs& aTransferArgs) const
+	{
+	aTransferArgs.iSrcConfig.iAddr += iChunkBase;
+	aTransferArgs.iDstConfig.iAddr += iChunkBase;
+	}
+
+#ifndef DMA_APIV2
+static TInt FragmentCount(DDmaRequest* aRequest)
+	{
+	TInt count = 0;
+	for (SDmaDesHdr* pH = aRequest->iFirstHdr; pH != NULL; pH = pH->iNext)
+		count++;
+	return count;
+	}
+#endif
+
+TInt DDmaTestSession::RequestFragmentCount(TUint aRequestCookie)
+	{
+	TInt requestIndex = CookieToRequestIndex(aRequestCookie);
+	if(requestIndex < 0)
+		return requestIndex;
+#ifdef DMA_APIV2
+	TInt r = iClientDmaReqs[requestIndex]->FragmentCount();
+#else
+	TInt r = FragmentCount(iClientDmaReqs[requestIndex]);
+#endif
+
+	return r;
+	}
+
+TInt DDmaTestSession::FragmentRequest(TUint aRequestCookie, const TDmaTransferArgs& aTransferArgs, TBool aLegacy)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf(">FragmentRequest: cookie=0x%08x, legacy=%d", aRequestCookie, aLegacy)); 
+	TInt requestIndex = CookieToRequestIndex(aRequestCookie);
+	if(requestIndex < 0)
+		return requestIndex;
+
+	TInt r = KErrNotSupported;
+	if(aLegacy)
+		{
+		// TODO we can extract the required info from the struct to
+		// set flags
+		TUint flags = KDmaMemSrc | KDmaIncSrc | KDmaMemDest | KDmaIncDest;
+
+		const TUint src = aTransferArgs.iSrcConfig.iAddr;
+		const TUint dst = aTransferArgs.iDstConfig.iAddr;
+		r = iClientDmaReqs[requestIndex]->Fragment(src, dst, aTransferArgs.iTransferCount, flags, NULL);
+		}
+	else
+		{
+#ifdef DMA_APIV2
+		r = iClientDmaReqs[requestIndex]->Fragment(aTransferArgs);
+#else
+		r = KErrNotSupported;
+#endif
+		}
+	return r;
+	}
+
+/**
+Queue the request refered to by aRequestCookie
+
+@param aRequestCookie Client identifier for the DDmaRequest
+@param aStatus Pointer to the client's TRequestStatus
+@param aRecord Pointer to the client's TCallbackRecord
+@return
+   - KErrNotFound - aRequestCookie was invalid
+   - KErrNone - Success
+*/
+TInt DDmaTestSession::QueueRequest(TUint aRequestCookie, TRequestStatus* aStatus, TCallbackRecord* aRecord, TUint64* aDurationMicroSecs)
+	{
+	__KTRACE_OPT(KDMA, Kern::Printf(">QueueRequest: 0x%08x", aRequestCookie)); 
+
+	DClientDmaRequest* request = RequestFromCookie(aRequestCookie);
+	if(request == NULL)
+		return KErrNotFound;
+
+	return request->Queue(aStatus, aRecord, aDurationMicroSecs);
+	}
+
+DClientDmaRequest* DDmaTestSession::RequestFromCookie(TUint aRequestCookie) const
+	{
+	TInt requestIndex = CookieToRequestIndex(aRequestCookie);
+	if(requestIndex < 0)
+		return NULL;
+
+	return (iClientDmaReqs[requestIndex]);
+	}
+
+TDmaV2TestInfo DDmaTestSession::ConvertTestInfo(const TDmaTestInfo& aOldInfo) const
+	{
+	TDmaV2TestInfo newInfo;
+	newInfo.iMaxTransferSize = aOldInfo.iMaxTransferSize;
+	newInfo.iMemAlignMask = aOldInfo.iMemAlignMask;
+	newInfo.iMemMemPslInfo = aOldInfo.iMemMemPslInfo;
+
+	newInfo.iMaxSbChannels = aOldInfo.iMaxSbChannels;
+	for(TInt i=0; i<aOldInfo.iMaxSbChannels; i++)
+		newInfo.iSbChannels[i] = aOldInfo.iSbChannels[i];
+
+	newInfo.iMaxDbChannels = aOldInfo.iMaxDbChannels;
+	for(TInt i=0; i<aOldInfo.iMaxDbChannels; i++)
+		newInfo.iDbChannels[i] = aOldInfo.iDbChannels[i];
+
+	newInfo.iMaxSgChannels = aOldInfo.iMaxSgChannels;
+	for(TInt i=0; i<aOldInfo.iMaxSgChannels; i++)
+		newInfo.iSgChannels[i] = aOldInfo.iSgChannels[i];
+
+	//TODO will want to add initialisation for Asym channels
+	//when these are available
+
+	return newInfo;
+	}
+//////////////////////////////////////////////////////////////////////////////
+
+class DDmaTestFactory : public DLogicalDevice
+	{
+public:
+	DDmaTestFactory();
+	// from DLogicalDevice
+	virtual ~DDmaTestFactory()
+		{
+		__KTRACE_OPT(KDMA, Kern::Printf(">DDmaTestFactory::~DDmaTestFactory"));
+		}
+	virtual TInt Install();
+	virtual void GetCaps(TDes8& aDes) const;
+	virtual TInt Create(DLogicalChannelBase*& aChannel);
+	};
+
+
+DDmaTestFactory::DDmaTestFactory()
+    {
+    iVersion = TestDmaLddVersion();
+    iParseMask = KDeviceAllowUnit;							// no info, no PDD
+    // iUnitsMask = 0;										// Only one thing
+    }
+
+
+TInt DDmaTestFactory::Create(DLogicalChannelBase*& aChannel)
+    {
+	aChannel=new DDmaTestSession;
+	return aChannel ? KErrNone : KErrNoMemory;
+    }
+
+
+TInt DDmaTestFactory::Install()
+    {
+    return SetName(&KTestDmaLddName);
+    }
+
+
+void DDmaTestFactory::GetCaps(TDes8& /*aDes*/) const
+    {
+    }
+
+//////////////////////////////////////////////////////////////////////////////
+
+DECLARE_STANDARD_LDD()
+	{
+    return new DDmaTestFactory;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/d_dma2.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,572 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test\dmav2\d_dma2.h
+// User-side API for LDD used to test DMAv2 framework.
+// 
+//
+
+#ifndef __D_DMA2_H__
+#define __D_DMA2_H__
+
+#include <e32cmn.h>
+#include <drivers/dmadefs.h>
+
+
+#define ARRAY_LENGTH(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
+
+#ifdef __KERNEL_MODE__
+	#include <nkern.h>
+	#include <kernel.h>
+	#define TEST_FAULT FAULT();
+	#define PRINT(N) Kern::Printf("%s = 0x%08x (%d)", #N, (N), (N))
+#else
+	#include <e32std.h>
+	#include <e32debug.h>
+	#define TEST_FAULT RDebug::Printf("Assertion failure in %s, %d", __FILE__, __LINE__); User::Invariant()
+	#define PRINT(N) RDebug::Printf("%s = 0x%08x (%d)", #N, (N), (N))
+#endif
+
+#define TEST_ASSERT(C) if(!(C)) {TEST_FAULT;}
+
+const TUint KPhysAddrInvalidUser=0xFFFFFFFFu; // KPhysAddrInvalid is not defined on the user side
+#ifdef __KERNEL_MODE__
+//if this fails then KPhysAddrInvalidUser must be updated to match
+//KPhysAddrInvalid
+__ASSERT_COMPILE(KPhysAddrInvalidUser == KPhysAddrInvalid);
+#endif
+
+
+_LIT(KTestDmaLddName, "TestDmaV2");
+
+inline TVersion TestDmaLddVersion() { return TVersion(1, 0, 1); }
+
+TInt Log2(TInt aNum);
+
+/**
+Indicates the number of each type of call back received
+and their context
+
+TODO as yet, it does not indicate the context of each callback, only
+the final one
+*/
+const TInt KNumberOfCallbacks = 12;
+
+class TCallbackRecord
+	{
+public:
+	enum TCbContext
+		{ EInvalid, EThread, EIsr };
+
+	TCallbackRecord(
+			TCbContext aContext = EThread,
+			TInt aReq = 0,
+			TInt aReqSrc = 0,
+			TInt aReqDst = 0,
+
+			TInt aDes = 0,
+			TInt aDesSrc = 0,
+			TInt aDesDst = 0,
+
+			TInt aFrame = 0,
+			TInt aFrameSrc = 0,
+			TInt aFrameDst = 0,
+
+			TInt aPause = 0,
+			TInt aPauseSrc = 0,
+			TInt aPauseDst = 0,
+			TDmaResult aResult = EDmaResultOK
+		);
+
+	static TCallbackRecord Empty();
+
+	void Reset();
+
+	/**
+	Allows 2 callback records to be compared
+	*/
+	TBool operator == (const TCallbackRecord aOther) const;
+	void Print() const;
+
+	/**
+	Get the number of callbacks for callback aCbType
+	*/
+	TInt GetCount(TDmaCallbackType aCbType) const;
+
+	void SetCount(TDmaCallbackType aCbType, TInt aCount);
+
+	/**
+	Set the result (expected or actual) from
+	TDmaChannel::IsrRedoRequest
+	 */
+	inline TCallbackRecord& IsrRedoResult(TInt aResult) {iIsrRedoRequestResult = aResult; return *this;}
+
+	/**
+	Reports the context in which the callback occurred.
+	*/
+	inline TCbContext GetContext()
+		{return iContext;}
+
+	/**
+	Updates data based on callback mask aCallbackMask
+	@param aCallbackMask Bitmask of callback events @see TDmaCallbackType
+	@oaram aResult The result reported by the current callback
+	*/
+	void ProcessCallback(TUint aCallbackMask, TDmaResult aResultaContext);
+
+	static void SelfTest();
+
+	// The below methods are setters, which may be chained together
+	// ie. The Named Parameter Idiom
+	// @see http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.18
+	TCallbackRecord& Context(TCbContext aContext) {iContext = aContext; return *this;}
+
+private:
+	TInt BitToIndex(TDmaCallbackType aCbType) const;
+
+	TCbContext CurrentContext() const;
+
+	TInt iCallbackLog[KNumberOfCallbacks];
+
+	TDmaResult iResult;
+	TCbContext iContext;
+	/** Result of the most recent redo request call */
+	TInt iIsrRedoRequestResult;
+	};
+
+/**
+Extends SDmacCaps to contain the DMA PIL
+version being used
+*/
+struct TDmacTestCaps : public SDmacCaps
+	{
+	TDmacTestCaps();
+	TDmacTestCaps(const SDmacCaps& aDmacCaps, TInt aVersion = 2);
+
+	TInt iPILVersion;
+	};
+
+
+class TDmaChannel;
+
+struct TAddrRange
+	{
+	TAddrRange(TUint aStart, TUint aLength);
+	inline TUint End() const {return (iStart + iLength -1);}
+	inline TUint Start() const {return iStart;}
+
+	inline TBool Contains(TUint aValue) const {return Rng(iStart, aValue, End());}
+	TBool Contains(TAddrRange aRange) const;
+
+	TBool Overlaps(const TAddrRange& aRange) const;
+	static void SelfTest();
+
+private:
+	TUint iStart;
+	TUint iLength;
+	};
+
+
+struct TAddressParms
+	{
+	TAddressParms(TUint32 aSrcAddr=0, TUint32 aDstAddr=0, TUint aTransferCount=0)
+		:iSrcAddr(aSrcAddr), iDstAddr(aDstAddr), iTransferCount(aTransferCount)
+		{}
+
+	TAddressParms(const TDmaTransferArgs& aArgs)
+		:iSrcAddr(aArgs.iSrcConfig.iAddr),
+		iDstAddr(aArgs.iDstConfig.iAddr),
+		iTransferCount(aArgs.iTransferCount)
+		{}
+
+	/**
+	If any src, dst, or transfer count are zero, substitute the values from
+	aTransferArgs in their place
+	*/
+	void Substitute(const TDmaTransferArgs& aTransferArgs);
+
+	/**
+	When recieved by the test driver, src and dst
+	addresses will be offsets from the dma test session's
+	chunk base. They must be converted to absolute, *physical* addresses
+	*/
+	void Fixup(TLinAddr aChunkBase);
+
+	/**
+	Check that both the src and destination lie within the area
+	defined by aStart and aSize
+	*/
+	TBool CheckRange(TLinAddr aStart, TUint aSize);
+
+	TAddrRange SourceRange() const;
+	TAddrRange DestRange() const;
+
+	TBool Overlaps(const TAddrRange aRange) const;
+	TBool Overlaps(const TAddressParms aParm) const;
+
+	TBool operator==(const TAddressParms& aOther) const;
+
+	static void SelfTest();
+
+	TUint32 iSrcAddr;
+	TUint32 iDstAddr;
+	TUint iTransferCount;
+	};
+
+// These functions can be used for accessing TDmaTransferArgs in
+// terms of TAddressParms. (TAddressParms would be a natural base
+// class for TDmaTransferArgs but changing the production code
+// is undesirable)
+TAddressParms GetAddrParms(const TDmaTransferArgs&);
+void SetAddrParms(TDmaTransferArgs&, const TAddressParms&);
+
+/**
+This struct holds the arguments which can be used with TDmaChannel::IsrRedoRequest
+*/
+struct TIsrRequeArgs : public TAddressParms
+	{
+	TIsrRequeArgs(TUint32 aSrcAddr=KPhysAddrInvalidUser, TUint32 aDstAddr=KPhysAddrInvalidUser,
+			TUint aTransferCount=0, TUint32 aPslRequestInfo=0,
+			TBool aIsrCb=ETrue)
+		: TAddressParms(aSrcAddr, aDstAddr, aTransferCount), iPslRequestInfo(aPslRequestInfo), iIsrCb(aIsrCb)
+		{}
+
+
+	TInt Call(TDmaChannel& aChannel);
+
+	TBool CheckRange(TLinAddr aStart, TUint aSize) const;
+
+	TUint32 iPslRequestInfo;
+	TBool iIsrCb;
+	};
+class CISrRequeTest;
+/**
+A collection of TIsrRequeArgs
+*/
+struct TIsrRequeArgsSet
+	{
+
+	friend class CIsrRequeTest; //TODO see line 394 t_dma2.cpp
+	TIsrRequeArgsSet(TIsrRequeArgs* aRequeueArgs=NULL, TInt aCount =0)
+		:iCount(aCount), iIndex(0)
+		{
+		TEST_ASSERT(iCount <= MaxCount);
+		for(TInt i=0; i<iCount; i++)
+			{
+			iRequeArgs[i] = aRequeueArgs[i];
+			}
+
+		}
+
+	TBool IsEmpty() const
+		{return iCount == 0;}
+
+	TIsrRequeArgs GetArgs();
+
+	void Substitute(const TDmaTransferArgs& aTransferArgs);
+	void Fixup(TLinAddr aChunkBase);
+	TBool CheckRange(TLinAddr aAddr, TUint aSize) const;
+
+private:
+	enum {MaxCount=6};
+	TInt iCount;
+	TInt iIndex;
+	TIsrRequeArgs iRequeArgs[MaxCount];
+	};
+
+class DDmaTestSession;
+class RDmaSession : public RBusLogicalChannel
+	{
+	friend class DDmaTestSession;
+public:
+#ifndef __KERNEL_MODE__
+	TInt ChannelIsQueueEmpty(TUint aDriverCookie,TBool& aQueueEmpty)
+		{
+		return DoControl(EIsQueueEmpty, reinterpret_cast<TAny*>(aDriverCookie),	&aQueueEmpty);		
+		}
+
+	TInt ChannelIsOpened(TUint aDriverCookie,TBool &aChannelOpen)
+		{
+		return DoControl(EIsOpened, reinterpret_cast<TAny*>(aDriverCookie), &aChannelOpen);		
+		}
+
+	TInt ChannelIsrRedoRequest(TUint aDriverCookie,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb)
+		{
+		TIsrRedoReqArgs args(aDriverCookie,aSrcAddr,aDstAddr,aTransferCount,aPslRequestInfo,aIsrCb);
+		TPckgC<TIsrRedoReqArgs> package(args);
+		return DoControl(EIsrRedoRequest,&package);
+		}
+
+	TInt ChannelCancelAll(TUint aDriverCookie)
+		{	
+		return DoControl(ECancelAllChannel, reinterpret_cast<TAny*>(aDriverCookie));
+		}
+
+	TInt ChannelOpen(TUint aPslCookie,  TUint& aDriverCookie)
+		{
+		return DoControl(EOpenChannel, reinterpret_cast<TAny*>(aPslCookie), &aDriverCookie);
+		}
+
+	TInt ChannelClose(TUint aDriverCookie)
+		{	
+		return DoControl(ECloseChannel, reinterpret_cast<TAny*>(aDriverCookie));
+		}
+
+	TInt ChannelPause(TUint aDriverCookie)
+		{	
+		return DoControl(EPauseChannel, reinterpret_cast<TAny*>(aDriverCookie));
+		}
+	
+	TInt ChannelResume(TUint aDriverCookie)
+		{	
+		return DoControl(EResumeChannel, reinterpret_cast<TAny*>(aDriverCookie));
+		}
+
+	TInt ChannelCaps(TUint aDriverCookie, SDmacCaps& aChannelCaps)
+		{
+		TDmacTestCaps caps;
+		TInt r = ChannelCaps(aDriverCookie, caps);
+		aChannelCaps = caps;
+		return r;
+		}
+
+	TInt ChannelCaps(TUint aDriverCookie, TDmacTestCaps& aChannelCaps)
+		{
+		TPckg<TDmacTestCaps> package(aChannelCaps);
+		return DoControl(EChannelCaps, reinterpret_cast<TAny*>(aDriverCookie), &package);
+		}
+	
+	TInt Open()
+		{// TO DO: Add Info , this  class is just to test the opening of channels
+		//TPckgBuf<TOpenInfo> infoBuf;
+		//infoBuf().iWhat = TOpenInfo::EOpen;
+		//infoBuf().U.iOpen.iId = aId;
+		//infoBuf().U.iOpen.iDesCount = aDesCount;
+		//infoBuf().U.iOpen.iMaxTransferSize = aMaxTransferSize;
+		return DoCreate(KTestDmaLddName,TestDmaLddVersion(), 0, NULL, NULL, EOwnerThread);
+		}
+
+	//TODO rename this (append "old")
+	TInt RequestCreate(TUint aChannelCookie, TUint& aRequestCookie, TUint aMaxTransferSize=0)
+		{	
+		return DoRequestCreate(aChannelCookie, EFalse, aMaxTransferSize, aRequestCookie);
+		}
+
+	//TODO rename this (get rid of "new"
+	TInt RequestCreateNew(TUint aChannelCookie, TUint& aRequestCookie, TUint aMaxTransferSize=0)
+		{
+		return DoRequestCreate(aChannelCookie, ETrue, aMaxTransferSize, aRequestCookie);
+		}
+
+	TInt RequestDestroy(TUint aRequestCookie)
+		{	
+		return DoControl(ERequestClose, reinterpret_cast<TAny*>(aRequestCookie));
+		}
+
+	TInt RequestFragmentCount(TUint aRequestCookie)
+		{	
+		return DoControl(EFragmentCount, reinterpret_cast<TAny*>(aRequestCookie));
+		}
+
+	/**
+	Will fragment a DMA request using the legacy API
+	*/
+	TInt FragmentRequestOld(TUint aRequestCookie, const TDmaTransferArgs& aTransferArgs, TUint64* aDurationMicroSecs=NULL)
+		{
+		const TFragmentArgs args(aRequestCookie, aTransferArgs, aDurationMicroSecs);
+		TPckgC<TFragmentArgs> package(args);
+		return DoControl(EFragmentLegacy, &package);
+		}
+
+	/**
+	Will fragment a DMA request using the new API
+	*/
+	TInt FragmentRequest(TUint aRequestCookie, const TDmaTransferArgs& aTransferArgs, TUint64* aDurationMicroSecs=NULL)
+		{
+		const TFragmentArgs args(aRequestCookie, aTransferArgs, aDurationMicroSecs);
+		TPckgC<TFragmentArgs> package(args);
+		return DoControl(EFragment, &package);
+		}
+
+	TInt QueueRequest(TUint aRequestCookie, TRequestStatus& aStatus, TCallbackRecord* aRecord = NULL, TUint64* aDurationMicroSecs=NULL)
+		{
+		//These dummy values can accept the writeback from the driver
+		//if the client does not want them.
+		//(TClientDataRequest can not be programmed with a NULL to
+		//indicate that an argument is unwanted)
+		TCallbackRecord dummyRec;
+		TUint64 dummyTime=0;
+
+		TQueueArgs args(aRequestCookie, &aStatus, aRecord ? aRecord : &dummyRec, aDurationMicroSecs ? aDurationMicroSecs : &dummyTime);
+		TPckgC<TQueueArgs> package(args);
+		return DoControl(EQueueRequest, &package);
+		}
+
+	/**
+	Synchronous version of QueueRequest
+	*/
+	TInt QueueRequest(TUint aRequestCookie, TCallbackRecord* aRecord = NULL, TUint64* aDurationMicroSecs=NULL)
+		{
+		TRequestStatus status;
+		TInt r = QueueRequest(aRequestCookie, status, aRecord, aDurationMicroSecs);
+		User::WaitForRequest(status);
+		return r;
+		}
+
+	/**
+	Queue a previously fragmented request.
+	Additional request parameters are included in iRequeueArgs, these will be
+	transferred from ISR context callback using the TDmaChannel::IsrRedoRequest function
+
+	@pre Isr callback for completion must have been requested at request fragmentation time
+	*/
+	TInt QueueRequestWithRequeue(TUint aRequestCookie, TIsrRequeArgs* aRequeueArgs, TInt aCount, TRequestStatus& aStatus, TCallbackRecord* aRecord = NULL, TUint64* aDurationMicroSecs=NULL)
+		{
+		//These dummy values can accept the writeback from the driver
+		//if the client does not want them.
+		//(TClientDataRequest can not be programmed with a NULL to
+		//indicate that an argument is unwanted)
+		TCallbackRecord dummyRec;
+		TUint64 dummyTime=0;
+
+		TQueueArgsWithReque args(aRequeueArgs, aCount, aRequestCookie, &aStatus, aRecord ? aRecord : &dummyRec, aDurationMicroSecs ? aDurationMicroSecs : &dummyTime);
+		TPckgC<TQueueArgsWithReque> package(args);
+		return DoControl(EQueueRequestWithReque, &package);
+		}
+
+	/**
+	Synchronous version of QueueRequestWithRequeue
+	*/
+	TInt QueueRequestWithRequeue(TUint aRequestCookie, TIsrRequeArgs* aRequeueArgs, TInt aCount, TCallbackRecord* aRecord = NULL, TUint64* aDurationMicroSecs=NULL)
+		{
+		TRequestStatus status;
+		TInt r = QueueRequestWithRequeue(aRequestCookie, aRequeueArgs, aCount, status, aRecord, aDurationMicroSecs);
+		User::WaitForRequest(status);
+		return r;
+		}
+
+	TInt OpenSharedChunk(RChunk& aChunk)
+		{
+		TUint chunkHandle = DoControl(EOpenSharedChunk);
+		return aChunk.SetReturnedHandle(chunkHandle);
+		}
+	
+	TInt GetTestInfo(TDmaV2TestInfo& aInfo)
+		{
+		TPckg<TDmaV2TestInfo> package(aInfo);
+		return DoControl(EGetTestInfo, &package);
+		}
+
+	static void SelfTest();
+	
+	static void ApiTest();
+#endif // __KERNEL_MODE__
+
+private:
+
+	TInt DoRequestCreate(TUint aChannelCookie, TBool aNewStyle, TUint aMaxTransferSize, TUint& aRequestCookie)
+		{
+		TRequestCreateArgs args(aChannelCookie, aNewStyle, aMaxTransferSize);
+		TPckgC<TRequestCreateArgs> package(args);
+		return DoControl(ERequestOpen, &package, &aRequestCookie);
+		}
+
+
+	struct TRequestCreateArgs
+		{
+		TRequestCreateArgs(TUint aChannelCookie, TBool aNewStyle, TUint aMaxFragmentSize)
+			:iChannelCookie(aChannelCookie), iNewStyle(aNewStyle), iMaxFragmentSize(aMaxFragmentSize)
+			{}
+
+		TUint iChannelCookie;
+		TBool iNewStyle;
+		TUint iMaxFragmentSize;
+		};
+
+	struct TFragmentArgs
+		{
+		TFragmentArgs()
+			:iRequestCookie(0), iTransferArgs(), iDurationMicroSecs(NULL)
+			{}
+		TFragmentArgs(TUint aRequestCookie, const TDmaTransferArgs& aTransferArgs, TUint64* aDurationMicroSecs = NULL)
+			:iRequestCookie(aRequestCookie), iTransferArgs(aTransferArgs), iDurationMicroSecs(aDurationMicroSecs)
+			{}
+
+		const TUint iRequestCookie;
+		const TDmaTransferArgs iTransferArgs;
+		TUint64* const iDurationMicroSecs;
+		};
+
+	struct TQueueArgs
+		{
+		TQueueArgs(TUint aRequestCookie=0, TRequestStatus* aStatus=NULL, TCallbackRecord* aCallbackRecord=NULL, TUint64* aDurationMicroSecs=NULL)
+			:iRequestCookie(aRequestCookie), iStatus(aStatus), iCallbackRecord(aCallbackRecord), iDurationMicroSecs(aDurationMicroSecs)
+			{}
+		TUint iRequestCookie;
+		TRequestStatus* iStatus;
+		TCallbackRecord* iCallbackRecord;
+		TUint64* iDurationMicroSecs;
+		};
+
+	struct TIsrRedoReqArgs 	
+		{
+		TIsrRedoReqArgs(TUint aDriverCookie=0,TUint32 aSrcAddr=0, TUint32 aDstAddr=0, TInt aTransferCount=0, TUint32 aPslRequestInfo=0,TBool aIsrCb=ETrue)
+			:iDriverCookie(aDriverCookie),iSrcAddr(aSrcAddr),iDstAddr(aDstAddr),iTransferCount(aTransferCount),iPslRequestInfo(aPslRequestInfo),iIsrCb(aIsrCb)
+			{}
+		TUint iDriverCookie;
+		TUint32 iSrcAddr;
+		TUint32 iDstAddr;
+		TInt iTransferCount;
+		TUint32 iPslRequestInfo;
+		TBool iIsrCb;
+		};
+
+	/**
+	This struct is used for queing and including a set of transfers
+	to be setup from ISR context callback
+	*/
+	struct TQueueArgsWithReque : public TQueueArgs
+		{
+		TQueueArgsWithReque(TIsrRequeArgs* aRequeueArgs=NULL, TInt aCount=0,
+				TUint aRequestCookie=0, TRequestStatus* aStatus=NULL, TCallbackRecord* aCallbackRecord=NULL, TUint64* aDurationMicroSecs=NULL)
+			:TQueueArgs(aRequestCookie, aStatus, aCallbackRecord, aDurationMicroSecs), iRequeSet(aRequeueArgs, aCount)
+			{
+			}
+
+		TIsrRequeArgsSet iRequeSet;
+		};
+
+
+	enum TControl
+		{
+		EOpenChannel,
+		ECloseChannel,
+		EPauseChannel,
+		EResumeChannel,
+		EChannelCaps,
+		ERequestOpen,
+		ERequestClose,
+		EOpenSharedChunk,
+		EFragmentLegacy,
+		EFragment,
+		EFragmentCount,
+		EQueueRequest,
+		EGetTestInfo,
+		EIsQueueEmpty,
+		EIsOpened,
+		EIsrRedoRequest,
+		ECancelAllChannel,
+		EQueueRequestWithReque
+		};
+	};
+#endif // __D_DMA2_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/d_dma2_cmn.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,328 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implmentation of DMAv2 test code, common
+* to both user and kernel side
+*
+*/
+#ifdef __KERNEL_MODE__
+#include <platform.h>
+#endif
+
+#include "d_dma2.h"
+
+TInt Log2(TInt aNum)
+	{
+	TInt res = -1;
+	while(aNum)
+		{
+		res++;
+		aNum >>= 1;
+		}
+	return res;
+	}
+
+TCallbackRecord::TCallbackRecord(
+		TCbContext aContext,
+		TInt aReq,
+		TInt aReqSrc,
+		TInt aReqDst,
+		TInt aDes,
+		TInt aDesSrc,
+		TInt aDesDst,
+		TInt aFrame,
+		TInt aFrameSrc,
+		TInt aFrameDst,
+		TInt aPause,
+		TInt aPauseSrc,
+		TInt aPauseDst,
+		TDmaResult aResult
+	)
+	//Default iIsrRedoRequestResult is 1 as this is an invalid error code
+	:iResult(aResult), iContext(aContext), iIsrRedoRequestResult(1)
+	{
+	SetCount(EDmaCallbackRequestCompletion, aReq);
+	SetCount(EDmaCallbackRequestCompletion_Src, aReqSrc);
+	SetCount(EDmaCallbackRequestCompletion_Dst, aReqDst);
+	SetCount(EDmaCallbackDescriptorCompletion, aDes);
+	SetCount(EDmaCallbackDescriptorCompletion_Src, aDesSrc);
+	SetCount(EDmaCallbackDescriptorCompletion_Dst, aDesDst);
+	SetCount(EDmaCallbackFrameCompletion, aFrame);
+	SetCount(EDmaCallbackFrameCompletion_Src, aFrameSrc);
+	SetCount(EDmaCallbackFrameCompletion_Dst, aFrameDst);
+	SetCount(EDmaCallbackLinkedListPaused, aPause);
+	SetCount(EDmaCallbackLinkedListPaused_Src, aPauseSrc);
+	SetCount(EDmaCallbackLinkedListPaused_Dst, aPauseDst);
+	}
+
+TCallbackRecord TCallbackRecord::Empty()
+	{
+	return TCallbackRecord(EInvalid,0,0,0,0,0,0,0,0,0,0,0,0,EDmaResultError);
+	}
+
+void TCallbackRecord::Reset()
+	{
+	new (this) TCallbackRecord();
+	}
+
+TBool TCallbackRecord::operator == (const TCallbackRecord aOther) const
+	{
+	return (memcompare((TUint8*)this, sizeof(*this), (TUint8*)&aOther, sizeof(aOther)) == 0);
+	}
+
+TInt TCallbackRecord::GetCount(TDmaCallbackType aCbType) const
+	{
+	const TInt index = BitToIndex(aCbType);
+	return iCallbackLog[index];
+	}
+
+void TCallbackRecord::SetCount(TDmaCallbackType aCbType, TInt aCount)
+	{
+	const TInt index = BitToIndex(aCbType);
+	iCallbackLog[index] = aCount;
+	}
+
+TInt TCallbackRecord::BitToIndex(TDmaCallbackType aCbType) const
+	{
+	const TInt index = Log2(aCbType);
+	TEST_ASSERT(index >=0 && index < KNumberOfCallbacks);
+
+	return index;
+	}
+
+void TCallbackRecord::ProcessCallback(TUint aCallbackMask, TDmaResult aResult)
+	{
+	// This function may be called several
+	// times and will accumulate the number of each callback
+	// received. However, it will only ever remember the last
+	// result and context value,
+	iResult = aResult;
+	iContext = CurrentContext();
+	TEST_ASSERT(iContext != EInvalid);
+
+	for(TInt i=0; i < KNumberOfCallbacks; i++)
+		{
+		if(aCallbackMask & 1)
+			{
+			iCallbackLog[i]++;
+			}
+		aCallbackMask >>= 1;
+		}
+	// Assert that we have handled all bits
+	// if not then maybe KNumberOfCallbacks is too small
+	// or there is a spurious bit in aCallbackMask
+	TEST_ASSERT(aCallbackMask == 0);
+	}
+
+TCallbackRecord::TCbContext TCallbackRecord::CurrentContext() const
+	{
+#ifdef __KERNEL_MODE__
+	switch(NKern::CurrentContext())
+		{
+	case NKern::EThread:
+		return EThread;
+	case NKern::EInterrupt:
+		return EIsr;
+	case NKern::EIDFC: //fall-through
+	case NKern::EEscaped:
+	default:
+		return EInvalid;
+		}
+#else
+	//for the benefit of user-mode testing
+	return EThread;
+#endif
+	}
+
+void TCallbackRecord::Print() const
+	{
+	PRINT(GetCount(EDmaCallbackRequestCompletion));
+	PRINT(GetCount(EDmaCallbackRequestCompletion_Src));
+	PRINT(GetCount(EDmaCallbackRequestCompletion_Dst));
+	PRINT(GetCount(EDmaCallbackDescriptorCompletion));
+	PRINT(GetCount(EDmaCallbackDescriptorCompletion_Src));
+	PRINT(GetCount(EDmaCallbackDescriptorCompletion_Dst));
+	PRINT(GetCount(EDmaCallbackFrameCompletion));
+	PRINT(GetCount(EDmaCallbackFrameCompletion_Src));
+	PRINT(GetCount(EDmaCallbackFrameCompletion_Dst));
+	PRINT(GetCount(EDmaCallbackLinkedListPaused));
+	PRINT(GetCount(EDmaCallbackLinkedListPaused_Src));
+	PRINT(GetCount(EDmaCallbackLinkedListPaused_Dst));
+	PRINT(iResult);
+	PRINT(iContext);
+	PRINT(iIsrRedoRequestResult);
+	}
+
+TDmacTestCaps::TDmacTestCaps()
+	:iPILVersion(1)
+	{
+	}
+
+TDmacTestCaps::TDmacTestCaps(const SDmacCaps& aDmacCaps, TInt aVersion)
+	:SDmacCaps(aDmacCaps), iPILVersion(aVersion)
+	{}
+
+TAddrRange::TAddrRange(TUint aStart, TUint aLength)
+	:iStart(aStart), iLength(aLength)
+	{
+	TEST_ASSERT(iLength > 0);
+	}
+
+TBool TAddrRange::Contains(TAddrRange aRange) const
+	{
+	return Contains(aRange.Start()) && Contains(aRange.End());
+	}
+
+TBool TAddrRange::Overlaps(const TAddrRange& aRange) const
+	{
+	return (aRange.Contains(iStart) || aRange.Contains(End()) ||
+			Contains(aRange.Start()) || Contains(aRange.End()));
+	}
+/**
+If addresses have been left as KPhysAddrInvalid or the count as 0
+(ie. the default values used for IsrRedoRequest)
+then substitute the values from aTransferArgs.
+*/
+void TAddressParms::Substitute(const TDmaTransferArgs& aTransferArgs)
+	{
+	if(iSrcAddr == KPhysAddrInvalidUser)
+		iSrcAddr = aTransferArgs.iSrcConfig.iAddr;
+
+	if(iDstAddr == KPhysAddrInvalidUser)
+		iDstAddr = aTransferArgs.iDstConfig.iAddr;
+
+	if(iTransferCount == 0)
+		iTransferCount = aTransferArgs.iTransferCount;
+	}
+
+/**
+Addresses are converted into absolute,
+addresses (virtual in user mode, physical in kernel)
+unless they are KPhysAddrInvalid
+*/
+void TAddressParms::Fixup(TLinAddr aChunkBase)
+	{
+	if(iSrcAddr != KPhysAddrInvalidUser)
+		{
+		iSrcAddr += aChunkBase;
+
+#ifdef __KERNEL_MODE__
+		iSrcAddr = Epoc::LinearToPhysical(iSrcAddr);
+		TEST_ASSERT(iSrcAddr != KPhysAddrInvalid);
+#endif
+		}
+#ifndef __KERNEL_MODE__
+	else
+		{
+		// Substitute must be called before
+		// Fixup on user side
+		TEST_FAULT;
+		}
+#endif
+
+	if(iDstAddr != KPhysAddrInvalidUser)
+		{
+		iDstAddr += aChunkBase;
+
+#ifdef __KERNEL_MODE__
+		iDstAddr = Epoc::LinearToPhysical(iDstAddr);
+		TEST_ASSERT(iDstAddr != KPhysAddrInvalid);
+#endif
+		}
+#ifndef __KERNEL_MODE__
+	else
+		{
+		// Substitute must be called before
+		// Fixup on user side
+		TEST_FAULT;
+		}
+#endif
+	}
+
+TBool TAddressParms::CheckRange(TLinAddr aStart, TUint aSize)
+	{
+	TAddrRange chunk(aStart, aSize);
+	return chunk.Contains(SourceRange()) && chunk.Contains(DestRange());
+	}
+
+/**
+@return ETrue if the source or destination range of this object
+overlaps with aRange
+*/
+TBool TAddressParms::Overlaps(const TAddrRange aRange) const
+	{
+	return SourceRange().Overlaps(aRange) || DestRange().Overlaps(aRange);
+	}
+
+/**
+@return ETrue if either the source or dest range of this
+overlap with either of those of aParm
+*/
+TBool TAddressParms::Overlaps(const TAddressParms aParm) const
+	{
+	return Overlaps(aParm.SourceRange()) || Overlaps(aParm.DestRange());
+	}
+
+TBool TAddressParms::operator==(const TAddressParms& aOther) const
+	{
+	return iSrcAddr == aOther.iSrcAddr &&
+		iDstAddr == aOther.iDstAddr &&
+		iTransferCount == aOther.iTransferCount;
+	}
+
+TAddressParms GetAddrParms(const TDmaTransferArgs& aArgs)
+	{
+	return TAddressParms(aArgs);
+	}
+
+TAddrRange TAddressParms::SourceRange() const
+	{
+	return TAddrRange(iSrcAddr, iTransferCount);
+	}
+
+TAddrRange TAddressParms::DestRange() const
+	{
+	return TAddrRange(iDstAddr, iTransferCount);
+	}
+
+void SetAddrParms(TDmaTransferArgs& aTransferArgs, const TAddressParms& aAddrParams)
+	{
+	aTransferArgs.iSrcConfig.iAddr = aAddrParams.iSrcAddr;
+	aTransferArgs.iDstConfig.iAddr = aAddrParams.iDstAddr;
+	aTransferArgs.iTransferCount = aAddrParams.iTransferCount;
+	}
+
+TIsrRequeArgs TIsrRequeArgsSet::GetArgs()
+	{
+	TEST_ASSERT(!IsEmpty());
+	const TIsrRequeArgs args(iRequeArgs[iIndex]);
+	iIndex++;
+	iCount--;
+	return args;
+	}
+
+
+void TIsrRequeArgsSet::Substitute(const TDmaTransferArgs& aTransferArgs)
+	{
+	for(TInt i=0; i<iCount; i++)
+		{
+		iRequeArgs[i].Substitute(aTransferArgs);
+		}
+	}
+void TIsrRequeArgsSet::Fixup(TLinAddr aChunkBase)
+	{
+	for(TInt i=0; i<iCount; i++)
+		{
+		iRequeArgs[i].Fixup(aChunkBase);
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/dma_api_tests.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,188 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test\dma\dma_api_tests.cpp
+// 
+// Overview:
+//  This file contains API tests for the new DMA framework
+//
+
+#define __E32TEST_EXTENSION__
+#include "d_dma2.h"
+#include "u32std.h"
+#include "t_dma2.h"
+#include "cap_reqs.h"
+
+#include <e32test.h>
+#include <e32debug.h>
+#include <e32svr.h>
+
+static RTest test(_L("DMA Test Framework API"));
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2564
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    This test checks the correct behaviour of Open API in the new DMA framework
+//!
+//! @SYMTestActions     
+//!						1.  Open a DMA channel
+//!						2.	Verify that channel is really open.
+//!
+//! @SYMTestExpectedResults 
+//!						1.  DMA channel opens and KErrNone returned
+//!						2.  Call to ChannelIsOpened() return as ETrue.
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+void test_open_api()
+{
+	//TO DO : Expose TInt Open(const SCreateInfo& aInfo, TDmaChannel*& aChannel)
+	//TO DO : Implement more test cases
+	test.Start(_L("*** Testing Open() API  ***"));
+
+	test.Next(_L("Open session"));
+	RDmaSession session;
+	TInt r = session.Open();
+	test_KErrNone(r);
+
+	TUint channelCookie_open_api=0;
+	
+	test.Next(_L("Open DMA Channel"));
+	channelCookie_open_api=0;
+	r = session.ChannelOpen(16, channelCookie_open_api);
+	test.Printf(_L("cookie recieved = 0x%08x\n"), channelCookie_open_api);
+	test_KErrNone(r);
+
+	//Check if channel is open
+	// test.Printf(_L("Verify that the specified DMA channel is opened\n"));	
+	// TBool channelOpened;
+	// TBool channelNotOpened = EFalse;
+	// r = session.ChannelIsOpened(channelCookie_open_api,  channelOpened);
+	// test_KErrNone(r);	
+ 	// TEST_ASSERT(channelOpened != channelNotOpened)
+	
+	//close channel
+	test.Next(_L("Channel close"));
+	r = session.ChannelClose(channelCookie_open_api);
+	test_KErrNone(r);
+	
+	RTest::CloseHandleAndWaitForDestruction(session);
+	test.End();
+}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2568
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    This test checks the correct behaviour of Close API in the new DMA framework
+//!
+//! @SYMTestActions     
+//!						1.  Open a DMA channel
+//!						2.	Open DMA Channel again
+//!						3	Close the DMA channel.
+//!						4	Open DMA channel to verify that the DMA channel closed.
+//!						5.	Open DMA channel again.
+//!						6.	Queue a request on the channel.
+//!						7.	Close DMA channel while request is still queued on it.
+//!
+//! @SYMTestExpectedResults 
+//!						1.  DMA channel opens and KErrNone returned.
+//!						2.	DMA Framework returns KErrInUse as channel is already open.					
+//!						3.	DMA channel closes and KErrNone returned.
+//!						4.	DMA channel opens and KErrNone returned.
+//!						5.	DMA Framework returns KErrInUse as channel is already open.
+//!						6.	DMA request queued and KErrNone returned.
+//!						7.	DMA channel closes and DMA framework flags an error.
+//!							
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+void test_close_api()
+{
+	test.Start(_L("*** Testing Close() API  ***"));
+	
+	test.Next(_L("Open session"));
+	RDmaSession session;
+	TInt r = session.Open();
+	test_KErrNone(r);
+
+	const TInt size = 64 * KKilo;
+	TUint reqCookieNewStyle_close_api=0;	
+	TUint channelCookie_close_api=0;
+	
+	test.Next(_L("Open a single DMA channel"));
+	r = session.ChannelOpen(16, channelCookie_close_api);
+	test.Printf(_L("cookie recieved = 0x%08x\n"), channelCookie_close_api);
+	test_KErrNone(r);
+
+	// test.Next(_L("Open DMA channel again"));
+	// TUint channelCookie_close_api_1=0;
+	// r = session.ChannelOpen(16, channelCookie_close_api_1);
+	// test.Printf(_L("Verify that DMA channel is already opened\n"));
+	// test_Equal(KErrInUse,r); 
+
+	test.Next(_L("Close the DMA channel"));
+	r = session.ChannelClose(channelCookie_close_api);
+	test_KErrNone(r);
+
+	test.Next(_L("Open DMA channel again"));
+	r = session.ChannelOpen(16, channelCookie_close_api);
+	test.Printf(_L("Verify that DMA channel was closed\n"));
+	test_KErrNone(r); 
+
+	//Fails if a request is created and cancel
+	test.Next(_L("Queue a request on the channel"));
+  	r = session.RequestCreateNew(channelCookie_close_api, reqCookieNewStyle_close_api); //Create Dma request (with new-style callback)
+  	test.Printf(_L("cookie recieved for open channel = 0x%08x\n"), reqCookieNewStyle_close_api);
+  	test_KErrNone(r);
+  
+  	TDmaTransferArgs transferArgs_close_api;
+  	transferArgs_close_api.iSrcConfig.iAddr = 0;
+  	transferArgs_close_api.iDstConfig.iAddr = size;
+  	transferArgs_close_api.iSrcConfig.iFlags = KDmaMemAddr;
+  	transferArgs_close_api.iDstConfig.iFlags = KDmaMemAddr;
+  	transferArgs_close_api.iTransferCount = size;
+  	r = session.FragmentRequest(reqCookieNewStyle_close_api, transferArgs_close_api);
+  	test_KErrNone(r);
+  	
+  	test.Next(_L("Queue DMA Request"));
+  	TCallbackRecord record_close_api;
+  	r = session.QueueRequest(reqCookieNewStyle_close_api, &record_close_api);
+  	test_KErrNone(r);
+	
+	test.Next(_L("Destroy Dma request"));
+	r = session.RequestDestroy(reqCookieNewStyle_close_api);
+	test_KErrNone(r);
+
+	test.Next(_L("Close the DMA channel"));
+	r = session.ChannelClose(channelCookie_close_api);
+	test_KErrNone(r);
+
+	test.End();
+	RTest::CloseHandleAndWaitForDestruction(session);
+}
+
+void RDmaSession::ApiTest()
+	{
+    test_open_api();     // Verify that Open() opens a DMA channel
+    test_close_api();    // Verify that Close() closes a DMA channel
+	}
+
+void ApiTests()
+	{
+	test.Next(_L("Running framework API tests"));
+	RDmaSession::ApiTest();	
+	test.Close();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/self_test.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,665 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This file contains unit tests for the test framework itself.
+* They should be run if changes have been made to
+* to the user side test framework code ie. anything in the dmav2
+* directory other than the d_* driver code, or test_cases.cpp
+*
+*/
+
+#include "d_dma2.h"
+#include "u32std.h"
+#include "t_dma2.h"
+#include "cap_reqs.h"
+
+#define __E32TEST_EXTENSION__
+#include <e32test.h>
+#include <e32debug.h>
+#include <e32svr.h>
+
+static RTest test(_L("t_dma2 test framework tests"));
+
+void RDmaSession::SelfTest()
+	{
+	test.Start(_L("Simple transfer test"));
+	test.Next(_L("Open session"));
+	RDmaSession session;
+	TInt r = session.Open();
+	test_KErrNone(r);
+
+	test.Next(_L("Get test info"));
+	TDmaV2TestInfo testInfo;
+	r = session.GetTestInfo(testInfo);
+	test_KErrNone(r);
+
+	if(gVerboseOutput)
+	{
+	Print(testInfo);
+	}
+
+	test.Next(_L("Channel open"));
+	TUint channelCookie=0;
+	r = session.ChannelOpen(16, channelCookie);
+	test.Printf(_L("cookie recived = 0x%08x\n"), channelCookie);
+	test_KErrNone(r);
+
+	test.Next(_L("Get Channel caps"));
+	SDmacCaps channelCaps;
+	r = session.ChannelCaps(channelCookie, channelCaps);
+	test_KErrNone(r);
+	if(gVerboseOutput)
+	{
+	PRINT(channelCaps.iChannelPriorities);
+	PRINT(channelCaps.iChannelPauseAndResume);
+	PRINT(channelCaps.iAddrAlignedToElementSize);
+	PRINT(channelCaps.i1DIndexAddressing);
+	PRINT(channelCaps.i2DIndexAddressing);
+	PRINT(channelCaps.iSynchronizationTypes);
+	PRINT(channelCaps.iBurstTransactions);
+	PRINT(channelCaps.iDescriptorInterrupt);
+	PRINT(channelCaps.iFrameInterrupt);
+	PRINT(channelCaps.iLinkedListPausedInterrupt);
+	PRINT(channelCaps.iEndiannessConversion);
+	PRINT(channelCaps.iGraphicsOps);
+	PRINT(channelCaps.iRepeatingTransfers);
+	PRINT(channelCaps.iChannelLinking);
+	PRINT(channelCaps.iHwDescriptors);
+	PRINT(channelCaps.iSrcDstAsymmetry);
+	PRINT(channelCaps.iAsymHwDescriptors);
+	PRINT(channelCaps.iBalancedAsymSegments);
+	PRINT(channelCaps.iAsymCompletionInterrupt);
+	PRINT(channelCaps.iAsymDescriptorInterrupt);
+	PRINT(channelCaps.iAsymFrameInterrupt);
+	PRINT(channelCaps.iReserved[0]);
+	PRINT(channelCaps.iReserved[1]);
+	PRINT(channelCaps.iReserved[2]);
+	PRINT(channelCaps.iReserved[3]);
+	PRINT(channelCaps.iReserved[4]);	
+	}
+
+	test.Next(_L("Get extended Channel caps (TDmacTestCaps)"));
+	TDmacTestCaps extChannelCaps;
+	r = session.ChannelCaps(channelCookie, extChannelCaps);
+	test_KErrNone(r);
+	test.Printf(_L("PIL version = %d\n"), extChannelCaps.iPILVersion);
+
+	const TBool newPil = (extChannelCaps.iPILVersion > 1);
+
+	test.Next(_L("Create Dma request - max fragment size 32K"));
+	TUint reqCookie=0;
+	r = session.RequestCreate(channelCookie, reqCookie, 32 * KKilo);
+	test.Printf(_L("cookie recived = 0x%08x\n"), reqCookie);
+	test_KErrNone(r);
+
+	if(newPil)
+		{
+		test.Next(_L("Create Dma request (with new-style callback)"));
+		TUint reqCookieNewStyle=0;
+		r = session.RequestCreateNew(channelCookie, reqCookieNewStyle);
+		test.Printf(_L("cookie recived = 0x%08x\n"), reqCookieNewStyle );
+		test_KErrNone(r);
+
+		test.Next(_L("Fragment for ISR callback"));
+		const TInt size = 128 * KKilo;
+		TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
+		r = session.FragmentRequest(reqCookieNewStyle, transferArgs);
+		test_KErrNone(r);
+
+		TIsrRequeArgs reque;
+		test.Next(_L("Queue ISR callback - with default re-queue"));
+		r = session.QueueRequestWithRequeue(reqCookieNewStyle, &reque, 1);
+		test_KErrNone(r);
+
+		test.Next(_L("Destroy new-style Dma request"));
+		r = session.RequestDestroy(reqCookieNewStyle);
+		test_KErrNone(r);
+
+		test.Next(_L("Attempt to destroy request again "));
+		r = session.RequestDestroy(reqCookieNewStyle);
+		test_Equal(KErrNotFound, r);
+		}
+
+	test.Next(_L("Open chunk handle"));
+	RChunk chunk;
+	r = session.OpenSharedChunk(chunk);
+	test_KErrNone(r);
+	if(gVerboseOutput)
+	{
+	test.Printf(_L("chunk base = 0x%08x\n"), chunk.Base());
+	test.Printf(_L("chunk size = %d\n"), chunk.Size());
+	}
+	test(chunk.IsWritable());
+	test(chunk.IsReadable());
+
+	test.Next(_L("Fragment(old style)"));
+	const TInt size = 128 * KKilo;
+	TInt i;
+	for(i = 0; i<10; i++)
+		{
+		TUint64 time = 0;
+		TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+		r = session.FragmentRequestOld(reqCookie, transferArgs, &time);
+		test_KErrNone(r);
+		if(gVerboseOutput)
+			{
+			test.Printf(_L("%lu us\n"), time);
+			}
+	}
+
+	test.Next(_L("Queue"));
+	TRequestStatus status;
+
+	for(i = 0; i<10; i++)
+		{
+		TUint64 time = 0;
+		r = session.QueueRequest(reqCookie, status, 0, &time);
+		User::WaitForRequest(status);
+		test_KErrNone(r);
+		if(gVerboseOutput)
+			{
+			test.Printf(_L("%lu us\n"), time);
+			}
+		}
+
+	if(newPil)
+		{
+		test.Next(_L("Fragment(new style)"));
+		TDmaTransferArgs transferArgs;
+		transferArgs.iSrcConfig.iAddr = 0;
+		transferArgs.iDstConfig.iAddr = size;
+		transferArgs.iSrcConfig.iFlags = KDmaMemAddr;
+		transferArgs.iDstConfig.iFlags = KDmaMemAddr;
+		transferArgs.iTransferCount = size;
+
+		for(i = 0; i<10; i++)
+			{
+			TUint64 time = 0;
+			r = session.FragmentRequest(reqCookie, transferArgs, &time);
+			test_KErrNone(r);
+			if(gVerboseOutput)
+				{
+				test.Printf(_L("%lu us\n"), time);
+				}
+			}
+		}
+
+	test.Next(_L("Queue"));
+	TCallbackRecord record;
+	r = session.QueueRequest(reqCookie, &record);
+	test_KErrNone(r);
+
+	test.Next(_L("check TCallbackRecord record"));
+	if(gVerboseOutput)
+	{
+	record.Print();
+	}
+	const TCallbackRecord expected(TCallbackRecord::EThread, 1);
+	if(!(record == expected))
+		{
+		test.Printf(_L("TCallbackRecords did not match"));
+		if(gVerboseOutput)
+			{
+			test.Printf(_L("expected:"));
+			expected.Print();
+			}
+		TEST_FAULT;
+		}
+
+	test.Next(_L("Destroy Dma request"));
+	r = session.RequestDestroy(reqCookie);
+	test_KErrNone(r);
+
+	test.Next(_L("Close chunk handle"));
+	chunk.Close();
+
+	test.Next(_L("Channel close"));
+	r = session.ChannelClose(channelCookie);
+	test_KErrNone(r);
+
+	test.Next(_L("Channel close (same again)"));
+	r = session.ChannelClose(channelCookie);
+	test_Equal(KErrNotFound, r);
+
+	test.Next(_L("Close session"));
+	RTest::CloseHandleAndWaitForDestruction(session);
+
+	test.End();
+
+	}
+
+const SDmacCaps KTestCapSet =
+	{6,										// TInt iChannelPriorities;
+	 EFalse,								// TBool iChannelPauseAndResume;
+	 ETrue,									// TBool iAddrAlignedToElementSize;
+	 EFalse,								// TBool i1DIndexAddressing;
+	 EFalse,								// TBool i2DIndexAddressing;
+	 KDmaSyncSizeElement | KDmaSyncSizeFrame |
+	 KDmaSyncSizeBlock,					   // TUint iSynchronizationTypes;
+	 KDmaBurstSize4 | KDmaBurstSize8,	   // TUint iBurstTransactions;
+	 EFalse,							   // TBool iDescriptorInterrupt;
+	 EFalse,							   // TBool iFrameInterrupt;
+	 EFalse,							   // TBool iLinkedListPausedInterrupt;
+	 EFalse,							   // TBool iEndiannessConversion;
+	 0,									   // TUint iGraphicsOps;
+	 ETrue,								   // TBool iRepeatingTransfers;
+	 EFalse,							   // TBool iChannelLinking;
+	 ETrue,								   // TBool iHwDescriptors;
+	 EFalse,							   // TBool iSrcDstAsymmetry;
+	 EFalse,							   // TBool iAsymHwDescriptors;
+	 EFalse,							   // TBool iBalancedAsymSegments;
+	 EFalse,							   // TBool iAsymCompletionInterrupt;
+	 EFalse,							   // TBool iAsymDescriptorInterrupt;
+	 EFalse,							   // TBool iAsymFrameInterrupt;
+	 {0, 0, 0, 0, 0}					   // TUint32 iReserved[5];
+	};
+
+const TDmacTestCaps KDmacTestCapsV1(KTestCapSet, 1);
+const TDmacTestCaps KDmacTestCapsV2(KTestCapSet, 2);
+
+void TDmaCapability::SelfTest()
+	{
+	test.Start(_L("Unit test_Value of TDmaCapability::CompareToDmaCaps\n"));
+
+	{
+	test.Next(_L("ENone\n"));
+	TResult t = none.CompareToDmaCaps(KTestCapSet);
+	test_Value(t, t == ERun);
+	}
+
+	{
+	test.Next(_L("EChannelPauseAndResume - wanted\n"));
+	TResult t = pauseRequired.CompareToDmaCaps(KTestCapSet);
+	test_Value(t, t == EFail);
+	}
+	{
+	test.Next(_L("EChannelPauseAndResume - wanted - Allow skip\n"));
+	TResult t = pauseRequired_skip.CompareToDmaCaps(KTestCapSet);
+	test_Value(t, t == ESkip);
+	}
+	{
+	test.Next(_L("EChannelPauseAndResume - not wanted\n"));
+	TResult t = pauseNotWanted.CompareToDmaCaps(KTestCapSet);
+	test_Value(t, t == ERun);
+	}
+
+	{
+	test.Next(_L("EHwDescriptors - not wanted\n"));
+	TResult t = hwDesNotWanted.CompareToDmaCaps(KTestCapSet);
+	test_Value(t, t == EFail);
+	}
+
+	{
+	test.Next(_L("EHwDescriptors - not wanted - Allow skip\n"));
+	TResult t = hwDesNotWanted_skip.CompareToDmaCaps(KTestCapSet);
+	test_Value(t, t == ESkip);
+	}
+
+	{
+	test.Next(_L("EHwDescriptors - wanted\n"));
+	TResult t = hwDesWanted.CompareToDmaCaps(KTestCapSet);
+	test_Value(t, t == ERun);
+	}
+
+
+//TODO use this macro for the above tests
+
+// Note: The construction of the test description message
+// is horribly confusing. The _L macro will make the
+// *first* string token wide, but not the next two.
+// Therefore these must be made wide or compilier
+// will complain about concatination of narrow and wide string
+// literals
+#define CAP_TEST(CAP, CAPSET, EXPCT)\
+	{\
+	test.Next(_L(#CAP L" against " L ## #CAPSET));\
+	TResult t = (CAP).CompareToDmaCaps(CAPSET);\
+	test_Equal(EXPCT, t);\
+	}
+
+
+	CAP_TEST(capEqualV1, KDmacTestCapsV1, ERun);
+	CAP_TEST(capEqualV2, KDmacTestCapsV2, ERun);
+	CAP_TEST(capEqualV1, KDmacTestCapsV2, ESkip);
+	CAP_TEST(capEqualV2, KDmacTestCapsV1, ESkip);
+	CAP_TEST(capEqualV2Fatal, KDmacTestCapsV1, EFail);
+
+	CAP_TEST(capAboveV1, KDmacTestCapsV2, ERun);
+	CAP_TEST(capBelowV2, KDmacTestCapsV1, ERun);
+	CAP_TEST(capAboveV1, KDmacTestCapsV1, ESkip);
+	CAP_TEST(capBelowV2, KDmacTestCapsV2, ESkip);
+
+	test.End();
+	}
+
+void TTestCase::SelfTest()
+	{
+	//TODO should use macros for these tests
+	test.Start(_L("Unit test of TTestCase::TestCaseValid\n"));
+
+	TTestCase testCase(NULL, EFalse, pauseRequired, hwDesNotWanted);
+	test.Next(_L("pauseRequired, hwDesNotWanted\n"));
+	TResult t = testCase.TestCaseValid(KTestCapSet);
+	test_Value(t, t == EFail);
+
+	test.Next(_L("pauseRequired_skip, hwDesNotWanted\n"));
+	testCase.iChannelCaps[0] = pauseRequired_skip;
+	t = testCase.TestCaseValid(KTestCapSet);
+	test_Value(t, t == EFail);
+
+	test.Next(_L("pauseRequired_skip, hwDesNotWanted_skip\n"));
+	testCase.iChannelCaps[1] = hwDesNotWanted_skip;
+	t = testCase.TestCaseValid(KTestCapSet);
+	test_Value(t, t == ESkip);
+
+	test.Next(_L("pauseNotWanted, hwDesNotWanted_skip\n"));
+	testCase.iChannelCaps[0] = pauseNotWanted;
+	t = testCase.TestCaseValid(KTestCapSet);
+	test_Value(t, t == ESkip);
+
+	test.Next(_L("pauseNotWanted, hwDesWanted\n"));
+	testCase.iChannelCaps[1] = hwDesWanted;
+	t = testCase.TestCaseValid(KTestCapSet);
+	test_Value(t, t == ERun);
+
+	test.Next(_L("pauseNotWanted\n"));
+	testCase.iChannelCaps[1] = none;
+	t = testCase.TestCaseValid(KTestCapSet);
+	test_Value(t, t == ERun);
+
+	test.Next(_L("pauseNotWanted + V1 PIL required\n"));
+	testCase.iChannelCaps[1] = capAboveV1;
+	test.Next(_L("Against KDmacTestCapsV1"));
+	t = testCase.TestCaseValid(KDmacTestCapsV1);
+	test_Equal(ESkip, t);
+	test.Next(_L("Against KDmacTestCapsV2"));
+	t = testCase.TestCaseValid(KDmacTestCapsV2);
+	test_Equal(ERun, t);
+
+	test.Next(_L("pauseNotWanted + >V1 PIL required\n"));
+	testCase.iChannelCaps[1] = capBelowV2;
+	test.Next(_L("Against KDmacTestCapsV1"));
+	t = testCase.TestCaseValid(KDmacTestCapsV1);
+	test_Equal(ERun, t);
+	test.Next(_L("Against KDmacTestCapsV2"));
+	t = testCase.TestCaseValid(KDmacTestCapsV2);
+	test_Equal(ESkip, t);
+
+	test.End();
+	test.Close();
+	}
+
+
+void TTransferIter::SelfTest()
+	{
+	test.Start(_L("No skip"));
+
+	const TUint8 src[9] = {
+			1 ,2, 3,
+			4, 5, 6,
+			7, 8, 9
+	};
+
+	const TUint32 addr = (TUint32)src;
+	const TUint elementSize = 1;
+	const TUint elementSkip = 0;
+	const TUint elementsPerFrame = 3;
+	const TUint frameSkip = 0;
+	const TUint framesPerTransfer = 3;
+	TDmaTransferConfig cfg(addr, elementSize, elementsPerFrame, framesPerTransfer,
+			elementSkip, frameSkip, KDmaMemAddr
+			);
+
+	TTransferIter iter(cfg, 0);
+	TTransferIter end;
+	TInt i;
+	for(i = 0; i<9; i++, ++iter)
+		{
+		test_Equal(src[i],*iter);
+		};
+
+
+	test.Next(_L("90 degree rotation"));
+	// Now imagine that we wanted to perform a rotation
+	// as we write, so that we wrote out the following
+
+	const TUint8 expected[9] = {
+		7, 4, 1,
+		8, 5, 2,
+		9, 6, 3
+	};
+
+	TUint8 dst[9] = {0};
+	TDmaTransferConfig dst_cfg(cfg);
+	dst_cfg.iAddr = (TUint32)&dst[2];
+	dst_cfg.iElementSkip = 2;
+	dst_cfg.iFrameSkip = -8;
+
+	TTransferIter dst_iter(dst_cfg, 0);
+	for(i=0; dst_iter != end; i++, ++dst_iter)
+		{
+		TEST_ASSERT(i<9);
+		*dst_iter=src[i];
+		};
+
+	for(i=0; i<9; i++)
+		{
+		test_Equal(expected[i],dst[i]);
+		}
+	}
+
+void TCallbackRecord::SelfTest()
+	{
+	test.Start(_L("SeltTest of TCallbackRecord"));
+
+	test.Next(_L("create default TCallbackRecord record, record2"));
+	TCallbackRecord record;
+	const TCallbackRecord record2;
+	if(gVerboseOutput)
+	{
+	test.Next(_L("Print record"));
+	record.Print();
+	}
+
+	test.Next(_L("test (record == record2)"));
+	if(!(record == record2))
+		{
+		if(gVerboseOutput)
+			{
+			record2.Print();
+			}
+		TEST_FAULT;
+		}
+
+	//A series of callback masks
+	//Note these combinations do not necessarily represent
+	//possible callback combinations
+	TUint callbacks[]  =
+		{
+		EDmaCallbackDescriptorCompletion,
+		EDmaCallbackDescriptorCompletion,
+		EDmaCallbackDescriptorCompletion,
+		EDmaCallbackDescriptorCompletion,
+		EDmaCallbackFrameCompletion_Src,
+		EDmaCallbackFrameCompletion_Dst,
+		EDmaCallbackDescriptorCompletion_Src | EDmaCallbackDescriptorCompletion_Dst,
+		EDmaCallbackDescriptorCompletion_Src | EDmaCallbackFrameCompletion_Src | EDmaCallbackLinkedListPaused_Dst,
+		EDmaCallbackRequestCompletion | EDmaCallbackRequestCompletion_Src,
+		EDmaCallbackDescriptorCompletion_Dst
+		};
+	test.Next(_L("Feed a series of callback masks in to record"));
+	const TInt length = ARRAY_LENGTH(callbacks);
+	for(TInt i = 0; i < length; i++)
+		{
+		record.ProcessCallback(callbacks[i], EDmaResultOK);
+		}
+	
+	if(gVerboseOutput)
+	{
+	test.Next(_L("Print record"));
+	record.Print();
+	}
+
+	test.Next(_L("test GetCount"));
+	test_Equal(1, record.GetCount(EDmaCallbackRequestCompletion));
+	test_Equal(1, record.GetCount(EDmaCallbackRequestCompletion_Src));
+	test_Equal(0, record.GetCount(EDmaCallbackRequestCompletion_Dst));
+	test_Equal(4, record.GetCount(EDmaCallbackDescriptorCompletion));
+	test_Equal(2, record.GetCount(EDmaCallbackDescriptorCompletion_Src));
+	test_Equal(2, record.GetCount(EDmaCallbackDescriptorCompletion_Dst));
+	test_Equal(0, record.GetCount(EDmaCallbackFrameCompletion));
+	test_Equal(2, record.GetCount(EDmaCallbackFrameCompletion_Src));
+	test_Equal(1, record.GetCount(EDmaCallbackFrameCompletion_Dst));
+	test_Equal(0, record.GetCount(EDmaCallbackLinkedListPaused));
+	test_Equal(0, record.GetCount(EDmaCallbackLinkedListPaused_Src));
+	test_Equal(1, record.GetCount(EDmaCallbackLinkedListPaused_Dst));
+
+	test.Next(_L("test expected == record"));
+	const TCallbackRecord expected(TCallbackRecord::EThread, 1, 1, 0, 4, 2, 2, 0, 2, 1, 0, 0, 1);
+	if(!(expected == record))
+		{
+		if(gVerboseOutput)
+			{
+			expected.Print();
+			}
+		TEST_FAULT;
+		}
+
+	test.Next(_L("modify record: test expected != record"));
+	record.SetCount(EDmaCallbackFrameCompletion, 10);
+	if(expected == record)
+		{
+		if(gVerboseOutput)
+			{
+			expected.Print();
+			}
+		TEST_FAULT;
+		}
+
+	test.Next(_L("test Reset()"));
+	record.Reset();
+	test(record == record2);
+
+	test.End();
+	}
+
+void CDmaBenchmark::SelfTest()
+	{
+	test.Start(_L("SelfTest of CDmaBenchmark"));
+	test.Next(_L("MeanResult()"));
+
+	TUint64 results[] = {8, 12, 1, 19, 3, 17, 10};
+	const TInt count = ARRAY_LENGTH(results);
+
+	CDmaBmFragmentation fragTest(_L("SelfTest"), count, TDmaTransferArgs(), 0);
+
+	for(TInt i = 0; i < count; i++)
+		{
+		fragTest.iResultArray.Append(results[i]);
+		}
+	test_Equal(10, fragTest.MeanResult());
+
+	test.End();
+	}
+
+void TAddrRange::SelfTest()
+	{
+	test.Start(_L("SelfTest of TAddrRange"));
+	TAddrRange a(0, 8);
+	TAddrRange b(8, 8);
+
+	test_Equal(7, a.End());
+	test_Equal(15, b.End());
+
+	test(!a.Overlaps(b));
+	test(!b.Overlaps(a));
+	test(a.Overlaps(a));
+	test(b.Overlaps(b));
+
+	TAddrRange c(7, 2);
+	test_Equal(8, c.End());
+
+	test(a.Overlaps(c));
+	test(c.Overlaps(a));
+	test(b.Overlaps(c));
+	test(c.Overlaps(b));
+
+	TAddrRange d(0, 24);
+	test(a.Overlaps(d));
+	test(d.Overlaps(a));
+
+	test(b.Overlaps(d));
+	test(d.Overlaps(b));
+
+	test(d.Contains(d));
+
+	test(d.Contains(a));
+	test(!a.Contains(d));
+
+	test(d.Contains(b));
+	test(!b.Contains(d));
+
+	test(!a.Contains(b));
+	test(!b.Contains(a));
+	test.End();
+	}
+
+void TAddressParms::SelfTest()
+	{
+	test.Start(_L("SelfTest of TAddressParms"));
+	const TAddressParms pA(0, 32, 8);
+	test(pA == pA);
+	test(pA.Overlaps(pA));
+
+	const TAddrRange rA(4, 8);
+	const TAddrRange rB(16, 8);
+	const TAddrRange rC(28, 8);
+	const TAddrRange rD(4, 32);
+
+	test(pA.Overlaps(rA));
+	test(!pA.Overlaps(rB));
+	test(pA.Overlaps(rC));
+	test(pA.Overlaps(rD));
+
+	const TAddressParms pB(8, 16, 8);
+	test(!(pA == pB));
+	test(!(pB == pA));
+	test(!pA.Overlaps(pB));
+	test(!pB.Overlaps(pA));
+
+	const TAddressParms pC(8, 28, 8);
+	test(pC.Overlaps(pA));
+	test(pC.Overlaps(pB));
+
+	const TAddressParms pD(0, 128, 64);
+	test(pD.Overlaps(pA));
+	test(pD.Overlaps(pB));
+	test(pD.Overlaps(pC));
+	test.End();
+	}
+
+void SelfTests()
+	{
+	test.Next(_L("Running framework unit tests"));
+	RDmaSession::SelfTest();
+	TDmaCapability::SelfTest();
+	TTestCase::SelfTest();
+	TTransferIter::SelfTest();
+	TCallbackRecord::SelfTest();
+	CDmaBmFragmentation::SelfTest();
+	TAddrRange::SelfTest();
+	TAddressParms::SelfTest();
+	test.End();
+	test.Close();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/t_dma2.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,1546 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test\dma\t_dma.cpp
+
+#include "d_dma2.h"
+#include "u32std.h"
+#include "t_dma2.h"
+#include "cap_reqs.h"
+
+#define __E32TEST_EXTENSION__
+#include <e32test.h>
+#include <e32debug.h>
+#include <e32svr.h>
+#include <e32def_private.h>
+
+// DMA test framework command  parameter options
+
+// SelfTest Option
+_LIT(KArgSelfTest, "/SELFTEST");  
+_LIT(KArgSelfTest2, "/S");		  
+
+//Verbose Option
+_LIT(KArgVerboseOutput, "/VERBOSE"); 
+_LIT(KArgVerboseOutput2, "/V");	     
+  
+
+TBool gHelpRequested;   // print usage 
+TBool gVerboseOutput;   // enable verbose output 
+TBool gSelfTest;        // run SelfTest 
+
+/**
+This function prints out the PSL test Information
+*/
+void Print(const TDmaV2TestInfo& aInfo)
+	{
+	PRINT(aInfo.iMaxTransferSize);
+	PRINT(aInfo.iMemAlignMask);
+	PRINT(aInfo.iMemMemPslInfo);
+	PRINT(aInfo.iMaxSbChannels);
+	for(TInt i=0; i<aInfo.iMaxSbChannels; i++)
+		{
+		PRINT(aInfo.iSbChannels[i]);
+		}
+	PRINT(aInfo.iMaxDbChannels);
+	for(TInt j=0; j<aInfo.iMaxDbChannels; j++)
+		{
+		PRINT(aInfo.iDbChannels[j]);
+		}
+	PRINT(aInfo.iMaxSgChannels);
+	for(TInt k=0; k<aInfo.iMaxSgChannels; k++)
+		{
+		PRINT(aInfo.iSgChannels[k]);
+		}
+	}
+
+void CDmaTest::PrintTestInfo() const
+	{
+	TBuf<32> buf;
+	buf.AppendFormat(_L("DMA channel %d"), iChannelCookie);
+	RDebug::RawPrint(buf);
+	}
+
+//////////////////////////////////////////////////////////////////////
+// CDmaTest
+//////////////////////////////////////////////////////////////////////
+
+void CDmaTest::OpenDmaSession()
+	{
+	TInt r = iDmaSession.Open();
+	TEST_ASSERT(r == KErrNone);
+	r = iDmaSession.OpenSharedChunk(iChunk);
+	TEST_ASSERT(r == KErrNone);
+	}
+
+void CDmaTest::CloseDmaSession()
+	{
+	iChunk.Close();
+	iDmaSession.Close();
+	}
+
+//////////////////////////////////////////////////////////////////////
+// CSingleTransferTest
+//////////////////////////////////////////////////////////////////////
+void CSingleTransferTest::RunTest()
+	{
+	OpenDmaSession();
+	PreTransferSetup();
+
+	OpenChannel();
+	CreateDmaRequest();
+	Fragment();
+	Queue();
+	FreeRequest();
+	CloseChannel();
+	PostTransferCheck();
+
+	CloseDmaSession();
+	}
+
+void CSingleTransferTest::OpenChannel()
+	{
+	iActual.iChannelOpenResult =
+		iDmaSession.ChannelOpen(iChannelCookie, iChannelSessionCookie);
+	}
+
+void CSingleTransferTest::CreateDmaRequest()
+	{
+	if(iUseNewRequest)
+	{
+		if(gVerboseOutput)
+			{
+			RDebug::Printf("Calling New Request API\n");
+			}
+		iActual.iRequestResult.iCreate =
+			iDmaSession.RequestCreateNew(iChannelSessionCookie, iRequestSessionCookie, iMaxFragmentSize);
+		}
+	else
+		{
+		if(gVerboseOutput)
+			{
+			RDebug::Printf("Calling Old Request API\n");
+			}
+		iActual.iRequestResult.iCreate =
+			iDmaSession.RequestCreate(iChannelSessionCookie, iRequestSessionCookie, iMaxFragmentSize);
+		}
+	}
+
+void CSingleTransferTest::Fragment()
+	{
+	if(iActual.iRequestResult.iCreate != KErrNone)
+		return;
+
+	if(iUseNewFragment)
+		{
+		if(gVerboseOutput)
+			{
+			RDebug::Printf("Calling New Fragment API\n");
+			}
+		iActual.iRequestResult.iFragmentationResult =
+			iDmaSession.FragmentRequest(iRequestSessionCookie, iTransferArgs);
+		}
+	else
+		{
+		if(gVerboseOutput)
+			{
+			RDebug::Printf("Calling Old Fragment API\n");
+			}
+		iActual.iRequestResult.iFragmentationResult =
+			iDmaSession.FragmentRequestOld(iRequestSessionCookie, iTransferArgs);
+
+		}
+
+	const TInt fragmentCount = iDmaSession.RequestFragmentCount(iRequestSessionCookie);
+
+	// Record the fragment count if a non-zero value was expected,
+	// or if it was an error value
+	if(iExpected.iRequestResult.iFragmentCount != 0 || fragmentCount < 0)
+		iActual.iRequestResult.iFragmentCount = fragmentCount;
+	}
+
+void CSingleTransferTest::Queue()
+	{
+	if(iActual.iRequestResult.iFragmentationResult == KErrNone)
+		{
+		iActual.iRequestResult.iQueueResult = iDmaSession.QueueRequest(iRequestSessionCookie, &iActual.iCallbackRecord);
+		}
+	}
+
+void CSingleTransferTest::PostTransferCheck()
+	{
+	if(iPostTransferCheck)
+		iActual.iPostTransferCheck = DoPostTransferCheck();
+	}
+
+TInt CSingleTransferTest::DoPostTransferCheck()
+	{
+	return iPostTransferCheck->Check(*this);
+	}
+
+void CSingleTransferTest::FreeRequest()
+	{
+	if(iActual.iRequestResult.iCreate == KErrNone)
+		{
+		TInt r = iDmaSession.RequestDestroy(iRequestSessionCookie);
+		TEST_ASSERT(r == KErrNone);
+		}
+	}
+
+void CSingleTransferTest::CloseChannel()
+	{
+	if(iActual.iChannelOpenResult == KErrNone)
+		{
+		TInt r = iDmaSession.ChannelClose(iChannelSessionCookie);
+		TEST_ASSERT(r == KErrNone);
+		}
+	}
+
+void CSingleTransferTest::PrintTestType() const
+	{
+	RDebug::RawPrint(_L("Single transfer"));
+	}
+
+void CSingleTransferTest::PreTransferSetup()
+	{
+	if(iPreTransfer)
+		iPreTransfer->Setup(*this); //initialize test
+	}
+
+TBool CSingleTransferTest::Result()
+	{
+	const TBool result = iExpected == iActual;
+	if(!result)
+		{
+		RDebug::Printf("TResultSets do not match");
+		}
+	if(!result || gVerboseOutput)
+		{
+		RDebug::Printf("\nExpected error codes:");
+		iExpected.Print();
+		RDebug::Printf("Expected callback record:");
+		iExpected.iCallbackRecord.Print();
+
+		RDebug::Printf("\nActual error codes:");
+		iActual.Print();
+		RDebug::Printf("Actual callback record:");
+		iActual.iCallbackRecord.Print();
+		}
+	return result;
+	}
+
+
+
+//////////////////////////////////////////////////////////////////////
+// CDmaBenchmark
+//////////////////////////////////////////////////////////////////////
+
+CDmaBenchmark::CDmaBenchmark(const TDesC& aName, TInt aIterations, const TResultSet& aExpectedResults, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize)
+	:CSingleTransferTest(aName, aIterations, aTransferArgs, aExpectedResults, aMaxFragmentSize, NULL, NULL)
+	{
+	UseNewDmaApi(EFalse);
+	}
+
+CDmaBenchmark::~CDmaBenchmark()
+	{
+	iResultArray.Close();
+	}
+
+TUint64 CDmaBenchmark::MeanResult()
+	{
+	if(gVerboseOutput)
+		RDebug::Printf("CDmaBenchmark::MeanResult\n");
+
+	const TInt count = iResultArray.Count();
+
+	TEST_ASSERT(count > 0);
+	TEST_ASSERT(count == iIterations);
+
+	TUint64 sum = 0;
+
+	for(TInt i = 0; i < count; i++)
+		{
+		const TUint64 value = iResultArray[i];
+		if(gVerboseOutput)
+			RDebug::Printf("iResultArray[%d]: %lu", i, value);
+
+		sum += value;
+		}
+
+	return sum / count;
+	}
+
+TBool CDmaBenchmark::Result()
+	{
+	const TBool result = CSingleTransferTest::Result();
+	if(result)
+		{
+		RDebug::Printf("  Mean time: %lu us", MeanResult());
+		}
+
+	//TODO this will be handled by the ctor later
+	iResultArray.Close();
+
+	return result;
+	}
+
+
+//////////////////////////////////////////////////////////////////////
+// CDmaBmFragmentation
+//////////////////////////////////////////////////////////////////////
+
+CDmaBmFragmentation::CDmaBmFragmentation(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize)
+	:CDmaBenchmark(aName, aIterations, ExpectedResults, aTransferArgs, aMaxFragmentSize)
+	{}
+
+const TResultSet CDmaBmFragmentation::ExpectedResults(KErrNone,
+		TRequestResults(KErrNone, 0, KErrNone, KErrUnknown),
+		KErrUnknown,
+		TCallbackRecord::Empty()
+		);
+
+void CDmaBmFragmentation::Fragment()
+	{
+	TUint64 time;
+	iActual.iRequestResult.iFragmentationResult =
+		iDmaSession.FragmentRequestOld(iRequestSessionCookie, iTransferArgs, &time);
+	iResultArray.Append(time);
+	}
+
+void CDmaBmFragmentation::PrintTestType() const
+	{
+	RDebug::RawPrint(_L("Fragmentation Benchmark"));
+	}
+
+void CDmaBmFragmentation::RunTest()
+	{
+	OpenDmaSession();
+
+	OpenChannel();
+	CreateDmaRequest();
+	Fragment();
+	FreeRequest();
+	CloseChannel();
+
+	CloseDmaSession();
+	}
+
+//////////////////////////////////////////////////////////////////////
+// CDmaBmTransfer
+//////////////////////////////////////////////////////////////////////
+
+CDmaBmTransfer::CDmaBmTransfer(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize)
+	:CDmaBenchmark(aName, aIterations,
+		TResultSet(KErrNone, TRequestResults(),	KErrUnknown, TCallbackRecord(TCallbackRecord::EThread,1)),
+		aTransferArgs, aMaxFragmentSize)
+	{}
+
+
+void CDmaBmTransfer::PrintTestType() const
+	{
+	RDebug::RawPrint(_L("Transfer Benchmark"));
+	}
+
+void CDmaBmTransfer::RunTest()
+	{
+	OpenDmaSession();
+
+	OpenChannel();
+	CreateDmaRequest();
+	Fragment();
+	Queue();
+	FreeRequest();
+	CloseChannel();
+
+	CloseDmaSession();
+	}
+
+void CDmaBmTransfer::Queue()
+	{
+	if(iActual.iRequestResult.iFragmentationResult == KErrNone)
+		{
+		TUint64 time;
+		iActual.iRequestResult.iQueueResult = iDmaSession.QueueRequest(iRequestSessionCookie, &iActual.iCallbackRecord, &time);
+		iResultArray.Append(time);
+		}
+	}
+
+
+//////////////////////////////////////////////////////////////////////
+// CMultiTransferTest
+//////////////////////////////////////////////////////////////////////
+
+//TODO
+// Add pre and post transfer for CMultiTransferTest
+CMultiTransferTest::CMultiTransferTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs* aTransferArgs,
+		const TResultSet* aResultSets, TInt aCount)
+	: CDmaTest(aName, aIterations, NULL, NULL), iTransferArgs(aTransferArgs), iTransferArgsCount(aCount), iNewDmaApi(ETrue),
+	iChannelSessionCookie(0), iExpectedArray(aResultSets), iPauseWhileQueuing(EFalse)
+	{}
+
+CMultiTransferTest::CMultiTransferTest(const CMultiTransferTest& aOther)
+	: CDmaTest(aOther), iTransferArgs(aOther.iTransferArgs), iTransferArgsCount(aOther.iTransferArgsCount),
+	iNewDmaApi(aOther.iNewDmaApi),
+	iExpectedArray(aOther.iExpectedArray), iPauseWhileQueuing(aOther.iPauseWhileQueuing)
+	//const cast is required because their isn't a ctor taking const
+	//array values
+	//TODO iRequestCookies(const_cast<TUint*>(&aOther.iRequestCookies[0]), aOther.iRequestCookies.Count())
+	{
+	}
+
+CMultiTransferTest::~CMultiTransferTest()
+	{
+	iRequestCookies.Close();
+	iActualResults.Close();
+	}
+
+TBool CMultiTransferTest::Result()
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("Results for %d transfers:", iTransferArgsCount);
+		}
+
+	TBool result = EFalse;
+	for(TInt i=0; i<iTransferArgsCount; i++)
+		{
+		result = Result(i);
+		if(!result)
+			break;
+		}
+	return result;
+	}
+
+TBool CMultiTransferTest::Result(TInt aTransfer)
+	{
+	const TResultSet& expected = iExpectedArray[aTransfer];
+	const TResultSet& actual = iActualResults[aTransfer];
+	const TBool result = expected == actual;
+	if(!result || gVerboseOutput)
+		{
+		RDebug::Printf("Compairing results for transfer %d", aTransfer);
+		}
+
+	if(!result)
+		{
+		RDebug::Printf("TResultSets do not match");
+		}
+	if(!result || gVerboseOutput)
+		{
+		RDebug::Printf("\nExpected error codes:");
+		expected.Print();
+		RDebug::Printf("Expected callback record:");
+		expected.iCallbackRecord.Print();
+
+		RDebug::Printf("\nActual error codes:");
+		actual.Print();
+		RDebug::Printf("Actual callback record:");
+		actual.iCallbackRecord.Print();
+		}
+	return result;
+	}
+void CMultiTransferTest::RunTest()
+	{
+	OpenDmaSession();
+
+	PreTransferSetup();
+	OpenChannel();
+
+	CreateDmaRequests();
+	Fragment();
+
+	QueueRequests();
+
+	TInt r = DoPostTransferCheck();
+	TEST_ASSERT(r == KErrNone);
+
+	CloseDmaSession();
+	}
+
+void CMultiTransferTest::PrintTestType() const
+	{
+	RDebug::RawPrint(_L("Multi Transfer"));
+	}
+
+const TDmaTransferArgs& CMultiTransferTest::TransferArgs(TInt aIndex) const
+	{
+	TEST_ASSERT(Rng(0, aIndex, iTransferArgsCount-1));
+
+	return iTransferArgs[aIndex];
+	}
+
+void CMultiTransferTest::SetPostTransferResult(TInt aIndex, TInt aErrorCode)
+	{
+	TEST_ASSERT(Rng(0, aIndex, iTransferArgsCount-1));
+
+	iActualResults[aIndex].iPostTransferCheck = aErrorCode;
+	}
+
+void CMultiTransferTest::OpenChannel()
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("CMultiTransferTest::OpenChannel()");
+		}
+	TInt r = iDmaSession.ChannelOpen(iChannelCookie, iChannelSessionCookie);
+
+	TEST_ASSERT(iActualResults.Count() == iTransferArgsCount);
+	for(TInt i=0; i<iTransferArgsCount; i++)
+		{
+		// Since all transfers will use the same channel,
+		// they all get the same result
+		// Arguably, iChannelOpenResult doesn't
+		// belong TResultSet
+		iActualResults[i].iChannelOpenResult = r;
+		}
+	}
+
+TInt CMultiTransferTest::CloseChannel()
+	{
+	return iDmaSession.ChannelClose(iChannelSessionCookie);
+	}
+
+void CMultiTransferTest::CreateDmaRequests()
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("CMultiTransferTest::CreateDmaRequests() %d", iTransferArgsCount);
+		}
+	TEST_ASSERT(iActualResults.Count() == iTransferArgsCount);
+	//create a DMA request for each transfer arg struct
+	for(TInt i=0; i<iTransferArgsCount; i++)
+		{
+		if(iActualResults[i].iChannelOpenResult != KErrNone)
+			continue;
+
+		TUint cookie = 0;
+		TInt r = KErrGeneral;
+
+		if(iNewDmaApi)
+			{
+			r = iDmaSession.RequestCreateNew(iChannelSessionCookie, cookie);
+			}
+		else
+			{
+			r = iDmaSession.RequestCreate(iChannelSessionCookie, cookie);
+			}
+		iActualResults[i].iRequestResult.iCreate = r;
+
+		if(r == KErrNone)
+			{
+			r = iRequestCookies.Append(cookie);
+			TEST_ASSERT(r == KErrNone);
+			}
+		}
+	}
+
+void CMultiTransferTest::Fragment()
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("CMultiTransferTest::Fragment() %d", iTransferArgsCount);
+		}
+	TEST_ASSERT(iActualResults.Count() == iTransferArgsCount);
+	// Fragment each dma request
+	for(TInt i=0; i<iTransferArgsCount; i++)
+		{
+		TRequestResults& result = iActualResults[i].iRequestResult;
+		if(result.iCreate != KErrNone)
+			continue;
+
+		TInt r = KErrGeneral;
+		if(iNewDmaApi)
+			r = iDmaSession.FragmentRequest(iRequestCookies[i], iTransferArgs[i]);
+		else
+			r = iDmaSession.FragmentRequestOld(iRequestCookies[i], iTransferArgs[i]);
+
+		result.iFragmentationResult = r;
+		}
+	}
+
+void CMultiTransferTest::QueueRequests()
+	{
+	if(iPauseWhileQueuing)
+		{
+		TInt r = iDmaSession.ChannelPause(iChannelSessionCookie);
+		TEST_ASSERT(r == KErrNone);
+		}
+
+	// Queue all the DMA requests asynchronously
+	TInt i;
+	RArray<TRequestStatus> requestStates;
+
+	TEST_ASSERT(iActualResults.Count() == iTransferArgsCount);
+	for(i=0; i<iTransferArgsCount; i++)
+		{
+		TResultSet& resultSet = iActualResults[i];
+		if(resultSet.iRequestResult.iFragmentationResult != KErrNone)
+			continue;
+
+		TInt r = requestStates.Append(TRequestStatus());
+		TEST_ASSERT(r == KErrNone);
+
+		r = iDmaSession.QueueRequest(iRequestCookies[i], requestStates[i], &resultSet.iCallbackRecord, NULL);
+		resultSet.iRequestResult.iQueueResult = r;
+		}
+
+	if(iPauseWhileQueuing)
+		{
+		TInt r = iDmaSession.ChannelResume(iChannelSessionCookie);
+		TEST_ASSERT(r == KErrNone);
+		}
+
+	// wait for all transfers to complete
+	const TInt count = requestStates.Count();
+
+	for(i=0; i<count; i++)
+		{
+		User::WaitForRequest(requestStates[i]);
+		}
+
+	requestStates.Close();
+	}
+
+//TODO support test setup for CMultiTransferTest
+void CMultiTransferTest::PreTransferSetup()
+	{
+	for(TInt i=0; i<iTransferArgsCount; i++)
+		{
+		//pre-fill actual results with error values
+		TInt r = iActualResults.Append(TResultSet(EFalse));
+		TEST_ASSERT(r == KErrNone);
+		}
+	if(iPreTransfer)
+		iPreTransfer->Setup(*this); //initialize test
+	}
+
+TInt CMultiTransferTest::DoPostTransferCheck()
+	{
+	if(iPostTransferCheck)
+		return iPostTransferCheck->Check(*this);
+	else
+		return KErrNone;
+	}
+//////////////////////////////////////////////////////////////////////
+// CIsrRequeTest
+//////////////////////////////////////////////////////////////////////
+
+
+CIsrRequeTest::CIsrRequeTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aArgs,
+			TIsrRequeArgs* aRequeueArgs, TInt aCount,
+			const TResultSet& aExpected,const MPreTransfer* aPreTfer,const MPostTransferCheck* aPostTferChk, TUint aMaxFragmentSize)
+	:CSingleTransferTest(aName, aIterations, aArgs, aExpected, aMaxFragmentSize, aPostTferChk, aPreTfer), iRequeArgSet(aRequeueArgs, aCount)
+	{}
+
+void CIsrRequeTest::Queue()
+	{
+	if(iActual.iRequestResult.iFragmentationResult == KErrNone)
+		{
+		iActual.iRequestResult.iQueueResult = iDmaSession.QueueRequestWithRequeue(iRequestSessionCookie, iRequeArgSet.iRequeArgs, iRequeArgSet.iCount, &iActual.iCallbackRecord);
+		}
+	}
+
+void CIsrRequeTest::PrintTestType() const
+	{
+	RDebug::RawPrint(_L("ISR Requeue"));
+	}
+
+/*
+//TODO will need to support buffer checking of the trasnfers
+TBool CIsrRequeTest::Result()
+	{
+	return CSingleTransferTest::Result();
+	}
+*/
+
+void CIsrRequeTest::PreTransferSetup()
+	{
+	if(iPreTransfer)
+		iPreTransfer->Setup(*this); //initialize test
+	}
+
+TInt CIsrRequeTest::DoPostTransferCheck()
+	{
+	return iPostTransferCheck->Check(*this);
+	}
+
+//////////////////////////////////////////////////////////////////////
+// TResultSet
+//////////////////////////////////////////////////////////////////////
+
+void TResultSet::Print() const
+	{
+	PRINT(iChannelOpenResult);
+	PRINT(iRequestResult.iCreate);
+	PRINT(iRequestResult.iFragmentCount);
+	PRINT(iRequestResult.iFragmentationResult);
+	PRINT(iRequestResult.iQueueResult);
+	PRINT(iPostTransferCheck);
+	}
+
+TBool TResultSet::operator == (const TResultSet& aOther) const
+	{
+	return (memcompare((TUint8*)this, sizeof(*this), (TUint8*)&aOther, sizeof(aOther)) == 0);
+	}
+
+//////////////////////////////////////////////////////////////////////
+// MPostTransferCheck classes
+//////////////////////////////////////////////////////////////////////
+
+TInt TCompareSrcDst::Check(const CSingleTransferTest& aTest) const
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("Comparing CSingleTransferTest buffers");
+		}
+	return Check(aTest.TransferArgs(), aTest.Chunk().Base());
+	}
+
+//TODO
+//this check will not deal correctly transfers were subsequent
+//requeues overlap
+TInt TCompareSrcDst::Check(const CIsrRequeTest& aTest) const
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("Comparing CIsrRequeTest buffers");
+		}
+	TUint8* chunkBase = aTest.Chunk().Base();
+	const TDmaTransferArgs& transferArgs = aTest.TransferArgs();
+	// check first transfer
+	TInt r = Check(transferArgs, chunkBase);
+
+	if(r != KErrNone)
+		return r;
+
+	// check re-queued transfers
+	const TIsrRequeArgsSet& requeueArgs = aTest.GetRequeueArgs();
+	return Check(requeueArgs, chunkBase, transferArgs);
+	}
+
+TInt TCompareSrcDst::Check(const TDmaTransferArgs& aTransferArgs, TUint8* aChunkBase) const
+	{
+	//TODO could make use of Fixup() method
+	const TUint32 srcOffset = aTransferArgs.iSrcConfig.iAddr;
+	const TUint32 dstOffset = aTransferArgs.iDstConfig.iAddr;
+	const TInt size = aTransferArgs.iTransferCount;
+
+	const TUint8* src = srcOffset + aChunkBase;
+	const TUint8* dst = dstOffset + aChunkBase;
+
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("Comparing TDmaTransferArgs buffers src=0x%08x dst=0x%08x size=0x%08x",
+				src, dst, size);
+		}
+
+	return memcompare(src, size, dst, size);
+	}
+
+TInt TCompareSrcDst::Check(const TIsrRequeArgsSet& aRequeueArgSet, TUint8* aChunkBase, const TDmaTransferArgs& aTferArgs) const
+	{
+	TIsrRequeArgsSet argSet(aRequeueArgSet); //copy since Fixup will mutate object
+
+	argSet.Substitute(aTferArgs); // replace any default (0) values with the values in aTferArgs
+
+	argSet.Fixup((TLinAddr)aChunkBase); //convert address offsets to virtual user mode addresses
+
+	TInt r = KErrCorrupt;
+	while(!argSet.IsEmpty())
+		{
+		r = Check(argSet.GetArgs());
+		if(r != KErrNone)
+			break;
+		}
+	return r;
+	}
+
+TInt TCompareSrcDst::Check(const TIsrRequeArgs& aRequeueArgs) const
+	{
+	const TUint8* src = (TUint8*)aRequeueArgs.iSrcAddr;
+	const TUint8* dst = (TUint8*)aRequeueArgs.iDstAddr;
+	const TInt size = aRequeueArgs.iTransferCount;
+
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("Comparing TIsrRequeArgs: src=0x%08x dst=0x%08x size=0x%08x",
+				src, dst, size);
+		}
+
+	return memcompare(src, size, dst, size);
+	}
+
+TInt TCompareSrcDst::Check(CMultiTransferTest& aTest) const
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("Comparing CMultiTransferTest buffers");
+		}
+
+	const TInt transferCount = aTest.TransferCount();
+	TUint8* const chunkBase = aTest.Chunk().Base();
+
+	// check buffers for each transfer
+	for(TInt i=0; i<transferCount; i++)
+		{
+		TInt r = Check(aTest.TransferArgs(i), chunkBase);
+		aTest.SetPostTransferResult(i, r);
+		}
+	// CMultiTransferTest is handled differently to the others.
+	// Whereas CSingleTransferTest logs just the return value
+	// of the check, here, we write back a result for each transfer
+	// so the return value from this function is not important
+	return KErrNone;
+	}
+
+TInt TCompare2D::Check(const CSingleTransferTest& aTest) const
+	{
+	const TDmaTransferArgs& args = aTest.TransferArgs();
+	TUint8* const chunkBase = aTest.Chunk().Base();
+
+	TInt ret = KErrNone;
+
+	TTransferIter src_iter(args.iSrcConfig, chunkBase);
+	TTransferIter dst_iter(args.iDstConfig, chunkBase);
+	TTransferIter end;
+	for (; (src_iter != end) && (dst_iter !=end); ++src_iter, ++dst_iter)
+		{
+		if(*src_iter != *dst_iter)
+			{
+			ret = KErrCorrupt;
+			break;
+			}
+		}
+	return ret;
+	}
+
+TInt TCompare2D::Check(const CIsrRequeTest&) const
+	{
+	return KErrNotSupported;
+	}
+
+TInt TCompare2D::Check(CMultiTransferTest&) const
+	{
+	return KErrNotSupported;
+	}
+//////////////////////////////////////////////////////////////////////
+// MPreTransfer classes
+//////////////////////////////////////////////////////////////////////
+
+void TPreTransferIncrBytes::Setup(const CSingleTransferTest& aTest) const
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("TPreTransferIncrBytes(CSingleTransferTest)");
+		}
+	TAddressParms params = GetAddrParms(aTest.TransferArgs());
+
+	TUint8* const chunkBase = aTest.Chunk().Base();
+	params.Fixup((TLinAddr)chunkBase);
+
+
+	Setup(params);
+	}
+
+void TPreTransferIncrBytes::Setup(const TAddressParms& aParams) const
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("TPreTransferIncrBytes: setup memory buffers: src=0x%08x dst=0x%08x size=0x%08x",
+				aParams.iSrcAddr, aParams.iDstAddr, aParams.iTransferCount);
+		}
+	TUint8* const src = (TUint8*) aParams.iSrcAddr;
+	const TInt size = aParams.iTransferCount;
+
+	for(TInt i=0; i<size; i++)
+		{src[i] = (TUint8)i;} //each src byte holds its own offset (mod 256)
+
+	TUint8* const dst = (TUint8*) aParams.iDstAddr;
+	memclr(dst, size); //clear destination
+	}
+
+void TPreTransferIncrBytes::Setup(const CIsrRequeTest& aTest) const
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("TPreTransferIncrBytes(CIsrRequeTest)");
+		}
+	if(!CheckBuffers(aTest))
+		{
+		RDebug::Printf("Successive transfer destinations may not overlap previous src or dst buffers");
+		RDebug::Printf("unless the whole transfer is an exact repeat of a previous one");
+		TEST_FAULT;
+		}
+
+	Setup(static_cast<CSingleTransferTest>(aTest)); // prepare the CSingleTransferTest parts
+
+	TIsrRequeArgsSet requeSet(aTest.GetRequeueArgs());
+
+	requeSet.Substitute(aTest.TransferArgs());
+
+	const TLinAddr chunkBase = (TLinAddr) aTest.Chunk().Base();
+	requeSet.Fixup(chunkBase);
+
+	while(!requeSet.IsEmpty())
+		{
+		TIsrRequeArgs args = requeSet.GetArgs();
+		Setup(args); // perform the setup operation for each TIsrRequeArgs
+		}
+	}
+
+void TPreTransferIncrBytes::Setup(const CMultiTransferTest& aTest) const
+	{
+	if(gVerboseOutput)
+		{
+		RDebug::Printf("TPreTransferIncrBytes(CMultiTransferTest)");
+		}
+	//TODO check for overlap
+
+	TUint8* const chunkBase = aTest.Chunk().Base();
+	const TInt transferCount = aTest.TransferCount();
+
+	// initialise buffers for each transfer
+	for(TInt i=0; i<transferCount; i++)
+		{
+		TAddressParms params = GetAddrParms(aTest.TransferArgs(i));
+
+		params.Fixup((TLinAddr)chunkBase);
+
+		Setup(params);
+		}
+	}
+
+TBool TPreTransferIncrBytes::CheckBuffers(const CIsrRequeTest& aTest) const
+	{
+	RArray<const TAddressParms> array;
+	array.AppendL(TAddressParms(aTest.TransferArgs()));
+
+	TIsrRequeArgsSet requeSet(aTest.GetRequeueArgs());
+	requeSet.Substitute(aTest.TransferArgs());
+
+	const TLinAddr chunkBase = (TLinAddr) aTest.Chunk().Base();
+	requeSet.Fixup(chunkBase);
+	while(!requeSet.IsEmpty())
+		{
+		const TIsrRequeArgs requeArgs = requeSet.GetArgs();
+		array.AppendL(requeArgs);
+		}
+
+	const TBool result = CheckBuffers(array);
+
+	array.Close();
+	return result;
+	}
+
+/**
+Check that the destination of each TAddressParms does not overlap with
+any previous source or destination or that if it does the whole transfer
+matches.
+This is so that successive transfers do not overwrite the destinations or
+sources of preceeding ones.
+Exactly matching transfers are allowed to test the case that a repeat
+transfer is required - though it can't then be determined just from
+looking at the buffers that the repeat was successful
+*/
+TBool TPreTransferIncrBytes::CheckBuffers(const RArray<const TAddressParms> aTransferParams) const
+	{
+	const TInt count = aTransferParams.Count();
+
+	for(TInt i=1; i<count; i++)
+		{
+		const TAddressParms& current = aTransferParams[i];
+		for(TInt j=0; j<i; j++)
+			{
+			const TAddressParms& previous = aTransferParams[j];
+			const TBool ok = !previous.Overlaps(current.DestRange()) || current == previous;
+			if(!ok)
+				return EFalse;
+			}
+		}
+	return ETrue;
+	}
+//////////////////////////////////////////////////////////////////////
+// TTransferIter class
+//////////////////////////////////////////////////////////////////////
+
+void TTransferIter::operator++ ()
+	{
+	iPtr++; //the standard post increment
+	if(iElem < (iCfg->iElementsPerFrame-1))
+		{
+		iPtr += iCfg->iElementSkip;
+		iElem++;
+		iBytes++;
+		}
+	else
+		{
+		TEST_ASSERT(iElem == iCfg->iElementsPerFrame-1);
+		if(iFrame < iCfg->iFramesPerTransfer-1)
+			{
+			iPtr += iCfg->iFrameSkip;
+			iFrame++;
+			iBytes++;
+			iElem = 0;
+			}
+		else
+			{
+			//we have reached the end
+			TEST_ASSERT(iFrame == iCfg->iFramesPerTransfer-1);
+			iPtr = NULL;
+			}
+		}
+
+	Invariant();
+	}
+
+void TTransferIter::Invariant() const
+	{
+	const TInt elemSize = iCfg->iElementSize;
+	RTest test(_L("TTransferIter invariant"));
+	const TInt bytesTransfered = (
+			elemSize * (iFrame * iCfg->iElementsPerFrame + iElem)
+			+ ((TUint)iPtr % (elemSize))
+			);
+	test_Equal(iBytes, bytesTransfered);
+	test.Close();
+	}
+
+///////////////////////////////////////////////////////////
+// TTestCase
+///////////////////////////////////////////////////////////
+TTestCase::TTestCase(CDmaTest* aTest,
+   TBool aConcurrent,
+   const TDmaCapability aCap1,
+   const TDmaCapability aCap2,
+   const TDmaCapability aCap3,
+   const TDmaCapability aCap4,
+   const TDmaCapability aCap5
+   )
+:
+	iTest(aTest), iConcurrentTest(aConcurrent)
+	{
+	iChannelCaps[0] = aCap1;
+	iChannelCaps[1] = aCap2;
+	iChannelCaps[2] = aCap3;
+	iChannelCaps[3] = aCap4;
+	iChannelCaps[4] = aCap5;
+	}
+
+TResult TTestCase::TestCaseValid(const SDmacCaps& aChannelCaps) const
+	{
+	const TDmaCapability* cap = &iChannelCaps[0];
+
+	TResult ret = ERun;
+	//We assume that the array is empty at the first ENone found
+	//any caps after this wil be ignored
+	while(cap->iCapsReq != ENone)
+		{
+		TResult t = cap->CompareToDmaCaps(aChannelCaps);
+		if(t > ret) //this relies on the enum ordering
+			ret = t;
+		cap++;
+		}
+	return ret;
+	}
+
+TResult TTestCase::TestCaseValid(const TDmacTestCaps& aChannelCaps) const
+	{
+	const TDmaCapability* cap = &iChannelCaps[0];
+
+	TResult ret = ERun;
+	//We assume that the array is empty at the first ENone found
+	//any caps after this wil be ignored
+	while(cap->iCapsReq != ENone)
+		{
+		TResult t = cap->CompareToDmaCaps(aChannelCaps);
+		if(t > ret) //this relies on the enum ordering
+			ret = t;
+		cap++;
+		}
+	return ret;
+	}
+/**
+Will report whether a value held in aChannelCaps satisfies a
+requirement specfied by this object
+*/
+TBool TDmaCapability::RequirementSatisfied(const SDmacCaps& aChannelCaps) const
+	{
+	switch(iCapsReq)
+		{
+	case ENone:
+		return ETrue;
+	case EChannelPriorities:
+		TEST_FAULT;
+	case EChannelPauseAndResume:
+		return aChannelCaps.iChannelPauseAndResume == (TBool)iValue;
+	case EAddrAlignedToElementSize:
+		TEST_FAULT;
+	case E1DAddressing:
+		return aChannelCaps.i1DIndexAddressing == (TBool)iValue;
+	case E2DAddressing:
+		return aChannelCaps.i2DIndexAddressing == (TBool)iValue;
+	case ESynchronizationTypes:
+	case EBurstTransactions:
+	case EDescriptorInterrupt:
+	case EFrameInterrupt:
+	case ELinkedListPausedInterrupt:
+	case EEndiannessConversion:
+	case EGraphicsOps:
+	case ERepeatingTransfers:
+	case EChannelLinking:
+		TEST_FAULT;
+	case EHwDescriptors:
+		return aChannelCaps.iHwDescriptors == (TBool)iValue;
+	case ESrcDstAsymmetry:
+	case EAsymHwDescriptors:
+		TEST_FAULT;
+	case EBalancedAsymSegments:
+		return aChannelCaps.iBalancedAsymSegments == (TBool)iValue;
+	case EAsymCompletionInterrupt:
+		return aChannelCaps.iAsymCompletionInterrupt == (TBool)iValue;
+	case EAsymDescriptorInterrupt:
+		return aChannelCaps.iAsymDescriptorInterrupt == (TBool)iValue;
+	case EAsymFrameInterrupt:
+		return aChannelCaps.iAsymFrameInterrupt == (TBool)iValue;
+	default:
+		TEST_FAULT;
+		}
+
+	return EFalse;
+	}
+
+/**
+Will report whether a value held in aChannelCaps satisfies a
+requirement specfied by this object
+*/
+TBool TDmaCapability::RequirementSatisfied(const TDmacTestCaps& aChannelCaps) const
+	{
+	switch(iCapsReq)
+		{
+	case EPilVersion:
+		return TestValue(aChannelCaps.iPILVersion);
+	default:
+		return RequirementSatisfied(static_cast<SDmacCaps>(aChannelCaps));
+		}
+	}
+
+TResult TDmaCapability::CompareToDmaCaps(const SDmacCaps& aChannelCaps) const
+	{
+	const TBool reqSatisfied = RequirementSatisfied(aChannelCaps);
+	if(reqSatisfied)
+		{
+		return ERun;
+		}
+	else
+		{
+		return iFail ? EFail : ESkip;
+		}
+	}
+
+TResult TDmaCapability::CompareToDmaCaps(const TDmacTestCaps& aChannelCaps) const
+	{
+	const TBool reqSatisfied = RequirementSatisfied(aChannelCaps);
+	if(reqSatisfied)
+		{
+		return ERun;
+		}
+	else
+		{
+		return iFail ? EFail : ESkip;
+		}
+	}
+/**
+Test that aValue satisfies the comparrison (iCapsReqType) with the
+reference value held in iValue
+*/
+TBool TDmaCapability::TestValue(TUint aValue) const
+	{
+	switch(iCapsReqType)
+		{
+	case EEqual:
+		return aValue == iValue;
+	case EGTE:
+		return aValue >= iValue;
+	case ELTE:
+		return aValue <= iValue;
+	case EBitsSet:
+	case EBitsClear:
+	default:
+		TEST_FAULT;
+		}
+	return EFalse;
+	}
+
+static RTest test(_L("DMAv2 test"));
+
+//////////////////////////////////////////////////////////////////////
+// TTestRunner
+//////////////////////////////////////////////////////////////////////
+TTestRunner::TTestRunner()
+	{
+	// Open RDmaSession handle
+	TInt r = iDmaSession.Open();
+	TEST_ASSERT(r == KErrNone);
+
+	// Get PSI Test info
+	r = iDmaSession.GetTestInfo(iPslTestInfo);
+	TEST_ASSERT(r == KErrNone);
+
+	//Retrieve PSL cookies
+	GetPslCookie();
+
+	//Generate the DMA channel records
+	GenerateChannelRecord();
+	}
+
+TTestRunner::~TTestRunner()
+	{
+	RTest::CloseHandleAndWaitForDestruction(iDmaSession);
+	iTestCases.Close(); //TestRunner does not own test cases
+	iChannelRecords.Close();
+	iPslCookies.Close();
+	}
+
+void TTestRunner::AddTestCases(RPointerArray<TTestCase>& aTTestCases)
+	{
+	const TInt count = aTTestCases.Count();
+	for(TInt i=0; i < count; i++)
+		{
+		iTestCases.AppendL(aTTestCases[i]);
+		}
+	}
+
+void TTestRunner::RunTests()
+	{
+	//Print PslTestInfo
+	if(gVerboseOutput)
+		{
+		Print(iPslTestInfo);
+		}
+
+	//iterate through the test case array
+	const TInt testCaseCount = iTestCases.Count();
+	for(TInt i=0; i < testCaseCount; i++)
+		{
+		const TTestCase& testCase = *iTestCases[i];
+
+		//Here, we must create a test thread for each channel
+		RPointerArray<CTest> concurrentTests;
+
+		if(testCase.iConcurrentTest)
+			RDebug::Printf("== Begin concurrent test run ==");
+
+		const TInt chanRecCount = iChannelRecords.Count();
+		for(TInt j=0; j < chanRecCount; j++)
+			{
+			const TChannelRecord& record = iChannelRecords[j];
+			const TDmacTestCaps& caps = record.iChannelCaps;
+
+			const TResult t = testCase.TestCaseValid(caps);
+
+			switch(t)
+				{
+			case ERun:
+				{
+				CDmaTest* dmaTest = static_cast<CDmaTest*>(testCase.iTest->Clone());
+				TEST_ASSERT(dmaTest != NULL);
+
+				dmaTest->SetChannelCookie(record.iCookie);
+				dmaTest->Announce();
+				if(testCase.iConcurrentTest)
+					{
+					//Add test to array to be run concurrently
+					TInt r = concurrentTests.Append(dmaTest);
+					TEST_ASSERT(r == KErrNone);
+					}
+				else
+					{
+					//Run test in this thread
+					(*dmaTest)();
+					//TTestThread(
+					TBool result = dmaTest->Result();
+					TEST_ASSERT(result);
+
+					delete dmaTest;
+					}
+
+				break;
+				}
+			case ESkip:
+				if(gVerboseOutput)
+				{
+				RDebug::Printf("Skipping test-case %S, PSL channel %d", &testCase.iTest->Name(), record.iCookie);
+				}
+				break;
+			case EFail:
+				if(gVerboseOutput)
+				{
+				RDebug::Printf("Failling test-case %S, PSL channel %d", &testCase.iTest->Name(), record.iCookie);
+				}
+				TEST_FAULT;
+			default:
+				TEST_FAULT;
+				}
+			//Depending on the value of iConcurrentTest the test runner will either block until the thread has completed or
+			//alternatively run the current test case on the next channel:
+
+			//if the test case has been run on all channels it will then  wait for all threads to complete.
+			}
+
+		const TInt count = concurrentTests.Count();
+		if(count>0)
+			{
+			MultipleTestRun(concurrentTests);
+			for(TInt i=0; i<count; i++)
+				{
+				TBool result = static_cast<CDmaTest*>(concurrentTests[i])->Result();
+				TEST_ASSERT(result);
+				}
+			RDebug::Printf("== End concurrent test run ==");
+			}
+
+		concurrentTests.ResetAndDestroy();
+		}
+	}
+
+void TTestRunner::GetPslCookie()
+	{
+	//Get Sb Channel cookies
+	for(TInt sb_channelcount=0; sb_channelcount<iPslTestInfo.iMaxSbChannels; sb_channelcount++)
+		{
+		iPslCookies.AppendL(iPslTestInfo.iSbChannels[sb_channelcount]);
+		}
+
+	//Get Db Channel cookies
+	for(TInt db_channelcount=0; db_channelcount<iPslTestInfo.iMaxDbChannels; db_channelcount++)
+		{
+		iPslCookies.AppendL(iPslTestInfo.iDbChannels[db_channelcount]);
+		}
+
+	//Get Sg Channel cookies
+	for(TInt sg_channelcount=0; sg_channelcount<iPslTestInfo.iMaxSgChannels; sg_channelcount++)
+		{
+		iPslCookies.AppendL(iPslTestInfo.iSgChannels[sg_channelcount]);
+		}
+	}
+
+void TTestRunner::GenerateChannelRecord()
+	{
+	//for each PSL cookie
+	for(TInt count=0; count<iPslCookies.Count(); count++)
+		{
+		//Get channel cookie
+		const TUint pslCookie = iPslCookies[count];
+		TUint sessionCookie;
+		TInt r = iDmaSession.ChannelOpen(pslCookie, sessionCookie);
+		TEST_ASSERT(r == KErrNone);
+		if(gVerboseOutput)
+		{
+		RDebug::Printf("Channel PSL Cookie[%d]  :0x%08x",count,pslCookie);
+		}
+
+		TChannelRecord dmaChannelRecord;
+		dmaChannelRecord.iCookie = pslCookie;
+
+		//Get Channel Caps
+		r = iDmaSession.ChannelCaps(sessionCookie, dmaChannelRecord.iChannelCaps);
+		TEST_ASSERT(r == KErrNone);
+
+		r = iDmaSession.ChannelClose(sessionCookie);
+		TEST_ASSERT(r == KErrNone);
+
+		//Append array
+		iChannelRecords.AppendL(dmaChannelRecord);
+		}
+	}
+//////////////////////////////////////////////////////////////////////
+// Global test functions and E32Main
+//////////////////////////////////////////////////////////////////////
+
+/**
+Displayed if used supplied no parameters, garbage, or a ? in the parameters
+*/
+void PrintUsage()
+	{
+	test.Printf(_L("*** DMA TEST FRAMEWORK ***\n"));
+	test.Printf(_L("Usage : t_dma2.exe [/option]\n"));
+	test.Printf(_L("  /V  or /VERBOSE    = Control test output\n"));
+	test.Printf(_L("  /S  or /SELFTEST   = Run DMA self test\n"));
+	test.Printf(_L("\n"));
+	}
+
+void ProcessCommandLineL()
+{
+	test.Printf(_L("Process command line arguments\n"));
+
+	TInt cmdLineLength(User::CommandLineLength());
+	HBufC* cmdLine = HBufC::NewMaxLC(cmdLineLength);
+	TPtr cmdLinePtr = cmdLine->Des();
+	User::CommandLine(cmdLinePtr);
+	TBool  tokenParsed(EFalse);
+
+	TLex args(*cmdLine);
+	args.SkipSpace(); // args are separated by spaces
+	
+	// first arg is the exe name, skip it
+	TPtrC cmdToken = args.NextToken();
+	HBufC* tc = HBufC::NewLC(KParameterTextLenMax);
+	*tc = cmdToken;
+	while (tc->Length())
+		{
+		tokenParsed = EFalse;
+		
+		// '/?' help wanted flag '?' or /? parameter
+		if ((0== tc->FindF(_L("?"))) || (0==tc->FindF(_L("/?")))) 
+			{
+			gHelpRequested = ETrue;
+			tokenParsed = ETrue;
+			}	
+		
+		// '/SELFTEST'			
+		if ((0== tc->FindF(KArgSelfTest)) || (0==tc->FindF(KArgSelfTest2))) 
+			{
+			// Run self test
+			test.Printf(_L("Command Line Options:Selftest option specified.\n"));
+			gSelfTest = ETrue;
+			tokenParsed = ETrue;
+			}
+
+		// '/VERBOSE' option	
+		if ((0== tc->FindF(KArgVerboseOutput)) || (0==tc->FindF(KArgVerboseOutput2)))
+			{ 
+			test.Printf(_L("Command Line Options:Verbose option specified.\n"));
+			gVerboseOutput = ETrue;
+			tokenParsed = ETrue;			
+			}
+
+		if (!tokenParsed)
+			{
+			// warn about unparsed parameter
+			test.Printf(_L("Warning: '%lS'??? not parsed\n"), tc);
+			gHelpRequested = ETrue;
+			}
+			
+		// next parameter
+		*tc = args.NextToken();
+		}
+	CleanupStack::PopAndDestroy(tc);
+	CleanupStack::PopAndDestroy(cmdLine);
+}
+
+void RunDMATests()
+	{
+	test.Start(_L("Creating test runner\n"));
+	TTestRunner testRunner;
+
+	test.Next(_L("Add global test cases to test runner\n"));
+	testRunner.AddTestCases(TestArray);
+
+	test.Next(_L("call TTestRunner::RunTests()\n"));
+	testRunner.RunTests();
+
+	test.End();
+	}
+
+TInt E32Main()
+	{
+	__UHEAP_MARK;
+	//__KHEAP_MARK;
+	test.Title();
+
+	gHelpRequested = EFalse;
+	TInt r;
+
+	// Create the new trap-cleanup mechanism
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+
+	if (cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+
+	// Process the command line parameters for batch/etc
+	TRAPD(err, ProcessCommandLineL());
+	if (err != KErrNone)
+		{
+		User::Panic(_L("DMA test run memory failure"), KErrNoMemory);
+		}
+	
+	if (gHelpRequested)
+		{
+		PrintUsage();
+		User::Leave(-2);	// nothing to do!
+		}
+	test.Start(_L("Loading test LDD"));
+	//load either the new test ldd, d_dma2.ldd,
+	//or d_dma2_compat.ldd - an ldd linked against
+	//the old DMA framework
+	_LIT(KDma, "D_DMA2.LDD");
+	r = User::LoadLogicalDevice(KDma);
+	const TBool dma2Loaded = ((r == KErrNone) || (r == KErrAlreadyExists));
+
+	_LIT(KDma2Compat, "D_DMA2_COMPAT.LDD");
+	r = User::LoadLogicalDevice(KDma2Compat);
+	const TBool dma2CompatLoaded = ((r == KErrNone) || (r == KErrAlreadyExists));
+
+	if (!(dma2Loaded || dma2CompatLoaded))
+		{
+		//TODO how can we distinguish this case from a platform where
+		//dma is supposed to be supported but the dma test ldd is
+		//missing?
+		test.Printf(_L("DMA not supported - test skipped\n"));
+		return 0;
+		}
+	else if (dma2Loaded && !dma2CompatLoaded)
+		{
+		test.Printf(_L("Loaded %S\n"), &KDma);
+		}
+	else if (!dma2Loaded && dma2CompatLoaded)
+		{
+		test.Printf(_L("Loaded %S\n"), &KDma2Compat);
+		}
+	else
+		{
+		test.Printf(_L("The ROM contains %S and %S - only one should be present\n"), &KDma, &KDma2Compat);
+		TEST_FAULT;
+		}
+	// Turn off evil lazy dll unloading
+	RLoader l;
+	test(l.Connect()==KErrNone);
+	test(l.CancelLazyDllUnload()==KErrNone);
+	RTest::CloseHandleAndWaitForDestruction(l);
+
+	__KHEAP_MARK;
+
+	if (gSelfTest) //Run self tests if specified on command line
+	{
+	SelfTests(); 	
+	}
+
+	ApiTests();
+
+	RunDMATests();
+
+	__KHEAP_MARKEND;
+
+	r = User::FreeLogicalDevice(KTestDmaLddName);
+	test_KErrNone(r);
+	test.End();
+	test.Close();
+
+	delete cleanup;
+
+	//__KHEAP_MARKEND;
+	__UHEAP_MARKEND;
+	return 0;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/t_dma2.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,719 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __T_DMA2_H__
+#define __T_DMA2_H__
+
+#include "cap_reqs.h"
+#include "test_thread.h"
+#include "d_dma2.h"
+#include <e32std.h>
+
+
+class TTestCase;
+// Global array of test cases
+extern RPointerArray<TTestCase> TestArray;
+
+
+extern TBool gVerboseOutput;   // Verbose output control
+
+
+const TInt KParameterTextLenMax = 80;	// command-line param length
+
+/**
+This function prints out the PSL test Information
+*/
+void Print(const TDmaV2TestInfo& aInfo);
+
+/**
+Runs all framework self tests
+*/
+void SelfTests();
+
+void ApiTests();
+
+class CSingleTransferTest;
+class CIsrRequeTest;
+class CMultiTransferTest;
+
+
+/**
+An interface to a classs that sets up the buffers before a test
+*/
+//TODO both pre and post transfer checks should perhaps derive from an
+//abstract visitor base
+class MPreTransfer
+	{
+public:
+	virtual ~MPreTransfer()
+		{}
+	virtual void Setup(const CSingleTransferTest& aTest) const = 0;
+	virtual void Setup(const CIsrRequeTest& aTest) const = 0;
+	virtual void Setup(const CMultiTransferTest& aTest) const = 0;
+	};
+
+/**
+An interface for a check which takes place at the end of a DMA
+transfer test to verify the transfer was as expected.
+*/
+class MPostTransferCheck
+	{
+public:
+	virtual ~MPostTransferCheck()
+		{}
+	virtual TInt Check(const CSingleTransferTest& aTest) const = 0;
+	virtual TInt Check(const CIsrRequeTest& aTest) const = 0;
+	virtual TInt Check(CMultiTransferTest& aTest) const = 0;
+	};
+
+class TCompare2D : public MPostTransferCheck
+	{
+public:
+	TCompare2D()
+		{}
+
+	virtual TInt Check(const CSingleTransferTest& aTest) const;
+	virtual TInt Check(const CIsrRequeTest& aTest) const;
+	virtual TInt Check(CMultiTransferTest& aTest) const;
+
+	};
+
+class TAlwaysFail : public MPostTransferCheck
+	{
+public:
+	virtual TInt Check(const CSingleTransferTest& /*aTest*/) const
+		{return KErrUnknown;}
+	virtual TInt Check(const CIsrRequeTest&) const
+		{return KErrUnknown;}
+	virtual TInt Check(CMultiTransferTest&) const
+		{return KErrUnknown;}
+	};
+
+class TAlwaysPass : public MPostTransferCheck
+	{
+public:
+	virtual TInt Check(const CSingleTransferTest& /*aTest*/) const
+		{return KErrNone;}
+	virtual TInt Check(const CIsrRequeTest&) const
+		{return KErrNone;}
+	virtual TInt Check(CMultiTransferTest&) const
+		{return KErrNone;}
+	};
+
+/**
+Compare that all the various source buffers of a test match
+its destination buffers
+*/
+class TCompareSrcDst : public MPostTransferCheck
+	{
+public:
+	TCompareSrcDst()
+		{}
+
+	virtual TInt Check(const CSingleTransferTest& aTest) const;
+	virtual TInt Check(const CIsrRequeTest& aTest) const;
+	virtual TInt Check(CMultiTransferTest& aTest) const;
+
+protected:
+	TInt Check(const TIsrRequeArgsSet& aRequeueArgSet, TUint8* aChunkBase, const TDmaTransferArgs& aTferArgs) const;
+	TInt Check(const TIsrRequeArgs& aRequeueArgs) const;
+	TInt Check(const TDmaTransferArgs& aTransferArgs, TUint8* aChunkBase) const;
+	};
+
+/**
+Base class for all DMA tests
+*/
+class CDmaTest : public CTest
+	{
+public:
+	CDmaTest(const TDesC& aName, TInt aIterations, const MPreTransfer* aPreTransfer, const MPostTransferCheck* aPostTransfer)
+		: CTest(aName, aIterations), iPreTransfer(aPreTransfer), iPostTransferCheck(aPostTransfer)
+		{}
+
+	void OpenDmaSession();
+	void CloseDmaSession();
+
+	virtual void PrintTestInfo() const;
+	virtual TBool Result() = 0;
+
+	const RChunk& Chunk() const
+		{return iChunk;}
+
+	/**
+	Tells the test which DMA channel it should run on
+	*/
+	void SetChannelCookie(TUint32 aCookie)
+		{iChannelCookie = aCookie;}
+
+	virtual void PreTransferSetup() =0;
+	virtual TInt DoPostTransferCheck() =0;
+protected:
+	RDmaSession iDmaSession;
+	RChunk iChunk;
+
+	/**
+	Identifies the channel to open (as understood by a DMA PSL)
+	*/
+	TUint iChannelCookie;
+	const MPreTransfer* iPreTransfer;
+
+	const MPostTransferCheck* iPostTransferCheck; //!< Some check to be run after the transfer
+	};
+
+/**
+Holds return codes for the various functions which must be called
+to create, fragment, and queue a DMA request
+*/
+struct TRequestResults
+	{
+	TRequestResults
+		(
+		TInt aCreate = KErrNone,
+		TInt aFragmentCount = 0,
+		TInt aFragmentationResult = KErrNone,
+		TInt aQueueResult = KErrNone
+		)
+		:iCreate(aCreate), iFragmentCount(aFragmentCount), iFragmentationResult(aFragmentationResult), iQueueResult(aQueueResult)
+		{}
+
+	/**
+	Constructs with error results
+	*/
+	TRequestResults(TFalse)
+		:iCreate(KErrUnknown), iFragmentCount(0), iFragmentationResult(KErrUnknown), iQueueResult(KErrUnknown)
+		{}
+
+	inline TRequestResults& CreationResult(TInt aErrorCode) {iCreate = aErrorCode; return *this;}
+	inline TRequestResults& FragmentCount(TInt aCount) {iFragmentCount = aCount; return *this;}
+	inline TRequestResults& FragmentationResult(TInt aErrorCode) {iFragmentationResult = aErrorCode; return *this;}
+	inline TRequestResults& QueueResult(TInt aErrorCode) {iQueueResult = aErrorCode; return *this;}
+
+	TInt iCreate;
+	TInt iFragmentCount; //!< 0 means any result permitted
+	TInt iFragmentationResult;
+	TInt iQueueResult;
+	};
+
+/**
+Holds all the results for a DMA CSingleTransferTest
+*/
+struct TResultSet
+	{
+	/**
+	No errors expected
+	*/
+	TResultSet(TInt aChannelOpenResult = KErrNone,
+			const TRequestResults aRequestResults = TRequestResults(),
+			TInt aPostTransferCheck = KErrNone,
+			const TCallbackRecord aCallbackRecord = TCallbackRecord(TCallbackRecord::EThread,1)
+			)
+		:
+		iChannelOpenResult(aChannelOpenResult),
+		iRequestResult(aRequestResults),
+		iPostTransferCheck(aPostTransferCheck),
+		iCallbackRecord(aCallbackRecord)
+		{}
+	
+	explicit TResultSet(const TCallbackRecord& aRecord)
+		:iChannelOpenResult(KErrNone),
+		 iRequestResult(),
+		 iPostTransferCheck(KErrNone),
+		 iCallbackRecord(aRecord)
+		{}
+
+	/**
+	Errors expected
+	*/
+	TResultSet(TFalse)
+		:iChannelOpenResult(KErrUnknown), 
+		iRequestResult(EFalse),
+		iPostTransferCheck(KErrUnknown),
+		iCallbackRecord(TCallbackRecord::Empty())
+		{}		
+	
+	void Print() const;
+	TBool operator == (const TResultSet& aOther) const;
+
+	/** Set channel opening result */
+	TResultSet& ChannelOpenResult(TInt aResult) {iChannelOpenResult = aResult; return *this;}
+	TResultSet& PostTransferResult(TInt aResult) {iPostTransferCheck = aResult; return *this;}
+	/** Set request results */
+	TResultSet& RequestResult(const TRequestResults& aResults) {iRequestResult = aResults; return *this;}
+	/** Set Callback record */
+	TResultSet& CallbackRecord(const TCallbackRecord& aCallbackRecord) {iCallbackRecord = aCallbackRecord; return *this;}
+
+	TInt iChannelOpenResult;
+	TRequestResults iRequestResult;
+	TInt iPostTransferCheck;
+	TCallbackRecord iCallbackRecord;
+	};
+
+/**
+Fills each source buffer with an increasing value and clears each destination
+*/
+class TPreTransferIncrBytes : public MPreTransfer
+	{
+public:
+	TPreTransferIncrBytes()
+		{}
+
+	virtual void Setup(const CSingleTransferTest& aTest) const;
+	virtual void Setup(const CIsrRequeTest& aTest) const;
+	virtual void Setup(const CMultiTransferTest& aTest) const;
+protected:
+	virtual void Setup(const TAddressParms& aParams) const;
+	TBool CheckBuffers(const CIsrRequeTest& aTest) const;
+	TBool CheckBuffers(const RArray<const TAddressParms> aTransferParams) const;
+	};
+
+const TPreTransferIncrBytes KPreTransferIncrBytes;
+const TCompareSrcDst KCompareSrcDst;
+const TCompare2D KCompare2D;
+
+
+/**
+Iterates over the bytes in buffer, in the order
+the supllied DMA config would access them
+*/
+class TTransferIter
+	{
+public:
+	TTransferIter()
+		:iCfg(NULL), iPtr(NULL)
+		{}
+
+	TTransferIter(const TDmaTransferConfig& aCfg, TUint8* aChunkBase=NULL)
+		:iElem(0), iFrame(0), iCfg(&aCfg), iChunkBase(aChunkBase), iPtr(Start()), iBytes(0)
+		{}
+
+	void operator++ ();
+	TUint8& operator* ()
+		{
+		Invariant();
+		return *iPtr;
+		}
+
+	TBool operator!= (const TTransferIter& aOther)
+		{
+		return (iPtr != aOther.iPtr);
+		}
+
+	static void SelfTest();
+private:
+	TUint8* Start() const
+		{
+		return iChunkBase + iCfg->iAddr;
+		}
+
+	void Invariant() const;
+
+	TUint iElem; //!< The current element
+	TUint iFrame; //!< The current frame
+
+	const TDmaTransferConfig* const iCfg;
+	TUint8* iChunkBase;
+
+	TUint8* iPtr; //<! Pointer to the current byte
+
+	TInt iBytes; //!< The number of bytes traversed
+	};
+
+/**
+Performs a single DMA transfer using the member TDmaTransferArgs on
+one channel. At each stage of the transfer results are recorded in a
+TResultSet struct: at the end these are compared with a set of expected
+results.
+*/
+class CSingleTransferTest : public CDmaTest
+	{
+public:
+	CSingleTransferTest(
+			const TDesC& aName, TInt aIterations,
+			const TDmaTransferArgs& aArgs,
+			const TResultSet& aExpected,
+			TUint aMaxFragmentSize = 0,
+			const MPostTransferCheck* aPostTferChk = &KCompareSrcDst,
+			const MPreTransfer* aPreTfer = &KPreTransferIncrBytes
+			)
+		: CDmaTest(aName, aIterations, aPreTfer, aPostTferChk),
+		iTransferArgs(aArgs),iExpected(aExpected),iActual(EFalse),
+		iUseNewRequest(ETrue),
+		iUseNewFragment(ETrue),
+		iMaxFragmentSize(aMaxFragmentSize)
+		{}
+
+	/**
+	Perform each stage of trasnfer
+	*/
+	virtual void RunTest();
+	virtual void PrintTestType() const;
+
+	virtual CTest* Clone() const {return new CSingleTransferTest(*this);}
+
+	/**
+	Compares the actual vs the exepected results and reports
+	of the test passed
+	@return ETrue for a pass, EFalse for a fail
+	 */
+	virtual TBool Result();
+
+	/**
+	An accessor function for the object's TDmaTransferArgs
+	*/
+	const TDmaTransferArgs& TransferArgs() const
+		{return iTransferArgs;}
+
+	// The below methods are setters, which may be chained together
+	// ie. The Named Parameter Idiom
+	// @see http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.18
+	inline CSingleTransferTest& UseNewRequest(TBool aFlag) {iUseNewRequest=aFlag; return *this;}
+	inline CSingleTransferTest& UseNewFragment(TBool aFlag) {iUseNewFragment=aFlag; return *this;}
+	inline CSingleTransferTest& UseNewDmaApi(TBool aFlag) {UseNewRequest(aFlag); UseNewFragment(aFlag); return *this;}
+
+protected:
+	virtual void OpenChannel();
+	virtual void PreTransferSetup();
+	virtual void CreateDmaRequest();
+	virtual void Fragment();
+	virtual void Queue();
+	virtual void PostTransferCheck();
+	virtual TInt DoPostTransferCheck();
+	virtual void FreeRequest();
+	virtual void CloseChannel();
+
+protected:
+	/**
+	A handle to kernel side TDmaChannel object received after a channel is opened.
+	*/
+	TUint iChannelSessionCookie;
+	/**
+	A handle to kernel side DDmaRequest object.
+	*/
+	TUint iRequestSessionCookie;
+
+	const TDmaTransferArgs& iTransferArgs;
+
+	/**
+	Expected transfer results
+	*/
+	TResultSet iExpected;
+
+	/**
+	Filled with actual transfer results
+	*/
+	TResultSet iActual;
+
+	TBool iUseNewRequest; //!< If true then CSingleTransferTest will create a DDmaRequest with the v2 ctor
+	TBool iUseNewFragment; //!< If true then CSingleTransferTest will use v2 Fragment API
+	const TUint iMaxFragmentSize;
+	};
+
+/**
+This class will be used for tests which benchmark certain DMA operations
+*/
+class CDmaBenchmark : public CSingleTransferTest
+	{
+public:
+	CDmaBenchmark(const TDesC& aName, TInt aIterations, const TResultSet& aExpectedResults, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
+	~CDmaBenchmark();
+
+	virtual TBool Result();
+
+	static void SelfTest();
+
+protected:
+	/**
+	@return The mean average of the result array
+	*/
+	TUint64 MeanResult();
+
+	//TODO must be included within copy ctor or all instances will
+	//share on result set!
+	RArray<TUint64> iResultArray;
+
+	};
+
+/**
+Fragments requests (only) and records duration
+TODO make sure we are using old style DDmaRequest
+*/
+class CDmaBmFragmentation : public CDmaBenchmark
+	{
+public:
+	CDmaBmFragmentation(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
+	virtual CTest* Clone() const {return new CDmaBmFragmentation(*this);}
+	virtual TInt DoPostTransferCheck()
+		{TEST_FAULT; return KErrNotSupported;}
+
+	virtual void RunTest();
+	virtual void PrintTestType() const;
+
+protected:
+	void Fragment();
+	static const TResultSet ExpectedResults;
+	};
+
+/**
+Performs a transfer using an old style DDmaRequest and
+records the duration
+*/
+class CDmaBmTransfer : public CDmaBenchmark
+	{
+public:
+	CDmaBmTransfer(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
+	virtual CTest* Clone() const {return new CDmaBmTransfer(*this);}
+	virtual TInt DoPostTransferCheck()
+		{TEST_FAULT; return KErrNotSupported;}
+
+	virtual void RunTest();
+	virtual void PrintTestType() const;
+
+	inline CDmaBmTransfer& UseNewDmaApi(TBool aFlag) {CSingleTransferTest::UseNewDmaApi(aFlag); return *this;}
+	inline CDmaBmTransfer& ExpectedResults(const TResultSet& aArgs) {iExpected=aArgs; return *this;}
+protected:
+	void Queue();
+	};
+
+
+
+/**
+Will create and queue multiple requests
+
+Unlike CSingleTransferTest the class does not permit the use of TResultSet to
+define expected results (for neagative testing)
+*/
+class CMultiTransferTest : public CDmaTest
+	{
+public:
+	CMultiTransferTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs* aTransferArgs, const TResultSet* aResultSets, TInt aCount);
+	CMultiTransferTest(const CMultiTransferTest& aOther);
+	virtual ~CMultiTransferTest();
+	virtual CTest* Clone() const {return new CMultiTransferTest(*this);}
+
+	virtual TBool Result();
+	virtual void RunTest();
+	virtual void PrintTestType() const;
+
+	inline CMultiTransferTest& PauseWhileQueuing() {iPauseWhileQueuing = ETrue; return *this;}
+	inline CMultiTransferTest& SetPreTransferTest(const MPreTransfer* aPreTfer) {iPreTransfer = aPreTfer; return *this;}
+	inline CMultiTransferTest& SetPostTransferTest(const MPostTransferCheck* aPostTfer) {iPostTransferCheck = aPostTfer; return *this;}
+
+	const TDmaTransferArgs& TransferArgs(TInt aIndex) const;
+	inline TInt TransferCount() const {return iTransferArgsCount;}
+
+	void SetPostTransferResult(TInt aIndex, TInt aErrorCode);
+protected:
+	void OpenChannel();
+	TInt CloseChannel();
+	void CreateDmaRequests();
+	void Fragment();
+	void QueueRequests();
+
+	virtual void PreTransferSetup();
+	virtual TInt DoPostTransferCheck();
+
+	TBool Result(TInt aTransfer);
+
+	const TDmaTransferArgs* const iTransferArgs; //pointer to an array of transfer args
+	const TInt iTransferArgsCount;
+
+
+	TBool iNewDmaApi; //!< If true then CMultiTransferTest will use new style API
+
+	/**
+	A handle to kernel side TDmaChannel object received after a channel is opened.
+	*/
+	TUint iChannelSessionCookie;
+	RArray<TUint> iRequestCookies;
+
+	const TResultSet* const iExpectedArray; // array will be of length iTransferArgsCount
+	RArray<TResultSet> iActualResults;
+
+	/**
+	If set, the test will pause the channel before queuing requests, and
+	resume once they are all queued
+	*/
+	TBool iPauseWhileQueuing;
+	};
+
+/**
+Used for testing TDmaChannel::IsrRedoRequest
+
+Extends CSingle transfer by adding the capability to queue with
+additonal transfer parameters (TIsrRequeArgs) which are passed
+to IsrRedoRequest in ISR callback
+*/
+class CIsrRequeTest : public CSingleTransferTest
+	{
+public:
+	CIsrRequeTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aArgs,
+			TIsrRequeArgs* aRequeueArgs, TInt aCount,
+			const TResultSet& aExpected, const MPreTransfer* aPreTfer,
+			const MPostTransferCheck* aPostTferChk, TUint aMaxFragmentSize=0);
+
+	virtual void PrintTestType() const;
+
+	virtual void Queue();
+
+	/**
+	Compares the actual vs the exepected results and reports
+	of the test passed
+	@return ETrue for a pass, EFalse for a fail
+	 */
+	//virtual TBool Result();
+
+
+	virtual CTest* Clone() const {return new CIsrRequeTest(*this);}
+
+	const TIsrRequeArgsSet& GetRequeueArgs() const
+		{return iRequeArgSet;}
+
+
+protected:
+	virtual TInt DoPostTransferCheck();
+	virtual void PreTransferSetup();
+
+	TIsrRequeArgsSet iRequeArgSet;
+	};
+
+/**
+A channel record collects DMA channel capabilities and other PSL information
+before running tests.
+*/
+class TChannelRecord
+	{
+public:
+	TChannelRecord(){}
+	~TChannelRecord(){}
+
+	/**
+	DMA Channel Cookie
+	*/
+	TUint   iCookie;
+
+	/**
+	DMA Channel Capabilities
+	*/
+	TDmacTestCaps iChannelCaps;
+	};
+
+/**
+A test case collects together a DMA test (CDmaTest), its hardware prerequisites,
+and other information about how the test should be run.
+*/
+class TTestCase
+	{
+public:
+	//TODO it might be better to group sets of TDmaCapability
+	//into their own class eg. TDmaCapSet.
+	TTestCase(CDmaTest* aTest,
+           TBool aConcurrent = EFalse,
+		   const TDmaCapability = TDmaCapability(),
+		   const TDmaCapability = TDmaCapability(),
+		   const TDmaCapability = TDmaCapability(),
+		   const TDmaCapability = TDmaCapability(),
+		   const TDmaCapability = TDmaCapability()
+		   );
+
+	static void SelfTest();
+
+	/**
+	Compares the requirements held in the class
+	against those described in aChannelCaps and makes a decision
+	as to whether this test case should be run, skipped, or failed.
+	*/
+	TResult TestCaseValid(const SDmacCaps& aChannelCaps) const;
+	TResult TestCaseValid(const TDmacTestCaps& aChannelCaps) const;
+
+	enum {KMaxChannelCaps=5};
+	TDmaCapability	iChannelCaps[KMaxChannelCaps];
+	TUint iChannelType;
+	TInt iTimeout;
+	CDmaTest* iTest;
+	TBool iConcurrentTest;
+	TBool iDmaV2Only; //!< If true then this test cannot be run on DMA v1 framework
+	};
+
+/**
+A TestRunner manages the whole testing process.Before running any test cases it will open its own RDmaSession 
+handle, not associated with a DMA channel, so that it can recover the TDmaTestInfo object (as used by the 
+existing DMA framework) which says what channels are available to be tested.It will use TTestThread objects 
+to run tests in new threads.TTestThread contains a number of useful features such as waiting for thread exit 
+and accepting a TFunctor object to be run in a new thread. 
+*/
+class TTestRunner
+{
+public:
+	TTestRunner();
+	~TTestRunner();
+
+	/**
+	This function will populate TTestRunner with an array of test cases which 
+	would be a collection of DMA test,its hardware prerequisites,and other 
+	information about how the test	
+
+	@aTTestCases on return, this contains an the DMA test cases 
+	*/
+	void AddTestCases(RPointerArray<TTestCase>& aTTestCases);
+
+	/**
+	This will iterate over all test cases held by the test runner and
+	for each one will judge which DMA channels it can be run on, running
+	the test if possible.
+	*/
+	void RunTests();
+
+private:
+	/**
+	This functions retrieves the PSL cookies from all the DMA channels
+	and stores them in a single array.	It will use information from 
+	the PslTestInfo.
+	*/
+	void GetPslCookie();
+
+	/**
+	This function will generate the DMA channel records.i.e channel cookies,Caps.
+	*/
+	void GenerateChannelRecord();
+
+	/**
+	Holds the PslTestInfo
+	*/	
+	TDmaV2TestInfo iPslTestInfo;
+
+	/**
+	A handle to RDmaSession
+	*/
+	RDmaSession iDmaSession;
+	
+	/**
+	Array of DMA test cases 
+	*/
+	RPointerArray<TTestCase> iTestCases; 
+	
+	/**
+	Array of DMA channel records,channel capabilities and other PSL information
+	*/
+	RArray<TChannelRecord> iChannelRecords; 	
+
+	/**
+	Array of DMA channel cookies
+	*/
+	RArray<TUint> iPslCookies;
+};
+
+
+#endif // #ifndef __T_DMA2_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/test_cases.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,1352 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This file contains statically defined test cases, a pointer to each
+* new test case should be entered in StaticTestArray
+*
+*/
+
+#include "t_dma2.h"
+#include "cap_reqs.h"
+
+const TCallbackRecord threadCallback(TCallbackRecord::EThread,1);
+const TCallbackRecord isrCallback(TCallbackRecord::EIsr,1);
+
+const TInt size = 128 * KKilo;
+//--------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2560
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    Simple DMA transfer test using CSingleTransferTest and New DMA APIs
+//!
+//! @SYMTestActions     
+//!						1.
+//!						2.	
+//!
+//!
+//! @SYMTestExpectedResults 
+//!						1.  
+//!						2.		
+//!							
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace Simple_1
+	{
+	TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+
+	const TResultSet expectedResults(threadCallback);
+
+	CSingleTransferTest simpleTest(_L("Simple Test - New DMA APIs"), 1, transferArgs, expectedResults);
+
+	TTestCase testCase(&simpleTest, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&simpleTest, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2561
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    Simple DMA transfer test using CSingleTransferTest and OLD DMA APIs
+//!
+//! @SYMTestActions     
+//!						1.
+//!						2.	
+//!
+//!
+//! @SYMTestExpectedResults 
+//!						1.  
+//!						2.						
+//!							
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace Simple_2
+	{
+	TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+
+	const TResultSet expectedResults(threadCallback);
+
+	CSingleTransferTest simpleTest = CSingleTransferTest(_L("Simple Test - Old DMA APIs"), 1, transferArgs, expectedResults, 0).
+		UseNewDmaApi(EFalse);
+
+	TTestCase testCase(&simpleTest, EFalse);
+	TTestCase testCaseConcurrent(&simpleTest, ETrue);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2573
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    DMA ISR Callback test (Isr Callback - use old request Ctor)
+//!
+//! @SYMTestActions     
+//!						1.
+//!						2.	
+//!
+//!
+//! @SYMTestExpectedResults 
+//!						1.  
+//!						2.		
+//!							
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace Callback
+	{
+	TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
+
+	const TResultSet expectedResults(isrCallback);
+
+	CSingleTransferTest isrTest(_L("Isr Callback"), 1, transferArgs, expectedResults);
+	TTestCase testCase(&isrTest, EFalse, capAboveV1);
+
+
+	const TRequestResults fragmentFails = TRequestResults().
+		FragmentationResult(KErrArgument).
+		QueueResult(KErrUnknown);
+
+	const TResultSet expectedResultsFail = TResultSet(EFalse).
+		ChannelOpenResult(KErrNone).
+		RequestResult(fragmentFails).
+		PostTransferResult(1); // PostTransferResult of 1 means buffers don't match
+
+	CSingleTransferTest isrTestOldRequest = CSingleTransferTest(_L("Isr Callback - use old request Ctor"), 1, transferArgs, expectedResultsFail)
+		.UseNewRequest(EFalse);
+	TTestCase testCaseOldRequest(&isrTestOldRequest, EFalse, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2574,KBASE-DMA-2575
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    DMA ISR Reque test
+//!
+//! @SYMTestActions     
+//!						1.
+//!						2.	
+//!
+//!
+//! @SYMTestExpectedResults 
+//!						1.  
+//!						2.		
+//!							
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace ISR_Reque
+	{
+	const TInt size = 4 * KKilo;
+	TDmaTransferArgs tferArgs(0, 2*size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
+
+	const TRequestResults requestResult(KErrNone, 1); // request must be in a single fragment
+
+	namespace endOnIsrCb
+		{
+		TIsrRequeArgs requeArgs[] = {
+			TIsrRequeArgs(),
+			TIsrRequeArgs(size,3*size,size,0, ETrue),
+			TIsrRequeArgs(size,4*size,size,0, ETrue),
+			TIsrRequeArgs(0,5*size,size,0, ETrue),
+		};
+		const TInt count = ARRAY_LENGTH(requeArgs);
+
+		// we expect a cb for each requeue + 1 for the original
+		// transfer
+		const TCallbackRecord callbackRecord = TCallbackRecord(TCallbackRecord::EIsr, count + 1).IsrRedoResult(KErrNone);
+		const TResultSet expected(KErrNone, requestResult, KErrNone, callbackRecord);
+
+		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("4 Requeues - end on isr cb"), 1, tferArgs, requeArgs, count, expected, &KPreTransferIncrBytes, &KCompareSrcDst), ETrue, capAboveV1);
+		}
+
+	namespace endOnThreadCb
+		{
+		TIsrRequeArgs requeArgs[] = {
+			TIsrRequeArgs(),
+			TIsrRequeArgs(size,3*size,size,0, ETrue),
+			TIsrRequeArgs(size,4*size,size,0, ETrue),
+			TIsrRequeArgs(0,5*size,size,0, EFalse),
+		};
+		const TInt count = ARRAY_LENGTH(requeArgs);
+
+		const TCallbackRecord callbackRecord = TCallbackRecord(TCallbackRecord::EThread, count + 1).IsrRedoResult(KErrNone);
+		const TResultSet expected(KErrNone, requestResult, KErrNone, callbackRecord);
+
+		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("4 Requeues - end on thread cb"), 1, tferArgs, requeArgs, count, expected, &KPreTransferIncrBytes, &KCompareSrcDst), ETrue, capAboveV1);
+		}
+
+	namespace changeSize
+		{
+		TIsrRequeArgs requeArgs[] = {
+			TIsrRequeArgs(3*size,5*size,2*size,0, EFalse),
+		};
+		const TInt count = ARRAY_LENGTH(requeArgs);
+
+		const TCallbackRecord callbackRecord = TCallbackRecord(TCallbackRecord::EThread, count + 1).IsrRedoResult(KErrNone);
+		const TResultSet expected(KErrNone, requestResult, KErrNone, callbackRecord);
+
+		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("1 Requeues - change transfer size"), 1, tferArgs, requeArgs, count, expected, &KPreTransferIncrBytes, &KCompareSrcDst), ETrue, capAboveV1);
+		}
+
+	namespace endOnRedo
+		{
+		// TODO have made this bigger than 4k so that we don't miss the second interrupt when tracing enabled
+		// this indicates the PSL's interrupt handler misses an interrupt if it occurs during the interrupt.
+		const TInt size = 0x10000;
+		TDmaTransferArgs tferArgs(0, 2*size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
+
+		TIsrRequeArgs requeArgs[] = {
+			TIsrRequeArgs(3*size,5*size,2*size,0, ETrue),
+			TIsrRequeArgs() //repeat the previous transfer
+		};
+		const TInt count = ARRAY_LENGTH(requeArgs);
+
+		const TCallbackRecord callbackRecord = TCallbackRecord(TCallbackRecord::EIsr, count + 1).IsrRedoResult(KErrNone);
+		const TResultSet expected(KErrNone, requestResult, KErrNone, callbackRecord);
+
+		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("2 Requeues - Isr redo request repeated"), 1, tferArgs, requeArgs, count, expected, &KPreTransferIncrBytes, &KCompareSrcDst), EFalse, capAboveV1);
+		}
+
+	namespace invalidAddresses
+		{
+		TIsrRequeArgs requeArgs[] = {
+			TIsrRequeArgs(size, size)
+		};
+		const TInt count = ARRAY_LENGTH(requeArgs);
+
+		const TCallbackRecord callbackRecord = TCallbackRecord(TCallbackRecord::EIsr, 1).IsrRedoResult(KErrArgument);
+		const TResultSet expected(KErrNone, requestResult, KErrUnknown, callbackRecord);
+
+		// pre and post test would fail because of bad requeue parameters
+		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("Requeue with matching addresses"), 1, tferArgs, requeArgs, count, expected, NULL, NULL), ETrue, capAboveV1);
+		}
+
+	namespace multipleFragments
+		{
+		TIsrRequeArgs requeArgs[] = {
+			TIsrRequeArgs()
+		};
+		const TInt count = ARRAY_LENGTH(requeArgs);
+
+		const TCallbackRecord callbackRecord = TCallbackRecord(TCallbackRecord::EThread, count + 1).IsrRedoResult(KErrNone);
+
+		TRequestResults results2Fragments = TRequestResults(requestResult).FragmentCount(2);
+		const TResultSet expected(KErrNone, results2Fragments, KErrNone, callbackRecord);
+
+		TTestCase testCase(new (ELeave) CIsrRequeTest(_L("Attempt to Requeue 2 fragment request"), 1, tferArgs, requeArgs, count, expected, &KPreTransferIncrBytes, &KCompareSrcDst, size/2), ETrue, capAboveV1);
+
+		}
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      PBASE-DMA-FUNC-xxx
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    DMA Multiple transfer test
+//! @SYMTestActions     
+//!						1.
+//!						2.	
+//!
+//!
+//! @SYMTestExpectedResults 
+//!						1.  
+//!						2.		
+//!							
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace Multipart
+	{
+	// need long transfer, to try and force adjacent
+	// requests to be concatinated
+	const TInt size = 2 * KMega;
+	const TDmaTransferArgs transferArgArray[] = {
+		TDmaTransferArgs(0, size, size, KDmaMemAddr),
+		TDmaTransferArgs(size, 2 * size, size, KDmaMemAddr)
+	};
+
+	const TResultSet expected[] =
+		{
+		TResultSet(),
+		TResultSet()
+		};
+	const TResultSet expectedResults(isrCallback);
+
+	CMultiTransferTest multipart =
+		CMultiTransferTest(_L("Sg request concatination"), 1, transferArgArray, expected, ARRAY_LENGTH(transferArgArray))
+			.SetPreTransferTest(&KPreTransferIncrBytes)
+			.SetPostTransferTest(&KCompareSrcDst);
+
+	TTestCase testCase(&multipart, EFalse, hwDesWanted_skip);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2580
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    These tests attempt to queue ISR cb requests while the queue is not 
+//!						empty and queing normal requests when an ISR cb is pending
+//! @SYMTestActions     
+//!						1.
+//!						2.	
+//!
+//!
+//! @SYMTestExpectedResults 
+//!						1.  
+//!						2.		
+//!							
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace IsrAndDfc
+	{
+	// need long transfer, so that 1st request is still queued
+	// when the second one is queued
+	// TODO pause is the better way to ensure this
+	//const TInt size = 2 * KMega;
+	//TODO have changed size to ensure that the first isr callback request in IsrBeforeDfc
+	//will only have one fragment
+	const TInt size = 0x40000;
+	TDmaTransferArgs dfcTransfer(0, size, size, KDmaMemAddr);
+	TDmaTransferArgs isrTransfer(size, 2 * size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
+
+	const TResultSet success = TResultSet();
+	TResultSet queueFailure = TResultSet().
+			RequestResult(TRequestResults().QueueResult(KErrGeneral)).
+			CallbackRecord(TCallbackRecord::Empty()).
+			PostTransferResult(1);
+
+	namespace DfcBeforeIsr
+		{
+		const TDmaTransferArgs transferArgArray[] = {
+			dfcTransfer,
+			isrTransfer
+		};
+
+		const TResultSet expected[] =
+			{
+			success,
+			queueFailure
+			};
+		CMultiTransferTest dfcBeforeIsr =
+			CMultiTransferTest(_L("DFC cb req before ISR cb req "), 1, transferArgArray, expected, ARRAY_LENGTH(transferArgArray))
+				.SetPreTransferTest(&KPreTransferIncrBytes)
+				.SetPostTransferTest(&KCompareSrcDst);
+		TTestCase testCase(&dfcBeforeIsr, EFalse, hwDesWanted_skip);
+		}
+
+	namespace IsrBeforeDfc
+		{
+		const TDmaTransferArgs transferArgArray[] = {
+			isrTransfer,
+			dfcTransfer
+		};
+
+		TResultSet isrSuccess = TResultSet(success).CallbackRecord(isrCallback);
+		const TResultSet expected[] =
+			{
+			isrSuccess,
+			queueFailure
+			};
+		CMultiTransferTest dfcBeforeIsr =
+			CMultiTransferTest(_L("ISR cb req before DFC cb req "), 1, transferArgArray, expected, ARRAY_LENGTH(transferArgArray))
+				.SetPreTransferTest(&KPreTransferIncrBytes)
+				.SetPostTransferTest(&KCompareSrcDst);
+		TTestCase testCase(&dfcBeforeIsr, EFalse, hwDesWanted_skip);
+		}
+
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      PBASE-DMA-FUNC-xxx
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    DMA 2D transfer test
+//!
+//! @SYMTestActions     
+//!						1.
+//!						2.	
+//!
+//!
+//! @SYMTestExpectedResults 
+//!						1.  
+//!						2.		
+//!							
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace _2D_Test
+	{
+	// Image @ 0x0 with 640x480 pixels and 24 bits/pixel.
+
+	TDmaTransferConfig src(
+		0, /*iAddr*/
+		3, /*iElementSize*/
+		6, /*iElementsPerFrame*/
+		4, /*iFramesPerTransfer*/
+		0, /*iElementSkip*/
+		0, /*iFrameSkip*/
+		KDmaMemAddr /*iFlags*/
+		);
+
+	TDmaTransferConfig dst(
+		0x708000, /*iAddr*/
+		3, /*iElementSize*/
+		640, /*iElementsPerFrame*/
+		480, /*iFramesPerTransfer*/
+		1437, /*iElementSkip*/
+		-920166, /*iFrameSkip*/
+		KDmaMemAddr /*iFlags*/
+		);
+
+	TDmaTransferArgs transferArgs2D(src, dst);
+
+	TResultSet expectedResults; //all KErrNone
+
+	//source buffer is currently filled with increasing values
+	//instead of an image, but the test is still valid
+	CSingleTransferTest transfer2d(_L("2D Transfer"), 1, transferArgs2D, expectedResults, 0, &KCompare2D);
+
+	TTestCase testCase2d(&transfer2d, EFalse, cap_2DRequired, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2565
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    DMA Fragmentation count test
+//!
+//! @SYMTestActions     
+//!						1.
+//!						2.	
+//!
+//!
+//! @SYMTestExpectedResults 
+//!						1.  
+//!						2.		
+//!							
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace FragmentationCount
+	{
+	TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+
+	const TRequestResults requestResult(KErrNone, 128);
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+	CSingleTransferTest test1(_L("Fragmentation Count - 128 fragments"), 1, transferArgs, expectedResults, KKilo);
+	TTestCase testCase(&test1, EFalse);
+
+	const TRequestResults requestResult2(KErrNone, 4);
+	const TResultSet expectedResults2(KErrNone, requestResult2, KErrNone, threadCallback);
+	CSingleTransferTest test2(_L("Fragmentation Count - 4 fragments"), 1, transferArgs, expectedResults2, 32*KKilo);
+	TTestCase testCase2(&test2, EFalse);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2584,KBASE-DMA-2585
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    DMA Benchmark tests
+//!
+//! @SYMTestActions     
+//!						1.
+//!						2.	
+//!
+//!
+//! @SYMTestExpectedResults 
+//!						1.  
+//!						2.		
+//!							
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//-----------------------------------------------------------------------------------------------
+namespace Benchmark
+	{
+	const TInt bmIters = 10;
+	namespace Frag
+		{
+		const TInt size = 1 * KMega;
+		TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+
+		TTestCase testCase_256k(new (ELeave) CDmaBmFragmentation(_L("1 Mb transfer - 256k frag size"), bmIters, transferArgs, 256 * KKilo), EFalse);
+		TTestCase testCase_8k(new (ELeave) CDmaBmFragmentation(_L("1 Mb transfer - 8k frag size"), bmIters, transferArgs, 8 * KKilo), EFalse);
+		}
+
+	namespace Transfer
+		{
+		namespace _4Bytes
+			{
+			const TInt size = 4;
+			TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+
+			CDmaBmTransfer bmTest(_L("4 bytes"), bmIters, transferArgs, 0);
+			TTestCase testCase(&bmTest, EFalse);
+			}
+		namespace _128K
+			{
+			const TInt size = 128 * KKilo;
+			TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+
+			TTestCase testCase_128(new (ELeave) CDmaBmTransfer(_L("128 K - 128K frag size"), bmIters, transferArgs, 128 * KKilo), EFalse);
+			TTestCase testCase_16(new (ELeave) CDmaBmTransfer(_L("128 K - 16k frag size"), bmIters, transferArgs, 16 * KKilo), EFalse);
+			TTestCase testCase_4(new (ELeave) CDmaBmTransfer(_L("128 K - 4k frag size"), bmIters, transferArgs, 4 * KKilo), EFalse);
+			TTestCase testCase_1(new (ELeave) CDmaBmTransfer(_L("128 K - 1k frag size"), bmIters, transferArgs, 1 * KKilo), EFalse);
+			}
+		namespace _4Mb
+			{
+			const TInt size = 4 * KMega;
+			TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+
+			CDmaBmTransfer bmTest(_L("4 Mb"), bmIters, transferArgs, 0);
+			TTestCase testCase(&bmTest, EFalse);
+			}
+		}
+
+	/**
+	Compare time taken between queing and callback of 4 byte
+	request with both DFC and ISR callback
+	The new API calls are used
+	*/
+	namespace CompareIsrDfcCb
+		{
+		const TInt iterations = 50;
+
+		namespace Dfc
+			{
+			TResultSet expected = TResultSet(threadCallback).
+				PostTransferResult(KErrUnknown);
+
+			namespace _4Bytes
+				{
+				const TInt size = 4;
+				TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+				CDmaBmTransfer bmTest = CDmaBmTransfer(_L("4 bytes DFC cb"), iterations, transferArgs, 0).
+					UseNewDmaApi(ETrue).
+					ExpectedResults(expected);
+				TTestCase testCase(&bmTest, EFalse);
+				}
+			namespace _4K
+				{
+				const TInt size = 4 * KKilo;
+				TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+				CDmaBmTransfer bmTest = CDmaBmTransfer(_L("4K DFC cb"), iterations, transferArgs, 0).
+					UseNewDmaApi(ETrue).
+					ExpectedResults(expected);
+				TTestCase testCase(&bmTest, EFalse);
+				}
+			}
+
+		namespace Isr
+			{
+			TResultSet expected = TResultSet(isrCallback).
+				PostTransferResult(KErrUnknown);
+
+			namespace _4Bytes
+				{
+				const TInt size = 4;
+				TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
+				CDmaBmTransfer bmTest = CDmaBmTransfer(_L("4 bytes Isr cb"), iterations, transferArgs, 0).
+					UseNewDmaApi(ETrue).
+					ExpectedResults(expected);
+				TTestCase testCase(&bmTest, EFalse);
+				}
+			namespace _4K
+				{
+				const TInt size = 4 * KKilo;
+				TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
+				CDmaBmTransfer bmTest = CDmaBmTransfer(_L("4K Isr cb"), iterations, transferArgs, 0).
+					UseNewDmaApi(ETrue).
+					ExpectedResults(expected);
+				TTestCase testCase(&bmTest, EFalse);
+				}
+			}
+		}
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2560
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//!						Test Scenario 1 - DstAddr > SrcAddr & TransferSize=32K & Location is 
+//!						address of a memory buffer
+//! @SYMTestActions     
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr		 = 4 * KKilo;
+//!							desAddr		 = 64 * KKilo;
+//!							transferSize = 32 * KKilo;	
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework					
+//!						3.	Fragment request completes and KErrNone returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestNewStyleFragment_1
+	{	
+	const TInt srcAddr = 4 * KKilo;
+	const TInt desAddr = 64 * KKilo;
+
+	const TInt transferSize =  32 * KKilo;
+	
+	TDmaTransferArgs transferArgs( srcAddr, desAddr, transferSize, KDmaMemAddr);
+
+	const TRequestResults requestResult(KErrNone, 32); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_1(_L("TestNewStyleFragment - Test Scenario 1"), 1, transferArgs, expectedResults,KKilo);
+
+	TTestCase testCase(&testscenario_1, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_1, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2560
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//!						Test Scenario 2 -  SrcAddr	== DstAddr   					
+//!		
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr	 = 4 * KKilo;
+//!							desAddr	 = 4 * KKilo;
+//!							transferSize = 32 * KKilo;	
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework					
+//!						3.	Fragment passes and KErrNone returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestNewStyleFragment_2
+	{
+	const TInt srcAddr = 4 * KKilo;
+	const TInt desAddr = 4 * KKilo;
+	const TInt transferSize =  32 * KKilo;
+
+	TDmaTransferArgs transferArgs(srcAddr,desAddr, transferSize, KDmaMemAddr);
+	const TRequestResults requestResult(KErrNone, 32); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_2(_L("TestNewStyleFragment - Test Scenario 2"), 1, transferArgs, expectedResults,KKilo);
+
+	TTestCase testCase(&testscenario_2, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_2, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2560
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//!						Test Scenario 3 -  TransferSize=0   
+//!
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr		 = 32 * KKilo;
+//!							desAddr		 = 64 * KKilo;
+//!							transferSize = 0	
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	Fragment request fails and KErrArgument returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestNewStyleFragment_3
+	{
+	const TInt srcAddr = 32 * KKilo;
+	const TInt desAddr = 64 * KKilo;
+	const TInt transferSize = 0;
+	
+	TDmaTransferArgs transferArgs( srcAddr, desAddr, transferSize,KDmaMemAddr);
+	const TRequestResults requestResult(KErrArgument, 0); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_3(_L("TestNewStyleFragment - Test Scenario 3"), 1, transferArgs, expectedResults);
+
+	TTestCase testCase(&testscenario_3, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_3, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2560
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//!						Test Scenario 4 -  TransferSize=1Byte   
+//!
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr		 = 32K;
+//!							desAddr		 = 64K;
+//!							transferSize = 1 byte	
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	Fragment request completes and KErrNone returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestNewStyleFragment_4
+	{	
+	const TInt srcAddr = 32 * KKilo;
+	const TInt desAddr = 64 * KKilo;
+	const TInt transferSize = 1;
+	
+	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize, KDmaMemAddr);
+	const TRequestResults requestResult(KErrNone, 1);
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_4(_L("TestNewStyleFragment - Test Scenario 4"), 1, transferArgs, expectedResults);
+
+	TTestCase testCase(&testscenario_4, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_4, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2560
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//!						Test Scenario 5 -  TransferSize=128KB    
+//!
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr		 = 16K;
+//!							desAddr		 = 2MB;
+//!							transferSize = 1MB;
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	Fragment request completes and KErrNone returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestNewStyleFragment_5
+	{
+	
+	const TInt srcAddr		= 16 * KKilo;
+	const TInt desAddr		= 2 * KMega;	
+	const TInt transferSize = 1 * KMega;
+
+	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize, KDmaMemAddr);
+	const TRequestResults requestResult(KErrNone); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_5(_L("TestNewStyleFragment - Test Scenario 5"), 1, transferArgs, expectedResults);
+
+	TTestCase testCase(&testscenario_5, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_5, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2560
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestNewStyleFragment using CSingleTransferTest
+//!						Test Scenario 6 -  TransferSize=3MB   
+//!
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr		 = 16K;
+//!							desAddr		 = 4MB;
+//!							transferSize = 3MB 	
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	Fragment request completes and KErrNone returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestNewStyleFragment_6
+	{
+	const TInt srcAddr = 16 * KKilo;
+	const TInt desAddr = 4 * KMega;
+	const TInt transferSize = 3 * KMega;
+
+	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize, KDmaMemAddr);
+	const TRequestResults requestResult(KErrNone); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_6(_L("TestNewStyleFragment - Test Scenario 6"), 1, transferArgs, expectedResults);
+
+	TTestCase testCase(&testscenario_6, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_6, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2561
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
+//!						Test Scenario 1 - DstAddr > SrcAddr & TransferSize=32K & Location is 
+//!						address of a memory buffer
+//!
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr		 = 4 * KKilo;
+//!							desAddr		 = 64 * KKilo;
+//!							transferSize = 32 * KKilo;	
+//!							iFlags		 = KDmaMemAddr;
+
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework					
+//!						3.	Fragment request completes and KErrNone returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestOldStyleFragment_1
+	{	
+	const TInt srcAddr = 4 * KKilo;
+	const TInt desAddr = 64 * KKilo;
+	const TInt transferSize =  32 * KKilo;
+	
+	TDmaTransferArgs transferArgs( srcAddr, desAddr, transferSize, KDmaMemAddr);
+
+	const TRequestResults requestResult(KErrNone,32); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_1 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 1"), 1, transferArgs, expectedResults,KKilo).
+		UseNewDmaApi(EFalse);
+
+	TTestCase testCase(&testscenario_1, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_1, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2561
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
+//!						Test Scenario 2 - DstAddr == SrcAddr
+//!
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr	 = 4 * KKilo;
+//!							desAddr	 = 4 * KKilo;
+//!							transferSize = 4 * KKilo
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	Fragment passes and KErrNone returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestOldStyleFragment_2
+	{
+	const TInt srcAddr = 4 * KKilo;
+	const TInt desAddr = 4 * KKilo;
+	const TInt transferSize =  4 * KKilo;
+
+	TDmaTransferArgs transferArgs(srcAddr,desAddr, transferSize, KDmaMemAddr);
+	const TRequestResults requestResult(KErrNone, 4);  
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_2 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 2"), 1, transferArgs, expectedResults,KKilo)
+		.UseNewDmaApi(EFalse);
+
+	TTestCase testCase(&testscenario_2, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_2, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2561
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
+//!						Test Scenario 3 -  TransferSize=0  
+//!
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr	 = 32K
+//!							desAddr	 = 64K;
+//!							transferSize = 0
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	Fragment request Fails and KErrArgument returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestOldStyleFragment_3
+	{
+
+	const TInt srcAddr = 32 * KKilo;
+	const TInt desAddr = 64 * KKilo;
+	const TInt transferSize = 0;
+	
+	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize,KDmaMemAddr);
+	const TRequestResults requestResult(KErrArgument, 0); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_3 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 3"), 1, transferArgs, expectedResults).
+		UseNewDmaApi(EFalse);
+
+	TTestCase testCase(&testscenario_3, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_3, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2561
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
+//!						Test Scenario 4 -  TransferSize=1Byte   
+//!
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!	
+//!							SrcAddr		 = 32K;
+//!							desAddr		 = 64K;
+//!							transferSize = 1 byte	
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	Fragment request completes and KErrNone returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//------------------------------------------------------------------------------------------------
+namespace TestOldStyleFragment_4
+	{	
+	const TInt srcAddr = 32 * KKilo;
+	const TInt desAddr = 64 * KKilo;
+	const TInt transferSize = 1;
+	
+	TDmaTransferArgs transferArgs( srcAddr, desAddr, transferSize, KDmaMemAddr);
+	const TRequestResults requestResult(KErrNone, 1); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_4 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 4"), 1, transferArgs, expectedResults).
+		UseNewDmaApi(EFalse);
+
+	TTestCase testCase(&testscenario_4, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_4, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2561
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
+//!						Test Scenario 5 -  TransferSize=1MB
+//!
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr		 = 16K;
+//!							desAddr		 = 2MB;
+//!							transferSize = 1MB	
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	Fragment request completes and KErrNone returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestOldStyleFragment_5
+	{
+	const TInt srcAddr = 16 * KKilo;	
+	const TInt desAddr = 2 * KMega;
+	const TInt transferSize = 1 *  KMega;
+
+	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize, KDmaMemAddr);
+
+	const TRequestResults requestResult(KErrNone); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_5 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 5"), 1, transferArgs, expectedResults).
+		UseNewDmaApi(EFalse);
+
+	TTestCase testCase(&testscenario_5, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_5, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2561
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestOldstyleFragment using CSingleTransferTest
+//!						Test Scenario 6 -  TransferSize=3MB     
+//!
+//!						1.	Set up the arguments for aTransfeArgs using the settings below.
+//!							
+//!							SrcAddr	 = 16K
+//!							desAddr	 = 4MB;
+//!							transferSize = 3MB  
+//!							iFlags		 = KDmaMemAddr;
+//!
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	Fragment request completes and KErrNone returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestOldStyleFragment_6
+	{
+	const TInt srcAddr = 16 * KKilo;
+	const TInt desAddr = 4 * KMega;
+	const TInt transferSize = 3 * KMega; 
+	TDmaTransferArgs transferArgs(srcAddr, desAddr, transferSize, KDmaMemAddr);
+
+	const TRequestResults requestResult(KErrNone); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_6 = CSingleTransferTest(_L("TestOldStyleFragment - Test Scenario 6"), 1, transferArgs, expectedResults).
+		UseNewDmaApi(EFalse);
+
+	TTestCase testCase(&testscenario_6, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_6, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2562
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestOldStyleDDmaRequest using CSingleTransferTest
+//!						Test Scenario 1 -  aMaxTransferSize=0 
+//!
+//!						1.	Set up the DDmaRequest using  aMaxTransferSize set to 0. 
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	DDmaRequest constructor behaves as expected and KErrArgument returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//------------------------------------------------------------------------------------------------
+namespace TestOldStyleDDmaRequest_1
+	{
+	const TInt desAddr = 4 * KKilo;
+	const TInt transferSize = 4 * KKilo;
+	TDmaTransferArgs transferArgs(0, desAddr, transferSize, KDmaMemAddr);
+
+	const TRequestResults requestResult(KErrNone, 0); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_1 = CSingleTransferTest(_L("TestOldStyleDDmaRequest - Test Scenario 1"), 1, transferArgs, expectedResults,0).
+		UseNewDmaApi(EFalse);
+
+	TTestCase testCase(&testscenario_1, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_1, ETrue, capAboveV1);
+	}
+
+//!-------------------------------------------------------------------------------------------------
+//! @SYMTestCaseID       KBASE-DMA-2562
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestOldStyleDDmaRequest using CSingleTransferTest
+//!						Test Scenario 2 -  aMaxTransferSize= 65535   
+//!
+//!						1.	Set up the arguments for DDmaRequest using aMaxTransferSize set to 65535.
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	DDmaRequest constructor behaves as expected and KErrArgument returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//---------------------------------------------------------------------------------------------------
+namespace TestOldStyleDDmaRequest_2
+	{
+	const TInt desAddr = 4 * KKilo;
+	const TInt transferSize = 4 * KKilo;
+	TDmaTransferArgs transferArgs(0, desAddr, transferSize, KDmaMemAddr);
+
+	const TRequestResults requestResult(KErrNone, 1); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_2 = CSingleTransferTest(_L("TestOldStyleDDmaRequest - Test Scenario 2"), 1, transferArgs, expectedResults, 65535).
+		UseNewDmaApi(EFalse);
+
+	TTestCase testCase(&testscenario_2, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_2, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2563
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestNewStyleDDmaRequest using CSingleTransferTest
+//!						Test Scenario 1 -  aMaxTransferSize=0 
+//!
+//!						1.	Set up the DDmaRequest using  aMaxTransferSize set to 0. 
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	DDmaRequest constructor behaves as expected and KErrArgument returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace TestNewStyleDDmaRequest_1
+	{
+	const TInt desAddr = 4 * KKilo;
+	const TInt transferSize = 4 * KKilo;
+	TDmaTransferArgs transferArgs(0, desAddr, transferSize, KDmaMemAddr);
+
+	const TRequestResults requestResult(KErrNone, 0); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_1(_L("TestNewStyleDDmaRequest - Test Scenario 1"), 1, transferArgs, expectedResults,0);
+
+	TTestCase testCase(&testscenario_1, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_1, ETrue, capAboveV1);
+	}
+
+//!-------------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      KBASE-DMA-2563
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    TestNewStyleDDmaRequest using CSingleTransferTest
+//!						Test Scenario 2 -  aMaxTransferSize= 65535   
+//!
+//!						1.	Set up the arguments for DDmaRequest using aMaxTransferSize set to 65535.
+//!						2.	Setup expected result.
+//!						3.	Create single transfer test and run test
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  TransfeArgs set up in DMA framework
+//!						2.	Expected results set up in DMA framework			
+//!						3.	DDmaRequest constructor behaves as expected and KErrArgument returned
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//---------------------------------------------------------------------------------------------------
+namespace TestNewStyleDDmaRequest_2
+	{
+	const TInt desAddr = 4 * KKilo;
+	const TInt transferSize = 4 * KKilo;
+	TDmaTransferArgs transferArgs(0, desAddr, transferSize, KDmaMemAddr);
+
+	const TRequestResults requestResult(KErrNone, 1); 
+	const TResultSet expectedResults(KErrNone, requestResult, KErrNone, threadCallback);
+
+	CSingleTransferTest testscenario_2(_L("TestNewStyleDDmaRequest - Test Scenario 2"), 1, transferArgs, expectedResults, 65535);
+
+	TTestCase testCase(&testscenario_2, EFalse, capAboveV1);
+	TTestCase testCaseConcurrent(&testscenario_2, ETrue, capAboveV1);
+	}
+
+//----------------------------------------------------------------------------------------------
+//! @SYMTestCaseID      PBASE-DMA-FUNC-xxx
+//! @SYMTestType        CIT
+//! @SYMPREQ            REQ
+//! @SYMTestCaseDesc    SmallFrags: This test provokes the failure seen in DEF140598
+//!						The test checks that requests with small fragments
+//!						do not trigger a spurious missed interrupt clean up
+//!
+//! @SYMTestExpectedResults 
+//!
+//!						1.  		
+//!						2.	
+//!
+//! @SYMTestPriority        High
+//! @SYMTestStatus          Implemented
+//----------------------------------------------------------------------------------------------
+namespace SmallFrags
+	{
+	const TInt size = 32;
+	TDmaTransferArgs transferArgs(0, size, size, KDmaMemAddr);
+
+	const TResultSet expectedResults(threadCallback);
+
+	TTestCase testCase(
+			new (ELeave) CSingleTransferTest(_L("8 * 4byte frags"), 10, transferArgs, expectedResults, 4),
+			EFalse, capAboveV1);
+	}
+
+
+//TODO TTestCase could automatically be added to aray by ctor
+//
+//Append new test cases here
+static TTestCase* StaticTestArray[] = {
+	&Simple_1::testCase,
+	&Simple_1::testCaseConcurrent,
+	&Simple_2::testCase,
+	&Simple_2::testCaseConcurrent,
+	&Callback::testCase,
+	&Callback::testCaseOldRequest,
+	&ISR_Reque::endOnRedo::testCase,
+	&ISR_Reque::endOnIsrCb::testCase,
+	&ISR_Reque::endOnThreadCb::testCase,
+	&ISR_Reque::changeSize::testCase,
+#ifdef _DEBUG
+	&ISR_Reque::invalidAddresses::testCase, // addresses only checked in UDEB
+#endif
+	//&ISR_Reque::multipleFragments::testCase, // This error condition is currently caught by a FAULT instead of a return code
+	&Multipart::testCase,
+	&IsrAndDfc::DfcBeforeIsr::testCase,
+	&IsrAndDfc::IsrBeforeDfc::testCase,
+	&_2D_Test::testCase2d,
+	&FragmentationCount::testCase,
+	&FragmentationCount::testCase2,
+	&SmallFrags::testCase,
+#ifndef _DEBUG
+	// Benchmarks are only really meaningful
+	// on UREL builds
+	&Benchmark::Frag::testCase_256k,
+	&Benchmark::Frag::testCase_8k,
+	&Benchmark::Transfer::_128K::testCase_128,
+	&Benchmark::Transfer::_128K::testCase_16,
+	&Benchmark::Transfer::_128K::testCase_4,
+	&Benchmark::Transfer::_128K::testCase_1,
+	&Benchmark::Transfer::_4Bytes::testCase,
+	&Benchmark::Transfer::_4Mb::testCase,
+	&Benchmark::CompareIsrDfcCb::Dfc::_4Bytes::testCase,
+	&Benchmark::CompareIsrDfcCb::Isr::_4Bytes::testCase,
+	&Benchmark::CompareIsrDfcCb::Dfc::_4K::testCase,
+	&Benchmark::CompareIsrDfcCb::Isr::_4K::testCase,
+#endif
+	&TestNewStyleFragment_1::testCase,
+	&TestNewStyleFragment_1::testCaseConcurrent,
+	&TestNewStyleFragment_2::testCase,
+	&TestNewStyleFragment_2::testCaseConcurrent,
+	//&TestNewStyleFragment_3::testCase,
+	//&TestNewStyleFragment_3::testCaseConcurrent,
+	&TestNewStyleFragment_4::testCase,
+	&TestNewStyleFragment_4::testCaseConcurrent,
+	&TestNewStyleFragment_5::testCase,
+	&TestNewStyleFragment_5::testCaseConcurrent,
+	&TestNewStyleFragment_6::testCase,
+	&TestNewStyleFragment_6::testCaseConcurrent,
+	&TestOldStyleFragment_1::testCase,
+	&TestOldStyleFragment_1::testCaseConcurrent,
+	&TestOldStyleFragment_2::testCase,
+	&TestOldStyleFragment_2::testCaseConcurrent,
+	//&TestOldStyleFragment_3::testCase,
+	//&TestOldStyleFragment_3::testCaseConcurrent,
+	&TestOldStyleFragment_4::testCase,
+	&TestOldStyleFragment_4::testCaseConcurrent,
+	&TestOldStyleFragment_5::testCase,
+	&TestOldStyleFragment_5::testCaseConcurrent,
+	&TestOldStyleFragment_6::testCase,
+	&TestOldStyleFragment_6::testCaseConcurrent,
+	&TestOldStyleDDmaRequest_1::testCase,
+	&TestOldStyleDDmaRequest_1::testCaseConcurrent,
+	&TestOldStyleDDmaRequest_2::testCase,
+	&TestOldStyleDDmaRequest_2::testCaseConcurrent,
+	&TestNewStyleDDmaRequest_1::testCase,
+	&TestNewStyleDDmaRequest_1::testCaseConcurrent,
+	&TestNewStyleDDmaRequest_2::testCase,
+	&TestNewStyleDDmaRequest_2::testCaseConcurrent,
+};
+
+RPointerArray<TTestCase> TestArray(StaticTestArray, ARRAY_LENGTH(StaticTestArray));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/test_thread.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Implementation of test_thread.h
+*
+*/
+#include "test_thread.h"
+
+TInt TTestRemote::iCount=0;
+
+TInt TTestRemote::RunFunctor(TAny* aFunctor)
+	{
+	TFunctor& functor = *(TFunctor*)aFunctor;
+	functor();
+	return KErrNone;
+	}
+
+TTestThread::TTestThread(const TDesC& aName, TThreadFunction aFn, TAny* aData, TBool aAutoResume)
+	{
+	Init(aName, aFn, aData, aAutoResume);
+	}
+
+TTestThread::TTestThread(const TDesC& aName, TFunctor& aFunctor, TBool aAutoResume)
+	{
+	Init(aName, RunFunctor, &aFunctor, aAutoResume);
+	}
+
+TTestThread::~TTestThread()
+	{
+	//RTest::CloseHandleAndWaitForDestruction(iThread);
+	iThread.Close();
+	}
+
+void TTestThread::Resume()
+	{
+	iThread.Resume();
+	}
+
+TInt TTestThread::WaitForExitL()
+	{
+	User::WaitForRequest(iLogonStatus);
+	const TInt exitType = iThread.ExitType();
+	const TInt exitReason = iThread.ExitReason();
+
+	__ASSERT_ALWAYS(exitType != EExitPending, User::Panic(_L("TTestThread"),0));
+
+	if(exitType != EExitKill)
+		User::Leave(exitReason);
+
+	return exitReason;
+	}
+
+void TTestThread::Rendezvous(TRequestStatus& aStatus)
+	{
+	iThread.Rendezvous(aStatus);
+	}
+
+void TTestThread::Init(const TDesC& aName, TThreadFunction aFn, TAny* aData, TBool aAutoResume)
+	{
+	TKName name(aName);
+	name.AppendFormat(_L("-%d"), iCount++);
+	TInt r=iThread.Create(name, aFn, KDefaultStackSize, KHeapSize, KHeapSize, aData);
+	if(r!=KErrNone)
+		{
+		RDebug::Printf("RThread::Create failed, code=%d", r);
+		User::Panic(KPanicCat, EThreadCreateFailed);
+		}
+
+	iThread.Logon(iLogonStatus);
+	__ASSERT_ALWAYS(iLogonStatus == KRequestPending, User::Panic(_L("TTestThread"),0));
+
+	if(aAutoResume)
+		iThread.Resume();
+	}
+
+
+CTest::~CTest()
+	{
+	iName.Close();
+	}
+
+void CTest::operator()()
+	{
+	for(TInt i=0; i<iIterations; i++)
+		{
+		RunTest();
+		}
+	}
+
+
+void CTest::Announce() const
+{
+	RDebug::RawPrint(_L("Test: "));
+	PrintTestInfo();
+	RDebug::RawPrint(_L(": "));
+	PrintTestType();
+	RDebug::RawPrint(_L(": "));
+	RDebug::RawPrint(iName);
+	RDebug::RawPrint(_L(": "));
+	RDebug::Printf("(%d iterations)", iIterations);
+}
+
+
+void CTest::PrintTestInfo() const
+	{
+	}
+const TDesC& CTest::Name() const
+	{
+	return iName;
+	}
+
+CTest::CTest(const TDesC& aName, TInt aIterations)
+	:iIterations(aIterations)
+	{
+	iName.CreateL(aName);
+	}
+
+CTest::CTest(const CTest& aOther)
+	:iIterations(aOther.iIterations)
+	{
+	iName.CreateL(aOther.iName);
+	}
+
+void MultipleTestRun(RTest& test, const CTest& aTest, TInt aNumberOfThreads)
+	{
+	RPointerArray<CTest> testArray;
+	RPointerArray<TTestThread> threadArray;
+
+	for(TInt i=0; i<aNumberOfThreads; i++)
+		{
+		//test.Next(_L("Create test thread"));
+		CTest* newTest = aTest.Clone();
+		test_NotNull(newTest);
+
+		TTestThread* thread = new TTestThread(aTest.Name(), *newTest);
+		test_NotNull(thread);
+
+		threadArray.AppendL(thread);
+		testArray.AppendL(newTest);
+		}
+
+	const TInt count = threadArray.Count();
+	for(TInt j=0; j<count; j++)
+		{
+		TTestThread* thread = threadArray[0];
+		
+		TInt r = KErrNone;
+		TRAPD(leaveCode, r = thread->WaitForExitL());
+		if(leaveCode != KErrNone)
+			{
+			test.Printf(_L("Thread %d: Panic code:%d\n"), j, leaveCode);
+			test_KErrNone(leaveCode);
+			}
+
+		if(r!=KErrNone)
+			{
+			test.Printf(_L("Thread Number %d\n"), j);
+			test_KErrNone(r);
+			}
+
+		threadArray.Remove(0);
+		delete thread;
+		}
+	threadArray.Close();
+
+	testArray.ResetAndDestroy();
+	testArray.Close();
+	}
+
+/**
+Runs each CTest in aTests in its own thread
+Returns once all threads have terminated
+*/
+void MultipleTestRun(const RPointerArray<CTest>& aTests)
+	{
+	RTest test(_L("CTest::MultipleTestRun"));
+	RPointerArray<TTestThread> threads;
+
+	const TInt count = aTests.Count();
+
+	TInt i;
+	for(i=0; i<count; i++)
+		{
+		_LIT(KDmaTestThread, "DMA-test-thread");
+		TTestThread* thread = new TTestThread(KDmaTestThread, *aTests[i], EFalse);
+		test_NotNull(thread);
+		TInt r = threads.Append(thread);
+		test_KErrNone(r);
+		}
+
+	for(i=0; i<count; i++)
+		{
+		threads[i]->Resume();
+		}
+
+
+	for(i=0; i<count; i++)
+		{
+		TInt r = threads[i]->WaitForExitL();
+		test_KErrNone(r);
+		}
+
+	threads.ResetAndDestroy();
+	test.Close();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/dmav2/test_thread.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Some helper classes to assist with writing multi-threaded tests
+*
+*/
+
+
+#ifndef __TEST_THREAD_H__
+#define __TEST_THREAD_H__
+
+#include <e32base.h>
+#include <e32debug.h>
+#define __E32TEST_EXTENSION__
+#include <e32test.h>
+#include <e32cmn_private.h>
+
+_LIT(KPanicCat, "test_thread.h");
+
+
+static const TInt KHeapSize=0x2000;
+
+enum TPanicCode
+	{
+	EThreadCreateFailed
+	};
+
+/**
+A utility class for running functions in other threads/processes
+*/
+class TTestRemote
+	{
+public:
+	virtual TInt WaitForExitL() = 0;
+	virtual ~TTestRemote()
+		{}
+
+	virtual void Rendezvous(TRequestStatus& aStatus) = 0;
+
+protected:
+	TTestRemote()
+		{}
+
+	static TInt RunFunctor(TAny* aFunctor);
+
+	TRequestStatus iLogonStatus;
+	static TInt iCount;
+	};
+
+class TTestThread : public TTestRemote
+	{
+public:
+	TTestThread(const TDesC& aName, TThreadFunction aFn, TAny* aData, TBool aAutoResume=ETrue);
+
+	/**
+	Run aFunctor in another thread
+	*/
+	TTestThread(const TDesC& aName, TFunctor& aFunctor, TBool aAutoResume=ETrue);
+
+	~TTestThread();
+
+	void Resume();
+
+	/**
+	If thread exited normally, return its return code
+	Otherwise, leave with exit reason
+	*/
+	virtual TInt WaitForExitL();
+
+	virtual void Rendezvous(TRequestStatus& aStatus);
+
+private:
+	void Init(const TDesC& aName, TThreadFunction aFn, TAny* aData, TBool aAutoResume);
+
+	RThread iThread;
+	};
+
+class CTest : public CBase, public TFunctor
+	{
+public:
+	~CTest();
+
+	virtual void operator()();
+	virtual void RunTest() = 0;
+	virtual CTest* Clone() const = 0;
+
+	/**
+	Prints a formatted description of the test
+	*/
+	void Announce() const;
+
+	const TDesC& Name() const;
+
+	/**
+	Should print the type of test, with no newlines.
+	eg. "Transfer", "Fragmentation"
+	TODO drop the function, just add a test type member
+	*/
+	virtual void PrintTestType() const = 0;
+
+	/**
+	Display any information about test environment, with no newlines
+	eg. "DMA channel 16"
+	The base class version prints nothing.
+	*/
+	virtual void PrintTestInfo() const;
+
+protected:
+	CTest(const TDesC& aName, TInt aIterations);
+	CTest(const CTest& aOther);
+
+	//It would be useful to have an RTest member, but this can't be
+	//initialised untill the new thread is running as it will refer to
+	//the creating thread
+	RBuf iName;
+	const TInt iIterations;
+	};
+
+/**
+Make aNumberOfThreads copies of aTest and run
+each in its own thread
+
+@param test Reference to test object
+@param aTest Referance
+*/
+void MultipleTestRun(RTest& test, const CTest& aTest, TInt aNumberOfThreads);
+
+void MultipleTestRun(const RPointerArray<CTest>& aTests);
+#endif // #ifndef __TEST_THREAD_H__
+
--- a/kerneltest/e32test/group/bld.inf	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/group/bld.inf	Mon Jan 18 21:31:10 2010 +0200
@@ -152,6 +152,9 @@
 #if defined(EPOC32) && !defined(X86)
 // Test LDD for real hardware DMA
 d_dma						support
+d_dma2						support
+d_dma_compat				support
+d_dma2_compat				support
 #endif
 
 #ifdef EPOC32
@@ -174,11 +177,11 @@
 
 #if !defined(WINS)
 d_demandpaging				support
+d_pagemove					support
 #endif
 
 #if !defined(WINS) && !defined(X86)
 d_ramdefrag					support
-d_pagemove					support
 d_smpsoak					support
 #endif
 
@@ -629,6 +632,7 @@
 t_mwait
 t_asid
 t_asid_dummy support
+t_alias_remove
 #endif
 
 // /E32TEST/NKERN tests
@@ -837,6 +841,7 @@
 
 // /E32TEST/DMA tests
 t_dma       // user-side test harness for real DMA framework
+t_dma2       // user-side test harness for DMAv2 framework
 
 // Example RTOS personality
 ../personality/example/t_expers support
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/d_dma2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,52 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "kernel/kern_ext.mmh"
+
+#ifdef	VariantDmaImportLib
+target		VariantTarget(d_dma2,ldd)
+#else
+target		d_dma2.ldd
+#endif
+
+targettype	ldd
+
+sourcepath	../dmav2
+source		d_dma2.cpp d_dma2_cmn.cpp
+
+#ifdef	VariantDmaImportLib
+library		VariantDmaImportLib
+#else
+library		dma2.lib
+#endif
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+epocallowdlldata
+
+capability	all
+VENDORID 0x70000001
+
+// Don't put this in ROM here since it would stop ROMs building on platforms
+// without DMA support.
+romtarget
+
+#ifdef SMP
+MACRO CPU_AFFINITY_ANY
+#endif
+
+SMPSAFE
+
+MACRO DMA_APIV2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/d_dma2_compat.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,53 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "kernel/kern_ext.mmh"
+
+#ifdef	VariantDmaImportLib
+target		VariantTarget(d_dma2_compat,ldd)
+#else
+target		d_dma2_compat.ldd
+#endif
+
+targettype	ldd
+
+sourcepath	../dmav2
+source		d_dma2.cpp d_dma2_cmn.cpp
+
+sourcepath	../../../../kernelhwsrv/kernel/eka/drivers/dma
+source		dma2_shared.cpp
+
+#ifdef	VariantDmaImportLib
+library		VariantDmaImportLib
+#else
+library		dma.lib
+#endif
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+epocallowdlldata
+
+capability	all
+VENDORID 0x70000001
+
+// Don't put this in ROM here since it would stop ROMs building on platforms
+// without DMA support.
+romtarget
+
+#ifdef SMP
+MACRO CPU_AFFINITY_ANY
+#endif
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/d_dma_compat.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,52 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "kernel/kern_ext.mmh"
+
+#ifdef	VariantDmaImportLib
+target		VariantTarget(d_dma_compat,ldd)
+#else
+target		d_dma_compat.ldd
+#endif
+
+targettype	ldd
+
+sourcepath	../dma
+source		d_dma.cpp
+
+#ifdef	VariantDmaImportLib
+library		VariantDmaImportLib
+#else
+library		dma2.lib
+#endif
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+epocallowdlldata
+
+capability	all
+VENDORID 0x70000001
+
+// Don't put this in ROM here since it would stop ROMs building on platforms
+// without DMA support.
+romtarget
+
+#ifdef SMP
+MACRO CPU_AFFINITY_ANY
+#endif
+
+SMPSAFE
+
+MACRO DMA_APIV2
--- a/kerneltest/e32test/group/smpsafea.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/group/smpsafea.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -28,6 +28,7 @@
 
 macro MAKE_DLL
 macro PROVIDE_A
+unpaged  // must be unpaged for CheckAffinity() to be robust
 
 capability NONE
 VENDORID 0x70000001
--- a/kerneltest/e32test/group/smpsafeb.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/group/smpsafeb.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -29,6 +29,7 @@
 smpsafe
 macro MAKE_DLL
 macro PROVIDE_B
+unpaged  // must be unpaged for CheckAffinity() to be robust
 
 capability NONE
 VENDORID 0x70000001
--- a/kerneltest/e32test/group/smpsafec.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/group/smpsafec.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -29,6 +29,7 @@
 smpsafe
 macro MAKE_DLL
 macro PROVIDE_C
+unpaged  // must be unpaged for CheckAffinity() to be robust
 
 capability NONE
 VENDORID 0x70000001
--- a/kerneltest/e32test/group/smpsafed.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/group/smpsafed.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -29,6 +29,7 @@
 smpsafe
 macro MAKE_DLL
 macro PROVIDE_D
+unpaged  // must be unpaged for CheckAffinity() to be robust
 
 capability NONE
 VENDORID 0x70000001
--- a/kerneltest/e32test/group/smpsafee.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/group/smpsafee.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -28,6 +28,7 @@
 
 macro MAKE_DLL
 macro PROVIDE_E
+unpaged  // must be unpaged for CheckAffinity() to be robust
 
 capability NONE
 VENDORID 0x70000001
--- a/kerneltest/e32test/group/smpsafexa.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/group/smpsafexa.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -26,6 +26,7 @@
 
 macro MAKE_DLL
 macro PROVIDE_A
+unpaged  // must be unpaged for CheckAffinity() to be robust
 
 capability NONE
 VENDORID 0x70000001
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/t_alias_remove.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,33 @@
+// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test/group/t_alias_remove.mmp
+// 
+//
+
+TARGET         t_alias_remove.exe
+TARGETTYPE     EXE
+SOURCEPATH	../mmu
+SOURCE         t_alias_remove.cpp
+LIBRARY        euser.lib
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+
+capability		all
+
+VENDORID 0x70000001
+
+SMPSAFE
+
+unpaged		// The test takes too long to execute when it's paged.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/t_dma2.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,30 @@
+// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+TARGET         t_dma2.exe
+TARGETTYPE     EXE
+SOURCEPATH	../dmav2
+SOURCE         t_dma2.cpp test_cases.cpp self_test.cpp dma_api_tests.cpp d_dma2_cmn.cpp
+SOURCE		   test_thread.cpp
+SOURCEPATH	../../../kernel/eka/drivers/dma
+SOURCE		dma2_shared.cpp
+LIBRARY        euser.lib
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+CAPABILITY	NONE
+
+VENDORID 0x70000001
+
+SMPSAFE
--- a/kerneltest/e32test/group/t_smpsafe.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/group/t_smpsafe.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -27,5 +27,6 @@
 
 smpsafe
 macro OMIT_MAIN
+unpaged  // must be unpaged for CheckAffinity() to be robust
 
 VENDORID 0x70000001
--- a/kerneltest/e32test/group/t_smpsoakspin.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/group/t_smpsoakspin.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -1,20 +1,7 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+// e32test\group\t_smpsoakspin.mmp
+//
+// Copyright (c) 2005 Symbian Ltd. All rights reserved.
+//
 
 target			t_smpsoakspin.exe        
 targettype		exe
--- a/kerneltest/e32test/misc/inflate.c	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/misc/inflate.c	Mon Jan 18 21:31:10 2010 +0200
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /* inflate.c -- Not copyrighted 1992 by Mark Adler
    version c10p1, 10 January 1993 */
 
--- a/kerneltest/e32test/misc/t_cputime.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/misc/t_cputime.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -35,7 +35,7 @@
 
 const TInt KLongWait  = 3000000;  // 3 seconds
 const TInt KShortWait =  100000;  // 0.1 seconds
-const TInt KTolerance =     500;  // 0.5 ms
+const TInt KTolerance =    1000;  // 1 ms
 const TInt numCpus = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0);
 
 #define FailIfError(EXPR) \
@@ -215,7 +215,7 @@
 
 	TThreadParam threadParam;
 	FailIfError((threadParam.iSem).CreateLocal(0));
-	threadParam.iCpu = 1;
+	threadParam.iCpu = 0;				// Later tests will exercise other CPUs
 
 	RThread thread;
 	RUndertaker u;
@@ -243,7 +243,7 @@
 	(threadParam.iSem).Signal();
 	User::After(KShortWait);
 	FailIfError(thread.GetCpuTime(time));
-	test(time > (KShortWait - 2 * KTolerance));
+	test(time > (KShortWait - KTolerance));
 
 	// Test not increased while suspended
 	thread.Suspend();
@@ -420,7 +420,7 @@
 	{
 	test.Title();
 	test.Start(_L("T_CPUTIME"));
-	
+
 	if (numCpus > 1)
 		FailIfError(SetCpuAffinity(0));
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/mmu/t_alias_remove.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,374 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// e32test\mmu\t_alias_remove.cpp
+// Overview:
+// Test interactions when free memory being aliases.
+// Details:
+// Create 3 mappings to one chunk one that owns the chunk, one to map it again another process 
+// and another alias mapping.
+// Then while the alias mapping is accessing the chunk close the second mapping.
+// Platforms/Drives/Compatibility:
+// All.
+// Assumptions/Requirement/Pre-requisites:
+// Failures and causes:
+// Base Port information:
+// 
+//
+
+#define __E32TEST_EXTENSION__
+#include <e32test.h>
+#include <e32hal.h>
+#include <e32svr.h>
+#include "..\defrag\d_pagemove.h"
+
+const TPtrC KAliasProcessName = _L("T_ALIAS_REMOVE");
+const TPtrC KAliasChunkName = _L("AliasChunk");
+const TPtrC KAliasServerName = _L("AliasServer");
+const TPtrC KMasterServerName = _L("MasterServer");
+
+RBuf ChunkName;
+RBuf MasterServerName;
+RBuf AliasServerName;
+
+RTest test(KAliasProcessName);
+
+//#define ENABLE_PRINTFS
+#ifndef __MSVC6__	// VC6 can't cope with variable arguments in macros.
+
+#define T_PRINTF(x...) test.Printf(x)
+#define D_PRINTF(x...) RDebug::Printf(x)
+#ifdef ENABLE_PRINTFS
+#define PRINTF(x) x
+#else
+#define PRINTF(x)
+#endif // ENABLE_PRINTFS
+
+#else
+#define PRINTF(x)
+#endif	// __MSCV6__
+
+enum TSlaveMsgType
+	{
+	ESlaveConnect = -1,
+	ESlaveDisconnect = -2,
+	ESlaveReadChunk = 0,
+	ESlaveClosedChunk = 1,
+	};
+
+
+struct SThreadData 
+	{
+	TUint8 iFillValue;
+	TUint iChunkSize;
+	RThread* iMasterThread;
+	TUint iProcessId;
+	};
+
+
+class RAliasSession : public RSessionBase
+	{
+public:
+	TInt CreateSession(const TDesC& aServerName, TInt aMsgSlots) 
+		{ 
+		return RSessionBase::CreateSession(aServerName,User::Version(),aMsgSlots);
+		}
+	TInt PublicSendReceive(TInt aFunction, const TIpcArgs &aPtr)
+		{
+		return (SendReceive(aFunction, aPtr));
+		}
+	TInt PublicSend(TInt aFunction, const TIpcArgs &aPtr)
+		{
+		return (Send(aFunction, aPtr));
+		}
+	};
+
+
+TInt SlaveProcess(TUint aProcessId, TUint aFillValue)
+	{		
+	// Connect to the master server to indicate that we're ready to receive ipc messages.
+	RAliasSession masterSession;
+	test_KErrNone(masterSession.CreateSession(MasterServerName, 1));
+
+	PRINTF(T_PRINTF(_L("Process ID %d Slave open chunk\n"), aProcessId));
+	// Open the global chunk.
+	RChunk chunk;
+	TInt r = chunk.OpenGlobal(ChunkName, ETrue);
+	test_KErrNone(r);
+
+	// Connect to alias server.
+	PRINTF(T_PRINTF(_L("Process ID %d Slave connect to alias server\n"), aProcessId));
+	RAliasSession aliasSession;
+	test_KErrNone(aliasSession.CreateSession(AliasServerName, 1));
+
+	PRINTF(T_PRINTF(_L("Process ID %d Slave send data to alias server\n"), aProcessId));
+	TPtr8 arg0(chunk.Base(), chunk.Size(), chunk.Size());
+	r = aliasSession.PublicSend(ESlaveReadChunk, TIpcArgs(&arg0));
+	test_KErrNone(r);
+	
+	// Close the chunk removing its mapping before the server has read it.
+	chunk.Close();
+	PRINTF(T_PRINTF(_L("Process ID %d Slave closed chunk\n"), aProcessId));
+
+	r = masterSession.PublicSendReceive(ESlaveClosedChunk, TIpcArgs());
+	test_KErrNone(r);
+	aliasSession.Close();
+	masterSession.Close();
+	return KErrNone;
+	}
+
+
+TInt ChunkReadThread(TAny* aThreadData)
+	{
+	SThreadData* threadData =  (SThreadData*)aThreadData;
+	RServer2 aliasServer;
+	TInt r = aliasServer.CreateGlobal(AliasServerName);
+	if (r != KErrNone)
+		{
+		RDebug::Printf("Process ID %d Error creating alias server r=%d", threadData->iProcessId, r);
+		return r;
+		}
+	// Connect to the master server to indicate that we're ready to receive ipc messages.
+	RAliasSession masterSession;
+	test_KErrNone(masterSession.CreateSession(MasterServerName, 1));
+
+	PRINTF(D_PRINTF("Process ID %d Alias wait for slave connection", threadData->iProcessId));
+	RMessage2 aliasMessage;
+	// Read and complete the connect message from the slave.
+	aliasServer.Receive(aliasMessage);
+	test_Equal(ESlaveConnect, aliasMessage.Function());
+	aliasMessage.Complete(KErrNone);
+
+	// Read the data of the remote chunk.
+	PRINTF(D_PRINTF("Process ID %d Alias read chunk data", threadData->iProcessId));
+	HBufC8* argTmp = HBufC8::New(threadData->iChunkSize);
+	test_NotNull(argTmp);
+	RBuf8 argBuf(argTmp);
+	aliasServer.Receive(aliasMessage);
+	test_Equal(ESlaveReadChunk, aliasMessage.Function());
+	r = aliasMessage.Read(0, argBuf);
+	if (r == KErrNone)
+		{// Successfully read the chunk so verify it.
+		aliasMessage.Complete(KErrNone);
+
+		PRINTF(D_PRINTF("Process ID %d Alias verify chunk data", threadData->iProcessId));
+		const TUint8* bufPtr = argBuf.Ptr();
+		const TUint8* bufEnd = bufPtr + threadData->iChunkSize;
+		for (; bufPtr < bufEnd; bufPtr++)
+			{
+			if (*bufPtr != threadData->iFillValue)
+				{
+				RDebug::Printf("Process ID %d Read incorrect data exp 0x%x got 0x%x", 
+								threadData->iProcessId, threadData->iFillValue, *bufPtr);
+				r = *bufPtr;
+				break;
+				}
+			}
+		}
+	else
+		{
+		PRINTF(D_PRINTF("Process ID %d Error reading chunk remotely %d", threadData->iProcessId, r));
+		}
+	argBuf.Close();
+	masterSession.Close();
+	return r;
+	}
+
+
+TInt MasterProcess(TInt aProcessId)
+	{
+	TInt pageSize;
+	UserHal::PageSizeInBytes(pageSize);
+	// Need a large chunk so that alias that reads it is held for a long
+	// enough period for there to be conflicts with the chunk closure in 
+	// the slave process.
+	const TUint KChunkSize = pageSize * 1024;
+
+	PRINTF(T_PRINTF(_L("Process ID %d Create chunk\n"), aProcessId));
+	RChunk chunk;
+	TInt r = chunk.CreateGlobal(ChunkName, KChunkSize, KChunkSize);
+	test_KErrNone(r);
+
+
+	for (TUint8 fillValue = 1; fillValue < 255; fillValue++)
+		{
+		// Output a character every 16 iterations so test machines 
+		// don't time out.
+		if ((fillValue & 0xf) == 1)
+			test.Printf(_L("."));
+
+		PRINTF(T_PRINTF(_L("Process ID %d start slave fill value %d\n"), aProcessId, fillValue));
+		RServer2 masterServer;
+		r = masterServer.CreateGlobal(MasterServerName);
+		test_KErrNone(r);
+		RMessage2 masterMessage;
+
+		// Update the chunk to new fill value.
+		memset(chunk.Base(), fillValue, KChunkSize);
+
+		PRINTF(T_PRINTF(_L("Process ID %d Start the slave process\n"), aProcessId));
+		RProcess slaveProcess;
+		test_KErrNone(slaveProcess.Create(KAliasProcessName, KNullDesC));
+		test_KErrNone(slaveProcess.SetParameter(1, aProcessId));
+		test_KErrNone(slaveProcess.SetParameter(2, fillValue));
+		TRequestStatus slaveStatus;
+		slaveProcess.Logon(slaveStatus);
+		test_Equal(KRequestPending, slaveStatus.Int());
+		slaveProcess.Resume();
+
+		// Wait for the connect message from the slave process.
+		masterServer.Receive(masterMessage);
+		test_Equal(ESlaveConnect, masterMessage.Function());
+
+		SThreadData threadData;
+		threadData.iFillValue = fillValue;
+		threadData.iChunkSize = KChunkSize;
+		threadData.iProcessId = aProcessId;
+		RThread readThread;
+		r = readThread.Create(KNullDesC, ChunkReadThread, 10 * pageSize, KChunkSize, KChunkSize * 2, &threadData);
+		test_KErrNone(r);
+		TRequestStatus threadStatus;
+		readThread.Logon(threadStatus);
+		test_Equal(KRequestPending, threadStatus.Int());
+		readThread.Resume();
+
+		PRINTF(T_PRINTF(_L("Process ID %d Wait for alias thread to start server\n"), aProcessId));
+		RMessage2 aliasMessage;
+		masterServer.Receive(aliasMessage);
+		test_Equal(ESlaveConnect, aliasMessage.Function());
+		aliasMessage.Complete(KErrNone);
+
+		// Signal to the slave process to send chunk to alias thread.
+		PRINTF(T_PRINTF(_L("Process ID %d Signal to slave to send chunk to alias\n"), aProcessId));
+		masterMessage.Complete(KErrNone);
+
+		// Wait for slave to close the chunk and fill it with new value.
+		for (;;)
+			{
+			masterServer.Receive(masterMessage);
+			TInt func = masterMessage.Function();
+			PRINTF(T_PRINTF(_L("Process ID %d rxd %d\n"), aProcessId, func));
+			if (func == ESlaveClosedChunk)
+				{// Slave closed the chunk.
+				memset(chunk.Base(), ++fillValue, KChunkSize);
+				break;
+				}
+			else
+				{// Alias has read the chunk and completed.
+				test_Equal(ESlaveDisconnect, func);
+				}
+			}
+		
+		PRINTF(T_PRINTF(_L("Process ID %d Wait for alias to complete\n"), aProcessId));
+		masterMessage.Complete(KErrNone);
+		User::WaitForRequest(threadStatus);
+		TInt statusInt = threadStatus.Int();
+		test_Value(	statusInt, 
+					statusInt == KErrNone || 
+					statusInt == KErrBadDescriptor ||
+					statusInt == KErrDied);
+		test_Equal(EExitKill, readThread.ExitType());
+		readThread.Close();
+
+		PRINTF(T_PRINTF(_L("Process ID %d Wait for slave to complete\n"), aProcessId));
+		User::WaitForRequest(slaveStatus);
+		test_Equal(EExitKill, slaveProcess.ExitType());
+		test_Equal(KErrNone, slaveProcess.ExitReason());
+		slaveProcess.Close();
+		masterServer.Close();
+		}
+
+	chunk.Close();
+
+	return 0;
+	}
+
+
+GLDEF_C TInt E32Main()
+	{
+	TInt processId;
+	if(User::GetTIntParameter(1, processId)==KErrNone)
+		{
+		test_KErrNone(ChunkName.Create(KAliasChunkName.Length() + 3));
+		ChunkName.Copy(KAliasChunkName);
+		ChunkName.AppendNum(processId);
+
+		test_KErrNone(MasterServerName.Create(KMasterServerName.Length() + 3));
+		MasterServerName.Copy(KMasterServerName);
+		MasterServerName.AppendNum(processId);
+
+		test_KErrNone(AliasServerName.Create(KAliasServerName.Length() + 3));
+		AliasServerName.Copy(KAliasServerName);
+		AliasServerName.AppendNum(processId);
+
+		TInt fillValue;
+		if(User::GetTIntParameter(2, fillValue)==KErrNone)
+			{
+			return SlaveProcess(processId, fillValue);
+			}
+		return MasterProcess(processId);
+		}
+
+	// Get the number of cpus and use it to determine how many processes to execute.
+	RPageMove pagemove;
+	test_KErrNone(pagemove.Open());
+	TUint masterProcesses = pagemove.NumberOfCpus() + 1;
+	pagemove.Close();
+
+	TInt cmdLineLen = User::CommandLineLength();
+	if(cmdLineLen)
+		{
+		RBuf cmdLine;
+		test_KErrNone(cmdLine.Create(cmdLineLen));
+		User::CommandLine(cmdLine);
+		test_KErrNone(TLex(cmdLine).Val(masterProcesses));
+		}
+
+	test.Title();
+	test.Start(_L(""));
+	test.Printf(_L("Create %d processes for accessing aliases being removed\n"), masterProcesses); 
+
+	TUint32 debugMask = UserSvr::DebugMask();
+	User::SetDebugMask(0);
+
+	// Start master processes to alias memory between each other.
+	RProcess* masters = new RProcess[masterProcesses];
+	TRequestStatus* masterStatus = new TRequestStatus[masterProcesses];
+	TUint i = 0;
+	for (; i < masterProcesses; i++)
+		{
+		test_KErrNone(masters[i].Create(KAliasProcessName, KNullDesC));
+		test_KErrNone(masters[i].SetParameter(1, i));
+		masters[i].Logon(masterStatus[i]);
+		test_Equal(KRequestPending, masterStatus[i].Int());
+		}
+	test.Next(_L("Resume the processes")); 
+	for (i = 0; i < masterProcesses; i++)
+		{
+		masters[i].Resume();
+		}
+
+	test.Next(_L("Wait for processes to exit")); 
+	for (i = 0; i < masterProcesses; i++)
+		{
+		User::WaitForRequest(masterStatus[i]);
+		test_Equal(EExitKill, masters[i].ExitType());
+		test_Equal(KErrNone, masters[i].ExitReason());
+		}
+	User::SetDebugMask(debugMask);
+	delete masterStatus;
+	delete masters;
+	test.Printf(_L("\n"));
+	test.End();
+	return KErrNone;
+	}
--- a/kerneltest/e32test/smpsoak/t_smpsoak.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/smpsoak/t_smpsoak.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -14,6 +14,7 @@
 // e32test\smpsoak\t_smpsoak.cpp
 
 //  User Includes
+#include <e32hal.h>
 #include "t_smpsoak.h"
 
 void ParseCommandLine ();
--- a/kerneltest/e32test/smpsoak/t_smpsoakspin.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/smpsoak/t_smpsoakspin.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -15,6 +15,7 @@
 //
 
 #define __E32TEST_EXTENSION__
+#include <e32svr.h>
 #include <e32test.h>
 #include <u32hal.h>
 #include <f32file.h>
--- a/kerneltest/e32test/system/t_dobject.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/system/t_dobject.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -179,25 +179,29 @@
 	test.Next(_L("Test mutexes have been created"));
 	
 	TFullName name;
-	TFindMutex find;
+
 	for (TInt i = 0 ; i < KObjectCount ; ++i)
 		{
+		TFindMutex find(MutexName(i));
 		test(find.Next(name) == KErrNone);
 		test.Printf(_L("  %02d: found handle %08x\n"), i, find.Handle());
-		test(name == MutexName(i));
 		}
-	test(find.Next(name) == KErrNotFound);
 	}
 
 void TestMutexesDeleted()
 	{
 	test.Next(_L("Test mutexes deleted"));
 
-	TFindMutex find;
 	TFullName name;
-	test(find.Next(name) == KErrNotFound);
+
+	for (TInt i = 0 ; i < KObjectCount ; ++i)
+		{
+		TFindMutex find(MutexName(i));
+		test(find.Next(name) == KErrNotFound);
+		}
 	}
 
+
 void TestFindSpecificMutex()
 	{
 	test.Next(_L("Test finding specific mutexes"));
@@ -275,27 +279,23 @@
 
 	// Find and delete even mutexes
 	TFullName name;
-	TFindMutex find2(KDoubleMatch);
 	TInt i;
 	for (i = 0 ; i < KObjectCount ; i += 2)
 		{
+		TFindMutex find2(MutexName(i));
 		test(find2.Next(name) == KErrNone);
 		test.Printf(_L("  %02d: found handle %08x\n"), i, find2.Handle());
-		test(name == MutexName(i));
 		Mutexes[i].Close();
 		RMutex mutex;
 		test(mutex.Open(find2) == KErrNotFound);
 		}
-	test(find2.Next(name) == KErrNotFound);
 
 	// Check odd mutexes remaining
-	TFindMutex find;
 	for (i = 1 ; i < KObjectCount ; i += 2)
 		{
+		TFindMutex find(MutexName(i));
 		test(find.Next(name) == KErrNone);
-		test(name == MutexName(i));
 		}
-	test(find2.Next(name) == KErrNotFound);
 	}
 
 void TestFindAndDeleteMutex2()
@@ -304,29 +304,26 @@
 
 	// Find even mutexes and delete odd
 	TFullName name;
-	TFindMutex find2(KDoubleMatch);
 	TInt i;
 	for (i = 0 ; i < KObjectCount ; i += 2)
 		{
+		TFindMutex find2(MutexName(i));
 		test(find2.Next(name) == KErrNone);
 		test.Printf(_L("  %02d: found handle %08x\n"), i, find2.Handle());
-		test(name == MutexName(i));
 		Mutexes[(i+KObjectCount-1)%KObjectCount].Close();	// -1%n = -1 or n-1, unspecified
 		RMutex mutex;
 		test(mutex.Open(find2) == KErrNone);
 		test(mutex.Name() == MutexName(i));
 		mutex.Close();
 		}
-	test(find2.Next(name) == KErrNotFound);
 
 	// Check even mutexes remaining
-	TFindMutex find;
 	for (i = 0 ; i < KObjectCount ; i += 2)
 		{
+		TFindMutex find(MutexName(i));
 		test(find.Next(name) == KErrNone);
-		test(name == MutexName(i));
 		}
-	test(find2.Next(name) == KErrNotFound);
+	
 	}
 
 void TestFindWithCreation()
@@ -334,20 +331,18 @@
 	test.Next(_L("Test finding mutexes interleaved with creation"));
 
 	TFullName name;
-	TFindMutex find;
 	
 	for (TInt i = 0 ; i < KObjectCount ; ++i)
 		{
 		test(Mutexes[i].CreateGlobal(MutexName(i)) == KErrNone);
+		TFindMutex find(MutexName(i));
 		test(find.Next(name) == KErrNone);
 		test.Printf(_L("  %02d: found handle %08x\n"), i, find.Handle());
-		test(name == MutexName(i));
 		RMutex mutex;
 		test(mutex.Open(find) == KErrNone);
 		test(mutex.Name() == MutexName(i));
 		mutex.Close();
 		}
-	test(find.Next(name) == KErrNotFound);
 	}
 
 void TestFindWithCreation2()
@@ -355,20 +350,20 @@
 	test.Next(_L("Test finding mutexes interleaved with creation and deletion"));
 
 	TFullName name;
-	TFindMutex find;
 
 	for (TInt i = 0 ; i < KObjectCount ; ++i)
 		{
 		RMutex mutex;
 		test(mutex.CreateGlobal(MutexName(0)) == KErrNone);
+		TFindMutex find(MutexName(0));
 		test(find.Next(name) == KErrNone);
+		test(name == MutexName(0));
 		test.Printf(_L("  %02d: found handle %08x\n"), i, find.Handle());
-		test(name == MutexName(0));
 		mutex.Close();
-		RMutex mutex2;
-		test(mutex2.Open(find) == KErrNotFound);
+
+		TFindMutex find2(MutexName(0));
+		test(find2.Next(name) == KErrNotFound);
 		}
-	test(find.Next(name) == KErrNotFound);
 	}
 
 void TestFindHandleOutOfRange()
@@ -376,12 +371,12 @@
 	test.Next(_L("Test finding mutexes when find handle index is off the end of container's array"));
 
 	TFullName name;
-	TFindMutex find;
+
 	for (TInt i = 0 ; i < KObjectCount ; ++i)
 		{
+		TFindMutex find(MutexName(i));
 		test(find.Next(name) == KErrNone);
 		test.Printf(_L("  %02d: found handle %08x\n"), i, find.Handle());
-		test(name == MutexName(i));
 		RMutex mutex;
 		test(mutex.Open(find) == KErrNone);
 		test(mutex.Name() == MutexName(i));
@@ -394,7 +389,6 @@
 				Mutexes[j].Close();
 			}
 		}
-	test(find.Next(name) == KErrNotFound);
 	}
 
 void TestFindHandles()
--- a/kerneltest/e32test/thread/smpsafe.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/e32test/thread/smpsafe.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -86,6 +86,7 @@
 	t.SetPriority(EPriorityLess);
 	t.Resume();
 
+	TInt a = 1;
 	for (TInt i = KLoopTries; i>0; --i)
 		{
 		Affinity = 1; // assume we are locked to a single cpu
@@ -95,7 +96,8 @@
 			{
 			// spin, waiting to see if the other thread actually *does* run
 			}
-		if (Affinity == 0)
+		a = Affinity;
+		if (a == 0)
 			break;
 		Stop.Wait(); // We didn't see it this time, but try again in case of scheduling fluke
 		}
@@ -104,7 +106,7 @@
 	User::WaitForRequest(s);
 	t.Close();
 
-	return Affinity;
+	return a;
 	}
 
 #ifndef OMIT_MAIN
--- a/kerneltest/f32test/bench/t_notify_perf_impl.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/f32test/bench/t_notify_perf_impl.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1331,9 +1331,29 @@
 TBool CNotifyWatcher::CompareEntry(const TEntry& aEntry1, const TEntry& aEntry2)
 	{
 	// we don't compare name, because names are compared by CompareEntryName() already
-	if ((aEntry1.iAtt == aEntry2.iAtt) && (aEntry1.iModified == aEntry2.iModified) 
-			&& (aEntry1.iSize == aEntry2.iSize) && (aEntry1.iType == aEntry2.iType))
-		return ETrue;
+	// we don't check attributes when creating files, because dir scan sometimes returns file
+	// entries before attributes being flushed, and we don't care about it in this test case.
+	// we also don't check the modified time for all the test cases expect replacing test, 
+	// because dir scan sometimes returns file entries before time being flushed, 
+	// and we don't care about it as well.
+	// For replacing test, we check modification time, because it's the way we distinguish the old and new files.
+	if (iCurrentOp == EOpCreate)
+	    {
+	    if ((aEntry1.iSize == aEntry2.iSize) && (aEntry1.iType == aEntry2.iType))
+            return ETrue;
+	    }
+	else if (iCurrentOp == EOpReplace || iCurrentOp == EOpManyFiles || iCurrentOp == EOpManyChanges || iCurrentOp == EOpMixed)
+	    {
+        if ((aEntry1.iAtt == aEntry2.iAtt) && (aEntry1.iModified == aEntry2.iModified) 
+                && (aEntry1.iSize == aEntry2.iSize) && (aEntry1.iType == aEntry2.iType))
+            return ETrue;
+	    }
+	else
+	    {
+        if ((aEntry1.iAtt == aEntry2.iAtt) && (aEntry1.iSize == aEntry2.iSize) 
+                && (aEntry1.iType == aEntry2.iType))
+            return ETrue;
+	    }
 	
 	return EFalse;
 	}
--- a/kerneltest/f32test/demandpaging/t_clamp.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/f32test/demandpaging/t_clamp.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -47,6 +47,7 @@
 
 #include <f32file.h>
 #include <f32dbg.h>
+#include <e32ldr_private.h>
 RFs TheFs;
 
 _LIT(KFATName,"FAT");
--- a/kerneltest/f32test/demandpaging/t_denyclamp.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/f32test/demandpaging/t_denyclamp.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -40,6 +40,7 @@
 
 #include <f32file.h>
 #include <f32dbg.h>
+#include <e32ldr_private.h>
 RFs TheFs;
 
 _LIT(KFATName,"FAT");
--- a/kerneltest/f32test/filesystem/automounter/t_automounter.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/f32test/filesystem/automounter/t_automounter.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -29,7 +29,6 @@
 #include <f32dbg.h>
 
 #include "filesystem_fat.h"
-#include "filesystem_exfat.h" 
 #include "filesystem_automounter.h" 
 
 
@@ -70,11 +69,26 @@
 _LIT(KFsy1, "elocal.fsy");
 #endif    
     
-//-- exFAT is used as a child filesystem #1
-//_LIT(KFSName2, "exfat");  ///< filesystem #2 name
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//-- exFAT is used as a child filesystem #1. The problem here: some poor guys might not have the exFAT at all including the header file
+//-- "filesystem_exfat.h" that defines exFAT volume formatting structure. Fortunately for them the exFAT formatting parameters like "sectors per cluster" and
+//-- "number of FATs" have the same layout in the data container as FAT ones. So FAT formatting structure can be used for formatting exFAT.
+//-- The macro defines if exFAT might not be available.
+#define EXFAT_MIGHT_NOT_BE_PRESENT
 
 /** filesystem #2 name */
-#define KFSName2 KFileSystemName_exFAT
+#ifdef EXFAT_MIGHT_NOT_BE_PRESENT
+    _LIT(KFSName2, "exFAT");
+#else
+    #define KFSName2 KFileSystemName_exFAT
+    #include "filesystem_exfat.h" 
+    using namespace FileSystem_EXFAT;
+#endif
+
+
+
+
 _LIT(KFsy2, "exfat.fsy"); ///< filesystem #2 *.fsy module name
 
 TBool automounter_Loaded  = EFalse; ///< ETrue if automounter.fsy is loaded; used for correct cleanup
@@ -1508,7 +1522,7 @@
 
 void TestFormatting_FsName_Parameters_exFAT()
 {
-    using namespace FileSystem_EXFAT;
+
 
     test.Next(_L("Testing TVolFormatParam_exFAT formatting API\n"));
 
@@ -1531,8 +1545,15 @@
     //================================================================================
     //-- 1.0  simple unit test for TVolFormatParam_FAT
 
-    TVolFormatParam_exFATBuf    fmtParamBuf_exFAT;
-    TVolFormatParam_exFAT&      fmtParam = fmtParamBuf_exFAT();
+#ifndef EXFAT_MIGHT_NOT_BE_PRESENT    
+    TVolFormatParam_exFATBuf    fmtParamBuf;
+    TVolFormatParam_exFAT&      fmtParam = fmtParamBuf();
+#else
+    //-- see the comments to "EXFAT_MIGHT_NOT_BE_PRESENT" macro definition
+    TVolFormatParam_FATBuf  fmtParamBuf;
+    TVolFormatParam_FAT&    fmtParam= fmtParamBuf();
+#endif
+
 
     fmtParam.SetSectPerCluster(64);
     test(fmtParam.SectPerCluster()==64);
@@ -1555,7 +1576,12 @@
     test.Printf(_L("fmt: using TVolFormatParam_exFAT, no parameters.\n"));
     fmtParam.Init();
     
-    nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt, fmtParamBuf_exFAT);
+#ifdef EXFAT_MIGHT_NOT_BE_PRESENT
+    //-- need to forcedly set exFAT FS name, because fmtParam.Init(); set it to "FAT"
+    ((TVolFormatParam&)fmtParam).SetFileSystemName(KFSName2);
+#endif        
+
+    nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt, fmtParamBuf);
     test(nRes==KErrNone);
     
     nRes = DoFormatSteps(format, fmtCnt);
@@ -1571,7 +1597,7 @@
     fmtParam.SetSectPerCluster(1);
     fmtParam.SetNumFATs(2);
 
-    nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt, fmtParamBuf_exFAT);
+    nRes = format.Open(TheFs, drivePath, fmtMode, fmtCnt, fmtParamBuf);
     test(nRes==KErrNone);
     
     nRes = DoFormatSteps(format, fmtCnt);
--- a/kerneltest/f32test/plugins/version_2/inc/modifier_plugin.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/f32test/plugins/version_2/inc/modifier_plugin.h	Mon Jan 18 21:31:10 2010 +0200
@@ -71,7 +71,8 @@
 	void FsRenameL(TFsPluginRequest& aRequest);
 	void FsEntryL(TFsPluginRequest& aRequest);
 	void FsSetEntryL(TFsPluginRequest& aRequest);
-	
+	void FsVolumeL(TFsPluginRequest& aRequest);
+
 	void FsPluginDoRequestL(TFsPluginRequest& aRequest);
 	TInt FsPluginDoControlL(TFsPluginRequest& aRequest);
 
--- a/kerneltest/f32test/plugins/version_2/inc/plugincommon.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/f32test/plugins/version_2/inc/plugincommon.h	Mon Jan 18 21:31:10 2010 +0200
@@ -16,11 +16,11 @@
 #include <f32plugin.h>
 #include <e32test.h>
 
-const TInt KPluginSetDrive = -112233;
-const TInt KPluginGetError = -112234;
-const TInt KPluginSetRemovable = -112235;
-const TInt KPluginToggleIntercepts = -112236;
-const TInt KPluginSetDirFullName = -112237;
+const TInt KPluginSetDrive			= -112233;
+const TInt KPluginGetError			= -112234;
+const TInt KPluginSetRemovable		= -112235;
+const TInt KPluginToggleIntercepts	= -112236;
+const TInt KPluginSetDirFullName	= -112237;
 
 //This is some stupid thing for making strings wide.
 //We're using this for printing out the filename.
--- a/kerneltest/f32test/plugins/version_2/src/modifier_plugin.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/f32test/plugins/version_2/src/modifier_plugin.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -94,6 +94,7 @@
 	User::LeaveIfError(RegisterIntercept(EFsFileSeek,			EPreIntercept));
 	User::LeaveIfError(RegisterIntercept(EFsPluginDoControl,	EPreIntercept));
 	User::LeaveIfError(RegisterIntercept(EFsPluginDoRequest,	EPreIntercept));
+	User::LeaveIfError(RegisterIntercept(EFsVolume,				EPreIntercept));
 
 
     _LOG(_L("Modifier Plugin: Enabled intercepts."));
@@ -131,6 +132,7 @@
 	User::LeaveIfError(UnregisterIntercept(EFsEntry,			EPreIntercept));
 	User::LeaveIfError(UnregisterIntercept(EFsSetEntry,			EPreIntercept));
 	User::LeaveIfError(UnregisterIntercept(EFsFileSeek,			EPreIntercept));
+	User::LeaveIfError(UnregisterIntercept(EFsVolume,			EPreIntercept));
 
     _LOG(_L("Modifier Plugin: Disabled intercepts."));
 
@@ -152,13 +154,13 @@
 	
 	if(aRequest.IsPostOperation())
 		{
-		_LOG2(_L("Modifier Plugin::DoRequestL for Function %d in Post-Interception"),function);
+		_LOG2(_L("CModifierPlugin::DoRequestL for Function %d in Post-Interception"),function);
 		}
 	else
 		{
-		_LOG2(_L("Modifier Plugin::DoRequestL for Function %d in Pre-Interception"),function);
+		_LOG2(_L("CModifierPlugin::DoRequestL for Function %d in Pre-Interception"),function);
 		}
-	 
+	
 	switch(function)
 		{
 		case EFsFileRead:
@@ -249,6 +251,10 @@
 			TRAP(err, FsSetEntryL(aRequest));
 			break;
 
+		case EFsVolume:
+			TRAP(err, FsVolumeL(aRequest));
+			break;
+
 		default:
 			break;
 		}
@@ -423,7 +429,7 @@
 				User::Leave(err); //trapped in DoRequestL
 
 			fileplugin.Close();
-			
+
 			User::Leave(KErrCompletion);
 			}
 		}
@@ -525,7 +531,7 @@
 		_LOG(_L("CModifierPlugin::FsFileSizeL, pre intercept"));
 		if(extension.CompareF(_L(".size")) == 0)
 			{
-			_LOG(_L("ModifierPlugin::FsFileSizeL"));
+			_LOG(_L("CModifierPlugin::FsFileSizeL"));
 
 			RFilePlugin fileplugin(aRequest);
 			TInt err = fileplugin.AdoptFromClient();
@@ -703,7 +709,7 @@
 				User::Leave(err); //trapped in DoRequestL
 
 			err = fsplugin.ReadFileSection(filename, pos, tempBufPtr, length);
-			_LOG2(_L("CModifierPlugin::FsReadFileSectionL, FileRead returned %d"), err);
+			_LOG2(_L("CModifierPlugin::FileRead, FileRead returned %d"), err);
 			iLastError = err;
 			iLineNumber = __LINE__;
 			if(err!=KErrNone)
@@ -711,7 +717,7 @@
 
 
 			err = aRequest.Write(TFsPluginRequest::EData, tempBufPtr);
-			_LOG2(_L("CModifierPlugin::FsReadFileSectionL, ClientWrite returned %d"), err);
+			_LOG2(_L("CModifierPlugin::FileRead, ClientWrite returned %d"), err);
 			iLastError = err;
 			iLineNumber = __LINE__;
 			if(err!=KErrNone)
@@ -841,7 +847,7 @@
 			//open a second file
 
 			err = fileplugin2.Open(testfilename1, EFileWrite);
-			_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+			_LOG3(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 			iLastError = err;
 			iLineNumber = __LINE__;
 			if(err!=KErrNone)
@@ -895,7 +901,7 @@
 			iLineNumber = __LINE__;
 			if(err!=KErrNone)
 				User::Leave(err); //trapped in DoRequestL
-			_LOG2(_L("RFilePlugin::Create returned %d"), err);
+			_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Create returned %d"), err);
 
 			//write to the newly created file
 			err = fileplugin.Write(pos, tempBufPtr2);
@@ -1071,7 +1077,7 @@
 
 		TInt err = fileplugin.Create(filename, mode);
 
-		_LOG2(_L("RFilePlugin::Create returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsFileCreateL, RFilePlugin::Create returned %d"), err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1178,7 +1184,7 @@
 
 		RFilePlugin fileplugin(aRequest);
 		err = fileplugin.Open(filename, mode);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &filename, err);
+		_LOG3(_L("CModifierPlugin::FsFileOpenL, RFilePlugin::Open for %S returned %d"), &filename, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1259,14 +1265,14 @@
 		TFileName fn;
 		RFilePlugin fileplugin(aRequest);
 		err = fileplugin.Temp(testfilename1, fn, mode);
-		_LOG2(_L("RFilePlugin::Temp returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsFileTempL, RFilePlugin::Temp returned %d"), err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
 			User::Leave(err); //trapped in DoRequestL
 
 		err = aRequest.Write(TFsPluginRequest::ENewName, fn);
-		_LOG2(_L("CModifierPlugin::FsFileReadL, ClientWrite returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsFileTempL, ClientWrite returned %d"), err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1352,7 +1358,7 @@
 		RFilePlugin fileplugin(aRequest);
 
 		TInt err = fileplugin.Replace(filename, mode);
-		_LOG2(_L("RFilePlugin::Replace returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsFileReplaceL, RFilePlugin::Replace returned %d"), err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1452,16 +1458,16 @@
 			if(err!=KErrNone)
 				User::Leave(err); //trapped in DoRequestL
 			fsplugin.Close();
-			
+
 			TBuf<26> temp_wide;
 			temp_wide.Copy(temp);
-			
+
 			iLogging = ETrue;
 			_LOG2(_L("CModifierPlugin::FsReadFileSectionL - wanted to read length = %d\n"),length);
 			_LOG2(_L("CModifierPlugin::FsReadFileSectionL - data read length = %d\n"),temp.Length());
 			_LOG2(_L("CModifierPlugin::FsReadFileSectionL - data read = %S\n"),&temp_wide);
 			iLogging = EFalse;
-			
+
 
 			err = aRequest.Write(TFsPluginRequest::EData, temp);
 			_LOG3(_L("CModifierPlugin::FsReadFileSectionL - RFilePlugin::Write for %S returned %d"), &testfilename1, err);
@@ -1498,7 +1504,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CModifierPlugin::FsDeleteL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1513,7 +1519,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsDeleteL, RFilePlugin::Close to the second file returned %d"), err);
 		}
 	else
 		{
@@ -1523,7 +1529,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CModifierPlugin::FsDeleteL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1538,7 +1544,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsDeleteL, RFilePlugin::Close to the second file returned %d"), err);
 
 		RFsPlugin fsplugin(aRequest);
 		err = fsplugin.Connect();
@@ -1605,7 +1611,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CModifierPlugin::FsReplaceL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1620,7 +1626,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsReplaceL, RFilePlugin::Close to the second file returned %d"), err);
 		}
 	else
 		{
@@ -1628,7 +1634,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CModifierPlugin::FsReplaceL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1643,7 +1649,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsReplaceL, FilePlugin::Close to the second file returned %d"), err);
 
 		_LOG(_L("CModifierPlugin::FsReplaceL, calling RFsPlugin::Replace"));
 		RFsPlugin fsplugin(aRequest);
@@ -1704,7 +1710,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsRenameL, RFilePlugin::Close to the second file returned %d"), err);
 		}
 	else
 		{
@@ -1712,7 +1718,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CModifierPlugin::FsRenameL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1727,7 +1733,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsRenameL, RFilePlugin::Close to the second file returned %d"), err);
 
 		_LOG(_L("CModifierPlugin::FsRenameL, calling RFsPlugin::Rename"));
 		RFsPlugin fsplugin(aRequest);
@@ -1771,7 +1777,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CModifierPlugin::FsEntryL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1786,7 +1792,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsEntryL, RFilePlugin::Close to the second file returned %d"), err);
 		}
 	else
 		{
@@ -1794,7 +1800,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CModifierPlugin::FsEntryL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1809,7 +1815,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsEntryL, RFilePlugin::Close to the second file returned %d"), err);
 
 		_LOG(_L("CModifierPlugin::FsEntryL, calling RFsPlugin::Entry"));
 		RFsPlugin fsplugin(aRequest);
@@ -1842,7 +1848,6 @@
 	}
 
 
-
 void CModifierPlugin::FsSetEntryL(TFsPluginRequest& aRequest)
 	{
 	TInt err = KErrNone;
@@ -1856,11 +1861,11 @@
 
 	if (aRequest.IsPostOperation())
 		{
-		_LOG(_L("CModifierPlugin::FsRenameL, post intercept"));
+		_LOG(_L("CModifierPlugin::FsSetEntryL, post intercept"));
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CModifierPlugin::FsSetEntryL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1875,7 +1880,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CModifierPlugin::FsSetEntryL, RFilePlugin::Close to the second file returned %d"), err);
 		}
 	else
 		{
@@ -1883,7 +1888,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CModifierPlugin::FsSetEntryL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1898,9 +1903,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
-
-		_LOG(_L("CModifierPlugin::FsSetEntryL, calling RFsPlugin::SetEntry"));
+		_LOG2(_L("CModifierPlugin::FsSetEntryL, FilePlugin::Close to the second file returned %d"), err);
 
 		TTime time;
 		TPtr8 t((TUint8*)&time,sizeof(TTime));
@@ -1945,6 +1948,67 @@
 		}
 	}
 
+/**
+@see TestVolume()
+*/
+void CModifierPlugin::FsVolumeL(TFsPluginRequest& aRequest)
+	{
+	if (aRequest.IsPostOperation())
+		{
+		_LOG(_L("CModifierPlugin::FsVolumeL, post intercept"));
+		}
+	else
+		{
+		_LOG(_L("CModifierPlugin::FsVolumeL, pre intercept"));
+		RFsPlugin fsplugin(aRequest);
+		CleanupClosePushL(fsplugin);
+
+		TInt err = fsplugin.Connect();
+		iLastError = err;
+		iLineNumber = __LINE__;
+		if(err!=KErrNone)
+			User::Leave(err); // Trapped in DoRequestL
+
+		TVolumeInfo volInfo;
+		TInt drive = (TInt)(iDriveToTest - (TChar)'A');
+		err = fsplugin.Volume(volInfo,drive);
+		_LOG3(_L("CModifierPlugin::FsVolumeL, RFsPlugin::Volume(drive %d) returned %d"), drive, err);
+		iLastError = err;
+		iLineNumber = __LINE__;
+		if(err!=KErrNone)
+			User::Leave(err); // Trapped in DoRequestL
+
+		// Check that the volume label is the same as what was set in t_plugin_v2
+		_LIT(KVolumeLabel,"1Volume");
+		err = volInfo.iName.Compare(KVolumeLabel);
+		_LOG2(_L("CModifierPlugin::FsVolumeL, Compare volume label returned %d"), err);
+		iLastError = err;
+		iLineNumber = __LINE__;
+		if(err!=KErrNone)
+			User::Leave(err); // Trapped in DoRequestL
+
+		// Modify volume name
+		_LOG2(_L("CModifierPlugin::FsVolumeL, Old volume name = %S"), &volInfo.iName);
+		TBuf<7> newVolumeName = volInfo.iName;
+		newVolumeName[0] = '2';
+		volInfo.iName = newVolumeName;
+		_LOG2(_L("CModifierPlugin::FsVolumeL, New volume name = %S"), &volInfo.iName);
+
+		// Send back volume info
+		TPckgC<TVolumeInfo> volInfoPckg(volInfo);
+		err = aRequest.Write(TFsPluginRequest::EVolumeInfo, volInfoPckg);
+		iLastError = err;
+		iLineNumber = __LINE__;
+		if(err!=KErrNone)
+			User::Leave(err); // Trapped in DoRequestL
+
+		CleanupStack::PopAndDestroy();
+
+		// Request processed by plug-in
+		User::Leave(KErrCompletion);
+		}
+	}
+
 
 /**
 @internalComponent
@@ -1975,7 +2039,7 @@
 	iLineNumber = __LINE__;
 	if(err!=KErrNone)
 		User::Leave(err); //trapped in DoRequestL
-	
+
 	//setting up test files
 	testfilename1.Append(iDriveToTest);
 	testfilename1.Append(_L(":\\Data2\\"));
@@ -2186,7 +2250,7 @@
 			}
 		case KPluginSetDirFullName:
 			{
-			//This is necessary as at present we have nwo way of getting the name of
+			//This is necessary as at present we have no way of getting the name of
 			//a directory!
 			TRAP(err,aRequest.ReadParam1L(dirnamePckg));
 			break;
--- a/kerneltest/f32test/plugins/version_2/src/premodifier_plugin.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/f32test/plugins/version_2/src/premodifier_plugin.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -962,7 +962,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CPreModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CPreModifierPlugin::FsDeleteL, RFilePlugin::Close to the second file returned %d"), err);
 		}
 	else
 		{
@@ -1012,7 +1012,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CPreModifierPlugin::FsReplaceL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1027,7 +1027,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CPreModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CPreModifierPlugin::FsReplaceL, RFilePlugin::Close to the second file returned %d"), err);
 		}
 	else
 		{
@@ -1057,7 +1057,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CPreModifierPlugin::FsRenameL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1072,7 +1072,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CPreModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CPreModifierPlugin::FsRenameL, RFilePlugin::Close to the second file returned %d"), err);
 		}
 	else
 		{
@@ -1099,7 +1099,7 @@
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CPreModifierPlugin::FsEntryL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1114,7 +1114,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CPreModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CPreModifierPlugin::FsEntryL, RFilePlugin::Close to the second file returned %d"), err);
 		}
 	else
 		{
@@ -1136,11 +1136,11 @@
 		    	
 	if (aRequest.IsPostOperation())
 		{
-		_LOG(_L("CPreModifierPlugin::FsRenameL, post intercept"));
+		_LOG(_L("CPreModifierPlugin::FsSetEntryL, post intercept"));
 		RFilePlugin fileplugin2(aRequest);
 		//open a second file
 		err = fileplugin2.Open(testfilename1, EFileWrite);
-		_LOG3(_L("RFilePlugin::Open for %S returned %d"), &testfilename1, err);
+		_LOG3(_L("CPreModifierPlugin::FsSetEntryL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
 		iLastError = err;
 		iLineNumber = __LINE__;
 		if(err!=KErrNone)
@@ -1155,7 +1155,7 @@
 
 		//close the second file
 		fileplugin2.Close();
-		_LOG2(_L("CPreModifierPlugin::FsFileWriteL, RFilePlugin::Close to the second file returned %d"), err);
+		_LOG2(_L("CPreModifierPlugin::FsSetEntryL, RFilePlugin::Close to the second file returned %d"), err);
 		}
 	else
 		{
@@ -1206,7 +1206,7 @@
 	
 	if (aRequest.IsPostOperation())
 		{
-		_LOG(_L("CPreModifierPlugin::FsDirReadL, post intercept"));
+		_LOG(_L("CPreModifierPlugin::FsDirReadOneL, post intercept"));
 		}
 	else
 		{
--- a/kerneltest/f32test/plugins/version_2/src/t_plugin_v2.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/kerneltest/f32test/plugins/version_2/src/t_plugin_v2.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -264,7 +264,7 @@
 
 	r = TheFs.MountPlugin(KModifierPluginName,20);
 	if(r==KErrInUse) r = KErrNone;
-	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.exe"));
+	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 
 
 	//Use RPlugin to communicate to the plugins which drive they should be
@@ -311,11 +311,11 @@
 
 	r = rplugin.Open(TheFs,KModifierPos);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
-	TRequestStatus aStatus; 
+	TRequestStatus aStatus;
 	rplugin.DoRequest(1,aStatus,drivePckg);
 	User::WaitForRequest(aStatus);
 	rplugin.Close();
-		
+	
 	}
 //-------------------------------------------------------------------------------------------------
 //! @SYMTestCaseID				KBASE-t_plugin_v2-1336
@@ -349,14 +349,14 @@
 	{
 
 	//As the plugin is installed at this point, rather than removing it
-	//or not mounting it until after, lets disable intercepts
-	//and enabled them at the end of this function.
+	//or not mounting it until after, let's disable intercepts
+	//and enable them at the end of this function.
 	MyRPlugin rplugin;
 	TInt r = rplugin.Open(TheFs,KModifierPos);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	TBool interceptsStatus;
 	TPckg<TBool> interceptsStatusDes(interceptsStatus);
-	test.Next(_L("RPlugin: togle itnercepts (Modifier)"));
+	test.Next(_L("RPlugin: toggle intercepts (Modifier)"));
 	r = rplugin.DoControl(KPluginToggleIntercepts,interceptsStatusDes);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	test.Next(_L("Ensure that intercepts are now disabled"));
@@ -368,7 +368,7 @@
 
 	r = rplugin.Open(TheFs,KObserverPos);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
-	test.Next(_L("RPlugin: togle itnercepts (Observer)"));
+	test.Next(_L("RPlugin: toggle intercepts (Observer)"));
 	r = rplugin.DoControl(KPluginToggleIntercepts,interceptsStatusDes);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	test.Next(_L("Ensure that intercepts are now disabled"));
@@ -412,7 +412,7 @@
 
 	r = rplugin.Open(TheFs,KModifierPos);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
-	test.Next(_L("RPlugin: togle itnercepts (Observer)"));
+	test.Next(_L("RPlugin: toggle intercepts (Observer)"));
 	r = rplugin.DoControl(KPluginToggleIntercepts,interceptsStatusDes);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	test.Next(_L("Ensure that intercepts are now enabled"));
@@ -424,7 +424,7 @@
 
 	r = rplugin.Open(TheFs,KObserverPos);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
-	test.Next(_L("RPlugin: togle itnercepts (Observer)"));
+	test.Next(_L("RPlugin: toggle intercepts (Observer)"));
 	r = rplugin.DoControl(KPluginToggleIntercepts,interceptsStatusDes);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	test.Next(_L("Ensure that intercepts are now enabled"));
@@ -557,7 +557,7 @@
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	TBool interceptsStatus;
 	TPckg<TBool> interceptsStatusDes(interceptsStatus);
-	test.Next(_L("RPlugin: togle itnercepts (Modifier)"));
+	test.Next(_L("RPlugin: toggle intercepts (Modifier)"));
 	r = rplugin.DoControl(KPluginToggleIntercepts,interceptsStatusDes);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	test.Next(_L("Ensure that intercepts are now disabled"));
@@ -570,7 +570,7 @@
 
 	r = rplugin.Open(TheFs,KObserverPos);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
-	test.Next(_L("RPlugin: togle itnercepts (Observer)"));
+	test.Next(_L("RPlugin: toggle intercepts (Observer)"));
 	r = rplugin.DoControl(KPluginToggleIntercepts,interceptsStatusDes);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	test.Next(_L("Ensure that intercepts are now disabled"));
@@ -627,7 +627,7 @@
 
 	r = rplugin.Open(TheFs,KModifierPos);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
-	test.Next(_L("RPlugin: togle itnercepts (Observer)"));
+	test.Next(_L("RPlugin: toggle intercepts (Modifier)"));
 	r = rplugin.DoControl(KPluginToggleIntercepts,interceptsStatusDes);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	test.Next(_L("Ensure that intercepts are now enabled"));
@@ -639,7 +639,7 @@
 
 	r = rplugin.Open(TheFs,KObserverPos);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
-	test.Next(_L("RPlugin: togle itnercepts (Observer)"));
+	test.Next(_L("RPlugin: toggle intercepts (Observer)"));
 	r = rplugin.DoControl(KPluginToggleIntercepts,interceptsStatusDes);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	test.Next(_L("Ensure that intercepts are now enabled"));
@@ -1977,7 +1977,7 @@
 		//if this fails, did you forget to do a \f32test\group\wintest ?
 		plugin_test(test,KDriveZPos,__LINE__,(TText*)Expand("drivez_plugin.cpp"));
 		safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp")); //if this fails, did you forget to do a \f32test\group\wintest ?
-		file.Close(); 
+		file.Close();
 
 		r = file.Replace(TheFs,_L("c:\\drivecplugin.txt"),EFileWrite);
 		plugin_test(test,KDriveCPos,__LINE__,(TText*)Expand("drivec_plugin.cpp"));
@@ -2007,7 +2007,7 @@
 	}
 
 //-------------------------------------------------------------------------------------------------
-//! @SYMTestCaseID				KBASE-t_plugin_v2-1357
+//! @SYMTestCaseID				KBASE-t_plugin_v2-1358
 //! @SYMTestType				CT
 //! @SYMTestCaseDesc			Testing unremovable plugins
 //! @SYMPREQ					REQ8794
@@ -2483,8 +2483,6 @@
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 
 
-
-
 	//Setting up test data
     TBuf8<20> wbuffer;
 	wbuffer.FillZ(20);
@@ -2543,6 +2541,62 @@
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 	}
 
+//-------------------------------------------------------------------------------------------------
+//! @SYMTestCaseID				KBASE-t_plugin_v2-1359
+//! @SYMTestType				CT
+//! @SYMTestCaseDesc			Test calling RFsPlugin::Volume()
+//!
+//! @SYMDEF						DEF142711: RFsPlugin needs to expose a Volume() API
+//! @SYMTestPriority			High
+//! @SYMTestActions				TestVolume() sets the volume label and gets the volume
+//!								information via the modifier plugin, which will verify
+//!								that the volume has the correct label and then change it.
+//!
+//!								1.	Set volume label to "MyVolume".
+//!								2.	Get volume information via modifier plugin.
+//!								3.	Verify correct volume label after changes by modifier plugin.
+//!								4.	Reset volume label.
+//!
+//! @SYMTestExpectedResults		1.	Volume label set without any panic.
+//!								2.	Volume information request completes without any panic.
+//!								3.	Correct volume label after modification.
+//!								4.	Volume label reset without any panic.
+//!
+//! @SYMTestPriority			High
+//! @SYMTestStatus				Implemented
+//-------------------------------------------------------------------------------------------------
+void TestVolume()
+	{
+	test.Next(_L("TestVolume()"));
+	
+	TInt theDrive;
+	TInt r = TheFs.CharToDrive(gDriveToTest,theDrive);
+	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
+	
+	// Set volume label to MyVolume so we can test it in the modifier plugin
+	_LIT(KVolumeLabel1,"1Volume");
+	r = TheFs.SetVolumeLabel(KVolumeLabel1,theDrive);
+	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
+	test.Printf(_L("TestVolume, RFs::SetVolumeLabel returned %d\n"), r);
+	
+	test.Printf(_L("TestVolume, Get volume information for drive %d via modifier plugin\n"), theDrive);
+	TVolumeInfo volInfo;
+	r = TheFs.Volume(volInfo,theDrive);
+	test.Printf(_L("TestVolume, RFs::Volume returned %d\n"), r);
+	plugin_test(test,KModifierPos,__LINE__,(TText*)Expand("modifier_plugin.cpp"));
+	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
+	
+	// Check volume name after modification by modifier plugin
+	_LIT(KVolumeLabel2,"2Volume");
+	r = volInfo.iName.Compare(KVolumeLabel2);
+	test.Printf(_L("TestVolume, Compare volume label returned %d\n"), r);
+	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
+	
+	test.Printf(_L("TestVolume, Reset volume label to nothing\n"));
+	r = TheFs.SetVolumeLabel(_L(""),theDrive);
+	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
+	}
+
 
 GLDEF_C void CallTestsL()
 	{
@@ -2554,19 +2608,19 @@
 	TVolumeInfo volInfo;
 	r = TheFs.Volume(volInfo, theDrive);
 	test (r == KErrNone);
-
+	
 	TDriveInfo drvInfo;
 	r = TheFs.Drive(drvInfo,theDrive);
 	test (r == KErrNone);
 
 	if(drvInfo.iType == EMediaRam || drvInfo.iType == EMediaRom || drvInfo.iMediaAtt == KMediaAttWriteProtected || drvInfo.iMediaAtt == KMediaAttLocked)
 		{
+		test.Printf(_L("T_PLUGIN_V2 SKIPPED:\n"));
 		test.Printf(_L("Local Buffers are not supported on RAM or ROM drives\n"));
 		if(drvInfo.iMediaAtt == KMediaAttLocked)
 			{
 			test.Printf(_L("This media is locked. Drive %d\n"),theDrive);
 			}
-		test.Printf(_L("Skipping Test\n"));
 		return;
 		}
 	
@@ -2724,7 +2778,10 @@
 	r = TheFs.Subst(path,drive);
 	safe_test(r,__LINE__,(TText*)Expand("t_plugin_v2.cpp"));
 
-
+#ifndef __WINS__
+	// RFs::SetVolumeLabel - Does not run on WINS
+	TestVolume();
+#endif
 	TestReadFileDirect();
 	TestReadFileViaPlugin();
 	TestWriteFileDirect();
--- a/userlibandfileserver/fileserver/automounter/automounter.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/automounter/automounter.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -32,14 +32,15 @@
 SOURCEPATH      .
 DOCUMENT        ../group/release.txt
 USERINCLUDE     ../inc 
+USERINCLUDE     ../fs_utils
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 
 LIBRARY         efile.lib efsrv.lib euser.lib 
 
-UID				0 0x100000d6
-VENDORID		0x70000001
+UID             0 0x100000d6
+VENDORID        0x70000001
 
 unpaged
 
--- a/userlibandfileserver/fileserver/bmarm/efileu.def	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/bmarm/efileu.def	Mon Jan 18 21:31:10 2010 +0200
@@ -239,4 +239,5 @@
 	InitL__8CMountCBR6TDriveP11CFileSystem @ 238 NONAME R3UNUSED ; CMountCB::InitL(TDrive &, CFileSystem *)
 	DriveInfo__C11CFileSystemR10TDriveInfoi @ 239 NONAME R3UNUSED ; CFileSystem::DriveInfo(TDriveInfo &, int) const
 	GetDriveInfo__FR10TDriveInfoi @ 240 NONAME R3UNUSED ; GetDriveInfo(TDriveInfo &, int)
+	Volume__C9RFsPluginR11TVolumeInfoi @ 241 NONAME R3UNUSED ; RFsPlugin::Volume(TVolumeInfo &, int) const
 
--- a/userlibandfileserver/fileserver/bwins/efileu.def	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/bwins/efileu.def	Mon Jan 18 21:31:10 2010 +0200
@@ -240,4 +240,4 @@
 	?InitL@CMountCB@@QAEXAAVTDrive@@PAVCFileSystem@@@Z @ 239 NONAME ; public: void __thiscall CMountCB::InitL(class TDrive &,class CFileSystem *)
 	?DriveInfo@CFileSystem@@UBEXAAVTDriveInfo@@H@Z @ 240 NONAME ; void CFileSystem::DriveInfo(class TDriveInfo &, int) const
 	?GetDriveInfo@@YAXAAVTDriveInfo@@H@Z @ 241 NONAME ; void GetDriveInfo(class TDriveInfo &, int)
-
+	?Volume@RFsPlugin@@QBEHAAVTVolumeInfo@@H@Z @ 242 NONAME ; int RFsPlugin::Volume(class TVolumeInfo &, int) const
--- a/userlibandfileserver/fileserver/bx86/efileu.def	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/bx86/efileu.def	Mon Jan 18 21:31:10 2010 +0200
@@ -240,4 +240,4 @@
 	?InitL@CMountCB@@QAEXAAVTDrive@@PAVCFileSystem@@@Z @ 239 NONAME ; public: void __thiscall CMountCB::InitL(class TDrive &,class CFileSystem *)
 	?DriveInfo@CFileSystem@@UBEXAAVTDriveInfo@@H@Z @ 240 NONAME ; public: virtual void __thiscall CFileSystem::DriveInfo(class TDriveInfo &,int)const 
 	?GetDriveInfo@@YAXAAVTDriveInfo@@H@Z @ 241 NONAME ; void __cdecl GetDriveInfo(class TDriveInfo &,int)
-
+	?Volume@RFsPlugin@@QBEHAAVTVolumeInfo@@H@Z @ 242 NONAME ; public: int __thiscall RFsPlugin::Volume(class TVolumeInfo &,int)const 
--- a/userlibandfileserver/fileserver/eabi/efileu.def	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/eabi/efileu.def	Mon Jan 18 21:31:10 2010 +0200
@@ -312,4 +312,4 @@
 	_ZN8CMountCB5InitLER6TDriveP11CFileSystem @ 311 NONAME
 	_Z12GetDriveInfoR10TDriveInfoi @ 312 NONAME
 	_ZNK11CFileSystem9DriveInfoER10TDriveInfoi @ 313 NONAME
-
+	_ZNK9RFsPlugin6VolumeER11TVolumeInfoi @ 314 NONAME
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/fs_utils/bit_vector.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,883 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+//  Collection of common constants, utility functions, etc. for the file server and file systems.
+//  Definitions here must be filesystem-agnostic, i.e. generic enougs to be used by every file system
+//
+//  This is the internal file and must not be exported.
+
+/**
+    @file
+    @internalTechnology
+*/
+
+#include "bit_vector.h"
+
+
+//#######################################################################################################################################
+//#   RBitVector class implementation
+//#######################################################################################################################################
+
+const TUint32 K_FFFF = 0xFFFFFFFF; //-- all one bits, beware rigth shifts of signed integers!
+
+RBitVector::RBitVector()
+          :iNumBits(0), ipData(NULL), iNumWords(0)
+    {
+    }
+
+
+RBitVector::~RBitVector()
+    {
+    Close();
+    }
+
+/**
+    Panics.
+    @param aPanicCode   a panic code
+*/
+void RBitVector::Panic(TPanicCode aPanicCode) const
+    {
+    _LIT(KPanicCat,"RBitVector");
+    User::Panic(KPanicCat, aPanicCode);
+    }
+
+/** explicitly closes the object and deallocates memory */
+void RBitVector::Close()
+    {
+    iNumBits = 0;
+    iNumWords =0;
+    User::Free(ipData);
+    ipData = NULL;
+    }
+
+//-----------------------------------------------------------------------------
+
+/**
+    Comparison perator.
+    @param  aRhs a vector to compate with.
+    @panic ESizeMismatch in the case of different vector sizes
+*/
+TBool RBitVector::operator==(const RBitVector& aRhs) const
+    {
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+    __ASSERT_ALWAYS(iNumBits == aRhs.iNumBits, Panic(ESizeMismatch));
+
+
+    if(!iNumBits)
+        return ETrue; //-- comparing 0-lenght arrays
+
+    if(this == &aRhs)
+        {//-- comparing with itself, potential source of errors
+        ASSERT(0);
+        return ETrue; 
+        }
+    
+    if(iNumWords >= 1)
+        {
+        const TUint32 cntBytes = (iNumBits >> 5) << 2; //-- bytes to compare
+        if(memcompare((const TUint8*)ipData, cntBytes, (const TUint8*)aRhs.ipData, cntBytes))
+            return EFalse;
+        }
+
+    const TUint32 bitsRest  = iNumBits & 0x1F;
+    if(bitsRest)
+        {
+        const TUint32 mask = K_FFFF >> (32-bitsRest);
+        return ( (ipData[iNumWords-1] & mask) == (aRhs.ipData[iNumWords-1] & mask) );
+        }
+    
+    return ETrue;
+    }
+
+TBool RBitVector::operator!=(const RBitVector& aRhs) const  
+    {
+    return ! ((*this) == aRhs);
+    } 
+
+//-----------------------------------------------------------------------------
+
+/** The same as Create(), but leaves on error */
+void RBitVector::CreateL(TUint32 aNumBits)
+    {
+    User::LeaveIfError(Create(aNumBits));
+    }
+
+
+/**
+    Create the vector with the size of aNumBits bits.
+    @return system-wide error codes:
+        KErrNoMemory    unable to allocate sufficient amount of memory for the array
+        KErrInUse       an attempt to call Create() for non-empty vector. Close it first.
+        KErrArgument    invalid aNumBits value == 0
+*/
+TInt RBitVector::Create(TUint32 aNumBits)
+    {
+
+    if(ipData)
+        return KErrInUse; //-- array is already in use. Close it first.
+
+    if(!aNumBits)
+        return KErrArgument;
+
+    //-- memory is allocated by word (32 bit) quiantities
+    const TUint32 numWords = (aNumBits >> 5) + ((aNumBits & 0x1F) > 0 ? 1:0);
+    ipData = (TUint32*)User::AllocZ(numWords << 2);
+
+    if(!ipData)
+        return KErrNoMemory;
+
+    iNumBits  = aNumBits;
+    iNumWords = numWords;
+
+    return KErrNone;
+    }
+
+
+/**
+    Fill a bit vector with a given bit value
+    @param aVal a bit value
+*/
+void RBitVector::Fill(TBool aVal)
+    {
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+    memset(ipData, (aVal ? 0xFF : 0x00), iNumWords << 2);
+    }
+
+/** Invert all bits in a bit vector */
+void RBitVector::Invert()
+{
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+    for(TUint32 i=0; i<iNumWords; ++i)
+        ipData[i] ^= K_FFFF;
+}
+
+
+/**
+    Perform "And" operation between 2 vectors. They shall be the same size.
+    @param  aRhs a vector from the right hand side
+    @panic ESizeMismatch in the case of different vector sizes
+*/
+void RBitVector::And(const RBitVector& aRhs)
+    {
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+    __ASSERT_ALWAYS(iNumBits == aRhs.iNumBits, Panic(ESizeMismatch));
+    for(TUint32 i=0; i<iNumWords; ++i)
+        {
+        ipData[i] &= aRhs.ipData[i];
+        }
+    }
+
+/**
+    Perform "Or" operation between 2 vectors. They shall be the same size.    
+    @param  aRhs a vector from the right hand side
+    @panic ESizeMismatch in the case of different vector sizes
+*/
+void RBitVector::Or(const RBitVector& aRhs)
+    {
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+    __ASSERT_ALWAYS(iNumBits == aRhs.iNumBits, Panic(ESizeMismatch));
+    for(TUint32 i=0; i<iNumWords; ++i)
+        {
+        ipData[i] |= aRhs.ipData[i];
+        }
+    }
+
+/**
+    Perform "Xor" operation between 2 vectors. They shall be the same size.    
+    @param  aRhs a vector from the right hand side
+    @panic ESizeMismatch in the case of different vector sizes
+*/
+void RBitVector::Xor(const RBitVector& aRhs)
+    {
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+    __ASSERT_ALWAYS(iNumBits == aRhs.iNumBits, Panic(ESizeMismatch));
+    for(TUint32 i=0; i<iNumWords; ++i)
+        {
+        ipData[i] ^= aRhs.ipData[i];
+        }
+    }
+
+//-----------------------------------------------------------------------------
+/**
+    Fill a range from bit number "aIndexFrom" to "aIndexTo" inclusively with the value of aVal
+    
+    @param  aIndexFrom  start bit number (inclusive)
+    @param  aIndexTo    end bit number (inclusive)
+    @param  aVal        the value to be used to fill the range (0s or 1s)
+*/
+void RBitVector::Fill(TUint32 aIndexFrom, TUint32 aIndexTo, TBool aVal)
+    {
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+
+    //-- swap indexes if they are not in order
+    if(aIndexFrom > aIndexTo)
+        {
+        const TUint32 tmp = aIndexFrom;
+        aIndexFrom = aIndexTo;
+        aIndexTo = tmp;
+        }
+
+    __ASSERT_ALWAYS((aIndexFrom < iNumBits) && (aIndexTo < iNumBits), Panic(EIndexOutOfRange));
+
+    const TUint32 wordStart = WordNum(aIndexFrom);
+    const TUint32 wordTo    = WordNum(aIndexTo);
+
+    if(aVal)
+        {//-- filling a range with '1'
+        
+        TUint32 shift = BitInWord(aIndexFrom);
+        const TUint32 mask1 = (K_FFFF >> shift) << shift;
+
+        TUint32 mask2 = K_FFFF;
+        shift = 1+BitInWord(aIndexTo);
+        if(shift < 32)
+            {
+            mask2 = ~((mask2 >> shift) << shift);
+            }
+
+        if(wordTo == wordStart)
+            {//-- a special case, filling is in the same word
+            ipData[wordStart] |= (mask1 & mask2);
+            }
+        else
+            {
+            ipData[wordStart] |= mask1; 
+            ipData[wordTo]    |= mask2;
+            
+            const TUint32 wholeWordsBetween = wordTo - wordStart - 1; //-- whole words that can be bulk filled
+
+            if(wholeWordsBetween)
+                memset(ipData+wordStart+1, 0xFF, wholeWordsBetween << 2);
+                            
+            }
+        }
+    else
+        {//-- filling a range with '0'
+        
+        TUint32 shift = BitInWord(aIndexFrom);
+        const TUint32 mask1 = ~((K_FFFF >> shift) << shift);
+
+        TUint32 mask2 = 0;
+        shift = 1+BitInWord(aIndexTo);
+        if(shift < 32)
+            {
+            mask2 = ((K_FFFF >> shift) << shift);
+            }
+
+        if(wordTo == wordStart)
+            {//-- a special case, filling is in the same word
+            ipData[wordStart] &= (mask1 | mask2);
+            }
+        else
+            {
+            ipData[wordStart] &= mask1; 
+            ipData[wordTo]    &= mask2;
+            
+            const TUint32 wholeWordsBetween = wordTo - wordStart - 1; //-- whole words that can be bulk filled
+
+            if(wholeWordsBetween)
+                memset(ipData+wordStart+1, 0x00, wholeWordsBetween << 2);
+                            
+            }
+        }
+
+    }
+
+//-----------------------------------------------------------------------------
+
+/**
+    Search for a specified bit value ('0' or '1') in the vector from the given position.
+    @param  aStartPos   zero-based index; from this position the search will start. This position isn't included to the search.
+                        On return may contain a new position if the specified bit is found in specified direction.
+    @param  aBitVal     zero or non-zero bit to search.
+    @param  aDir        Specifies the search direction
+
+    @return ETrue if the specified bit value is found; aStartPos gets updated.
+            EFalse otherwise.
+
+*/
+TBool RBitVector::Find(TUint32& aStartPos, TBool aBitVal, TFindDirection aDir) const
+    {
+    __ASSERT_ALWAYS(aStartPos < iNumBits, Panic(EIndexOutOfRange));
+    ASSERT(iNumWords && ipData);
+
+    switch(aDir)
+        {
+        case ERight:    //-- Search from the given position to the right
+            return FindToRight(aStartPos, aBitVal);
+
+        case ELeft:     //-- Search from the given position to the left (towards lower index)
+            return FindToLeft(aStartPos, aBitVal);
+
+        case ENearestL: //-- Search for the nearest value in both directions starting from left
+            return FindNearest(aStartPos, aBitVal, ETrue);
+
+        case ENearestR: //-- Search for the nearest value in both directions starting from right
+            return FindNearest(aStartPos, aBitVal, EFalse);
+
+        default:
+            Panic(EWrondFindDirection);
+            return EFalse;
+
+        };
+    
+    }
+
+//-----------------------------------------------------------------------------
+/**
+    Internal method to look for a given bit value in the right direction.
+    see TBool RBitVector::Find(...)
+*/
+TBool RBitVector::FindToRight(TUint32& aStartPos, TBool aBitVal) const
+    {
+    if(aStartPos >= iNumBits-1)
+        return EFalse; //-- no way to the right
+
+    const TUint32 startPos = aStartPos+1;
+    const TUint32 fInvert = aBitVal ? 0 : K_FFFF; //-- invert everything if we are looking for '0' bit
+
+    TUint32 wordNum = WordNum(startPos);
+    TUint32 val = ipData[wordNum] ^ fInvert;
+
+    if(wordNum == iNumWords-1)
+        {//-- process the last word in the array, some higher bits might not belong to the bit vector
+        val = MaskLastWord(val);
+        }
+
+    const TUint32 shift = BitInWord(startPos);
+    val = (val >> shift) << shift; //-- mask unused low bits
+
+    if(val)
+        {//-- there are '1' bits in the current word
+        goto found;
+        }
+    else
+        {//-- search in higher words
+        wordNum++;
+
+        while(iNumWords-wordNum > 1)
+            {
+            val = ipData[wordNum] ^ fInvert;
+            if(val)
+                goto found;
+
+            wordNum++;
+            }
+
+        if(wordNum == iNumWords-1)
+            {//-- process the last word in the array, some higher bith might not belong to the bit vector
+            val = ipData[wordNum] ^ fInvert;
+            val = MaskLastWord(val);
+
+            if(val)
+                goto found;
+            }
+        }
+
+    return EFalse; //-- haven't found anything
+
+  found:
+
+    val &= (~val+1); //-- select rightmost bit
+    aStartPos = (wordNum << 5)+Log2(val);
+    return ETrue;
+    }
+
+
+//-----------------------------------------------------------------------------
+
+/**
+    Internal method to look for a given bit value in the left direction.
+    see TBool RBitVector::Find(...)
+*/
+TBool RBitVector::FindToLeft(TUint32& aStartPos, TBool aBitVal) const
+{
+    if(!aStartPos)
+        return EFalse; //-- no way to the left
+    
+    const TUint32 startPos=aStartPos-1;
+    const TUint32 fInvert = aBitVal ? 0 : K_FFFF; //-- invert everything if we are looking for '0' bit
+
+    TUint32 wordNum = WordNum(startPos);
+    TUint32 val = ipData[wordNum] ^ fInvert;
+
+    const TUint32 shift = 31-(BitInWord(startPos));
+    val = (val << shift) >> shift; //-- mask unused high bits
+
+    if(val)
+    {//-- there are '1' bits in the current word
+        goto found;
+    }
+    else
+    {//-- search in the lower words
+        while(wordNum)
+        {
+            wordNum--;
+            val=ipData[wordNum] ^ fInvert;
+            if(val)
+                goto found;
+        }
+    }
+
+    return EFalse; //-- nothing found
+
+ found:
+    aStartPos = (wordNum << 5)+Log2(val);
+    return ETrue;
+}
+
+//-----------------------------------------------------------------------------
+
+/**
+    Internal method to look for a given bit value in the both directions.
+    see TBool RBitVector::Find(...)
+*/
+TBool RBitVector::FindNearest(TUint32& aStartPos, TBool aBitVal, TBool aToLeft) const
+{
+    if(iNumBits < 2)
+        return EFalse;
+
+    if(aStartPos == 0)
+        return FindToRight(aStartPos, aBitVal);
+
+    if(aStartPos == iNumBits-1)
+        return FindToLeft(aStartPos, aBitVal);
+
+    
+    const TUint32 fInvert = aBitVal ? 0 : K_FFFF; //-- invert everything if we are looking for '0' bit
+    
+    TUint32 wordNum = WordNum(aStartPos);
+    TUint32 l_Idx; //-- index of the word to the left
+    TUint32 r_Idx; //-- index of the word to the right
+    
+    l_Idx = r_Idx = wordNum;
+
+    TBool   noWayLeft  = (wordNum == 0);            //-- if we are in the first word
+    TBool   noWayRight = (wordNum == iNumWords-1);  //-- if we are in the last word
+
+    //-- look in the current word first
+    TUint32 val = ipData[wordNum] ^ fInvert;
+    
+    if(noWayRight)
+    {   //-- this is the last word in the array, mask unused high bits in the last word
+        val = MaskLastWord(val);
+    }
+
+    const TUint32 bitPos = aStartPos & 0x1F;
+    val &= ~(1<<bitPos); //-- mask the bit at current position
+    
+    if(val == 0)
+    {//-- no '1' bits in the current word
+        noWayLeft  = ItrLeft(l_Idx);
+        noWayRight = ItrRight(r_Idx);
+    }
+    else if(bitPos == 0)
+    {
+        noWayLeft = ItrLeft(l_Idx); //-- move to the previous word
+    }
+    else if(bitPos == 31)
+    {
+        noWayRight = ItrRight(r_Idx); //-- move to the next word
+    }
+    else
+    {//-- look in the current word, in both halves to the left and right from the start position
+        
+        const TUint32 shift1 = 32-bitPos;
+        const TUint32 partLo = (val << shift1) >> shift1; //-- towards lower bits
+
+        const TUint32 shift2 = bitPos+1;
+        const TUint32 partHi = (val >> shift2) << shift2; //-- towards higher bits 
+        
+
+        if(partLo && !partHi) //-- only lower part has '1' bits   
+        {
+            aStartPos = (wordNum << 5)+Log2(partLo);
+            return ETrue;
+        }
+        else if(!partLo && partHi) //-- only higher part has '1' bits
+        {
+            aStartPos = (wordNum << 5)+Log2( (partHi & (~partHi+1)) );
+            return ETrue;
+        }
+        else if(partLo && partHi) //-- both parts contain '1' bits, select the nearest one
+        {
+            const TUint32 posL = (wordNum << 5)+Log2(partLo);
+            const TUint32 posR = (wordNum << 5)+Log2( (partHi & (~partHi+1)) );
+        
+            ASSERT(aStartPos > posL);
+            ASSERT(posR > aStartPos);
+            const TUint32 distL = aStartPos-posL;
+            const TUint32 distR = posR-aStartPos;
+
+            if(distL < distR)
+            {
+                aStartPos = posL;
+                return ETrue;
+            }
+            else if(distL > distR)
+            {
+                aStartPos = posR;
+                return ETrue;
+            }
+            else
+            {//-- distL == distR, take into account search priority
+                aStartPos = aToLeft ? posL : posR;
+                return ETrue;
+            }
+        }
+        else //-- (!partLo && !partHi), nothing in the current word
+        {
+            ASSERT(0);
+        }
+
+    }// if(bitPos > 0 && bitPos < 31)
+
+    //-- now we are processing separate words from both sides of the search position
+    for(;;)
+    { 
+        TUint32 wL = ipData[l_Idx] ^ fInvert;
+        TUint32 wR = ipData[r_Idx] ^ fInvert;
+        if(r_Idx == iNumWords-1)
+        {   //-- this is the last word in the array, mask unused high bits in the last word
+            wR = MaskLastWord(wR);
+        }
+
+        if(wL && !wR)
+        {
+            aStartPos = (l_Idx << 5)+Log2(wL);
+            return ETrue;
+        }
+        else if(!wL && wR)
+        {
+            aStartPos = (r_Idx << 5)+Log2( (wR & (~wR+1)) );
+            return ETrue;
+        }
+        else if(wL && wR)
+        {
+            const TUint32 posL = (l_Idx << 5)+Log2(wL);
+            const TUint32 posR = (r_Idx << 5)+Log2( (wR & (~wR+1)) );
+        
+            ASSERT(aStartPos > posL);
+            ASSERT(posR > aStartPos);
+            const TUint32 distL = aStartPos-posL;
+            const TUint32 distR = posR-aStartPos;
+
+            if(distL < distR)
+            {
+                aStartPos = posL;
+                return ETrue;
+            }
+            else if(distL > distR)
+            {
+                aStartPos = posR;
+                return ETrue;
+            }
+            else
+            {//-- distL == distR, take into account search priority
+                aStartPos = aToLeft ? posL : posR;
+                return ETrue;
+            }
+
+        }//else if(wL && wR)
+
+
+        if(noWayLeft)
+        {
+            aStartPos = r_Idx << 5;
+            return FindToRight(aStartPos, aBitVal);
+        }
+        else
+        {
+            noWayLeft  = ItrLeft(l_Idx);
+        }
+
+        if(noWayRight)
+        {
+            aStartPos = l_Idx << 5;
+            return FindToLeft(aStartPos, aBitVal);
+        }
+        else
+        {    
+            noWayRight = ItrRight(r_Idx);
+        }
+
+   }//for(;;)
+
+    //return EFalse;
+}
+
+//-----------------------------------------------------------------------------
+/**
+    Find out if two vectors are different.
+
+    @param  aRhs        vector to compare with
+    @param  aDiffIndex  if there is a differene, here will be the number of the first different bit
+    @return ETrue if vectors differ, EFalse, if they are identical.
+*/
+TBool RBitVector::Diff(const RBitVector& aRhs, TUint32& aDiffIndex) const
+{
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+    __ASSERT_ALWAYS(iNumBits == aRhs.iNumBits, Panic(ESizeMismatch));
+    ASSERT(iNumWords > 0);
+
+    TUint32 diffWord=0;
+    TUint32 wordNum=0;
+
+    //-- compare all but the last word in the array
+    for(wordNum=0; wordNum < iNumWords-1; ++wordNum)
+    {
+        diffWord = ipData[wordNum] ^ aRhs.ipData[wordNum];
+        if(diffWord)
+            break;  //-- found difference
+    }
+
+    //-- process the last word in the array
+    if(!diffWord)
+    {
+        diffWord = MaskLastWord(ipData[wordNum]) ^ MaskLastWord(aRhs.ipData[wordNum]);
+    }
+
+    if(!diffWord)
+        return EFalse; //-- vectors are the same
+
+    //-- calculate the position of the bit that different.
+    diffWord &= (~diffWord+1); //-- select rightmost bit
+    aDiffIndex = (wordNum << 5)+Log2(diffWord);
+    
+    return ETrue;
+}
+
+//-----------------------------------------------------------------------------
+
+/**
+    Iterate to the left (towards lower index) in the array of words ipData
+
+    @param  aIdx index within ipData array to be decremented; if it's possible to move left, it will be decreased
+    @return ETrue if there is no way left i.e. aIdx is 0. EFalse otherwise and aIdx decreased.
+*/
+TBool RBitVector::ItrLeft(TUint32& aIdx) const
+{
+    if(aIdx == 0)
+        return ETrue;
+    else
+    {
+        aIdx--;
+        return EFalse;
+    }
+}
+
+//-----------------------------------------------------------------------------
+
+/**
+    Iterate to the right (towards higher index) in the array of words ipData
+
+    @param  aIdx index within ipData array to be incremented; if it's possible to move right, it will be increased
+    @return ETrue if there is no way right i.e. aIdx corresponds to the last word. EFalse otherwise and aIdx increased.
+*/
+TBool RBitVector::ItrRight(TUint32& aIdx) const
+{
+    if(aIdx < iNumWords-1)
+    {
+        aIdx++;
+        return EFalse;
+    }
+    else
+        return ETrue;
+}
+
+//-----------------------------------------------------------------------------
+
+/**
+    Import data to the internal bit vector representation.
+    Just replaces number of bytes from apData to the ipData.
+
+    @param aStartBit starting bit number. Must have 8-bit alignment.
+    @param aNumBits  number of bits to import; granularity: 1 bit, i.e. it can be 177, for example.
+    @param apData    pointer to the data (bitstream) to import.
+
+*/
+void RBitVector::DoImportData(TUint32 aStartBit, TUint32 aNumBits, const TAny* apData)
+{
+    ASSERT(aNumBits);
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+    
+    //-- check parameters granularity. aStartBit must have 8-bit alignment
+    __ASSERT_ALWAYS(!(aStartBit & 0x07), Panic(EDataAlignment));
+
+
+    __ASSERT_ALWAYS(iNumWords && (aStartBit+aNumBits <= iNumBits), Panic(EIndexOutOfRange));
+
+    const TUint     bitsTail = aNumBits & 0x07;
+    const TUint32   nBytes = aNumBits >> 3;
+ 
+    if(nBytes)
+    {//-- copy full array of bytes
+        const TUint32   startByte = aStartBit >> 3;
+        Mem::Copy(((TUint8*)ipData) + startByte, apData, nBytes);
+    }
+
+    if(bitsTail)
+    {//-- we need to copy trailing bits from the input data to the corresponding byte of the internal array
+        const TUint8 mask   = (TUint8)(0xFF >> (8-bitsTail));
+        const TUint8 orMask = (TUint8)( *((const TUint8*)apData + nBytes) & mask);
+        const TUint8 andMask= (TUint8)~mask;
+
+        TUint8* pbData = (TUint8*)ipData + nBytes;
+        *pbData &= andMask;
+        *pbData |= orMask;
+    }
+
+}
+
+//-----------------------------------------------------------------------------
+
+/**
+    Export data from the internal bit vector buffer to the external one.
+
+    @param aStartBit starting bit number. Must have 8-bit alignment.
+    @param aNumBits  number of bits to export, must comprise the whole byte, i.e. be multiple of 8.
+                     The client is responsible for masking extra bits it doesn't need. 
+                     Another implication: e.g. if the bitvector consists of 3 bits, this value must be 8.
+                     The value of bits 3-7 in the aData[0] will be undefined.
+
+    @param aData     destination data descriptor   
+*/
+void  RBitVector::DoExportData(TUint32 aStartBit, TUint32 aNumBits, TDes8& aData) const
+{
+    ASSERT(aNumBits);
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+
+    //-- check parameters granularity.
+    __ASSERT_ALWAYS(!(aStartBit & 0x07), Panic(EDataAlignment)); //-- aStartBit must have 8-bit alignment
+    __ASSERT_ALWAYS(!(aNumBits & 0x07), Panic(EDataAlignment));  //-- number of bits shall comprise a byte
+
+    __ASSERT_ALWAYS(iNumWords && (aStartBit+aNumBits <= (iNumWords << (KBitsInByteLog2+sizeof(TUint32))) ), Panic(EIndexOutOfRange));
+
+    const TUint32 nBytes = aNumBits >> 3;
+    const TUint32 startByte = aStartBit >> 3;
+    
+    aData.SetLength(nBytes);
+    aData.Copy(((const TUint8*)ipData) + startByte, nBytes);
+}
+
+//-----------------------------------------------------------------------------
+
+/**
+    @return number of bits set to '1' in the vector
+*/
+TUint32 RBitVector::Num1Bits() const
+{
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+    if(!iNumBits)
+        return 0;
+
+    TUint32 cntBits = 0;
+
+    TUint32 wordNum;
+    for(wordNum=0; wordNum < iNumWords-1; ++wordNum)
+    {
+        cntBits += Count1Bits(ipData[wordNum]);
+    }
+
+    //-- process the last word, it shall be masked
+    cntBits += Count1Bits(MaskLastWord(ipData[wordNum]));
+    
+    return cntBits;
+}
+
+//-----------------------------------------------------------------------------
+/**
+    @return number of bits set to '0' in the vector
+*/
+TUint32 RBitVector::Num0Bits() const
+{
+    return iNumBits - Num1Bits();
+}
+
+
+//-----------------------------------------------------------------------------
+/**
+    Calculate number of '1' bits in the range from aIndexFrom to aIndexTo inclusively
+
+    @param  aIndexFrom  starting index; bit[aIndexFrom] is included to the search
+    @param  aIndexTo    ending index;   bit[aIndexTo] is included to the search
+    @return number of bits set to '1' in the slice
+*/
+TUint32 RBitVector::Num1Bits(TUint32 aIndexFrom, TUint32 aIndexTo) const
+{
+    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
+    __ASSERT_ALWAYS(aIndexTo < iNumBits && aIndexFrom <= aIndexTo, Panic(EIndexOutOfRange));
+
+    const TUint32 wordFrom = WordNum(aIndexFrom); //?const
+    const TUint32 wordTo   = WordNum(aIndexTo);
+
+    if(wordFrom == wordTo)
+    {//-- the same word
+        TUint32 word = ipData[wordFrom];
+
+        const TUint32 shMaskR = BitInWord(aIndexFrom);
+        word >>= shMaskR; word <<= shMaskR; //-- zero low bits
+
+        const TUint32 shMaskL = 31-BitInWord(aIndexTo);
+        word <<= shMaskL;  //-- zero high bits
+
+        return Count1Bits(word);
+    } 
+
+    TUint32 bitsCnt = 0;
+    TUint32 wordsBetween = wordTo - wordFrom - 1;
+
+    //-- count '1' bits in the termial words
+    TUint32 word = ipData[wordFrom];
+    const TUint32 shMaskR = BitInWord(aIndexFrom);
+    word >>= shMaskR; //-- zero low bits
+    bitsCnt += Count1Bits(word);
+
+    word = ipData[wordTo];
+    const TUint32 shMaskL = 31-BitInWord(aIndexTo);
+    word <<= shMaskL;  //-- zero high bits
+    bitsCnt += Count1Bits(word);
+
+    //-- count '1' bits in the words between terminal ones
+    TUint32 wordIdx = wordFrom+1;
+    while(wordsBetween--)
+    {
+        bitsCnt += Count1Bits(ipData[wordIdx]);
+    }
+    
+
+    return bitsCnt;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/fs_utils/bit_vector.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,251 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+//  Collection of common constants, utility functions, etc. for the file server and file systems.
+//  Definitions here must be filesystem-agnostic, i.e. generic enougs to be used by every file system
+//
+//  This is the internal file and must not be exported.
+
+/**
+    @file
+    @internalTechnology
+*/
+
+#if !defined(__FILESYSTEM_UTILS_BIT_VECTOR__)
+#define __FILESYSTEM_UTILS_BIT_VECTOR__
+
+#if !defined(__FILESYSTEM_UTILS_H__)
+#include "filesystem_utils.h"
+#endif
+
+
+//#######################################################################################################################################
+
+/**
+    This class represents a bit vector i.e. an array of bits. Vector size can be from 1 to 2^32 bits.
+    This class can be created on a stack (but needs to be placed into cleanup stack) or in a heap with the help of its factory methods Create/CreateL
+*/
+class RBitVector
+    {
+ public:
+    
+    RBitVector(); //-- Creates an empty vector. see Create() methods for memory allocation
+   ~RBitVector(); 
+    
+    void Close(); 
+    
+    TInt Create(TUint32 aNumBits);
+    void CreateL(TUint32 aNumBits);
+
+    inline TUint32 Size() const;
+
+    //-- single bit manipulation methods
+    inline TBool operator[](TUint32 aIndex) const;
+    inline void SetBit(TUint32 aIndex);
+    inline void ResetBit(TUint32 aIndex);
+    inline void InvertBit(TUint32 aIndex);
+    inline void SetBitVal(TUint32 aIndex, TBool aVal);
+    
+    void Fill(TBool aVal);
+    void Fill(TUint32 aIndexFrom, TUint32 aIndexTo, TBool aVal);
+
+    void Invert();
+   
+    TBool operator==(const RBitVector& aRhs) const; 
+    TBool operator!=(const RBitVector& aRhs) const;
+
+    //-- logical operations between 2 vectors. 
+    void And(const RBitVector& aRhs);
+    void Or (const RBitVector& aRhs);
+    void Xor(const RBitVector& aRhs);
+
+    TBool Diff(const RBitVector& aRhs, TUint32& aDiffIndex) const;
+    
+    TUint32 Num1Bits() const;
+    TUint32 Num1Bits(TUint32 aIndexFrom, TUint32 aIndexTo) const;
+
+    TUint32 Num0Bits() const;
+
+
+    /** Bit search specifiers */
+    enum TFindDirection
+        {
+        ELeft,      ///< Search from the given position to the left (towards lower index)
+        ERight,     ///< Search from the given position to the right (towards higher index)
+        ENearestL,  ///< Search in both directions starting from the given position; in the case of the equal distances return the position to the left
+        ENearestR   ///< Search in both directions starting from the given position; in the case of the equal distances return the position to the right
+
+        //-- N.B the current position the search starts with isn't included to the search.
+        };
+
+    TBool Find(TUint32& aStartPos, TBool aBitVal, TFindDirection aDir) const;
+
+    /** panic codes */
+    enum TPanicCode
+        {
+        EIndexOutOfRange,       ///< index out of range
+        EWrondFindDirection,    ///< a value doesn't belong to TFindDirection
+        ESizeMismatch,          ///< Size mismatch for binary operators
+        ENotInitialised,        ///< No memory allocated for the array
+        ENotImplemented,        ///< functionality isn't implemented
+
+        EDataAlignment,         ///< wrong data alignment when importing / exporting raw data
+        };
+
+ protected:
+    
+    //-- these are outlawed. Can't use them because memory allocator can leave and we don't have conthrol on it  in these methods. 
+    RBitVector(const RBitVector& aRhs);            
+    RBitVector& operator=(const RBitVector& aRhs); 
+
+    void* operator new(TUint); //-- disable creating objects on heap.
+    void* operator new(TUint, void*);
+    //-------------------------------------
+
+  
+    void Panic(TPanicCode aPanicCode) const;
+
+    inline TUint32 WordNum(TUint32 aBitPos)  const;
+    inline TUint32 BitInWord(TUint32 aBitPos) const;
+
+ protected:
+    //-- special interface to acecess raw internal data. It's protected. Derive appropriate class from this one if you wan to use it
+    void  DoImportData(TUint32 aStartBit, TUint32 aNumBits, const TAny* apData);
+    void  DoExportData(TUint32 aStartBit, TUint32 aNumBits, TDes8& aData) const;
+
+
+ private:
+    TBool FindToRight(TUint32& aStartPos, TBool aBitVal) const;
+    TBool FindToLeft (TUint32& aStartPos, TBool aBitVal) const;
+    TBool FindNearest(TUint32& aStartPos, TBool aBitVal, TBool aToLeft) const;
+   
+    inline TUint32 MaskLastWord(TUint32 aVal) const; 
+    inline TBool ItrLeft(TUint32& aIdx) const;
+    inline TBool ItrRight(TUint32& aIdx) const;
+
+
+ protected:
+
+    TUint32   iNumBits; ///< number of bits in the vector
+    TUint32*  ipData;   ///< pointer to the data 
+    TUint32   iNumWords;///< number of 32-bit words that store bits
+    };
+
+
+//#######################################################################################################################################
+//#   inline functions area
+//#######################################################################################################################################
+
+
+//--------------------------------------------------------------------------------------------------------------------------------- 
+//-- class RBitVector
+
+/** @return size of the vector (number of bits) */
+inline TUint32 RBitVector::Size() const
+    {
+    return iNumBits;
+    } 
+
+/**
+    Get a bit by index
+    
+    @param aIndex  index in a bit vector
+    @return 0 if the bit at pos aIndex is 0, not zero otherwise
+    @panic EIndexOutOfRange if aIndex is out of range
+*/
+inline TBool RBitVector::operator[](TUint32 aIndex) const
+    {
+    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
+    return (ipData[WordNum(aIndex)] & (1<<BitInWord(aIndex)));
+    }
+
+/**
+    Set a bit at pos aIndex to '1'
+    @param aIndex  index in a bit vector
+    @panic EIndexOutOfRange if aIndex is out of range
+*/
+inline void RBitVector::SetBit(TUint32 aIndex)
+    {
+    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
+    ipData[WordNum(aIndex)] |= (1<<BitInWord(aIndex));
+    }
+
+/**
+    Set a bit at pos aIndex to '0'
+    @param aIndex  index in a bit vector
+    @panic EIndexOutOfRange if aIndex is out of range
+*/
+inline void RBitVector::ResetBit(TUint32 aIndex)
+    {
+    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
+    ipData[WordNum(aIndex)] &= ~(1<<BitInWord(aIndex));
+    }
+
+/**
+    Invert a bit at pos aIndex
+    @param aIndex  index in a bit vector
+    @panic EIndexOutOfRange if aIndex is out of range
+*/
+inline void RBitVector::InvertBit(TUint32 aIndex)
+    {
+    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
+    ipData[WordNum(aIndex)] ^= (1<<BitInWord(aIndex));
+    }
+
+/**
+    Set bit value at position aIndex
+    @param aIndex  index in a bit vector
+    @panic EIndexOutOfRange if aIndex is out of range
+*/
+inline void RBitVector::SetBitVal(TUint32 aIndex, TBool aVal)
+    {
+    if(aVal) 
+        SetBit(aIndex);
+    else 
+        ResetBit(aIndex);
+    }
+
+
+inline TUint32 RBitVector::MaskLastWord(TUint32 aVal) const
+    {
+    const TUint32 shift = (32-(iNumBits & 0x1F)) & 0x1F;
+    return (aVal << shift) >> shift; //-- mask unused high bits
+    }
+
+inline TUint32 RBitVector::WordNum(TUint32 aBitPos)  const
+    {
+    return aBitPos >> 5;
+    }
+
+inline TUint32 RBitVector::BitInWord(TUint32 aBitPos) const 
+    {
+    return aBitPos & 0x1F;
+    }
+
+
+
+#endif //__FILESYSTEM_UTILS_BIT_VECTOR__
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/fs_utils/filesystem_utils.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,91 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+//  Collection of common constants, utility functions, etc. for the file server and file systems.
+//  Definitions here must be filesystem-agnostic, i.e. generic enougs to be used by every file system
+//
+//  This is the internal file and must not be exported.
+
+/**
+    @file
+    @internalTechnology
+*/
+
+#include "filesystem_utils.h"
+
+//-----------------------------------------------------------------------------
+
+/**
+    Calculates the log2 of a number
+
+    @param aNum Number to calulate the log two of
+    @return The log two of the number passed in
+*/
+TUint32 Log2(TUint32 aVal)
+    {
+    return Log2_inline(aVal);
+    }
+
+//-----------------------------------------------------------------------------
+/**
+    Calculates number of '1' bits in the aVal
+
+    @param aVal some value
+    @return number of '1' bits in the aVal
+*/
+TUint32 Count1Bits(TUint32 aVal)
+    {
+    return Count1Bits_inline(aVal);
+    }
+
+//-----------------------------------------------------------------------------
+/**
+    Removes trailing dots from aName.
+    @return new string descriptor that may have its length adjusted
+*/
+TPtrC RemoveTrailingDots(const TDesC& aName)
+    {
+    TInt len = aName.Length();
+    
+    while(len > 0)
+        {
+        if(aName[len-1] == '.')
+            len--;
+        else
+            break;
+        }
+
+    TPtrC ptrNoDots(aName.Ptr(), len);
+    return ptrNoDots;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/fs_utils/filesystem_utils.h	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,118 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+//  Collection of common constants, utility functions, etc. for the file server and file systems.
+//  Definitions here must be filesystem-agnostic, i.e. generic enougs to be used by every file system
+//
+//  This is the internal file and must not be exported.
+
+/**
+    @file
+    @internalTechnology
+*/
+
+#if !defined(__FILESYSTEM_UTILS_H__)
+#define __FILESYSTEM_UTILS_H__
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+//#######################################################################################################################################
+//#   constants definitions
+//#######################################################################################################################################
+
+const TUint KBitsInByteLog2 = 3;
+const TUint KBitsInByte = 1<<KBitsInByteLog2;
+
+
+const TUint16 K1KiloByteLog2 = 10;
+const TUint32 K1KiloByte = 1<<K1KiloByteLog2; 
+const TUint32 K1MegaByte = 1<<20; 
+
+const TUint32 K1uSec = 1;               ///< 1 misrosecond in TTimeIntervalMicroSeconds32
+const TUint32 K1mSec = 1000;            ///< 1 millisecond in TTimeIntervalMicroSeconds32
+const TUint32 K1Sec  = 1000*K1mSec;     ///< 1 second in TTimeIntervalMicroSeconds32
+
+//---------------------------------------------------------------------------------------------------------------------------------------
+
+const TUint KDefSectorSzLog2=9;                         ///< Log2 of the default sector size for the media 
+const TUint KDefaultSectorSize = 1 << KDefSectorSzLog2; ///< Default sector size for the media, 512 bytes
+
+//#######################################################################################################################################
+//#   some useful utility functions
+//#######################################################################################################################################
+
+inline TUint32 Pow2(TUint32 aVal);          //-- return 2^aVal
+inline TUint32 Pow2_32(TUint32 aVal);       //-- return 2^aVal
+inline TUint64 Pow2_64(TUint32 aVal);       //-- return 2^aVal
+
+inline TBool IsPowerOf2(TUint32 aVal);      //-- return ETrue if aVal is a power of 2 
+inline TBool IsPowerOf2_64(TUint64 aVal);   //-- return ETrue if aVal is a power of 2 
+
+inline TUint32 RoundDown(TUint32 aVal, TUint32 aGranularityLog2);
+inline TUint32 RoundUp(TUint32 aVal, TUint32 aGranularityLog2);
+
+inline TBool BoolXOR(TBool a1, TBool a2);           //-- return Boolean XOR of a1 and a2
+
+inline TUint32 Log2_inline(TUint32 aVal);           //-- Calculates the Log2(aVal)
+TUint32 Log2(TUint32 aVal);                         //-- Calculates the Log2(aVal)
+
+inline TUint32 Count1Bits_inline(TUint32 aVal);     //-- counts number of '1' bits in the aVal
+TUint32 Count1Bits(TUint32 aVal);                   //-- counts number of '1' bits in the aVal
+
+//-----------------------------------------------------------------------------
+
+TPtrC RemoveTrailingDots(const TDesC& aName); //-- Removes trailing dots from aName. "Name..." -> "Name"
+
+
+//#######################################################################################################################################
+/**
+    A class representing a simple abstraction of the 32 bit flags
+*/
+class T32Bits
+{
+ public:
+    T32Bits() : iData(0) {}
+
+    inline void  Clear();
+    inline TBool HasBitsSet() const;
+    inline void SetBit(TUint32 aIndex);
+    inline TBool operator[](TUint32 aIndex) const;
+
+ private:
+    TUint32 iData; ///< 32 bits data
+};
+
+
+
+
+
+
+#include "filesystem_utils.inl"
+
+
+#endif //__FILESYSTEM_UTILS_H__
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userlibandfileserver/fileserver/fs_utils/filesystem_utils.inl	Mon Jan 18 21:31:10 2010 +0200
@@ -0,0 +1,239 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// 
+
+/**
+    @file
+    @internalTechnology
+*/
+
+#if !defined(__FILESYSTEM_UTILS_INL__)
+#define __FILESYSTEM_UTILS_INL__
+
+
+//-----------------------------------------------------------------------------
+/** @return 2^aVal */
+inline TUint32 Pow2(TUint32 aVal)
+    {
+    ASSERT(aVal<32);
+    return 1 << aVal;
+    }
+
+//-----------------------------------------------------------------------------
+/** @return TUint32 value equals 2^aVal */
+inline TUint32 Pow2_32(TUint32 aVal)
+    {
+    ASSERT(aVal < 32);
+    return 1 << aVal;
+    }
+
+//-----------------------------------------------------------------------------
+/** @return TUint64 value equals 2^aVal */
+inline TUint64 Pow2_64(TUint32 aVal)
+    {
+    ASSERT(aVal < 64);
+    return ((TUint64)1) << aVal;
+    }
+
+//-----------------------------------------------------------------------------
+/**
+    Indicates if a number passed in is a power of two
+    @return ETrue if aVal is a power of 2 
+*/
+inline TBool IsPowerOf2(TUint32 aVal)
+    {
+    if (aVal==0)
+        return EFalse;
+
+    return !(aVal & (aVal-1));
+    }
+
+//-----------------------------------------------------------------------------
+/**
+    Indicates if a number passed in is a power of two
+    @return ETrue if aVal is a power of 2 
+*/
+inline TBool IsPowerOf2_64(TUint64 aVal)
+    {
+    if (aVal==0)
+        return EFalse;
+
+    return !(aVal & (aVal-1));
+
+    }
+
+//-----------------------------------------------------------------------------
+
+/**
+    rounds down the given value to 2^aGranularityLog2
+    @param  aVal                input value to round down
+    @param  aGranularityLog2    Log2(granularity)
+    @return rounded - down value
+*/
+inline TUint32 RoundDown(TUint32 aVal, TUint32 aGranularityLog2)
+{
+    ASSERT(aGranularityLog2 < 32);
+    return (aVal >> aGranularityLog2) << aGranularityLog2;
+}
+
+//-----------------------------------------------------------------------------
+/**  
+    Rounds up aVal to the 2^aGranularityLog2 
+    For example: RoundUp(0x08, 2) == 0x08; RoundUp(0x08, 3) == 0x08; RoundUp(0x08, 4) == 0x10; RoundUp(0x19, 4) == 0x20
+    
+    @return rounded-up value
+*/
+inline TUint32 RoundUp(TUint32 aVal, TUint32 aGranularityLog2)
+    {
+    ASSERT(aGranularityLog2 < 32);
+                                         
+    if( (aVal & ((1<<aGranularityLog2)-1)) == 0)
+        return aVal;    
+
+    aVal >>= aGranularityLog2;
+    aVal++;
+    aVal <<= aGranularityLog2;
+
+    return aVal;
+    }
+
+//-----------------------------------------------------------------------------
+
+/**
+    @return Boolean exclusive OR between a1 and a2
+    This function should be used on C-style TBool, which is, actually TInt type; Its '0' value means "False" and _any_ non-zero means "True"
+    E.g: BoolXor(0x17, 0x4a) == EFalse;
+*/
+TBool BoolXOR(TBool a1, TBool a2)
+    {
+    if(!a1 && !a2)        
+        return EFalse;
+    else if(a1 && a2)
+        return EFalse;
+    else
+        return ETrue;
+    }
+
+//-----------------------------------------------------------------------------
+
+/**
+    Calculates the log2 of a number
+    This is the explicitly inlined version. Extensive using it may result in a code bloat.
+
+    @param aNum Number to calulate the log two of
+    @return The log two of the number passed in
+*/
+inline TUint32 Log2_inline(TUint32 aVal)
+    {
+    __ASSERT_COMPILE(sizeof(TUint32) == 4);
+    ASSERT(aVal);
+
+    TUint32 bitPos=31;
+
+    if(!(aVal >> 16)) {bitPos-=16; aVal<<=16;}
+    if(!(aVal >> 24)) {bitPos-=8;  aVal<<=8 ;}
+    if(!(aVal >> 28)) {bitPos-=4;  aVal<<=4 ;}
+    if(!(aVal >> 30)) {bitPos-=2;  aVal<<=2 ;}
+    if(!(aVal >> 31)) {bitPos-=1;}
+    
+    return bitPos;
+    }
+
+
+//-----------------------------------------------------------------------------
+/**
+    Calculates number of '1' bits in the aVal
+    This is the explicitly inlined version. Extensive using it may result in a code bloat.
+
+    @param aVal some value
+    @return number of '1' bits in the aVal
+*/
+inline TUint32 Count1Bits_inline(TUint32 aVal)
+    {
+    if(!aVal)
+        return 0;
+
+    if(aVal == 0xFFFFFFFF)
+        return 32;
+
+    aVal = aVal - ((aVal >> 1) & 0x55555555);
+    aVal = (aVal & 0x33333333) + ((aVal >> 2) & 0x33333333);
+    aVal = (aVal + (aVal >> 4)) & 0x0f0f0f0f;
+    aVal = aVal + (aVal >> 8);
+    aVal = aVal + (aVal >> 16);
+
+    return aVal & 0x3f;
+    }
+
+
+
+
+//-----------------------------------------------------------------------------
+
+/** clear all bits */
+void T32Bits::Clear()
+    {
+    iData = 0;
+    }
+
+/** @return non-0 if at least one of 32 bits is set to '1' */
+TBool T32Bits::HasBitsSet() const 
+    {
+    return iData;
+    } 
+
+/** sets bit number "aIndex" to '1' */
+void T32Bits::SetBit(TUint32 aIndex)
+    {
+    ASSERT(aIndex < 32);
+    iData |= (1<<aIndex);
+    }
+
+/** 
+    Get value of the bit number "aIndex". 
+    @return 0 if the bit aIndex is '0' non-zero otherwise
+*/
+TBool T32Bits::operator[](TUint32 aIndex) const
+    {
+    ASSERT(aIndex < 32);
+    return (iData & (1<<aIndex));
+    }
+
+
+
+
+
+
+
+
+
+
+#endif //__FILESYSTEM_UTILS_INL__
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- a/userlibandfileserver/fileserver/group/base_f32.mrp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/group/base_f32.mrp	Mon Jan 18 21:31:10 2010 +0200
@@ -10,6 +10,7 @@
 source	\sf\os\kernelhwsrv\userlibandfileserver\fileserver\bx86
 source	\sf\os\kernelhwsrv\userlibandfileserver\fileserver\ddesign
 source	\sf\os\kernelhwsrv\userlibandfileserver\fileserver\eabi
+source	\sf\os\kernelhwsrv\userlibandfileserver\fileserver\fs_utils
 source	\sf\os\kernelhwsrv\userlibandfileserver\fileserver\rom
 source	\sf\os\kernelhwsrv\userlibandfileserver\fileserver\runtests
 source	\sf\os\kernelhwsrv\userlibandfileserver\fileserver\sfile
--- a/userlibandfileserver/fileserver/group/release.txt	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/group/release.txt	Mon Jan 18 21:31:10 2010 +0200
@@ -1,3 +1,63 @@
+Version 2.00.2025
+=================
+(Made by vfebvre 16/12/2009)
+
+1.	MichaelCox
+	1.	MINOR_CHANGE: Improve documentation for class CFsNotify concerning how big the buffer should be
+
+2.	HaoJ
+	1.	DEFECT FIX: DEF143253 [Coverity]:DEADCODE and CHECKED_RETURN error in MSF00264 vtb101sf
+	2.	MINOR_CHANGE: Remove a build warning in arm4 and wins introduced by fix for DEF143253
+
+3.	hengrant
+	1.	DEFECT FIX: DEF143386: t_notify_perf failure of edge use cases on gekko79 
+
+4.	DmitryL
+	1.	DEFECT FIX: DEF143263 FAT CheckDisk() is too slow comparing to ScanDrive() 
+
+5.	FadhliMustaffa
+	1.	DEFECT FIX: DEF142711: RFsPlugin needs to expose a Volume() API
+
+
+Version 2.00.2024
+=================
+(Made by vfebvre 15/12/2009)
+
+1.	cnotton
+	1.	MINOR_CHANGE Added two missing public headers for case when SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT is used.
+
+
+Version 2.00.2023
+=================
+(Made by VincentF 14/12/2009)
+
+1.	cnotton
+	1.	DEF143346: Stop including platform headers in f32file.h
+
+
+Version 2.00.2022
+=================
+(Made by VincentF 10/12/2009)
+
+1.	DmitryL
+	1.	DEFECT FIX: DEF143214 t_automounter.cpp depends on exfat which is not contributed to the foundation  
+
+2.	KaiD
+	1.	DEFECT FIX: DEF143215: 	File server requesting a large chunk
+
+
+Version 2.00.2021
+=================
+(Made by VincentF 03/12/2009)
+
+1.	DmitryL
+	1.	DEFECT FIX: DEF142313 excessive usage of Entry() in the file server  
+	2. 	MINOR_CHANGE: placing RBitVector into common utilities file
+
+2.	HaoJ
+	1.	DEFECT FIX: DEF143222 t_notify_perf failure
+
+
 Version 2.00.2020
 =================
 (Made by VincentF 27/11/2009)
--- a/userlibandfileserver/fileserver/inc/F32plugin.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/inc/F32plugin.h	Mon Jan 18 21:31:10 2010 +0200
@@ -37,7 +37,7 @@
 const TInt KCountNeeded=KMinTInt;
 
 /**
-List of file server operations 
+List of file server operations
 */
 enum TFsMessage
 	{
@@ -70,7 +70,7 @@
 	EFsFormatSubClose,          ///< Closes the Format subsession
 	EFsDirSubClose,             ///< Closes the directory.
 	EFsFileSubClose,            ///< Closes the file
-	EFsRawSubClose,             ///< Closes the direct access channel to the disk 
+	EFsRawSubClose,             ///< Closes the direct access channel to the disk
 	EFsFileOpen,				///< -- 30 Opens file
 	EFsFileCreate,				///< Creates and opens a new file
 	EFsFileReplace,             ///< Replaces a file of the same name or creates a new file
@@ -142,7 +142,7 @@
 	EFsSwapFileSystem,          ///< Swaps file systems
 	EFsErasePassword,           ///< Erase the password from the locked MultiMedia card
 	EFsReserveDriveSpace,		///< -- 100 Reserves an area of a drive
-	EFsGetReserveAccess,        ///< Get exclusive access to reserved area 
+	EFsGetReserveAccess,        ///< Get exclusive access to reserved area
 	EFsReleaseReserveAccess,    ///< Release exclusive access to reserved area
 	EFsFileName,                ///< Gets the final part of a filename
     EFsGetMediaSerialNumber,    ///<  Gets the serial number of media
@@ -151,7 +151,7 @@
 	EFsRemovePlugin,            ///< Removes the specified plugin
 	EFsMountPlugin,			    ///< Mounts the specified plugin
 	EFsDismountPlugin,	        ///< Dismounts the specified plugin
-	EFsPluginName,				///<-- 110 Gets a plugin's name in specific position and drive 
+	EFsPluginName,				///<-- 110 Gets a plugin's name in specific position and drive
 	EFsPluginOpen,              ///< Opens the plugin
 	EFsPluginSubClose,          ///< Closes the plugin
 	EFsPluginDoRequest,         ///< Issues an asynchronous plugin request
@@ -178,10 +178,10 @@
 	EFsDismountProxyDrive,		///< Dismounts a proxy drive
 	EFsNotificationOpen,		///< Opens the notification
 	EFsNotificationBuffer,		///< Communicates buffer to file server
-	EFsNotificationRequest,		///< Sends the notification request 
-	EFsNotificationCancel,		///< Cancels the notification request 
-	EFsNotificationSubClose,	///< -- 140 Closes the notification 
-	EFsNotificationAdd,			///< Adds filter to the server, comprising a path and notification type
+	EFsNotificationRequest,		///< Sends the notification request
+	EFsNotificationCancel,		///< Cancels the notification request
+	EFsNotificationSubClose,	///< Closes the notification
+	EFsNotificationAdd,			///< -- 140 Adds filter to the server, comprising a path and notification type
 	EFsNotificationRemove,		///< Removes filters from Server-Side
 	EFsLoadCodePage,			///< Loads a code page library
 	EMaxClientOperations		///< This must always be the last operation insert above
@@ -190,7 +190,7 @@
 class CFsRequest;
 
 /**
-Request wrapper for plugins 
+Request wrapper for plugins
 */
 class TFsPluginRequest
 	{
@@ -221,6 +221,7 @@
 		EUid,
 		EEntryArray,
 		ENewPosition,
+		EVolumeInfo
 		};
 	
 	IMPORT_C TFsPluginRequest(CFsRequest* aRequest);
@@ -374,18 +375,18 @@
 	IMPORT_C RLibrary Library() const;
 public:
 	/**
-	@internalTechnology 
-	Installs the plugin factory 
+	@internalTechnology
+	Installs the plugin factory
 	@return KErrNone or one of the system wide errors
 	*/
 	virtual TInt Install()=0;
-	/** 
+	/**
 	@internalTechnology
-	Creates a new plugin 
+	Creates a new plugin
 	@return plugin object
 	*/
 	virtual CFsPlugin* NewPluginL()=0;
-	/**	
+	/**
 	@internalTechnology
 	Returns unique position of the plugin
 	@return unique position of the plugin
@@ -430,7 +431,7 @@
 	inline virtual TInt SessionDisconnect(CSessionFs* aSession);
 protected:
 	IMPORT_C virtual void InitialiseL();
-	IMPORT_C virtual TInt Deliver(TFsPluginRequest& aRequest);	
+	IMPORT_C virtual TInt Deliver(TFsPluginRequest& aRequest);
 	virtual TInt DoRequestL(TFsPluginRequest& aRequest) = 0;
 	
 	IMPORT_C virtual CFsPluginConn* NewPluginConnL();
@@ -466,7 +467,7 @@
 	The remaining space in this base class in release 9.1 is defined as follows:
 		TUint8 iRegisteredIntercepts[EMaxClientOperations << 1];	244 bytes
 		TInt iUniquePos;											  4 bytes
-															TOTAL	248 bytes 
+															TOTAL	248 bytes
 	where EMaxClientOperations = 122.
 
 	Unfortunately, the remaining space in release 9.2+ WAS defined as follows:
@@ -475,17 +476,17 @@
 																	  2 bytes (padding)
 		TInt iUniquePos;											  4 bytes
 															TOTAL:	252 bytes
-  
-	This meant that a 9.1-compiled plugin running on 9.2+ would have it's first data 
+
+	This meant that a 9.1-compiled plugin running on 9.2+ would have its first data
 	member overwritten when the base class (CFsPlugin) wrote to iUniquePos.
 
-	To maintain Binary Compatibility (BC), we need to preserve both the (smaller) 9.1 
-	and (larger) 9.2+ class sizes. 
+	To maintain Binary Compatibility (BC), we need to preserve both the (smaller) 9.1
+	and (larger) 9.2+ class sizes.
 	To allow 9.1 plugins to work unchanged on 9.2+ iUniquePos has been moved to BEFORE
 	the iRegisteredIntercepts byte array
 
-	N.B. - the iRegisteredIntercepts array uses only 2 bits per function, so the 
-	array size only needs to be >= EMaxClientOperations/4. 
+	N.B. - the iRegisteredIntercepts array uses only 2 bits per function, so the
+	array size only needs to be >= EMaxClientOperations/4.
 	*/
     enum {KIntcArrSize = 132};
 	TInt iUniquePos;									//			  4 bytes
@@ -527,6 +528,11 @@
 	};
 
 /**
+A class for making file server request internally from within a
+file server plugin.
+
+See also RFilePlugin and RDirPlugin.
+
 @publishedPartner
 @released
 */
@@ -545,6 +551,7 @@
 	IMPORT_C TInt Entry(const TDesC& aName,TEntry& anEntry) const;
 	IMPORT_C TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
 	IMPORT_C TInt ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const;
+	IMPORT_C TInt Volume(TVolumeInfo &aVol,TInt aDrive=KDefaultDrive) const;
 
 protected:
 	TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const;
@@ -579,13 +586,13 @@
 	IMPORT_C TInt Create(const TDesC& aName,TUint aFileMode);
     IMPORT_C TInt Replace(const TDesC& aName,TUint aFileMode);
     IMPORT_C TInt Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode);
-       
+
     // re-open SAME file as client's request
     IMPORT_C TInt AdoptFromClient();
 
     // Transfer the plugin's open file to the client
 	IMPORT_C TInt TransferToClient();
-	
+
 	IMPORT_C void Close();
 
     // RFile overloads
@@ -690,7 +697,7 @@
 public:
 	TInt InitControl(CFsRequest* aRequest);
 	TInt InitRequest(CFsRequest* aRequest);
-private:	
+private:
 	TDblQueLink iLink;
 	CFsPluginConn& iPluginConn;
 	TInt iFunction;
--- a/userlibandfileserver/fileserver/inc/f32file.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/inc/f32file.h	Mon Jan 18 21:31:10 2010 +0200
@@ -26,11 +26,21 @@
 #include <e32base.h>
 #endif
 
+#ifndef SYMBIAN_ENABLE_PUBLIC_PLATFORM_HEADER_SPLIT
+// Old implementation including platform e32svr.h (which includes the several other platform headers)...
 #if !defined(__E32SVR_H__)
 #include <e32svr.h>
 #endif
-
+#include <e32ldr.h>
+#else
+// New implementation including only the public headers needed for f32file.h...
 #include <e32ldr.h>
+// And the public headers previously included via e32svr.h but otherwise not needed for f32file.h...
+#include <e32def.h>
+#include <e32event.h>
+#include <e32debug.h>
+#include <e32keys.h> 
+#endif
 
 
 /**
--- a/userlibandfileserver/fileserver/inc/f32notification.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/inc/f32notification.h	Mon Jan 18 21:31:10 2010 +0200
@@ -139,6 +139,11 @@
 class CFsNotifyBody; //incomplete decl
 
 /*
+ * CFsNotify is a class which allows changes to file and directories to be monitored
+ *
+ * The notification framework supported by CFsNotify is able to keep track of multiple notifications,
+ * whilst ensuring that notifications cannot be missed (unlike RFs::NotifyChange which can miss changes).
+ *
  * CFsNotify encapsulates the client-side sub-session associated with
  * the file server notification framework.
  * 
@@ -172,8 +177,22 @@
 		/*
 		 * Factory function. Creates a new CFsNotify and returns a pointer to it.
 		 *
+		 * CFsNotify stores notifications in a buffer. 
+		 * Clients of CFsNotify must specify how large this buffer should be.
+		 * 
+		 * As a guideline: Notification objects in the buffer typically have a 8byte header,
+		 * followed by a word aligned string containing the fullname of the file that has changed.
+		 * In the case of a rename notification both the original and the new fullnames are stored.
+		 *
+		 * However, clients must not assume to know the exact size of notifications when determining the size of their buffer,
+		 * as it is not possible to know how often a client will be able to read the notifications from the buffer.
+		 * In addition, if further notification types are added, then the header size or maximum data could increase.
+		 * 
+		 * Thus, clients must ensure that their notification handling code appropriately deals with an overflow notification, whereby the
+		 * buffer was not large enough to store all of the notifications.
+		 *
 		 * If aBufferSize is greater than (KMaxTInt/2) then it will return KErrArgument.
-		 * If it is less than KMinNotificationBufferSize (approximately 1KB) then aBufferSize will be 
+		 * If aBufferSize is less than KMinNotificationBufferSize (which is an internal constant but is approximately equal to 1KB) then aBufferSize will be 
 		 * set to KMinNotificationBufferSize.
 		 * 
 		 * @param aFs - RFs session. Must be connected.
--- a/userlibandfileserver/fileserver/inc/f32ver.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/inc/f32ver.h	Mon Jan 18 21:31:10 2010 +0200
@@ -58,6 +58,6 @@
 
 @see TVersion
 */
-const TInt KF32BuildVersionNumber=2020;
+const TInt KF32BuildVersionNumber=2025;
 //
 #endif
--- a/userlibandfileserver/fileserver/inc/filesystem_utils.h	Thu Jan 07 13:38:45 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-//  Collection of common constants, utility functions, etc. for the file server and file systems.
-//  Definitions here must be filesystem-agnostic, i.e. generic enougs to be used by every file system
-//
-//  This is the internal file and must not be exported.
-
-/**
-    @file
-    @internalTechnology
-*/
-
-#if !defined(__FILESYSTEM_UTILS_H__)
-#define __FILESYSTEM_UTILS_H__
-
-#if !defined(__E32BASE_H__)
-#include <e32base.h>
-#endif
-
-//#######################################################################################################################################
-//#   constants definitions
-//#######################################################################################################################################
-
-const TUint KBitsInByteLog2 = 3;
-const TUint KBitsInByte = 1<<KBitsInByteLog2;
-
-
-const TUint16 K1KiloByteLog2 = 10;
-const TUint32 K1KiloByte = 1<<K1KiloByteLog2; 
-const TUint32 K1MegaByte = 1<<20; 
-
-const TUint32 K1uSec = 1;               ///< 1 misrosecond in TTimeIntervalMicroSeconds32
-const TUint32 K1mSec = 1000;            ///< 1 millisecond in TTimeIntervalMicroSeconds32
-const TUint32 K1Sec  = 1000*K1mSec;     ///< 1 second in TTimeIntervalMicroSeconds32
-
-//---------------------------------------------------------------------------------------------------------------------------------------
-
-const TUint KDefSectorSzLog2=9;                         ///< Log2 of the default sector size for the media 
-const TUint KDefaultSectorSize = 1 << KDefSectorSzLog2; ///< Default sector size for the media, 512 bytes
-
-//#######################################################################################################################################
-//#   some useful utility functions
-//#######################################################################################################################################
-
-inline TUint32 Pow2(TUint32 aVal);          //-- return 2^aVal
-inline TUint32 Pow2_32(TUint32 aVal);       //-- return 2^aVal
-inline TUint64 Pow2_64(TUint32 aVal);       //-- return 2^aVal
-
-inline TBool IsPowerOf2(TUint32 aVal);      //-- return ETrue if aVal is a power of 2 
-inline TBool IsPowerOf2_64(TUint64 aVal);   //-- return ETrue if aVal is a power of 2 
-
-inline TUint32 RoundDown(TUint32 aVal, TUint32 aGranularityLog2);
-inline TUint32 RoundUp(TUint32 aVal, TUint32 aGranularityLog2);
-
-inline TBool BoolXOR(TBool a1, TBool a2);    //-- return Boolean XOR of a1 and a2
-
-inline TUint32 Log2_inline(TUint32 aVal);           //-- Calculates the Log2(aVal)
-inline TUint32 Count1Bits_inline(TUint32 aVal);     //-- counts number of '1' bits in the aVal
-
- 
-
-
-#include "filesystem_utils.inl"
-
-
-#endif //__FILESYSTEM_UTILS_H__
-
-
-
-
-
-
-
-
-
-
-
-
--- a/userlibandfileserver/fileserver/inc/filesystem_utils.inl	Thu Jan 07 13:38:45 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +0,0 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// 
-
-/**
-    @file
-    @internalTechnology
-*/
-
-#if !defined(__FILESYSTEM_UTILS_INL__)
-#define __FILESYSTEM_UTILS_INL__
-
-
-//-----------------------------------------------------------------------------
-/** @return 2^aVal */
-inline TUint32 Pow2(TUint32 aVal)
-    {
-    ASSERT(aVal<32);
-    return 1 << aVal;
-    }
-
-//-----------------------------------------------------------------------------
-/** @return TUint32 value equals 2^aVal */
-inline TUint32 Pow2_32(TUint32 aVal)
-    {
-    ASSERT(aVal < 32);
-    return 1 << aVal;
-    }
-
-//-----------------------------------------------------------------------------
-/** @return TUint64 value equals 2^aVal */
-inline TUint64 Pow2_64(TUint32 aVal)
-    {
-    ASSERT(aVal < 64);
-    return ((TUint64)1) << aVal;
-    }
-
-//-----------------------------------------------------------------------------
-/**
-    Indicates if a number passed in is a power of two
-    @return ETrue if aVal is a power of 2 
-*/
-inline TBool IsPowerOf2(TUint32 aVal)
-    {
-    if (aVal==0)
-        return EFalse;
-
-    return !(aVal & (aVal-1));
-    }
-
-//-----------------------------------------------------------------------------
-/**
-    Indicates if a number passed in is a power of two
-    @return ETrue if aVal is a power of 2 
-*/
-inline TBool IsPowerOf2_64(TUint64 aVal)
-    {
-    if (aVal==0)
-        return EFalse;
-
-    return !(aVal & (aVal-1));
-
-    }
-
-//-----------------------------------------------------------------------------
-
-/**
-    rounds down the given value to 2^aGranularityLog2
-    @param  aVal                input value to round down
-    @param  aGranularityLog2    Log2(granularity)
-    @return rounded - down value
-*/
-inline TUint32 RoundDown(TUint32 aVal, TUint32 aGranularityLog2)
-{
-    ASSERT(aGranularityLog2 < 32);
-    return (aVal >> aGranularityLog2) << aGranularityLog2;
-}
-
-//-----------------------------------------------------------------------------
-/**  
-    Rounds up aVal to the 2^aGranularityLog2 
-    For example: RoundUp(0x08, 2) == 0x08; RoundUp(0x08, 3) == 0x08; RoundUp(0x08, 4) == 0x10; RoundUp(0x19, 4) == 0x20
-    
-    @return rounded-up value
-*/
-inline TUint32 RoundUp(TUint32 aVal, TUint32 aGranularityLog2)
-    {
-    ASSERT(aGranularityLog2 < 32);
-                                         
-    if( (aVal & ((1<<aGranularityLog2)-1)) == 0)
-        return aVal;    
-
-    aVal >>= aGranularityLog2;
-    aVal++;
-    aVal <<= aGranularityLog2;
-
-    return aVal;
-    }
-
-//-----------------------------------------------------------------------------
-
-/**
-    @return Boolean exclusive OR between a1 and a2
-    This function should be used on C-style TBool, which is, actually TInt type; Its '0' value means "False" and _any_ non-zero means "True"
-    E.g: BoolXor(0x17, 0x4a) == EFalse;
-*/
-TBool BoolXOR(TBool a1, TBool a2)
-    {
-    if(!a1 && !a2)        
-        return EFalse;
-    else if(a1 && a2)
-        return EFalse;
-    else
-        return ETrue;
-    }
-
-//-----------------------------------------------------------------------------
-
-/**
-    Calculates the log2 of a number
-    This is the explicitly inlined version. Extensive using it may result in a code bloat.
-
-    @param aNum Number to calulate the log two of
-    @return The log two of the number passed in
-*/
-inline TUint32 Log2_inline(TUint32 aVal)
-    {
-    __ASSERT_COMPILE(sizeof(TUint32) == 4);
-    ASSERT(aVal);
-
-    TUint32 bitPos=31;
-
-    if(!(aVal >> 16)) {bitPos-=16; aVal<<=16;}
-    if(!(aVal >> 24)) {bitPos-=8;  aVal<<=8 ;}
-    if(!(aVal >> 28)) {bitPos-=4;  aVal<<=4 ;}
-    if(!(aVal >> 30)) {bitPos-=2;  aVal<<=2 ;}
-    if(!(aVal >> 31)) {bitPos-=1;}
-    
-    return bitPos;
-    }
-
-
-//-----------------------------------------------------------------------------
-/**
-    Calculates number of '1' bits in the aVal
-    This is the explicitly inlined version. Extensive using it may result in a code bloat.
-
-    @param aVal some value
-    @return number of '1' bits in the aVal
-*/
-inline TUint32 Count1Bits_inline(TUint32 aVal)
-    {
-    if(!aVal)
-        return 0;
-
-    if(aVal == 0xFFFFFFFF)
-        return 32;
-
-    aVal = aVal - ((aVal >> 1) & 0x55555555);
-    aVal = (aVal & 0x33333333) + ((aVal >> 2) & 0x33333333);
-    aVal = (aVal + (aVal >> 4)) & 0x0f0f0f0f;
-    aVal = aVal + (aVal >> 8);
-    aVal = aVal + (aVal >> 16);
-
-    return aVal & 0x3f;
-    }
-
-
-
-
-
-
-#endif //__FILESYSTEM_UTILS_INL__
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/userlibandfileserver/fileserver/sfat32/common_constants.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/common_constants.h	Mon Jan 18 21:31:10 2010 +0200
@@ -87,6 +87,9 @@
 //-- define this macro in order to enable the DEMAND PAGING DIRECTORY CACHE.
 #define USE_DP_DIR_CACHE
 
+//-- define this macro in order to use "Rummage Dirictory Cache" feature: searching for the entry in the cache first
+#define USE_DIR_CACHE_RUMMAGE
+
 //-----------------------------------------------------------------------------
 
 typedef TUint32 TLinAddr;
@@ -142,30 +145,26 @@
 	EFatBadStdFormatName,           // 5
 	EFatBadDosFormatName,           // 6
 	EFatCorrupt,                    // 7
-	EFatChkDskIllegalClusterNumber, // 8
-	EFatChkDskClusterAlreadyInUse,  // 9
-	EFatChkDskBadCluster,           // 10
-	EFatChkDskInvalidEntrySize,     // 11
-	EFatFilePosBeyondEnd,			// 12
-	EFatFileSeekIndexTooSmall,      // 13
-	EFatFileSeekIndexTooSmall2,     // 14
-	ELruCacheBadGranularity,        // 15
-	EFatRawReadTooBig,              // 16
-	EFatReadUidFailed,              // 17
-	ELruCacheFlushNotSupported,     // 18
-	EReadFileSectionFailed,         // 19
-	EBadReplacementForUnconvertibleUnicodeCharacters, // 20
+	EFatFilePosBeyondEnd,			// 8 
+	EFatFileSeekIndexTooSmall,      // 9 
+	EFatFileSeekIndexTooSmall2,     // 10
+	ELruCacheBadGranularity,        // 11
+	EFatRawReadTooBig,              // 12
+	EFatReadUidFailed,              // 13
+	ELruCacheFlushNotSupported,     // 14
+	EReadFileSectionFailed,         // 15
+	EBadReplacementForUnconvertibleUnicodeCharacters, // 16
 
-    EFatRAMDriveSizeInvalid,        // 21
-	EFatRAMDriveFreeInvalid,        // 22
-    ECheckFatIndexZero,             // 23
+    EFatRAMDriveSizeInvalid,        // 17
+	EFatRAMDriveFreeInvalid,        // 18
+    ECheckFatIndexZero,             // 19
 
-    EFatCache_BadGranularity,       // 24
-    EFatCache_DiscardingDirtyData,  // 25
-    EFatCache_NotImplemented,       // 26
-    EFatCache_BadFatType,           // 27
+    EFatCache_BadGranularity,       // 20
+    EFatCache_DiscardingDirtyData,  // 21
+    EFatCache_NotImplemented,       // 22
+    EFatCache_BadFatType,           // 23
 
-    EFatTable_InvalidIndex,         // 28
+    EFatTable_InvalidIndex,         // 24
 
 	};
 
--- a/userlibandfileserver/fileserver/sfat32/efat32.mmp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/efat32.mmp	Mon Jan 18 21:31:10 2010 +0200
@@ -21,6 +21,8 @@
 
 USERINCLUDE     ../sfile
 USERINCLUDE     ../inc
+USERINCLUDE     ../fs_utils
+
 USERINCLUDE     ../sfat32
 USERINCLUDE     ../sfat32/inc
 
@@ -36,6 +38,9 @@
 SOURCE          sl_scan32.cpp sl_mnt32.cpp
 SOURCE          sl_fatcache32.cpp
 
+SOURCEPATH      ../fs_utils
+SOURCE			filesystem_utils.cpp bit_vector.cpp
+
 SOURCEPATH      .
 DOCUMENT        ../group/release.txt
 
--- a/userlibandfileserver/fileserver/sfat32/fat_table32.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/fat_table32.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -1761,7 +1761,7 @@
 */
 void CFatTable::WriteFatEntryEofL(TUint32 aFatIndex)
 	{
-	__PRINT1(_L("CAtaFatTable::WriteFatEntryEofL(%d)"), aFatIndex);
+	__PRINT1(_L("CFatTable::WriteFatEntryEofL(%d)"), aFatIndex);
 
     //-- use EOF_32Bit (0x0fffffff) for all types of FAT, FAT cache will mask it appropriately
     WriteL(aFatIndex, EOF_32Bit);
--- a/userlibandfileserver/fileserver/sfat32/filesystem_fat.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/filesystem_fat.h	Mon Jan 18 21:31:10 2010 +0200
@@ -117,8 +117,8 @@
         {
         KOffsetSubType =0,  //-- 0
         KOffsetReservedSec, //-- 1
-        KOffsetSpc,         //-- 2
-        KOffsetNumFATs,     //-- 3
+        KOffsetSpc,         //-- 2  !! do not change this offset. 
+        KOffsetNumFATs,     //-- 3  !! do not change this offset. 
         
         };
 
@@ -141,6 +141,9 @@
 TVolFormatParam_FAT::TVolFormatParam_FAT() : TVolFormatParam() 
     {
      __ASSERT_COMPILE(sizeof(TVolFormatParam_FAT) == sizeof(TVolFormatParam));
+     __ASSERT_COMPILE(KOffsetSpc == 2);
+     __ASSERT_COMPILE(KOffsetNumFATs == 3);
+     
      Init();
     }
 
--- a/userlibandfileserver/fileserver/sfat32/inc/fat_table32.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/inc/fat_table32.h	Mon Jan 18 21:31:10 2010 +0200
@@ -161,6 +161,7 @@
     void FreeClusterListL(TUint32 aCluster);
     TUint32 AllocateSingleClusterL(TUint32 aNearestCluster);
     void ExtendClusterListL(TUint32 aNumber,TInt& aCluster);
+    TUint32 AllocateClusterListL(TUint32 aNumber,TUint32 aNearestCluster);
 
 private:
     CRamFatTable(CFatMountCB& aOwner);
--- a/userlibandfileserver/fileserver/sfat32/inc/sl_scandrv.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/inc/sl_scandrv.h	Mon Jan 18 21:31:10 2010 +0200
@@ -27,12 +27,10 @@
 
 //---------------------------------------------------------------------------------------------------------------------------------
 
-const TInt KMaxMatchingEntries		= 2;        ///< Maximum number of matching directory entries scan drive can fix. Any more indicates a fault in the file system
-const TInt KMaxArrayDepth			= 6;        ///< Maximum array depth for cluster storage when KMaxScanDepth is reached
+const TUint KMaxMatchingEntries		= 2;        ///< Maximum number of matching directory entries scan drive can fix. Any more indicates a fault in the file system
+const TUint KMaxArrayDepth			= 6;        ///< Maximum array depth for cluster storage when KMaxScanDepth is reached
 
-/**
-Data structure used to store the location of a partial VFat entry
-*/
+/** Data structure used to store the location of a partial VFat entry */
 struct TPartVFatEntry
 	{
 	TEntryPos    iEntryPos; ///< The position of the partial VFat entry
@@ -40,29 +38,33 @@
 	};
 
 
-/**
-Data structure used to store the locations of entries with matching
-start cluster numbers. 
-*/
+/** Data structure used to store the locations of entries with matching start cluster numbers. */
 struct TMatchingStartCluster
 	{
 	TEntryPos   iEntries[KMaxMatchingEntries]; ///< The positions of the matching entries
-	TInt        iCount;         ///< Count of matching entries
-	TInt        iStartCluster;  ///< The matching cluster number found in more than one entry
+	TUint       iCount;         ///< Count of matching entries
+	TUint       iStartCluster;  ///< The matching cluster number found in more than one entry
 	};
 
+
+//---------------------------------------------------------------------------------------------------------------------------------
 /**
-Scan drive class performs scan drive functionality on all types
-of fat volume.
+    This class is used for checking volume for FS errors and fixing a limited set of FS artefacts introduced by Rugged FAT on write failures.
+    It can operate in 2 modes:
+    
+    1. "ScanDrive" mode, scan whole volume for possible Rugged FAT artefacts and fix them if possible. 
+        1.1 If there was no problem at all, then StartL() finishes normally and ProblemsDiscovered() returns ENoErrors.
+        1.2 If there was Rugged FAT artefact and it had been successfully fixed, StartL() finishes normally and ProblemsDiscovered() returns EScanDriveDirError.
+            In this case the client may perform volum remounting, because FAT is very likely to have been changed.
+        1.3 If there was a fatal error, like media failure or unfixable FS problem, StartL() will leave with some generic error code.
+
+    2.  "CheckDisk" mode. check file system for known artefacts and return an error if _any_ problem discovered.
+        In this case StartL() _may_ leave with something like KErrCorrupt if there was a media failure or scan has stumbled across unknown FS error, 
+        ProblemsDiscovered() _may_ return some code describing the problem. If StartL() did not leave, but ProblemsDiscovered() returns a code different 
+        from ENoErrors, this means that there is FS corruption. 
 */
 class CScanDrive : public CBase
 	{
-public:
-	/**
-	Error type found by scan drive, only a single error should occur in 
-	any scan of the volume
-	*/
-	enum TDirError{EScanMatchingEntry=1,EScanPartEntry, ETruncation};
 
 public:
 
@@ -70,40 +72,63 @@
 	static CScanDrive* NewL(CFatMountCB* aMount);
 	void ConstructL(CFatMountCB* aMount);
 
-	TInt  StartL();
-    TBool ProblemsDiscovered() const;  
+public:
+
+    /** description of known problems that this scanned can deal with. Mostly used in "CheckDisk " mode */
+    enum TGenericError
+        {
+        ENoErrors = 0,          ///< 0  no errors discovered
+        EBadClusterNumber,      ///< 1  cluster number that doesn't correspond to the max. amount of clusters on the volume
+        EClusterAlreadyInUse,   ///< 2  cross-linked cluster chain
+        EBadClusterValue,       ///< 3  also means "lost cluster"
+        EInvalidEntrySize,      ///< 4  size of file/directory does not correspond to the cluster chain length
+        
+        EUnknownError = 95,     ///< unknown error
 
+        EScanDriveDirError=100  ///< 100 ScanDrive error
+        };
+
+    TGenericError ProblemsDiscovered() const;
+
+	/** CScanDrive mode of operation */
+    enum TScanDriveMode
+        {
+        EScanAndFix, ///< "ScanDrive" mode, scan whole volume for possible Rugged FAT artefacts and fix them
+        ECheckDisk,  ///< "CheckDisk" mode. check file system for known artefacts and return an error if _any_ problem discovered
+        };
+    
+    void StartL(TScanDriveMode aMode);
 
 private:
-#if defined(DEBUG_SCANDRIVE)
 	void PrintErrors();
-	void CompareFatsL() const;
-#endif
-	void FixupDirErrorL();
+	void CompareFatsL(TBool aStopOnFirstErrorFound) ;
+	void CompareAndFixFatsL();
+
+    void FixupDirErrorL();
 
 	void ReadMediaFatL();
     void DoParseFatL();
     void DoParseFat32L();
     void DoParseFat32Buf(const TPtrC8& aBuf, TUint32& aCurrFatEntry);
 
-	TBool AlreadyUsedL(TUint aCluster) const;
-	void SetUsedL(TUint aCluster);
+	TBool IsClusterUsedL(TUint aCluster);
+	void MarkClusterUsedL(TUint aCluster);
 
-	TUint32 ReadFatL(TInt aClusterNum) const;
+	TUint32 ReadFatL(TUint aClusterNum) ;
 	void FindSameStartClusterL();
 	TInt FindStartClusterL(TInt aDirCluster);
 	void CheckDirStructureL();
-	void CheckDirL(TInt aCluster);
+	void CheckDirL(TUint32 aCluster);
 	void ProcessEntryL(const TFatDirEntry& aEntry);
 	TInt CheckEntryClusterL(const TFatDirEntry& aEntry, const TEntryPos& aEntryPos);
-	void WriteClusterChainL(TInt aCluster,TUint aSizeInBytes);
+	void RecordClusterChainL(TInt aCluster,TUint aSizeInBytes);
 	TBool MoveToVFatEndL(TEntryPos& aPos,TFatDirEntry& aEntry,TInt& aDirLength);
 	TBool IsValidVFatEntry(const TFatDirEntry& aEntry,TInt prevNum)const;
 	TBool IsDosEntry(const TFatDirEntry& aEntry)const;
 	void AddPartialVFatL(const TEntryPos& aStartPos, const TFatDirEntry& aEntry);
 	TBool AddMatchingEntryL(const TEntryPos& aEntryPos);
 	TInt GetReservedidL(const TEntryPos aVFatPos);
-	void WriteNewFatsL();
+	
 	void FixPartEntryL();
 	void FixMatchingEntryL();
 	void MovePastEntriesL(TEntryPos& aEntryPos,TFatDirEntry& aEntry,TInt aToMove,TInt& aDirEntries);
@@ -115,23 +140,44 @@
 	void MoveToNextEntryL(TEntryPos& aPos);
 	void ReadDirEntryL(const TEntryPos& aPos,TFatDirEntry& aDirEntry);
 
-    void IndicateErrorsFound();
+    inline void IndicateErrorsFound(TGenericError aError);
+    inline TUint32 MaxClusters() const;
+    inline TBool CheckDiskMode() const;
+
+protected:
+	
+    /**
+    Internal ScanDrive mode specific errors. In Rugged FAT mode (current implementatio) any type of error of this kind can occur only once and it will be fixed.
+    Othersise the FS is considered to be corrupted
+    */
+    enum TDirError 
+        {
+        ENoDirError= 0,         ///< no errors found
+        EScanMatchingEntry=1,   ///< Two entries pointing to the same cluster chain; Rugged FAT rename/replace artefact
+        EScanPartEntry,         ///< Deleted DOS entry and orphaned VFAT ones from the same entryset; Rugged FAT 'file/dir delete' artefact
+        };
+
 
 private:
 	CFatMountCB*            iMount;             ///< The owning Fat mount
-	TPartVFatEntry          iPartEntry;         ///< Storage for a partial VFat entry set error
-	TMatchingStartCluster   iMatching;          ///< Storage for Matching start cluster error
-	TDirError               iDirError;          ///< Indicates the error tpye found also used to indicate if an error has occured
-	TInt                    iDirsChecked;       ///< Count of the number of directories checked
+	
+    TPartVFatEntry          iPartEntry;         ///< Storage for a partial VFat entry set error, see EScanPartEntry
+	TMatchingStartCluster   iMatching;          ///< Storage for Matching start cluster error, see EScanMatchingEntry
+	
+    TDirError               iDirError;          ///< Indicates the error tpye found also used to indicate if an error has occured
+    TInt                    iDirsChecked;       ///< Count of the number of directories checked
 	TInt                    iRecursiveDepth;    ///< Depth of recursion the scan has reached
 	RArray<TInt>*           iClusterListArray[KMaxArrayDepth]; ///< Size in bytes of the bit packed Fat	Cluster list array used when maximum depth has been reached so that directory may be re-visited. Avoid stack overflow
-	TInt                    iListArrayIndex;    ///< Current position into cluster list array
-	TInt                    iTruncationCluster; ///< Cluster at which cluster chain truncation should take place, used for truncation errors
 	
-    TBool                   iFoundProblems; ///< if ETrue after finish, it means that there where some problems FS structure and they were probably fixed;
-    RBitVector              iMediaFatBits;  ///< Storage for bit packed Fat read from media 
-    RBitVector              iScanFatBits;   ///< Storage for bit packed Fat built up by the scan
+    TUint                   iListArrayIndex;    ///< Current position into cluster list array
+	TUint32                 iTruncationCluster; ///< Cluster at which cluster chain truncation should take place, used for truncation errors
+	TUint32                 iMaxClusters;       ///< Max. amount of clusters on the volume
 
+    RBitVector              iMediaFatBits;      ///< Storage for bit packed Fat read from media 
+    RBitVector              iScanFatBits;       ///< Storage for bit packed Fat built up by the scan
+
+    TGenericError           iGenericError;      ///< FS error that is discovered by scanning in any mode  
+    TScanDriveMode          iScanDriveMode;     ///< mode of operation
 	};
 
 
--- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.h	Mon Jan 18 21:31:10 2010 +0200
@@ -31,14 +31,17 @@
 #include <f32ver.h>
 #include <e32svr.h>
 #include <kernel/localise.h>
+
 #include "filesystem_fat.h"
+using namespace FileSystem_FAT;
 
 #include "common_constants.h"
 #include "sl_bpb.h"
 #include "fat_config.h"
 #include "fat_dir_entry.h"
+#include "bit_vector.h"
 
-using namespace FileSystem_FAT;
+
 
 #ifdef _DEBUG
 _LIT(KThisFsyName,"EFAT32.FSY"); ///< This FSY name
@@ -719,11 +722,6 @@
 
 private:
 	
-    TBool ValidClusterNumber(TUint32 aCluster) const;
-    void  CheckUnvisitedClustersL(const RBitVector& aFatBitVec) const;
-	TInt  WalkClusterListL(RBitVector& aFatBitVec, TInt aCluster);
-	void  ChkEntryL(RBitVector& aFatBitVec, const TFatDirEntry& anEntry);
-	void  ChkDirL(RBitVector& aFatBitVec, TInt aDirCluster);
 
 	CFatMountCB();
 
@@ -1001,17 +999,6 @@
 	};
 //
 
-TPtrC RemoveTrailingDots(const TDesC& aName);
-
-/**
-Calculates the log2 of a number
-
-@param aNum Number to calulate the log two of
-@return The log two of the number passed in
-*/
-TUint32 Log2(TUint32 aVal);
-
-
 /**
 Converts Dos time (from a directory entry) to TTime format
 
@@ -1072,103 +1059,6 @@
 TUint32 EocCodeByFatType(TFatType aFatType);
 
 
-
-//-----------------------------------------------------------------------------
-
-/**
-    This class represents a bit vector i.e. an array of bits. Vector size can be 1..2^32 bits.
-*/
-class RBitVector
-    {
- public:
-    
-    RBitVector(); //-- Creates an empty vector. see Create() methods for memory allocation
-   ~RBitVector(); 
-    
-    void Close(); 
-    
-    TInt Create(TUint32 aNumBits);
-    void CreateL(TUint32 aNumBits);
-
-    inline TUint32 Size() const;
-
-    //-- single bit manipulation methods
-    inline TBool operator[](TUint32 aIndex) const;
-    inline void SetBit(TUint32 aIndex);
-    inline void ResetBit(TUint32 aIndex);
-    inline void InvertBit(TUint32 aIndex);
-    inline void SetBitVal(TUint32 aIndex, TBool aVal);
-    
-    void Fill(TBool aVal);
-    void Fill(TUint32 aIndexFrom, TUint32 aIndexTo, TBool aVal);
-
-    void Invert();
-   
-    TBool operator==(const RBitVector& aRhs) const; 
-    TBool operator!=(const RBitVector& aRhs) const;
-
-    //-- logical operations between 2 vectors. 
-    void And(const RBitVector& aRhs);
-    void Or (const RBitVector& aRhs);
-    void Xor(const RBitVector& aRhs);
-
-    TBool Diff(const RBitVector& aRhs, TUint32& aDiffIndex) const;
-
-    /** Bit search specifiers */
-    enum TFindDirection
-        {
-        ELeft,      ///< Search from the given position to the left (towards lower index)
-        ERight,     ///< Search from the given position to the right (towards higher index)
-        ENearestL,  ///< Search in both directions starting from the given position; in the case of the equal distances return the position to the left
-        ENearestR   ///< Search in both directions starting from the given position; in the case of the equal distances return the position to the right
-
-        //-- N.B the current position the search starts with isn't included to the search.
-        };
-
-    TBool Find(TUint32& aStartPos, TBool aBitVal, TFindDirection aDir) const;
-
-    /** panic codes */
-    enum TPanicCode
-        {
-        EIndexOutOfRange,       ///< index out of range
-        EWrondFindDirection,    ///< a value doesn't belong to TFindDirection
-        ESizeMismatch,          ///< Size mismatch for binary operators
-        ENotInitialised,        ///< No memory allocated for the array
-        ENotImplemented,        ///< functionality isn't implemented
-        };
-
- protected:
-    
-    //-- these are outlawed. Can't use them because memory allocator can leave and we don't have conthrol on it  in these methods. 
-    RBitVector(const RBitVector& aRhs);            
-    RBitVector& operator=(const RBitVector& aRhs); 
-  
-    void Panic(TPanicCode aPanicCode) const;
-
-    inline TUint32 WordNum(TUint32 aBitPos)  const;
-    inline TUint32 BitInWord(TUint32 aBitPos) const;
-
- private:
-    TBool FindToRight(TUint32& aStartPos, TBool aBitVal) const;
-    TBool FindToLeft (TUint32& aStartPos, TBool aBitVal) const;
-    TBool FindNearest(TUint32& aStartPos, TBool aBitVal, TBool aToLeft) const;
-   
-    inline TUint32 MaskLastWord(TUint32 aVal) const; 
-    inline TBool ItrLeft(TUint32& aIdx) const;
-    inline TBool ItrRight(TUint32& aIdx) const;
-
-
- protected:
-
-    TUint32   iNumBits; ///< number of bits in the vector
-    TUint32*  ipData;   ///< pointer to the data 
-    TUint32   iNumWords;///< number of 32-bit words that store bits
-    };
-
-
-//-----------------------------------------------------------------------------
-
-
 #include "sl_std.inl"
 #include "sl_bpb.inl"
 #include "fat_dir_entry.inl"
--- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl	Mon Jan 18 21:31:10 2010 +0200
@@ -535,91 +535,6 @@
     }
 
 //---------------------------------------------------------------------------------------------------------------------------------	
-//-- class RBitVector
-
-/** @return size of the vector (number of bits) */
-inline TUint32 RBitVector::Size() const
-    {
-    return iNumBits;
-    } 
-
-/**
-    Get a bit by index
-    
-    @param aIndex  index in a bit vector
-    @return 0 if the bit at pos aIndex is 0, not zero otherwise
-    @panic EIndexOutOfRange if aIndex is out of range
-*/
-inline TBool RBitVector::operator[](TUint32 aIndex) const
-    {
-    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
-    return (ipData[WordNum(aIndex)] & (1<<BitInWord(aIndex)));
-    }
-
-/**
-    Set a bit at pos aIndex to '1'
-    @param aIndex  index in a bit vector
-    @panic EIndexOutOfRange if aIndex is out of range
-*/
-inline void RBitVector::SetBit(TUint32 aIndex)
-    {
-    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
-    ipData[WordNum(aIndex)] |= (1<<BitInWord(aIndex));
-    }
-
-/**
-    Set a bit at pos aIndex to '0'
-    @param aIndex  index in a bit vector
-    @panic EIndexOutOfRange if aIndex is out of range
-*/
-inline void RBitVector::ResetBit(TUint32 aIndex)
-    {
-    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
-    ipData[WordNum(aIndex)] &= ~(1<<BitInWord(aIndex));
-    }
-
-/**
-    Invert a bit at pos aIndex
-    @param aIndex  index in a bit vector
-    @panic EIndexOutOfRange if aIndex is out of range
-*/
-inline void RBitVector::InvertBit(TUint32 aIndex)
-    {
-    __ASSERT_ALWAYS(aIndex < iNumBits, Panic(EIndexOutOfRange));
-    ipData[WordNum(aIndex)] ^= (1<<BitInWord(aIndex));
-    }
-
-/**
-    Set bit value at position aIndex
-    @param aIndex  index in a bit vector
-    @panic EIndexOutOfRange if aIndex is out of range
-*/
-inline void RBitVector::SetBitVal(TUint32 aIndex, TBool aVal)
-    {
-    if(aVal) 
-        SetBit(aIndex);
-    else 
-        ResetBit(aIndex);
-    }
-
-
-inline TUint32 RBitVector::MaskLastWord(TUint32 aVal) const
-    {
-    const TUint32 shift = (32-(iNumBits & 0x1F)) & 0x1F;
-    return (aVal << shift) >> shift; //-- mask unused high bits
-    }
-
-
-
-inline TUint32 RBitVector::WordNum(TUint32 aBitPos)  const
-    {
-    return aBitPos >> 5;
-    }
-
-inline TUint32 RBitVector::BitInWord(TUint32 aBitPos) const 
-    {
-    return aBitPos & 0x1F;
-    }
 
 /**
     Calculate offset of the page starting position in the cluster 
--- a/userlibandfileserver/fileserver/sfat32/ram_fat_table32.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/ram_fat_table32.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -363,6 +363,47 @@
     return(aCluster<<iOwner->ClusterSizeLog2());
     }
 
+//-----------------------------------------------------------------------------
+
+/**
+    Allocate and link a cluster chain, leaves if there are not enough free clusters.
+    Chain starts as close as possible to aNearestCluster, last cluster will be marked as EOF.
+
+    @param aNumber Number of clusters to allocate
+    @param aNearestCluster Cluster the new chain should be nearest to
+    @leave System wide error codes
+    @return The first cluster number allocated
+*/
+TUint32 CRamFatTable::AllocateClusterListL(TUint32 aNumber, TUint32 aNearestCluster)
+	{
+    __PRINT2(_L("CRamFatTable::AllocateClusterList() N:%d,NearestCL:%d"),aNumber,aNearestCluster);
+	__ASSERT_DEBUG(aNumber>0, Fault(EFatBadParameter));
+
+	if(!RequestFreeClusters(aNumber))
+    	{
+		__PRINT(_L("CRamFatTable::AllocateClusterListL - leaving KErrDirFull"));
+		User::Leave(KErrDiskFull);
+		}
+
+	//-- if this leaves for some reason, there will be no lost clusters
+    TInt firstCluster = aNearestCluster = AllocateSingleClusterL(aNearestCluster);
+	
+    
+    if (aNumber>1)
+	    {//-- if this part leaves (e.g. fail to expand the RAM drive), we will need to handle the first allocated EOC
+    	TRAPD(nRes, ExtendClusterListL(aNumber-1, (TInt&)aNearestCluster));
+        if(nRes != KErrNone)
+            {
+            __PRINT1(_L("CRamFatTable::AllocateClusterListL:ExtendClusterListL() failed with %d") ,nRes);
+            FreeClusterListL(firstCluster); //-- clean up EOC in firstCluster
+            User::Leave(nRes);
+            }
+        }
+
+
+    return firstCluster;
+	}	
+
 /**
 Allocate and mark as EOF a single cluster as close as possible to aNearestCluster,
 calls base class implementation but must Enlarge the RAM drive first. Allocated cluster RAM area will be zero-filled.
@@ -392,7 +433,7 @@
 */
 void CRamFatTable::ExtendClusterListL(TUint32 aNumber, TInt& aCluster)
     {
-    __PRINT(_L("CRamFatTable::ExtendClusterListL"));
+    __PRINT2(_L("CRamFatTable::ExtendClusterListL(%d, %d)"), aNumber, aCluster);
     __ASSERT_DEBUG(aNumber>0,Fault(EFatBadParameter));
 
     iOwner->EnlargeL(aNumber<<iOwner->ClusterSizeLog2());
--- a/userlibandfileserver/fileserver/sfat32/sl_fatcache.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache.h	Mon Jan 18 21:31:10 2010 +0200
@@ -28,25 +28,6 @@
 
 //-----------------------------------------------------------------------------
 
-/**
-    A simple abstraction of the 32 bit flags
-*/
-class T32Bits
-{
- public:
-    T32Bits() : iData(0) {}
-
-    inline void  Clear();
-    inline TBool HasBitsSet() const;
-    inline void SetBit(TUint32 aIndex);
-    inline TBool operator[](TUint32 aIndex) const;
-
- private:
-    TUint32 iData; ///< 32 bits data
-};
-
-//-----------------------------------------------------------------------------
-
 class CFatBitCache;
 
 /**
--- a/userlibandfileserver/fileserver/sfat32/sl_fatcache.inl	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache.inl	Mon Jan 18 21:31:10 2010 +0200
@@ -23,36 +23,6 @@
 #define SL_FAT_CACHE_INL
 
 
-//-----------------------------------------------------------------------------
-
-/** clear all bits */
-void T32Bits::Clear()
-    {
-    iData = 0;
-    }
-
-/** @return non-0 if at least one of 32 bits is set to '1' */
-TBool T32Bits::HasBitsSet() const 
-    {
-    return iData;
-    } 
-
-/** sets bit number "aIndex" to '1' */
-void T32Bits::SetBit(TUint32 aIndex)
-    {
-    ASSERT(aIndex < 32);
-    iData |= (1<<aIndex);
-    }
-
-/** 
-    Get value of the bit number "aIndex". 
-    @return 0 if the bit aIndex is '0' non-zero otherwise
-*/
-TBool T32Bits::operator[](TUint32 aIndex) const
-    {
-    ASSERT(aIndex < 32);
-    return (iData & (1<<aIndex));
-    }
 
 
 //-----------------------------------------------------------------------------
--- a/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -29,9 +29,6 @@
 
 TShortName DoGenerateShortNameL(const TDesC& aLongName,TInt& aNum,TBool aUseTildeSelectively);
 
-static void  MarkClusterVisited(RBitVector& aFatBitVec, TUint32 aCluster);
-static TBool IsClusterVisited(const RBitVector& aFatBitVec, TUint32 aCluster);
-static TInt  NextUnvisitedCluster(const RBitVector& aFatBitVec, TUint32 aCluster);
 
 //-----------------------------------------------------------------------------------------
 
@@ -2507,7 +2504,8 @@
     //-- while directory cache pages are. For FAT32 it doesn't matter, because root dir is a usual file.
     
     //-- the "rummage dir. cache" can be swithed off. This is not affecting the functionality, only the performance.
- #if 1
+ #ifdef USE_DIR_CACHE_RUMMAGE
+                                                                 
     if(iRawDisk->DirCacheInterface() && trgNameFullySpecified && !IsRootDir(aDosEntryPos) && !aFileCreationHelper)
         {//-- aName is fully specified, i.e doesn't contain wildcards
 
@@ -4122,10 +4120,12 @@
     TRAPD(err,GetDosEntryFromNameL(aName,dosEntryPos,dosEntry));
     if(err!=KErrNone)
         return err;
+
     TInt startCluster=StartCluster(dosEntry);
     // Empty files will return a cluster of zero
     if(startCluster==0)
         return KErrEof;
+
     aUniqueId=MAKE_TINT64(0,startCluster);
     return KErrNone;
     }
@@ -4149,154 +4149,10 @@
 
 //-----------------------------------------------------------------------------------------
 
-//-- maximal level of recursion for the CheckDisk. i.e. the max. number of folded directories to check.
-const TInt KCheckDskMaxRecursionLevel = 50;
-
-//
-// Walks a directory cluster list then checks all the entries.
-//
-void  CFatMountCB::ChkDirL(RBitVector& aFatBitVec, TInt aDirCluster)
-    {
-    //__PRINT1(_L("### CFatMountCB::ChkDirL() level:%d"),iChkDiscRecLevel);
-
-    //-- check if we have reached the recursion limit. on hardware the stack is very limited
-    //-- and its overflow will lead to crash.
-    if(iChkDiscRecLevel++ >= KCheckDskMaxRecursionLevel)
-        {
-         __PRINT1(_L("CFatMountCB::ChkDirL() max recursion level(%d) reached. Leaving!"),iChkDiscRecLevel);
-         User::Leave(KErrTooBig);
-        }
-
-    if(/*Is32BitFat() &&*/aDirCluster != 0 && (aDirCluster == RootIndicator()))//the bit in comments maybe required
-        WalkClusterListL(aFatBitVec, RootIndicator());
-
-    TEntryPos entryPos(aDirCluster,0);
-    FOREVER
-        {
-        TFatDirEntry entry;
-        ReadDirEntryL(entryPos,entry);
-        MoveToDosEntryL(entryPos,entry);
-        if (entry.IsEndOfDirectory())
-            break;
-        if (IsRootDir(entryPos)&&(StartOfRootDirInBytes()+entryPos.iPos==(RootDirEnd()-KSizeOfFatDirEntry)))
-            {
-            if(!entry.IsErased())
-                ChkEntryL(aFatBitVec, entry);
-            break;  //  Allows maximum number of entries in root directory
-            }
-        MoveToNextEntryL(entryPos);
-        if (entry.IsParentDirectory() || entry.IsCurrentDirectory() || entry.IsErased())
-            continue;
-        ChkEntryL(aFatBitVec, entry);
-        }
-
-    iChkDiscRecLevel--;
-    }
-
-//-----------------------------------------------------------------------------------------
-
-//
-// Check FAT is valid for anEntry
-//
-void  CFatMountCB::ChkEntryL(RBitVector& aFatBitVec, const TFatDirEntry& anEntry)
-    {
-    TInt listLength=0;
-
-    if ((anEntry.Attributes()&(KEntryAttDir)) || anEntry.Size())
-        listLength=WalkClusterListL(aFatBitVec, StartCluster(anEntry));
-    else if (anEntry.StartCluster() != 0)        // zero length file
-        User::Leave(EFatChkDskInvalidEntrySize); // shouldn't have clusters
-
-    if (anEntry.Attributes()&KEntryAttDir)
-        ChkDirL(aFatBitVec, StartCluster(anEntry));
-
-    //  Check that the correct number of clusters have been allocated for the size of the file.
-
-    else if ((anEntry.Attributes()&KEntryAttVolume)==0)
-        {
-        TInt clustersForFileSize;
-        TInt clusterSize=1<<ClusterSizeLog2();
-        clustersForFileSize = (TInt) ( (TInt64(anEntry.Size()) + TInt64(clusterSize-1)) >> ClusterSizeLog2() );
-
-        if (listLength!=clustersForFileSize)
-            User::Leave(EFatChkDskInvalidEntrySize);
-        }
-    }
-
-//-----------------------------------------------------------------------------------------
-
-//
-// Walks cluster list from aCluster to EOF
-// Reports an error if an invalid cluster is found before EOF or
-// a cluster has been visited before.
-//
-TInt  CFatMountCB::WalkClusterListL(RBitVector& aFatBitVec, TInt aCluster)
-    {
-
-    TInt i=0;
-    do  {
-        i++;
-        if (!ValidClusterNumber(aCluster))
-            {
-            __PRINT1(_L("Bad Cluster number %d"),aCluster);
-            User::Leave(EFatChkDskIllegalClusterNumber);
-            }
-
-        if (IsClusterVisited(aFatBitVec, aCluster))
-            {
-            __PRINT1(_L("Cluster already in use %d"),aCluster);
-            User::Leave(EFatChkDskClusterAlreadyInUse);
-            }
-
-        MarkClusterVisited(aFatBitVec, aCluster);
-
-        } while (FAT().GetNextClusterL(aCluster));
-
-    return(i);
-    }
-
-//-----------------------------------------------------------------------------------------
-
-//
-// Checks that all unvisited clusters are marked as free in the FAT
-//
-void  CFatMountCB::CheckUnvisitedClustersL(const RBitVector& aFatBitVec) const
-    {
-
-    TInt cluster=2;
-    TInt maxCluster=cluster + UsableClusters();
-    while (cluster<maxCluster)
-        {
-        cluster=NextUnvisitedCluster(aFatBitVec, cluster); //-- move to the next unvisited cluster
-        if(cluster < 0 || cluster >= maxCluster)
-            break;
-
-        TInt clusterVal=FAT().ReadL(cluster);
-        if (clusterVal!=0 && IsEndOfClusterCh(clusterVal)==EFalse && !IsBadCluster(clusterVal))
-            {
-            __PRINT1(_L("\n*****Bad cluster Num = %d"),cluster);
-            User::Leave(EFatChkDskBadCluster);
-            }
-        }
-    }
-
-//-----------------------------------------------------------------------------------------
-
-/**
-@param  aCluster cluster number to check for validity
-@returns ETrue if aCluster is a valid cluster number
+/** 
+    Check file system for errors. 
+    @return KErrNone if no errors found, otherwise a error code hopefully describing the problem found.
 */
-TBool CFatMountCB::ValidClusterNumber(TUint32 aCluster) const
-    {
-    return (aCluster>=KFatFirstSearchCluster && aCluster<=MaxClusterNumber());
-    }
-
-//-----------------------------------------------------------------------------------------
-
-//
-// Walk the FAT, returns error if find an unterminated list or
-// lists that merge.
-//
 TInt CFatMountCB::CheckDisk()
 	{
 
@@ -4307,10 +4163,6 @@
 
     //-- create a bit representation of the FAT
     const TUint32 MaxClusters = UsableClusters()+KFatFirstSearchCluster; //-- UsableClusters() doesn't count first 2 unused clusers
-
-
-    // cluster count may be zero if boot sector failed to be read (e.g. if the media is locked)
-    // or if TDrive::MountMedia(ETrue) has been called (in which case the boot sector may
     if (MaxClusters == 0)
         return KErrCorrupt;
 
@@ -4319,115 +4171,42 @@
     TTime   timeEnd;
     timeStart.UniversalTime(); //-- take start time
 
-
-    RBitVector bitVec; //-- each bit in this vector represents a FAT cluster
-
-    TInt nRes = bitVec.Create(MaxClusters);
+    TInt nRes;
+ 
+    CScanDrive* pScnDrv = NULL;
+    TRAP(nRes, pScnDrv=CScanDrive::NewL(this));
     if(nRes != KErrNone)
-        {
-        ASSERT(nRes == KErrNoMemory); //-- the only one possible reason.
-        return KErrNoMemory;
-        }
-
-    iChkDiscRecLevel = 0; //-- reset CheckDisk recursion counter
-    TRAPD(r,ChkDirL(bitVec, RootIndicator())); // Check from root directory
-    if (r==KErrNone)
-        {
-        TRAP(r,CheckUnvisitedClustersL(bitVec));
-        }
-
-
-    bitVec.Close();
-
+        return nRes;
+
+    //-- start ScanDrive in "checkdisk" mode
+    TRAPD(nScnDrvRes, pScnDrv->StartL(CScanDrive::ECheckDisk));
+    
     timeEnd.UniversalTime(); //-- take end time
     const TInt msScanTime = (TInt)( (timeEnd.MicroSecondsFrom(timeStart)).Int64() / K1mSec);
     (void)msScanTime;
-
     __PRINT1(_L("#@@@ CheckDisk() time taken:%d ms"), msScanTime);
-
-
-    switch(r)
+ 
+    CScanDrive::TGenericError chkDskRes = pScnDrv->ProblemsDiscovered();
+    const TBool bProblemsFound = (nScnDrvRes!=KErrNone) || pScnDrv->ProblemsDiscovered();
+    
+    if(bProblemsFound && chkDskRes == CScanDrive::ENoErrors)
+        {//-- ScanDrive in this mode can leave unexpectedly without setting an error code that is returned by ProblemsDiscovered();
+         //-- leave itself means a problem
+        chkDskRes = CScanDrive::EUnknownError;
+        }
+
+    delete pScnDrv;
+
+    if(chkDskRes != KErrNone)
         {
-
-    case KErrNone:
-        return KErrNone;
-
-    case EFatChkDskIllegalClusterNumber:
-        return(1);
-
-    case EFatChkDskClusterAlreadyInUse:
-        return(2);
-
-    case EFatChkDskBadCluster:
-        return(3);
-
-    case EFatChkDskInvalidEntrySize:
-        return(4);
-
-    default:
-        break;
+        __PRINT2(_L("CFatMountCB::CheckDisk() drv:%d, result:%d"), DriveNumber(), chkDskRes);
         }
-
-    return(r);
+    
+    return chkDskRes;
+
     }
 
 
-//-----------------------------------------------------------------------------------------
-//  Helper functions for Check Disk functionality
-//-----------------------------------------------------------------------------------------
-
-/**
-    Find the next unvisited cluster number in the bit array.
-
-    @param  aBitList    bit array, where '0' bits represent unvisited clusters.
-    @param  aCluster    cluster number to start search with.
-
-    @return positive integer indicating next unvisited cluster number
-            KErrNotFound (-1) if there are no unvisited clusters
-
-*/
-static TInt  NextUnvisitedCluster(const RBitVector& aFatBitVec, TUint32 aCluster)
-{
-    __ASSERT_DEBUG(aCluster >= KFatFirstSearchCluster, Fault(EFatChkDskIllegalClusterNumber)); //-- 1st 2 FAT entries are reserved
-
-    TUint32 searchPos = aCluster; //-- bit number to start search with
-
-    //-- look for the unvisited cluster (bit '0') in the bit array from the searchPos to the right
-    if(aFatBitVec.Find(searchPos, 0, RBitVector::ERight))
-        return searchPos;
-
-    return KErrNotFound;
-}
-
-
-/**
-    Check if we have visited cluster aCluster
-
-    @param  aFatBitVec  bit array, where '0' bits represent unvisited clusters.
-    @param  aCluster    cluster number to check
-    @return ETrue if aCluster has been visited.
-*/
-static TBool IsClusterVisited(const RBitVector& aFatBitVec, TUint32 aCluster)
-{
-    __ASSERT_DEBUG(aCluster >= KFatFirstSearchCluster, Fault(EFatChkDskIllegalClusterNumber)); //-- 1st 2 FAT entries are reserved
-
-    return aFatBitVec[aCluster];
-}
-
-/**
-    Mark aCluster as visited
-    @param  aFatBitVec  bit array, where '0' bits represent unvisited clusters.
-    @param  aCluster    cluster number to mark
-*/
-static void MarkClusterVisited(RBitVector& aFatBitVec, TUint32 aCluster)
-{
-    __ASSERT_DEBUG(aCluster >= KFatFirstSearchCluster, Fault(EFatChkDskIllegalClusterNumber)); //-- 1st 2 FAT entries are reserved
-
-    aFatBitVec.SetBit(aCluster); //-- '1' bit in a bit array means that the corresponding cluster is visited
-}
-
-
-
 //-------------------------------------------------------------------------------------------------------------------
 
 /**
@@ -4442,7 +4221,7 @@
     if(nRes != KErrNone)
         return nRes;
 
-    TRAPD(nScnDrvRes, pScnDrv->StartL());
+    TRAPD(nScnDrvRes, pScnDrv->StartL(CScanDrive::EScanAndFix));
 
     const TBool bNeedFatRemount = (nScnDrvRes!=KErrNone) || pScnDrv->ProblemsDiscovered();
     delete pScnDrv;
@@ -4459,7 +4238,7 @@
         return nScnDrvRes;
 
 
-    //-- if ScanDrive hasn't found anything wrong or has fixed recoverable erros, mark the volume clean
+    //-- if ScanDrive hasn't found anything wrong or has fixed recoverable errors, mark the volume clean
     if(VolCleanFlagSupported())
         {
         //-- if there is a background FAT scanning thread, we need to wait until it finishes its work.
--- a/userlibandfileserver/fileserver/sfat32/sl_scan32.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_scan32.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -21,37 +21,38 @@
  @internalTechnology
 */
 
-//#define DEBUG_SCANDRIVE
-
 #include "sl_std.h"
 #include "sl_scandrv.h"
 
+const TInt KMaxScanDepth			= 20;   ///< Maximum scan depth of to avoid stack over flow 
+const TInt KClusterListGranularity	= 8;    ///< Granularity of cluster list used for storage of clusters when KMaxScanDepth is reached
+
 
 
-const TInt KEndOfDirectory			= 0xFFFF;   ///< End of directory marker
-const TInt KMaxScanDepth			= 20;       ///< Maximum scan depth of to avoid stack over flow 
-const TInt KClusterListGranularity	= 8;        ///< Granularity of cluster list used for storage of clusters when KMaxScanDepth is reached
-
+/**
+    CScanDrive factory method
+    @param  aMount the owning mount
+*/
+CScanDrive* CScanDrive::NewL(CFatMountCB* aMount)
+	{
+	if(!aMount)
+		{
+        ASSERT(0);
+        User::Leave(KErrArgument);
+        }
 
-/**
-Creates a CScanDrive
-@param aMount The owning mount
-*/
- CScanDrive* CScanDrive::NewL(CFatMountCB* aMount)
-	{
-	if(aMount==NULL)
-		User::Leave(KErrArgument);
 	CScanDrive* self=new (ELeave) CScanDrive();
 	CleanupStack::PushL(self);
 	self->ConstructL(aMount);
 	CleanupStack::Pop();
-	return self;
+	
+    return self;
 	}
 
 
 CScanDrive::~CScanDrive()
 	{
-	for(TInt i=0;i<KMaxArrayDepth && iClusterListArray[i]!=NULL;++i)
+	for(TUint i=0; i<KMaxArrayDepth && iClusterListArray[i]!=NULL; ++i)
 		{
 		iClusterListArray[i]->Close();
 		delete iClusterListArray[i];
@@ -63,24 +64,28 @@
 	}
 
 /**
-Allocates the Cluster array, the bit packed Fats and if run in a seperate
-thread the extra CFatTable and cluster buffer
-
-@param aMount The owning mount
+    Creates the structure of this class.
+    @param aMount The owning mount
 */
 void CScanDrive::ConstructL(CFatMountCB* aMount)
     {
-	iMount=aMount;
+    ASSERT(aMount);
+
+    //--- setting up 
+    iMount=aMount;
+    iGenericError = ENoErrors;
+    iDirError     = ENoDirError;  
+    iMaxClusters  = iMount->UsableClusters()+KFatFirstSearchCluster; //-- UsableClusters() doesn't count first 2 unused clusers
+    //------------------------------
 	
-    //-- create bit vectors that will represent FAT on media and reconstructed by ScanDrive
-    //-- each bit in the vector represents 1 FAT cluster.
-    const TUint32 KClustersNum = iMount->UsableClusters()+KFatFirstSearchCluster; //-- UsableClusters() doesn't count first 2 unused clusers
-    
+    //-- create bit vectors that will represent FAT on media and reconstructed by ScanDrive. Each bit in the vector represents 1 FAT cluster.
+    const TUint32 KClustersNum = MaxClusters();
+
     CleanupClosePushL(iMediaFatBits);
     CleanupClosePushL(iScanFatBits);
 
     iMediaFatBits.CreateL(KClustersNum);
-    iScanFatBits.CreateL(KClustersNum);;
+    iScanFatBits.CreateL(KClustersNum);
 
     CleanupStack::Pop(&iScanFatBits);
     CleanupStack::Pop(&iMediaFatBits);
@@ -88,18 +93,18 @@
 
 //----------------------------------------------------------------------------------------------------
 /**
-    FAT type-agnnostic parser. Reads whole FAT and sets up a bit vector.
+    FAT type-agnostic parser. Reads whole FAT and sets up a bit vector.
     for FAT12/16 it's OK, because the FAT12/16 is fully cached.
 */
 void CScanDrive::DoParseFatL()
     {
-    const TInt MaxClusters = iMount->UsableClusters()+KFatFirstSearchCluster;
-    
-
+    const TInt KMaxClusters = MaxClusters();
 
     iMediaFatBits.Fill(0);
 
-    for(TInt i=KFatFirstSearchCluster; i<MaxClusters; ++i)
+    __PRINT1(_L("CScanDrive::DoParseFatL(), clusters:%d"), KMaxClusters);
+
+    for(TInt i=KFatFirstSearchCluster; i<KMaxClusters; ++i)
 	    {
         const TUint32 nFatEntry = ReadFatL(i);
        
@@ -143,9 +148,12 @@
 */
 void CScanDrive::DoParseFat32L()
     {
-    ASSERT(iMount->FatType() == EFat32);
+    const TInt    KNumClusters = MaxClusters();
+    
+    __PRINT1(_L("CScanDrive::DoParseFat32L(), clusters:%d"), KNumClusters);
 
-    const TUint32 KNumClusters  = iMount->UsableClusters()+KFatFirstSearchCluster;
+    ASSERT(iMount->FatType() == EFat32);
+    
     const TUint32 KFat1StartPos = iMount->StartOfFatInBytes();
     const TUint32 KFatSize      = KNumClusters * sizeof(TFat32Entry); //-- usable size of one FAT.
 
@@ -183,6 +191,8 @@
     CleanupStack::PopAndDestroy(&buf); 
     }
 
+
+
 //----------------------------------------------------------------------------------------------------
 /**
     Sets up a bit list representation of the media fat
@@ -192,63 +202,23 @@
     {
     ASSERT(iMount->ConsistentState());
     
+    TInt nRes;
+
     if(iMount->FatType() == EFat32)
         {//-- for FAT32 try to use specialised method of parsing
-        TInt nRes;
         TRAP(nRes, DoParseFat32L())
         if(nRes == KErrNone)
             return;
         }
-    
+
+
     //-- use old FAT-agnostic parsing
     DoParseFatL();
     }
 
-/**
-Set a cluster as visited in the bit packed scan Fat
-
-@param aCluster Cluster number
-*/
-void CScanDrive::SetUsedL(TUint aCluster)
-	{
-	__ASSERT_ALWAYS(aCluster >= KFatFirstSearchCluster && aCluster < (KFatFirstSearchCluster+iMount->UsableClusters()),User::Leave(KErrCorrupt));
-    iScanFatBits.SetBit(aCluster);
-	}
-
 
 /**
-Query whether a cluster is already set as used 
-
-@param aCluster Cluster to query
-*/
-TBool CScanDrive::AlreadyUsedL(TUint aCluster) const
-	{
-	__ASSERT_ALWAYS(aCluster >= KFatFirstSearchCluster && aCluster < (KFatFirstSearchCluster+iMount->UsableClusters()),User::Leave(KErrCorrupt));
-
-    return iScanFatBits[aCluster];
-	}
-
-/**
-@param aPos Position in a directory cluster
-@return  ETrue if aPos is the last entry in the root directory
-*/
-TBool CScanDrive::IsEndOfRootDir(const TEntryPos& aPos)const
-	{
-	return(iMount->IsRootDir(aPos)&&(iMount->StartOfRootDirInBytes()+aPos.iPos==(iMount->RootDirEnd()-KSizeOfFatDirEntry)));
-	}
-
-/**
-@param aVal Value of the cluster to be tested
-@return ETrue if aVal is the end of cluster marker
-*/
-TBool CScanDrive::IsEofF(TInt aVal) const 
-	{
-    return iMount->IsEndOfClusterCh(aVal);
-	}
-
-
-/**
-@return True if a directory error has been found
+    @return True if a directory error has been found
 */
 TBool CScanDrive::IsDirError() const
 	{
@@ -256,77 +226,103 @@
 	}
 
 /**
-    After StartL() and finishing allows us to know if there were any problems at all.
+    After StartL() and finishing allows us to know if there were any problems discovered at all.
     The client may wish to remount the filesystem if there were errors.
 
-    @return EFalse if there were no problems in FS.
+    @return The code describing the problem.
 */
-TBool CScanDrive::ProblemsDiscovered() const
+CScanDrive::TGenericError CScanDrive::ProblemsDiscovered() const
 {
-    return IsDirError() || iFoundProblems;
+
+    if(IsDirError()) 
+        return EScanDriveDirError;
+    else
+        return iGenericError;
 }
 
 /**
     Sets the flag indicating than there are errors in filesystem structure
     See ProblemsDiscovered()
+
+    @param  aError a code describing the error
 */
-void CScanDrive::IndicateErrorsFound()
+void CScanDrive::IndicateErrorsFound(TGenericError aError)
 {
-    iFoundProblems = ETrue;
+    ASSERT(aError != ENoErrors);
+    iGenericError = aError;
 }
 
 
-
+//----------------------------------------------------------------------------------------------------
 /**
-Start point for scan drive also fixes up errors 
-
-@return The result of the scan
-@leave 
+    Start the scanner. The this calss description about what it actually does.
+    @param  aMode specifies the operational mode.
 */
-TInt CScanDrive::StartL()
+void CScanDrive::StartL(TScanDriveMode aMode)
 	{
-	__PRINT1(_L("CScanDrive::StartL(), drive:%d"), iMount->DriveNumber());
+	__PRINT2(_L("CScanDrive::StartL(%d), drive:%d"), aMode, iMount->DriveNumber());
+    iScanDriveMode = aMode;
 
     //-- used for measuring time
     TTime   timeStart;
     TTime   timeEnd;
+    
     timeStart.UniversalTime(); //-- take start time
 
-
 	ReadMediaFatL();
 
+        //timeEnd.UniversalTime(); //-- take end time
+        //elapsedTime = (TInt)( (timeEnd.MicroSecondsFrom(timeStart)).Int64() / K1mSec);
+        //__PRINT1(_L("#@@@ CScanDrive #1:%d ms "), elapsedTime);
+
 	CheckDirStructureL();
-#if defined(DEBUG_SCANDRIVE)
-	CompareFatsL();
-#endif
-	if(IsDirError())
-		FixupDirErrorL();
+
+    //-- uncomments a line below if you need to compare real and restored FAT tables and print out all differences
+    //CompareFatsL(EFalse);
+
+        //timeEnd.UniversalTime(); //-- take end time
+        //elapsedTime = (TInt)( (timeEnd.MicroSecondsFrom(timeStart)).Int64() / K1mSec);
+        //__PRINT1(_L("#@@@ CScanDrive #2:%d ms "), elapsedTime);
 
-	WriteNewFatsL();
-#if defined(DEBUG_SCANDRIVE)
+    if(CheckDiskMode())
+        {//-- in check disk mode it is nesessarily just to detech FS errors
+        CompareFatsL(ETrue); //-- will stop on the first error found
+        }
+    else
+        {//-- In ScanDrive mode we need to find and fix Rugged FAT artefacts.
+     
+        if(IsDirError())
+		    FixupDirErrorL();
+
+	    CompareAndFixFatsL();
+        }
+
 	PrintErrors();
-#endif
-   
 
 
     timeEnd.UniversalTime(); //-- take end time
-    const TInt msScanTime = (TInt)( (timeEnd.MicroSecondsFrom(timeStart)).Int64() / K1mSec);
-    (void)msScanTime;
-    
+    const TInt elapsedTime = (TInt)( (timeEnd.MicroSecondsFrom(timeStart)).Int64() / K1mSec);
+    (void)elapsedTime;
+
     __PRINT1(_L("CScanDrive: Directories visisted = %d\n"),iDirsChecked);
-    __PRINT1(_L("#@@@ CScanDrive time taken:%d ms "), msScanTime);
+    __PRINT1(_L("#@@@ CScanDrive time taken:%d ms "), elapsedTime);
+    
+    
 
-	return KErrNone;
+	return;
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Fix errors detected by the drive scan
+    Fix errors detected by the drive scan
  
-@leave System wide error code
+    @leave System wide error code
 */
 void CScanDrive::FixupDirErrorL()
 	{
-	if(!IsDirError())
+	ASSERT(!CheckDiskMode());
+    
+    if(!IsDirError())
 		return;
 	
     if(iDirError==EScanMatchingEntry)
@@ -339,21 +335,23 @@
         FixPartEntryL();
         }
 
-    IndicateErrorsFound(); //-- indicate that we have found errors
+    IndicateErrorsFound(EScanDriveDirError); //-- indicate that we have found errors
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Find positions of entries with same start cluster for error correction, searches
-the whole volume. Starts at the root directory. 
+    Find positions of entries with same start cluster for error correction, searches
+    the whole volume. Starts at the root directory. 
 
-@leave System wide error code
+    @leave System wide error code
 */
 void CScanDrive::FindSameStartClusterL()
 	{
 	TInt err=FindStartClusterL(iMount->RootIndicator());
 	if(err==KErrNone)
 		return;
-	for(TInt i=0;i<KMaxArrayDepth && iClusterListArray[i]!=NULL;++i)
+	
+    for(TUint i=0;i<KMaxArrayDepth && iClusterListArray[i]!=NULL;++i)
 		{
 		RArray<TInt>* clusterList=iClusterListArray[i];
 		for(TInt j=0;j<clusterList->Count();++j)
@@ -364,15 +362,17 @@
 				return;
 			}
 		}
+
 	__ASSERT_ALWAYS(err==KErrNone,User::Leave(KErrNotFound));
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Scan through directory structure looking for start cluster found in iMatching
+    Scan through directory structure looking for start cluster found in iMatching
 
-@param aDirCluster Start cluster for scan to start
-@return System wide error value
-@leave 
+    @param aDirCluster Start cluster for scan to start
+    @return System wide error value
+    @leave 
 */
 TInt CScanDrive::FindStartClusterL(TInt aDirCluster)
 	{
@@ -402,32 +402,36 @@
 		TEntryPos vfatPos=entryPos;
 		isComplete=MoveToVFatEndL(entryPos,entry,dirEntries);
 		__ASSERT_ALWAYS(isComplete,User::Leave(KErrBadName));
+
 		TInt err=CheckEntryClusterL(entry,vfatPos);
 		if(err==KErrNone)
 			{
 			--iRecursiveDepth;
 			return(err);
 			}
+
 		if(IsEndOfRootDir(entryPos))
 			break;
+
 		MoveToNextEntryL(entryPos);
 		}
 	--iRecursiveDepth;
 	return(KErrNotFound);
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Procces aEntry to find matching start cluster
+    Procces aEntry to find matching start cluster
 
-@param aEntry Directory entry to check
-@param aEntryPos Position of directory to check
-@return System wide error value
-@leave 
+    @param aEntry Directory entry to check
+    @param aEntryPos Position of directory to check
+    @return System wide error value
+    @leave 
 */
 TInt CScanDrive::CheckEntryClusterL(const TFatDirEntry& aEntry, const TEntryPos& aEntryPos)
 	{
 	__PRINT(_L("CScanDrive::CheckEntryClusterL"));
-	if(iMount->StartCluster(aEntry)==iMatching.iStartCluster)
+	if((TUint)iMount->StartCluster(aEntry)==iMatching.iStartCluster)
 		{
 		TBool complete=AddMatchingEntryL(aEntryPos);
 		if(complete)
@@ -435,14 +439,16 @@
 		}
 	else if(aEntry.Attributes()&KEntryAttDir)
 		return(FindStartClusterL(iMount->StartCluster(aEntry)));
+
 	return(KErrNotFound);
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Checks directory strucutre for errors, can be considered the start point of the scan.  
-Handles recursion depth to avoid stack overflow.
+    Checks directory structure for errors, can be considered the start point of the scan.  
+    Handles recursion depth to avoid stack overflow.
 
-@leave System wide error code
+    @leave System wide error code
 */
 void CScanDrive::CheckDirStructureL()
 	{
@@ -450,7 +456,8 @@
 	// Due to recursive nature of CheckDirL when a depth of
 	// KMaxScanDepth is reached clusters are stored in a list
 	// and passed into CheckDirL afresh
-	for(TInt i=0;i<KMaxArrayDepth && iClusterListArray[i]!=NULL;++i)
+
+	for(TUint i=0;i<KMaxArrayDepth && iClusterListArray[i]!=NULL;++i)
 		{
 		RArray<TInt>* clusterList=iClusterListArray[i];
 		++iListArrayIndex;
@@ -463,17 +470,18 @@
 	}
 
 
+//----------------------------------------------------------------------------------------------------
 /**
-Function is called recursively with Process entry untill the whole volume has been scanned.
-Each directory entry is scanned for errors, these are recorded for later fixing. 
+    This function is called recursively with Process entry untill the whole volume has been scanned.
+    Each directory entry is scanned for errors, these are recorded for later fixing. 
 
-@param aCluster Directory cluster to start checking
-@leave System wide error codes
+    @param aCluster Directory cluster to start checking
+    @leave System wide error codes
 */
-void CScanDrive::CheckDirL(TInt aCluster)
+void CScanDrive::CheckDirL(TUint32 aCluster)
 	{
 	__PRINT1(_L("CScanDrive::CheckDirL aCluster=%d"),aCluster);
-	__ASSERT_ALWAYS(aCluster>=0,User::Leave(KErrCorrupt));
+
 	// check depth of recursion
 	if(++iRecursiveDepth==KMaxScanDepth)
 		{
@@ -481,9 +489,9 @@
 		--iRecursiveDepth;
 		return;
 		}
-#if defined(DEBUG_SCANDRIVE)
+
 	++iDirsChecked;
-#endif
+
 	TEntryPos entryPos(aCluster,0);
 	TInt dirEntries=0;
 	FOREVER
@@ -492,31 +500,46 @@
 		ReadDirEntryL(entryPos,entry);
 		if(!iMount->IsEndOfClusterCh(entryPos.iCluster))
 			++dirEntries;
-		if(entry.IsParentDirectory()||entry.IsCurrentDirectory()||entry.IsErased())
+
+		if(entry.IsParentDirectory() || entry.IsCurrentDirectory() || entry.IsErased())
 			{
 			if(IsEndOfRootDir(entryPos))
 				break;
+
 			MoveToNextEntryL(entryPos);
 			continue;
 			}
+
 		if(entry.IsEndOfDirectory())
 			{
 			if(aCluster)	
-				WriteClusterChainL(aCluster,dirEntries<<KSizeOfFatDirEntryLog2);
+				RecordClusterChainL(aCluster,dirEntries<<KSizeOfFatDirEntryLog2);
+
 			break;
 			}
+
 		TEntryPos origPos=entryPos;
 		TFatDirEntry origEntry=entry;
 		TInt origDirEntries=dirEntries;
-		TBool isComplete;
-		isComplete=MoveToVFatEndL(entryPos,entry,dirEntries);
-		// Only assume that this is a corrupted VFAT entry if the VFAT attributes are set; 
+		
+		const TBool isComplete = MoveToVFatEndL(entryPos,entry,dirEntries);
+        
+        if(!isComplete && CheckDiskMode())
+            {//-- broken VFAT entryset; in CheckDisk mode this is the FS error, abort further activity
+                IndicateErrorsFound(EInvalidEntrySize);
+                User::Leave(KErrCorrupt);
+            }
+
+        // Only assume that this is a corrupted VFAT entry if the VFAT attributes are set; 
 		// assuming a non-VFAT corrupted entry is a VFAT entry is dangerous as we then assume that the 
 		// first byte is a count of entries to skip, thus completely invalidating the next <n> directories.
-		if (!isComplete && origEntry.IsVFatEntry())
+		
+        //-- this code seems to deal with one of the Rugged FAT artefacts: partially deleted VFAT entryset, when DOS entry is deleted first
+        //-- and delettion of VFAT ones had failed
+        if(!isComplete && origEntry.IsVFatEntry())
 			{
 			AddPartialVFatL(origPos,origEntry);
-			if(entryPos.iCluster!=KEndOfDirectory)
+			if(!IsEofF(entryPos.iCluster))
 				{
 				TInt toMove=origEntry.NumFollowing()-(dirEntries-origDirEntries);
 				if(toMove)
@@ -530,22 +553,26 @@
 				}
 			}
 		else
-			ProcessEntryL(entry);
+			{
+            ProcessEntryL(entry);
+            }
+
 		if(IsEndOfRootDir(entryPos))
 			break;
+
 		MoveToNextEntryL(entryPos);
 		}
 	--iRecursiveDepth;
 	}
 
-
+//----------------------------------------------------------------------------------------------------
 /**
-Process non trivial entries, such as files, if they are correct by filling out their 
-cluster allocation in the bit packed Fat table. If it comes accross a directory 
-CheckDirL will be called.
+    Process non trivial entries, such as files, if they are correct by filling out their 
+    cluster allocation in the bit packed Fat table. If it comes accross a directory 
+    CheckDirL will be called.
 
-@param aEntry Directory entry to check
-@leave System wide error code
+    @param aEntry Directory entry to check
+    @leave System wide error code
 */
 void CScanDrive::ProcessEntryL(const TFatDirEntry& aEntry)
 	{
@@ -553,82 +580,116 @@
 	TInt entryAtt=aEntry.Attributes();
 
 	__ASSERT_ALWAYS(!(entryAtt&~KEntryAttMaskSupported)&&!aEntry.IsErased(),User::Leave(KErrCorrupt));
-	if(!(entryAtt&(KEntryAttDir|KEntryAttVolume)) && iMount->StartCluster(aEntry)>0)
-		WriteClusterChainL(iMount->StartCluster(aEntry),(TUint) aEntry.Size());
+	
+    if(!(entryAtt&(KEntryAttDir|KEntryAttVolume)) && iMount->StartCluster(aEntry)>0)
+		{//-- this is a file with length >0. Check that its cluster chain corresponds to its size
+        RecordClusterChainL(iMount->StartCluster(aEntry),(TUint) aEntry.Size());
+        }
 	else if(entryAtt&KEntryAttDir)
-		CheckDirL(iMount->StartCluster(aEntry));
+		{//-- this is the directory, walk into it
+        CheckDirL(iMount->StartCluster(aEntry));
+        }
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Writes out the cluster chain for a correct file or directory, checks that the cluster 
-has not already been used and that the correct number of clusters are allocated for the 
-size of file. Registers cluster as used if correct
+    Walks the cluster chain for a correct file or directory, checks that the cluster 
+    has not already been used and that the correct number of clusters are allocated for the 
+    size of file. Registers cluster as used, if correct.
 
-@param aCluster Cluster chain start point
-@param aSizeInBytes Size of the file or directory in bytes
-@leave System wide error values
+    @param aCluster Cluster chain start point
+    @param aSizeInBytes Size of the file or directory in bytes
+    @leave System wide error values
 */
-void CScanDrive::WriteClusterChainL(TInt aCluster,TUint aSizeInBytes)
-//
-// Mark off in the new fat the clusters used by entry with start cluster of aCluster
-//
+void CScanDrive::RecordClusterChainL(TInt aCluster, TUint aSizeInBytes)
 	{
-	__PRINT1(_L("CScanDrive::WriteClusterChainL starting at %d"),aCluster);
-	__ASSERT_ALWAYS(aCluster>0,User::Leave(KErrCorrupt));
-	TInt clusterCount;
-	if(aSizeInBytes==0)
+	__PRINT2(_L("CScanDrive::RecordClusterChainL() cl:%d, sz:%d") ,aCluster, aSizeInBytes);
+	__ASSERT_ALWAYS(aCluster>0, User::Leave(KErrCorrupt));
+	
+    TUint clusterCount;
+	
+    if(aSizeInBytes==0)
 		clusterCount=1;
 	else
-		clusterCount = (TInt) (( TInt64(aSizeInBytes) + TInt64((1<<iMount->ClusterSizeLog2())-1) ) >> iMount->ClusterSizeLog2());
+		{
+        const TUint64 tmp = aSizeInBytes + Pow2_64(iMount->ClusterSizeLog2()) - 1;
+        clusterCount = (TUint) (tmp >> iMount->ClusterSizeLog2());
+        }
+
 	TInt startCluster=aCluster;
 	while(clusterCount)
 		{
-		if(AlreadyUsedL(aCluster))
-			{
-			__ASSERT_ALWAYS(!IsDirError()&&iMatching.iStartCluster==0&&aCluster==startCluster,User::Leave(KErrCorrupt));
+        if(IsClusterUsedL(aCluster))
+			{//-- this cluster already seems to belong to some other object; crosslinked cluster chain. Can't fix it.
+			if(CheckDiskMode())
+                {//-- in check disk mode this is a FS error; Indicate error and abort furter scanning
+                __PRINT1(_L("CScanDrive::RecordClusterChainL #1 %d"),aCluster); 
+                IndicateErrorsFound(EClusterAlreadyInUse);
+                User::Leave(KErrCorrupt);
+                }
+            
+            __ASSERT_ALWAYS(!IsDirError() && iMatching.iStartCluster==0 && aCluster==startCluster,User::Leave(KErrCorrupt));
 			iMatching.iStartCluster=aCluster;
 			iDirError=EScanMatchingEntry;		//ERROR POINT
-            IndicateErrorsFound(); //-- indicate that we have found errors
+            IndicateErrorsFound(EScanDriveDirError); //-- indicate that we have found errors
 			return;
 			}
-		if(clusterCount==1)
+
+		
+        if(clusterCount==1)
 			{
 			if(!iMount->IsEndOfClusterCh(ReadFatL(aCluster)))
-				{
-				//This is a genuine truncation
+				{//-- seems to be a rugged FAT artefact; File truncation had failed before and now file length is less than
+                 //-- the corresponding cluster chain shall be. It will be truncated.
 				iTruncationCluster = aCluster;								
+                
+                if(CheckDiskMode())
+                    {//-- in check disk mode this is a FS error; Indicate error and abort furter scanning
+                    __PRINT1(_L("CScanDrive::RecordClusterChainL #2 %d"),aCluster); 
+                    IndicateErrorsFound(EInvalidEntrySize);
+                    User::Leave(KErrCorrupt);
+                    }
                 }
-			SetUsedL(aCluster);
+
+            //__PRINT1(_L("#--: %d -> EOC"), aCluster); 
+            MarkClusterUsedL(aCluster);
 			return;
 			}
 		else
 			{
-			TInt clusterVal=ReadFatL(aCluster);
-			__ASSERT_ALWAYS(!IsEofF(clusterVal) && clusterVal!=0,User::Leave(KErrCorrupt));
-			SetUsedL(aCluster);
+			const TUint clusterVal=ReadFatL(aCluster);
+
+            //__PRINT2(_L("#--: %d -> %d"), aCluster, clusterVal); 
+			
+            __ASSERT_ALWAYS(!IsEofF(clusterVal) && clusterVal !=KSpareCluster, User::Leave(KErrCorrupt));
+			MarkClusterUsedL(aCluster);
 			aCluster=clusterVal;
 			--clusterCount;
 			}
-		}
+		
+        }//while(clusterCount)
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Move to dos entry, checking all vfat entry ID numbers are in sequence.
-Assumes aEntry is not erased
+    Move to dos entry, checking all vfat entry ID numbers are in sequence.
+    Assumes aEntry is not erased
 
-@param aPos Position of the entry to move from, returns with new position
-@param aEntry The Dos entry after the Vfat entries on return
-@param aDirLength Running total of the length of the directory in entries
-@leave System wide error codes
-@return EFalse if not valid vfat entries or dos entry, else returns ETrue
+    @param aPos Position of the entry to move from, returns with new position
+    @param aEntry The Dos entry after the Vfat entries on return
+    @param aDirLength Running total of the length of the directory in entries
+    @leave System wide error codes
+    @return EFalse if not valid vfat entries or dos entry, else returns ETrue
 */
 TBool CScanDrive::MoveToVFatEndL(TEntryPos& aPos,TFatDirEntry& aEntry,TInt& aDirLength)
 	{
 	__PRINT2(_L("CScanDrive::MoveToVFatEndL cluster=%d,pos=%d"),aPos.iCluster,aPos.iPos);
 	if(!aEntry.IsVFatEntry())
 		return IsDosEntry(aEntry);
+
 	TInt toFollow=aEntry.NumFollowing();
-	__ASSERT_ALWAYS(toFollow>0&&!aEntry.IsErased(),User::Leave(KErrCorrupt));
+	__ASSERT_ALWAYS(toFollow>0 && !aEntry.IsErased(), User::Leave(KErrCorrupt));
+
 	FOREVER
 		{
 		MoveToNextEntryL(aPos);
@@ -637,31 +698,36 @@
 		--toFollow;
 		if(!toFollow)
 			break;
-		if(!IsValidVFatEntry(aEntry,toFollow))
+		
+        if(!IsValidVFatEntry(aEntry,toFollow))
 			return(EFalse);
 		}
-	return(IsDosEntry(aEntry));
+	
+    return(IsDosEntry(aEntry));
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Check if an entry is valid VFat
+    Check if an entry is valid VFat
 
-@param aEntry Entry to check
-@param aPrevNum Number into VFat entries for a dos entry to ensure in correct position
-@return ETrue if aEntry is a valid vfat entry
+    @param aEntry Entry to check
+    @param aPrevNum Number into VFat entries for a dos entry to ensure in correct position
+    @return ETrue if aEntry is a valid vfat entry
 */
 TBool CScanDrive::IsValidVFatEntry(const TFatDirEntry& aEntry,TInt aPrevNum)const
 	{
 	if(aEntry.IsErased()||!aEntry.IsVFatEntry())
-		return(EFalse);
+		return EFalse;
+
 	return(aEntry.NumFollowing()==aPrevNum);
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Check if an entry is a Dos entry
+    Check if an entry is a Dos entry
 
-@param aEntry Entry to check
-@return ETrue if aEntry is a dos entry
+    @param aEntry Entry to check
+    @return ETrue if aEntry is a dos entry
 */
 TBool CScanDrive::IsDosEntry(const TFatDirEntry& aEntry)const
 	{
@@ -669,13 +735,13 @@
 	return res;
 	} 
 
+//----------------------------------------------------------------------------------------------------
 /**
-Add partial entry to iPartEntry under the error condition of not all Vfat entries 
-being present
+    Add partial entry to iPartEntry under the error condition of not all Vfat entries being present
 
-@param aStartPos Position of the Dos entry associated with the VFat entries
-@param aEntry Directory Entry of the Dos entry associated with the VFat entries
-@leave KErrCorrupt Occurs if the entry is not valid
+    @param aStartPos Position of the Dos entry associated with the VFat entries
+    @param aEntry Directory Entry of the Dos entry associated with the VFat entries
+    @leave KErrCorrupt Occurs if the entry is not valid
 */
 void CScanDrive::AddPartialVFatL(const TEntryPos& aStartPos, const TFatDirEntry& aEntry)
 	{
@@ -686,12 +752,13 @@
 	iDirError=EScanPartEntry;
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Add entry position to iMatching
+    Add entry position to iMatching
 
-@param aEntryPos Position of the entry with the matching entry
-@leave KErrCorrupt if the start cluster is 0 or more that two matching entries occurs
-@return 
+    @param aEntryPos Position of the entry with the matching entry
+    @leave KErrCorrupt if the start cluster is 0 or more that two matching entries occurs
+    @return 
 */
 TBool CScanDrive::AddMatchingEntryL(const TEntryPos& aEntryPos)
 	{
@@ -702,15 +769,18 @@
 	}
 
 
+//----------------------------------------------------------------------------------------------------
 /**
-Scan for differnces in the new and old FAT table writing them to media if discovered
+    Scan for differnces in the new and old FAT table writing them to media if discovered
+    It is supposed to be called in 'ScanDrive' mode only
 
-@leave System wide error codes
+    @leave System wide error codes
 */
-void CScanDrive::WriteNewFatsL()
+void CScanDrive::CompareAndFixFatsL()
     {
-	
-    __PRINT1(_L("CScanDrive::WriteNewFatsL() drv:%d"),iMount->DriveNumber());
+    __PRINT1(_L("CScanDrive::CompareAndFixFatsL() drv:%d"),iMount->DriveNumber());
+
+    ASSERT(!CheckDiskMode());
 
     TUint32 nClustersFixed = 0; //-- fixed clusters count
     TUint32 nBadClusters   = 0; //-- bad cluster count
@@ -732,7 +802,7 @@
                 {//-- difference in the cluster "i" between a real FAT and what ScanDrive restored.
           
                 //-- indicate that there are some problems in FAT. and we probably wrote something there.
-                IndicateErrorsFound(); 
+                IndicateErrorsFound(EScanDriveDirError); 
                 
                 //-- skip BAD cluster, can't mark it as unused.
                 if(iMount->IsBadCluster(ReadFatL(i)))
@@ -790,7 +860,7 @@
 		iMount->FAT().FlushL();
 		
         //-- indicate that there are some problems in FAT. and we probably wrote something there.
-        IndicateErrorsFound(); //-- indicate that we have found errors
+        IndicateErrorsFound(EScanDriveDirError); //-- indicate that we have found errors
 
         ++nClustersFixed;
         }
@@ -798,14 +868,15 @@
     __PRINT2(_L("CScanDrive::WriteNewFatsL() fixed:%d, bad:%d"), nClustersFixed, nBadClusters);
     }
 
+//----------------------------------------------------------------------------------------------------
 /**
-Read the ID stored in reserved2 in the Dos entry or associated with the Dos entry of the 
-Entry at the position passed in. This is used to find which version of two matching entries 
-should be kept.
+    Read the "Rugged FAT" ID, stored in reserved2 in the Dos entry or associated with the Dos entry of the 
+    Entry at the position passed in. This is used to find which version of two matching entries should be kept.
+
 
-@param aVFatPos Position of an entry to read ID from
-@leave System wide error codes
-@return The ID found in reserved2 field of dos entry 
+    @param aVFatPos Position of an entry to read ID from
+    @leave System wide error codes
+    @return The ID found in reserved2 field of dos entry 
 */
 TInt CScanDrive::GetReservedidL(TEntryPos aVFatPos)
 	{
@@ -822,47 +893,54 @@
 	return(entry.RuggedFatEntryId());
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Erase part entry found in iPartEntry
-
-@leave System wide error code
+    Erase part entry found in iPartEntry
+    @leave System wide error code
 */
 void CScanDrive::FixPartEntryL()
 	{
 	__PRINT2(_L("CScanDrive::FixPartEntryL cluster=%d,pos=%d"),iPartEntry.iEntryPos.iCluster,iPartEntry.iEntryPos.iPos);
-	iMount->EraseDirEntryL(iPartEntry.iEntryPos,iPartEntry.iEntry);
-    IndicateErrorsFound(); //-- indicate that we have found errors
+	ASSERT(!CheckDiskMode());
+    iMount->EraseDirEntryL(iPartEntry.iEntryPos,iPartEntry.iEntry);
+    IndicateErrorsFound(EScanDriveDirError); //-- indicate that we have found errors
 	}
 	
+//----------------------------------------------------------------------------------------------------
 /**
-Delete entry with largest value in the reserved2 section(bytes 20 and 21) of dos entry
+    Delete entry with largest value in the reserved2 section(bytes 20 and 21) of dos entry
 
-@leave System wide error code
+    @leave System wide error code
 */
 void CScanDrive::FixMatchingEntryL()
 	{
-	__PRINT1(_L("CScanDrive::FixMatchingEntryL() start cluster=%d"),iMatching.iStartCluster);
+	
+    __PRINT1(_L("CScanDrive::FixMatchingEntryL() start cluster=%d"),iMatching.iStartCluster);
 	__ASSERT_ALWAYS(iMatching.iCount==KMaxMatchingEntries,User::Leave(KErrCorrupt));
-	TInt idOne=GetReservedidL(iMatching.iEntries[0]);
+	ASSERT(!CheckDiskMode());
+
+    TInt idOne=GetReservedidL(iMatching.iEntries[0]);
 	TInt idTwo=GetReservedidL(iMatching.iEntries[1]);
 	TFatDirEntry entry;
 	TInt num=idOne>idTwo?0:1;
 	ReadDirEntryL(iMatching.iEntries[num],entry);
 	iMount->EraseDirEntryL(iMatching.iEntries[num],entry);
-    IndicateErrorsFound(); //-- indicate that we have found errors
+    IndicateErrorsFound(EScanDriveDirError); //-- indicate that we have found errors
 	}
-/**
-Move past specified number of entries
 
-@param aEntryPos Start position to move from, updated as move takes place
-@param aEntry Directory entry moved to
-@param aToMove Number of entries to move through
-@param aDirEntries Number of entries moved, updated as move takes place
-@leave System wide error code
+//----------------------------------------------------------------------------------------------------
+/**
+    Move past specified number of entries
+
+    @param aEntryPos Start position to move from, updated as move takes place
+    @param aEntry Directory entry moved to
+    @param aToMove Number of entries to move through
+    @param aDirEntries Number of entries moved, updated as move takes place
+    @leave System wide error code
 */
 void CScanDrive::MovePastEntriesL(TEntryPos& aEntryPos,TFatDirEntry& aEntry,TInt aToMove,TInt& aDirEntries)
 	{
-	while(aToMove-- && aEntryPos.iCluster!=KEndOfDirectory)
+	while(aToMove-- && !IsEofF(aEntryPos.iCluster))
 		{
 		MoveToNextEntryL(aEntryPos);
 		++aDirEntries;
@@ -870,33 +948,38 @@
 	ReadDirEntryL(aEntryPos,aEntry);
 	}
 
+//----------------------------------------------------------------------------------------------------
 /**
-Adds aCluster to cluster list array so that it may be revisited later, avoids stack 
-over flow
+    Adds aCluster to cluster list array so that it may be revisited later, avoids stack 
+    over flow
 
-@param aCluster Directory cluster number to add to the list
-@leave KErrNoMemory If allocation fails
+    @param aCluster Directory cluster number to add to the list
+    @leave KErrNoMemory If allocation fails
 */
 void CScanDrive::AddToClusterListL(TInt aCluster)
 	{
+
 	if(iListArrayIndex>=KMaxArrayDepth)
 		return;
+
 	if(iClusterListArray[iListArrayIndex]==NULL)
 		iClusterListArray[iListArrayIndex]=new(ELeave) RArray<TInt>(KClusterListGranularity);
 	iClusterListArray[iListArrayIndex]->Append(aCluster);
 	}
 
 
-#if defined(DEBUG_SCANDRIVE)
+//----------------------------------------------------------------------------------------------------
 /**
-Used for debug purposes only, compares new Fat and first Fat table, displays any differences
-and there meaning
-
-@leave System wide error codes
+    Used in "CheckDisk" mode mostly. Compares first FAT table on the media with the FAT bitmap restored by walking the directory structure.
+    Displays any differences and records an error if found.
+    
+    @param  aStopOnFirstErrorFound if ETrue will stop after discovering first error (FATs discrepancy)
+    
+    @leave  System wide error codes
 */
-void CScanDrive::CompareFatsL() const 
+void CScanDrive::CompareFatsL(TBool aStopOnFirstErrorFound)  
     {
-	__PRINT(_L("CScanDrive::CompareFatsL()"));
+	__PRINT1(_L("CScanDrive::CompareFatsL(%d)"), aStopOnFirstErrorFound);
 		
    
     TUint32 diffPos;
@@ -904,34 +987,51 @@
         return; //-- FATs are identical
     
     //-- there is a difference between the real FAT and reconstructed one. Find the mismaching bit and fix FAT. 
-    const TInt clusters = iMount->UsableClusters();
+    const TUint clusters = iMount->UsableClusters();
     ASSERT(diffPos < (TUint32)clusters);
                         
-    TInt scanusedcnt=0;
-	TInt mediausedcnt=0;
+    TUint scanusedcnt=0;
+	TUint mediausedcnt=0;
 	
-    for(TInt i=diffPos; i<clusters; ++i)
+    for(TUint i=diffPos; i<clusters; ++i)
 	    {
         const TBool bRealFatEntry = iMediaFatBits[i];
         const TBool bNewFatEntry  = iScanFatBits[i];
 
 		if(BoolXOR(bRealFatEntry, bNewFatEntry))
-		    {
-			if(bRealFatEntry && !bNewFatEntry)
-			    {	
-                __PRINT1(_L("Lost cluster=%d\n"),i);
+		    {//-- mismatch between FAT on the media and the FAT bitmap restored by walking directory structure
+
+			    if(bRealFatEntry)
+                {//-- FAT[i] on the media is marked as occupied, but retored FAT bitmap shows that it is free
+                    if(iMount->IsBadCluster(ReadFatL(i)))
+                        continue; //-- this is a BAD cluster it can't be occupied by the FS object, OK.
+
+                    __PRINT2(_L("FAT[%d] = %d\n"), i, ReadFatL(i));        
+                    __PRINT1(_L("iTruncationCluster = %d\n"), iTruncationCluster);        
+                    
+                    //-- this is a lost cluster
+                    if(!IsEofF(ReadFatL(i)) && (i==iTruncationCluster))
+                        {//-- seems to be a Rugged FAT ertefact
+                        __PRINT1(_L("Hanging cluster = %d\n"),i);        
+                        }
+                    else
+                        {
+                        __PRINT1(_L("Lost cluster=%d\n"),i);
+                        }
+                    
+                    
+                    IndicateErrorsFound(EBadClusterValue);
                 }
-			else if((bRealFatEntry && !IsEofF(ReadFatL(i))) && (i==iTruncationCluster))
-			    {
-            	__PRINT1(_L("Hanging cluster = %d\n"),i);
+                else
+                {//-- FAT[i] on the media is marked as free, but retored FAT bitmap shows that it is occupied by some object
+                    IndicateErrorsFound(EClusterAlreadyInUse);
+                    __PRINT1(_L("Unflushed cluster = %d\n"),i);
                 }
-			else if(!bRealFatEntry && bNewFatEntry)
-                {
-				__PRINT1(_L("Unflushed cluster = %d\n"),i);
-                }
-			else
-				User::Leave(KErrCorrupt);
-		    }
+
+             if(aStopOnFirstErrorFound)
+                 break; //-- not asked to check for errors further
+
+            }
 		
         if(bRealFatEntry)
 			mediausedcnt++;
@@ -943,11 +1043,13 @@
     __PRINT2(_L("Scan Fat Used=%d, Media Fat Used=%d \n"),scanusedcnt,mediausedcnt);
     }	
 
+//----------------------------------------------------------------------------------------------------
 /**
-For debug purposes, print errors found as debug output
+    For debug purposes, print errors found as debug output
 */
 void CScanDrive::PrintErrors()
     {
+#if defined(_DEBUG)    
 	__PRINT1(_L("Directories visisted = %d\n"),iDirsChecked);
 
 	if(iDirError==EScanPartEntry)
@@ -960,8 +1062,10 @@
 		__PRINT2(_L("\tcluster 1 - dir cluster=%d,dir pos=%d\n"),iMatching.iEntries[0].iCluster,iMatching.iEntries[0].iPos);
 		__PRINT2(_L("\tcluster 2 - dir cluster=%d,dir pos=%d\n"),iMatching.iEntries[1].iCluster,iMatching.iEntries[1].iPos);
 	    }
+#endif
     }
-#endif
+
+
 
 /**
 Read a FAT directory entry from disk, either reads directly from the main cache or
@@ -973,7 +1077,7 @@
 */
 void CScanDrive::ReadDirEntryL(const TEntryPos& aPos,TFatDirEntry& aDirEntry)
     {
-	__PRINT(_L("CScanDrive::ReadDirEntryL"));
+	//__PRINT(_L("CScanDrive::ReadDirEntryL"));
 	if (iMount->IsEndOfClusterCh(aPos.iCluster))
 		{
 		Mem::FillZ(&aDirEntry,sizeof(TFatDirEntry));
@@ -985,12 +1089,10 @@
 
 
 /**
-Move to next directory entry, if anEntry is at the end of the cluster, and we are not 
-the root dir, move it to the next cluster in the chain.
+    Move to next directory entry, if anEntry is at the end of the cluster, and we are not 
+    the root dir, move it to the next cluster in the chain.
 
-@param aPos Current directory position up dated to position of next entry.
-@leave System wide error codes
-
+    @param aPos Current directory position up dated to position of next entry.
 */
 void CScanDrive::MoveToNextEntryL(TEntryPos& aPos)
 	{
@@ -999,16 +1101,86 @@
 	}	
 
 /**
-Read a cluster from the Media Fat if scan run in a seperate thread read from scan fat table
-otherwise read from mount owned Fat table
+    Read a cluster from the Media Fat if scan run in a seperate thread read from scan fat table
+    otherwise read from mount owned Fat table
+
+    @param aClusterNum Cluster to read
+    @return Value of cluster read from Fat
+*/
+TUint32 CScanDrive::ReadFatL(TUint aClusterNum) 
+	{
+	if(aClusterNum < KFatFirstSearchCluster || aClusterNum >= MaxClusters())
+        {
+        IndicateErrorsFound(EBadClusterNumber);
+        User::Leave(KErrCorrupt);
+        }
+
+    //-- actually, ReadL() can leave with some error code, that won't be reflected in IndicateErrorsFound().
+    //-- it's possible to improve but is it worth it?
+    return iMount->FAT().ReadL(aClusterNum);			
+    }
+
+
+/**
+    Set a cluster as visited in the bit packed scan Fat
+    @param aCluster Cluster number
+*/
+void CScanDrive::MarkClusterUsedL(TUint aClusterNum)
+	{
+	if(aClusterNum < KFatFirstSearchCluster || aClusterNum >= MaxClusters())
+        {
+        IndicateErrorsFound(EBadClusterNumber);
+        User::Leave(KErrCorrupt);
+        }
+
+    iScanFatBits.SetBit(aClusterNum);
+	}
+
 
-@param aClusterNum Cluster to read
-@leave System wide error code
-@return Value of cluster read from Fat
+/**
+    Query whether a cluster is already set as used 
+    @param aCluster Cluster to query
+*/
+TBool CScanDrive::IsClusterUsedL(TUint aClusterNum) 
+	{
+	if(aClusterNum < KFatFirstSearchCluster || aClusterNum >= MaxClusters())
+        {
+        IndicateErrorsFound(EBadClusterNumber);
+        User::Leave(KErrCorrupt);
+        }
+
+    return iScanFatBits[aClusterNum];
+	}
+
+/**
+    @param aPos Position in a directory cluster
+    @return  ETrue if aPos is the last entry in the root directory
 */
-TUint32 CScanDrive::ReadFatL(TInt aClusterNum) const
+TBool CScanDrive::IsEndOfRootDir(const TEntryPos& aPos)const
+	{
+	return(iMount->IsRootDir(aPos)&&(iMount->StartOfRootDirInBytes()+aPos.iPos==(iMount->RootDirEnd()-KSizeOfFatDirEntry)));
+	}
+
+/**
+    @param aVal Value of the cluster to be tested
+    @return ETrue if aVal is the end of cluster marker
+*/
+TBool CScanDrive::IsEofF(TInt aVal) const 
 	{
-	return iMount->FAT().ReadL(aClusterNum);			
+    return iMount->IsEndOfClusterCh(aVal);
+	}
+
+/** @return max. number of clusters on the volume being scanned */
+TUint32 CScanDrive::MaxClusters() const
+    {
+        ASSERT(iMaxClusters);
+        return iMaxClusters;
+    }
+
+/** @return ETrue in we are operating in "CheckDisk" mode*/
+TBool CScanDrive::CheckDiskMode() const 
+    {
+    return iScanDriveMode == ECheckDisk;
     }
 
 
@@ -1019,5 +1191,3 @@
 
 
 
-
-
--- a/userlibandfileserver/fileserver/sfat32/sl_utl.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_utl.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -16,32 +16,6 @@
 #include "sl_std.h"
 
 //-----------------------------------------------------------------------------
-/**
-    Removes trailing dots from aName.
-    @return new string descriptor that may have its length adjusted
-*/
-TPtrC RemoveTrailingDots(const TDesC& aName)
-{
-    TInt len = aName.Length();
-    
-    while(len > 0)
-    {
-        if(aName[len-1] == '.')
-            len--;
-        else
-            break;
-    }
-
-    TPtrC ptrNoDots(aName.Ptr(), len);
-    return ptrNoDots;
-}
-
-
-TUint32 Log2(TUint32 aVal)
-{
-    return Log2_inline(aVal);
-}
-
 
 TTime DosTimeToTTime(TInt aDosTime,TInt aDosDate)
 //
@@ -195,681 +169,8 @@
     return (TUint8)chkSum;
     }
 
-//-----------------------------------------------------------------------------
-
-const TUint32 K_FFFF = 0xFFFFFFFF; //-- all one bits, beware rigth shifts of signed integers!
-
-
-RBitVector::RBitVector()
-          :iNumBits(0), ipData(NULL), iNumWords(0)
-    {
-    }
-
-
-RBitVector::~RBitVector()
-    {
-    Close();
-    }
-
-/**
-    Panics.
-    @param aPanicCode   a panic code
-*/
-void RBitVector::Panic(TPanicCode aPanicCode) const
-    {
-    _LIT(KPanicCat,"RBitVector");
-    User::Panic(KPanicCat, aPanicCode);
-    }
-
-/** explicitly closes the object and deallocates memory */
-void RBitVector::Close()
-    {
-    iNumBits = 0;
-    iNumWords =0;
-    User::Free(ipData);
-    ipData = NULL;
-    }
-
-//-----------------------------------------------------------------------------
-
-/**
-    Comparison perator.
-    @param  aRhs a vector to compate with.
-    @panic ESizeMismatch in the case of different vector sizes
-*/
-TBool RBitVector::operator==(const RBitVector& aRhs) const
-    {
-    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
-    __ASSERT_ALWAYS(iNumBits == aRhs.iNumBits, Panic(ESizeMismatch));
-
-
-    if(!iNumBits)
-        return ETrue; //-- comparing 0-lenght arrays
-
-    if(this == &aRhs)
-        return ETrue; //-- comparing with itself
-
-    if(iNumWords >= 1)
-        {
-        const TUint32 cntBytes = (iNumBits >> 5) << 2; //-- bytes to compare
-        if(memcompare((const TUint8*)ipData, cntBytes, (const TUint8*)aRhs.ipData, cntBytes))
-            return EFalse;
-        }
-
-    const TUint32 bitsRest  = iNumBits & 0x1F;
-    if(bitsRest)
-        {
-        const TUint32 mask = K_FFFF >> (32-bitsRest);
-        return ( (ipData[iNumWords-1] & mask) == (aRhs.ipData[iNumWords-1] & mask) );
-        }
-    
-    return ETrue;
-    }
-
-TBool RBitVector::operator!=(const RBitVector& aRhs) const  
-    {
-    return ! ((*this) == aRhs);
-    } 
-
-//-----------------------------------------------------------------------------
-
-/** The same as Create(), but leaves on error */
-void RBitVector::CreateL(TUint32 aNumBits)
-    {
-    User::LeaveIfError(Create(aNumBits));
-    }
-
-
-/**
-    Create the vector with the size of aNumBits bits.
-    @return system-wide error codes:
-        KErrNoMemory    unable to allocate sufficient amount of memory for the array
-        KErrInUse       an attempt to call Create() for non-empty vector. Close it first.
-        KErrArgument    invalid aNumBits value == 0
-*/
-TInt RBitVector::Create(TUint32 aNumBits)
-    {
-
-    if(ipData)
-        return KErrInUse; //-- array is already in use. Close it first.
-
-    if(!aNumBits)
-        return KErrArgument;
-
-    //-- memory is allocated by word (32 bit) quiantities
-    const TUint32 numWords = (aNumBits >> 5) + ((aNumBits & 0x1F) > 0 ? 1:0);
-    ipData = (TUint32*)User::AllocZ(numWords << 2);
-
-    if(!ipData)
-        return KErrNoMemory;
-
-    iNumBits  = aNumBits;
-    iNumWords = numWords;
-
-    return KErrNone;
-    }
-
-
-/**
-    Fill a bit vector with a given bit value
-    @param aVal a bit value
-*/
-void RBitVector::Fill(TBool aVal)
-    {
-    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
-    memset(ipData, (aVal ? 0xFF : 0x00), iNumWords << 2);
-    }
-
-/** Invert all bits in a bit vector */
-void RBitVector::Invert()
-{
-    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
-    for(TUint32 i=0; i<iNumWords; ++i)
-        ipData[i] ^= K_FFFF;
-}
-
-
-/**
-    Perform "And" operation between 2 vectors. They shall be the same size.
-    @param  aRhs a vector from the right hand side
-    @panic ESizeMismatch in the case of different vector sizes
-*/
-void RBitVector::And(const RBitVector& aRhs)
-    {
-    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
-    __ASSERT_ALWAYS(iNumBits == aRhs.iNumBits, Panic(ESizeMismatch));
-    for(TUint32 i=0; i<iNumWords; ++i)
-        {
-        ipData[i] &= aRhs.ipData[i];
-        }
-    }
-
-/**
-    Perform "Or" operation between 2 vectors. They shall be the same size.    
-    @param  aRhs a vector from the right hand side
-    @panic ESizeMismatch in the case of different vector sizes
-*/
-void RBitVector::Or(const RBitVector& aRhs)
-    {
-    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
-    __ASSERT_ALWAYS(iNumBits == aRhs.iNumBits, Panic(ESizeMismatch));
-    for(TUint32 i=0; i<iNumWords; ++i)
-        {
-        ipData[i] |= aRhs.ipData[i];
-        }
-    }
-
-/**
-    Perform "Xor" operation between 2 vectors. They shall be the same size.    
-    @param  aRhs a vector from the right hand side
-    @panic ESizeMismatch in the case of different vector sizes
-*/
-void RBitVector::Xor(const RBitVector& aRhs)
-    {
-    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
-    __ASSERT_ALWAYS(iNumBits == aRhs.iNumBits, Panic(ESizeMismatch));
-    for(TUint32 i=0; i<iNumWords; ++i)
-        {
-        ipData[i] ^= aRhs.ipData[i];
-        }
-    }
-
-//-----------------------------------------------------------------------------
-/**
-    Fill a range from bit number "aIndexFrom" to "aIndexTo" inclusively with the value of aVal
-    
-    @param  aIndexFrom  start bit number (inclusive)
-    @param  aIndexTo    end bit number (inclusive)
-    @param  aVal        the value to be used to fill the range (0s or 1s)
-*/
-void RBitVector::Fill(TUint32 aIndexFrom, TUint32 aIndexTo, TBool aVal)
-    {
-    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
-
-    //-- swap indexes if they are not in order
-    if(aIndexFrom > aIndexTo)
-        {
-        const TUint32 tmp = aIndexFrom;
-        aIndexFrom = aIndexTo;
-        aIndexTo = tmp;
-        }
-
-    __ASSERT_ALWAYS((aIndexFrom < iNumBits) && (aIndexTo < iNumBits), Panic(EIndexOutOfRange));
-
-    const TUint32 wordStart = WordNum(aIndexFrom);
-    const TUint32 wordTo    = WordNum(aIndexTo);
-
-    if(aVal)
-        {//-- filling a range with '1'
-        
-        TUint32 shift = BitInWord(aIndexFrom);
-        const TUint32 mask1 = (K_FFFF >> shift) << shift;
-
-        TUint32 mask2 = K_FFFF;
-        shift = 1+BitInWord(aIndexTo);
-        if(shift < 32)
-            {
-            mask2 = ~((mask2 >> shift) << shift);
-            }
-
-        if(wordTo == wordStart)
-            {//-- a special case, filling is in the same word
-            ipData[wordStart] |= (mask1 & mask2);
-            }
-        else
-            {
-            ipData[wordStart] |= mask1; 
-            ipData[wordTo]    |= mask2;
-            
-            const TUint32 wholeWordsBetween = wordTo - wordStart - 1; //-- whole words that can be bulk filled
-
-            if(wholeWordsBetween)
-                memset(ipData+wordStart+1, 0xFF, wholeWordsBetween << 2);
-                            
-            }
-        }
-    else
-        {//-- filling a range with '0'
-        
-        //-- if you need this functionality, remove the panic and uncomment the code below.
-
-        Panic(ENotImplemented);
-        
-        /*
-        TUint32 shift = BitInWord(aIndexFrom);
-        const TUint32 mask1 = ~((K_FFFF >> shift) << shift);
-
-        TUint32 mask2 = 0;
-        shift = 1+BitInWord(aIndexTo);
-        if(shift < 32)
-            {
-            mask2 = ((K_FFFF >> shift) << shift);
-            }
-
-        if(wordTo == wordStart)
-            {//-- a special case, filling is in the same word
-            ipData[wordStart] &= (mask1 | mask2);
-            }
-        else
-            {
-            ipData[wordStart] &= mask1; 
-            ipData[wordTo]    &= mask2;
-            
-            const TUint32 wholeWordsBetween = wordTo - wordStart - 1; //-- whole words that can be bulk filled
-
-            if(wholeWordsBetween)
-                memset(ipData+wordStart+1, 0x00, wholeWordsBetween << 2);
-                            
-            }
-        */
-        }
-
-    }
-
-//-----------------------------------------------------------------------------
-
-/**
-    Search for a specified bit value ('0' or '1') in the vector from the given position.
-    @param  aStartPos   zero-based index; from this position the search will start. This position isn't included to the search.
-                        On return may contain a new position if the specified bit is found in specified direction.
-    @param  aBitVal     zero or non-zero bit to search.
-    @param  aDir        Specifies the search direction
-
-    @return ETrue if the specified bit value is found; aStartPos gets updated.
-            EFalse otherwise.
-
-*/
-TBool RBitVector::Find(TUint32& aStartPos, TBool aBitVal, TFindDirection aDir) const
-    {
-    __ASSERT_ALWAYS(aStartPos < iNumBits, Panic(EIndexOutOfRange));
-    ASSERT(iNumWords && ipData);
-
-    switch(aDir)
-        {
-        case ERight:    //-- Search from the given position to the right
-            return FindToRight(aStartPos, aBitVal);
-
-        case ELeft:     //-- Search from the given position to the left (towards lower index)
-            return FindToLeft(aStartPos, aBitVal);
-
-        case ENearestL: //-- Search for the nearest value in both directions starting from left
-            return FindNearest(aStartPos, aBitVal, ETrue);
-
-        case ENearestR: //-- Search for the nearest value in both directions starting from right
-            return FindNearest(aStartPos, aBitVal, EFalse);
-
-        default:
-            Panic(EWrondFindDirection);
-            return EFalse;
-
-        };
-    
-    }
-
-//-----------------------------------------------------------------------------
-/**
-    Internal method to look for a given bit value in the right direction.
-    see TBool RBitVector::Find(...)
-*/
-TBool RBitVector::FindToRight(TUint32& aStartPos, TBool aBitVal) const
-    {
-    if(aStartPos >= iNumBits-1)
-        return EFalse; //-- no way to the right
-
-    const TUint32 startPos = aStartPos+1;
-    const TUint32 fInvert = aBitVal ? 0 : K_FFFF; //-- invert everything if we are looking for '0' bit
-
-    TUint32 wordNum = WordNum(startPos);
-    TUint32 val = ipData[wordNum] ^ fInvert;
-
-    if(wordNum == iNumWords-1)
-        {//-- process the last word in the array, some higher bits might not belong to the bit vector
-        val = MaskLastWord(val);
-        }
-
-    const TUint32 shift = BitInWord(startPos);
-    val = (val >> shift) << shift; //-- mask unused low bits
-
-    if(val)
-        {//-- there are '1' bits in the current word
-        goto found;
-        }
-    else
-        {//-- search in higher words
-        wordNum++;
-
-        while(iNumWords-wordNum > 1)
-            {
-            val = ipData[wordNum] ^ fInvert;
-            if(val)
-                goto found;
-
-            wordNum++;
-            }
-
-        if(wordNum == iNumWords-1)
-            {//-- process the last word in the array, some higher bith might not belong to the bit vector
-            val = ipData[wordNum] ^ fInvert;
-            val = MaskLastWord(val);
-
-            if(val)
-                goto found;
-            }
-        }
-
-    return EFalse; //-- haven't found anything
-
-  found:
-
-    val &= (~val+1); //-- select rightmost bit
-    aStartPos = (wordNum << 5)+Log2(val);
-    return ETrue;
-    }
-
-
-//-----------------------------------------------------------------------------
-
-/**
-    Internal method to look for a given bit value in the left direction.
-    see TBool RBitVector::Find(...)
-*/
-TBool RBitVector::FindToLeft(TUint32& aStartPos, TBool aBitVal) const
-{
-    if(!aStartPos)
-        return EFalse; //-- no way to the left
-    
-    const TUint32 startPos=aStartPos-1;
-    const TUint32 fInvert = aBitVal ? 0 : K_FFFF; //-- invert everything if we are looking for '0' bit
-
-    TUint32 wordNum = WordNum(startPos);
-    TUint32 val = ipData[wordNum] ^ fInvert;
-
-    const TUint32 shift = 31-(BitInWord(startPos));
-    val = (val << shift) >> shift; //-- mask unused high bits
-
-    if(val)
-    {//-- there are '1' bits in the current word
-        goto found;
-    }
-    else
-    {//-- search in the lower words
-        while(wordNum)
-        {
-            wordNum--;
-            val=ipData[wordNum] ^ fInvert;
-            if(val)
-                goto found;
-        }
-    }
-
-    return EFalse; //-- nothing found
-
- found:
-    aStartPos = (wordNum << 5)+Log2(val);
-    return ETrue;
-}
-
-//-----------------------------------------------------------------------------
-
-/**
-    Internal method to look for a given bit value in the both directions.
-    see TBool RBitVector::Find(...)
-*/
-TBool RBitVector::FindNearest(TUint32& aStartPos, TBool aBitVal, TBool aToLeft) const
-{
-    if(iNumBits < 2)
-        return EFalse;
-
-    if(aStartPos == 0)
-        return FindToRight(aStartPos, aBitVal);
-
-    if(aStartPos == iNumBits-1)
-        return FindToLeft(aStartPos, aBitVal);
-
-    
-    const TUint32 fInvert = aBitVal ? 0 : K_FFFF; //-- invert everything if we are looking for '0' bit
-    
-    TUint32 wordNum = WordNum(aStartPos);
-    TUint32 l_Idx; //-- index of the word to the left
-    TUint32 r_Idx; //-- index of the word to the right
-    
-    l_Idx = r_Idx = wordNum;
-
-    TBool   noWayLeft  = (wordNum == 0);            //-- if we are in the first word
-    TBool   noWayRight = (wordNum == iNumWords-1);  //-- if we are in the last word
-
-    //-- look in the current word first
-    TUint32 val = ipData[wordNum] ^ fInvert;
-    
-    if(noWayRight)
-    {   //-- this is the last word in the array, mask unused high bits in the last word
-        val = MaskLastWord(val);
-    }
-
-    const TUint32 bitPos = aStartPos & 0x1F;
-    val &= ~(1<<bitPos); //-- mask the bit at current position
-    
-    if(val == 0)
-    {//-- no '1' bits in the current word
-        noWayLeft  = ItrLeft(l_Idx);
-        noWayRight = ItrRight(r_Idx);
-    }
-    else if(bitPos == 0)
-    {
-        noWayLeft = ItrLeft(l_Idx); //-- move to the previous word
-    }
-    else if(bitPos == 31)
-    {
-        noWayRight = ItrRight(r_Idx); //-- move to the next word
-    }
-    else
-    {//-- look in the current word, in both halves to the left and right from the start position
-        
-        const TUint32 shift1 = 32-bitPos;
-        const TUint32 partLo = (val << shift1) >> shift1; //-- towards lower bits
-
-        const TUint32 shift2 = bitPos+1;
-        const TUint32 partHi = (val >> shift2) << shift2; //-- towards higher bits 
-        
-
-        if(partLo && !partHi) //-- only lower part has '1' bits   
-        {
-            aStartPos = (wordNum << 5)+Log2(partLo);
-            return ETrue;
-        }
-        else if(!partLo && partHi) //-- only higher part has '1' bits
-        {
-            aStartPos = (wordNum << 5)+Log2( (partHi & (~partHi+1)) );
-            return ETrue;
-        }
-        else if(partLo && partHi) //-- both parts contain '1' bits, select the nearest one
-        {
-            const TUint32 posL = (wordNum << 5)+Log2(partLo);
-            const TUint32 posR = (wordNum << 5)+Log2( (partHi & (~partHi+1)) );
-        
-            ASSERT(aStartPos > posL);
-            ASSERT(posR > aStartPos);
-            const TUint32 distL = aStartPos-posL;
-            const TUint32 distR = posR-aStartPos;
-
-            if(distL < distR)
-            {
-                aStartPos = posL;
-                return ETrue;
-            }
-            else if(distL > distR)
-            {
-                aStartPos = posR;
-                return ETrue;
-            }
-            else
-            {//-- distL == distR, take into account search priority
-                aStartPos = aToLeft ? posL : posR;
-                return ETrue;
-            }
-        }
-        else //-- (!partLo && !partHi), nothing in the current word
-        {
-            ASSERT(0);
-        }
-
-    }// if(bitPos > 0 && bitPos < 31)
-
-    //-- now we are processing separate words from both sides of the search position
-    for(;;)
-    { 
-        TUint32 wL = ipData[l_Idx] ^ fInvert;
-        TUint32 wR = ipData[r_Idx] ^ fInvert;
-        if(r_Idx == iNumWords-1)
-        {   //-- this is the last word in the array, mask unused high bits in the last word
-            wR = MaskLastWord(wR);
-        }
-
-        if(wL && !wR)
-        {
-            aStartPos = (l_Idx << 5)+Log2(wL);
-            return ETrue;
-        }
-        else if(!wL && wR)
-        {
-            aStartPos = (r_Idx << 5)+Log2( (wR & (~wR+1)) );
-            return ETrue;
-        }
-        else if(wL && wR)
-        {
-            const TUint32 posL = (l_Idx << 5)+Log2(wL);
-            const TUint32 posR = (r_Idx << 5)+Log2( (wR & (~wR+1)) );
-        
-            ASSERT(aStartPos > posL);
-            ASSERT(posR > aStartPos);
-            const TUint32 distL = aStartPos-posL;
-            const TUint32 distR = posR-aStartPos;
-
-            if(distL < distR)
-            {
-                aStartPos = posL;
-                return ETrue;
-            }
-            else if(distL > distR)
-            {
-                aStartPos = posR;
-                return ETrue;
-            }
-            else
-            {//-- distL == distR, take into account search priority
-                aStartPos = aToLeft ? posL : posR;
-                return ETrue;
-            }
-
-        }//else if(wL && wR)
-
-
-        if(noWayLeft)
-        {
-            aStartPos = r_Idx << 5;
-            return FindToRight(aStartPos, aBitVal);
-        }
-        else
-        {
-            noWayLeft  = ItrLeft(l_Idx);
-        }
-
-        if(noWayRight)
-        {
-            aStartPos = l_Idx << 5;
-            return FindToLeft(aStartPos, aBitVal);
-        }
-        else
-        {    
-            noWayRight = ItrRight(r_Idx);
-        }
-
-   }//for(;;)
-
-    //return EFalse;
-}
-
-//-----------------------------------------------------------------------------
-/**
-    Find out if two vectors are different.
-
-    @param  aRhs        vector to compare with
-    @param  aDiffIndex  if there is a differene, here will be the number of the first different bit
-    @return ETrue if vectors differ, EFalse, if they are identical.
-*/
-TBool RBitVector::Diff(const RBitVector& aRhs, TUint32& aDiffIndex) const
-{
-    __ASSERT_ALWAYS(ipData, Panic(ENotInitialised));
-    __ASSERT_ALWAYS(iNumBits == aRhs.iNumBits, Panic(ESizeMismatch));
-    ASSERT(iNumWords > 0);
-
-    TUint32 diffWord=0;
-    TUint32 wordNum=0;
-
-    //-- compare all but the last word in the array
-    for(wordNum=0; wordNum < iNumWords-1; ++wordNum)
-    {
-        diffWord = ipData[wordNum] ^ aRhs.ipData[wordNum];
-        if(diffWord)
-            break;  //-- found difference
-    }
-
-    //-- process the last word in the array
-    if(!diffWord)
-    {
-        diffWord = MaskLastWord(ipData[wordNum]) ^ MaskLastWord(aRhs.ipData[wordNum]);
-    }
-
-    if(!diffWord)
-        return EFalse; //-- vectors are the same
-
-    //-- calculate the position of the bit that different.
-    diffWord &= (~diffWord+1); //-- select rightmost bit
-    aDiffIndex = (wordNum << 5)+Log2(diffWord);
-    
-    return ETrue;
-}
-//-----------------------------------------------------------------------------
-
-/**
-    Iterate to the left (towards lower index) in the array of words ipData
-
-    @param  aIdx index within ipData array to be decremented; if it's possible to move left, it will be decreased
-    @return ETrue if there is no way left i.e. aIdx is 0. EFalse otherwise and aIdx decreased.
-*/
-TBool RBitVector::ItrLeft(TUint32& aIdx) const
-{
-    if(aIdx == 0)
-        return ETrue;
-    else
-    {
-        aIdx--;
-        return EFalse;
-    }
-}
-
-
-/**
-    Iterate to the right (towards higher index) in the array of words ipData
-
-    @param  aIdx index within ipData array to be incremented; if it's possible to move right, it will be increased
-    @return ETrue if there is no way right i.e. aIdx corresponds to the last word. EFalse otherwise and aIdx increased.
-*/
-TBool RBitVector::ItrRight(TUint32& aIdx) const
-{
-    if(aIdx < iNumWords-1)
-    {
-        aIdx++;
-        return EFalse;
-    }
-    else
-        return ETrue;
-}
 
 
 
 
 
-
-
-
--- a/userlibandfileserver/fileserver/sfile/sf_drv.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfile/sf_drv.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -59,7 +59,6 @@
 // Validate a drive number and set iTheDrive.
 //
 	{
-	__CHECK_MAINTHREAD();
 	if (aDriveNumber==KDefaultDrive)
 		aDriveNumber=aRequest->Session()->CurrentDrive();
 	if (!RFs::IsValidDrive(aDriveNumber))
@@ -1002,33 +1001,30 @@
 	return(r);
 	}
 
+/*
+ Delete files allowing wild cards.
+*/
 TInt TDrive::Delete(const TDesC& aName)
-//
-// Delete files allowing wild cards.
-//
 	{
 	TInt r=CheckMountAndEntryName(aName);
-	if (r!=KErrNone)
-		return(r);
-	CFileCB* pF=LocateFile(aName);
-	if (pF!=NULL)
-		return(KErrInUse);		
+	if(r!=KErrNone)
+		return r;
+	
+	if(LocateFile(aName))
+		return KErrInUse; //-- the file is already opened by someone
 
 	// remove from closed queue - NB this isn't strictly necessary if file is read-only or write-protected...
 	LocateClosedFile(aName, EFalse);
 
-	TEntry entry;
-	r=Entry(aName,entry);
-	if (r!=KErrNone)
-		return(r);
-	if (entry.IsDir() || IsWriteProtected() || entry.IsReadOnly())
+    if (IsWriteProtected())
 		return(KErrAccessDenied);
 
+    //-- filesystems' CMountCB::DeleteL() implementations shall check the entry attributes themeselves. 
 	TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBDeleteL, EF32TraceUidFileSys, DriveNumber(), aName);
 	TRAP(r,CurrentMount().DeleteL(aName))
 	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBDeleteLRet, EF32TraceUidFileSys, r);
 
-	return(r);
+	return r;
 	}
 
 TInt TDrive::CheckMountAndEntryNames(const TDesC& anOldName,const TDesC& aNewName)
@@ -1686,22 +1682,20 @@
 	return(r);
 	}
 
+
+/**
+    Query whether the file is open or not.
+*/
 TInt TDrive::IsFileOpen(const TDesC& aFileName,CFileCB*& aFileCB)
-//
-// Query whether the file is open or not.
-//
 	{
 	__CHECK_DRIVETHREAD(iDriveNumber);
 
 	aFileCB = NULL;
 	
-	TEntry dumEntry;
-	TInt r=Entry(aFileName,dumEntry);
+	TInt r=CheckMountAndEntryName(aFileName);
 	if (r!=KErrNone)
 		return(r);
-	if(dumEntry.iAtt&KEntryAttDir)
-		return KErrArgument;
-
+    
 	Files->Lock();
 	TInt count=Files->Count();
 
--- a/userlibandfileserver/fileserver/sfile/sf_memory_client.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfile/sf_memory_client.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -34,7 +34,11 @@
 	{
 	const TUint32 segCnt = iTouchedRegionFlag <= iReservedRegionMarkInSegs ? 
 										iReservedRegionMarkInSegs : iTouchedRegionFlag;
-	DecommitSegments(iBase, segCnt);
+	TInt r = DecommitSegments(iBase, segCnt);
+	if (r != KErrNone)  // this 'if() {}' is to remove build warnings
+	{
+	ASSERT(0);
+	}
 	iReusablePagePool.Close();
 	delete iName;
 	}
--- a/userlibandfileserver/fileserver/sfile/sf_memory_man.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfile/sf_memory_man.h	Mon Jan 18 21:31:10 2010 +0200
@@ -98,8 +98,8 @@
 	static TInt32 iLowMemoryThreshold;
 	};
 
-/** Default cache memory size in KBytes (32768 KBytes)*/
-const TInt 	KDefaultGlobalCacheMemorySize = (32 << 10);
+/** Default cache memory size in KBytes (8192 KBytes)*/
+const TInt 	KDefaultGlobalCacheMemorySize = (8 << 10);
 /** 
 Low memory threshold as a percentage of total RAM (10 %)
 If the amount of RAM drops below this value, attempts to allocate memory will fail
--- a/userlibandfileserver/fileserver/sfile/sf_ops.h	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfile/sf_ops.h	Mon Jan 18 21:31:10 2010 +0200
@@ -33,7 +33,7 @@
 		{	EFsNotifyChangeCancel,		ESync,					&TFsNotifyChangeCancel::Initialise,			NULL,								&TFsNotifyChangeCancel::DoRequestL			},
 		{	EFsDriveList,				ESync,					&TFsDriveList::Initialise,					NULL,								&TFsDriveList::DoRequestL					},
 		{	EFsDrive,					ESync,					&TFsDrive::Initialise,						NULL,								&TFsDrive::DoRequestL						},
-		{	EFsVolume,					0,						&TFsVolume::Initialise,						NULL,								&TFsVolume::DoRequestL						},
+		{	EFsVolume,					0,						&TFsVolume::Initialise,						NULL,								&TFsVolume::DoRequestL						, MSG0(EVolumeInfo)},
 		{	EFsSetVolume,				0,						&TFsSetVolume::Initialise,					NULL,								&TFsSetVolume::DoRequestL					},
 		{	EFsSubst,					ESync,					&TFsSubst::Initialise,						NULL,								&TFsSubst::DoRequestL						},
 		{	EFsSetSubst,				ESync | EParseSrc,		&TFsSetSubst::Initialise,					NULL,								&TFsSetSubst::DoRequestL					},
--- a/userlibandfileserver/fileserver/sfile/sf_plugin_shim.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfile/sf_plugin_shim.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -119,6 +119,16 @@
 #endif
 	}
 
+EXPORT_C TInt RFsPlugin::Volume(TVolumeInfo &aVol, TInt aDrive) const
+/**
+Gets volume information for a formatted device.
+
+@see RFs::Volume
+*/
+	{
+	return (RFs::Volume(aVol, aDrive));
+	}
+
 TInt RFsPlugin::SendReceive(TInt aFunction,const TIpcArgs& aArgs) const
 	{
 	return iSessionHelper.SendReceive(aFunction, aArgs);
@@ -128,7 +138,7 @@
 	{
 	if(Handle())
 		return RSessionBase::SendReceive(aFunction, aArgs);
-		
+
 	return ((RFsPlugin*) this)->SendReceive(aFunction, aArgs);
 	}
 
@@ -236,7 +246,7 @@
 
 	return err;
 	}
-    
+
 EXPORT_C TInt RFilePlugin::TransferToClient()
 /**
 Closes the file.
@@ -306,7 +316,7 @@
 
 EXPORT_C TInt RFilePlugin::Read(TInt64 aPos,TDes8& aDes,TInt aLen) const
 /**
-Reads the specified number of bytes of binary data from the file at a specified 
+Reads the specified number of bytes of binary data from the file at a specified
 offset within the file.
 
 @see RFile::Read
@@ -399,7 +409,7 @@
 
 EXPORT_C TInt RFilePlugin::Flush()
 /**
-Commits data to the storage device and flushes internal buffers without closing 
+Commits data to the storage device and flushes internal buffers without closing
 the file.
 
 @see RFile::Flush
@@ -523,7 +533,7 @@
 
 void RFile::CloseSubSession(TInt aFunction)
 	{
-	if((Session().Handle() ^ CObjectIx::ENoClose) != KErrBadHandle) 
+	if((Session().Handle() ^ CObjectIx::ENoClose) != KErrBadHandle)
 		RSubSessionBase::CloseSubSession(aFunction);
 	else
 		((RFilePlugin*) this)->CloseSubSession(aFunction);
@@ -531,9 +541,9 @@
 
 TInt RFile::SendReceive(TInt aFunction,const TIpcArgs& aArgs) const
 	{
-	if((Session().Handle() ^ CObjectIx::ENoClose) != KErrBadHandle) 
+	if((Session().Handle() ^ CObjectIx::ENoClose) != KErrBadHandle)
 		return RSubSessionBase::SendReceive(aFunction, aArgs);
-		
+
 	return ((RFilePlugin*) this)->SendReceive(aFunction, aArgs);
 	}
 
@@ -584,7 +594,7 @@
 	TPckgC<TUidType> pckgUid(uidType);
 	return(CreateSubSession(fs,EFsDirOpen,TIpcArgs(&aMatchName,anAttMask,&pckgUid)));
 	}
-    
+
 EXPORT_C void RDirPlugin::Close()
 /**
 Closes the the directory.
@@ -653,7 +663,7 @@
 
 TInt RDir::SendReceive(TInt aFunction,const TIpcArgs& aArgs) const
 	{
-	if((Session().Handle() ^ CObjectIx::ENoClose) != KErrBadHandle) 
+	if((Session().Handle() ^ CObjectIx::ENoClose) != KErrBadHandle)
 		return RSubSessionBase::SendReceive(aFunction, aArgs);
 
 	return ((RDirPlugin*) this)->SendReceive(aFunction, aArgs);
@@ -730,7 +740,7 @@
 
 	newRequest->Dispatch();
 
-	// NOTE : newRequest will be free'd by the File Server before completing the 
+	// NOTE : newRequest will be free'd by the File Server before completing the
 	//        request so it's not safe to touch the request from now on...
 	
 	return(iPlugin->WaitForRequest());
--- a/userlibandfileserver/fileserver/sfsrv/cl_clamp.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfsrv/cl_clamp.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -16,6 +16,7 @@
 //
 
 #include <f32file.h>
+#include <e32ldr_private.h>
 
 
 EXPORT_C TInt RFileClamp::Clamp(RFile& aFile)
--- a/userlibandfileserver/fileserver/sfsrv/cl_cli.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfsrv/cl_cli.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -2631,8 +2631,6 @@
 
 
 
-
-EFSRV_EXPORT_C TInt RFs::CheckDisk(const TDesC& aDrive) const
 /**
 Checks the integrity of the disk on the specified drive.
 On FAT, this checks if a cluster number is invalid, if a cluster is allocated to
@@ -2652,11 +2650,11 @@
         KErrNotReady, if the specified drive is empty;
         KErrNotSupported, if the drive cannot handle this request;
         KErrPermissionDenied, if the caller doesn't have DiskAdmin capability;
-		KErrTooBig, if the drives folder depth exceeds maximum allowed. For the current FAT file system implementation this limit is 50.
         Other system wide error codes may also be returned.
 
 @capability DiskAdmin
 */
+EFSRV_EXPORT_C TInt RFs::CheckDisk(const TDesC& aDrive) const
 	{
 	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDisk, MODULEUID, Handle(), aDrive);
 	TInt r = SendReceive(EFsCheckDisk,TIpcArgs(&aDrive));
--- a/userlibandfileserver/fileserver/sfsrv/cl_plugin.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/sfsrv/cl_plugin.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -414,7 +414,7 @@
 Client requests a synchronous operation
 
 @param	aFunction: The operation to be handled
-@param	a1: returned buffer from plugin on comletion of the request
+@param	a1: returned buffer from plugin on completion of the request
 */
 	{
 	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl2, MODULEUID, Session().Handle(), SubSessionHandle(), aFunction, &a1);
@@ -432,8 +432,8 @@
 Client requests a synchronous operation
 
 @param	aFunction: The operation to be handled
-@param	a1: returned buffer from plugin on comletion of the request
-@param  a2: 2nd returned buffer from plugin on comletion of the request
+@param	a1: returned buffer from plugin on completion of the request
+@param  a2: 2nd returned buffer from plugin on completion of the request
 */
 	{
 	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl3, MODULEUID, Session().Handle(), SubSessionHandle(), aFunction, &a1, &a2);
--- a/userlibandfileserver/fileserver/swins/elocal.cpp	Thu Jan 07 13:38:45 2010 +0200
+++ b/userlibandfileserver/fileserver/swins/elocal.cpp	Mon Jan 18 21:31:10 2010 +0200
@@ -374,7 +374,14 @@
 
 	if (IsRomDrive())
 		User::Leave(KErrAccessDenied);
-	TFileName n;
+	
+    //-- check entry attributes
+    TEntry entry;
+    EntryL(aName, entry);
+	if (entry.IsDir() ||  entry.IsReadOnly())
+	    User::Leave(KErrAccessDenied);
+
+    TFileName n;
 	MapFileNameL(n,Drive().DriveNumber(),aName);
 	BOOL b=Emulator::DeleteFile(StrPtrZL(n));
 	
@@ -947,8 +954,8 @@
 	if (h==INVALID_HANDLE_VALUE)
 		User::Leave(Emulator::LastError());
 	FindClose(h);
-	if (d.cAlternateFileName[0])	// we have a dos name too
-		aShortName=(TText*)(&d.cAlternateFileName[0]);
+    if (d.cAlternateFileName[0])	// we have a dos name too
+        aShortName=(TText*)(&d.cAlternateFileName[0]);
 	else
 		aShortName=(TText*)(&d.cFileName[0]);
 	}
@@ -1411,7 +1418,7 @@
 	CheckPosL(aPos);
 	TInt pos=0;
 	TInt len=aLength;
-	TBuf8<0x1000> buf;
+	TBuf8<65536> buf;
 
 	if (aMessage.Handle() == KLocalMessageHandle)
 		((TPtr8* )aDes)->SetLength(0);
@@ -1471,7 +1478,7 @@
 	CheckPosL(aPos);
 	TInt pos=0;
 	TInt len=aLength;
-	TBuf8<0x1000> buf;
+	TBuf8<65536> buf;
 
 	while (len)
 		{