Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
6.2 KiB

  1. /*
  2. * $Log: V:/Flite/archives/TrueFFS5/Src/NANDDEFS.H_V $
  3. *
  4. * Rev 1.9 Apr 15 2002 07:38:10 oris
  5. * Added 2 additional fields to mtdVars record for backwards compatibility (under RAM_MTD compilation flag)
  6. * - unsigned short pageSize;
  7. * - unsigned short pageAndTailSize;
  8. *
  9. * Rev 1.8 Jan 20 2002 20:29:14 oris
  10. * Changed doc2000FreeWindow prototype to remove warnings.
  11. * Changed docPlusFreeWindow prototype to remove warnings.
  12. *
  13. * Rev 1.7 Jan 17 2002 23:03:52 oris
  14. * Definitions for the new memory access routine mechanism
  15. * - NDOC2window was moved from docsys.h
  16. * - Add pointer to read back buffer when MTD_RECONSTRUCT_BBT and VERIFY_VOLUME compilation flags are defined.
  17. * Replaced flbuffer.h include with flflash.h
  18. * Changed win_io from unsigned to word.
  19. * Changed the use of vol (macro *pVol) to *flash in NFDC21thisVars.
  20. *
  21. * Rev 1.6 Sep 15 2001 23:47:50 oris
  22. * Added 128MB flash support
  23. *
  24. * Rev 1.5 Jul 13 2001 01:08:58 oris
  25. * Added readBackBuffer pointer for the VERIFY_WRITE Compilation flag.
  26. *
  27. * Rev 1.4 May 16 2001 21:21:14 oris
  28. * Change "data" named variables to flData to avoid name clashes.
  29. *
  30. * Rev 1.3 Apr 10 2001 16:43:40 oris
  31. * Added prototype of docSocketInit.
  32. *
  33. * Rev 1.2 Apr 01 2001 07:48:26 oris
  34. * Revised in order to support both diskonchip 2000 family and doc plus family.
  35. *
  36. * Rev 1.1 Feb 07 2001 17:42:24 oris
  37. * removed MAX_FLASH_DEVICES_MDOC define since alone can support 16 chips
  38. *
  39. * Rev 1.0 Feb 04 2001 12:26:10 oris
  40. * Initial revision.
  41. *
  42. */
  43. /************************************************************************/
  44. /* */
  45. /* FAT-FTL Lite Software Development Kit */
  46. /* Copyright (C) M-Systems Ltd. 1995-2001 */
  47. /* */
  48. /************************************************************************/
  49. #ifndef NANDDEFS_H
  50. #define NANDDEFS_H
  51. #include "flflash.h"
  52. typedef byte Reg8bitType;
  53. typedef word Reg16bitType;
  54. typedef struct {
  55. #ifdef RAM_MTD
  56. unsigned short pageSize;
  57. unsigned short pageAndTailSize;
  58. #endif /* RAM_MTD */
  59. unsigned short vendorID;
  60. unsigned short chipID;
  61. dword pageMask; /* ...these............... */
  62. unsigned short pageAreaSize; /* .......variables....... */
  63. unsigned short tailSize; /* .............interleave */
  64. unsigned short noOfBlocks; /* total erasable blocks in flash device*/
  65. unsigned short pagesPerBlock;
  66. unsigned char currentFloor; /* 0 .. totalFloors-1 */
  67. long floorSize; /* in bytes */
  68. long floorSizeMask;
  69. byte floorSizeBits;
  70. byte if_cfg; /* host access type */
  71. unsigned short flags; /* bitwise: BIG_PAGE, SLOW_IO etc. */
  72. FLBuffer* buffer; /* buffer for map through buffer */
  73. #if (defined(VERIFY_WRITE) || defined(VERIFY_ERASE) || defined(MTD_RECONSTRUCT_BBT) || defined(VERIFY_VOLUME))
  74. byte* readBackBuffer; /* buffer for map through buffer */
  75. #endif /* VERIFY_WRITE || VERIFY_ERASE || VERIFY_VOLUME */
  76. word win_io; /* pointer to DOC CDSN_IO */
  77. NDOC2window win; /* pointer to DOC memory window */
  78. } NFDC21Vars;
  79. #define NFDC21thisVars ((NFDC21Vars *) flash->mtdVars)
  80. #define NFDC21thisWin (NFDC21thisVars->win)
  81. #define NFDC21thisIO (NFDC21thisVars->win_io)
  82. #define NFDC21thisBuffer (NFDC21thisVars->buffer->flData)
  83. /* Flash commands */
  84. #define SERIAL_DATA_INPUT 0x80
  85. #define READ_MODE 0x00
  86. #define READ_MODE_2 0x50
  87. #define RESET_FLASH 0xff
  88. #define SETUP_WRITE 0x10
  89. #define SETUP_ERASE 0x60
  90. #define CONFIRM_ERASE 0xd0
  91. #define READ_STATUS 0x70
  92. #define READ_ID 0x90
  93. #define SUSPEND_ERASE 0xb0
  94. #define REGISTER_READ 0xe0
  95. /* commands for moving flash pointer to areeas A,B or C of page */
  96. typedef enum { AREA_A = READ_MODE, AREA_B = 0x1, AREA_C = READ_MODE_2 } PointerOp;
  97. #define FAIL 0x01 /* error in block erase */
  98. #define EXTRA_LEN 8 /* In memory of 4MB chips */
  99. #define SECTOR_EXTRA_LEN 16
  100. /* Flash IDs*/
  101. #define KM29N16000_FLASH 0xec64
  102. #define KM29N32000_FLASH 0xece5
  103. #define KM29V64000_FLASH 0xece6
  104. #define KM29V128000_FLASH 0xec73
  105. #define KM29V256000_FLASH 0xec75
  106. #define KM29V512000_FLASH 0xec76
  107. #define NM29N16_FLASH 0x8f64
  108. #define NM29N32_FLASH 0x8fe5
  109. #define NM29N64_FLASH 0x8fe6
  110. #define TC5816_FLASH 0x9864
  111. #define TC5832_FLASH 0x98e5
  112. #define TC5864_FLASH 0x98e6
  113. #define TC58128_FLASH 0x9873
  114. #define TC58256_FLASH 0x9875
  115. #define TC58512_FLASH 0x9876
  116. #define TC581024_FLASH 0x9877
  117. /*******************************/
  118. /**** Exported routines ****/
  119. /*******************************/
  120. /* DiskOnChip 2000 family registration routines */
  121. #ifndef MTD_STANDALONE
  122. extern FLBoolean checkWinForDOC(unsigned driveNo, NDOC2window memWinPtr);
  123. #endif /* MTD_STANDALONE */
  124. #ifndef MTD_FOR_EXB
  125. extern FLStatus flRegisterDOC2000(void);
  126. extern FLStatus flRegisterDOCSOC(dword lowAddress, dword highAddress);
  127. #else
  128. FLStatus doc2000SearchForWindow(FLSocket * socket, dword lowAddress,
  129. dword highAddress);
  130. FLStatus doc2000Identify(FLFlash vol);
  131. void doc2000FreeWindow(FLSocket * socket);
  132. #endif /* MTD_FOR_EXB */
  133. /* DiskOnChip Plus family registration routines */
  134. #ifndef MTD_STANDALONE
  135. extern FLBoolean checkWinForDOCPLUS(unsigned driveNo, NDOC2window memWinPtr);
  136. extern void docSocketInit(FLSocket vol);
  137. #endif /* MTD_STANDALONE */
  138. #ifndef MTD_FOR_EXB
  139. extern FLStatus flRegisterDOCPLUS(void);
  140. extern FLStatus flRegisterDOCPLUSSOC(dword lowAddress, dword highAddress);
  141. #else
  142. FLStatus docPlusSearchForWindow(FLSocket * socket, dword lowAddress,
  143. dword highAddress);
  144. FLStatus docPlusIdentify(FLFlash vol);
  145. void docPlusFreeWindow(FLSocket * socket);
  146. #endif /* MTD_FOR_EXB */
  147. #endif /* NANDDEFS_H */