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

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

?? flash.c

?? 如何制作JFFS文件系統
?? C
?? 第 1 頁 / 共 3 頁
字號:
		if(!chip) {			printk("Flash: illegal ptr 0x%p in flash_write.\n", ptr);			return -EINVAL;		}		flashStart = (flashptr)chip->start;		programAddress = (flashptr)ptr;		/* if the block doesn't fit in this flash chip, clamp the size */		fsize = (ptr + size) > (chip->start + chip->size) ?			(chip->start + chip->size - ptr) : size;		ptr += fsize;		size -= fsize;		odd_size = fsize & 1;		fsize >>= 1; /* We write one word at a time.  */		FDEBUG(printk("flash_write (flash start 0x%p) %d words to 0x%p\n",			      flashStart, fsize, programAddress));		for (i = 0; i < fsize; i++) {			int retries = 0;			do {				int timeout;				/* Start programming sequence.				 */#ifdef IRQ_LOCKS				unsigned long flags;				save_flags(flags);				cli();#endif				flashStart[unlockAddress1] = unlockData1;				flashStart[unlockAddress2] = unlockData2;				flashStart[unlockAddress1] = programUnlockData;				*programAddress = *theData;				/* give the busy signal time to activate (tBusy, 90 ns) */				nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop();				/* Wait for programming to finish.  */				timeout = 500000;				while(timeout-- &&				      (*programAddress & D8_MASK)				      != (*theData & D8_MASK)) {				    if (*programAddress & D5_MASK)						break;				}				/* nothing */;#ifdef IRQ_LOCKS				restore_flags(flags);#endif				if(timeout <= 0)					printk("flash: write timeout 0x%p\n",					       programAddress);				if (*programAddress == *theData)					break;				printk("Flash: verify error 0x%p. "				       "(flash_write() 1)\n",				       programAddress);				printk("*programAddress = 0x%04x, "				       "*theData = 0x%04x\n",				       *programAddress, *theData);			} while(++retries < 5);			if(retries >= 5) {				printk("FATAL FLASH ERROR (1)\n");				return -EIO; /* we failed... */			}			programAddress++;			theData++;		}		/* We should write one extra byte to the flash.  */		if (odd_size) {			unsigned char last_byte[2];			int retries = 0;			last_byte[0] = *(unsigned char *)theData;			last_byte[1] = ((unsigned char *)programAddress)[1];			do {				int timeout = 500000;#ifdef IRQ_LOCKS				unsigned long flags;				save_flags(flags);				cli();#endif				flashStart[unlockAddress1] = unlockData1;				flashStart[unlockAddress2] = unlockData2;				flashStart[unlockAddress1] = programUnlockData;				*programAddress = *(flashptr) last_byte;				/* give the busy signal time enough to activate (tBusy, 90 ns) */				nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop(); nop();				/* Wait for programming to finish */				while(timeout-- &&				      (*programAddress & D8_MASK)				      != ((* (flashptr) last_byte) & D8_MASK)) {				    if (*programAddress & D5_MASK)						break;				}#ifdef IRQ_LOCKS				restore_flags(flags);#endif				if(timeout <= 0)					printk("flash: write timeout 0x%p\n",					       programAddress);				if (*programAddress == * (flashptr) last_byte)					break;				printk("Flash: verify error 0x%p. "				       "(flash_write() 2)\n",				       programAddress);			} while(++retries < 5);			if(retries >= 5) {				printk("FATAL FLASH ERROR (2)\n");				return -EIO; /* we failed... */			}		}	}#else	/* in the simulator we simulate flash as ram, so we can use a simple memcpy */	printk("flash write, source %p dest %p size %d\n", source, ptr, size);	memcpy(ptr, source, size);#endif	return 0;}/* "Memset" a chunk of memory on the flash. * do this by flash_write()'ing a pattern chunk. */intflash_memset(unsigned char *ptr, const __u8 c, unsigned long size){#ifndef CONFIG_SVINTO_SIM	static unsigned char pattern[16];	int i;	/* fill up pattern */	for(i = 0; i < 16; i++)		pattern[i] = c;	/* write as many 16-byte chunks as we can */	while(size >= 16) {		flash_write(ptr, pattern, 16);		size -= 16;		ptr += 16;	}	/* and the rest */	if(size)		flash_write(ptr, pattern, size);#else	/* In the simulator, we simulate flash as ram, so we can use a	   simple memset.  */	printk("flash memset, byte 0x%x dest %p size %d\n", c, ptr, size);	memset(ptr, c, size);#endif	return 0;}#ifdef CONFIG_BLK_DEV_FLASH/* the operations supported by the block device */static struct file_operations flash_block_fops ={	NULL,                   /* lseek - default */	block_read,             /* read - general block-dev read */	block_write,            /* write - general block-dev write */	NULL,                   /* readdir - bad */	NULL,                   /* poll */	flash_ioctl,            /* ioctl */	NULL,                   /* mmap */	flash_open,             /* open */	flash_release,          /* release */	block_fsync,            /* fsync */	NULL,			/* fasync */	NULL,			/* check media change */	NULL			/* revalidate */};#endif#ifdef CONFIG_CHR_DEV_FLASH/* the operations supported by the char device */static struct file_operations flash_char_fops ={	NULL,                   /* lseek - default */	flash_char_read,        /* read */	flash_char_write,       /* write */	NULL,                   /* readdir - bad */	NULL,                   /* poll */	flash_ioctl,            /* ioctl */	NULL,                   /* mmap */	flash_open,             /* open */	flash_release,          /* release */	NULL,                   /* fsync */	NULL,			/* fasync */	NULL,			/* check media change */	NULL			/* revalidate */};#endif/* Initialize the flash_partitions array, by reading the partition information from the * partition table (if there is any). Otherwise use a default partition set. * * The first partition is always sector 0 on the first chip, so start by initializing that. * TODO: partitions only reside on chip[0] now. check that. */static voidflash_init_partitions(){	struct partitiontable_head *ptable_head;	struct partitiontable_entry *ptable;	int use_default_ptable = 1; /* Until proven otherwise */	int pidx = 0;	int pidx_before_probe = 0;	const char *pmsg = "  /dev/flash%d at 0x%x, size 0x%x\n";	/* if there is no chip 0, there is no bootblock => no partitions at all */		if (chips[0].isValid) {		printk("Checking flash partitions:\n");		/* First sector in the flash is partition 0,		   regardless of if it's a real flash "bootblock" or not.  */		partitions[0].chip = &chips[0];		partitions[0].start = chips[0].start;		partitions[0].size = chips[0].sectorsize;		partitions[0].flags = 0;  /* FIXME */		flash_sizes[FLASH_MINOR] =			partitions[0].size >> BLOCK_SIZE_BITS;		FDEBUG(printk(pmsg, 0, partitions[0].start, partitions[0].size));		pidx++;		ptable_head = (struct partitiontable_head *)		  (partitions[0].start + partitions[0].size		   + PARTITION_TABLE_OFFSET);#ifdef CONFIG_SVINTO_SIM                /* If running in the simulator, do not scan nonexistent		   memory.  Behave as when the bootblock is "broken".                   ??? FIXME: Maybe there's something better to do. */		partitions[pidx].chip = &chips[0];		partitions[pidx].start = chips[0].start;		partitions[pidx].size = chips[0].size;		partitions[pidx].flags = 0; /* FIXME */		flash_sizes[FLASH_MINOR + pidx] =			partitions[pidx].size >> BLOCK_SIZE_BITS;		printk(pmsg, pidx, partitions[pidx].start, partitions[pidx].size);		pidx++;#else  /* ! defined CONFIG_SVINTO_SIM */		pidx_before_probe = pidx;		/* TODO: until we've defined a better partition table,		 * always do the default flash1 and flash2 partitions.		 */		if ((ptable_head->magic ==  PARTITION_TABLE_MAGIC)		    && (ptable_head->size			< (MAX_PARTITIONS			   * sizeof(struct partitiontable_entry) + 4))		    && (*(unsigned long*)			((void*)ptable_head			 + sizeof(*ptable_head)			 + ptable_head->size - 4)			==  PARTITIONTABLE_END_MARKER)) {			/* Looks like a start, sane length and end of a			 * partition table, lets check csum etc.			 */			int ptable_ok = 0;			struct partitiontable_entry *max_addr =			  (struct partitiontable_entry *)			  ((unsigned long)ptable_head + sizeof(*ptable_head) +				ptable_head->size);			unsigned long offset = chips[0].sectorsize;			unsigned char *p;			unsigned long csum = 0;			ptable = (struct partitiontable_entry *)			  ((unsigned long)ptable_head + sizeof(*ptable_head));			/* Lets be PARANOID, and check the checksum. */			p = (unsigned char*) ptable;			while (p <= (unsigned char*)max_addr) {				csum += *p++;				csum += *p++;				csum += *p++;				csum += *p++;			}			printk("  total csum: 0x%08X 0x%08X\n",			   csum, ptable_head->checksum);			ptable_ok = (csum == ptable_head->checksum);			/* Read the entries and use/show the info.  */			ptable = (struct partitiontable_entry *)			  ((unsigned long)ptable_head + sizeof(*ptable_head));			printk(" Found %s partition table at 0x%08lX-0x%08lX.\n",			       (ptable_ok ? "valid" : "invalid"),			       (unsigned long)ptable_head,			       (unsigned long)max_addr);			/* We have found a working bootblock.  Now read the			   partition table.  Scan the table.  It ends when			   there is 0xffffffff, that is, empty flash.  */			while (ptable_ok			       && ptable->offset != 0xffffffff			       && ptable < max_addr			       && pidx < MAX_PARTITIONS) {				partitions[pidx].chip = &chips[0];				if ((offset + ptable->offset) >= chips[0].size) {					partitions[pidx].start					  = offset + chips[1].start					    + ptable->offset - chips[0].size;				}				else {					partitions[pidx].start					  = offset + chips[0].start					    + ptable->offset;				}				partitions[pidx].size = ptable->size;				partitions[pidx].flags = ptable->flags;				partitions[pidx].type = ptable->type;				flash_sizes[FLASH_MINOR + pidx] =					partitions[pidx].size >> BLOCK_SIZE_BITS;				printk(pmsg, pidx, partitions[pidx].start,				       partitions[pidx].size);				pidx++;				ptable++;			}#ifdef CONFIG_USE_FLASH_PARTITION_TABLE			use_default_ptable = !ptable_ok;#endif		}printk("Checking flash partitions:\n");		if (use_default_ptable) {			/* the flash is split into flash1, flash2 and bootblock			 * (flash0)			 */			pidx = pidx_before_probe;			FDEBUG(printk(" Using default flash1 and flash2.\n"));			printk(" Using default flash1:.\n");			/* flash1 starts after the first sector */			partitions[pidx].chip = &chips[0];			partitions[pidx].start = chips[0].start + chips[0].sectorsize;			partitions[pidx].size = chips[0].size - (DEF_FLASH2_SIZE +				partitions[0].size);			partitions[pidx].flags = 0; /* FIXME */			flash_sizes[FLASH_MINOR + pidx] =				partitions[pidx].size >> BLOCK_SIZE_BITS;			printk(pmsg, pidx, partitions[pidx].start,			       partitions[pidx].size);			pidx++;			/* flash2 starts after flash1. */			partitions[pidx].chip = &chips[0];			partitions[pidx].start = partitions[pidx - 1].start +				partitions[pidx - 1].size;			partitions[pidx].size = DEF_FLASH2_SIZE;			partitions[pidx].flags = 0; /* FIXME */			flash_sizes[FLASH_MINOR + pidx] =				partitions[pidx].size >> BLOCK_SIZE_BITS;			FDEBUG(printk(pmsg, pidx, partitions[pidx].start,			       partitions[pidx].size));			pidx++;		}#endif /* ! defined CONFIG_SVINTO_SIM */	}	/* fill in the rest of the table as well */	while (pidx < MAX_PARTITIONS) {		partitions[pidx].start = 0;		partitions[pidx].size = 0;		partitions[pidx].chip = 0;		pidx++;	}	/*flash_blk_sizes[FLASH_MINOR + i] = 1024; TODO this should be 512.. */}#ifdef LISAHACKstatic voidmove_around_bootparams(){	unsigned long *newp = (unsigned long *)0x8000c000;  /* new bootsector */	unsigned long *oldp = (unsigned long *)0x801fc000;  /* old bootsector */	unsigned long *buf;	unsigned long magic = 0xbeefcace;	printk("Checking if we need to move bootparams...");	/* First check if they are already moved.  */	if(*newp == magic) {		printk(" no\n");		return;	}	printk(" yes. Moving...");	buf = (unsigned long *)kmalloc(0x4000, GFP_KERNEL);	memcpy(buf, oldp, 0x4000);	flash_write((unsigned char *)newp, (unsigned char *)&magic, 4);	flash_write((unsigned char *)(newp + 1), (unsigned char *)buf, 0x4000 - 4);	/* Erase old boot block, so JFFS can expand into it.  */	flash_init_erase((unsigned char *)0x801f0000, chips[0].sectorsize);	flash_busy_wait_erase(chips[0].start);	printk(" done.\n");	kfree(buf);}#endif/* register the device into the kernel - called at boot */intflash_init(){#ifdef CONFIG_BLK_DEV_FLASH	/* register the block device major */	if(register_blkdev(MAJOR_NR, DEVICE_NAME, &flash_block_fops )) {		printk(KERN_ERR DEVICE_NAME ": Unable to get major %d\n",		       MAJOR_NR);		return -EBUSY;	}	/* register the actual block I/O function - do_flash_request - and the	 * tables containing the device sizes (in 1kb units) and block sizes	 */	blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;	blk_size[MAJOR_NR] = flash_sizes;	blksize_size[MAJOR_NR] = flash_blk_sizes;	read_ahead[MAJOR_NR] = 1; /* fast device, so small read ahead */	printk("Flash/ROM block device v2.1, (c) 1999 Axis Communications AB\n");	printk("Driver for SST39VF160 Flash block device v1.0, (c) 2001 Zhihui Li,Wanhe Corp.,Ltd.\n");#endif#ifdef CONFIG_CHR_DEV_FLASH	/* register the char device major */	if(register_chrdev(MAJOR_NR, DEVICE_NAME, &flash_char_fops )) {		printk(KERN_ERR DEVICE_NAME ": Unable to get major %d\n",		       MAJOR_NR);		return -EBUSY;	}	printk("Flash/ROM char device v2.1, (c) 1999 Axis Communications AB\n");#endif	/* initialize partition table */	flash_init_partitions();#ifdef LISAHACK	/* nasty hack to "upgrade" older beta units of Lisa into newer by	 * moving the boot block parameters. will go away as soon as this	 * build is done.	 */	move_around_bootparams();#endif	return 0;}/* check if it's possible to erase the wanted range, and if not, return * the range that IS erasable, or a negative error code. */longflash_erasable_size(void *_part, __u32 offset, __u32 size){	struct flashpartition *part = (struct flashpartition *)_part;	int ssize;	if (!part->start) {		return -EINVAL;	}	/* assume that sector size for a partition is constant even	 * if it spans more than one chip (you usually put the same	 * type of chips in a system)	 */	ssize = part->chip->sectorsize;	if (offset % ssize) {		/* The offset is not sector size aligned.  */		return -1;	}	else if (offset > part->size) {		return -2;	}	else if (offset + size > part->size) {		return -3;	}	return (size / ssize) * ssize;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一级二级在线| 国产日韩在线不卡| 成人中文字幕合集| 亚洲另类春色校园小说| 精品捆绑美女sm三区| 94-欧美-setu| 国产一区视频在线看| 亚洲成人在线网站| 中文字幕精品综合| 欧美videossexotv100| 一本高清dvd不卡在线观看| 精品一区二区三区日韩| 一区二区三区四区乱视频| 国产丝袜欧美中文另类| 5858s免费视频成人| 色综合久久中文综合久久牛| 国产成人免费在线观看不卡| 天天影视色香欲综合网老头| 亚洲男同1069视频| 久久99最新地址| 免费在线观看一区| 奇米精品一区二区三区在线观看一| 国产精品久久久久久久久搜平片 | 欧美日韩一区小说| 色88888久久久久久影院按摩| 成人免费黄色在线| 成人app在线| av中文字幕不卡| 成人av免费在线| 99国内精品久久| 欧美亚洲国产bt| 日本精品裸体写真集在线观看| fc2成人免费人成在线观看播放| 国产激情一区二区三区| 成人精品gif动图一区| www.欧美日韩| 欧美亚洲动漫制服丝袜| 欧美一区日本一区韩国一区| 欧美videos大乳护士334| 久久婷婷成人综合色| 国产精品久久影院| 午夜影视日本亚洲欧洲精品| 亚洲大片在线观看| 国产在线视频精品一区| 成人sese在线| 欧美日韩国产色站一区二区三区| 欧美日韩国产综合久久| 久久久久久免费| 亚洲午夜成aⅴ人片| 久久99深爱久久99精品| 色综合天天综合网天天看片| 欧美日韩激情一区二区三区| 国产日韩欧美一区二区三区乱码| 中文字幕国产一区二区| 亚洲成人资源网| 不卡电影一区二区三区| 欧美美女一区二区在线观看| 国产三级三级三级精品8ⅰ区| 最新日韩av在线| 久久99国产精品尤物| 91免费观看在线| 久久精品夜色噜噜亚洲aⅴ| 亚洲综合色婷婷| 99riav久久精品riav| 精品久久久久久久久久久久包黑料| 中文字幕五月欧美| 国产精品中文字幕欧美| 欧美电视剧免费全集观看| 亚洲444eee在线观看| 99久久婷婷国产综合精品电影 | 93久久精品日日躁夜夜躁欧美| 日韩欧美国产一二三区| 婷婷亚洲久悠悠色悠在线播放| www.一区二区| 亚洲人123区| 91小视频在线观看| 综合久久久久综合| 91免费看视频| 亚洲一区电影777| 91国产免费观看| 一区二区三区.www| 欧美日韩一区中文字幕| 亚洲成av人影院| 欧美日韩成人激情| 日本欧美韩国一区三区| 精品成人一区二区三区四区| 老鸭窝一区二区久久精品| 精品国偷自产国产一区| 国产福利不卡视频| 国产精品国产三级国产普通话三级| 国产成人免费视频网站高清观看视频 | 欧美亚洲综合网| 日韩高清一区在线| wwww国产精品欧美| jvid福利写真一区二区三区| 亚洲一区二区三区四区不卡| 欧美丰满高潮xxxx喷水动漫| 激情综合色综合久久| 国产精品高潮久久久久无| 欧美午夜精品一区二区三区| 青椒成人免费视频| 国产日韩欧美电影| 欧美在线free| 国产一区二区三区视频在线播放| 国产精品美女一区二区在线观看| 欧洲国产伦久久久久久久| 蜜桃久久久久久| 亚洲欧美日韩精品久久久久| 日韩午夜三级在线| 不卡的av在线| 国产精品一区在线观看乱码| 一个色在线综合| 国产精品久久福利| 精品成人a区在线观看| 欧美日韩国产在线播放网站| 成人激情免费网站| 韩国视频一区二区| 日本亚洲电影天堂| 亚洲一区免费在线观看| 自拍偷拍欧美精品| 国产精品动漫网站| 国产欧美精品一区二区色综合| 6080日韩午夜伦伦午夜伦| 欧洲亚洲国产日韩| 欧美在线视频你懂得| 97久久超碰精品国产| jlzzjlzz亚洲日本少妇| 国产精品一区在线观看乱码| 久久福利视频一区二区| 午夜影视日本亚洲欧洲精品| 日韩毛片在线免费观看| 国产午夜亚洲精品不卡| 久久久久青草大香线综合精品| 5566中文字幕一区二区电影| 在线成人高清不卡| 91精品黄色片免费大全| 欧美一区二区播放| 久久婷婷成人综合色| 国产亚洲精品中文字幕| 综合久久综合久久| 午夜视频一区在线观看| 麻豆一区二区99久久久久| 国产一区二区视频在线| 国产成人一级电影| 欧美在线一区二区| 精品国产一区二区三区久久久蜜月| 久久久久久**毛片大全| 国产精品成人免费 | 亚洲欧美日韩综合aⅴ视频| 一二三区精品福利视频| 日本女优在线视频一区二区| 久久99久久久欧美国产| 99九九99九九九视频精品| 欧美久久久影院| 国产精品久久久久久妇女6080| 亚洲国产精品人人做人人爽| 国产一区二区三区精品欧美日韩一区二区三区 | 欧美日韩国产一区二区三区地区| 日韩欧美另类在线| 亚洲欧美日韩电影| 久久爱www久久做| 在线一区二区观看| 国产日韩欧美亚洲| 麻豆一区二区在线| 欧美色视频在线观看| 中文字幕第一页久久| 蜜桃av噜噜一区| 欧美日本在线看| 综合久久综合久久| 国产成人精品网址| 久久久久久久久久看片| 日本系列欧美系列| 777亚洲妇女| 日韩av一二三| 欧美久久久久久蜜桃| 亚洲国产综合视频在线观看| jizz一区二区| 亚洲精品一卡二卡| 国产在线播放一区| 国产欧美一区二区在线| 国产很黄免费观看久久| 国产精品丝袜久久久久久app| 高清不卡在线观看av| 亚洲色大成网站www久久九九| 一本一道久久a久久精品 | 天天影视涩香欲综合网| 欧美成人aa大片| 99国产精品久| 日韩精品色哟哟| 国产欧美日韩精品a在线观看| a亚洲天堂av| 亚洲国产一区在线观看| 成人av电影观看| 午夜不卡av在线| 久久影院午夜片一区| 91小宝寻花一区二区三区| 日日夜夜精品视频免费| 日本一区二区三区四区| 欧美日韩一区小说| 国产成人久久精品77777最新版本|