Leaked source code of windows server 2003
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.

1977 lines
114 KiB

  1. /*
  2. * $Log: V:/Flite/archives/TrueFFS5/Src/BLOCKDEV.H_V $
  3. *
  4. * Rev 1.20 Apr 15 2002 07:34:06 oris
  5. * Bug fix - FL_IPL_MODE_XSCALE define was set to 3 instead of 4 and therefore caused FL_IPL_DOWNLOAD and FL_IPL_MODE_SA to be set as well.
  6. *
  7. * Rev 1.19 Feb 19 2002 20:58:20 oris
  8. * Removed warnings.
  9. * Moved FLFunctionNo enumerator to dedicated file flfuncno.h
  10. * Added include directive for cleaner customer usage.
  11. *
  12. * Rev 1.18 Jan 29 2002 20:07:16 oris
  13. * Moved flParsePath declaration to the end of the file.
  14. * Changed LOW_LEVEL compilation flag with FL_LOW_LEVEL to prevent definition clashes.
  15. * Added documentation of irFlags in flMountVolume (returns no of hidden sectors of the media).
  16. * flSetEnvVolume, flSetEnvSocket , flSetEnvAll , flSetDocBusRoutine , flGetDocBusRoutine, flBuildGeometry , bdCall and flExit
  17. * Added FL_IPL_MODE_XSCALE definition and change FL_IPL_XXX values.
  18. *
  19. * Rev 1.17 Jan 28 2002 21:23:46 oris
  20. * Changed FL_NFTL_CACHE_ENABLED to FL_TL_CACHE_ENABLED.
  21. * Changed flSetDocBusRoutine interface and added flGetDocBusRoutine.
  22. *
  23. * Rev 1.16 Jan 23 2002 23:30:54 oris
  24. * Added documentation of irData and irLength to flCheckVolume.
  25. *
  26. * Rev 1.15 Jan 20 2002 20:27:40 oris
  27. * Added TL_NORMAL_FORMAT flag was added to bdFormatPhisycalDrive instead of 0 (in the comments).
  28. * Removed TL_QUICK_MOUNT_FORMAT flag definition.
  29. *
  30. * Rev 1.14 Jan 17 2002 22:57:18 oris
  31. * Added flClearQuickMountInfo() routine - FL_CLEAR_QUICK_MOUNT_INFO
  32. * Added flVerifyVolume() routine - FL_VERIFY_VOLUME
  33. * Added DiskOnChip Millennium Plus 16MB type
  34. * Changed the order of FLEnvVars enumerator.
  35. * Added FLEnvVars values for :
  36. * FL_SECTORS_VERIFIED_PER_FOLDING
  37. * FL_SUSPEND_MODE
  38. * FL_VERIFY_WRITE_OTHER
  39. * FL_MTD_BUS_ACCESS_TYPE
  40. * FL_VERIFY_WRITE_BDTL
  41. * FL_VERIFY_WRITE_BINARY
  42. * flSetEnv() routine was changed into 3 different routines: flSetEnvVolume / flSetEnvSocket / flSetEnvAll
  43. * Removed TL_SINGLE_FLOOR_FORMATTING flag definition from format routine.
  44. * Added flSetDocBusRoutines prototype and required definitions.
  45. *
  46. * Rev 1.13 Nov 21 2001 11:39:36 oris
  47. * Changed FL_VERIFY_WRITE_MODE to FL_MTD_VERIFY_WRITE.
  48. *
  49. * Rev 1.12 Nov 08 2001 10:44:18 oris
  50. * Added FL_VERIFY_WRITE_MODE enumerator type for the flSetEnv routine .
  51. * Moved environment variable states definitions to flbase.h.
  52. *
  53. * Rev 1.11 Sep 15 2001 23:44:30 oris
  54. * Placed flDeepPowerDownMone under LOW_LEVEL compilation flag.
  55. *
  56. * Rev 1.10 May 17 2001 16:50:32 oris
  57. * Removed warnings.
  58. *
  59. * Rev 1.9 May 16 2001 21:16:22 oris
  60. * Added the Binary state (0,1) of the environment variables to meaningful definitions.
  61. * Removed LAST function enumerator.
  62. * Improved documentation.
  63. *
  64. * Rev 1.8 May 06 2001 22:41:14 oris
  65. * Added SUPPORT_WRITE_IPL_ROUTIN capability.
  66. *
  67. * Rev 1.7 Apr 30 2001 17:57:50 oris
  68. * Added required defintions to support the flMarkDeleteOnFlash environment variable.
  69. *
  70. * Rev 1.6 Apr 24 2001 17:05:52 oris
  71. * Changed bdcall function numbers in order to allow future grouth.
  72. *
  73. * Rev 1.5 Apr 01 2001 07:49:04 oris
  74. * Added FL_READ_IPL .
  75. * flChangeEnvironmentVariable prototype removed.
  76. * Moved s/w protection definitions from iovtl.h to blockdev.h
  77. * Changed s\w and h\w to s/w and h/w.
  78. * Added flBuildGeometry prototype
  79. * Moved bdcall prototype to the end of the file with the rest of the prototypes.
  80. *
  81. * Rev 1.4 Feb 18 2001 14:15:38 oris
  82. * Changed function enums order.
  83. *
  84. * Rev 1.3 Feb 14 2001 01:44:16 oris
  85. * Changed capabilities from defined flags to an enumerator
  86. * Improoved documentation of readBBT, writeBBT InquireCapabilities, countVolumes
  87. * Added environment variables defintions
  88. *
  89. * Rev 1.2 Feb 13 2001 02:08:42 oris
  90. * Moved LOCKED_OTP and DEEP_POWER_DOWN to flflash.h
  91. * Moved TL_FORMAT_FAT and TL_FORMAT_COMPRESSION to flformat.h
  92. * Added extern declaration for flSetEnv routine.
  93. *
  94. * Rev 1.1 Feb 12 2001 11:54:46 oris
  95. * Added baseAddress in flGetPhysicalInfo as irLength.
  96. * Added boot sectors in flMountVolumes as irFlags.
  97. * Change order of routines definition.
  98. *
  99. * Rev 1.0 Feb 04 2001 18:05:04 oris
  100. * Initial revision.
  101. *
  102. */
  103. /***********************************************************************************/
  104. /* M-Systems Confidential */
  105. /* Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2001 */
  106. /* All Rights Reserved */
  107. /***********************************************************************************/
  108. /* NOTICE OF M-SYSTEMS OEM */
  109. /* SOFTWARE LICENSE AGREEMENT */
  110. /* */
  111. /* THE USE OF THIS SOFTWARE IS GOVERNED BY A SEPARATE LICENSE */
  112. /* AGREEMENT BETWEEN THE OEM AND M-SYSTEMS. REFER TO THAT AGREEMENT */
  113. /* FOR THE SPECIFIC TERMS AND CONDITIONS OF USE, */
  114. /* OR CONTACT M-SYSTEMS FOR LICENSE ASSISTANCE: */
  115. /* E-MAIL = [email protected] */
  116. /***********************************************************************************/
  117. #ifndef BLOCKDEV_H
  118. #define BLOCKDEV_H
  119. #include "flreq.h"
  120. #include "flfuncno.h"
  121. #include "docsys.h"
  122. #ifdef FORMAT_VOLUME
  123. #include "dosformt.h"
  124. #endif /* FORMAT_VOLUME */
  125. #ifdef WRITE_EXB_IMAGE
  126. #include "doc2exb.h"
  127. #else
  128. #ifdef BDK_ACCESS
  129. #include "docbdk.h"
  130. #endif /* BDK_ACCESS */
  131. #endif /* WRITE_EXB_IMAGE */
  132. /*----------------------------------------------------------------------*/
  133. /* b d C a l l */
  134. /* */
  135. /* Common entry-point to all TrueFFS functions. Macros are to call */
  136. /* individual function, which are separately described below. */
  137. /* */
  138. /* Parameters: */
  139. /* function : Block device driver function code (listed below) */
  140. /* ioreq : IOreq structure */
  141. /* */
  142. /* Returns: */
  143. /* FLStatus : 0 on success, otherwise failed */
  144. /*----------------------------------------------------------------------*/
  145. #if FILES > 0
  146. #ifndef FL_READ_ONLY
  147. /*----------------------------------------------------------------------*/
  148. /* f l F l u s h B u f f e r */
  149. /* */
  150. /* If there is relevant data in the RAM buffer then writes it on */
  151. /* the flash memory. */
  152. /* */
  153. /* Parameters: */
  154. /* irHandle : Drive number (0, 1, ...) */
  155. /* bits 7-4 - Partition # (zero based) */
  156. /* bits 3-0 - Socket # (zero based) */
  157. /* */
  158. /* Returns: */
  159. /* FLStatus : 0 on success, otherwise failed */
  160. /*----------------------------------------------------------------------*/
  161. #define flFlushBuffer(ioreq) bdCall(FL_FLUSH_BUFFER,ioreq)
  162. #endif /* READ_ONLY */
  163. /*----------------------------------------------------------------------*/
  164. /* f l O p e n F i l e */
  165. /* */
  166. /* Opens an existing file or creates a new file. Creates a file handle */
  167. /* for further file processing. */
  168. /* */
  169. /* Parameters: */
  170. /* irHandle : Drive number (0, 1, ...) */
  171. /* bits 7-4 - Partition # (zero based) */
  172. /* bits 3-0 - Socket # (zero based) */
  173. /* irFlags : Access and action options, defined below */
  174. /* irPath : path of file to open */
  175. /* */
  176. /* Returns: */
  177. /* FLStatus : 0 on success, otherwise failed */
  178. /* irHandle : New file handle for open file */
  179. /* */
  180. /*----------------------------------------------------------------------*/
  181. /** Values of irFlags for flOpenFile: */
  182. #define ACCESS_MODE_MASK 3 /* Mask for access mode bits */
  183. /* Individual flags */
  184. #define ACCESS_READ_WRITE 1 /* Allow read and write */
  185. #define ACCESS_CREATE 2 /* Create new file */
  186. /* Access mode combinations */
  187. #define OPEN_FOR_READ 0 /* open existing file for read-only */
  188. #define OPEN_FOR_UPDATE 1 /* open existing file for read/write access */
  189. #define OPEN_FOR_WRITE 3 /* create a new file, even if it exists */
  190. #define flOpenFile(ioreq) bdCall(FL_OPEN_FILE,ioreq)
  191. /*----------------------------------------------------------------------*/
  192. /* f l C l o s e F i l e */
  193. /* */
  194. /* Closes an open file, records file size and dates in directory and */
  195. /* releases file handle. */
  196. /* */
  197. /* Parameters: */
  198. /* irHandle : Handle of file to close. */
  199. /* */
  200. /* Returns: */
  201. /* FLStatus : 0 on success, otherwise failed */
  202. /*----------------------------------------------------------------------*/
  203. #define flCloseFile(ioreq) bdCall(FL_CLOSE_FILE,ioreq)
  204. #ifndef FL_READ_ONLY
  205. #ifdef SPLIT_JOIN_FILE
  206. /*------------------------------------------------------------------------*/
  207. /* f l S p l i t F i l e */
  208. /* */
  209. /* Splits the file into two files. The original file contains the first */
  210. /* part, and a new file (which is created for that purpose) contains */
  211. /* the second part. If the current position is on a cluster */
  212. /* boundary, the file will be split at the current position. Otherwise, */
  213. /* the cluster of the current position is duplicated, one copy is the */
  214. /* first cluster of the new file, and the other is the last cluster of the*/
  215. /* original file, which now ends at the current position. */
  216. /* */
  217. /* Parameters: */
  218. /* file : file to split. */
  219. /* irPath : Path name of the new file. */
  220. /* */
  221. /* Returns: */
  222. /* irHandle : handle of the new file. */
  223. /* FLStatus : 0 on success, otherwise failed. */
  224. /* */
  225. /*------------------------------------------------------------------------*/
  226. #define flSplitFile(ioreq) bdCall(FL_SPLIT_FILE,ioreq)
  227. /*------------------------------------------------------------------------*/
  228. /* f l J o i n F i l e */
  229. /* */
  230. /* joins two files. If the end of the first file is on a cluster */
  231. /* boundary, the files will be joined there. Otherwise, the data in */
  232. /* the second file from the beginning until the offset that is equal to */
  233. /* the offset in cluster of the end of the first file will be lost. The */
  234. /* rest of the second file will be joined to the first file at the end of */
  235. /* the first file. On exit, the first file is the expanded file and the */
  236. /* second file is deleted. */
  237. /* Note: The second file will be open by this function, it is advised to */
  238. /* close it before calling this function in order to avoid */
  239. /* inconsistencies. */
  240. /* */
  241. /* Parameters: */
  242. /* file : file to join to. */
  243. /* irPath : Path name of the file to be joined. */
  244. /* */
  245. /* Return: */
  246. /* FLStatus : 0 on success, otherwise failed. */
  247. /* */
  248. /*------------------------------------------------------------------------*/
  249. #define flJoinFile(ioreq) bdCall(FL_JOIN_FILE,ioreq)
  250. #endif /* SPLIT_JOIN_FILE */
  251. #endif /* FL_READ_ONLY */
  252. /*----------------------------------------------------------------------*/
  253. /* f l R e a d F i l e */
  254. /* */
  255. /* Reads from the current position in the file to the user-buffer. */
  256. /* Parameters: */
  257. /* irHandle : Handle of file to read. */
  258. /* irData : Address of user buffer */
  259. /* irLength : Number of bytes to read. If the read extends */
  260. /* beyond the end-of-file, the read is truncated */
  261. /* at the end-of-file. */
  262. /* */
  263. /* Returns: */
  264. /* FLStatus : 0 on success, otherwise failed */
  265. /* irLength : Actual number of bytes read */
  266. /*----------------------------------------------------------------------*/
  267. #define flReadFile(ioreq) bdCall(FL_READ_FILE,ioreq)
  268. #ifndef FL_READ_ONLY
  269. /*----------------------------------------------------------------------*/
  270. /* f l W r i t e F i l e */
  271. /* */
  272. /* Writes from the current position in the file from the user-buffer. */
  273. /* */
  274. /* Parameters: */
  275. /* irHandle : Handle of file to write. */
  276. /* irData : Address of user buffer */
  277. /* irLength : Number of bytes to write. */
  278. /* */
  279. /* Returns: */
  280. /* FLStatus : 0 on success, otherwise failed */
  281. /* irLength : Actual number of bytes written */
  282. /*----------------------------------------------------------------------*/
  283. #define flWriteFile(ioreq) bdCall(FL_WRITE_FILE,ioreq)
  284. #endif /* FL_READ_ONLY */
  285. /*----------------------------------------------------------------------*/
  286. /* f l S e e k F i l e */
  287. /* */
  288. /* Sets the current position in the file, relative to file start, end or*/
  289. /* current position. */
  290. /* Note: This function will not move the file pointer beyond the */
  291. /* beginning or end of file, so the actual file position may be */
  292. /* different from the required. The actual position is indicated on */
  293. /* return. */
  294. /* */
  295. /* Parameters: */
  296. /* irHandle : File handle to close. */
  297. /* irLength : Offset to set position. */
  298. /* irFlags : Method code */
  299. /* SEEK_START: absolute offset from start of file */
  300. /* SEEK_CURR: signed offset from current position */
  301. /* SEEK_END: signed offset from end of file */
  302. /* */
  303. /* Returns: */
  304. /* FLStatus : 0 on success, otherwise failed */
  305. /* irLength : Actual absolute offset from start of file */
  306. /*----------------------------------------------------------------------*/
  307. /* Values of irFlags for flSeekFile: */
  308. #define SEEK_START 0 /* offset from start of file */
  309. #define SEEK_CURR 1 /* offset from current position */
  310. #define SEEK_END 2 /* offset from end of file */
  311. #define flSeekFile(ioreq) bdCall(FL_SEEK_FILE,ioreq)
  312. /*----------------------------------------------------------------------*/
  313. /* f l F i n d F i l e */
  314. /* */
  315. /* Finds a file entry in a directory, optionally modifying the file */
  316. /* time/date and/or attributes. */
  317. /* Files may be found by handle no. provided they are open, or by name. */
  318. /* Only the Hidden, System or Read-only attributes may be modified. */
  319. /* Entries may be found for any existing file or directory other than */
  320. /* the root. A DirectoryEntry structure describing the file is copied */
  321. /* to a user buffer. */
  322. /* */
  323. /* The DirectoryEntry structure is defined in dosformt.h */
  324. /* */
  325. /* Parameters: */
  326. /* irHandle : If by name: Drive number (socket+partitions) */
  327. /* else : Handle of open file */
  328. /* irPath : If by name: Specifies a file or directory path */
  329. /* irFlags : Options flags */
  330. /* FIND_BY_HANDLE: Find open file by handle. */
  331. /* Default is access by path. */
  332. /* SET_DATETIME: Update time/date from buffer */
  333. /* SET_ATTRIBUTES: Update attributes from buffer */
  334. /* irDirEntry : Address of user buffer to receive a */
  335. /* DirectoryEntry structure */
  336. /* */
  337. /* Returns: */
  338. /* irLength : Modified */
  339. /* FLStatus : 0 on success, otherwise failed */
  340. /*----------------------------------------------------------------------*/
  341. /** Bit assignment of irFlags for flFindFile: */
  342. #define SET_DATETIME 1 /* Change date/time */
  343. #define SET_ATTRIBUTES 2 /* Change attributes */
  344. #define FIND_BY_HANDLE 4 /* Find file by handle rather than by name */
  345. #define flFindFile(ioreq) bdCall(FL_FIND_FILE,ioreq)
  346. /*----------------------------------------------------------------------*/
  347. /* f l F i n d F i r s t F i l e */
  348. /* */
  349. /* Finds the first file entry in a directory. */
  350. /* This function is used in combination with the flFindNextFile call, */
  351. /* which returns the remaining file entries in a directory sequentially.*/
  352. /* Entries are returned according to the unsorted directory order. */
  353. /* flFindFirstFile creates a file handle, which is returned by it. Calls*/
  354. /* to flFindNextFile will provide this file handle. When flFindNextFile */
  355. /* returns 'noMoreEntries', the file handle is automatically closed. */
  356. /* Alternatively the file handle can be closed by a 'closeFile' call */
  357. /* before actually reaching the end of directory. */
  358. /* A DirectoryEntry structure is copied to the user buffer describing */
  359. /* each file found. This structure is defined in dosformt.h. */
  360. /* */
  361. /* Parameters: */
  362. /* irHandle : Drive number (0, 1, ...) */
  363. /* bits 7-4 - Partition # (zero based) */
  364. /* bits 3-0 - Socket # (zero based) */
  365. /* irPath : Specifies a directory path */
  366. /* irData : Address of user buffer to receive a */
  367. /* DirectoryEntry structure */
  368. /* */
  369. /* Returns: */
  370. /* irHandle : File handle to use for subsequent operations */
  371. /* FLStatus : 0 on success, otherwise failed */
  372. /*----------------------------------------------------------------------*/
  373. #define flFindFirstFile(ioreq) bdCall(FL_FIND_FIRST_FILE,ioreq)
  374. /*----------------------------------------------------------------------*/
  375. /* f l F i n d N e x t F i l e */
  376. /* */
  377. /* See the description of 'flFindFirstFile'. */
  378. /* */
  379. /* Parameters: */
  380. /* irHandle : File handle returned by flFindFirstFile. */
  381. /* irData : Address of user buffer to receive a */
  382. /* DirectoryEntry structure */
  383. /* */
  384. /* Returns: */
  385. /* FLStatus : 0 on success, otherwise failed */
  386. /*----------------------------------------------------------------------*/
  387. #define flFindNextFile(ioreq) bdCall(FL_FIND_NEXT_FILE,ioreq)
  388. /*----------------------------------------------------------------------*/
  389. /* f l G e t D i s k I n f o */
  390. /* */
  391. /* Returns general allocation information. */
  392. /* */
  393. /* The bytes/sector, sector/cluster, total cluster and free cluster */
  394. /* information are returned into a DiskInfo structure. */
  395. /* */
  396. /* Parameters: */
  397. /* irHandle : Drive number (0, 1, ...) */
  398. /* bits 7-4 - Partition # (zero based) */
  399. /* bits 3-0 - Socket # (zero based) */
  400. /* irData : Address of DiskInfo structure */
  401. /* */
  402. /* Returns: */
  403. /* FLStatus : 0 on success, otherwise failed */
  404. /*----------------------------------------------------------------------*/
  405. typedef struct {
  406. unsigned bytesPerSector;
  407. unsigned sectorsPerCluster;
  408. unsigned totalClusters;
  409. unsigned freeClusters;
  410. } DiskInfo;
  411. #define flGetDiskInfo(ioreq) bdCall(FL_GET_DISK_INFO,ioreq)
  412. #ifndef FL_READ_ONLY
  413. /*----------------------------------------------------------------------*/
  414. /* f l D e l e t e F i l e */
  415. /* */
  416. /* Deletes a file. */
  417. /* */
  418. /* Parameters: */
  419. /* irHandle : Drive number (0, 1, ...) */
  420. /* bits 7-4 - Partition # (zero based) */
  421. /* bits 3-0 - Socket # (zero based) */
  422. /* irPath : path of file to delete */
  423. /* */
  424. /* Returns: */
  425. /* FLStatus : 0 on success, otherwise failed */
  426. /*----------------------------------------------------------------------*/
  427. #define flDeleteFile(ioreq) bdCall(FL_DELETE_FILE,ioreq)
  428. #ifdef RENAME_FILE
  429. /*----------------------------------------------------------------------*/
  430. /* f l R e n a m e F i l e */
  431. /* */
  432. /* Renames a file to another name. */
  433. /* */
  434. /* Parameters: */
  435. /* irHandle : Drive number (0, 1, ...) */
  436. /* bits 7-4 - Partition # (zero based) */
  437. /* bits 3-0 - Socket # (zero based) */
  438. /* irPath : path of existing file */
  439. /* irData : path of new name. */
  440. /* */
  441. /* Returns: */
  442. /* FLStatus : 0 on success, otherwise failed */
  443. /*----------------------------------------------------------------------*/
  444. #define flRenameFile(ioreq) bdCall(FL_RENAME_FILE,ioreq)
  445. #endif /* RENAME_FILE */
  446. #ifdef SUB_DIRECTORY
  447. /*----------------------------------------------------------------------*/
  448. /* f l M a k e D i r */
  449. /* */
  450. /* Creates a new directory. */
  451. /* */
  452. /* Parameters: */
  453. /* irHandle : Drive number (0, 1, ...) */
  454. /* bits 7-4 - Partition # (zero based) */
  455. /* bits 3-0 - Socket # (zero based) */
  456. /* irPath : path of new directory. */
  457. /* */
  458. /* Returns: */
  459. /* FLStatus : 0 on success, otherwise failed */
  460. /*----------------------------------------------------------------------*/
  461. #define flMakeDir(ioreq) bdCall(FL_MAKE_DIR,ioreq)
  462. /*----------------------------------------------------------------------*/
  463. /* f l R e m o v e D i r */
  464. /* */
  465. /* Removes an empty directory. */
  466. /* */
  467. /* Parameters: */
  468. /* irHandle : Drive number (0, 1, ...) */
  469. /* bits 7-4 - Partition # (zero based) */
  470. /* bits 3-0 - Socket # (zero based) */
  471. /* irPath : path of directory to remove. */
  472. /* */
  473. /* Returns: */
  474. /* FLStatus : 0 on success, otherwise failed */
  475. /*----------------------------------------------------------------------*/
  476. #define flRemoveDir(ioreq) bdCall(FL_REMOVE_DIR,ioreq)
  477. #endif /* SUB_DIRECTORY */
  478. #endif /* FL_READ_ONLY */
  479. #endif /* FILES > 0 */
  480. /*----------------------------------------------------------------------*/
  481. /* V o l u m e I n f o R e c o r d */
  482. /* */
  483. /* A structure that holds general information about the media. The */
  484. /* information includes Physical Info (see flGetPhysicalInfo), Logical */
  485. /* partition (number of sectors and CHS), boot area size, S/W versions */
  486. /* Media life-time etc. */
  487. /* A pointer to this structure is passed to the function flVolumeInfo */
  488. /* where it receives the relevant data. */
  489. /*----------------------------------------------------------------------*/
  490. typedef struct {
  491. unsigned long logicalSectors; /* number of logical sectors */
  492. unsigned long bootAreaSize; /* boot area size */
  493. unsigned long baseAddress; /* physical base address */
  494. #ifdef FL_LOW_LEVEL
  495. unsigned short flashType; /* JEDEC id of the flash */
  496. unsigned long physicalSize; /* physical size of the media */
  497. unsigned short physicalUnitSize; /* Erasable block size */
  498. char DOCType; /* DiskOnChip type (MDoc/Doc2000) */
  499. char lifeTime; /* Life time indicator for the media (1-10) */
  500. /* 1 - the media is fresh, */
  501. /* 10 - the media is close to its end of life */
  502. #endif
  503. char driverVer[10]; /* driver version (NULL terminated string) */
  504. char OSAKVer[10]; /* OSAK version that driver is based on
  505. (NULL terminated string) */
  506. #ifdef ABS_READ_WRITE
  507. unsigned long cylinders; /* Media..... */
  508. unsigned long heads; /* geometry...... */
  509. unsigned long sectors; /* parameters. */
  510. #endif
  511. } VolumeInfoRecord;
  512. /*----------------------------------------------------------------------*/
  513. /* f l V o l u m e I n f o */
  514. /* */
  515. /* Get general information about the media. */
  516. /* */
  517. /* Parameters: */
  518. /* irHandle : Socket number (0,1,..) */
  519. /* bits 7-4 - Partition # (zero based) */
  520. /* bits 3-0 - Socket # (zero based) */
  521. /* irData : Address of user buffer to read general */
  522. /* information into. */
  523. /* */
  524. /* Returns: */
  525. /* FLStatus : 0 on success, otherwise failed */
  526. /*----------------------------------------------------------------------*/
  527. #define flVolumeInfo(ioreq) bdCall(FL_VOLUME_INFO,ioreq)
  528. /*----------------------------------------------------------------------*/
  529. /* f l C o u n t V o l u m e s */
  530. /* */
  531. /* Counts the number of volumes on the Flash device. */
  532. /* */
  533. /* This routine is applicable only for TL that can accomdate more then */
  534. /* a single volume on a flash medium. other TL's will simply return 1 */
  535. /* while not even tring to access the medium. */
  536. /* */
  537. /* Not all the volumes can neccesaryly be mounted. A drive formated */
  538. /* with a read protection will be registered but can not be accessed. */
  539. /* */
  540. /* Parameters: */
  541. /* irHandle : Socket number ( 0,1,2... ) */
  542. /* : Partition number ( 0,1,2... ) */
  543. /* irFlags : Returns the number of partitions */
  544. /* */
  545. /* Returns: */
  546. /* FLStatus : 0 on success, otherwise failed */
  547. /*----------------------------------------------------------------------*/
  548. #define flCountVolumes(ioreq) bdCall(FL_COUNT_VOLUMES,ioreq)
  549. /*----------------------------------------------------------------------*/
  550. /* f l C l e a r Q u i c k M o u n t I n f o */
  551. /* */
  552. /* Clear all quick mount informtion. */
  553. /* */
  554. /* Must be called before calling mount volume routines. */
  555. /* */
  556. /* Parameters: */
  557. /* irHandle : Socket number ( 0,1,2... ) */
  558. /* : Partition number ( 0,1,2... ) */
  559. /* Returns: */
  560. /* FLStatus : 0 on success, otherwise failed */
  561. /*----------------------------------------------------------------------*/
  562. #define flClearQuickMountInfo(ioreq) bdCall(FL_CLEAR_QUICK_MOUNT_INFO,ioreq)
  563. /*----------------------------------------------------------------------*/
  564. /* f l M o u n t V o l u m e */
  565. /* */
  566. /* Mounts, verifies or dismounts the Flash medium. */
  567. /* */
  568. /* In case the inserted volume has changed, or on the first access to */
  569. /* the file system, it should be mounted before file operations can be */
  570. /* done on it. */
  571. /* */
  572. /* The volume automatically becomes unmounted if it is removed or */
  573. /* changed. */
  574. /* */
  575. /* Parameters: */
  576. /* irHandle : Socket number (0, 1, ...) */
  577. /* bits 7-4 - Partition # (zero based) */
  578. /* bits 3-0 - Socket # (zero based) */
  579. /* irFlags : Number of hidden sectors. */
  580. /* */
  581. /* Returns: */
  582. /* FLStatus : 0 on success, otherwise failed */
  583. /*----------------------------------------------------------------------*/
  584. #define flMountVolume(ioreq) bdCall(FL_MOUNT_VOLUME,ioreq)
  585. /*----------------------------------------------------------------------*/
  586. /* f l A b s M o u n t V o l u m e */
  587. /* */
  588. /* Mounts, verifies or dismounts the Flash medium. */
  589. /* */
  590. /* The volume automatically becomes unmounted if it is removed or */
  591. /* changed. */
  592. /* */
  593. /* Parameters: */
  594. /* irHandle : Socket number (0, 1, ...) */
  595. /* bits 7-4 - Partition # (zero based) */
  596. /* bits 3-0 - Socket # (zero based) */
  597. /* */
  598. /* Returns: */
  599. /* FLStatus : 0 on success, otherwise failed */
  600. /*----------------------------------------------------------------------*/
  601. #define flAbsMountVolume(ioreq) bdCall(FL_ABS_MOUNT,ioreq)
  602. /*----------------------------------------------------------------------*/
  603. /* f l V e r i f y V o l u m e */
  604. /* */
  605. /* Verifies a mounted volume for partialy written sectors. */
  606. /* */
  607. /* Note: The volume must be mounted first. */
  608. /* */
  609. /* Parameters: */
  610. /* irHandle : Socket number (0, 1, ...) */
  611. /* bits 7-4 - Partition # (zero based) */
  612. /* bits 3-0 - Socket # (zero based) */
  613. /* irData : Must be set to NULL */
  614. /* irLength : Must be set to 0 */
  615. /* */
  616. /* Returns: */
  617. /* FLStatus : 0 on success, otherwise failed */
  618. /*----------------------------------------------------------------------*/
  619. #define flVerifyVolume(ioreq) bdCall(FL_VERIFY_VOLUME,ioreq)
  620. /*----------------------------------------------------------------------*/
  621. /* f l D i s m o u n t V o l u m e */
  622. /* */
  623. /* Dismounts the volume. */
  624. /* This call is not normally necessary, unless it is known the volume */
  625. /* will soon be removed. */
  626. /* */
  627. /* Parameters: */
  628. /* irHandle : Drive number (0, 1, ...) */
  629. /* bits 7-4 - Partition # (zero based) */
  630. /* bits 3-0 - Socket # (zero based) */
  631. /* */
  632. /* Returns: */
  633. /* FLStatus : 0 on success, otherwise failed */
  634. /*----------------------------------------------------------------------*/
  635. #define flDismountVolume(ioreq) bdCall(FL_DISMOUNT_VOLUME,ioreq)
  636. /*----------------------------------------------------------------------*/
  637. /* f l C h e c k V o l u m e */
  638. /* */
  639. /* Verifies that the current volume is mounted. */
  640. /* */
  641. /* Parameters: */
  642. /* irHandle : Drive number (0, 1, ...) */
  643. /* bits 7-4 - Partition # (zero based) */
  644. /* bits 3-0 - Socket # (zero based) */
  645. /* */
  646. /* Returns: */
  647. /* FLStatus : 0 on success, otherwise failed */
  648. /*----------------------------------------------------------------------*/
  649. #define flCheckVolume(ioreq) bdCall(FL_CHECK_VOLUME,ioreq)
  650. /*----------------------------------------------------------------------*/
  651. /* r e a d B B T */
  652. /* */
  653. /* Read Bad Blocks Table of device to user buffer */
  654. /* */
  655. /* Note: The user buffer is filled with the address of the bad units */
  656. /* the buffer maximum size is 2% of the number of TL units of the */
  657. /* specific device * 4 bytes. therfore a 8M device of 8KB erase */
  658. /* zone will need a maximum size buffer of 1024 * 0.02 * 4 = 82B */
  659. /* and a 192M with 16KB erase zones will need 960Bytes */
  660. /* */
  661. /* Note: the buffer is not initialized by the function */
  662. /* */
  663. /* Parameters: */
  664. /* irData : User buffer. */
  665. /* */
  666. /* Returns: */
  667. /* FLStatus : 0 on success, otherwise failed */
  668. /* irLength : returns the media size */
  669. /* irFlags : returns the actual number of badBlocks */
  670. /*----------------------------------------------------------------------*/
  671. #define flReadBBT(ioreq) bdCall(FL_READ_BBT,ioreq)
  672. /*----------------------------------------------------------------------*/
  673. /* f l S e c t o r s I n V o l u m e */
  674. /* */
  675. /* Returns number of virtual sectors in volume. */
  676. /* */
  677. /* In case the inserted volume is not mounted, returns current status. */
  678. /* */
  679. /* Parameters: */
  680. /* irHandle : Drive number (0, 1, ...) */
  681. /* bits 7-4 - Partition # (zero based) */
  682. /* bits 3-0 - Socket # (zero based) */
  683. /* */
  684. /* Returns: */
  685. /* FLStatus : 0 on success, otherwise failed */
  686. /* irLength : number of virtual sectors in volume */
  687. /*----------------------------------------------------------------------*/
  688. #define flSectorsInVolume(ioreq) bdCall(FL_SECTORS_IN_VOLUME,ioreq)
  689. #ifndef FL_READ_ONLY
  690. #ifdef DEFRAGMENT_VOLUME
  691. /*----------------------------------------------------------------------*/
  692. /* f l D e f r a g m e n t V o l u m e */
  693. /* */
  694. /* Performs a general defragmentation and recycling of non-writable */
  695. /* Flash areas, to achieve optimal write speed. */
  696. /* */
  697. /* NOTE: The required number of sectors (in irLength) may be changed */
  698. /* (from another execution thread) while defragmentation is active. In */
  699. /* particular, the defragmentation may be cut short after it began by */
  700. /* modifying the irLength field to 0. */
  701. /* */
  702. /* Parameters: */
  703. /* irHandle : Drive number (0, 1, ...) */
  704. /* bits 7-4 - Partition # (zero based) */
  705. /* bits 3-0 - Socket # (zero based) */
  706. /* irLength : Minimum number of sectors to make available for */
  707. /* writes. */
  708. /* */
  709. /* Returns: */
  710. /* irLength : Actual number of sectors available for writes */
  711. /* FLStatus : 0 on success, otherwise failed */
  712. /*----------------------------------------------------------------------*/
  713. #define flDefragmentVolume(ioreq) bdCall(FL_DEFRAGMENT_VOLUME,ioreq)
  714. #endif /* DEFRAGMENT_VOLUME */
  715. #ifdef FORMAT_VOLUME
  716. /*----------------------------------------------------------------------*/
  717. /* f l F o r m a t V o l u m e */
  718. /* */
  719. /* Performs formatting of the DiskOnChip. */
  720. /* All existing data is destroyed. */
  721. /* */
  722. /* Note : This routine does not support some of the new feature */
  723. /* introduces in OSAK 5.0 and was left in order to support */
  724. /* backwards compatibility with application build on OSAK 4.2 */
  725. /* and down. */
  726. /* */
  727. /* Parameters: */
  728. /* irHandle : Socket number (0, 1, ...) */
  729. /* : Partition number must be 0 */
  730. /* irFlags : TL_FORMAT : Translation layer formatting */
  731. /* + FAT formating */
  732. /* TL_FORMAT_IF_NEEDED: Translation layer formatting */
  733. /* only if current format is */
  734. /* invalid + FAT format */
  735. /* : FAT_ONLY_FORMAT : FAT only formatting */
  736. /* : TL_FORMAT_ONLY : Translation layer formatting */
  737. /* without FAT format */
  738. /* irData : Address of FormatParams structure to use */
  739. /* (defined in format.h) */
  740. /* */
  741. /* Returns: */
  742. /* FLStatus : 0 on success, otherwise failed */
  743. /*----------------------------------------------------------------------*/
  744. #define flFormatVolume(ioreq) bdCall(BD_FORMAT_VOLUME,ioreq)
  745. /** Values of irFlags for flLowLevelFormat: */
  746. #define FAT_ONLY_FORMAT 0
  747. #define TL_FORMAT 1
  748. #define TL_FORMAT_IF_NEEDED 2
  749. #define TL_FORMAT_ONLY 8
  750. /*----------------------------------------------------------------------*/
  751. /* f l F o r m a t P h i s i c a l D r i v e */
  752. /* */
  753. /* Performs formatting of the DiskOnChip. */
  754. /* All existing data is destroyed. */
  755. /* */
  756. /* Note : This routine is the format routine for OSAK 5.0 and up. */
  757. /* Note : This routine is the format routine for OSAK 5.0 */
  758. /* */
  759. /* Parameters: */
  760. /* irHandle : Socket number (0, 1, ...) */
  761. /* Partition number must be 0 */
  762. /* irFlags : */
  763. /* TL_NORMAL_FORMAT : Normal format */
  764. /* TL_LEAVE_BINARY_AREA : Leave the previous binary area */
  765. /* irData : Address of FormatParams2 structure to use */
  766. /* (defined in format.h) */
  767. /* Returns: */
  768. /* FLStatus : 0 on success, otherwise failed */
  769. /*----------------------------------------------------------------------*/
  770. #define flFormatPhysicalDrive(ioreq) bdCall(BD_FORMAT_PHYSICAL_DRIVE,ioreq)
  771. #define TL_NORMAL_FORMAT 0
  772. #define TL_LEAVE_BINARY_AREA 8
  773. /*----------------------------------------------------------------------*/
  774. /* f l F o r m a t L o g i c a l D r i v e */
  775. /* */
  776. /* Performs formatting of a single block device partition of a */
  777. /* DiskOnChip. All existing data of the partition is destroyed. */
  778. /* */
  779. /* Parameters: */
  780. /* irHandle : Drive number (0, 1, ...) */
  781. /* bits 7-4 - Partition # (zero based) */
  782. /* bits 3-0 - Socket # (zero based) */
  783. /* irData : Address of BDTLPartitionFormatParams structure */
  784. /* to use (defined in format.h) */
  785. /* */
  786. /* Returns: */
  787. /* FLStatus : 0 on success, otherwise failed */
  788. /*----------------------------------------------------------------------*/
  789. #define flFormatLogicalDrive(ioreq) bdCall(BD_FORMAT_LOGICAL_DRIVE,ioreq)
  790. /*----------------------------------------------------------------------*/
  791. /* w r i t e B B T */
  792. /* */
  793. /* Erase the flash medium while marking bad block with 2 zeros in the */
  794. /* first page of the unit. This state is the virgin state of the flash */
  795. /* device allowing it to be reformated while incorporating the written */
  796. /* bad blocks. */
  797. /* */
  798. /* Note that tl units are marked and not actual erasable blocks */
  799. /* */
  800. /* Parameters: */
  801. /* irData : User buffer. */
  802. /* irLength : Size of the media to erase. */
  803. /* irFlags : User buffer length in bytes. */
  804. /* */
  805. /* Returns: */
  806. /* FLStatus : 0 on success, otherwise failed */
  807. /*----------------------------------------------------------------------*/
  808. #define flWriteBBT(ioreq) bdCall(FL_WRITE_BBT,ioreq)
  809. #endif /* FORMAT_VOLUME */
  810. #endif /*FL_READ_ONLY */
  811. #ifdef ABS_READ_WRITE
  812. /*----------------------------------------------------------------------*/
  813. /* f l A b s R e a d */
  814. /* */
  815. /* Reads absolute sectors by sector no. */
  816. /* */
  817. /* Parameters: */
  818. /* irHandle : Drive number (0, 1, ...) */
  819. /* bits 7-4 - Partition # (zero based) */
  820. /* bits 3-0 - Socket # (zero based) */
  821. /* irData : Address of user buffer to read into */
  822. /* irSectorNo : First sector no. to read (sector 0 is the */
  823. /* DOS boot sector). */
  824. /* irSectorCount : Number of consectutive sectors to read */
  825. /* */
  826. /* Returns: */
  827. /* FLStatus : 0 on success, otherwise failed */
  828. /* irSectorCount : Number of sectors actually read */
  829. /*----------------------------------------------------------------------*/
  830. #define flAbsRead(ioreq) bdCall(FL_ABS_READ,ioreq)
  831. /*----------------------------------------------------------------------*/
  832. /* f l A b s A d d r e s s */
  833. /* */
  834. /* Returns the current physical media offset of an absolute sector by */
  835. /* sector no. */
  836. /* */
  837. /* Parameters: */
  838. /* irHandle : Drive number (0, 1, ...) */
  839. /* bits 7-4 - Partition # (zero based) */
  840. /* bits 3-0 - Socket # (zero based) */
  841. /* irSectorNo : Sector no. to address (sector 0 is the DOS */
  842. /* boot sector) */
  843. /* */
  844. /* Returns: */
  845. /* FLStatus : 0 on success, otherwise failed */
  846. /* irCount : Offset of the sector on the physical media */
  847. /*----------------------------------------------------------------------*/
  848. #define flAbsAddress(ioreq) bdCall(FL_ABS_ADDRESS,ioreq)
  849. /*----------------------------------------------------------------------*/
  850. /* f l G e t B P B */
  851. /* */
  852. /* Reads the BIOS Parameter Block from the boot sector */
  853. /* */
  854. /* Parameters: */
  855. /* irHandle : Drive number (0, 1, ...) */
  856. /* bits 7-4 - Partition # (zero based) */
  857. /* bits 3-0 - Socket # (zero based) */
  858. /* irData : Address of user buffer to read BPB into */
  859. /* */
  860. /* Returns: */
  861. /* FLStatus : 0 on success, otherwise failed */
  862. /*----------------------------------------------------------------------*/
  863. #define flGetBPB(ioreq) bdCall(FL_GET_BPB,ioreq)
  864. #ifndef FL_READ_ONLY
  865. /*----------------------------------------------------------------------*/
  866. /* f l A b s W r i t e */
  867. /* */
  868. /* Writes absolute sectors by sector no. */
  869. /* */
  870. /* Parameters: */
  871. /* irHandle : Drive number (0, 1, ...) */
  872. /* bits 7-4 - Partition # (zero based) */
  873. /* bits 3-0 - Socket # (zero based) */
  874. /* irData : Address of user buffer to write from */
  875. /* irSectorNo : First sector no. to write (sector 0 is the */
  876. /* DOS boot sector). */
  877. /* irSectorCount : Number of consectutive sectors to write */
  878. /* */
  879. /* Returns: */
  880. /* FLStatus : 0 on success, otherwise failed */
  881. /* irSectorCount : Number of sectors actually written */
  882. /*----------------------------------------------------------------------*/
  883. #define flAbsWrite(ioreq) bdCall(FL_ABS_WRITE,ioreq)
  884. /*----------------------------------------------------------------------*/
  885. /* f l A b s D e l e t e */
  886. /* */
  887. /* Marks absolute sectors by sector no. as deleted. */
  888. /* */
  889. /* Parameters: */
  890. /* irHandle : Drive number (0, 1, ...) */
  891. /* bits 7-4 - Partition # (zero based) */
  892. /* bits 3-0 - Socket # (zero based) */
  893. /* irSectorNo : First sector no. to delete (sector 0 is the */
  894. /* DOS boot sector). */
  895. /* irSectorCount : Number of consectutive sectors to delete */
  896. /* */
  897. /* Returns: */
  898. /* FLStatus : 0 on success, otherwise failed */
  899. /* irSectorCount : Number of sectors actually deleted */
  900. /*----------------------------------------------------------------------*/
  901. #define flAbsDelete(ioreq) bdCall(FL_ABS_DELETE,ioreq)
  902. #ifdef WRITE_PROTECTION
  903. /*----------------------------------------------------------------------*/
  904. /* f l W r i t e P r o t e c t i o n */
  905. /* */
  906. /* Put and remove write protection from the volume */
  907. /* */
  908. /* Note partition number 0 protectes the binary partition as well */
  909. /* */
  910. /* Parameters: */
  911. /* irHandle : Drive number (0, 1, ...) */
  912. /* bits 7-4 - Partition # (zero based) */
  913. /* bits 3-0 - Socket # (zero based) */
  914. /* irFlags : FL_PROTECT=remove, FL_UNPROTECT=put */
  915. /* and FL_UNLOCK=unlock */
  916. /* irData : password (8 bytes) */
  917. /* */
  918. /* Returns: */
  919. /* FLStatus : 0 on success, otherwise failed */
  920. /*----------------------------------------------------------------------*/
  921. #define flWriteProtection(ioreq) bdCall(FL_WRITE_PROTECTION,ioreq)
  922. #define FL_PROTECT 0
  923. #define FL_UNPROTECT 1
  924. #define FL_UNLOCK 2
  925. #endif /* WRITE_PROTETION */
  926. #endif /* FL_READ_ONLY */
  927. #endif /* ABS_READ_WRITE */
  928. #ifdef FL_LOW_LEVEL
  929. /*----------------------------------------------------------------------*/
  930. /* P h y s i c a l I n f o */
  931. /* */
  932. /* A structure that holds physical information about the media. The */
  933. /* information includes JEDEC ID, unit size and media size. Pointer */
  934. /* to this structure is passed to the function flGetPhysicalInfo where */
  935. /* it receives the relevant data. */
  936. /* */
  937. /*----------------------------------------------------------------------*/
  938. typedef struct {
  939. unsigned short type; /* Flash device type (JEDEC id) */
  940. char mediaType; /* type of media see below */
  941. long int unitSize; /* Smallest physically erasable size
  942. (with interleaving taken in account) */
  943. long int mediaSize; /* media size in bytes */
  944. long int chipSize; /* individual chip size in bytes */
  945. int interleaving; /* device interleaving */
  946. } PhysicalInfo;
  947. /* media types */
  948. #define FL_NOT_DOC 0
  949. #define FL_DOC 1
  950. #define FL_MDOC 2
  951. #define FL_DOC2000TSOP 3
  952. #define FL_MDOCP_16 4
  953. #define FL_MDOCP 5
  954. /*----------------------------------------------------------------------*/
  955. /* f l G e t P h y s i c a l I n f o */
  956. /* */
  957. /* Get physical information of the media. The information includes */
  958. /* JEDEC ID, unit size and media size. */
  959. /* */
  960. /* Parameters: */
  961. /* irHandle : Socket number (0,1,..) */
  962. /* irData : Address of user buffer to read physical */
  963. /* information into. */
  964. /* */
  965. /* Returns: */
  966. /* FLStatus : 0 on success, otherwise failed */
  967. /* irLength : Window base address. note mast be cast to */
  968. /* unsigned. */
  969. /*----------------------------------------------------------------------*/
  970. #define flGetPhysicalInfo(ioreq) bdCall(FL_GET_PHYSICAL_INFO, ioreq)
  971. /*----------------------------------------------------------------------*/
  972. /* f l P h y s i c a l R e a d */
  973. /* */
  974. /* Read from a physical address. */
  975. /* */
  976. /* Parameters: */
  977. /* irHandle : Socket number (0,1,..) */
  978. /* irAddress : Physical address to read from. */
  979. /* irByteCount : Number of bytes to read. */
  980. /* irData : Address of user buffer to read into. */
  981. /* irFlags : Method mode */
  982. /* EDC: Activate ECC/EDC */
  983. /* EXTRA: Read/write spare area */
  984. /* Returns: */
  985. /* FLStatus : 0 on success, otherwise failed */
  986. /*----------------------------------------------------------------------*/
  987. #define flPhysicalRead(ioreq) bdCall(FL_PHYSICAL_READ,ioreq)
  988. #ifndef FL_READ_ONLY
  989. /*----------------------------------------------------------------------*/
  990. /* f l P h y s i c a l W r i t e */
  991. /* */
  992. /* Write to a physical address. */
  993. /* */
  994. /* Parameters: */
  995. /* irHandle : Socket number (0,1,..) */
  996. /* irAddress : Physical address to write to. */
  997. /* irByteCount : Number of bytes to write. */
  998. /* irData : Address of user buffer to write from. */
  999. /* irFlags : Method mode */
  1000. /* EDC: Activate ECC/EDC */
  1001. /* EXTRA: Read/write spare area */
  1002. /* Returns: */
  1003. /* FLStatus : 0 on success, otherwise failed */
  1004. /*----------------------------------------------------------------------*/
  1005. #define flPhysicalWrite(ioreq) bdCall(FL_PHYSICAL_WRITE,ioreq)
  1006. /* Bit assignment of irFlags for flPhysicalRead or flPhysicalWrite: */
  1007. /* ( defined in file flflash.h ) */
  1008. /* #define OVERWRITE 1 *//* Overwriting non-erased area */
  1009. /* #define EDC 2 *//* Activate ECC/EDC */
  1010. /* #define EXTRA 4 *//* Read/write spare area */
  1011. /*----------------------------------------------------------------------*/
  1012. /* f l P h y s i c a l E r a s e */
  1013. /* */
  1014. /* Erase physical units. */
  1015. /* */
  1016. /* Parameters: */
  1017. /* irHandle : Socket number (0,1,..) */
  1018. /* irUnitNo : First unit to erase. */
  1019. /* irUnitCount : Number of units to erase. */
  1020. /* */
  1021. /* Returns: */
  1022. /* FLStatus : 0 on success, otherwise failed */
  1023. /*----------------------------------------------------------------------*/
  1024. #define flPhysicalErase(ioreq) bdCall(FL_PHYSICAL_ERASE,ioreq)
  1025. #endif /* FL_READ_ONLY */
  1026. #ifdef BDK_ACCESS
  1027. /*-------------------------------------------------------------------
  1028. * bdkReadInit - Init read operations on the DiskOnChip starting
  1029. * at 'startUnit', with a size of 'areaLen' bytes and 'signature'.
  1030. *
  1031. * Note: Blocks in the DiskOnChip are marked with a 4-character signature
  1032. * followed by a 4-digit hexadecimal number.
  1033. *
  1034. * Parameters:
  1035. * 'irHandle' - Drive number (0, 1, ...)
  1036. * bits 7-4 - Partition # (zero based)
  1037. * bits 3-0 - Socket # (zero based)
  1038. * 'irData' - bdkParams record
  1039. * startingBlock - unit number of the sub-partition to start reading from
  1040. * length - number of bytes to read
  1041. * oldSign - signature of the sub-partition
  1042. * flags - EDC or not
  1043. * signOffset - signature offset 0 or 8
  1044. *
  1045. * Return :
  1046. * flOK - success
  1047. * flDriveNotAvailable - DiskOnChip ASIC was not found
  1048. * flUnknownMedia - failed in Flash chips recognition
  1049. * flBadFormat - TL format does not exists
  1050. * flNoSpaceInVolume - there are 0 units marked with this signature
  1051. * flDataError - MTD read fault.
  1052. * flHWReadProtect - HW read protection was triggerd
  1053. *-------------------------------------------------------------------*/
  1054. #define bdkReadInit(ioreq) bdCall(FL_BINARY_READ_INIT,ioreq)
  1055. /*-------------------------------------------------------------------
  1056. * bdkReadBlock - Read to 'buffer' from the DiskOnChip BDK Image area.
  1057. *
  1058. * Note: Before the first use of this function 'bdkCopyBootAreaInit'
  1059. * must be called
  1060. *
  1061. * Parameters:
  1062. * 'irHandle' - Drive number (0, 1, ...)
  1063. * bits 7-4 - Partition # (zero based)
  1064. * bits 3-0 - Socket # (zero based)
  1065. * 'irData' - bdkParams record
  1066. * length - number of bytes to read
  1067. * bdkBuffer - buffer to read into
  1068. *
  1069. * Return :
  1070. * flOK - success
  1071. * flDriveNotAvailable - DiskOnChip ASIC was not found
  1072. * flUnknownMedia - failed in Flash chips recognition
  1073. * flBadFormat - TL format does not exists
  1074. * flNoSpaceInVolume - there are 0 units marked with this signature
  1075. * flDataError - MTD read fault.
  1076. * flHWReadProtect - HW read protection was triggerd
  1077. *-------------------------------------------------------------------*/
  1078. #define bdkReadBlock(ioreq) bdCall(FL_BINARY_READ_BLOCK,ioreq)
  1079. /*-------------------------------------------------------------------
  1080. * bdkWriteInit - Init update operations on the DiskOnChip starting
  1081. * at 'startUnit', with a size of 'areaLen' bytes and 'signature'.
  1082. *
  1083. * Note: Blocks in the DiskOnChip are marked with a 4-character signature
  1084. * followed by a 4-digit hexadecimal number.
  1085. *
  1086. * Parameters:
  1087. * 'irHandle' - Drive number (0, 1, ...)
  1088. * bits 7-4 - Partition # (zero based)
  1089. * bits 3-0 - Socket # (zero based)
  1090. * 'irData' - bdkParams record
  1091. * startingBlock - unit number of the sub-partition to start writting to
  1092. * length - number of bytes to write
  1093. * oldSign - signature of the sub-partition
  1094. * flags - EDC \ BDK_COMPLETE_IMAGE_UPDATE
  1095. * signOffset - signature offset 0 or 8
  1096. *
  1097. * Return: flOK - success
  1098. * flGeneralFailure - DiskOnChip ASIC was not found
  1099. * flUnknownMedia - fail in Flash chips recognition
  1100. * flNoSpaceInVolume - 'areaLen' is bigger than BootImage length
  1101. *-------------------------------------------------------------------*/
  1102. #define bdkWriteInit(ioreq) bdCall(FL_BINARY_WRITE_INIT,ioreq)
  1103. /*-------------------------------------------------------------------
  1104. * bdkWriteBlock - Write 'buffer' to the DiskOnChip BDK Image area.
  1105. *
  1106. * Note: Before the first use of this function 'bdkUpdateBootAreaInit'
  1107. * must be called
  1108. *
  1109. * Parameters:
  1110. * 'irHandle' - Drive number (0, 1, ...)
  1111. * bits 7-4 - Partition # (zero based)
  1112. * bits 3-0 - Socket # (zero based)
  1113. * 'irData' - bdkParams record
  1114. * length - number of bytes to write
  1115. * bdkBuffer - buffer to write from
  1116. * flags - ERASE_BEFORE_WRITE
  1117. *
  1118. * Return: flOK - success
  1119. * flBadLength - buffer length > Erasable Block Size
  1120. * flWriteFault - fail in buffer writing
  1121. * flNoSpaceInVolume - end of media was prematurely reached
  1122. *-------------------------------------------------------------------*/
  1123. #define bdkWriteBlock(ioreq) bdCall(FL_BINARY_WRITE_BLOCK,ioreq)
  1124. /*-------------------------------------------------------------------
  1125. * bdkErase - erase given number of blockdsin the BDK area.
  1126. *
  1127. * Erase given number of blockds in the binary sub partition.
  1128. *
  1129. * Parameters: ioreq
  1130. * 'irHandle' - Drive number (0, 1, ...)
  1131. * bits 7-4 - Partition # (zero based)
  1132. * bits 3-0 - Socket # (zero based)
  1133. * 'irData' - bdkParams record
  1134. * startingBlock - unit number of the sub-partition to start erasing from
  1135. * length - number of blocks to erase
  1136. * oldSign - signature of the sub-partition
  1137. * signOffset - signature offset 0 or 8
  1138. *
  1139. * Return: flOK - success
  1140. * flBadLength - buffer length > Erasable Block Size
  1141. * flWriteFault - fail in buffer writing
  1142. * flNoSpaceInVolume - end of media was prematurely reached
  1143. *-------------------------------------------------------------------*/
  1144. #define bdkErase(ioreq) bdCall(FL_BINARY_ERASE,ioreq)
  1145. /*-------------------------------------------------------------------
  1146. * bdkCreate - create new BDK partition .
  1147. *
  1148. * Init create operations on the DiskOnChip starting at 'startUnit', with
  1149. * a # of 'units' and 'signature'.
  1150. *
  1151. * Note : Blocks in the DiskOnChip are marked with a 4-character signature
  1152. * followed by a 4-digit hexadecimal number.
  1153. *
  1154. * Parameters: ioreq
  1155. * 'irHandle' - Drive number (0, 1, ...)
  1156. * bits 7-4 - Partition # (zero based)
  1157. * bits 3-0 - Socket # (zero based)
  1158. * 'irData' - bdkParams record
  1159. * length - number of blocks to create
  1160. * oldSign - signature of the sub-partition
  1161. * newSign - the replacing signature
  1162. * signOffset - signature offset 0 or 8
  1163. *
  1164. * Return: flOK - success
  1165. * flBadLength - buffer length > Erasable Block Size
  1166. * flWriteFault - fail in buffer writing
  1167. * flNoSpaceInVolume - end of media was prematurely reached
  1168. *-------------------------------------------------------------------*/
  1169. #define bdkCreate(ioreq) bdCall(FL_BINARY_CREATE,ioreq)
  1170. /*----------------------------------------------------------------------*/
  1171. /* b d k P a r t i t i o n I n f o */
  1172. /* */
  1173. /* Parameters: */
  1174. /* irHandle : volume number */
  1175. /* irData : pointer to structure that hold socket */
  1176. /* parameters */
  1177. /* irLength : Physical size of the binary volume */
  1178. /* */
  1179. /* Returns: */
  1180. /* FLStatus : 0 on success, otherwise failed. */
  1181. /*----------------------------------------------------------------------*/
  1182. #define bdkPartitionInfo(ioreq) bdCall(FL_BINARY_PARTITION_INFO,ioreq)
  1183. #endif /* BDK_ACCESS */
  1184. #ifdef HW_OTP
  1185. /*----------------------------------------------------------------------*/
  1186. /* f l O T P S i z e */
  1187. /* */
  1188. /* Get the OTP size and stated */
  1189. /* */
  1190. /* Parameters: */
  1191. /* irHandle : Socket number ( 0,1,2... ) */
  1192. /* 4 LSB - Socket number */
  1193. /* irLength : The size of the used OTP area in bytes */
  1194. /* irCount : The size of the OTP ara in bytes */
  1195. /* irFlags : LOCKED_OTP for a locked area otherwise unlocked */
  1196. /* */
  1197. /* Returns: */
  1198. /* FLStatus : 0 on success, otherwise failed */
  1199. /*----------------------------------------------------------------------*/
  1200. #define flOTPSize(ioreq) bdCall(FL_OTP_SIZE,ioreq)
  1201. /* LOCKED_OTP 1 defined in flflash.h */
  1202. /*----------------------------------------------------------------------*/
  1203. /* f l O T P R e a d */
  1204. /* */
  1205. /* Read from the OTP area */
  1206. /* */
  1207. /* Parameters: */
  1208. /* irHandle : Socket number ( 0,1,2... ) */
  1209. /* 4 LSB - Socket number */
  1210. /* irData : pointer to user buffer to read into */
  1211. /* irLength : number of bytes to read */
  1212. /* irCount : offset to read from (starting at the begining of */
  1213. /* the OTP area */
  1214. /* */
  1215. /* Returns: */
  1216. /* FLStatus : 0 on success, otherwise failed */
  1217. /*----------------------------------------------------------------------*/
  1218. #define flOTPRead(ioreq) bdCall(FL_OTP_READ,ioreq)
  1219. /*----------------------------------------------------------------------*/
  1220. /* f l O T P W r i t e A n d L o c k */
  1221. /* */
  1222. /* Write to the OTP area while locking it at the end. */
  1223. /* */
  1224. /* Parameters: */
  1225. /* irHandle : Socket number ( 0,1,2... ) */
  1226. /* 4 LSB - Socket number */
  1227. /* irData : pointer to user buffer to write from */
  1228. /* irLength : number of bytes to write */
  1229. /* */
  1230. /* Returns: */
  1231. /* FLStatus : 0 on success, otherwise failed */
  1232. /*----------------------------------------------------------------------*/
  1233. #define flOTPWriteAndLock(ioreq) bdCall(FL_OTP_WRITE,ioreq)
  1234. /*----------------------------------------------------------------------*/
  1235. /* f l G e t U n i q u e I D */
  1236. /* */
  1237. /* Returns the 16 bytes device unique ID */
  1238. /* */
  1239. /* Parameters: */
  1240. /* irHandle : Socket number ( 0,1,2... ) */
  1241. /* 4 LSB - Socket number */
  1242. /* irData : pointer to a 16 bytes buffer to read into the */
  1243. /* unique ID data */
  1244. /* */
  1245. /* Returns: */
  1246. /* FLStatus : 0 on success, otherwise failed */
  1247. /* irData : 16 bytes unique ID buffer */
  1248. /*----------------------------------------------------------------------*/
  1249. #define flGetUniqueID(ioreq) bdCall(FL_UNIQUE_ID,ioreq)
  1250. /*----------------------------------------------------------------------*/
  1251. /* f l G e t C u s t o m e r I D */
  1252. /* */
  1253. /* Returns the 4 bytes customer ID */
  1254. /* */
  1255. /* Parameters: */
  1256. /* irHandle : Socket number ( 0,1,2... ) */
  1257. /* 4 LSB - Socket number */
  1258. /* irData : pointer to a 4 bytes buffer to read into the */
  1259. /* customer ID */
  1260. /* */
  1261. /* Returns: */
  1262. /* FLStatus : 0 on success, otherwise failed */
  1263. /* irData : 4 bytes unique ID buffer */
  1264. /*----------------------------------------------------------------------*/
  1265. #define flGetCustomerID(ioreq) bdCall(FL_CUSTOMER_ID,ioreq)
  1266. #endif /* HW_OTP */
  1267. #ifdef FL_LOW_LEVEL
  1268. /*----------------------------------------------------------------------*/
  1269. /* f l D e e p P o w e r D o w n M o d e */
  1270. /* */
  1271. /* Forces the device into and out of the deep power down mode */
  1272. /* */
  1273. /* Parameters: */
  1274. /* irHandle : Socket number ( 0,1,2... ) */
  1275. /* 4 LSB - Socket number */
  1276. /* irFlags : DEEP_POWER_DOWN forces the low power consumption */
  1277. /* mode. otherwise turning to the regular mode */
  1278. /* */
  1279. /* Returns: None */
  1280. /*----------------------------------------------------------------------*/
  1281. #define flDeepPowerDownMode(ioreq) bdCall(FL_DEEP_POWER_DOWN_MODE,ioreq)
  1282. /* DEEP_POWER_DOWN 1 defined in flflash.h */
  1283. #endif /* FL_LOW_LEVEL */
  1284. /*----------------------------------------------------------------------*/
  1285. /* f l I n q u i r e C a p a b i l i t i e s */
  1286. /* */
  1287. /* Get the specific device S/W and H/W capabilities */
  1288. /* */
  1289. /* Parameters: */
  1290. /* irHandle : Socket number ( 0,1,2... ) */
  1291. /* 4 LSB - Socket number */
  1292. /* irLength : One of the capabilities below to examine */
  1293. /* Returns: */
  1294. /* FLStatus : 0 on success, otherwise failed */
  1295. /* irLength : Either CAPABILITY_NOT_SUPPORTED or */
  1296. /* CAPABILITY_SUPPORTED. */
  1297. /*----------------------------------------------------------------------*/
  1298. #define flInquireCapabilities(ioreq) bdCall(FL_INQUIRE_CAPABILITIES,ioreq)
  1299. /* capabilities flags */
  1300. typedef enum{
  1301. CAPABILITY_NOT_SUPPORTED = 0,
  1302. CAPABILITY_SUPPORTED = 1,
  1303. SUPPORT_UNERASABLE_BBT = 2,
  1304. SUPPORT_MULTIPLE_BDTL_PARTITIONS = 3,
  1305. SUPPORT_MULTIPLE_BINARY_PARTITIONS = 4,
  1306. SUPPORT_HW_PROTECTION = 5,
  1307. SUPPORT_HW_LOCK_KEY = 6,
  1308. SUPPORT_CUSTOMER_ID = 7,
  1309. SUPPORT_UNIQUE_ID = 8,
  1310. SUPPORT_DEEP_POWER_DOWN_MODE = 9,
  1311. SUPPORT_OTP_AREA = 10,
  1312. SUPPORT_WRITE_IPL_ROUTINE = 11
  1313. }FLCapability;
  1314. /*----------------------------------------------------------------------*/
  1315. /* f l P l a c e E x b B y B u f f e r */
  1316. /* */
  1317. /* Place M-systems firmware file on the media. */
  1318. /* This routine analizes the exb file calclats the media space needed */
  1319. /* for it taking only the device specific code. */
  1320. /* In addition the routine customizes the file and places it on the */
  1321. /* media. */
  1322. /* */
  1323. /* Note : The media must be already formated with enough binary area */
  1324. /* already marked with the SPL signature. This routine is best used */
  1325. /* with the format routine where the format routine is givven the first */
  1326. /* 512 bytes while the rest of the file is given with this routine */
  1327. /* */
  1328. /* Parameters: */
  1329. /* irHandle : Socket number (0,1,..) */
  1330. /* 4 LSB - Socket number */
  1331. /* irData : Buffer containing the entire/part of EXB file */
  1332. /* irLength : Size of the current buffer */
  1333. /* irWindowBase : Optional window base address to be loaded to */
  1334. /* irFlags : One of the following exb flags */
  1335. /* : INSTALL_FIRST - Install device as drive C: */
  1336. /* FLOPPY - Install device as drive A: */
  1337. /* QUIET - Do not show TFFS titles */
  1338. /* INT15_DISABLE - Do not hook int 15 */
  1339. /* SIS5598 - Support for SIS5598 platforms */
  1340. /* NO_PNP_HEADER - Do not place the PNP bios header */
  1341. /* */
  1342. /* Returns: */
  1343. /* FLStatus : 0 on success, otherwise failed */
  1344. /*----------------------------------------------------------------------*/
  1345. #define flPlaceExbByBuffer(ioreq) bdCall(FL_PLACE_EXB,ioreq)
  1346. /*----------------------------------------------------------------------*/
  1347. /* f l W r i t e I P L */
  1348. /* */
  1349. /* Place a user buffer to both copies of the IPL area */
  1350. /* */
  1351. /* Note : This routine is applicable only to docPlus famaly devices */
  1352. /* Doc2000 family devices will return flFeatureNotSupported */
  1353. /* */
  1354. /* Parameters: */
  1355. /* irHandle : Socket number (0,1,..) */
  1356. /* 4 LSB - Socket number */
  1357. /* irData : Pointer to user buffer */
  1358. /* irLength : Size of the buffer */
  1359. /* irFlags : See flags bellow */
  1360. /* */
  1361. /* Returns: */
  1362. /* FLStatus : 0 on success, otherwise failed */
  1363. /*----------------------------------------------------------------------*/
  1364. #define flWriteIPL(ioreq) bdCall(FL_WRITE_IPL,ioreq)
  1365. /*
  1366. * defined in flflash.h
  1367. *
  1368. * FL_IPL_MODE_NORMAL 0 - Written as usual
  1369. * FL_IPL_DOWNLOAD 1 - Download new IPL when done
  1370. * FL_IPL_MODE_SA 2 - Written with Strong Arm mode enabled
  1371. * FL_IPL_MODE_XSCALE 4 - Written with X-Scale mode enabled
  1372. */
  1373. /*----------------------------------------------------------------------*/
  1374. /* r e a d I P L */
  1375. /* */
  1376. /* Read IPL to user buffer. */
  1377. /* */
  1378. /* Note : Read length must be a multiplication of 512 bytes */
  1379. /* Note : Causes DiskOnChip Millennium Plus to download (i,e protection */
  1380. /* key will be removed from all partitions. */
  1381. /* */
  1382. /* Parameters: */
  1383. /* irHandle : Socket number (0,1,..) */
  1384. /* 4 LSB - Socket number */
  1385. /* irData : Pointer to user buffer */
  1386. /* irLength : Size of the buffer */
  1387. /* */
  1388. /* Returns: */
  1389. /* FLStatus : 0 on success, otherwise failed */
  1390. /*----------------------------------------------------------------------*/
  1391. #define flReadIPL(ioreq) bdCall(FL_READ_IPL,ioreq)
  1392. #endif /* FL_LOW_LEVEL */
  1393. /*----------------------------------------------------------------------*/
  1394. /* f l U p d a t e S o c k e t P a r a m s */
  1395. /* */
  1396. /* Pass socket parameters to the socket interface layer. */
  1397. /* This function should be called after the socket parameters (like */
  1398. /* size and base) are known. If these parameters are known at */
  1399. /* registration time then there is no need to use this function, and */
  1400. /* the parameters can be passed to the registration routine. */
  1401. /* The structure passed in irData is specific for each socket interface.*/
  1402. /* */
  1403. /* Parameters: */
  1404. /* irHandle : volume number */
  1405. /* irData : pointer to structure that hold socket */
  1406. /* parameters */
  1407. /* */
  1408. /* Returns: */
  1409. /* FLStatus : 0 on success, otherwise failed. */
  1410. /*----------------------------------------------------------------------*/
  1411. #define flUpdateSocketParams(ioreq) bdCall(FL_UPDATE_SOCKET_PARAMS,ioreq)
  1412. #ifdef HW_PROTECTION
  1413. /*----------------------------------------------------------------------*/
  1414. /* f l I d e n t i f y P r o t e c t i o n */
  1415. /* b d k I d e n t i f y P r o t e c t i o n */
  1416. /* */
  1417. /* Returns the specified partitions protection attributes */
  1418. /* */
  1419. /* Parameters: */
  1420. /* irHandle : Drive number (0, 1, ...) */
  1421. /* bits 7-4 - Partition # (zero based) */
  1422. /* bits 3-0 - Socket # (zero based) */
  1423. /* */
  1424. /* Returns: */
  1425. /* FLStatus : 0 on success, otherwise failed */
  1426. /* irFlags CHANGEABLE_PROTECTION - changeable protection type */
  1427. /* PROTECTABLE - partition can recieve protection */
  1428. /* READ_PROTECTED - partition is read protected */
  1429. /* WRITE_PROTECTED - partition is write protected */
  1430. /* LOCK_ENABLED - HW lock signal is enabled */
  1431. /* LOCK_ASSERTED - HW lock signal is asserted */
  1432. /* KEY_INSERTED - key is inserted (not currently */
  1433. /* protected. */
  1434. /*----------------------------------------------------------------------*/
  1435. #define flIdentifyProtection(ioreq) bdCall(FL_PROTECTION_GET_TYPE,ioreq)
  1436. #define bdkIdentifyProtection(ioreq) bdCall(FL_BINARY_PROTECTION_GET_TYPE,ioreq)
  1437. /* Protection partition flags (see flbase.h)*/
  1438. /*----------------------------------------------------------------------*/
  1439. /* f l I n s e r t P r o t e c t i o n K e y */
  1440. /* b d k I n s e r t P r o t e c t i o n K e y */
  1441. /* */
  1442. /* Insert the protection key in order to remove the protection of the */
  1443. /* partititon specified by the drive handle */
  1444. /* */
  1445. /* Parameters: */
  1446. /* irHandle : Drive number (0, 1, ...) */
  1447. /* bits 7-4 - Partition # (zero based) */
  1448. /* bits 3-0 - Socket # (zero based) */
  1449. /* irData : pointer to an 8 bytes key array */
  1450. /* */
  1451. /* Returns: */
  1452. /* FLStatus : 0 on success, otherwise failed */
  1453. /*----------------------------------------------------------------------*/
  1454. #define flInsertProtectionKey(ioreq) bdCall(FL_PROTECTION_INSERT_KEY,ioreq)
  1455. #define bdkInsertProtectionKey(ioreq) bdCall(FL_BINARY_PROTECTION_INSERT_KEY,ioreq)
  1456. /*----------------------------------------------------------------------*/
  1457. /* f l R e m o v e P r o t e c t i o n K e y */
  1458. /* b d k R e m o v e P r o t e c t i o n K e y */
  1459. /* */
  1460. /* Remove the protection key making the partition protected again */
  1461. /* */
  1462. /* Parameters: */
  1463. /* irHandle : Drive number (0, 1, ...) */
  1464. /* bits 7-4 - Partition # (zero based) */
  1465. /* bits 3-0 - Socket # (zero based) */
  1466. /* */
  1467. /* Returns: */
  1468. /* FLStatus : 0 on success, otherwise failed */
  1469. /*----------------------------------------------------------------------*/
  1470. #define flRemoveProtectionKey(ioreq) bdCall(FL_PROTECTION_REMOVE_KEY,ioreq)
  1471. #define bdkRemoveProtectionKey(ioreq) bdCall(FL_BINARY_PROTECTION_REMOVE_KEY,ioreq)
  1472. /*----------------------------------------------------------------------*/
  1473. /* f l H a r d w a r e P r o t e c t i o n L o c k */
  1474. /* b d k H a r d w a r e P r o t e c t i o n L o c k */
  1475. /* */
  1476. /* Enabled or disabled the affect of the hardware LOCK signal */
  1477. /* The hardware lock signal disables the removal of protection through */
  1478. /* the key therfore the partition will remain protected until the */
  1479. /* hardware LOCK signal will be removed */
  1480. /* */
  1481. /* Parameters: */
  1482. /* irHandle : Drive number (0, 1, ...) */
  1483. /* bits 7-4 - Partition # (zero based) */
  1484. /* bits 3-0 - Socket # (zero based) */
  1485. /* irFlags : LOCK_ENABLED locks the partition otherwise */
  1486. /* */
  1487. /* Returns: */
  1488. /* FLStatus : 0 on success, otherwise failed */
  1489. /*----------------------------------------------------------------------*/
  1490. #define flHardwareProtectionLock(ioreq) bdCall(FL_PROTECTION_SET_LOCK,ioreq)
  1491. #define bdkHardwareProtectionLock(ioreq) bdCall(FL_BINARY_PROTECTION_CHANGE_LOCK,ioreq)
  1492. /*----------------------------------------------------------------------*/
  1493. /* f l C h a n g e P r o t e c t i o n K e y */
  1494. /* b d k C h a n g e P r o t e c t i o n K e y */
  1495. /* */
  1496. /* Changes the current protection key with a new one. */
  1497. /* */
  1498. /* Parameters: */
  1499. /* irHandle : Drive number (0, 1, ...) */
  1500. /* bits 7-4 - Partition # (zero based) */
  1501. /* bits 3-0 - Socket # (zero based) */
  1502. /* irData : Pointer to the new 8 bytes key array */
  1503. /* */
  1504. /* Returns: */
  1505. /* FLStatus : 0 on success, otherwise failed */
  1506. /*----------------------------------------------------------------------*/
  1507. #define flChangeProtectionKey(ioreq) bdCall(FL_PROTECTION_CHANGE_KEY,ioreq)
  1508. #define bdkChangeProtectionKey(ioreq) bdCall(FL_BINARY_PROTECTION_CHANGE_KEY,ioreq)
  1509. /*----------------------------------------------------------------------*/
  1510. /* f l C h a n g e P r o t e c t i o n T y p e */
  1511. /* b d k C h a n g e P r o t e c t i o n T y p e */
  1512. /* */
  1513. /* Changes the protection attributes of the partitions. */
  1514. /* In order for a partition to change its protection type (without */
  1515. /* reformating the media) it must have the CHANGEABLE_PRTOECTION */
  1516. /* attribute. */
  1517. /* */
  1518. /* Parameters: */
  1519. /* irHandle : Drive number (0, 1, ...) */
  1520. /* bits 7-4 - Partition # (zero based) */
  1521. /* bits 3-0 - Socket # (zero based) */
  1522. /* */
  1523. /* Returns: */
  1524. /* FLStatus : 0 on success, otherwise failed */
  1525. /*----------------------------------------------------------------------*/
  1526. #define flChangeProtectionType(ioreq) bdCall(FL_PROTECTION_CHANGE_TYPE,ioreq)
  1527. #define bdkChangeProtectionType(ioreq) bdCall(FL_BINARY_PROTECTION_SET_TYPE,ioreq)
  1528. #endif /* HW_PROTECTION */
  1529. #ifdef EXIT
  1530. /*----------------------------------------------------------------------*/
  1531. /* f l E x i t */
  1532. /* */
  1533. /* If the application ever exits, flExit should be called before exit. */
  1534. /* flExit flushes all buffers, closes all open files, powers down the */
  1535. /* sockets and removes the interval timer. */
  1536. /* */
  1537. /* Parameters: */
  1538. /* None */
  1539. /* */
  1540. /* Returns: */
  1541. /* Nothing */
  1542. /*----------------------------------------------------------------------*/
  1543. #ifdef __cplusplus
  1544. extern "C"
  1545. {
  1546. #endif /* __cplusplus */
  1547. void NAMING_CONVENTION flExit(void);
  1548. #ifdef __cplusplus
  1549. }
  1550. #endif /* __cplusplus */
  1551. #endif /* EXIT */
  1552. #ifdef ENVIRONMENT_VARS
  1553. typedef enum { /* Variable type code for flSetEnv routin */
  1554. FL_ENV_VARS_PER_SYSTEM = 0,
  1555. FL_IS_RAM_CHECK_ENABLED = 1,
  1556. FL_TL_CACHE_ENABLED = 2,
  1557. FL_DOC_8BIT_ACCESS = 3,
  1558. FL_MULTI_DOC_ENABLED = 4,
  1559. FL_SET_MAX_CHAIN = 5,
  1560. FL_MARK_DELETE_ON_FLASH = 6,
  1561. FL_MTL_POLICY = 7,
  1562. FL_SECTORS_VERIFIED_PER_FOLDING = 8,
  1563. FL_SUSPEND_MODE = 9,
  1564. FL_ENV_VARS_PER_SOCKET = 100,
  1565. FL_VERIFY_WRITE_OTHER = 101,
  1566. FL_MTD_BUS_ACCESS_TYPE = 102,
  1567. FL_ENV_VARS_PER_VOLUME = 200,
  1568. FL_SET_POLICY = 201,
  1569. FL_VERIFY_WRITE_BDTL = 202,
  1570. FL_VERIFY_WRITE_BINARY = 203
  1571. } FLEnvVars;
  1572. /*----------------------------------------------------------------------*/
  1573. /* f l S e t E n v V o l u m e */
  1574. /* */
  1575. /* Change one of TrueFFS environment variables for a specific partition */
  1576. /* */
  1577. /* Note : This routine is used by all other flSetEnv routines. */
  1578. /* In order to effect variables that are common to several */
  1579. /* sockets or volumes use INVALID_VOLUME_NUMBER */
  1580. /* */
  1581. /* Parameters: */
  1582. /* variableType : variable type to cahnge */
  1583. /* socket : Associated socket */
  1584. /* volume : Associated volume (partition) */
  1585. /* value : varaible value */
  1586. /* */
  1587. /* Note: Variables common to al sockets must be addressed using socket */
  1588. /* 0 and volume 0. */
  1589. /* */
  1590. /* Returns: */
  1591. /* FLStatus : 0 on success, otherwise failed */
  1592. /* prevValue : The previous value of the variable */
  1593. /*----------------------------------------------------------------------*/
  1594. #ifdef __cplusplus
  1595. extern "C"
  1596. {
  1597. #endif /* __cplusplus */
  1598. FLStatus NAMING_CONVENTION flSetEnvVolume(FLEnvVars variableType ,
  1599. byte socket,byte volume ,
  1600. dword value, dword FAR2 *prevValue);
  1601. #ifdef __cplusplus
  1602. }
  1603. #endif /* __cplusplus */
  1604. /*----------------------------------------------------------------------*/
  1605. /* f l S e t E n v S o c k e t */
  1606. /* */
  1607. /* Change one of TrueFFS environment variables for a specific sockets. */
  1608. /* */
  1609. /* Parameters: */
  1610. /* variableType : variable type to cahnge */
  1611. /* socket : socket number */
  1612. /* value : varaible value */
  1613. /* */
  1614. /* Returns: */
  1615. /* FLStatus : 0 on success, otherwise failed */
  1616. /* prevValue : The previous value of the variable */
  1617. /* if there are more then 1 partition in that */
  1618. /* socket , the first partition value is returned*/
  1619. /*----------------------------------------------------------------------*/
  1620. #ifdef __cplusplus
  1621. extern "C"
  1622. {
  1623. #endif /* __cplusplus */
  1624. FLStatus NAMING_CONVENTION flSetEnvSocket(FLEnvVars variableType , byte socket ,
  1625. dword value, dword FAR2 *prevValue);
  1626. #ifdef __cplusplus
  1627. }
  1628. #endif /* __cplusplus */
  1629. /*----------------------------------------------------------------------*/
  1630. /* f l S e t E n v All */
  1631. /* */
  1632. /* Change one of TrueFFS environment variables for all systems, sockets */
  1633. /* and partitions. */
  1634. /* */
  1635. /* Parameters: */
  1636. /* variableType : variable type to cahnge */
  1637. /* value : varaible value */
  1638. /* */
  1639. /* Returns: */
  1640. /* FLStatus : 0 on success, otherwise failed */
  1641. /* prevValue : The previous value of the variable */
  1642. /*----------------------------------------------------------------------*/
  1643. #ifdef __cplusplus
  1644. extern "C"
  1645. {
  1646. #endif /* __cplusplus */
  1647. FLStatus NAMING_CONVENTION flSetEnvAll(FLEnvVars variableType , dword value, dword FAR2 *prevValue);
  1648. #ifdef __cplusplus
  1649. }
  1650. #endif /* __cplusplus */
  1651. #endif /* ENVIRONMENT_VARS */
  1652. /*----------------------------------------------------------------------*/
  1653. /* f l B u i l d G e o m e t r y */
  1654. /* */
  1655. /* Get C/H/S information of the disk according to number of sectors. */
  1656. /* */
  1657. /* Parameters: */
  1658. /* capacity : Number of Sectors in Volume */
  1659. /* cylinders : Pointer to Number of Cylinders */
  1660. /* heads : Pointer to Number of Heads */
  1661. /* sectors : Pointer to Number of Sectors per Track */
  1662. /* oldFormat : True for one sector per culoster */
  1663. /* */
  1664. /*----------------------------------------------------------------------*/
  1665. #ifdef __cplusplus
  1666. extern "C"
  1667. {
  1668. #endif /* __cplusplus */
  1669. void NAMING_CONVENTION flBuildGeometry(dword capacity, dword FAR2 *cylinders,
  1670. dword FAR2 *heads,dword FAR2 *sectors, FLBoolean oldFormat);
  1671. #ifdef __cplusplus
  1672. }
  1673. #endif /* __cplusplus */
  1674. #ifndef FL_NO_USE_FUNC
  1675. /*----------------------------------------------------------------------*/
  1676. /* f l S e t D o c B u s R o u t i n e */
  1677. /* */
  1678. /* Set user defined memory acces routines for DiskOnChip. */
  1679. /* */
  1680. /* Parameters: */
  1681. /* socket : Socket number to install routine for. */
  1682. /* structPtr : Pointer to function structure. */
  1683. /* */
  1684. /* Returns: */
  1685. /* FLStatus : 0 on success, otherwise failed */
  1686. /*----------------------------------------------------------------------*/
  1687. #ifdef __cplusplus
  1688. extern "C"
  1689. {
  1690. #endif /* __cplusplus */
  1691. FLStatus NAMING_CONVENTION flSetDocBusRoutine(byte socket, FLAccessStruct FAR1 * structPtr);
  1692. #ifdef __cplusplus
  1693. }
  1694. #endif /* __cplusplus */
  1695. /*----------------------------------------------------------------------*/
  1696. /* f l G e t D o c B u s R o u t i n e */
  1697. /* */
  1698. /* Get currently installed memory access routines for DiskOnChip. */
  1699. /* */
  1700. /* Parameters: */
  1701. /* socket : Socket number to install routine for. */
  1702. /* structPtr : Pointer to function structure. */
  1703. /* */
  1704. /* Returns: */
  1705. /* FLStatus : 0 on success, otherwise failed */
  1706. /*----------------------------------------------------------------------*/
  1707. #ifdef __cplusplus
  1708. extern "C"
  1709. {
  1710. #endif /* __cplusplus */
  1711. FLStatus NAMING_CONVENTION flGetDocBusRoutine(byte socket, FLAccessStruct FAR1 * structPtr);
  1712. #ifdef __cplusplus
  1713. }
  1714. #endif /* __cplusplus */
  1715. #endif /* FL_NO_USE_FUNC */
  1716. /*----------------------------------------------------------------------*/
  1717. /* b d C a l l */
  1718. /* */
  1719. /* Common entry-point to all file-system functions. Macros are */
  1720. /* to call individual function, which are separately described below. */
  1721. /* */
  1722. /* Parameters: */
  1723. /* function : file-system function code (listed below) */
  1724. /* ioreq : IOreq structure */
  1725. /* */
  1726. /* Returns: */
  1727. /* FLStatus : 0 on success, otherwise failed */
  1728. /*----------------------------------------------------------------------*/
  1729. #ifdef __cplusplus
  1730. extern "C"
  1731. {
  1732. #endif /* __cplusplus */
  1733. FLStatus NAMING_CONVENTION bdCall(FLFunctionNo functionNo, IOreq FAR2 *ioreq);
  1734. #ifdef __cplusplus
  1735. }
  1736. #endif /* __cplusplus */
  1737. #ifdef PARSE_PATH
  1738. /*----------------------------------------------------------------------*/
  1739. /* f l P a r s e P a t h */
  1740. /* */
  1741. /* Converts a DOS-like path string to a simple-path array. */
  1742. /* */
  1743. /* Note: Array length received in irPath must be greater than the */
  1744. /* number of path components in the path to convert. */
  1745. /* */
  1746. /* Parameters: */
  1747. /* irData : address of path string to convert */
  1748. /* irPath : address of array to receive parsed-path. */
  1749. /* */
  1750. /* Returns: */
  1751. /* FLStatus : 0 on success, otherwise failed */
  1752. /*----------------------------------------------------------------------*/
  1753. #ifdef __cplusplus
  1754. extern "C"
  1755. {
  1756. #endif /* __cplusplus */
  1757. extern FLStatus NAMING_CONVENTION flParsePath(IOreq FAR2 *ioreq);
  1758. #ifdef __cplusplus
  1759. }
  1760. #endif /* __cplusplus */
  1761. #endif /* PARSE_PATH */
  1762. #endif /* BLOCKDEV_H */