亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? doc2000.c

?? 自己根據(jù)lkd和情境分析
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * Linux driver for Disk-On-Chip 2000 and Millennium * (c) 1999 Machine Vision Holdings, Inc. * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> * * $Id: doc2000.c,v 1.1.1.1 2004/02/04 12:56:23 laputa Exp $ */#include <linux/kernel.h>#include <linux/module.h>#include <asm/errno.h>#include <asm/io.h>#include <asm/uaccess.h>#include <linux/miscdevice.h>#include <linux/pci.h>#include <linux/delay.h>#include <linux/slab.h>#include <linux/sched.h>#include <linux/init.h>#include <linux/types.h>#include <linux/mtd/mtd.h>#include <linux/mtd/nand.h>#include <linux/mtd/nand_ids.h>#include <linux/mtd/doc2000.h>#define DOC_SUPPORT_2000#define DOC_SUPPORT_MILLENNIUM#ifdef DOC_SUPPORT_2000#define DoC_is_2000(doc) (doc->ChipID == DOC_ChipID_Doc2k)#else#define DoC_is_2000(doc) (0)#endif#ifdef DOC_SUPPORT_MILLENNIUM#define DoC_is_Millennium(doc) (doc->ChipID == DOC_ChipID_DocMil)#else#define DoC_is_Millennium(doc) (0)#endif/* #define ECC_DEBUG *//* I have no idea why some DoC chips can not use memcpy_from|to_io(). * This may be due to the different revisions of the ASIC controller built-in or * simplily a QA/Bug issue. Who knows ?? If you have trouble, please uncomment * this: #undef USE_MEMCPY*/static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,		    size_t *retlen, u_char *buf);static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,		     size_t *retlen, const u_char *buf);static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,			size_t *retlen, u_char *buf, u_char *eccbuf);static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,			 size_t *retlen, const u_char *buf, u_char *eccbuf);static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,			size_t *retlen, u_char *buf);static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,			 size_t *retlen, const u_char *buf);static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len,			 size_t *retlen, const u_char *buf);static int doc_erase (struct mtd_info *mtd, struct erase_info *instr);static struct mtd_info *doc2klist = NULL;/* Perform the required delay cycles by reading from the appropriate register */static void DoC_Delay(struct DiskOnChip *doc, unsigned short cycles){	volatile char dummy;	int i;		for (i = 0; i < cycles; i++) {		if (DoC_is_Millennium(doc))			dummy = ReadDOC(doc->virtadr, NOP);		else			dummy = ReadDOC(doc->virtadr, DOCStatus);	}	}/* DOC_WaitReady: Wait for RDY line to be asserted by the flash chip */static int _DoC_WaitReady(struct DiskOnChip *doc){	unsigned long docptr = doc->virtadr;	unsigned long timeo = jiffies + (HZ * 10);	DEBUG(MTD_DEBUG_LEVEL3,	      "_DoC_WaitReady called for out-of-line wait\n");	/* Out-of-line routine to wait for chip response */	while (!(ReadDOC(docptr, CDSNControl) & CDSN_CTRL_FR_B)) {		if (time_after(jiffies, timeo)) {			DEBUG(MTD_DEBUG_LEVEL2, "_DoC_WaitReady timed out.\n");			return -EIO;		}		if (current->need_resched) {			set_current_state(TASK_UNINTERRUPTIBLE);			schedule_timeout(1);		}		else			udelay(1);	}	return 0;}static inline int DoC_WaitReady(struct DiskOnChip *doc){	unsigned long docptr = doc->virtadr;	/* This is inline, to optimise the common case, where it's ready instantly */	int ret = 0;	/* 4 read form NOP register should be issued in prior to the read from CDSNControl	   see Software Requirement 11.4 item 2. */	DoC_Delay(doc, 4);	if (!(ReadDOC(docptr, CDSNControl) & CDSN_CTRL_FR_B))		/* Call the out-of-line routine to wait */		ret = _DoC_WaitReady(doc);	/* issue 2 read from NOP register after reading from CDSNControl register	   see Software Requirement 11.4 item 2. */	DoC_Delay(doc, 2);	return ret;}/* DoC_Command: Send a flash command to the flash chip through the CDSN Slow IO register to   bypass the internal pipeline. Each of 4 delay cycles (read from the NOP register) is   required after writing to CDSN Control register, see Software Requirement 11.4 item 3. */static inline int DoC_Command(struct DiskOnChip *doc, unsigned char command,			      unsigned char xtraflags){	unsigned long docptr = doc->virtadr;	if (DoC_is_2000(doc))		xtraflags |= CDSN_CTRL_FLASH_IO;	/* Assert the CLE (Command Latch Enable) line to the flash chip */	WriteDOC(xtraflags | CDSN_CTRL_CLE | CDSN_CTRL_CE, docptr, CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	if (DoC_is_Millennium(doc))		WriteDOC(command, docptr, CDSNSlowIO);	/* Send the command */	WriteDOC_(command, docptr, doc->ioreg);	/* Lower the CLE line */	WriteDOC(xtraflags | CDSN_CTRL_CE, docptr, CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	/* Wait for the chip to respond - Software requirement 11.4.1 (extended for any command) */	return DoC_WaitReady(doc);}/* DoC_Address: Set the current address for the flash chip through the CDSN Slow IO register to   bypass the internal pipeline. Each of 4 delay cycles (read from the NOP register) is   required after writing to CDSN Control register, see Software Requirement 11.4 item 3. */static int DoC_Address(struct DiskOnChip *doc, int numbytes, unsigned long ofs,		       unsigned char xtraflags1, unsigned char xtraflags2){	unsigned long docptr;	int i;	docptr = doc->virtadr;	if (DoC_is_2000(doc))		xtraflags1 |= CDSN_CTRL_FLASH_IO;	/* Assert the ALE (Address Latch Enable) line to the flash chip */	WriteDOC(xtraflags1 | CDSN_CTRL_ALE | CDSN_CTRL_CE, docptr, CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	/* Send the address */	/* Devices with 256-byte page are addressed as:	   Column (bits 0-7), Page (bits 8-15, 16-23, 24-31)	   * there is no device on the market with page256	   and more than 24 bits.	   Devices with 512-byte page are addressed as:	   Column (bits 0-7), Page (bits 9-16, 17-24, 25-31)	   * 25-31 is sent only if the chip support it.	   * bit 8 changes the read command to be sent	   (NAND_CMD_READ0 or NAND_CMD_READ1).	 */	if (numbytes == ADDR_COLUMN || numbytes == ADDR_COLUMN_PAGE) {		if (DoC_is_Millennium(doc))			WriteDOC(ofs & 0xff, docptr, CDSNSlowIO);		WriteDOC_(ofs & 0xff, docptr, doc->ioreg);	}	if (doc->page256) {		ofs = ofs >> 8;	} else {		ofs = ofs >> 9;	}	if (numbytes == ADDR_PAGE || numbytes == ADDR_COLUMN_PAGE) {		for (i = 0; i < doc->pageadrlen; i++, ofs = ofs >> 8) {			if (DoC_is_Millennium(doc))				WriteDOC(ofs & 0xff, docptr, CDSNSlowIO);			WriteDOC_(ofs & 0xff, docptr, doc->ioreg);		}	}	DoC_Delay(doc, 2);	/* Needed for some slow flash chips. mf. */		/* FIXME: The SlowIO's for millennium could be replaced by 	   a single WritePipeTerm here. mf. */	/* Lower the ALE line */	WriteDOC(xtraflags1 | xtraflags2 | CDSN_CTRL_CE, docptr,		 CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	/* Wait for the chip to respond - Software requirement 11.4.1 */	return DoC_WaitReady(doc);}/* Read a buffer from DoC, taking care of Millennium odditys */static void DoC_ReadBuf(struct DiskOnChip *doc, u_char * buf, int len){	volatile int dummy;	int modulus = 0xffff;	unsigned long docptr;	int i;	docptr = doc->virtadr;	if (len <= 0)		return;	if (DoC_is_Millennium(doc)) {		/* Read the data via the internal pipeline through CDSN IO register,		   see Pipelined Read Operations 11.3 */		dummy = ReadDOC(docptr, ReadPipeInit);		/* Millennium should use the LastDataRead register - Pipeline Reads */		len--;		/* This is needed for correctly ECC calculation */		modulus = 0xff;	}	for (i = 0; i < len; i++)		buf[i] = ReadDOC_(docptr, doc->ioreg + (i & modulus));	if (DoC_is_Millennium(doc)) {		buf[i] = ReadDOC(docptr, LastDataRead);	}}/* Write a buffer to DoC, taking care of Millennium odditys */static void DoC_WriteBuf(struct DiskOnChip *doc, const u_char * buf, int len){	unsigned long docptr;	int i;	docptr = doc->virtadr;	if (len <= 0)		return;	for (i = 0; i < len; i++)		WriteDOC_(buf[i], docptr, doc->ioreg + i);	if (DoC_is_Millennium(doc)) {		WriteDOC(0x00, docptr, WritePipeTerm);	}}/* DoC_SelectChip: Select a given flash chip within the current floor */static inline int DoC_SelectChip(struct DiskOnChip *doc, int chip){	unsigned long docptr = doc->virtadr;	/* Software requirement 11.4.4 before writing DeviceSelect */	/* Deassert the CE line to eliminate glitches on the FCE# outputs */	WriteDOC(CDSN_CTRL_WP, docptr, CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	/* Select the individual flash chip requested */	WriteDOC(chip, docptr, CDSNDeviceSelect);	DoC_Delay(doc, 4);	/* Reassert the CE line */	WriteDOC(CDSN_CTRL_CE | CDSN_CTRL_FLASH_IO | CDSN_CTRL_WP, docptr,		 CDSNControl);	DoC_Delay(doc, 4);	/* Software requirement 11.4.3 for Millennium */	/* Wait for it to be ready */	return DoC_WaitReady(doc);}/* DoC_SelectFloor: Select a given floor (bank of flash chips) */static inline int DoC_SelectFloor(struct DiskOnChip *doc, int floor){	unsigned long docptr = doc->virtadr;	/* Select the floor (bank) of chips required */	WriteDOC(floor, docptr, FloorSelect);	/* Wait for the chip to be ready */	return DoC_WaitReady(doc);}/* DoC_IdentChip: Identify a given NAND chip given {floor,chip} */static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip){	int mfr, id, i;	volatile char dummy;	/* Page in the required floor/chip */	DoC_SelectFloor(doc, floor);	DoC_SelectChip(doc, chip);	/* Reset the chip */	if (DoC_Command(doc, NAND_CMD_RESET, CDSN_CTRL_WP)) {		DEBUG(MTD_DEBUG_LEVEL2,		      "DoC_Command (reset) for %d,%d returned true\n",		      floor, chip);		return 0;	}	/* Read the NAND chip ID: 1. Send ReadID command */	if (DoC_Command(doc, NAND_CMD_READID, CDSN_CTRL_WP)) {		DEBUG(MTD_DEBUG_LEVEL2,		      "DoC_Command (ReadID) for %d,%d returned true\n",		      floor, chip);		return 0;	}	/* Read the NAND chip ID: 2. Send address byte zero */	DoC_Address(doc, ADDR_COLUMN, 0, CDSN_CTRL_WP, 0);	/* Read the manufacturer and device id codes from the device */	/* CDSN Slow IO register see Software Requirement 11.4 item 5. */	dummy = ReadDOC(doc->virtadr, CDSNSlowIO);	DoC_Delay(doc, 2);	mfr = ReadDOC_(doc->virtadr, doc->ioreg);	/* CDSN Slow IO register see Software Requirement 11.4 item 5. */	dummy = ReadDOC(doc->virtadr, CDSNSlowIO);	DoC_Delay(doc, 2);	id = ReadDOC_(doc->virtadr, doc->ioreg);	/* No response - return failure */	if (mfr == 0xff || mfr == 0)		return 0;	/* Check it's the same as the first chip we identified. 	 * M-Systems say that any given DiskOnChip device should only	 * contain _one_ type of flash part, although that's not a 	 * hardware restriction. */	if (doc->mfr) {		if (doc->mfr == mfr && doc->id == id)			return 1;	/* This is another the same the first */		else			printk(KERN_WARNING			       "Flash chip at floor %d, chip %d is different:\n",			       floor, chip);	}	/* Print and store the manufacturer and ID codes. */	for (i = 0; nand_flash_ids[i].name != NULL; i++) {		if (mfr == nand_flash_ids[i].manufacture_id &&		    id == nand_flash_ids[i].model_id) {			printk(KERN_INFO			       "Flash chip found: Manufacturer ID: %2.2X, "			       "Chip ID: %2.2X (%s)\n", mfr, id,			       nand_flash_ids[i].name);			if (!doc->mfr) {				doc->mfr = mfr;				doc->id = id;				doc->chipshift =				    nand_flash_ids[i].chipshift;				doc->page256 = nand_flash_ids[i].page256;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美大片在线观看一区二区| 蜜桃视频一区二区| 成人av电影免费观看| 亚洲国产成人自拍| 99久久婷婷国产| 亚洲欧美日韩系列| 欧美日韩视频第一区| 日韩在线一区二区| 久久久亚洲精品一区二区三区| 国产一区二区三区最好精华液| 久久精品视频一区二区| 99久久国产免费看| 亚洲成人高清在线| 精品国产百合女同互慰| 成人av网址在线| 午夜影院在线观看欧美| 欧美va天堂va视频va在线| 国产成人在线免费| 亚洲日本成人在线观看| 91麻豆精品国产91久久久久| 国产精品综合视频| 一区二区三区高清在线| 91麻豆精品国产91久久久使用方法| 国产在线看一区| 亚洲欧美色一区| 欧美mv日韩mv国产| gogo大胆日本视频一区| 亚洲一区二区三区四区不卡| 精品少妇一区二区三区在线播放| 国产超碰在线一区| 日韩精品免费视频人成| 国产精品色噜噜| 4hu四虎永久在线影院成人| 国产a区久久久| 日韩高清在线不卡| 亚洲激情图片qvod| 久久久久9999亚洲精品| 欧美亚洲一区二区三区四区| 国产精品91一区二区| 亚洲综合在线五月| 亚洲国产成人午夜在线一区| 在线综合+亚洲+欧美中文字幕| 99精品久久久久久| 国产一区二区三区av电影| 亚洲愉拍自拍另类高清精品| 久久久久久久综合狠狠综合| 欧美日韩免费视频| 97精品久久久午夜一区二区三区| 裸体健美xxxx欧美裸体表演| 一区二区欧美视频| 中文字幕精品综合| 精品国产一区二区三区忘忧草 | 精品视频一区 二区 三区| 国内精品嫩模私拍在线| 亚洲一区二区三区在线| 中文字幕成人av| 久久精品一区二区三区不卡牛牛| 欧美日本一区二区在线观看| www.成人在线| 国产99精品在线观看| 国产在线精品一区二区夜色 | 激情六月婷婷久久| 日本一不卡视频| 亚洲va欧美va人人爽午夜| 亚洲欧美乱综合| 综合久久久久久| 国产精品久久久久一区 | 成人av小说网| 成人免费视频免费观看| 国产一区欧美二区| 精品无人区卡一卡二卡三乱码免费卡 | 一区在线观看视频| 国产亚洲欧美中文| 亚洲国产精品成人综合| 国产免费成人在线视频| 久久精品一区二区三区四区| 久久久午夜电影| 久久综合九色综合97婷婷| 日韩欧美不卡在线观看视频| 91麻豆精品国产自产在线| 正在播放亚洲一区| 精品日韩99亚洲| www国产亚洲精品久久麻豆| 久久综合狠狠综合久久综合88| 日韩视频一区二区在线观看| 日韩精品中文字幕在线不卡尤物| 日韩女优毛片在线| 久久综合九色欧美综合狠狠| 国产日韩影视精品| 亚洲欧洲日产国码二区| 亚洲另类在线视频| 一区二区三区日韩精品视频| 亚洲国产色一区| 另类小说视频一区二区| 国产黑丝在线一区二区三区| 国产精品一区二区在线播放| 99久久精品一区二区| 在线观看视频一区| 欧美一区二区三区不卡| 久久久久久免费网| 亚洲图片你懂的| 亚洲二区在线视频| 蜜桃一区二区三区在线观看| 国产精品一二三四区| 99久久99久久精品国产片果冻| 欧日韩精品视频| 精品日韩一区二区三区| 亚洲国产成人一区二区三区| 一二三区精品视频| 韩国v欧美v亚洲v日本v| 99这里只有久久精品视频| 欧美日韩国产一级片| 久久久久久久久一| 亚洲欧美日韩久久| 蜜桃一区二区三区在线| av不卡免费电影| 欧美一区二区三区四区五区| 国产嫩草影院久久久久| 日韩高清一区二区| voyeur盗摄精品| 欧美一区二区高清| 亚洲情趣在线观看| 久久 天天综合| 日本韩国视频一区二区| 久久免费的精品国产v∧| 亚洲一区二区视频| 成人毛片老司机大片| 91精品国产综合久久久蜜臀粉嫩| 国产欧美精品一区| 日韩av一二三| 色婷婷久久久综合中文字幕 | 天堂va蜜桃一区二区三区漫画版| 夫妻av一区二区| 欧美一级生活片| 亚洲理论在线观看| 丰满少妇在线播放bd日韩电影| 5858s免费视频成人| 亚洲美女少妇撒尿| 成人免费视频app| 精品国产乱码久久久久久图片 | 日韩av成人高清| 在线观看欧美黄色| 国产精品久久久久aaaa樱花| 精品制服美女丁香| 欧美精品v日韩精品v韩国精品v| 中文字幕一区二| 粉嫩av一区二区三区在线播放| 日韩欧美视频一区| 日韩综合小视频| 欧美精选一区二区| 亚洲一级二级在线| 91精品福利视频| 成人欧美一区二区三区在线播放| 国模套图日韩精品一区二区| 91麻豆精品91久久久久同性| 午夜视频在线观看一区二区 | 久久精品国产在热久久| 欧美日韩一区二区三区在线 | 91美女视频网站| 国产精品不卡一区| 成人18视频日本| 国产精品电影一区二区| 成人精品视频一区二区三区尤物| 精品999在线播放| 激情文学综合插| 久久午夜老司机| 国产精品18久久久久久久久| 久久综合五月天婷婷伊人| 精品一区二区在线视频| 久久综合资源网| 成人免费视频视频| 亚洲同性同志一二三专区| 91免费在线视频观看| 一区二区三区精品在线观看| 欧美在线观看一区| 日韩精品1区2区3区| 日韩一区二区三区电影| 裸体健美xxxx欧美裸体表演| 精品第一国产综合精品aⅴ| 国产精品原创巨作av| 国产精品嫩草99a| 色哟哟精品一区| 午夜视频在线观看一区| 欧美大片一区二区三区| 国产美女娇喘av呻吟久久| 国产日韩欧美在线一区| 97aⅴ精品视频一二三区| 亚洲一二三区不卡| 日韩亚洲欧美一区二区三区| 国产精品自拍毛片| 中文字幕日本乱码精品影院| 在线视频一区二区三| 青青草伊人久久| 亚洲国产精品成人久久综合一区| 色悠久久久久综合欧美99| 日韩国产欧美三级| 欧美国产日韩亚洲一区| 在线免费观看视频一区| 美女看a上一区| 国产精品高清亚洲|