757 |
757 |
758 const TInt64 pos(iCurrentReq->Pos()); |
758 const TInt64 pos(iCurrentReq->Pos()); |
759 TUint32 length(I64LOW(iCurrentReq->Length())); |
759 TUint32 length(I64LOW(iCurrentReq->Length())); |
760 |
760 |
761 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dr:0x%lx,0x%x", pos, length)); |
761 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dr:0x%lx,0x%x", pos, length)); |
762 OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DO_READ, "Position=0x%lx; Length=0x%x", (TUint) pos, (TUint) length); |
762 OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DO_READ, "Position=%x:%x; Length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length); |
763 __ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDRInUse)); |
763 __ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDRInUse)); |
764 __ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDRStart)); |
764 __ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDRStart)); |
765 __ASSERT_DEBUG(iCurrentReq->Length() >= 0, Panic(EDRNotPositive)); |
765 __ASSERT_DEBUG(iCurrentReq->Length() >= 0, Panic(EDRNotPositive)); |
766 __ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDREnd)); |
766 __ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDREnd)); |
767 |
767 |
819 // read into iIntBuf. iIntBuf can be set to a cached entry or to the minor buffer. It is |
819 // read into iIntBuf. iIntBuf can be set to a cached entry or to the minor buffer. It is |
820 // assumed that before this function is called that ReadDataUntilCacheExhausted() has been used. |
820 // assumed that before this function is called that ReadDataUntilCacheExhausted() has been used. |
821 // |
821 // |
822 { |
822 { |
823 OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHREAD_ENTRY, this ); |
823 OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHREAD_ENTRY, this ); |
824 OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHREAD, "position=0x%lx; length=0x%x", (TUint) iCurrentReq->Pos(), (TUint) I64LOW(iCurrentReq->Length())); |
824 OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHREAD, "position=%x:%x; length=0x%x", (TUint) I64HIGH(iCurrentReq->Pos()), (TUint) I64LOW(iCurrentReq->Pos()) ,(TUint) I64LOW(iCurrentReq->Length())); |
825 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lr:0x%lx,0x%x", aStart, aLength)); |
825 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lr:0x%lx,0x%x", aStart, aLength)); |
826 __ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart)); |
826 __ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart)); |
827 __ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive)); |
827 __ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive)); |
828 __ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELREnd)); |
828 __ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELREnd)); |
829 __ASSERT_CACHE(GetCachedBlock(aStart & ~iBlkMsk) == 0, Panic(ELRCached)); |
829 __ASSERT_CACHE(GetCachedBlock(aStart & ~iBlkMsk) == 0, Panic(ELRCached)); |
885 // assumed that before this function is called that ReadDataUntilCacheExhausted() has been used. |
885 // assumed that before this function is called that ReadDataUntilCacheExhausted() has been used. |
886 // |
886 // |
887 { |
887 { |
888 OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_LAUNCHDBREAD_ENTRY, this ); |
888 OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_LAUNCHDBREAD_ENTRY, this ); |
889 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:ldbr:0x%lx,0x%x", iReqCur, I64LOW(iReqEnd - iReqCur))); |
889 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:ldbr:0x%lx,0x%x", iReqCur, I64LOW(iReqEnd - iReqCur))); |
890 OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHDBREAD, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur)); |
890 OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHDBREAD, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur)); |
891 __ASSERT_DEBUG(TotalSizeInBytes() > iReqCur, Panic(ELRStart)); |
891 __ASSERT_DEBUG(TotalSizeInBytes() > iReqCur, Panic(ELRStart)); |
892 __ASSERT_DEBUG(I64LOW(iReqEnd - iReqCur) > 0, Panic(ELRNotPositive)); |
892 __ASSERT_DEBUG(I64LOW(iReqEnd - iReqCur) > 0, Panic(ELRNotPositive)); |
893 __ASSERT_DEBUG(TotalSizeInBytes() >= iReqEnd, Panic(ELREnd)); |
893 __ASSERT_DEBUG(TotalSizeInBytes() >= iReqEnd, Panic(ELREnd)); |
894 __ASSERT_CACHE(GetCachedBlock(iReqCur & ~iBlkMsk) == 0, Panic(ELRCached)); |
894 __ASSERT_CACHE(GetCachedBlock(iReqCur & ~iBlkMsk) == 0, Panic(ELRCached)); |
895 __ASSERT_DEBUG(iSession != NULL, Panic(ECFSessPtrNull)); |
895 __ASSERT_DEBUG(iSession != NULL, Panic(ECFSessPtrNull)); |
946 // It is assumed that before this function is called that |
946 // It is assumed that before this function is called that |
947 // ReadDataUntilCacheExhausted() has been used. |
947 // ReadDataUntilCacheExhausted() has been used. |
948 // |
948 // |
949 { |
949 { |
950 OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD_ENTRY, this ); |
950 OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD_ENTRY, this ); |
951 OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur)); |
951 OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur)); |
952 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:physr:0x%lx,0x%x", aStart, aLength)); |
952 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:physr:0x%lx,0x%x", aStart, aLength)); |
953 __ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart)); |
953 __ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart)); |
954 __ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive)); |
954 __ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive)); |
955 __ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELREnd)); |
955 __ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELREnd)); |
956 __ASSERT_CACHE(GetCachedBlock(aStart & ~iBlkMsk) == 0, Panic(ELRCached)); |
956 __ASSERT_CACHE(GetCachedBlock(aStart & ~iBlkMsk) == 0, Panic(ELRCached)); |
1038 OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_DOWRITE_ENTRY, this ); |
1038 OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_DOWRITE_ENTRY, this ); |
1039 const TInt64 pos = iCurrentReq->Pos(); |
1039 const TInt64 pos = iCurrentReq->Pos(); |
1040 const TUint32 length = I64LOW(iCurrentReq->Length()); |
1040 const TUint32 length = I64LOW(iCurrentReq->Length()); |
1041 |
1041 |
1042 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dw:0x%lx,0x%x", pos, length)); |
1042 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dw:0x%lx,0x%x", pos, length)); |
1043 OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOWRITE, "position=0x%lx; length=0x%x", (TUint) pos, (TUint) length); |
1043 OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOWRITE, "position=%x:%x; length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length); |
1044 __ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDWInUse)); |
1044 __ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDWInUse)); |
1045 __ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDWStart)); |
1045 __ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDWStart)); |
1046 __ASSERT_DEBUG(length > 0, Panic(EDWNotPositive)); |
1046 __ASSERT_DEBUG(length > 0, Panic(EDWNotPositive)); |
1047 __ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDWEnd)); |
1047 __ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDWEnd)); |
1048 |
1048 |
1073 OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_DOFORMAT_ENTRY, this ); |
1073 OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_DOFORMAT_ENTRY, this ); |
1074 const TInt64 pos = iCurrentReq->Pos(); |
1074 const TInt64 pos = iCurrentReq->Pos(); |
1075 const TUint32 length = I64LOW(iCurrentReq->Length()); |
1075 const TUint32 length = I64LOW(iCurrentReq->Length()); |
1076 |
1076 |
1077 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:df:0x%lx,0x%x", pos, length)); |
1077 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:df:0x%lx,0x%x", pos, length)); |
1078 OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOFORMAT, "position=0x%lx; length=0x%x", (TUint) pos, (TUint) length); |
1078 OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOFORMAT, "position=%x:%x; length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length); |
1079 __ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDFInUse)); |
1079 __ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDFInUse)); |
1080 __ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDFStart)); |
1080 __ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDFStart)); |
1081 __ASSERT_DEBUG(length > 0, Panic(EDFNotPositive)); |
1081 __ASSERT_DEBUG(length > 0, Panic(EDFNotPositive)); |
1082 __ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDFEnd)); |
1082 __ASSERT_DEBUG(TotalSizeInBytes() >= pos + length, Panic(EDFEnd)); |
1083 |
1083 |
1114 // starts writes from DoWrite(), DoFormat() and the session end DFC. This function does not |
1114 // starts writes from DoWrite(), DoFormat() and the session end DFC. This function does not |
1115 // maintain the iReq* instance variables. It sets iIntBuf, iPhysStart and iPhysEnd. |
1115 // maintain the iReq* instance variables. It sets iIntBuf, iPhysStart and iPhysEnd. |
1116 // |
1116 // |
1117 { |
1117 { |
1118 OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHFORMAT_ENTRY, this ); |
1118 OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHFORMAT_ENTRY, this ); |
1119 OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHFORMAT, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur)); |
1119 OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHFORMAT, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur)); |
1120 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lf:0x%lx,0x%x", aStart, aLength)); |
1120 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lf:0x%lx,0x%x", aStart, aLength)); |
1121 __ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELFStart)); |
1121 __ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELFStart)); |
1122 __ASSERT_DEBUG((aStart & iBlkMsk) == 0, Panic(ELWFmtStAlign)); |
1122 __ASSERT_DEBUG((aStart & iBlkMsk) == 0, Panic(ELWFmtStAlign)); |
1123 __ASSERT_DEBUG(aLength > 0, Panic(ELFNotPositive)); |
1123 __ASSERT_DEBUG(aLength > 0, Panic(ELFNotPositive)); |
1124 __ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELFEnd)); |
1124 __ASSERT_DEBUG(TotalSizeInBytes() >= aStart + aLength, Panic(ELFEnd)); |
1130 if ((r = CheckDevice(EMReqTypeNormalWr)) == KErrNone) |
1130 if ((r = CheckDevice(EMReqTypeNormalWr)) == KErrNone) |
1131 { |
1131 { |
1132 iPhysStart = aStart & ~iBlkMsk; |
1132 iPhysStart = aStart & ~iBlkMsk; |
1133 |
1133 |
1134 // formats are always block-aligned, and the buffer is initialized to 0xff |
1134 // formats are always block-aligned, and the buffer is initialized to 0xff |
1135 // Check whether erase commands are supported by this card |
1135 // Check whether erase commands are supported by this card |
1136 if (iCard->CSD().CCC() & KMMCCmdClassErase) |
1136 if ( (iCard->CSD().CCC() & KMMCCmdClassErase) && iEraseInfo.iEraseFlags) |
1137 { |
1137 { |
1138 // Determine the erase end point for the next command. We don't erase past the preferred erase unit |
1138 // Determine the erase end point for the next command. We don't erase past the preferred erase unit |
1139 // size. Therefore, check which is lower, the preferred erase unit size or the end of the requested range. |
1139 // size. Therefore, check which is lower, the preferred erase unit size or the end of the requested range. |
1140 TInt64 prefEraseUnitEnd = (iPhysStart + iEraseInfo.iPreferredEraseUnitSize) & ~iEraseUnitMsk; |
1140 TInt64 prefEraseUnitEnd = (iPhysStart + iEraseInfo.iPreferredEraseUnitSize) & ~iEraseUnitMsk; |
1141 iPhysEnd = UMin(prefEraseUnitEnd, aStart + aLength); |
1141 iPhysEnd = UMin(prefEraseUnitEnd, aStart + aLength); |
1213 // starts writes from DoWrite(), DoFormat() and the session end DFC. This function does not |
1213 // starts writes from DoWrite(), DoFormat() and the session end DFC. This function does not |
1214 // maintain the iReq* instance variables. It sets iIntBuf, iPhysStart and iPhysEnd. |
1214 // maintain the iReq* instance variables. It sets iIntBuf, iPhysStart and iPhysEnd. |
1215 // |
1215 // |
1216 { |
1216 { |
1217 OstTraceExt4(TRACE_FLOW, DMMCMEDIADRIVERFLASH_LAUNCHWRITE_ENTRY, "DMmcMediaDriverFlash::LaunchWrite;aStart=%Ld;aLength=%x;aMedReq=%d;this=%x", aStart, (TUint) aLength, (TInt) aMedReq, (TUint) this); |
1217 OstTraceExt4(TRACE_FLOW, DMMCMEDIADRIVERFLASH_LAUNCHWRITE_ENTRY, "DMmcMediaDriverFlash::LaunchWrite;aStart=%Ld;aLength=%x;aMedReq=%d;this=%x", aStart, (TUint) aLength, (TInt) aMedReq, (TUint) this); |
1218 OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHWRITE, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur)); |
1218 OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHWRITE, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur),(TInt) I64LOW(iReqEnd - iReqCur)); |
1219 __KTRACE_OPT(KPBUSDRV, Kern::Printf("\n>mmd:lw:0x%lx,%d,%d", aStart, aLength, aMedReq)); |
1219 __KTRACE_OPT(KPBUSDRV, Kern::Printf("\n>mmd:lw:0x%lx,%d,%d", aStart, aLength, aMedReq)); |
1220 __ASSERT_DEBUG(aMedReq == EMReqWrite || aMedReq == EMReqFormat, Panic(ELWRequest)); |
1220 __ASSERT_DEBUG(aMedReq == EMReqWrite || aMedReq == EMReqFormat, Panic(ELWRequest)); |
1221 __ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELWStart)); |
1221 __ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELWStart)); |
1222 __ASSERT_DEBUG(!(aMedReq == EMReqFormat) || (aStart & iBlkMsk) == 0, Panic(ELWFmtStAlign)); |
1222 __ASSERT_DEBUG(!(aMedReq == EMReqFormat) || (aStart & iBlkMsk) == 0, Panic(ELWFmtStAlign)); |
1223 __ASSERT_DEBUG(aLength > 0, Panic(ELWNotPositive)); |
1223 __ASSERT_DEBUG(aLength > 0, Panic(ELWNotPositive)); |
2885 // This function is linear in the number of blocks in the cache. |
2885 // This function is linear in the number of blocks in the cache. |
2886 // |
2886 // |
2887 { |
2887 { |
2888 OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED_ENTRY, this ); |
2888 OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED_ENTRY, this ); |
2889 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd)); |
2889 __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd)); |
2890 OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=0x%x; iReqEnd=0x%x", (TUint) iReqCur, (TUint) iReqEnd ); |
2890 OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=%x:%x; iReqEnd=0x%x", (TUint) I64HIGH(iReqCur), (TUint) I64LOW(iReqCur), (TUint) iReqEnd ); |
2891 |
2891 |
2892 if ( iCurrentReq->IsPhysicalAddress() |
2892 if ( (iCurrentReq->DriverFlags() & RLocalDrive::ELocDrvDirectIO) || iCurrentReq->IsPhysicalAddress() |
2893 #if defined(__DEMAND_PAGING__) && !defined(__WINS__) |
2893 #if defined(__DEMAND_PAGING__) && !defined(__WINS__) |
2894 || DMediaPagingDevice::PageInRequest(*iCurrentReq) |
2894 || DMediaPagingDevice::PageInRequest(*iCurrentReq) |
2895 #endif //DEMAND_PAGING |
2895 #endif //DEMAND_PAGING |
2896 ) |
2896 ) |
2897 { |
2897 { |