⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _docsys.h

📁 H3 M-system NAND flash driver in Linux OS, M-DOC driver
💻 H
字号:
/****************************************************************************** *                                                                            * * Project: DOC Driver for Linux 2.4 Block device driver for mDOC H3  family  * * of devices under Linux kernel 2.4.                                         * *                                                                            * *   Version: 1.0                                                             * *   Email questions to: oemsupport@sandisk.com                               * *   Copyright (C) SanDisk IL Ltd. 1995 - 2007                                * *   SanDisk IL Ltd., 7 Atir Yeda Street, Kfar Saba 44425, Israel             * *                                                                            * ****************************************************************************** *                                                                            * * This program is free software; you can redistribute it and/or modify it    * * under the terms of the GNU General Public License as published by the Free * * Software Foundation; either version 2 of the License, or any later version.* * This program is distributed in the hope that it will be useful, but WITHOUT* * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      * * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for  * * more details, which is set forth in the readme.txt file.                   * * You should have received a copy of the GNU General Public License along    * * with this program; if not, write to the Free Software Foundation, Inc., 51 * * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA                    * *                                                                            * * This License does not grant you any right to use the trademarks, service   * * marks or logos of SanDisk IL Ltd. or SanDisk Corporation.                  * * Subject to the foregoing, SanDisk IL Ltd., for itself and on behalf of its * * licensors, hereby reserves all intellectual property rights in the program,* * except for the rights expressly granted in this License.                   * *                                                                            * ******************************************************************************/
/************************************************************************                                                                      * 
 *                          I M P O R T A N T                           *  
 *                                                                      * 
 * The file contains DiskOnChip memory access routines and macros       * 
 * defintions.                                                          * 
 *                                                                      * 
 * In order to use the complete set of TrueFFS memory access routine    * 
 * that allows runtime configuration of each socket access type make    * 
 * sure the FL_NO_USE_FUNC is not defined in FLCUSTOM.H:                * 
 *                                                                      * 
 * If you know the exact configuration of your application you can      * 
 * uncomment the FL_NO_USE_FUNC definition and set the proper access    * 
 * type using the macroe defintion bellow.                              * 
 *                                                                      * 
 ************************************************************************/
/*
 * $Log:   V:/PVCSDB/DiskOnChip/archives/Testing/TrueFFS 6.3/Drop 2.5/3/bddoc/src/_docsys.h-arc  $
 * 
 *    Rev 1.2.1.1   Sep 11 2006 13:45:10   yaniv.iarovici
 * Legal header added
 * 
 *    Rev 1.2.1.0   Aug 08 2006 15:55:34   Polina.Marimont
 * DOC Driver 1.0 initial
 */


#ifndef _DOCSYS_H
#define _DOCSYS_H

#include "defs.h"

#ifdef FL_NO_USE_FUNC 

/*--------------------------------------------------------------------------*/

/* Default access layer for 16 bit configuration */

#ifndef flDirectWrite8BitReg
#ifdef FL_BIG_ENDIAN
#define flDirectWrite8BitReg(flash,offset,val) \
        FLWRITE_IO_WORD((((FLWord)val)<<8),((volatile FLWord FAR0 *)((flash)->win)+((offset)>>1)))
#else
#define flDirectWrite8BitReg(flash,offset,val) \
        FLWRITE_IO_WORD(((FLWord)val),((volatile FLWord FAR0 *)((flash)->win)+((offset)>>1)))
#endif /* FL_BIG_ENDIAN */
#endif /* flDirectWrite8BitReg */

#ifndef flDirectWrite16BitReg
#define flDirectWrite16BitReg(flash,offset,val) \
        FLWRITE_IO_WORD(val,((volatile FLByte FAR0 *)((flash)->win)+(offset)))
#endif /* flDirectWrite16BitReg */

#ifndef flDirectRead8BitReg
#ifdef FL_BIG_ENDIAN
#define flDirectRead8BitReg(flash,offset)                 \
        (Reg8bitType)(((offset & 0x1) == 0) ?             \
		  ((FLREAD_IO_WORD((volatile FLWord FAR0 *)((flash)->win)+((offset)>>1))) >> 8) : \
          ((FLREAD_IO_WORD((volatile FLWord FAR0 *)((flash)->win)+((offset)>>1)))     )   )
