📄 diskonc.c
字号:
/*
* $Log: V:/Flite/archives/TrueFFS5/Src/DISKONC.C_V $
*
* Rev 1.37 Nov 07 2002 12:33:56 oris
* Remove warnings.
*
* Rev 1.36 Oct 31 2002 14:56:20 oris
* Added readIPL routine.
*
* Rev 1.35 Jul 04 2002 18:04:02 oris
* Bug fix - When setting low and high address parameters of the flDocWindowBaseAddress() routine to 0 (using default range) only the first DiskOnChip in the range was found.
* Placed DFORMAT_PRINT under parenthesis to remove warnings.
* Added support for Samsung 128MB flashes.
*
* Rev 1.34 May 01 2002 19:02:26 oris
* Removed warnings
*
* Rev 1.33 Apr 15 2002 07:35:04 oris
* Changed usage and logic of checkToggle to be more intuitive.
* Added support for new access layer (docsys). MTD now initializes the
* access layer accessing the DiskOnChip registers.
* Bug fix - doc2write did not report write faults in case runtime verify
* write was not required.
* Bug fix - bad compilation ifdef in readBBT routine might cause a write
* operation while FL_READ_ONLY is defined or to compile the
* reconstruct BBT code even if MTD_RECONSTRUCT_BBT is
* not defined.
*
* Rev 1.32 Jan 29 2002 20:07:30 oris
* Changed sanity check of write IPL modes.
*
* Rev 1.31 Jan 28 2002 21:23:58 oris
* Removed the use of back-slashes in macro definitions.
* Added FL_IPL_DOWNLOAD flag to writeIPL routine in order to control whether the IPL will be reloaded after the update.
* Bug fix - writeIPL routine did not support buffers smaller then 1024 bytes.
* Bug fix - writeIPL routine did not write the second copy of the IPL correctly (for both 512 bytes).
* Changed docwrite and docset calls to separate DiskOnChip base window pointer and IO registers offset (for address shifting).
* Replaced FLFlash argument with DiskOnChip memory base pointer in calls to docwrite , docset and docread.
* Removed win_io initialization (one of FLFlash record fields).
* Improved check for flSuspend.
*
* Rev 1.30 Jan 23 2002 23:31:04 oris
* Added writeIPL routine (copied from blockdev.c).
* Made writeIPL and download routines available even when MTD_STANDALONE is defined.
* Bug fix - checkErase routine was unreasonably slow.
* Changed DFORMAT_PRINT syntax.
*
* Rev 1.29 Jan 21 2002 20:43:50 oris
* Compilation errors for MTD_STANDALONE with BDK_VERIFY_WRITE.
* Bug fix - PARTIAL_EDC flag to doc2read was negated prior to readOneSector.
*
* Rev 1.28 Jan 20 2002 20:57:00 oris
* physicalToPointer was called with wrong size argument.
*
* Rev 1.27 Jan 20 2002 20:28:06 oris
* Changed doc2000FreeWindow return type to remove warnings.
*
* Rev 1.26 Jan 17 2002 22:57:56 oris
* Replaced vol with *flash.
* Removed flPreInit memory access routines.
* Added new memory access routine implementation.
* Compilation problems fixed with VERIFY_ERASE
* Added support for flSuspendMode environment variable.
*
* Rev 1.25 Nov 21 2001 11:39:10 oris
* Changed FL_WITH_VERIFY_WRITE and FL_WITHOUT_VERIFY_WRITE to FL_ON and FL_OFF.
*
* Rev 1.24 Nov 20 2001 20:24:58 oris
* Removed warnings.
*
* Rev 1.23 Nov 16 2001 00:19:38 oris
* Compilation problem for FL_READ_ONLY.
*
* Rev 1.22 Nov 08 2001 10:44:30 oris
* Added run-time control over verify write mode.
* Added support for more up to 64K units - erase / readbbt
* Restricted BBT block search to BBT_MAX_DISTANCE and not the entire floor.
* Bug fix - Replacing a DiskOnChip Millennium with DiskOnChip 2000 failed identifying DiskOnChip2000 (gang).
*
* Rev 1.21 Sep 24 2001 18:23:08 oris
* Removed warnings.
*
* Rev 1.20 Sep 15 2001 23:44:42 oris
* Placed YIELD_CPU definition under ifdef to prevent redeclaration.
* Changed doc2erase to support up to 64K erase blocks.
* Added reconstruct flag to readBBT routine - stating whether to reconstruct BBT if it is not available.
* Added support for block multiplication in readBBT - several erase blocks in a single unit.
* Added support for 128MB flashes.
*
* Rev 1.19 Jul 29 2001 16:14:06 oris
* Support for number of units per floor not power of 2
*
* Rev 1.18 Jul 16 2001 22:47:58 oris
* Compilation error when using the FL_READ_ONLY compilation flag.
*
* Rev 1.17 Jul 15 2001 20:44:48 oris
* Removed warnings.
* Bug fix - virgin card dformat print was repeated for DiskOnChip with several floors.
*
* Rev 1.16 Jul 13 2001 00:59:42 oris
* Added docsys.h include.
* Improved VERIFY_WRITE support - added socket readBack buffer.
* Added PARTIAL_EDC read flag to the read routine.
* Revised checkErase routine to include extra area.
* Revised readBBT routine not to use MTD buffer.
* Added dformat debug print massages.
* Changed firstUsable block to 0 for DOC2000 tsop.
*
* Rev 1.15 Jun 17 2001 08:17:02 oris
* Added brackets to remove warnnings.
* Changed NO_READ_BBT_CODE to MTD_NO_READ_BBT_CODE.
*
* Rev 1.14 May 16 2001 21:16:32 oris
* Removed warnings.
* Changed code variable name to flCode (avoid name clashes).
*
* Rev 1.13 May 09 2001 00:31:28 oris
* Changed the DOC2000_TSOP_SUPPORT and READ_BBT_CODE compilation flags to NO_READ_BBT_CODE.
*
* Rev 1.12 May 07 2001 10:00:04 oris
* Compilation problems under MTD_STANDLAONE compilation flag.
*
* Rev 1.11 May 06 2001 22:41:22 oris
* Added the READ_BBT_CODE to allow reading the BBT even in the MTD_STANDALONE mode.
* Removed warnings.
*
* Rev 1.10 May 02 2001 06:44:38 oris
* Bug fix - readBBT routine.
* Removed the lastUsableBlock variable.
*
* Rev 1.9 Apr 30 2001 17:58:18 oris
* Added EDC check when reading the BBT.
*
* Rev 1.8 Apr 24 2001 17:06:22 oris
* Removed warrnings.
* Added lastUsableBlock initialization field in the FLFlash record.
*
* Rev 1.7 Apr 16 2001 13:04:20 oris
* Removed warrnings.
*
* Rev 1.6 Apr 12 2001 06:49:06 oris
* Added forceDownload routine
* Changed checkWinForDoc routine to be under ifndef MTD_STANDALONE.
*
* Rev 1.5 Apr 10 2001 16:39:16 oris
* Added multiple floor support for readbbt routine.
* Added call for docSocketInit which initializes the socket routines.
* Added validity check after flMap call in order to support pccard premoutn routine.
*
* Rev 1.4 Apr 09 2001 14:58:40 oris
* Removed debug buffer from readBBT routine.
* Bug fix in doc2000Identify if ASIC id was not mdoc 8 is was assumed to be doc2000.
* Added if_cfg field initialization in doc2000Identify.
*
* Rev 1.3 Apr 01 2001 07:38:58 oris
* Moved include diskonc.h from docsys.h.
* Removed waitForReadyWithYieldCPU for MTD_STANDALONE configuration.
* Removed NO_PPP compilation flag support.
* Left alligned all # directives.
* Moved pageSize,noOfFloors filed from the MTDs internal stucture to FLFlash record.
* Changed writeOneSector,doc2Write,readOneSector,doc2Read prototype.
* Added readbbt routine for alon.
* Removed pageAndTailSize from mtdVars record.
*
* Rev 1.2 Mar 01 2001 14:15:56 vadimk
* Add proper MDOC and DOC2300 support
*
* Rev 1.1 Feb 07 2001 18:28:38 oris
* Bug fix - restored antialise mechanizm to flDocWindowBaseAddress
* Added seperetaed floors compilation flag
* Changed mdoc \ alon distingishing algorithm
* Removed checkWinForDoc routine under the mtd_standalone comilation flag
* removed MAX_FLASH_DEVICES_MDOC define since alone DiskOnChips can support 16 chips just like doc2000
*
* Rev 1.0 Feb 02 2001 15:35:38 oris
* Initial revision.
*
*/
/************************************************************************/
/* */
/* FAT-FTL Lite Software Development Kit */
/* Copyright (C) M-Systems Ltd. 1995-2001 */
/* */
/************************************************************************/
#include "reedsol.h"
#include "diskonc.h"
extern NFDC21Vars docMtdVars[SOCKETS];
/* When the MTD is used as a standalone package some of the routine */
/* are replaced with the following macroes */
#ifdef MTD_STANDALONE
#define flReadBackBufferOf(a) &(globalReadBack[a][0])
#define flSocketNoOf(volume) 0 /* currently we support only a single device */
#define flMap(socket,address) addToFarPointer(socket->base,address & (socket->size - 1));
#endif /* MTD_STANDALONE */
/* Yield CPU time in msecs */
#ifndef YIELD_CPU
#define YIELD_CPU 10
#endif /* YIELD_CPU */
/* maximum waiting time in msecs */
#define MAX_WAIT 30
#ifndef NO_EDC_MODE
/*哪哪哪哪哪哪哪哪哪哪哪哪哪
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -