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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nand_base.c

?? 嵌入式試驗箱S3C2410的bootloader源代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* *  drivers/mtd/nand.c * *  Overview: *   This is the generic MTD driver for NAND flash devices. It should be *   capable of working with almost all NAND chips currently available. *   Basic support for AG-AND chips is provided. * *	Additional technical information is available on *	http://www.linux-mtd.infradead.org/tech/nand.html * *  Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) * 		  2002 Thomas Gleixner (tglx@linutronix.de) * *  02-08-2004  tglx: support for strange chips, which cannot auto increment *		pages on read / read_oob * *  03-17-2004  tglx: Check ready before auto increment check. Simon Bayes *		pointed this out, as he marked an auto increment capable chip *		as NOAUTOINCR in the board driver. *		Make reads over block boundaries work too * *  04-14-2004	tglx: first working version for 2k page size chips * *  05-19-2004  tglx: Basic support for Renesas AG-AND chips * *  09-24-2004  tglx: add support for hardware controllers (e.g. ECC) shared *		among multiple independend devices. Suggestions and initial patch *		from Ben Dooks <ben-mtd@fluff.org> * * Credits: *	David Woodhouse for adding multichip support * *	Aleph One Ltd. and Toby Churchill Ltd. for supporting the *	rework for 2K page size chips * * TODO: *	Enable cached programming for 2k page size chips *	Check, if mtd->ecctype should be set to MTD_ECC_HW *	if we have HW ecc support. *	The AG-AND chips have nice features for speed improvement, *	which are not supported yet. Read / program 4 pages in one go. * * $Id: nand_base.c,v 1.126 2004/12/13 11:22:25 lavinen Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * *//* XXX U-BOOT XXX */#if 0#include <linux/delay.h>#include <linux/errno.h>#include <linux/sched.h>#include <linux/slab.h>#include <linux/types.h>#include <linux/mtd/mtd.h>#include <linux/mtd/nand.h>#include <linux/mtd/nand_ecc.h>#include <linux/mtd/compatmac.h>#include <linux/interrupt.h>#include <linux/bitops.h>#include <asm/io.h>#ifdef CONFIG_MTD_PARTITIONS#include <linux/mtd/partitions.h>#endif#endif#include <common.h>#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)#include <malloc.h>#include <watchdog.h>#include <linux/mtd/compat.h>#include <linux/mtd/mtd.h>#include <linux/mtd/nand.h>#include <linux/mtd/nand_ecc.h>#include <asm/io.h>#include <asm/errno.h>#ifdef CONFIG_JFFS2_NAND#include <jffs2/jffs2.h>#endif#if defined(CONFIG_S3C2400)#include <s3c2400.h>#elif defined(CONFIG_S3C2410)#include <s3c2410.h>#endif#ifdef CONFIG_SURPORT_WINCE#include "../../wince/loader.h"#endif/* Define default oob placement schemes for large and small page devices */static struct nand_oobinfo nand_oob_8 = {	.useecc = MTD_NANDECC_AUTOPLACE,	.eccbytes = 3,	.eccpos = {0, 1, 2},	.oobfree = { {3, 2}, {6, 2} }};static struct nand_oobinfo nand_oob_16 = {	.useecc = MTD_NANDECC_AUTOPLACE,	.eccbytes = 6,	.eccpos = {0, 1, 2, 3, 6, 7},	.oobfree = { {8, 8} }};static struct nand_oobinfo nand_oob_64 = {	.useecc = MTD_NANDECC_AUTOPLACE,	.eccbytes = 24,	.eccpos = {		40, 41, 42, 43, 44, 45, 46, 47,		48, 49, 50, 51, 52, 53, 54, 55,		56, 57, 58, 59, 60, 61, 62, 63},	.oobfree = { {2, 38} }};/* This is used for padding purposes in nand_write_oob */static u_char ffchars[] = {	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,};/* * NAND low-level MTD interface functions */static void nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len);static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len);static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len);static int nand_read (struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf);static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,			  size_t * retlen, u_char * buf, u_char * eccbuf, struct nand_oobinfo *oobsel);static int nand_read_oob (struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf);static int nand_write (struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char * buf);static int nand_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,			   size_t * retlen, const u_char * buf, u_char * eccbuf, struct nand_oobinfo *oobsel);static int nand_write_oob (struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char *buf);/* XXX U-BOOT XXX */#if 0static int nand_writev (struct mtd_info *mtd, const struct kvec *vecs,			unsigned long count, loff_t to, size_t * retlen);static int nand_writev_ecc (struct mtd_info *mtd, const struct kvec *vecs,			unsigned long count, loff_t to, size_t * retlen, u_char *eccbuf, struct nand_oobinfo *oobsel);#endifstatic int nand_erase (struct mtd_info *mtd, struct erase_info *instr);static void nand_sync (struct mtd_info *mtd);/* Some internal functions */static int nand_write_page (struct mtd_info *mtd, struct nand_chip *this, int page, u_char *oob_buf,		struct nand_oobinfo *oobsel, int mode);#ifdef CONFIG_MTD_NAND_VERIFY_WRITEstatic int nand_verify_pages (struct mtd_info *mtd, struct nand_chip *this, int page, int numpages,	u_char *oob_buf, struct nand_oobinfo *oobsel, int chipnr, int oobmode);#else#define nand_verify_pages(...) (0)#endifstatic void nand_get_device (struct nand_chip *this, struct mtd_info *mtd, int new_state);/** * nand_release_device - [GENERIC] release chip * @mtd:	MTD device structure * * Deselect, release chip lock and wake up anyone waiting on the device *//* XXX U-BOOT XXX */#if 0static void nand_release_device (struct mtd_info *mtd){	struct nand_chip *this = mtd->priv;	/* De-select the NAND device */	this->select_chip(mtd, -1);	/* Do we have a hardware controller ? */	if (this->controller) {		spin_lock(&this->controller->lock);		this->controller->active = NULL;		spin_unlock(&this->controller->lock);	}	/* Release the chip */	spin_lock (&this->chip_lock);	this->state = FL_READY;	wake_up (&this->wq);	spin_unlock (&this->chip_lock);}#elsestatic void nand_release_device (struct mtd_info *mtd){	struct nand_chip *this = mtd->priv;	this->select_chip(mtd, -1);	/* De-select the NAND device */}#endif/** * nand_read_byte - [DEFAULT] read one byte from the chip * @mtd:	MTD device structure * * Default read function for 8bit buswith */static u_char nand_read_byte(struct mtd_info *mtd){	struct nand_chip *this = mtd->priv;	return readb(this->IO_ADDR_R);}/** * nand_write_byte - [DEFAULT] write one byte to the chip * @mtd:	MTD device structure * @byte:	pointer to data byte to write * * Default write function for 8it buswith */static void nand_write_byte(struct mtd_info *mtd, u_char byte){	struct nand_chip *this = mtd->priv;	writeb(byte, this->IO_ADDR_W);}/** * nand_read_byte16 - [DEFAULT] read one byte endianess aware from the chip * @mtd:	MTD device structure * * Default read function for 16bit buswith with * endianess conversion */static u_char nand_read_byte16(struct mtd_info *mtd){	struct nand_chip *this = mtd->priv;	return (u_char) cpu_to_le16(readw(this->IO_ADDR_R));}/** * nand_write_byte16 - [DEFAULT] write one byte endianess aware to the chip * @mtd:	MTD device structure * @byte:	pointer to data byte to write * * Default write function for 16bit buswith with * endianess conversion */static void nand_write_byte16(struct mtd_info *mtd, u_char byte){	struct nand_chip *this = mtd->priv;	writew(le16_to_cpu((u16) byte), this->IO_ADDR_W);}/** * nand_read_word - [DEFAULT] read one word from the chip * @mtd:	MTD device structure * * Default read function for 16bit buswith without * endianess conversion */static u16 nand_read_word(struct mtd_info *mtd){	struct nand_chip *this = mtd->priv;	return readw(this->IO_ADDR_R);}/** * nand_write_word - [DEFAULT] write one word to the chip * @mtd:	MTD device structure * @word:	data word to write * * Default write function for 16bit buswith without * endianess conversion */static void nand_write_word(struct mtd_info *mtd, u16 word){	struct nand_chip *this = mtd->priv;	writew(word, this->IO_ADDR_W);}/** * nand_select_chip - [DEFAULT] control CE line * @mtd:	MTD device structure * @chip:	chipnumber to select, -1 for deselect * * Default select function for 1 chip devices. */static void nand_select_chip(struct mtd_info *mtd, int chip){	struct nand_chip *this = mtd->priv;	switch(chip) {	case -1:		this->hwcontrol(mtd, NAND_CTL_CLRNCE);		break;	case 0:		this->hwcontrol(mtd, NAND_CTL_SETNCE);		break;	default:		BUG();	}}/** * nand_write_buf - [DEFAULT] write buffer to chip * @mtd:	MTD device structure * @buf:	data buffer * @len:	number of bytes to write * * Default write function for 8bit buswith */static void nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	for (i=0; i<len; i++)		writeb(buf[i], this->IO_ADDR_W);}/** * nand_read_buf - [DEFAULT] read chip data into buffer * @mtd:	MTD device structure * @buf:	buffer to store date * @len:	number of bytes to read * * Default read function for 8bit buswith */static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	for (i=0; i<len; i++)		buf[i] = readb(this->IO_ADDR_R);}/** * nand_verify_buf - [DEFAULT] Verify chip data against buffer * @mtd:	MTD device structure * @buf:	buffer containing the data to compare * @len:	number of bytes to compare * * Default verify function for 8bit buswith */static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	for (i=0; i<len; i++)		if (buf[i] != readb(this->IO_ADDR_R))			return -EFAULT;	return 0;}/** * nand_write_buf16 - [DEFAULT] write buffer to chip * @mtd:	MTD device structure * @buf:	data buffer * @len:	number of bytes to write * * Default write function for 16bit buswith */static void nand_write_buf16(struct mtd_info *mtd, const u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	u16 *p = (u16 *) buf;	len >>= 1;	for (i=0; i<len; i++)		writew(p[i], this->IO_ADDR_W);}/** * nand_read_buf16 - [DEFAULT] read chip data into buffer * @mtd:	MTD device structure * @buf:	buffer to store date * @len:	number of bytes to read * * Default read function for 16bit buswith */static void nand_read_buf16(struct mtd_info *mtd, u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	u16 *p = (u16 *) buf;	len >>= 1;	for (i=0; i<len; i++)		p[i] = readw(this->IO_ADDR_R);}/** * nand_verify_buf16 - [DEFAULT] Verify chip data against buffer * @mtd:	MTD device structure * @buf:	buffer containing the data to compare * @len:	number of bytes to compare * * Default verify function for 16bit buswith */static int nand_verify_buf16(struct mtd_info *mtd, const u_char *buf, int len){	int i;	struct nand_chip *this = mtd->priv;	u16 *p = (u16 *) buf;	len >>= 1;	for (i=0; i<len; i++)		if (p[i] != readw(this->IO_ADDR_R))			return -EFAULT;	return 0;}/** * nand_block_bad - [DEFAULT] Read bad block marker from the chip * @mtd:	MTD device structure * @ofs:	offset from device start * @getchip:	0, if the chip is already selected * * Check, if the block is bad. */static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip){	int page, chipnr, res = 0;	struct nand_chip *this = mtd->priv;	u16 bad;	page = (int)(ofs >> this->page_shift);	chipnr = (int)(ofs >> this->chip_shift);	if (getchip) {		/* Grab the lock and see if the device is available */		nand_get_device (this, mtd, FL_READING);		/* Select the NAND device */		this->select_chip(mtd, chipnr);	} 	if (this->options & NAND_BUSWIDTH_16) {		this->cmdfunc (mtd, NAND_CMD_READOOB, this->badblockpos & 0xFE, page & this->pagemask);		bad = cpu_to_le16(this->read_word(mtd));		if (this->badblockpos & 0x1)			bad >>= 1;		if ((bad & 0xFF) != 0xff)			res = 1;	} else {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久69国产一区二区蜜臀| 欧美性极品少妇| 亚洲图片你懂的| 欧美熟乱第一页| 日本aⅴ免费视频一区二区三区| 日韩精品中文字幕一区二区三区 | 成人h版在线观看| 亚洲乱码国产乱码精品精可以看 | 亚洲成人动漫在线免费观看| 欧美美女bb生活片| 极品少妇xxxx精品少妇| 国产精品视频第一区| 在线免费av一区| 日韩国产精品久久久久久亚洲| 精品国产91洋老外米糕| 99免费精品视频| 午夜激情一区二区| 26uuu精品一区二区三区四区在线| 丁香婷婷综合色啪| 亚洲一区在线观看免费| 精品久久五月天| 91香蕉视频黄| 美国三级日本三级久久99| 国产精品麻豆一区二区| 欧美日韩另类一区| 国产一区二区三区国产| 亚洲人成在线观看一区二区| 欧美一区欧美二区| 不卡av在线免费观看| 视频一区二区三区在线| 国产日韩av一区| 欧美日韩国产影片| 国产精品综合久久| 亚洲www啪成人一区二区麻豆| 国产亚洲视频系列| 欧美亚洲国产怡红院影院| 国产一区二区在线观看视频| 亚洲精品v日韩精品| 精品久久国产字幕高潮| 色综合久久88色综合天天6| 精品夜夜嗨av一区二区三区| 一区二区三国产精华液| 久久久久久日产精品| 欧美色欧美亚洲另类二区| 国产v日产∨综合v精品视频| 午夜精品影院在线观看| 中文字幕在线观看不卡视频| 欧美精品vⅰdeose4hd| 国产91丝袜在线18| 男人的天堂久久精品| 日韩久久一区二区| 久久噜噜亚洲综合| 欧美日韩的一区二区| 91在线一区二区三区| 国内外精品视频| 亚洲高清免费视频| 综合激情成人伊人| 国产亚洲欧美中文| 91精品欧美福利在线观看| 色综合久久综合网97色综合 | 欧美精品第1页| 色成人在线视频| 成人成人成人在线视频| 久久国产精品99久久久久久老狼| 一区二区免费在线播放| 国产精品免费aⅴ片在线观看| 欧美大片日本大片免费观看| 欧洲中文字幕精品| 99天天综合性| 国产福利精品一区二区| 麻豆精品一区二区综合av| 亚洲在线视频网站| 亚洲色图都市小说| 国产精品不卡在线观看| 久久精品在这里| 久久综合九色综合97婷婷女人| 欧美高清一级片在线| 在线看不卡av| 91免费国产在线观看| 成人国产在线观看| 国产成人av电影在线| 国产美女精品在线| 久久精品国产成人一区二区三区 | 国产盗摄精品一区二区三区在线| 日韩中文字幕av电影| 亚瑟在线精品视频| 亚洲一区二区影院| 亚洲一区二区三区四区中文字幕| 亚洲免费资源在线播放| 亚洲色图20p| 亚洲视频一二三区| 亚洲免费观看视频| 亚洲欧美色一区| 1024精品合集| 中文字幕亚洲不卡| 亚洲欧美怡红院| 综合中文字幕亚洲| 亚洲视频你懂的| 亚洲你懂的在线视频| 日韩毛片视频在线看| 中文字幕在线不卡一区 | 中文字幕一区二区三区不卡在线| 欧美国产激情一区二区三区蜜月| 国产日韩精品久久久| 亚洲国产精品国自产拍av| 国产欧美精品一区| 国产精品系列在线| 国产精品国产三级国产aⅴ原创 | 欧美大胆一级视频| 日韩免费观看高清完整版 | 在线看不卡av| 欧美吞精做爰啪啪高潮| 欧美三级日本三级少妇99| 欧美性大战久久| 3d动漫精品啪啪1区2区免费| 91精品国产91久久综合桃花| 欧美一二三区在线| 26uuu亚洲综合色欧美 | 国产精品国产三级国产aⅴ原创| 中文字幕亚洲不卡| 一区二区三区欧美在线观看| 亚洲风情在线资源站| 日本va欧美va瓶| 国产一区二区久久| av影院午夜一区| 欧美色视频一区| 日韩欧美成人一区二区| 久久精品一区二区三区不卡牛牛| 国产精品久久久久久久浪潮网站| 亚洲视频精选在线| 亚洲h在线观看| 激情综合五月婷婷| 成人激情午夜影院| 欧洲人成人精品| 日韩一区二区麻豆国产| 久久精品人人做人人爽人人| 亚洲婷婷在线视频| 亚洲va欧美va天堂v国产综合| 喷水一区二区三区| 成人网在线免费视频| 日本韩国精品一区二区在线观看| 欧美日韩电影在线播放| 精品国产精品网麻豆系列| 国产精品久99| 日韩电影在线观看一区| 国产麻豆精品在线| 一本高清dvd不卡在线观看| 欧美精品乱码久久久久久按摩 | 精品国产精品网麻豆系列| 国产精品女同一区二区三区| 一区二区三区国产| 精品亚洲成a人| 97久久精品人人做人人爽50路| 欧美丰满美乳xxx高潮www| 久久久国产精品麻豆 | 亚洲欧美日韩国产手机在线| 婷婷综合五月天| 成人午夜视频在线观看| 欧美日韩国产成人在线免费| 久久精品一区二区三区av| 亚洲妇女屁股眼交7| 国产精品中文字幕日韩精品| 欧美性一区二区| 欧美激情在线观看视频免费| 亚洲第一会所有码转帖| 风间由美一区二区av101| 欧美日韩在线观看一区二区 | 成人黄色片在线观看| 精品视频一区三区九区| 国产午夜亚洲精品不卡| 亚洲国产一区二区视频| 国产精品一二三区在线| 欧美日韩一区三区| 国产清纯白嫩初高生在线观看91 | 国产成人在线免费| 欧美猛男超大videosgay| 国产精品女上位| 麻豆国产欧美日韩综合精品二区| 91在线观看视频| 2020国产精品自拍| 亚洲国产成人av网| 成人午夜视频在线| 日韩三级视频中文字幕| 亚洲精品成人少妇| 成人性生交大片免费看中文| 日韩午夜激情电影| 亚洲综合网站在线观看| 成人性生交大片免费看中文| 日韩美女在线视频| 亚洲一区二区三区精品在线| 成人免费看的视频| 欧美电影免费观看高清完整版在线 | 中文字幕一区二区在线播放| 狠狠狠色丁香婷婷综合激情 | 国产亚洲成年网址在线观看| 丝瓜av网站精品一区二区 | 色拍拍在线精品视频8848| 国产欧美一区二区精品性色超碰| 首页综合国产亚洲丝袜| 在线观看区一区二|