📄 mdocplus.c
字号:
/*
* $Log: V:/Flite/archives/TrueFFS5/Src/MDOCPLUS.C_V $
*
* Rev 1.58 Oct 22 2002 15:50:50 oris
* Added a call to the informOfOperation routine for bad blocks
* debugging under the FL_PLANT_BBT_FOR_TESTING
* compilation flag.
*
* Rev 1.57 Oct 21 2002 23:38:44 oris
* Fixed a bug in readBBT. The first 4 blocks might be read incorrectly in case
* the starting block address is divisible by 4.
* Fixed a bug in readBBT. In case less then 8 blocks are read starting from a
* block after the 8th block from the end.
* Fixed a bug that prevented re-entrance. The bug occurred only when using
* more then 1 none cascaded DiskOnChip Plus sockets.
* Fixed a bug in the MTD regarding the DPD (Deep Power Down Mode). In
* case user forced the device into DPD and called the MTD again without
* wakening the device, the MTD may fail to exist on its own.
* Added support for using DiskOnChip on an xscale processor when booting
* from the device (FL_XSCALE_BOOT_MODE). The flag is needed for customers
* who implemented a H/W solution for the 32MB DiskOnChip Millennium Plus
* and it prevents accesses to the flash IO register on 32bits aligned addresses.
* Fixed a bug in the writeIPL routine. When having more then 1 floor. The routine
* might read outside the user buffer and will write to all of the media floors
* regardless of the given size.
* Missing #ifdef statement in changeInterleave() prevents compilation when
* FL_NO_USE_FUNC is defined.
*
* Rev 1.56 Aug 22 2002 17:26:36 oris
* Bug fix - added release from power down in check controller
* (Asic) and DiskOnChip search routines. Bug could have caused
* error in read, write and warm boot in case the device was placed
* into deep power down mode and has not been given a wake up
* call, before it was used.
*
* Rev 1.55 Jul 18 2002 15:20:14 ORIS
* Bug fix readIPL
*
* Rev 1.54 Jul 17 2002 17:41:14 oris
* Removed warnings
* Renamed setIplSize to setIplSizePlus and made it public
*
* Rev 1.53 Jul 07 2002 09:28:28 oris
* Read IPL routine now uses the access layer.
*
* Rev 1.52 Jul 04 2002 18:05:38 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.
*
* Rev 1.51 May 14 2002 15:08:10 oris
* Changed all calls to flash->memSetGetMode calls to CheckAccessMode
* macros defined in _docsys.h
*
* Rev 1.50 06 May 2002 19:15:44 andreyk
* bug fix - if_cfg is now correctly initialized for MDOC128
*
* Rev 1.49 May 05 2002 16:57:36 oris
* Bug fix - bad initialization of if_cfg causes an error debug massage. The fix is placed under the MTD_STANDALONE compilation flag and therefore will have no affect when compiling the TrueFFS SDK.
*
* Rev 1.48 May 02 2002 09:40:56 oris
* Changed memIntereleaveChanged to memSetGetMode and added the socket number as a parameter.
*
* Rev 1.47 May 01 2002 19:03:50 oris
* Removed warnings.
* Bug fix - read BBT routine for DiskOnChip Millennium Plus 16MB might cause memory leak.
* Added a call to interleave changed call back routine.
*
* Rev 1.46 Apr 30 2002 17:21:44 oris
* Bug fix - Bad Blocks table was read from wrong address for Millennium Plus 16MB.
*
* Rev 1.45 Apr 15 2002 07:37:38 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.
* Added macro's for several special DiskOnChip registers.
* Remove interleave if statement since new access layer simply uses different routine for int-1 and int-2.
* Bug fix - setAsicMode routine should first exit power down before checking for access error.
* Bug fix - forceDownload routine did not issue the download command to all DiskOnChip floors.
* Bug fix - added verify write support for uneven address and length.
* Bug fix - doc2write routine might not report flHWProtection when in FL_OFF mode.
* Bug fix - readBBT when reading less then 8 bytes.
* Bug fix - writeIPL routine did not write all copies of IPL
* Bug fix - readIPL routine did not set Max Id properly.
*
* Rev 1.44 Feb 19 2002 21:00:40 oris
* Replaced flTimeOut status with flTimedOut.
* Bug fix - missing initialization of returned status in otpSize routine.
* Bug fix - read OTP routine when offset != 0
* Bug fix - unique ID is now read with EDC.
*
* Rev 1.43 Jan 29 2002 20:09:40 oris
* Switched arguments sent to docPlusSet.
* Added support for FL_IPL_MODE_XSCALE and changed support for FL_IPL_MODE_SA in writeIPL routine acording to new spec.
* Added sanity check for write IPL modes.
*
* Rev 1.42 Jan 28 2002 21:26:06 oris
* Removed the use of back-slashes in macro definitions.
* 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 , docread, wrBuf and wrSet.
* Removed win_io initialization (one of FLFlash record fields).
* Improved check for flSuspend.
* Added FL_IPL_DOWNLOAD flag to writeIPL routine in order to control whether the IPL will be reloaded after the update.
* Removed wrBuf and wrSet macros.
*
* Rev 1.41 Jan 23 2002 23:33:38 oris
* Bug fix - checkErase routine was unreasonably slow.
* Changed DFORMAT_PRINT syntax
* Bug fix - bad offset of writeIPL routine caused only first 512 bytes to be written.
* Changed readOTP not to use PARTIAL_EDC code.
*
* Rev 1.40 Jan 21 2002 20:45:12 oris
* Compilation errors for MTD_STANDALONE with BDK_VERIFY_WRITE.
* Missing casting causes compilation error in readIPL.
*
* Rev 1.39 Jan 20 2002 20:57:02 oris
* physicalToPointer was called with wrong size argument.
*
* Rev 1.38 Jan 20 2002 20:28:58 oris
* Removed warnings.
* Restored readIPL function initialization.
*
* Rev 1.37 Jan 20 2002 12:12:26 oris
* Removed warnings.
*
* Rev 1.36 Jan 20 2002 10:10:52 oris
* Moved mtdVars to docsoc.c (common with diskonc.c)
* Removed warnings.
* Replaced vol with *flash.
* Removed flPreInitXXXX memory access routines.
* Added new memory access routine implementation.
* Simplified docsys interleave-1 operations (interleave-1 operations use only 1 byte per operation. The if was made in docsys and is now a part of the MTD)
* Bug in implementation of VERIFY_ERASE extra area was fixed.
* Added support for flSuspendMode environment variable.
* Added support for 16MB Plus DiskOnChip :
* - Revised write IPL code
* - Revised read IPL code - now reads from SRAM and not flash causes download of protection logic.
* - OTP / Unique ID offsets were updated to be interleave dependent.
* - readBBT routine was changed to support DiskOnChip Millennium Plus.
* - Identification routine was changed.
* Changed checkStatus with if != flOK
* Added interrupt support under ifdef (ENABLE_EDGE__INTERRUPT / ENABLE_LEVEL__INTERRUPT)
* Changed NO_READ_BBT_CODE ifdef to MTD_READ_BBT.
* Big fix in erasable Block Size Bits field of the flash record when changing interleave.
* Added force remmapping of internal sector buffer.
*
* Rev 1.35 Nov 22 2001 19:48:46 oris
* Power consumption bug fix - chip select to the flash was remained open causing the power down mode to be ignored and the ideal current consumption to be twice the normal current.
* Made sure that when preventing the BUSY# signal to be asserted by the download operation all other bits of the output controll register remain as they were.
*
* Rev 1.34 Nov 21 2001 11:38:14 oris
* Changed FL_WITH_VERIFY_WRITE and FL_WITHOUT_VERIFY_WRITE to FL_ON and FL_OFF.
*
* Rev 1.33 Nov 20 2001 20:25:36 oris
* Bug fix - deep power down mode was released after access due to check of access error.
* Bug fix - download operation did assert the BUSY#.
*
* Rev 1.32 Nov 16 2001 00:23:04 oris
* Restored byte (if_cfg=8) access for reading syndrome registers.
*
* Rev 1.31 Nov 08 2001 10:49:48 oris
* Removed warnings.
* Added run-time control over verify write mode buffers.
*
* Rev 1.30 Oct 18 2001 22:17:22 oris
* Bug fix - incorrect read and write when performed from the middle of the page, incomplete pages , more then 1k when EDC is not requested.
*
* Rev 1.29 Oct 11 2001 23:55:10 oris
* Bug fix - Read operation to the MTD from 2 different pages (for example read operation to BDK with length > 1K) the logic that determined whether to read the last data from the pipeline is incorrect.
*
* 1) When reading with EDC data will be read from the I/O registers and not from the pipeline - This is not a problem, since the pipeline is not necessary.
* 2) When reading without EDC data will be read both from the I/O registers and from the pipeline casing overwriting the last 2 bytes with 0xff.
*
* Rev 1.28 Oct 10 2001 19:48:02 oris
* Bug fix - WORD_ADD_FAR macro was misused using casing bad casting to unaligned buffers. Replaced it with read operation to an intermidiate variable and then copy byte after byte.
*
* Rev 1.27 Sep 24 2001 18:24:08 oris
* Removed warnings.
* Added support for readBBT call for less then 8 bytes.
* Removed DOC_PLUS_ACCESS_TYPE ifdef.
*
* Rev 1.26 Sep 15 2001 23:47:20 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.
* Changed all memory access routine to DiskOnChip Millennium Plus dedicated routines.
* Changed recoverFromAccessError and setAsicMode routine to use standard memory access routines and not preInit routines.
* Bug fix - read\write from uneven address.
* Bug fix - read full 1k with no EDC.
* Bug fix - first 4 blocks are not reported correctly by the readBBT()
* Added debug print when BBT is not read well.
*
* Rev 1.25 Jul 29 2001 19:15:30 oris
* Changed file calls to macros.
*
* Rev 1.24 Jul 13 2001 01:08:08 oris
* Bug fix - rewritten VERIFY_WRITE compilation option.
* Prevent calls to docPlusRead with 0 length.
* Bug fix - added support for platforms that can not access single bytes.
* Added PARTIAL_EDC read flag to the read routine.
* Revised checkErase routine to include extra area.
* Bug fix - missing check of write protection in doc2erase.
* Bug fix - read bbt .
* Insert key before writing IPL since it might be protected with the default protection.
* Bug fix - set floor to 0 in all OTP calls.
* Use PARTIAL_EDC in read OTP routine.
* Added initialization of max erase cycles FLFlash field.
*
* Rev 1.23 Jun 17 2001 16:39:10 oris
* Improved documentation and remove warnings.
*
* Rev 1.22 Jun 17 2001 08:17:52 oris
* Bug fix - caused changing to interleave 1 even if already in this mode.
* Changed NO_READ_BBT_CODE to MTD_NO_READ_BBT_CODE.
*
* Rev 1.21 May 30 2001 21:16:06 oris
* Bug fix - pages per blocks might be used uninitialized.
*
* Rev 1.20 May 17 2001 19:21:10 oris
* Removed warnings.
*
* Rev 1.19 May 16 2001 21:20:34 oris
* Added failsafe mechanism for the download operation.
* Changed code variable name to flCode (avoid name clashes).
* Bug fix - read operation from extra area of second sector of page starting from offset 6 reading more then 2 bytes.
* Bug fix - write OTP and read OTP routines - Wrong usage of buffers.
* Removed warnings.
* Bug fix - enable power down routine while in MTD_STANDALONE mode.
*
* Rev 1.18 May 09 2001 00:33:12 oris
* Changed IPL_CODE to NO_IPL_CODE , READ_BBT_CODE to NO_READ_BBT_CODE.
* Made sure that forceddownload is active when HW_OTP compilation flag is defined.
* Removed 2 redundant ALE down calls.
* Change all 2 consequative read operation to for in order to prevent compiler optimizations.
*
* Rev 1.17 May 06 2001 22:41:52 oris
* Bug fix - checking for access error was moved. After every set address operation and after erase confirm.
* Bug fix - readBBT for unaligned units.
* Removed warnings.
* redundant was misspelled.
*
* Rev 1.16 May 02 2001 07:29:50 oris
* flInterleaveError was misspelled.
* Added the BBT_UNAVAIL_UNIT defintion.
*
* Rev 1.15 May 01 2001 14:22:56 oris
* Bug fix - reading BBT of cascaded device.
*
* Rev 1.14 Apr 30 2001 18:01:54 oris
* Bug fix - Several ifdef caused exception since MTD buffer was not allocated.
* Use erasableBlockSizeBits instead of erasableBlockSize when posible.
* Added EDC check when reading the BBT.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -