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

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

?? rtc_from4.c

?? 根據fs2410移植過后的mtd驅動源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
		status =  RTC_FROM4_RS_ECC_CTL_CLR			| RTC_FROM4_RS_ECC_CTL_FD_E;		*rs_ecc_ctl = status;		break;	    case NAND_ECC_READSYN :		status =  0x00;		*rs_ecc_ctl = status;		break;	    case NAND_ECC_WRITE :		status =  RTC_FROM4_RS_ECC_CTL_CLR			| RTC_FROM4_RS_ECC_CTL_GEN			| RTC_FROM4_RS_ECC_CTL_FD_E;		*rs_ecc_ctl = status;		break;	    default:		BUG();		break;	}}/* * rtc_from4_calculate_ecc - hardware specific code to read ECC code * @mtd:	MTD device structure * @dat:	buffer containing the data to generate ECC codes * @ecc_code	ECC codes calculated * * The ECC code is calculated by the FPGA.  All we have to do is read the values * from the FPGA registers. * * Note: We read from the inverted registers, since data is inverted before * the code is calculated. So all 0xff data (blank page) results in all 0xff rs code * */static void rtc_from4_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code){	volatile unsigned short * rs_eccn = (volatile unsigned short *)(rtc_from4_fio_base + RTC_FROM4_RS_ECCN);	unsigned short value;	int i;	for (i = 0; i < 8; i++) {		value = *rs_eccn;		ecc_code[i] = (unsigned char)value;		rs_eccn++;	}	ecc_code[7] |= 0x0f;	/* set the last four bits (not used) */}/* * rtc_from4_correct_data - hardware specific code to correct data using ECC code * @mtd:	MTD device structure * @buf:	buffer containing the data to generate ECC codes * @ecc1	ECC codes read * @ecc2	ECC codes calculated * * The FPGA tells us fast, if there's an error or not. If no, we go back happy * else we read the ecc results from the fpga and call the rs library to decode * and hopefully correct the error. * */static int rtc_from4_correct_data(struct mtd_info *mtd, const u_char *buf, u_char *ecc1, u_char *ecc2){	int i, j, res;	unsigned short status;	uint16_t par[6], syn[6];	uint8_t ecc[8];        volatile unsigned short *rs_ecc;	status = *((volatile unsigned short *)(rtc_from4_fio_base + RTC_FROM4_RS_ECC_CHK));	if (!(status & RTC_FROM4_RS_ECC_CHK_ERROR)) {		return 0;	}	/* Read the syndrom pattern from the FPGA and correct the bitorder */	rs_ecc = (volatile unsigned short *)(rtc_from4_fio_base + RTC_FROM4_RS_ECC);        for (i = 0; i < 8; i++) {                ecc[i] = revbits[(*rs_ecc) & 0xFF];                rs_ecc++;        }	/* convert into 6 10bit syndrome fields */	par[5] = rs_decoder->index_of[(((uint16_t)ecc[0] >> 0) & 0x0ff) |				      (((uint16_t)ecc[1] << 8) & 0x300)];	par[4] = rs_decoder->index_of[(((uint16_t)ecc[1] >> 2) & 0x03f) |				      (((uint16_t)ecc[2] << 6) & 0x3c0)];	par[3] = rs_decoder->index_of[(((uint16_t)ecc[2] >> 4) & 0x00f) |				      (((uint16_t)ecc[3] << 4) & 0x3f0)];	par[2] = rs_decoder->index_of[(((uint16_t)ecc[3] >> 6) & 0x003) |				      (((uint16_t)ecc[4] << 2) & 0x3fc)];	par[1] = rs_decoder->index_of[(((uint16_t)ecc[5] >> 0) & 0x0ff) |				      (((uint16_t)ecc[6] << 8) & 0x300)];	par[0] = (((uint16_t)ecc[6] >> 2) & 0x03f) | (((uint16_t)ecc[7] << 6) & 0x3c0);	/* Convert to computable syndrome */	for (i = 0; i < 6; i++) {		syn[i] = par[0];		for (j = 1; j < 6; j++)			if (par[j] != rs_decoder->nn)				syn[i] ^= rs_decoder->alpha_to[rs_modnn(rs_decoder, par[j] + i * j)];		/* Convert to index form */		syn[i] = rs_decoder->index_of[syn[i]];	}	/* Let the library code do its magic.*/	res = decode_rs8(rs_decoder, (uint8_t *)buf, par, 512, syn, 0, NULL, 0xff, NULL);	if (res > 0) {		DEBUG (MTD_DEBUG_LEVEL0, "rtc_from4_correct_data: "			"ECC corrected %d errors on read\n", res);	}	return res;}/** * rtc_from4_errstat - perform additional error status checks * @mtd:	MTD device structure * @this:	NAND chip structure * @state:	state or the operation * @status:	status code returned from read status * @page:	startpage inside the chip, must be called with (page & this->pagemask) * * Perform additional error status checks on erase and write failures * to determine if errors are correctable.  For this device, correctable * 1-bit errors on erase and write are considered acceptable. * * note: see pages 34..37 of data sheet for details. * */static int rtc_from4_errstat(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page){	int	er_stat=0;	int	rtn, retlen;	size_t	len;	uint8_t *buf;	int	i;	this->cmdfunc (mtd, NAND_CMD_STATUS_CLEAR, -1, -1);        if (state == FL_ERASING) {		for (i=0; i<4; i++) {			if (status & 1<<(i+1)) {				this->cmdfunc (mtd, (NAND_CMD_STATUS_ERROR + i + 1), -1, -1);				rtn = this->read_byte(mtd);				this->cmdfunc (mtd, NAND_CMD_STATUS_RESET, -1, -1);				if (!(rtn & ERR_STAT_ECC_AVAILABLE)) {					er_stat |= 1<<(i+1);	/* err_ecc_not_avail */				}			}		}	} else if (state == FL_WRITING) {		/* single bank write logic */		this->cmdfunc (mtd, NAND_CMD_STATUS_ERROR, -1, -1);		rtn = this->read_byte(mtd);		this->cmdfunc (mtd, NAND_CMD_STATUS_RESET, -1, -1);		if (!(rtn & ERR_STAT_ECC_AVAILABLE)) {			er_stat |= 1<<1;	/* err_ecc_not_avail */		} else {			len = mtd->oobblock;			buf = kmalloc (len, GFP_KERNEL);			if (!buf) {				printk (KERN_ERR "rtc_from4_errstat: Out of memory!\n");				er_stat = 1;			/* if we can't check, assume failed */			} else {				/* recovery read */				/* page read */				rtn = nand_do_read_ecc (mtd, page, len, &retlen, buf, NULL, this->autooob, 1);				if (rtn) {	/* if read failed or > 1-bit error corrected */					er_stat |= 1<<1;	/* ECC read failed */				}				kfree(buf);			}		}	}	rtn = status;	if (er_stat == 0) {				/* if ECC is available   */		rtn = (status & ~NAND_STATUS_FAIL);	/*   clear the error bit */	}	return rtn;}#endif/* * Main initialization routine */int __init rtc_from4_init (void){	struct nand_chip *this;	unsigned short bcr1, bcr2, wcr2;	int i;	/* Allocate memory for MTD device structure and private data */	rtc_from4_mtd = kmalloc(sizeof(struct mtd_info) + sizeof (struct nand_chip),				GFP_KERNEL);	if (!rtc_from4_mtd) {		printk ("Unable to allocate Renesas NAND MTD device structure.\n");		return -ENOMEM;	}	/* Get pointer to private data */	this = (struct nand_chip *) (&rtc_from4_mtd[1]);	/* Initialize structures */	memset((char *) rtc_from4_mtd, 0, sizeof(struct mtd_info));	memset((char *) this, 0, sizeof(struct nand_chip));	/* Link the private data with the MTD structure */	rtc_from4_mtd->priv = this;	/* set area 5 as PCMCIA mode to clear the spec of tDH(Data hold time;9ns min) */	bcr1 = *SH77X9_BCR1 & ~0x0002;	bcr1 |= 0x0002;	*SH77X9_BCR1 = bcr1;	/* set */	bcr2 = *SH77X9_BCR2 & ~0x0c00;	bcr2 |= 0x0800;	*SH77X9_BCR2 = bcr2;	/* set area 5 wait states */	wcr2 = *SH77X9_WCR2 & ~0x1c00;	wcr2 |= 0x1c00;	*SH77X9_WCR2 = wcr2;	/* Set address of NAND IO lines */	this->IO_ADDR_R = rtc_from4_fio_base;	this->IO_ADDR_W = rtc_from4_fio_base;	/* Set address of hardware control function */	this->hwcontrol = rtc_from4_hwcontrol;	/* Set address of chip select function */        this->select_chip = rtc_from4_nand_select_chip;	/* command delay time (in us) */	this->chip_delay = 100;	/* return the status of the Ready/Busy line */	this->dev_ready = rtc_from4_nand_device_ready;#ifdef RTC_FROM4_HWECC	printk(KERN_INFO "rtc_from4_init: using hardware ECC detection.\n");        this->eccmode = NAND_ECC_HW8_512;	this->options |= NAND_HWECC_SYNDROME;	/* return the status of extra status and ECC checks */	this->errstat = rtc_from4_errstat;	/* set the nand_oobinfo to support FPGA H/W error detection */	this->autooob = &rtc_from4_nand_oobinfo;	this->enable_hwecc = rtc_from4_enable_hwecc;	this->calculate_ecc = rtc_from4_calculate_ecc;	this->correct_data = rtc_from4_correct_data;#else	printk(KERN_INFO "rtc_from4_init: using software ECC detection.\n");	this->eccmode = NAND_ECC_SOFT;#endif	/* set the bad block tables to support debugging */	this->bbt_td = &rtc_from4_bbt_main_descr;	this->bbt_md = &rtc_from4_bbt_mirror_descr;	/* Scan to find existence of the device */	if (nand_scan(rtc_from4_mtd, RTC_FROM4_MAX_CHIPS)) {		kfree(rtc_from4_mtd);		return -ENXIO;	}	/* Perform 'device recovery' for each chip in case there was a power loss. */	for (i=0; i < this->numchips; i++) {		deplete(rtc_from4_mtd, i);	}#if RTC_FROM4_NO_VIRTBLOCKS	/* use a smaller erase block to minimize wasted space when a block is bad */	/* note: this uses eight times as much RAM as using the default and makes */	/*       mounts take four times as long. */	rtc_from4_mtd->flags |= MTD_NO_VIRTBLOCKS;#endif	/* Register the partitions */	add_mtd_partitions(rtc_from4_mtd, partition_info, NUM_PARTITIONS);#ifdef RTC_FROM4_HWECC	/* We could create the decoder on demand, if memory is a concern.	 * This way we have it handy, if an error happens	 *	 * Symbolsize is 10 (bits)	 * Primitve polynomial is x^10+x^3+1	 * first consecutive root is 0	 * primitve element to generate roots = 1	 * generator polinomial degree = 6	 */	rs_decoder = init_rs(10, 0x409, 0, 1, 6);	if (!rs_decoder) {		printk (KERN_ERR "Could not create a RS decoder\n");		nand_release(rtc_from4_mtd);		kfree(rtc_from4_mtd);		return -ENOMEM;	}#endif	/* Return happy */	return 0;}module_init(rtc_from4_init);/* * Clean up routine */#ifdef MODULEstatic void __exit rtc_from4_cleanup (void){	/* Release resource, unregister partitions */	nand_release(rtc_from4_mtd);	/* Free the MTD device structure */	kfree (rtc_from4_mtd);#ifdef RTC_FROM4_HWECC	/* Free the reed solomon resources */	if (rs_decoder) {		free_rs(rs_decoder);	}#endif}module_exit(rtc_from4_cleanup);#endifMODULE_LICENSE("GPL");MODULE_AUTHOR("d.marlin <dmarlin@redhat.com");MODULE_DESCRIPTION("Board-specific glue layer for AG-AND flash on Renesas FROM_BOARD4");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久亚洲精华液精华液精华液 | 懂色一区二区三区免费观看| 日韩精品一区二区三区中文精品| 免费在线看成人av| 欧美电视剧免费观看| 国产综合色产在线精品| 国产精品情趣视频| 在线欧美一区二区| 午夜私人影院久久久久| 日韩精品一区二区三区视频播放| 国产大片一区二区| 亚洲图片另类小说| 在线综合亚洲欧美在线视频| 国产精品一级在线| 亚洲手机成人高清视频| 欧美一区二区三区男人的天堂| 久久99国产精品久久99果冻传媒| 国产精品久久国产精麻豆99网站| 欧美三区免费完整视频在线观看| 秋霞电影一区二区| 国产精品女上位| 欧美日韩国产欧美日美国产精品| 国产做a爰片久久毛片| 亚洲人123区| 日韩欧美色电影| 色综合亚洲欧洲| 黑人精品欧美一区二区蜜桃 | 日韩一级大片在线| 国产高清在线精品| 亚洲国产精品久久一线不卡| 精品盗摄一区二区三区| 99久久久免费精品国产一区二区| 午夜精品一区二区三区三上悠亚| 国产日产欧美一区二区视频| 欧美日本一区二区| 成人国产一区二区三区精品| 免费成人你懂的| ...xxx性欧美| 精品国产区一区| 欧美性一级生活| 国产69精品久久久久777| 日韩激情在线观看| 日韩一区日韩二区| 久久在线观看免费| 欧美日韩精品三区| 99精品视频免费在线观看| 麻豆视频观看网址久久| 亚洲国产精品久久人人爱 | 成人欧美一区二区三区黑人麻豆| 91精品国产综合久久福利| 91丨porny丨户外露出| 国产电影精品久久禁18| 免费观看久久久4p| 亚洲第一精品在线| 亚洲黄色av一区| 中文字幕一区不卡| 久久精品人人做人人综合 | 一本一道综合狠狠老| 国产一区二区免费在线| 日本中文字幕一区| 亚洲sss视频在线视频| 中文字幕视频一区| 亚洲国产精品国自产拍av| 久久影院午夜片一区| 欧美第一区第二区| 欧美一区二区福利视频| 91麻豆精品国产91久久久更新时间 | 337p日本欧洲亚洲大胆色噜噜| 欧美丰满一区二区免费视频 | 国产精品视频你懂的| 久久网这里都是精品| 欧美成人女星排名| 欧美成人video| 日韩亚洲欧美高清| 日韩欧美一区中文| 久久综合狠狠综合久久综合88| 精品国产精品一区二区夜夜嗨| 日韩女优视频免费观看| 欧美va亚洲va香蕉在线| 26uuu另类欧美| 国产欧美精品一区二区三区四区 | 丝袜诱惑亚洲看片| 日韩国产欧美一区二区三区| 免费在线看一区| 国产中文字幕一区| 成人免费黄色在线| 91免费看`日韩一区二区| 色噜噜久久综合| 欧美精品 国产精品| 欧美一区二区观看视频| 亚洲精品一区二区三区精华液 | 91在线码无精品| 在线视频你懂得一区| 欧美精选在线播放| 精品国产乱码久久久久久蜜臀| 久久久综合激的五月天| 中文字幕制服丝袜成人av| 亚洲国产日韩av| 国产综合久久久久久鬼色| 成人高清视频免费观看| 在线影视一区二区三区| 日韩欧美成人激情| 国产女人18毛片水真多成人如厕 | 久久久亚洲国产美女国产盗摄| 国产精品天美传媒| 亚洲资源在线观看| 久久97超碰国产精品超碰| 99视频热这里只有精品免费| 欧美性一二三区| 2023国产一二三区日本精品2022| 国产精品福利影院| 午夜精品在线视频一区| 成人综合在线网站| 欧美日韩日本视频| 日本一区二区三区dvd视频在线 | 国产农村妇女毛片精品久久麻豆| 一区二区三区在线视频免费观看| 日本中文字幕一区二区有限公司| 国产精品系列在线播放| 欧美日韩国产精品成人| 国产亚洲欧美中文| 午夜久久久影院| 99re热这里只有精品免费视频| 91精品在线免费观看| 国产精品美女www爽爽爽| 青青青伊人色综合久久| 97久久久精品综合88久久| 日韩欧美你懂的| 亚洲成人一区二区在线观看| 成人一区二区三区视频| 91精品国产手机| 亚洲男人都懂的| 国产成人自拍网| 日韩午夜电影av| 亚洲一区二区在线免费看| 成人精品一区二区三区四区 | 国产成人在线电影| 91精品国产综合久久精品图片| 亚洲国产精品精华液2区45| 老司机免费视频一区二区| 欧洲视频一区二区| 国产精品每日更新在线播放网址| 麻豆91免费观看| 91精品欧美福利在线观看| 一个色在线综合| 99视频一区二区三区| 中文字幕精品一区| 精品一区二区三区免费毛片爱| 欧美夫妻性生活| 午夜久久久影院| 欧美日韩免费观看一区三区| 一区二区欧美国产| 91偷拍与自偷拍精品| 国产精品每日更新| 国产成人8x视频一区二区| 久久综合九色综合97_久久久| 久热成人在线视频| 日韩一区二区在线观看视频播放| 天堂一区二区在线免费观看| 欧美精品精品一区| 石原莉奈在线亚洲三区| 3d成人动漫网站| 蜜臀av在线播放一区二区三区 | 国产欧美一区二区三区沐欲| 国产精选一区二区三区| 国产日本欧洲亚洲| 成人免费视频视频在线观看免费| 国产蜜臀av在线一区二区三区| 国产91在线观看| 亚洲视频在线观看三级| 91老师国产黑色丝袜在线| 亚洲免费av观看| 在线观看欧美日本| 亚洲大片在线观看| 日韩一级视频免费观看在线| 精品一区二区在线视频| 国产婷婷色一区二区三区| 成人黄色在线看| 一区二区三区日韩精品视频| 在线亚洲人成电影网站色www| 亚洲五月六月丁香激情| 日韩一区二区三区四区| 国产在线播放一区| 国产欧美一区二区三区沐欲| 91日韩精品一区| 午夜精品一区在线观看| 欧美变态凌虐bdsm| 成人av在线观| 午夜视频在线观看一区二区| 日韩欧美aaaaaa| 99re8在线精品视频免费播放| 亚洲成a人在线观看| 日韩精品影音先锋| 成人国产精品免费网站| 同产精品九九九| 国产视频不卡一区| 在线欧美日韩精品| 久色婷婷小香蕉久久| 亚洲欧洲日韩av| 777xxx欧美|