kernel/eka/drivers/medmmc/medmmc.cpp
branchRCL_3
changeset 42 a179b74831c9
parent 36 bbf8bed59bcb
child 43 c1f20ce4abcf
equal deleted inserted replaced
41:0ffb4e86fcc9 42:a179b74831c9
   795 			    }
   795 			    }
   796 			}
   796 			}
   797 		}
   797 		}
   798 	else
   798 	else
   799 		{
   799 		{
   800 #if defined(__DEMAND_PAGING__) && !defined(__WINS__)
   800 		TPtrC8 zeroDes(NULL, 0);
   801 		if (DMediaPagingDevice::PageInRequest(*iCurrentReq))
   801 		r = iCurrentReq->WriteRemote(&zeroDes,0);
   802 			{
       
   803 			r = iCurrentReq->WriteToPageHandler(NULL, 0, 0);
       
   804 			}
       
   805 		else
       
   806 #endif	// __DEMAND_PAGING__
       
   807 			{
       
   808 			TPtrC8 zeroDes(NULL, 0);
       
   809 			r = iCurrentReq->WriteRemote(&zeroDes,0);
       
   810 			}
       
   811 		}
   802 		}
   812 
   803 
   813 	// error occurred or read all from cache so complete immediately
   804 	// error occurred or read all from cache so complete immediately
   814 	if(r == KErrNone)
   805 	if(r == KErrNone)
   815 		r = KErrCompletion;
   806 		r = KErrCompletion;
  2896 	{
  2887 	{
  2897 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED_ENTRY, this );
  2888 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED_ENTRY, this );
  2898 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd));
  2889 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd));
  2899 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=%x:%x; iReqEnd=0x%x", (TUint) I64HIGH(iReqCur), (TUint) I64LOW(iReqCur), (TUint) iReqEnd );
  2890 	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=%x:%x; iReqEnd=0x%x", (TUint) I64HIGH(iReqCur), (TUint) I64LOW(iReqCur), (TUint) iReqEnd );
  2900 	
  2891 	
  2901 	if ( iCurrentReq->IsPhysicalAddress()
  2892 	if ( (iCurrentReq->DriverFlags() & RLocalDrive::ELocDrvDirectIO) || iCurrentReq->IsPhysicalAddress()
  2902 #if defined(__DEMAND_PAGING__) && !defined(__WINS__)
  2893 #if defined(__DEMAND_PAGING__) && !defined(__WINS__)
  2903 	     || DMediaPagingDevice::PageInRequest(*iCurrentReq)
  2894 	     || DMediaPagingDevice::PageInRequest(*iCurrentReq)
  2904 #endif //DEMAND_PAGING 
  2895 #endif //DEMAND_PAGING 
  2905         )
  2896         )
  2906 		{
  2897 		{
  2957 
  2948 
  2958 	// write data from internal buffer
  2949 	// write data from internal buffer
  2959 	TUint usrOfst = I64LOW(iReqCur - iReqStart);
  2950 	TUint usrOfst = I64LOW(iReqCur - iReqStart);
  2960 
  2951 
  2961 	OstTrace0( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_LATENCY1, "Begin writing user data" );
  2952 	OstTrace0( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_LATENCY1, "Begin writing user data" );
  2962 #if defined(__DEMAND_PAGING__) && !defined(__WINS__)
  2953 	r = iCurrentReq->WriteRemote(&extrView,usrOfst);
  2963 	if (DMediaPagingDevice::PageInRequest(*iCurrentReq))
       
  2964 		r=iCurrentReq->WriteToPageHandler((TUint8 *)(&extrView[0]), len, usrOfst);
       
  2965 	else
       
  2966 #endif	// __DEMAND_PAGING__
       
  2967 		r = iCurrentReq->WriteRemote(&extrView,usrOfst);
       
  2968 	
  2954 	
  2969 	OstTrace0( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_LATENCY2, "End writing user data" );
  2955 	OstTrace0( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_LATENCY2, "End writing user data" );
  2970 
  2956 
  2971 	OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_EXIT, this, r );
  2957 	OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_EXIT, this, r );
  2972 	return r;
  2958 	return r;
  2973 	}
  2959 	}
  2974 
  2960 
  2975 TInt DMmcMediaDriverFlash::ReadDataFromUser(TDes8& aDes, TInt aOffset)
  2961 TInt DMmcMediaDriverFlash::ReadDataFromUser(TDes8& aDes, TInt aOffset)
  2976 	{
  2962 	{
  2977 	OstTraceExt2(TRACE_FLOW, DMMCMEDIADRIVERFLASH_READDATAFROMUSER_ENTRY ,"DMmcMediaDriverFlash::ReadDataFromUser;aOffset=%d;this=%x", aOffset, (TUint) this);
  2963 	OstTraceExt2(TRACE_FLOW, DMMCMEDIADRIVERFLASH_READDATAFROMUSER_ENTRY ,"DMmcMediaDriverFlash::ReadDataFromUser;aOffset=%d;this=%x", aOffset, (TUint) this);
  2978 	TInt r = KErrNotSupported;
  2964 
  2979 #ifndef __WINS__
  2965 	TInt r = iCurrentReq->ReadRemote(&aDes, aOffset);
  2980 	if (DMediaPagingDevice::PageOutRequest(*iCurrentReq))
  2966 
  2981 	    {
  2967 	OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_READDATAFROMUSER_EXIT1, this, r );
  2982 		r = iCurrentReq->ReadFromPageHandler((TAny*) aDes.Ptr(), aDes.MaxLength(), aOffset);
       
  2983 		OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_READDATAFROMUSER_EXIT1, this, r );
       
  2984 		return r;
       
  2985 	    }
       
  2986 	else
       
  2987 #endif // #ifndef __WINS__
       
  2988 		r = iCurrentReq->ReadRemote(&aDes, aOffset);
       
  2989 	
       
  2990 	OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_READDATAFROMUSER_EXIT2, this, r );
       
  2991 	return r;
  2968 	return r;
  2992 	}
  2969 	}
  2993 
  2970 
  2994 TInt DMmcMediaDriverFlash::AdjustPhysicalFragment(TPhysAddr &aPhysAddr, TInt &aPhysLength)
  2971 TInt DMmcMediaDriverFlash::AdjustPhysicalFragment(TPhysAddr &aPhysAddr, TInt &aPhysLength)
  2995 //
  2972 //
  3698 		TLocDrv& drive = *aRequest.Drive();
  3675 		TLocDrv& drive = *aRequest.Drive();
  3699 		r = Caps(drive, c);
  3676 		r = Caps(drive, c);
  3700 		c.iSize = drive.iPartitionLen;
  3677 		c.iSize = drive.iPartitionLen;
  3701 		c.iPartitionType = drive.iPartitionType;	
  3678 		c.iPartitionType = drive.iPartitionType;	
  3702 		c.iHiddenSectors = (TUint) (drive.iPartitionBaseAddr >> KDiskSectorShift);
  3679 		c.iHiddenSectors = (TUint) (drive.iPartitionBaseAddr >> KDiskSectorShift);
       
  3680 		SetTotalSizeInBytes(c);
  3703 		OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_REQUEST_EXIT1, this, r );
  3681 		OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_REQUEST_EXIT1, this, r );
  3704 		return r;
  3682 		return r;
  3705 		}
  3683 		}
  3706 
  3684 
  3707 	// All other requests must be deferred if a request is currently in progress
  3685 	// All other requests must be deferred if a request is currently in progress