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

📄 tffsarch.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 TFFSARCH_H#define TFFSARCH_H/* * includes */#include <linux/version.h>#include <linux/autoconf.h>/*  * Physical address of DiskOnChip device.  * * M-Systems provides default values for variety of popular boards (see also * documentation for respective DiskOnChip adaptors for these boards). If you * are using different board, you'll need to define TFFS_PHYS_ADDR as * appropriate for your system. */#if defined(CONFIG_ARCH_MAINSTONE) || defined(CONFIG_MACH_MAINSTONE)# define TFFS_PHYS_ADDR 0x14000000  /* chip select CS5 on Intel PXA27x Mainstone */#elif defined(CONFIG_ARCH_LUBBOCK)# define TFFS_PHYS_ADDR 0x14000000#elif defined(CONFIG_ARCH_OMAP24XX)# define TFFS_PHYS_ADDR 0x10000000  /* chip select CS2 on Texas Instruments OMAP2420 */#elif defined(CONFIG_OMAP_H2) || defined(CONFIG_MACH_OMAP_H2)# define TFFS_PHYS_ADDR 0x8000000#elif defined(CONFIG_OMAP_OSK)# define TFFS_PHYS_ADDR 0x6000000#elif defined(CONFIG_M386) || defined(CONFIG_M486) || defined(CONFIG_M586) || defined(CONFIG_M586TSC) || defined(CONFIG_M586MMX) || defined(CONFIG_M686) || defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUM4)# define TFFS_PHYS_ADDR 0xd0000#else# define TFFS_PHYS_ADDR 0#endifextern unsigned long tffs_addr [];/*  * Board's IRQ line that DiskOnChip's IREQ is connected to. * * M-Systems provides default values for variety of popular boards (see also * documentation for respective DiskOnChip adaptors for these boards). If you * are using different board, you'll need to define TFFS_IRQ as * appropriate for your system, or set it to (-1) if you don't want to use * DiskOnChip IREQ. */#if defined(CONFIG_ARCH_MAINSTONE) || defined(CONFIG_MACH_MAINSTONE)# define TFFS_IRQ  MAINSTONE_IRQ(7)  /* Intel PXA27x ("Mainstone") */#elif defined(CONFIG_ARCH_LUBBOCK)# define TFFS_IRQ (-1)#elif defined(CONFIG_ARCH_OMAP24XX)# define TFFS_IRQ (-1)  /* OMAP_GPIO_IRQ_NO(94), if using GPIO line 94 */#elif defined(CONFIG_OMAP_H2) || defined(CONFIG_MACH_OMAP_H2)   /* Texas Instruments OMAP1610 SDP ("H2") */# define TFFS_IRQ (-1)  /* was INT_GPIO_9, or numerically 169 */#elif defined(CONFIG_OMAP_OSK)# define TFFS_IRQ (-1)#elif defined(CONFIG_M386) || defined(CONFIG_M486) || defined(CONFIG_M586) || defined(CONFIG_M586TSC) || defined(CONFIG_M586MMX) || defined(CONFIG_M686) || defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUM4)# define TFFS_IRQ (-1)#else# define TFFS_IRQ (-1)#endif/* # define FL_XSCALE_BOOT_MODE *//* DiskOnChip driver uses 'flRead512Bytes' macro to transfer 512-bytes of * data from DiskOnChip to destination RAM buffer. We check if s/w DMA * is enabled for 'read' operations, and if buffer is properly aligned. * If they are, we use s/w DMA to transfer data; otherwise we use TrueFFS' * internal C loops to transfer data in 16-bit short words. */  extern int tffs_dma_mode;    extern void tffs_readw (unsigned long io_vaddr, short *vbuf, int words);  extern void tffs_writew (unsigned long io_vaddr, short *vbuf, int words);  extern void tffs_dmasw (char *win, int off, void *vbuf, unsigned int bytes, int read);#if defined(CONFIG_ARCH_MAINSTONE) || defined(CONFIG_MACH_MAINSTONE) || defined(CONFIG_OMAP_H2) || defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_ARCH_OMAP24XX)# define flReadEvenNumberOfBytes(flash,off,vbuf,bytes)                                              \      (                                                                                             \          ((tffs_dma_mode & 1) && ((bytes) >= 512) && ((((long)(vbuf)) & (sizeof(long) - 1)) == 0)) \                           ?                                                                        \               tffs_dmasw(((char*)((flash)->win)),(off),(vbuf),(bytes),1)                           \                           :                                                                        \               tffs_readw(((unsigned long)(((char *)((flash)->win)) + (off))),((short*)(vbuf)),((bytes) / sizeof(short)))  \      )# define flWriteEvenNumberOfBytes(flash,off,vbuf,bytes)                                             \      (                                                                                             \          ((tffs_dma_mode & 2) && ((bytes) >= 512) && ((((long)(vbuf)) & (sizeof(long) - 1)) == 0)) \                           ?                                                                        \               tffs_dmasw(((char*)((flash)->win)),(off),(vbuf),(bytes),0)                           \                           :                                                                        \               tffs_writew(((unsigned long)((char*)((flash)->win) + (off))),((short*)(vbuf)),((bytes) / sizeof(short)))  \      )#else /* not Mainstone/OMAP1610/OMAP2420 */# define flReadEvenNumberOfBytes(flash,off,vbuf,bytes)  \               tffs_readw(((unsigned long)((char*)((flash)->win) + (off))),((short*)(vbuf)),((bytes) / sizeof(short)))# define flWriteEvenNumberOfBytes(flash,off,vbuf,bytes) \               tffs_writew(((unsigned long)((char*)((flash)->win) + (off))),((short*)(vbuf)),((bytes) / sizeof(short)))#endif /* ARCH *//* DiskOnChip driver uses DOCHBLK_READ and DOCHBLK_WRITE macros to transfer * data from and from (respectively) DiskOnChip H3 devices. */# define DOCHBLK_READ(reg_base,vbuf,sectors)   dochblk_read((vbuf),(sectors))# define DOCHBLK_WRITE(reg_base,vbuf,sectors)  dochblk_write((vbuf),(sectors))# if 0 /* andrayk June 23 2006: added for H3 burst */#   define DOCHREAD_BURST(reg_base,offset,vbuf,sectors)   dochblk_read((vbuf),(sectors))#   define DOCHWRITE_BURST(reg_base,offset,vbuf,sectors)  dochblk_write((vbuf),(sectors))#endifextern int dochblk_read (void *vbuf, unsigned int sectors);extern int dochblk_write (void *vbuf, unsigned int sectors);extern unsigned char tffsarch_init (int resume_flag);extern void TffsHWRelease (void);#ifdef CONFIG_ARCH_OMAP24XX  extern void omap24xx_enable_gpio_irq (int gpio_irq, int enable);#endif#endif /* TFFSARCH_H */

⌨️ 快捷键说明

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