equal
deleted
inserted
replaced
18 #ifndef SL_STD_INL |
18 #ifndef SL_STD_INL |
19 #define SL_STD_INL |
19 #define SL_STD_INL |
20 |
20 |
21 |
21 |
22 |
22 |
23 TBool IsPowerOf2(TUint32 aVal) |
|
24 { |
|
25 if (aVal==0) |
|
26 return EFalse; |
|
27 |
|
28 return !(aVal & (aVal-1)); |
|
29 } |
|
30 |
|
31 TUint32 Pow2(TUint32 aVal) |
|
32 { |
|
33 //ASSERT(aVal<32); |
|
34 return 1 << aVal; |
|
35 } |
|
36 |
|
37 |
|
38 //--------------------------------------------------------------------------------------------------------------------------------- |
23 //--------------------------------------------------------------------------------------------------------------------------------- |
39 // class TEntryPos |
24 // class TEntryPos |
40 TUint32 TEntryPos::Cluster() const |
25 TUint32 TEntryPos::Cluster() const |
41 { |
26 { |
42 return (TUint32) iCluster; |
27 return (TUint32) iCluster; |
251 __PRINT3(_L("#- CFatMountCB::SetState() drv:%d, %d->%d\n"),DriveNumber(),iState,aState); |
236 __PRINT3(_L("#- CFatMountCB::SetState() drv:%d, %d->%d\n"),DriveNumber(),iState,aState); |
252 iState = aState; |
237 iState = aState; |
253 } |
238 } |
254 |
239 |
255 |
240 |
256 TFatDriveInterface& CFatMountCB::DriveInterface() const |
241 TDriveInterface& CFatMountCB::DriveInterface() const |
257 { |
242 { |
258 return (TFatDriveInterface&)iDriverInterface; |
243 return (TDriveInterface&)iDriverInterface; |
259 } |
244 } |
260 |
245 |
261 const TFatConfig& CFatMountCB::FatConfig() const |
246 const TFatConfig& CFatMountCB::FatConfig() const |
262 { |
247 { |
263 return iFatConfig; |
248 return iFatConfig; |
320 Set condition if position of new entries has been found. |
305 Set condition if position of new entries has been found. |
321 */ |
306 */ |
322 void CFatMountCB::XFileCreationHelper::SetIsNewEntryPosFound(TBool aFound) |
307 void CFatMountCB::XFileCreationHelper::SetIsNewEntryPosFound(TBool aFound) |
323 { |
308 { |
324 isNewEntryPosFound = aFound; |
309 isNewEntryPosFound = aFound; |
|
310 } |
|
311 |
|
312 |
|
313 /** |
|
314 Checks for "EOC" for all Fat types |
|
315 @param aCluster FAT table entry (cluster number) to check |
|
316 @return ETrue if aCluster is a EOC for the FAT type being used by CFatMountCB |
|
317 */ |
|
318 TBool CFatMountCB::IsEndOfClusterCh(TInt aCluster) const |
|
319 { |
|
320 ASSERT(iFatEocCode); |
|
321 |
|
322 if((TUint32)aCluster >= iFatEocCode) |
|
323 return ETrue; |
|
324 |
|
325 ASSERT((TUint32)aCluster <= iFatEocCode+7); |
|
326 |
|
327 return EFalse; |
|
328 } |
|
329 |
|
330 /** |
|
331 Sets "End of Cluster Chain" value in aCluster depending on the FAT type. |
|
332 @param aCluster cluster to set to end of chain marker |
|
333 */ |
|
334 void CFatMountCB::SetEndOfClusterCh(TInt &aCluster) const |
|
335 { |
|
336 ASSERT(iFatEocCode); |
|
337 aCluster = iFatEocCode+7; |
325 } |
338 } |
326 |
339 |
327 |
340 |
328 //------- debug methods |
341 //------- debug methods |
329 #ifdef _DEBUG |
342 #ifdef _DEBUG |
367 {iWriteFailError=aErrorValue;} |
380 {iWriteFailError=aErrorValue;} |
368 |
381 |
369 #endif |
382 #endif |
370 |
383 |
371 |
384 |
|
385 |
|
386 |
|
387 |
372 //--------------------------------------------------------------------------------------------------------------------------------- |
388 //--------------------------------------------------------------------------------------------------------------------------------- |
373 // class CFatFormatCB |
389 // class CFatFormatCB |
374 |
390 |
375 /** @return pointer to the owning mount object */ |
391 /** @return pointer to the owning mount object */ |
376 CFatMountCB& CFatFormatCB::FatMount() |
392 CFatMountCB& CFatFormatCB::FatMount() |
445 TUint32 CFatTable::FreeClusters() const |
461 TUint32 CFatTable::FreeClusters() const |
446 { |
462 { |
447 return iFreeClusters; |
463 return iFreeClusters; |
448 } |
464 } |
449 |
465 |
450 TBool CFatTable::IsEof32Bit(TInt aCluster) const |
|
451 {return(aCluster>=(TInt)0x0FFFFFF8 && aCluster<=(TInt)0x0FFFFFFF);} |
|
452 |
|
453 TBool CFatTable::IsEof16Bit(TInt aCluster) const |
|
454 {return(aCluster>=0xFFF8 && aCluster<=0xFFFF);} |
|
455 |
|
456 TBool CFatTable::IsEof12Bit(TInt aCluster) const |
|
457 {return(aCluster>=0xFF8 && aCluster<=0xFFF);} |
|
458 |
|
459 TInt CFatTable::SectorSizeLog2() const |
|
460 {return(iOwner->SectorSizeLog2());} |
|
461 |
466 |
462 //--------------------------------------------------------------------------------------------------------------------------------- |
467 //--------------------------------------------------------------------------------------------------------------------------------- |
463 |
468 |
464 inline TFatType CFatTable::FatType() const |
469 inline TFatType CFatTable::FatType() const |
465 { |
470 { |
477 } |
482 } |
478 |
483 |
479 inline TBool CFatTable::IsFat32() const |
484 inline TBool CFatTable::IsFat32() const |
480 { |
485 { |
481 return iFatType == EFat32; |
486 return iFatType == EFat32; |
|
487 } |
|
488 |
|
489 |
|
490 /** |
|
491 Checks for "EOC" for all Fat types |
|
492 @param aCluster FAT table entry (cluster number) to check |
|
493 @return ETrue if aCluster is a EOC for the FAT type being used by CFatMountCB that owns the CFatTable |
|
494 */ |
|
495 inline TBool CFatTable::IsEndOfClusterCh(TUint32 aCluster) const |
|
496 { |
|
497 ASSERT(iFatEocCode); |
|
498 |
|
499 if(aCluster >= iFatEocCode) |
|
500 return ETrue; |
|
501 |
|
502 ASSERT((TUint32)aCluster <= iFatEocCode+7); |
|
503 return EFalse; |
482 } |
504 } |
483 |
505 |
484 |
506 |
485 /** |
507 /** |
486 @return Maximal number of addresable FAT entries. This value is taken from the owning mount |
508 @return Maximal number of addresable FAT entries. This value is taken from the owning mount |
490 ASSERT(iMaxEntries > 0); |
512 ASSERT(iMaxEntries > 0); |
491 return iMaxEntries; |
513 return iMaxEntries; |
492 } |
514 } |
493 |
515 |
494 |
516 |
495 // class TFatDriveInterface |
517 // class TDriveInterface |
496 TBool TFatDriveInterface::NotifyUser() const |
518 TBool TDriveInterface::NotifyUser() const |
497 {return(iMount->GetNotifyUser());} |
519 {return(iMount->GetNotifyUser());} |
498 |
520 |
499 |
521 |
500 //---------------------------------------------------------------------------------------------------- |
522 //---------------------------------------------------------------------------------------------------- |
501 // class CRawDisk |
523 // class CRawDisk |