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

📄 flsystem.h

📁 H3 M-system NAND flash driver in Linux OS, M-DOC driver
💻 H
字号:
/****************************************************************************** *                                                                            * * Project: DOC Driver for Linux 2.6 Block device driver for mDOC H3  family  * * of devices under Linux kernel 2.6.                                         * *                                                                            * *   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.                   * *                                                                            * ******************************************************************************//* * $Log$ */#ifndef FLSYSTEM_H#define FLSYSTEM_H#include "flcustom.h"#include "tffsarch.h"#include <linux/types.h>#include <linux/string.h>#include <asm/io.h>#ifdef __KERNEL__# include <asm/current.h>#endif#define NAMING_CONVENTION      /* don't change me */#define TFFS_DLL_API#define FL_PACKED_STRUCTURES __attribute__ ((packed))#ifndef TRUE# define TRUE 1#endif#ifndef FALSE# define FALSE 0#endif#define FAR_LEVEL 0#define FLMutex   int#ifndef FL_IOCTL_START# define FL_IOCTL_LNX   0  /* don't change */# define FL_IOCTL_START 1  /* don't change */#endif/* * "yield CPU and sleep" implementation for G4/G3/H1 DiskOnChip devices */#define FL_TFFS_SLEEP(handle,microseconds) fl_tffs_sleep((unsigned int)(handle),(microseconds))extern void fl_tffs_sleep (unsigned int handle, unsigned long microseconds);/* * "yield CPU and sleep" implementation for H3 DiskOnChip devices */#define DOCH_SLEEP(soc,dev,microseconds) doch_sleep((soc),(microseconds))extern void doch_sleep (unsigned int soc, unsigned long microseconds);/* * macros for printing debug messages  */#define DBG_PRINT_FLOW(zone,str)     do { if(fl_debug & 4) {LnxTffsPrint(str);} } while(0)#define DBG_PRINT_FLOW_PRM(zone,str) do { if(fl_debug & 4) {LnxTffsPrint str; } } while(0)#define DBG_PRINT_WRN(zone,str)      do { if(fl_debug & 2) {LnxTffsPrint(str);} } while(0)#define DBG_PRINT_WRN_PRM(zone,str)  do { if(fl_debug & 2) {LnxTffsPrint str; } } while(0)#define DBG_PRINT_ERR(zone,str)      do { if(fl_debug & 1) {LnxTffsPrint(str);} } while(0)#define DBG_PRINT_ERR_PRM(zone,str)  do { if(fl_debug & 1) {LnxTffsPrint str; } } while(0)extern int LnxTffsPrint (const char *fmt, ...);extern int fl_debug;/*  * dynamic memory allocation/freeing */#define FL_MALLOC TffsMalloc#define FL_FREE   TffsFreeextern void * TffsMalloc (unsigned long size);extern void  TffsFree (void *vptr);/*  * Macro DOCH_SYS_FUNC_RELEASE is invoked when rmmod is called */#define DOCH_SYS_FUNC_RELEASE LnxSysfunRelease()extern void LnxSysfunRelease (void);/* * pointer manupulation macros */#define physicalToPointer(paddr,size,drive) ((void *) (paddr))#define addToFarPointer(ptr,val)            ((void *) ((unsigned char *) (ptr) + (val)))#define freePointer(ptr,size)               /* do nothing *//*  * macros tffscpy/tffscmp/tffsset are used with RAM buffers only */#define tffscpy  memcpy#define tffscmp  memcmp#define tffsset  memset/*  * macros for writing byte/short word/long word to I/O memory */#define FLWRITE_IO_BYTE(val,addr)  writeb((unsigned char) (val),(volatile unsigned char *)(addr))#define FLWRITE_IO_WORD(val,addr)  writew((unsigned short)(val),(volatile unsigned short*)(addr))#define FLWRITE_IO_DWORD(val,addr) writel((unsigned long) (val),(volatile unsigned long *)(addr))/*  * macros for reading byte/short word/long word from I/O memory */#define FLREAD_IO_BYTE(addr)       readb((volatile unsigned char*) (addr))#define FLREAD_IO_WORD(addr)       readw((volatile unsigned short*)(addr))#define FLREAD_IO_DWORD(addr)      readl((volatile unsigned long*) (addr))/*  * macros for transferring data blocks to I/O memory */#define TFFSCPY_FROM_IO(dest,src,cnt)         memcpy_fromio((dest),(void*)(src),(cnt))#define TFFSCPY_FROM_IO_8_BITS                TFFSCPY_FROM_IO#define TFFSCPY_FROM_IO_16_BITS               TFFSCPY_FROM_IO/*  * macros for transferring data blocks from I/O memory */#define TFFSCPY_TO_IO(dest,src,cnt)           memcpy_toio((void*)(dest),(src),(cnt))#define TFFSCPY_TO_IO_8_BITS                  TFFSCPY_TO_IO#define TFFSCPY_TO_IO_16_BITS                 TFFSCPY_TO_IO/*  * macros for memset-like operations on I/O memory */#define TFFSSET_IO(dest,val,cnt)               memset_io((void*)(dest),(val),(cnt))#define TFFSSET_IO_8_BITS                      TFFSSET_IO#define TFFSSET_IO_16_BITS                     TFFSSET_IOextern int tffs_irq;extern void tffs_irq_enable (int lock);extern void tffs_irq_disable (int lock);#endif /* FLSYSTEM_H */

⌨️ 快捷键说明

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