tffsDrv.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:7k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* tffsDrv.h - TFFS FLite driver header */
  2. /* Copyright 1984-1997 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01i,25jan99,yp   added new function tffsDevOptionsSet()'s prototype.
  7. 01h,19jan98,hdn  added new function tffsShowAll()'s prototype.
  8. 01g,06jan98,hdn  added usrTffsConfig()'s prototype.
  9. 01f,06jan98,hdn  changed tffsShow()'s prototype.
  10. 01e,15dec97,hdn  added _ASMLANGUAGE macro.
  11. 01d,11dec97,hdn  added tffsShow()'s prototype.
  12. 01c,05dec97,hdn  added tffsRawio()'s function codes and prototype.
  13. 01b,07nov97,hdn  cleaned up.
  14. 01a,25aug97,and  written by Andray in M-Systems
  15. */
  16. #ifndef __INCtffsDrvh
  17. #define __INCtffsDrvh
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #ifndef _ASMLANGUAGE
  22. #include "blkIo.h"
  23. #define TFFS_MAX_DRIVES 5 /* same to DRIVES in flcustom.h */
  24. /* function number for tffsRawio() */
  25. #define TFFS_GET_PHYSICAL_INFO 0 /* get physical info */
  26. #define TFFS_PHYSICAL_READ 1 /* physical read */
  27. #define TFFS_PHYSICAL_WRITE 2 /* physical write */
  28. #define TFFS_PHYSICAL_ERASE 3 /* physical erase */
  29. #define TFFS_ABS_READ 4 /* absolute read */
  30. #define TFFS_ABS_WRITE 5 /* absolute write */
  31. #define TFFS_ABS_DELETE 6 /* absolute erase */
  32. #define TFFS_DEFRAGMENT_VOLUME 7 /* defragment volume */
  33. /*--------------------------------------------------------------------------*/
  34. /*      TFFS block devices                                                  */
  35. /*--------------------------------------------------------------------------*/
  36. typedef struct
  37.     {
  38.     BLK_DEV  tffsBlkdev;         /* VxWorks block device descriptor        */
  39.     int      tffsDriveNo;        /* 0..DRIVES-1, internal FLite numbering  */
  40.     } TFFS_DEV;
  41. /*---------------------------------------------------------------------------*/
  42. /*                Formatting parameter structure definition                  */
  43. /*---------------------------------------------------------------------------*/
  44. typedef struct 
  45.     {
  46.     /* FTL formatting section */
  47.     long int bootImageLen;
  48. /* Space to reserve for a boot-image at the start of the
  49.    medium. The FLite volume will begin at the next higher
  50.    erase unit boundary */
  51.     unsigned percentUse;
  52. /* FTL performance depends on how full the Flash media is,
  53.    getting slower when the media is close to 100%. It is
  54.    possible to avoid the worst consequences of this effect by
  55.    formatting the media to less than 100% capacity, so
  56.    guaranteeing some free space at all times. This of course
  57.    sacrifices some capcity.
  58.    The standard value to use is 99 */
  59.     unsigned noOfSpareUnits;
  60. /* FTL needs at least one spare erase unit to function as a
  61.    read/write media (it is possible to specify 0 to achieve
  62.    WORM functionality). It is possible to specify more than
  63.    one spare unit, which costs more media space.
  64.    The advantage to doing this is in case one of the Flash
  65.    erase units becomes bad and unerasable in the future, one
  66.    of the spare units will need to replace it. A second spare
  67.    unit will then enable to continue read/write functionality
  68.    (in its absence, the media will go into read-only mode).
  69.    The standard value to use is 1 */
  70.     unsigned long vmAddressingLimit;
  71. /* A part of the FTL Virtual Map always resides in RAM. The
  72.    RAM part is the one that is used to address the part of
  73.    the media below the VM addressing limit. Reading and
  74.    writing to this part is usually faster to some degree.
  75.    The downside is that the bigger the limit, the more RAM
  76.    size is required.
  77.    The minimum VM limit is 0.
  78.    The standard value to use is 0x10000 (first 64 KBytes) */
  79.     int (*progressCallback)(int totalUnitsToFormat,
  80.     int totalUnitsFormattedSoFar);
  81. /* Progress callback routine, will be called if not NULL.
  82.    The callback routine is called after erasing each unit,
  83.    and its parameters are the total number of erase units
  84.    to format and the number erased so far.
  85.    The callback routine returns a Status value. A value of
  86.    OK (0) allows formatting to continue. Any other value
  87.    will abort the formatting with the returned status code. */
  88.     /* DOS formatting section */
  89.     char volumeId[4];
  90. /* Volume identification number */
  91.     char * volumeLabel;
  92. /* Volume label string. If NULL, no label */
  93.     unsigned noOfFATcopies;
  94. /* It is customary to format DOS media with 2 FAT copies.
  95.    The first copy is always used, but more copies make it
  96.    possible to recover if the FAT becomes corrupted (a
  97.    rare occurrence). On the other hand, this slows down
  98.    performance and uses media space.
  99.    The standard value to use is 2 */
  100.     unsigned embeddedCISlength;
  101. /* Length in bytes of CIS to embed after the unit header */
  102.     char * embeddedCIS;
  103. /* The unit header is structured as a beginning of a PCMCIA
  104.    'tuple' chain (a CIS). The unit header contains a
  105.    data-organization tuple, which points past the end of the
  106.    unit header to a location which usually just contains
  107.    hex FF's which mark an 'end-of-tuple-chain'. Optionally,
  108.    it is possible to embed an entire CIS chain at this
  109.    location. If so, 'embeddedCISlength' marks the length in
  110.    bytes */
  111.     } tffsFormatParams;
  112. /*---------------------------------------------------------------------------*/
  113. /*            IOCTL FIODISKFORMAT structure definition                       */
  114. /*---------------------------------------------------------------------------*/
  115. typedef struct 
  116.     {
  117.     tffsFormatParams  formatParams;
  118.     unsigned          formatFlags;
  119.     } tffsDevFormatParams;
  120. /* values for tffsDevFormatParams.formatFlags */
  121. #define FTL_FORMAT      1  /* FAT & FTL formatting                     */
  122. #define FTL_FORMAT_IF_NEEDED 2 /* FAT formatting, FTL formatting if needed */
  123. #define NO_FTL_FORMAT      0 /* FAT formatting only                      */
  124. /* Standard initializer for IOCTLParams structure */
  125. #define TFFS_STD_FORMAT_PARAMS {{0, 99, 1, 0x10000l, NULL, {0,0,0,0}, NULL, 
  126.  2, 0, NULL}, FTL_FORMAT_IF_NEEDED}
  127. /* function declarations */
  128. #if defined(__STDC__) || defined(__cplusplus)
  129. extern STATUS  tffsDrv (void);
  130. extern BLK_DEV * tffsDevCreate (int tffsDriveNo, int removableMediaFlag);
  131. extern STATUS  tffsDevFormat (int tffsDriveNo, int arg);
  132. extern void      flAnnonceDiskChange (unsigned volNo);
  133. extern void      tffsShowAll (void);
  134. extern void      tffsShow (int driveNo);
  135. extern STATUS  tffsRawio (int tffsDriveNo, int functionNo, int arg0,
  136.     int arg1, int arg2);
  137. extern STATUS  tffsDevOptionsSet (TFFS_DEV * pTffsDev);
  138. extern STATUS  usrTffsConfig (int drive, int removable, char *  fileName);
  139. #else /* __STDC__ */
  140. extern STATUS  tffsDrv ();
  141. extern BLK_DEV * tffsDevCreate ();
  142. extern STATUS  tffsDevFormat ();
  143. extern void      flAnnonceDiskChange ();
  144. extern void      tffsShowAll ();
  145. extern void      tffsShow ();
  146. extern STATUS  tffsRawio ();
  147. extern STATUS    tffsDevOptionsSet ();
  148. extern STATUS  usrTffsConfig ();
  149. #endif /* __STDC__ */
  150. #endif  /* _ASMLANGUAGE */
  151. #ifdef __cplusplus
  152. }
  153. #endif
  154. #endif /* __INCtffsDrvh */