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.

711 lines
39 KiB

  1. /*
  2. * $Log: V:/Flite/archives/TrueFFS5/Src/FLFLASH.H_V $
  3. *
  4. * Rev 1.17 Apr 15 2002 07:36:44 oris
  5. * Removed the use of NDOC2window in access routine interface.
  6. * FL_NO_USE_FUNC now removes all of the access routines pointers.
  7. *
  8. * Rev 1.16 Feb 19 2002 20:59:44 oris
  9. * Bug fix changed definition of FL_IPL_MODE_XSCALE from 3 to 4.
  10. *
  11. * Rev 1.15 Jan 29 2002 20:08:26 oris
  12. * Changed FLAccessStruct definition to prevent compilation errors.
  13. * Added FL_IPL_MODE_XSCALE definition and change FL_IPL_XXX values.
  14. *
  15. * Rev 1.14 Jan 28 2002 21:24:48 oris
  16. * Added FL_IPL_DOWNLOAD flag to writeIPL routine in order to control whether the IPL will be reloaded after the update.
  17. * Added FLAccessStruct definition - used to get and set DiskOnChip memory access routines.
  18. * Removed win_io field from FLFlash record.
  19. *
  20. * Rev 1.13 Jan 23 2002 23:31:34 oris
  21. * Missing declaration of globalReadBack buffer, when MTD_RECONSTRUCT is defined.
  22. *
  23. * Rev 1.12 Jan 21 2002 20:44:32 oris
  24. * Bug fix - PARTIAL_EDC flag was support to incorporate EDC flag.
  25. *
  26. * Rev 1.11 Jan 20 2002 09:44:00 oris
  27. * Bug fix - changed include directive of flBuffer.h to flbuffer.h
  28. *
  29. * Rev 1.10 Jan 17 2002 23:01:28 oris
  30. * Added flFlashOf() prototype.
  31. * New memory access routines mechanism :
  32. * - Added memory access routines pointers in FLFlash.
  33. * - Added win_io and win fields to FLFlash record pointing to DiskOnChip IO registers and window base.
  34. * - Added busAccessType.
  35. * Moved CardAddress typedef and NDOC2window typedefs from flbase.h
  36. * Added DiskOnChip Millennium Plus 16MB type MDOCP_16_TYPE.
  37. * Added the following definitions FL_IPL_MODE_NORMAL / FL_IPL_MODE_SA / MAX_PROTECTED_PARTITIONS /MAX_SECTORS_PER_BLOCK
  38. * Added Another flag to writeIPL for Strong Arm mode.
  39. *
  40. * Rev 1.9 Sep 15 2001 23:46:08 oris
  41. * Changed erase routine to support up to 64K erase blocks.
  42. * Added reconstruct flag to readBBT routine - stating whether to reconstruct BBT if it is not available.
  43. *
  44. * Rev 1.8 Jul 13 2001 01:04:48 oris
  45. * Added include directive to flBuffer and readBack buffer forward definition under the MTD_STANDALONE compilation flag.
  46. * Added volNo field to the socket record under the MTD_STANDALONE compilation flag.
  47. * Added definition for PARTIAL_EDC flash read mode.
  48. * Added protection default key.
  49. * Added bad block marking in the BBT (BBT_BAD_UNIT).
  50. * Moved syndrome length definition to reedsol files.
  51. * Added new field in FLFlash record - Max Erase Cycles of the flash.
  52. * Changed interleave field in FLFlash record to signed.
  53. *
  54. * Rev 1.7 May 16 2001 21:18:30 oris
  55. * Moved SYNDROM_BYTES definition from diskonc.h and mdocplus.h.
  56. * Added forward definition for saveSyndromForDumping global EDC\ECC syndrome buffer.
  57. * Changed DATA definition to FL_DATA.
  58. *
  59. * Rev 1.6 May 02 2001 06:40:58 oris
  60. * Removed the lastUsableBlock variable.
  61. * Added the BBT_UNAVAIL_UNIT defintion.
  62. *
  63. * Rev 1.5 Apr 24 2001 17:08:12 oris
  64. * Added lastUsableBlock field and changed firstUsableBlock type to dword.
  65. *
  66. * Rev 1.4 Apr 16 2001 13:40:48 oris
  67. * Added firstUsableBlock.
  68. * Removed warrnings by changing some of the fields types.
  69. *
  70. * Rev 1.3 Apr 12 2001 06:51:12 oris
  71. * Changed protectionBounries and protectionSet routine to be floor specific.
  72. * Changed powerdown prototype.
  73. * Added download prototype.
  74. *
  75. * Rev 1.2 Apr 01 2001 07:54:24 oris
  76. * copywrite notice.
  77. * Moved protection attributes definition from mdocplus.h
  78. * Changed prototype of routine pointers in flflash struct :read,write routines to dword length.
  79. * Other routine pointer prototypes have been changed as well.
  80. * Removed interface b routine pointers from flflash struct (experimental MTD interface for mdocp).
  81. * Changed prototype of :read,write routine to enabled dword length.
  82. * Changed unsigned char to byte.
  83. * Changed unsigned long to dword.
  84. * Changed long int to Sdword.
  85. * Spelling mistake "changable".
  86. *
  87. * Rev 1.1 Feb 13 2001 01:37:38 oris
  88. * Changed ENTER_DEEP_POWER_DOWN_MODE to DEEP_POWER_DOWN
  89. * Changed LOCKED to LOCKED_OTP
  90. *
  91. * Rev 1.0 Feb 04 2001 11:30:44 oris
  92. * Initial revision.
  93. *
  94. */
  95. /***********************************************************************************/
  96. /* M-Systems Confidential */
  97. /* Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2001 */
  98. /* All Rights Reserved */
  99. /***********************************************************************************/
  100. /* NOTICE OF M-SYSTEMS OEM */
  101. /* SOFTWARE LICENSE AGREEMENT */
  102. /* */
  103. /* THE USE OF THIS SOFTWARE IS GOVERNED BY A SEPARATE LICENSE */
  104. /* AGREEMENT BETWEEN THE OEM AND M-SYSTEMS. REFER TO THAT AGREEMENT */
  105. /* FOR THE SPECIFIC TERMS AND CONDITIONS OF USE, */
  106. /* OR CONTACT M-SYSTEMS FOR LICENSE ASSISTANCE: */
  107. /* E-MAIL = [email protected] */
  108. /***********************************************************************************/
  109. #ifndef FLFLASH_H
  110. #define FLFLASH_H
  111. #include "flbase.h"
  112. #ifndef MTD_STANDALONE
  113. #include "flsocket.h"
  114. #else
  115. #include "flbuffer.h" /* defintion for READ_BACK_BUFFER_SIZE */
  116. typedef struct tSocket FLSocket;
  117. struct tSocket
  118. {
  119. unsigned volNo; /* Volume no. of socket */
  120. void FAR0 * base; /* Pointer to window base */
  121. Sdword size; /* Window size (must by power of 2) */
  122. };
  123. #if (defined (VERIFY_WRITE) || defined(VERIFY_ERASE) || defined(MTD_RECONSTRUCT_BBT))
  124. extern byte globalReadBack[SOCKETS][READ_BACK_BUFFER_SIZE];
  125. #endif /* VERIFY_WRITE */
  126. extern FLSocket *flSocketOf(unsigned volNo);
  127. extern FLBuffer globalMTDBuffer;
  128. extern int noOfMTDs;
  129. /* Replacement for various TrueFFS typedefs */
  130. typedef unsigned long CardAddress; /* Physical offset on card */
  131. #endif /* MTD_STANDALONE */
  132. /* Some useful types for mapped Flash locations */
  133. typedef volatile byte FAR0 * FlashPTR;
  134. typedef volatile unsigned short int FAR0 * FlashWPTR;
  135. typedef volatile dword FAR0 * FlashDPTR;
  136. typedef unsigned short FlashType; /* JEDEC id */
  137. typedef volatile unsigned char FAR0* NDOC2window;
  138. /* DiskOnChip memory access routines type defintions */
  139. /* Doc memory read routine */
  140. typedef void (FLMemRead)(volatile byte FAR1* win,word regOffset,byte FAR1* dest,word count);
  141. /* Doc memory write routine */
  142. typedef void (FLMemWrite)(volatile byte FAR1* win,word regOffset,byte FAR1* src,word count);
  143. /* Doc memory set routine */
  144. typedef void (FLMemSet)(volatile byte FAR1* win,word regOffset,word count, byte val);
  145. /* Doc memory 8 bit read routine */
  146. typedef byte (FLMemRead8bit)(volatile byte FAR1* win,word offset);
  147. /* Doc memory 8 bit write routine */
  148. typedef void (FLMemWrite8bit)(volatile byte FAR1* win,word offset,byte Data);
  149. /* Doc memory 16 bit read routine */
  150. typedef word (FLMemRead16bit)(volatile byte FAR1* win,word offset);
  151. /* Doc memory 16 bit write routine */
  152. typedef void (FLMemWrite16bit)(volatile byte FAR1* win,word offset,word Data);
  153. /* Doc memory window size */
  154. typedef dword (FLMemWindowSize)(void);
  155. typedef struct { /* DiskOnChip memory access routines */
  156. dword access; /* Output only */
  157. FLMemRead FAR1* memRead;
  158. FLMemWrite FAR1* memWrite;
  159. FLMemSet FAR1* memSet;
  160. FLMemRead8bit FAR1* memRead8bit;
  161. FLMemWrite8bit FAR1* memWrite8bit;
  162. FLMemRead16bit FAR1* memRead16bit;
  163. FLMemWrite16bit FAR1* memWrite16bit;
  164. FLMemWindowSize FAR1* memWindowSize;
  165. }FLAccessStruct;
  166. #define NOT_FLASH 0
  167. /* Media types */
  168. #define NOT_DOC_TYPE 0
  169. #define DOC_TYPE 1
  170. #define MDOC_TYPE 2
  171. #define DOC2000TSOP_TYPE 3
  172. #define MDOCP_TYPE 4
  173. #define MDOCP_16_TYPE 5
  174. /* page characteristics flags */
  175. #define BIG_PAGE 0x0100 /* page size > 100H*/
  176. #define FULL_PAGE 0x0200 /* no partial page programming*/
  177. #define BIG_ADDR 0x0400 /* 4 byte address cycle */
  178. /* MTD write routine mode flags */
  179. #define FL_DATA 0 /* Read/Write data area */
  180. #define OVERWRITE 1 /* Overwriting non-erased area */
  181. #define EDC 2 /* Activate ECC/EDC */
  182. #define EXTRA 4 /* Read/write spare area */
  183. #define PARTIAL_EDC 10 /* Read with EDC even for partial page */
  184. #define NO_SECOND_TRY 0x8000 /* do not read again on EDC error */
  185. /* Protection attributes */
  186. #define PROTECTABLE 1 /* partition can recieve protection */
  187. #define READ_PROTECTED 2 /* partition is read protected */
  188. #define WRITE_PROTECTED 4 /* partition is write protected */
  189. #define LOCK_ENABLED 8 /* HW lock signal is enabled */
  190. #define LOCK_ASSERTED 16 /* HW lock signal is asserted */
  191. #define KEY_INSERTED 32 /* key is inserted (not currently */
  192. #define CHANGEABLE_PROTECTION 64 /* changeable protection area type */
  193. /* protection specific defintions */
  194. #define DO_NOT_COMMIT_PROTECTION 0 /* The new values will take affect only after reset */
  195. #define COMMIT_PROTECTION 1 /* The new values will take affect imidiatly */
  196. #define PROTECTION_KEY_LENGTH 8 /* Size of protection key in bytes */
  197. #define MAX_PROTECTED_PARTITIONS 2 /* Max Number of protected partitiosn */
  198. #define DEFAULT_KEY "00000000"
  199. /* IPL modes */
  200. #define FL_IPL_MODE_NORMAL 0 /* IPL - Written as usual */
  201. #define FL_IPL_DOWNLOAD 1 /* IPL - Force download of new IPL */
  202. #define FL_IPL_MODE_SA 2 /* IPL - Written with Strong Arm mode enabled */
  203. #define FL_IPL_MODE_XSCALE 4 /* IPL - Written with X-Scale mode enabled */
  204. /* OTP specific defintions */
  205. #define CUSTOMER_ID_LEN 4
  206. #define UNIQUE_ID_LEN 16
  207. /* BBT block types */
  208. #define BBT_GOOD_UNIT 0xff
  209. #define BBT_UNAVAIL_UNIT 0x1
  210. #define BBT_BAD_UNIT 0x0
  211. /* General purpose */
  212. #define MAX_SECTORS_PER_BLOCK 64
  213. /*----------------------------------------------------------------------*/
  214. /* Flash array identification structure */
  215. /* */
  216. /* This structure contains a description of the Flash array and */
  217. /* routine pointers for the map, read, write & erase functions. */
  218. /* */
  219. /* The structure is initialized by the MTD that identifies the Flash */
  220. /* array. */
  221. /* On entry to an MTD, the Flash structure contains default routines */
  222. /* for all operations. This routines are sufficient forread-only access */
  223. /* to NOR Flash on a memory-mapped socket. The MTD should override the */
  224. /* default routines with MTD specific ones when appropriate. */
  225. /*----------------------------------------------------------------------*/
  226. /* Flash array identification structure */
  227. typedef struct tFlash FLFlash; /* Forward definition */
  228. struct tFlash {
  229. FlashType type; /* Flash device type (JEDEC id) */
  230. byte mediaType; /* see media types obove */
  231. byte ppp; /* number of allowed PPP */
  232. dword busAccessType; /* saves bus access type */
  233. dword maxEraseCycles; /* erase cycles limit per erase block */
  234. dword changeableProtectedAreas; /* areas capable of changing protection */
  235. /* attribute with no danger of loosing */
  236. /* the entire chip */
  237. byte totalProtectedAreas; /* total number of protection arweas */
  238. dword erasableBlockSize; /* Smallest physically erasable size */
  239. /* (with interleaving taken into account) */
  240. byte erasableBlockSizeBits;/* Bits representing the erasable block */
  241. dword chipSize; /* chip size */
  242. byte noOfFloors; /* no of controllers in array */
  243. word pageSize; /* size of flash page in bytes */
  244. word noOfChips; /* no of chips in array */
  245. dword firstUsableBlock; /* Some devices may not use all of the media */
  246. /* blocks. For example mdocplus can not use */
  247. /* the first 3 blocks. */
  248. Sword interleaving; /* chip interleaving (The interleaving is */
  249. /* defined as the address difference between */
  250. /* two consecutive bytes on a chip) */
  251. word flags; /* Special capabilities & options Bits 0-7 */
  252. /* may be used by FLite. Bits 8-15 are not */
  253. /* used bt FLite and may beused by MTD's for */
  254. /* MTD-specific purposes. */
  255. /* Flag bit values */
  256. #define SUSPEND_FOR_WRITE 1 /* MTD provides suspend for write */
  257. #define NFTL_ENABLED 2 /* Flash can run NFTL */
  258. #define INFTL_ENABLED 4 /* Flash can run INFTL */
  259. #define EXTERNAL_EPROM 8 /* Can support external eprom */
  260. void * mtdVars; /* Points to MTD private area for this socket.*/
  261. /* This field, if used by the MTD, is */
  262. /* initialized bythe MTD identification */
  263. /* routine. */
  264. FLSocket * socket; /* Socket of this drive. Note that 2 diffrent */
  265. /* records are used. One for OSAK and the */
  266. /* other forstandalone applications. */
  267. NDOC2window win; /* DiskOnChip memory windows */
  268. #ifdef NT5PORT
  269. ULONG readBufferSize;
  270. VOID * readBuffer;
  271. #endif /*NT5PORT*/
  272. /*----------------------------------------------------------------------*/
  273. /* f l a s h . m a p */
  274. /* */
  275. /* MTD specific map routine */
  276. /* */
  277. /* The default routine maps by socket mapping, and is suitable for all */
  278. /* NOR Flash. */
  279. /* NAND or other type Flash should use map-through-copy emulation: Read */
  280. /* a block of Flash to an internal buffer and return a pointer to that */
  281. /* buffer. */
  282. /* */
  283. /* Parameters: */
  284. /* vol : Pointer identifying drive */
  285. /* address : Card address to map */
  286. /* length : Length to map */
  287. /* */
  288. /* Returns: */
  289. /* Pointer to required card address */
  290. /*----------------------------------------------------------------------*/
  291. void FAR0 * (*map)(FLFlash *, CardAddress, int);
  292. /*----------------------------------------------------------------------*/
  293. /* f l a s h . r e a d */
  294. /* */
  295. /* MTD specific Flash read routine */
  296. /* */
  297. /* The default routine reads by copying from a mapped window, and is */
  298. /* suitable for all NOR Flash. */
  299. /* */
  300. /* Parameters: */
  301. /* vol : Pointer identifying drive */
  302. /* address : Card address to read */
  303. /* buffer : Area to read into */
  304. /* length : Length to read */
  305. /* modes : See write mode flags definition above */
  306. /* */
  307. /*----------------------------------------------------------------------*/
  308. FLStatus (*read)(FLFlash *, CardAddress, void FAR1 *, dword, word);
  309. /*----------------------------------------------------------------------*/
  310. /* f l a s h . w r i t e */
  311. /* */
  312. /* MTD specific Flash write routine */
  313. /* */
  314. /* The default routine returns a write-protect error. */
  315. /* */
  316. /* Parameters: */
  317. /* vol : Pointer identifying drive */
  318. /* address : Card address to write to */
  319. /* buffer : Address of data to write */
  320. /* length : Number of bytes to write */
  321. /* modes : See write mode flags definition above */
  322. /* */
  323. /* Returns: */
  324. /* FLStatus : 0 on success, failed otherwise */
  325. /*----------------------------------------------------------------------*/
  326. FLStatus (*write)(FLFlash *, CardAddress, const void FAR1 *, dword, word);
  327. /*----------------------------------------------------------------------*/
  328. /* f l a s h . e r a s e */
  329. /* */
  330. /* Erase one or more contiguous Flash erasable blocks */
  331. /* */
  332. /* The default routine returns a write-protect error. */
  333. /* */
  334. /* Parameters: */
  335. /* vol : Pointer identifying drive */
  336. /* firstErasableBlock : Number of first block to erase */
  337. /* numOfErasableBlocks : Number of blocks to erase */
  338. /* */
  339. /* Returns: */
  340. /* FLStatus : 0 on success, failed otherwise */
  341. /*----------------------------------------------------------------------*/
  342. FLStatus (*erase)(FLFlash *, word, word);
  343. /*----------------------------------------------------------------------*/
  344. /* f l a s h . s e t P o w e r O n C a l l b a c k */
  345. /* */
  346. /* Register power on callback routine. Default: no routine is */
  347. /* registered. */
  348. /* */
  349. /* Parameters: */
  350. /* vol : Pointer identifying drive */
  351. /* */
  352. /*----------------------------------------------------------------------*/
  353. void (*setPowerOnCallback)(FLFlash *);
  354. /*----------------------------------------------------------------------*/
  355. /* f l a s h . r e a d B B T */
  356. /* */
  357. /* MTD specific Flash routine returning the media units status */
  358. /* Note that a unit can contain more then 1 erase block */
  359. /* */
  360. /* No default routine is implemented for this routine. */
  361. /* */
  362. /* Parameters: */
  363. /* vol : Pointer identifying drive */
  364. /* unitNo : Number of the first unit to check */
  365. /* unitsToRead : Number of units to check */
  366. /* blockMultiplier : Number of blocks per erase unit */
  367. /* buffer : Buffer to return the units status */
  368. /* reconstruct : TRUE for reconstruct BBT from virgin card */
  369. /* */
  370. /*----------------------------------------------------------------------*/
  371. FLStatus (*readBBT)(FLFlash *, dword unitNo, dword unitsToRead,
  372. byte blockMultiplier,byte FAR1 * buffer, FLBoolean reconstruct);
  373. /*----------------------------------------------------------------------*/
  374. /* f l a s h . w r i t e I P L */
  375. /* */
  376. /* MTD specific Flash write IPL area routine */
  377. /* */
  378. /* No default routine is implemented for this routine. */
  379. /* */
  380. /* Parameters: */
  381. /* vol : Pointer identifying drive */
  382. /* buffer : Buffer containing the data to write */
  383. /* length : Length to write */
  384. /* flags : Flags of write IPL operation (see obove) */
  385. /* */
  386. /*----------------------------------------------------------------------*/
  387. FLStatus (*writeIPL)(FLFlash *, const void FAR1 * buffer, word length,
  388. byte offset , unsigned flags);
  389. /*----------------------------------------------------------------------*/
  390. /* f l a s h . r e a d I P L */
  391. /* */
  392. /* MTD specific Flash read area IPL routine */
  393. /* */
  394. /* No default routine is implemented for this routine. */
  395. /* */
  396. /* Parameters: */
  397. /* vol : Pointer identifying drive */
  398. /* buffer : Area to read into */
  399. /* length : Length to read */
  400. /* */
  401. /*----------------------------------------------------------------------*/
  402. FLStatus (*readIPL)(FLFlash *, void FAR1 * buffer, word length);
  403. #ifdef HW_OTP
  404. /*----------------------------------------------------------------------*/
  405. /* f l a s h . w r i t e O T P */
  406. /* */
  407. /* MTD specific Flash write and lock OTP area routine */
  408. /* */
  409. /* No default routine is implemented for this routine. */
  410. /* */
  411. /* Parameters: */
  412. /* vol : Pointer identifying drive */
  413. /* buffer : buffer containing the data to write */
  414. /* length : Length to write */
  415. /* */
  416. /*----------------------------------------------------------------------*/
  417. FLStatus (*writeOTP)(FLFlash *, const void FAR1 * buffer,word length);
  418. /*----------------------------------------------------------------------*/
  419. /* f l a s h . r e a d O T P */
  420. /* */
  421. /* MTD specific Flash read OTP area routine */
  422. /* */
  423. /* No default routine is implemented for this routine. */
  424. /* */
  425. /* Parameters: */
  426. /* vol : Pointer identifying drive */
  427. /* offset : Offset from the begining of the OTP arae */
  428. /* buffer : Area to read into */
  429. /* length : Length to read */
  430. /* */
  431. /*----------------------------------------------------------------------*/
  432. FLStatus (*readOTP)(FLFlash *, word offset, void FAR1 * buffer, word length);
  433. /*----------------------------------------------------------------------*/
  434. /* f l a s h . otpSize */
  435. /* */
  436. /* MTD specific Flash get OTP area size and state */
  437. /* */
  438. /* No default routine is implemented for this routine. */
  439. /* */
  440. /* Parameters: */
  441. /* vol : Pointer identifying drive */
  442. /* sectionSize : total size of the OTP area */
  443. /* usedSize : Used (and locked) size of the OTP area */
  444. /* locked : LOCKED_OTP flag stating the locked state */
  445. /* */
  446. /*----------------------------------------------------------------------*/
  447. FLStatus (*otpSize)(FLFlash *, dword FAR2* sectionSize,
  448. dword FAR2* usedSize, word FAR2* locked);
  449. #define LOCKED_OTP 1
  450. #endif /* HW_OTP */
  451. /*----------------------------------------------------------------------*/
  452. /* f l a s h . g e t U n i q u e I d */
  453. /* */
  454. /* MTD specific Flash get the chip unique ID */
  455. /* */
  456. /* No default routine is implemented for this routine. */
  457. /* */
  458. /* Parameters: */
  459. /* vol : Pointer identifying drive */
  460. /* buffer : byte buffer to read unique ID into */
  461. /* */
  462. /*----------------------------------------------------------------------*/
  463. FLStatus (*getUniqueId)(FLFlash *, void FAR1 * buffer);
  464. #ifdef HW_PROTECTION
  465. /*----------------------------------------------------------------------*/
  466. /* f l a s h . p r o t e c t i o n B o u n d r i e s */
  467. /* */
  468. /* MTD specific Flash get protection boundries routine */
  469. /* */
  470. /* No default routine is implemented for this routine. */
  471. /* */
  472. /* Parameters: */
  473. /* vol : Pointer identifying drive */
  474. /* areaNo : Protection area number to work on */
  475. /* addressLow : Low boundary Address of protected area */
  476. /* addressHigh : High boundary Address of protected area */
  477. /* floorNo : The floor to work on. */
  478. /* */
  479. /*----------------------------------------------------------------------*/
  480. FLStatus (*protectionBoundries)(FLFlash *, byte areaNo,
  481. CardAddress* addressLow ,CardAddress* addressHigh, byte floorNo);
  482. /*----------------------------------------------------------------------*/
  483. /* f l a s h . p r o t e c t i o n K e y I n s e r t */
  484. /* */
  485. /* MTD specific Flash insert the protection key routine */
  486. /* */
  487. /* No default routine is implemented for this routine. */
  488. /* */
  489. /* Note the key is inserted only to protected areas and to all floors */
  490. /* */
  491. /* Parameters: */
  492. /* vol : Pointer identifying drive */
  493. /* areaNo : Protection area number to work on */
  494. /* key : protection key buffer */
  495. /* */
  496. /*----------------------------------------------------------------------*/
  497. FLStatus (*protectionKeyInsert)(FLFlash *, byte areaNo, byte FAR1* key);
  498. /*----------------------------------------------------------------------*/
  499. /* f l a s h . p r o t e c t i o n K e y R e m o v e */
  500. /* */
  501. /* MTD specific Flash remove the protection key routine */
  502. /* */
  503. /* No default routine is implemented for this routine. */
  504. /* */
  505. /* Note the key is removed from all floors. */
  506. /* */
  507. /* Parameters: */
  508. /* vol : Pointer identifying drive */
  509. /* areaNo : Protection area number to work on */
  510. /* */
  511. /*----------------------------------------------------------------------*/
  512. FLStatus (*protectionKeyRemove)(FLFlash *,byte areaNo);
  513. /*----------------------------------------------------------------------*/
  514. /* f l a s h . p r o t e c t i o n T y p e */
  515. /* */
  516. /* MTD specific Flash get protection type routine */
  517. /* */
  518. /* No default routine is implemented for this routine. */
  519. /* */
  520. /* Note the type is the combined attributes of all the floors. */
  521. /* */
  522. /* Parameters: */
  523. /* vol : Pointer identifying drive */
  524. /* areaNo : Protection area number to work on */
  525. /* areaType : returnining the protection type */
  526. /* */
  527. /*----------------------------------------------------------------------*/
  528. FLStatus (*protectionType)(FLFlash *,byte areaNo, word* areaType);
  529. /*----------------------------------------------------------------------*/
  530. /* f l a s h . p r o t e c t i o n S e t */
  531. /* */
  532. /* MTD specific Flash get protection type routine */
  533. /* */
  534. /* No default routine is implemented for this routine. */
  535. /* */
  536. /* Parameters: */
  537. /* vol : Pointer identifying drive */
  538. /* areaNo : Protection area number to work on */
  539. /* areaType : Protection area type */
  540. /* addressLow : Low boundary Address of protected area */
  541. /* addressHigh : High boundary Address of protected area */
  542. /* key : protection key buffer */
  543. /* modes : Either COMMIT_PROTECTION will cause the new */
  544. /* values to take affect immidiatly or */
  545. /* DO_NOT_COMMIT_PROTECTION for delaying the new */
  546. /* values to take affect only after the next reset.*/
  547. /* floorNo : The floor to work on. */
  548. /* */
  549. /*----------------------------------------------------------------------*/
  550. FLStatus (*protectionSet )( FLFlash *,byte areaNo, word areaType ,
  551. CardAddress addressLow, CardAddress addressHigh,
  552. byte FAR1* key , byte modes , byte floorNo);
  553. #endif /* HW_PROTECTION */
  554. /*----------------------------------------------------------------------*/
  555. /* f l a s h . e n t e r D e e p P o w e r D o w n M o d e */
  556. /* */
  557. /* MTD specific Flash enter deep power down mode routine */
  558. /* */
  559. /* No default routine is implemented for this routine. */
  560. /* */
  561. /* Parameters: */
  562. /* vol : Pointer identifying drive */
  563. /* state : DEEP_POWER_DOWN */
  564. /* */
  565. /*----------------------------------------------------------------------*/
  566. FLStatus (*enterDeepPowerDownMode)(FLFlash *,word state);
  567. #define DEEP_POWER_DOWN 1 /* must be the same as in blockdev.h */
  568. /*----------------------------------------------------------------------*/
  569. /* f l a s h . d o w n l o a d */
  570. /* */
  571. /* MTD specific - Reset download mechanizm to download IPL and */
  572. /* protection attributes. */
  573. /* */
  574. /* No default routine is implemented for this routine. */
  575. /* */
  576. /* Parameters: */
  577. /* vol : Pointer identifying drive */
  578. /* */
  579. /*----------------------------------------------------------------------*/
  580. FLStatus (*download)(FLFlash *);
  581. /*----------------------------------------------------------------------*/
  582. /* DiskOnChip memory access routines type defintions */
  583. /*----------------------------------------------------------------------*/
  584. FLMemWindowSize FAR1* memWindowSize; /* Doc memory window size */
  585. #ifndef FL_NO_USE_FUNC
  586. FLMemRead FAR1* memRead; /* Doc memory read routine */
  587. FLMemWrite FAR1* memWrite; /* Doc memory write routine */
  588. FLMemSet FAR1* memSet; /* Doc memory set routine */
  589. FLMemRead8bit FAR1* memRead8bit; /* Doc memory 8 bit read routine */
  590. FLMemWrite8bit FAR1* memWrite8bit; /* Doc memory 8 bit write routine */
  591. FLMemRead16bit FAR1* memRead16bit; /* Doc memory 16 bit read routine */
  592. FLMemWrite16bit FAR1* memWrite16bit; /* Doc memory 16 bit write routine */
  593. #endif /* FL_NO_USE_FUNC */
  594. };
  595. /* MTD registration information */
  596. extern int noOfMTDs; /* No. of MTDs actually registered */
  597. typedef FLStatus (*MTDidentifyRoutine) (FLFlash *);
  598. extern MTDidentifyRoutine mtdTable[MTDS];
  599. /* Returns specific flash structure of the socket */
  600. extern FLFlash * flFlashOf(unsigned volNo);
  601. #ifdef MTD_STANDALONE
  602. typedef FLStatus (*SOCKETidentifyRoutine) (FLSocket * ,
  603. dword lowAddress, dword highAddress);
  604. typedef void (*FREEmtd) (FLSocket vol);
  605. extern SOCKETidentifyRoutine socketTable[MTDS];
  606. extern FREEmtd freeTable[MTDS];
  607. #else
  608. /* The address of this, if returned from map, denotes a data error */
  609. extern FLStatus dataErrorObject;
  610. #define dataErrorToken ((void FAR0 *) &dataErrorObject)
  611. /* See interface documentation of functions in flflash.c */
  612. extern void flIntelIdentify(FLFlash *,
  613. void (*)(FLFlash *, CardAddress, byte, FlashPTR),
  614. CardAddress);
  615. extern FLStatus flIntelSize(FLFlash *,
  616. void (*)(FLFlash *, CardAddress, byte, FlashPTR),
  617. CardAddress);
  618. extern FLStatus flIdentifyFlash(FLSocket *socket, FLFlash *flash);
  619. #ifdef NT5PORT
  620. extern VOID * mapThroughBuffer(FLFlash *flash, CardAddress address, LONG length);
  621. #endif /*NT5PORT*/
  622. #endif /* MTD_STANDALONE */
  623. #endif
  624. /*----------------------------------------------------------------------*/
  625. /* f l a s h . r e s e t I n t e r r u p t */
  626. /* */
  627. /* MTD specific Flash reset the interrupt signal routine */
  628. /* */
  629. /* No default routine is implemented for this routine. */
  630. /* */
  631. /* Parameters: */
  632. /* vol : Pointer identifying drive */
  633. /* */
  634. /*----------------------------------------------------------------------*/
  635. /*void (*resetInterrupt)(FLFlash vol); */