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.

380 lines
16 KiB

  1. /*
  2. * $Log: V:/Flite/archives/TrueFFS5/Src/MDOCPLUS.H_V $
  3. *
  4. * Rev 1.14 Apr 15 2002 07:37:48 oris
  5. * Added OUT_CNTRL_STICKY_BIT_ENABLE definition.
  6. * Added FOUNDRY_WRITE_ENABLE definition.
  7. * Changed OUT_CNTRL_BSY_EN_MASK to OUT_CNTRL_BSY_DISABLE_MASK and used the complimentary value.
  8. *
  9. * Rev 1.13 Jan 29 2002 20:09:50 oris
  10. * Added IPL_SA_MODE_MARK and IPL_XSCALE_MODE_MARK definitions.
  11. * Changed DPS1_COPY0_16 to unit 3 instead of unit 2.
  12. * Changed IPL_SA_MARK_OFFSET1 to IPL_MODE_MARK_OFFSET.
  13. *
  14. * Rev 1.12 Jan 17 2002 23:03:12 oris
  15. * Changed flash addresses to interleave-1 to fit both 32MB and 16MB Plus DiskOnChip devices
  16. * include docsys file instead of docsysp.
  17. * Add 16MB Plus DiskOnChip ID 0x41
  18. *
  19. * Rev 1.11 Nov 22 2001 19:48:56 oris
  20. * Changed FLS__SEL_WP_MASK and FLS__SEL_CE_MASK to MPLUS_SEL_CE and MPLUS_SEL_WP.
  21. *
  22. * Rev 1.10 Sep 15 2001 23:47:26 oris
  23. * Include docsysp.h instead of docsys.h
  24. *
  25. * Rev 1.9 Jul 13 2001 01:08:20 oris
  26. * Added BBT_MEDIA_OFFSET definition.
  27. * Moved VERIFY_WRITE and VERIFY_ERASE compilation flag to flcustom.h.
  28. *
  29. * Rev 1.8 May 16 2001 21:20:44 oris
  30. * Added busy delay for download operation DOWNLOAD_BUSY_DELAY.
  31. * Moved SYNDROM_BYTES definition to flflash.h.
  32. *
  33. * Rev 1.7 May 09 2001 00:33:24 oris
  34. * Removed the IPL_CODE and READ_BBT_CODE defintion.
  35. *
  36. * Rev 1.6 May 06 2001 22:42:12 oris
  37. * redundant was misspelled.
  38. *
  39. * Rev 1.5 Apr 30 2001 18:02:40 oris
  40. * Added READ_BBT_CODE defintion.
  41. *
  42. * Rev 1.4 Apr 24 2001 17:11:40 oris
  43. * Bug fix - otp start address definition did not take interleave into acount.
  44. *
  45. * Rev 1.3 Apr 18 2001 21:25:58 oris
  46. * Added OTPLockStruct record.
  47. *
  48. * Rev 1.2 Apr 16 2001 13:55:20 oris
  49. * Removed warrnings.
  50. *
  51. * Rev 1.1 Apr 09 2001 15:08:22 oris
  52. * End with an empty line.
  53. *
  54. * Rev 1.0 Apr 01 2001 07:42:32 oris
  55. * Initial revision.
  56. *
  57. */
  58. /*******************************************************************
  59. *
  60. * DESCRIPTION: basic mtd functions for the MDOC32
  61. *
  62. * AUTHOR: arie tamam
  63. *
  64. * HISTORY: created november 14, 2000
  65. *
  66. *******************************************************************/
  67. /***********************************************************************************/
  68. /* M-Systems Confidential */
  69. /* Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2001 */
  70. /* All Rights Reserved */
  71. /***********************************************************************************/
  72. /* NOTICE OF M-SYSTEMS OEM */
  73. /* SOFTWARE LICENSE AGREEMENT */
  74. /* */
  75. /* THE USE OF THIS SOFTWARE IS GOVERNED BY A SEPARATE LICENSE */
  76. /* AGREEMENT BETWEEN THE OEM AND M-SYSTEMS. REFER TO THAT AGREEMENT */
  77. /* FOR THE SPECIFIC TERMS AND CONDITIONS OF USE, */
  78. /* OR CONTACT M-SYSTEMS FOR LICENSE ASSISTANCE: */
  79. /* E-MAIL = [email protected] */
  80. /***********************************************************************************/
  81. #ifndef MDOCPLUS_H
  82. #define MDOCPLUS_H
  83. /** include files **/
  84. #include "docsys.h"
  85. /** public functions **/
  86. extern FLStatus changeInterleave(FLFlash vol, byte interNum);
  87. extern FLStatus chkASICmode (FLFlash vol);
  88. #ifndef MTD_STANDALONE
  89. extern FLBoolean checkWinForDOCPLUS(unsigned driveNo, NDOC2window memWinPtr);
  90. #endif /* MTD_STANDALONE */
  91. /*���������������������������.*/
  92. /* Feature list */
  93. /*���������������������������.*/
  94. /* #define MULTI_ERASE */ /* use multiple block erase feature */
  95. /* #define WIN_FROM_SS */ /* call Socket Services to get window location */
  96. /* #define LOG_FILE */ /* log edc errors */
  97. /*----------------------------------------------------------------------*/
  98. /* s e t F l o o r */
  99. /* */
  100. /* Set the specified floor as the active floor. */
  101. /* */
  102. /* Parameters: */
  103. /* vol : Pointer identifying drive */
  104. /* floor : The new active floor */
  105. /* */
  106. /*----------------------------------------------------------------------*/
  107. #define setFloor(volume,floor) flWrite8bitRegPlus(volume,NASICselect,floor); /* select ASIC */
  108. /* The first page of the customer OTP area */
  109. typedef struct {
  110. byte lockByte[4];
  111. LEulong usedSize;
  112. } OTPLockStruct;
  113. #define DOWNLOAD_BUSY_DELAY 300000L
  114. #define BUSY_DELAY 30000
  115. #define START_ADR 0xC8000L
  116. #define STOP_ADR 0xF0000L
  117. #define MDOCP_PAGES_PER_BLOCK 0x20 /* 16 pages per block on a single chip */
  118. #define CHIP_PAGE_SIZE 0x100 /* Page Size of 2 Mbyte Flash */
  119. #define IPL_MAX_SIZE 1024l /* IPL maximum media size */
  120. #define CHIP_TOTAL_SIZE 0x1000000L
  121. #define SIZE_OF_DPS 0x12
  122. #define NO_OF_DPS 2
  123. #define SECTOR_SIZE_MASK 0xff
  124. #define BBT_MEDIA_OFFSET 2048L
  125. /* Flash page area sizes */
  126. #define SECTOR_FLAG_SIZE 2
  127. #define UNIT_DATA_SIZE 8
  128. #define EDC_SIZE 6
  129. #define EDC_PLUS_SECTOR_FLAGS 8
  130. #define END_OF_SECOND_SECTOR_DATA 10
  131. #define START_OF_SECOND_SECTOR_DATA 10
  132. #define UNIT_DATA_OFFSET 16
  133. #define UNIT_DATA_OFFSET_MINUS_8 8
  134. #define SECOND_SECTOR_FLAGS_OFFSET 8
  135. #define TOTAL_EXTRA_AREA 16
  136. /* OTP defintions */
  137. #define OTP_LOCK_MARK 0
  138. #define CUSTOMER_OTP_SIZE 6*1024
  139. #define CUSTOMER_OTP_START SECTOR_SIZE*6L
  140. #define UNIQUE_ID_OFFSET 0x10
  141. #define UNIQUE_ID_SIZE 16
  142. /* IPL flash media offsets */
  143. #define IPL_START_OFFSET (SECTOR_SIZE<<1)
  144. #define IPL_HIGH_SECTOR (SECTOR_SIZE<<1)
  145. #define IPL0_COPY0_32 (flash->erasableBlockSize << 1) + IPL_START_OFFSET/* Unit 2 + 1024 */
  146. #define IPL1_COPY0_32 IPL0_COPY0_32 + IPL_HIGH_SECTOR /* Unit 2 + 2048 */
  147. #define IPL0_COPY0_16 (flash->erasableBlockSize * 3) + IPL_START_OFFSET /* Unit 3 + 1024 */
  148. #define IPL1_COPY0_16 IPL0_COPY0_16 + IPL_HIGH_SECTOR /* Unit 3 + 2048 */
  149. /* DPS flash media offsets */
  150. #define REDUNDANT_DPS_OFFSET (SECTOR_SIZE+0x80)
  151. #define DPS0_COPY0 flash->erasableBlockSize /* Unit 1 */
  152. #define DPS1_COPY0_32 (flash->erasableBlockSize<<1L) /* Unit 2 */
  153. #define DPS1_COPY0_16 (flash->erasableBlockSize*3L) /* Unit 3 */
  154. #define DPS0_UNIT_NO 1
  155. #define DPS1_UNIT_NO_32 2
  156. #define DPS1_UNIT_NO_16 3
  157. /* Strong arm mark offset */
  158. #define IPL_MODE_MARK_OFFSET IPL1_COPY0_16+8
  159. #define IPL_SA_MODE_MARK 0xF8 /* Strong Arm */
  160. #define IPL_XSCALE_MODE_MARK 0X8F /* X-Scale */
  161. /* miscellaneous limits */
  162. #define MAX_FLASH_DEVICES_MDOCP 1 /* maximum flash inside one MDOC */
  163. #define MAX_FLOORS 4
  164. #define CHIP_ID_MDOCP 0x40 /* MDOCP 32MB chip identification value */
  165. #define CHIP_ID_MDOCP16 0x41 /* MDOCP 16MB chip identification value */
  166. #define MDOC_ALIAS_RANGE 0x100
  167. #define ALIAS_RESOLUTION (MAX_FLASH_DEVICES_MDOCP + 10)
  168. /*������������������������������������Ŀ
  169. Definition for writing boot image
  170. */
  171. #define SPL_SIZE 0x2000 /* 8 KBytes */
  172. #define MAX_CODE_MODULES 6 /* max number of code modules in boot area (incl. SPL) */
  173. /*-----------------------------------------
  174. | Definition of MDOC32 memory window |
  175. ----------------------------------------*/
  176. /* MDOC32 memory window layout :
  177. 0000 .... 07FF RAM ( 1KB aliased across 2KB)
  178. 0800 .... 0FFF Flash Data Register (2KB alias of address 1028H-1029H)
  179. 1000 Chip Identification register
  180. 1002 NOP register
  181. 1004 Alias Resolution register
  182. 1006 DOC Control register
  183. 1008 Device ID select register
  184. 100a Configuration Input register
  185. 100c Output Control register
  186. 100e Interrupt Control register
  187. 1012 Output Enable Delay register
  188. 101E - 101F Flash Slow Read register[1:0]
  189. 1020 Flash Control Register
  190. 1022 Flash Select register
  191. 1024 Flash Command register
  192. 1026 Flash Address register
  193. 1028-1029 Flash Data Register
  194. 102A Read Pipeline Initialization register
  195. 102C-102D Last Data Read register
  196. 102E Write Pipeline Termination register
  197. 1040-1045 ECC Syndrome register[5:0]
  198. 1046 ECC Control register
  199. 1048 Customer OTP Pointer register
  200. 105A Flash Geometry register
  201. 105C-105D Data Protect Structure Status register[1:0]
  202. 105E-105f Data Protect Structure Pointer register[1:0]
  203. 1060-1063 Data Protect Lower Address register 0 [3:0]
  204. 1064-1067 Data Protect Upper Address register 0 [3:0]
  205. 1068-106B Data Protect Lower Address register 1 [3:0]
  206. 106C-106F Data Protect Upper Address register 1 [3:0]
  207. 1070 Data Protect Key register[0]
  208. 1072 Data Protect Key register[1]
  209. 1074 Download status register
  210. 1076 DOC Control Confirmation register
  211. 1078 Protection Status register
  212. 107E Foundry Test register
  213. 1800-1FFE RAM (1KB aliased across 2KB)
  214. 1FFF Release from power down mode
  215. */
  216. #define Nio 0x800 /* Flash Data Register (2KB alias of address 1028H-1029H) read/write */
  217. #define NIPLpart2 0x800 /* Flash Data Register (2KB alias of address 1028H-1029H) read/write */
  218. #define NchipId 0x1000 /* Chip Identification register. read */
  219. #define ID_FAMILY_MASK 0xf0 /* family . */
  220. #define ID_VERSION_MASK 0x7 /* version. */
  221. #define NNOPreg 0x1002 /* NOP register. read/write */
  222. #define NaliasResolution 0x1004 /* Alias Resolution register. read write */
  223. /* Asic controll register */
  224. #define NDOCcontrol 0x1006 /* DOC Control register. read/write */
  225. #define NDOCcontrolConfirm 0x1076 /*DOC Control Confirmation register.read only*/
  226. #define DOC_CNTRL_RAM_WE_MASK 0x20 /* ram write enable. 1=allow write to RAM. */
  227. #define DOC_CNTRL_RST_LAT_MASK 0x10 /* reset mode latched. */
  228. #define DOC_CNTRL_BDETCT_MASK 0x8 /* boot detect. */
  229. #define DOC_CNTRL_MDWREN_MASK 0x4 /* mode write enable. */
  230. #define DOC_CNTRL_MODE_MASK 0x3 /* mode of operation. 00=reset, 01=normal, 1x=power down */
  231. #define DOC_CNTRL_MODE_RESET 0x0 /* Reset mode + MDWREN */
  232. #define DOC_CNTRL_MODE_NORMAL 0x1 /* Normal mode + MDWREN */
  233. #define DOC_CNTRL_MODE_PWR_DWN 0x2 /* Power down mode + MDWREN */
  234. /* The modes are ORed with the following state:
  235. a) Do not enable ram write. ~0x20
  236. b) Reset the reset mode latche. 0x10
  237. c) Reset the boot detect latche 0x08
  238. d) Enable writing new mode 0x04
  239. e) Clear mode bits 2 LSB */
  240. #define DOC_CNTRL_DEFAULT 0x1c
  241. #define NASICselect 0x1008 /* Device ID select register. read/ write */
  242. #define ASIC_SELECT_ID_MASK 0x3 /* identification */
  243. #define NconfigInput 0x100A /* Configuration Input register. read/write */
  244. #define CONFIG_IF_CFG_MASK 0x80 /* state of IF_CFG input pin. */
  245. #define CONFIG_MAX_ID_MASK 0x30 /* maximum device ID */
  246. #define CONFIG_BD_IHN_MASK 0x8 /* boot detector inhibit */
  247. #define CONFIG_INTLV_MASK 0x4 /* interleave. 0=interleave-1, 1=interleave-2 */
  248. #define NoutputControl 0x100C /* Output Control register. read/write */
  249. #define OUT_CNTRL_BSY_DISABLE_MASK 0xfe /* busy enable . 1=enable assertion of the BUSY# output */
  250. #define OUT_CNTRL_STICKY_BIT_ENABLE 0x8 /* sticky bit . 8=prevent key insertion */
  251. #define NinterruptControl 0x100E /* Interrupt Control register. read/write */
  252. #define INTR_IRQ_P_MASK 0x40 /* interrupt request on protection violation */
  253. #define INTR_IRQ_F_MASK 0x20 /* interrupt request on FREADY */
  254. #define INTR_EDGE_MASK 0x10 /* edge/level interrupt. 1=edge */
  255. #define INTR_PROT_T_MASK 0x8 /* protection trigger */
  256. #define INTR_FRDY_T_MASK 0x7 /* flash ready trigger */
  257. #define NoutputEnableDelay 0x1012 /* Output Enable Delay register. read/write */
  258. #define NslowIO 0x101E /* Flash Slow Read register[1:0]. read only */
  259. #define NflashControl 0x1020 /* Flash Control Register. read write */
  260. #define FLS_FR_B_MASK 0xc0 /* flash ready/busy for 2 byte lanes*/
  261. #define FLS_FR_B_EVEN_MASK 0x40 /* flash ready/busy for even lane*/
  262. #define FLS_FR_B_ODD_MASK 0x80 /* flash ready/busy for odd lane*/
  263. #define FLS_ALE_MASK 0x4 /* address latch enable */
  264. #define FLS_CLE_MASK 0x2 /* command latch enable */
  265. #define NflashSelect 0x1022 /* Flash Select register. read write */
  266. #define MPLUS_SEL_CE 0x80 /* chip enable */
  267. #define MPLUS_SEL_WP 0x60 /* write protect*/
  268. #define FLS_SEL_BANK_MASK 0x2 /* select flash bank to access */
  269. #define FLS_SEL_BYTE_L_MASK 0x1 /* select flash device of the bankbyte lane*/
  270. /* The default for MDOCP is the following combination:
  271. a) Send chip enable. - 0x80
  272. b) Lower write protect. - 0x40
  273. c) Select chip bank 0 chip 0 - 0 for bits 0-5 */
  274. #define FLS_SEL_DEFAULT 0x80
  275. #define NflashCommand 0x1024 /*Flash Command register. write only */
  276. #define NflashAddress 0x1026 /* Flash Address register. write only */
  277. #define NflashData 0x1028 /* Flash Data Register[1:0]. read/write */
  278. #define NreadPipeInit 0x102A /* Read Pipeline Initialization register. read only */
  279. #define NreadLastData_1 0x102C /* Last Data Read register. read only */
  280. #define NreadLastData_2 0x102D /* Last Data Read register. read only */
  281. #define NwritePipeTerm 0x102E /*Write Pipeline Termination register. write only */
  282. #define Nsyndrom 0x1040 /*ECC Syndrome register[5:0]. read only */
  283. #define NECCcontrol 0x1046 /*ECC Control register. read/write */
  284. #define ECC_CNTRL_ERROR_MASK 0x80 /*EDC error detection */
  285. #define ECC_CNTRL_ECC_RW_MASK 0x20 /* ECC read/write. 1=ECC in write mode*/
  286. #define ECC_CNTRL_ECC_EN_MASK 0x8 /* ECC enable */
  287. #define ECC_CNTRL_TOGGLE_MASK 0x4 /* identify presence of MDOC*/
  288. #define ECC_CNTRL_IGNORE_MASK 0x1 /* ignore the ECC unit*/
  289. #define ECC_RESET 0 /* reset the ECC */
  290. #define NcustomerOTPptr 0x1048 /* Customer OTP Pointer register. read only*/
  291. #define NflashGeometry 0x105A /* Flash Geometry register. read only */
  292. #define NdownloadStatus 0x1074 /*Download status register. read only*/
  293. #define DWN_STAT_IPL_ERR 0x30
  294. #define DWN_STAT_IPL_INVALID 0x20
  295. #define DWN_STAT_IPL_1_ERR 0x10
  296. #define DWN_STAT_OTP_ERR 0x40 /* */
  297. #define DWN_STAT_DPS1_ERR 0xc
  298. #define DWN_STAT_DPS0_ERR 0x3
  299. #define DWN_STAT_DPS10_ERR 0x4
  300. #define DWN_STAT_DPS11_ERR 0x8
  301. #define DWN_STAT_DPS00_ERR 0x1
  302. #define DWN_STAT_DPS01_ERR 0x2
  303. #define DWN_STAT_DWLD_ERR 0x4a /* otp + all 4 copies of dps */
  304. #define NprotectionStatus 0x1078 /*Protection Status register. read only*/
  305. #define PROTECT_STAT_ACCERR 0x80
  306. #define PROTECT_STAT_LOCK_INPUT_MASK 0x10
  307. #define PROTECT_STAT_4BA_MASK 0x8
  308. #define PROTECT_STAT_COTPL_MASK 0x4
  309. #define PROTECT_STAT_BUC_MASK 0x2
  310. #define PROTECT_STAT_FOTPL_MASK 0x1
  311. #define NfoudaryTest 0x107E /* Foundry Test register. write only */
  312. #define FOUNDRY_WRITE_ENABLE 0xc3
  313. #define FOUNDRY_DNLD_MASK 0x80
  314. #define NreleasePowerDown 0x1FFF /* Release from power down. */
  315. #endif /* MDOCPLUS */