MityDSP Documentation Index
Macros
fatfs_macros.h File Reference

Macros

#define GET_FAT16_FAT_SECTOR(DPTR, SECTOR)
 The following macros compute geometry for FAT16 filesystems...
#define GET_FAT16_ROOT_SECTOR(DPTR, SECTOR)
#define GET_FAT16_CLUSTER_SECTOR(DPTR, CLUSTER, SECTOR)
#define GET_CLUSTER(ENTRY, RESULT)
 The following macros minipulate data for a directory entry...
#define GET_FILESIZE(ENTRY, RESULT)
#define SET_FDATE(Y, M, D, DATEARRAY)
#define SET_FTIME(H, M, S, TIMEARRAY)
#define GET_FDATE(DATEARRAY, Y, M, D)
#define GET_FTIME(TIMEARRAY, H, M, S)

Macro Definition Documentation

#define GET_FAT16_FAT_SECTOR (   DPTR,
  SECTOR 
)
Value:
{ \
(SECTOR) = (DPTR)->msDevInfo.mnSectorOffset; \
(SECTOR) += (DPTR)->ReservedSectorCount; \
}

The following macros compute geometry for FAT16 filesystems...

#define GET_FAT16_ROOT_SECTOR (   DPTR,
  SECTOR 
)
Value:
{ \
GET_FAT16_FAT_SECTOR((DPTR), (SECTOR)); \
(SECTOR) += (DPTR)->FATSize * (DPTR)->NumFATs; \
}
#define GET_FAT16_CLUSTER_SECTOR (   DPTR,
  CLUSTER,
  SECTOR 
)
Value:
{ \
GET_FAT16_ROOT_SECTOR((DPTR), (SECTOR)); \
(SECTOR) += (((DPTR)->MaxRootEntries * sizeof(tsDirEntry)) + \
((DPTR)->msDevInfo.mnBytesPerSector - 1)) / \
(DPTR)->msDevInfo.mnBytesPerSector; \
if ((CLUSTER) > 2) \
(SECTOR) += ((CLUSTER) - 2) * (DPTR)->SectorsPerCluster; \
}
#define GET_CLUSTER (   ENTRY,
  RESULT 
)
Value:
(RESULT) = ((int)(ENTRY)->maClusterMSW[1]) << 24; \
(RESULT) |= ((int)(ENTRY)->maClusterMSW[0]) << 16; \
(RESULT) |= ((int)(ENTRY)->maClusterLSW[1]) << 8; \
(RESULT) |= ((int)(ENTRY)->maClusterLSW[0]);

The following macros minipulate data for a directory entry...

#define GET_FILESIZE (   ENTRY,
  RESULT 
)
Value:
RESULT = ((int)(ENTRY)->maFileSize[3]) << 24; \
RESULT |= ((int)(ENTRY)->maFileSize[2]) << 16; \
RESULT |= ((int)(ENTRY)->maFileSize[1]) << 8; \
RESULT |= ((int)(ENTRY)->maFileSize[0]);
#define SET_FDATE (   Y,
  M,
  D,
  DATEARRAY 
)
Value:
(DATEARRAY)[0] = ((D) & 0x1F); \
(DATEARRAY)[0] |= ((M) & 0x07) << 5; \
(DATEARRAY)[1] = ((M) & 0x08) >> 3; \
(DATEARRAY)[1] |= (((Y)-1980) & 0x7F) << 1;
#define SET_FTIME (   H,
  M,
  S,
  TIMEARRAY 
)
Value:
(TIMEARRAY)[0] = ((S) & 0x3E) >> 1; \
(TIMEARRAY)[0] |= ((M) & 0x07) << 5; \
(TIMEARRAY)[1] = ((M) & 0x38) >> 3; \
(TIMEARRAY)[1] |= ((H) & 0x1F) << 3;
#define GET_FDATE (   DATEARRAY,
  Y,
  M,
 
)
Value:
(D) = (DATEARRAY)[0] & 0x1F; \
(M) = ((DATEARRAY)[0] >> 5) & 0x07; \
(M) |= ((DATEARRAY)[1] << 3) & 0x08; \
(Y) = (((DATEARRAY)[1] >> 1) & 0x7F) + 1980;
#define GET_FTIME (   TIMEARRAY,
  H,
  M,
 
)
Value:
(S) = ((TIMEARRAY)[0] << 1) & 0x3E; \
(M) = ((TIMEARRAY)[0] >> 5) & 0x07; \
(M) |= ((TIMEARRAY)[1] << 3) & 0x38; \
(H) = ((TIMEARRAY)[1] >> 3) & 0x1F;

  
Generated on Mon Apr 22 2013 11:33:25 for FAT File System Library by  Doxygen Version 1.8.1.1
Copyright © 2009, Critical Link LLC, All rights reserved.