kernel/eka/drivers/medmmc/medmmc.cpp
changeset 109 b3a1d9898418
parent 39 5d2844f35677
child 133 2a0ada0a1bf8
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
   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;
  2955 
  2946 
  2956 	// write data from internal buffer
  2947 	// write data from internal buffer
  2957 	TUint usrOfst = I64LOW(iReqCur - iReqStart);
  2948 	TUint usrOfst = I64LOW(iReqCur - iReqStart);
  2958 
  2949 
  2959 	OstTrace0( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_LATENCY1, "Begin writing user data" );
  2950 	OstTrace0( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_LATENCY1, "Begin writing user data" );
  2960 #if defined(__DEMAND_PAGING__) && !defined(__WINS__)
  2951 	r = iCurrentReq->WriteRemote(&extrView,usrOfst);
  2961 	if (DMediaPagingDevice::PageInRequest(*iCurrentReq))
       
  2962 		r=iCurrentReq->WriteToPageHandler((TUint8 *)(&extrView[0]), len, usrOfst);
       
  2963 	else
       
  2964 #endif	// __DEMAND_PAGING__
       
  2965 		r = iCurrentReq->WriteRemote(&extrView,usrOfst);
       
  2966 	
  2952 	
  2967 	OstTrace0( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_LATENCY2, "End writing user data" );
  2953 	OstTrace0( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_LATENCY2, "End writing user data" );
  2968 
  2954 
  2969 	OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_EXIT, this, r );
  2955 	OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_WRITEDATATOUSER_EXIT, this, r );
  2970 	return r;
  2956 	return r;
  2971 	}
  2957 	}
  2972 
  2958 
  2973 TInt DMmcMediaDriverFlash::ReadDataFromUser(TDes8& aDes, TInt aOffset)
  2959 TInt DMmcMediaDriverFlash::ReadDataFromUser(TDes8& aDes, TInt aOffset)
  2974 	{
  2960 	{
  2975 	OstTraceExt2(TRACE_FLOW, DMMCMEDIADRIVERFLASH_READDATAFROMUSER_ENTRY ,"DMmcMediaDriverFlash::ReadDataFromUser;aOffset=%d;this=%x", aOffset, (TUint) this);
  2961 	OstTraceExt2(TRACE_FLOW, DMMCMEDIADRIVERFLASH_READDATAFROMUSER_ENTRY ,"DMmcMediaDriverFlash::ReadDataFromUser;aOffset=%d;this=%x", aOffset, (TUint) this);
  2976 	TInt r = KErrNotSupported;
  2962 
  2977 #ifndef __WINS__
  2963 	TInt r = iCurrentReq->ReadRemote(&aDes, aOffset);
  2978 	if (DMediaPagingDevice::PageOutRequest(*iCurrentReq))
  2964 
  2979 	    {
  2965 	OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_READDATAFROMUSER_EXIT1, this, r );
  2980 		r = iCurrentReq->ReadFromPageHandler((TAny*) aDes.Ptr(), aDes.MaxLength(), aOffset);
       
  2981 		OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_READDATAFROMUSER_EXIT1, this, r );
       
  2982 		return r;
       
  2983 	    }
       
  2984 	else
       
  2985 #endif // #ifndef __WINS__
       
  2986 		r = iCurrentReq->ReadRemote(&aDes, aOffset);
       
  2987 	
       
  2988 	OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_READDATAFROMUSER_EXIT2, this, r );
       
  2989 	return r;
  2966 	return r;
  2990 	}
  2967 	}
  2991 
  2968 
  2992 TInt DMmcMediaDriverFlash::AdjustPhysicalFragment(TPhysAddr &aPhysAddr, TInt &aPhysLength)
  2969 TInt DMmcMediaDriverFlash::AdjustPhysicalFragment(TPhysAddr &aPhysAddr, TInt &aPhysLength)
  2993 //
  2970 //
  3696 		TLocDrv& drive = *aRequest.Drive();
  3673 		TLocDrv& drive = *aRequest.Drive();
  3697 		r = Caps(drive, c);
  3674 		r = Caps(drive, c);
  3698 		c.iSize = drive.iPartitionLen;
  3675 		c.iSize = drive.iPartitionLen;
  3699 		c.iPartitionType = drive.iPartitionType;	
  3676 		c.iPartitionType = drive.iPartitionType;	
  3700 		c.iHiddenSectors = (TUint) (drive.iPartitionBaseAddr >> KDiskSectorShift);
  3677 		c.iHiddenSectors = (TUint) (drive.iPartitionBaseAddr >> KDiskSectorShift);
       
  3678 		SetTotalSizeInBytes(c);
  3701 		OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_REQUEST_EXIT1, this, r );
  3679 		OstTraceFunctionExitExt( DMMCMEDIADRIVERFLASH_REQUEST_EXIT1, this, r );
  3702 		return r;
  3680 		return r;
  3703 		}
  3681 		}
  3704 
  3682 
  3705 	// All other requests must be deferred if a request is currently in progress
  3683 	// All other requests must be deferred if a request is currently in progress