#else
#define flDirectRead8BitReg(flash,offset)                 \
        (Reg8bitType)(((offset & 0x1) != 0) ?             \
		  ((FLREAD_IO_WORD((volatile FLWord FAR0 *)((flash)->win)+((offset)>>1))) >> 8) : \
          ((FLREAD_IO_WORD((volatile FLWord FAR0 *)((flash)->win)+((offset)>>1)))     )   )
#endif /* FL_BIG_ENDIAN */
#endif /* flDirectRead8BitReg */

#ifndef flDirectRead16BitReg 
#define flDirectRead16BitReg(flash,offset) \
	    FLREAD_IO_WORD((flash)->win+(offset))
#endif

#ifndef flReadEvenNumberOfBytes
#define flReadEvenNumberOfBytes(flash,offset,dest,count) \
	    TFFSCPY_FROM_IO_16_BITS( dest,((flash)->win + (offset)), count) 
#endif

#ifndef flWriteEvenNumberOfBytes
#define flWriteEvenNumberOfBytes(flash,offset,src,count) \
	    TFFSCPY_TO_IO_16_BITS(((flash)->win + (offset)),src,count)
#endif

#ifndef flRead512Bytes
#define flRead512Bytes(flash,offset,dest)                flReadEvenNumberOfBytes(flash,offset,dest,512)
#endif

#ifndef flWrite512Bytes
#define flWrite512Bytes(flash,offset,src)                flWriteEvenNumberOfBytes(flash,offset,src,512)
#endif

#ifndef flDocWindow
#define flDocWindow(flash)                               (0x2000)
#endif

/*--------------------------------------------------------------------------*/

#else /* FL_NO_USE_FUNC */

/*--------------------------------------------------------------------------*/

/* Redirect to runtime access layer */

#ifndef flDirectWrite8BitReg
#define flDirectWrite8BitReg(flash,offset,val)           (flash)->memWrite8bit((flash)->win,offset,val)
#endif

#ifndef flDirectWrite16BitReg
#define flDirectWrite16BitReg(flash,offset,val)          (flash)->memWrite16bit((flash)->win,offset,val)
#endif

#ifndef flDirectRead8BitReg
#define flDirectRead8BitReg(flash,offset)                (flash)->memRead8bit((flash)->win,offset)
#endif

#ifndef flDirectRead16BitReg 
#define flDirectRead16BitReg(flash,offset)               (flash)->memRead16bit((flash)->win,offset)
#endif

#ifndef flReadEvenNumberOfBytes
#define flReadEvenNumberOfBytes(flash,offset,dest,count) (flash)->memRead((flash)->win,offset,dest,count)
#endif

#ifndef flWriteEvenNumberOfBytes
#define flWriteEvenNumberOfBytes(flash,offset,src,count) (flash)->memWrite((flash)->win,offset,src,count)
#endif

#ifndef flRead512Bytes
#define flRead512Bytes(flash,offset,dest)                flReadEvenNumberOfBytes(flash,offset,dest,512)
#endif

#ifndef flWrite512Bytes
#define flWrite512Bytes(flash,offset,src)                flWriteEvenNumberOfBytes(flash,offset,src,512)
#endif

#ifndef flDocWindow
#define flDocWindow(flash)                               (flash->memWindowSize())
#endif

/*--------------------------------------------------------------------------*/

/* (private) types of DiskOnChip access configurations */

#define FL_8BIT_DOC_ACCESS         0x00000000L /* Has 8 data bits            */
#define FL_16BIT_DOC_ACCESS        0x00000100L /* Has 16 data bits           */
#define FL_XX_DATA_BITS_MASK       0x00000300L /* Mask of the above          */
#define FL_8BIT_FLASH_ACCESS       0x00000400L /* 8 bits of flash per cycle  */
#define FL_16BIT_FLASH_ACCESS      0x00000800L /* 16 bits of flash per cycle */
#define FL_XX_FLASH_ACCESS_MASK    0x00000C00L /* Mask of the above          */

#define FL_ACCESS_USER_DEFINED     0x00001000L /* User defined routines */

/* DiskOnChip routines prototypes */

extern FLStatus FAR1 setBusTypeOfFlash(FLFlash * flash,FLDword access);

#endif /* FL_NO_USE_FUNC */
#endif /* DOCSYS_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -