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

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

?? flash.c

?? PXA250上的XBOOT
?? C
字號:
/*  * $Id: flash.c,v 1.3 2003/09/26 07:11:55 jfabo Exp $ * * Copyright (C) 2001, 2002 ETC s.r.o. * * 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 (at your option) 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. * * 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., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * Written by Marcel Telka <marcel@telka.sk>, 2001, 2002. * */#include ".config.h"#include <stdint.h>#include <flash/cfi.h>#include <flash/intel.h>#include "board.h"#include "except.h"#include "flash.h"#include "format.h"#include "splash.h"#define	FLASH(addr)	(*(volatile uint32_t *)(MEM_VIRT_FLASH + ((addr) << 2)))#define MAXBUFSIZE	1024#define MAXBLOCKS	256static uint32_t flashoffset;static uint8_t flashbuf[MAXBUFSIZE];static size_t flashbufsize;static uint32_t flashbufptr;static int erasedblocks[MAXBLOCKS];static size_t blocksize;static voiderase( int block ){	if (!erasedblocks[block]) {		EdbgOutputDebugString( "Erasing block #%d%s\n", block,				block ? "" : "   WARNING: Overwriting xboot!" );		if (FlashClearBlockLockBit( block ))			Throw E_FL_BLOCKUNLOCK;		if (FlashBlockErase( block ))			Throw E_FL_BLOCKERASE;		erasedblocks[block] = 1;	}}static voidflash( void *dst, const void *src, size_t count ){	size_t offset = (size_t) dst - MEM_VIRT_FLASH;	if ((offset % sizeof (size_t)) || (count % sizeof (size_t)))		Throw E_FL_DATAALIGNMENT;	/* TODO: check offset and offset + count to be in flashsize */	while (count) {		size_t len;		int block = offset / blocksize;		size_t nbo = (block + 1) * blocksize;		if ((len = (nbo - offset)) > count)			len = count;		erase( block );		count -= len;		while (len) {			size_t flen = (len > flashbufsize) ? flashbufsize : len;			if (FlashWriteToBuffer( offset, src, flen / 4 ))				Throw E_FL_WRITETOBUFFER;			offset += flen;			len -= flen;			src = (void *) ((size_t) src + flen);		}	}}static voidWriteFlashBuf( void ){	uint32_t block = flashoffset / blocksize;	erase( block );	if (FlashWriteToBuffer( flashoffset, (uint32_t *) &flashbuf, (flashbufptr + 3) / 4 ))		Throw E_FL_WRITETOBUFFER;	flashoffset += flashbufptr;}static voidWriteByte( uint8_t c ){	flashbuf[flashbufptr++] = c;	if (flashbufptr == flashbufsize) {		WriteFlashBuf();		flashbufptr = 0;	}}static voidWriteDWord( uint32_t dw ){	WriteByte( (uint8_t) (dw & 0xFF) );	WriteByte( (uint8_t) ((dw >> 8) & 0xFF) );	WriteByte( (uint8_t) ((dw >> 16) & 0xFF) );	WriteByte( (uint8_t) ((dw >> 24) & 0xFF) );}static voidStartFlash( uint32_t offset, struct FlashInfo *fi ){	int i;	if ((fi->wbufsize > MAXBUFSIZE) || (fi->eblocks > MAXBLOCKS))		Throw E_FL_OUTOFMEMORY;	flashoffset = offset;	flashbufsize = fi->wbufsize;	flashbufptr = 0;	blocksize = fi->eblocksize;	for (i = 0; i < fi->eblocks; i++)		erasedblocks[i] = 0;}static voidEndFlash( void ){	if (flashbufptr > 0)		WriteFlashBuf();	FlashReadArray();}voidFlashXIP( struct imginfo *img ){	unsigned int *rec = (void *) img->target;#ifdef CONFIG_SPLASH_SCREEN	unsigned int total_length = 0;	unsigned char progress_percentage = 0;#endif	switch (img->start & 0xFF000000) {		case MEM_VIRT_FLASH:			img->target = img->start;			break;		case MEM_PHYS_FLASH:			img->target = img->start + MEM_VIRT_FLASH - MEM_PHYS_FLASH;			break;		default:			Throw E_FL_UNKNOWNMEMORY;	}	for (;;) {		unsigned int addr = *rec++;		unsigned int len = *rec++;		unsigned int sum = *rec++;#ifdef CONFIG_SPLASH_SCREEN		unsigned int step = 0, current = 0;#endif		if (!addr && !sum) {			FlashReadArray();#ifdef CONFIG_SPLASH_SCREEN						progress_bar(100, 0);#endif						return;		}#ifdef CONFIG_SPLASH_SCREEN#define	LARGE_BLOCK	262144		step = (LARGE_BLOCK < len) ? LARGE_BLOCK : len;		current = 0;		while (current < len) {			total_length += step;			if (((total_length * 100 )/ img->len ) > progress_percentage ){				progress_percentage = (unsigned char)((total_length * 100 )/ img->len );				progress_bar(progress_percentage, 0);			}			flash( (void *) (addr - img->start + img->target + current), rec + current/4, step );			current +=step;			step = (LARGE_BLOCK < (len - current)) ? LARGE_BLOCK : (len - current);		}			#else		flash( (void *) (addr - img->start + img->target), rec, len );#endif		rec += len / sizeof *rec;	}}voidFlashImage( struct imginfo *img, unsigned int FlashOffset ){	struct FlashInfo fi;	unsigned int *rec;	if (!FlashReadInfo( &fi ))		Throw E_FL_READINFO;	EdbgOutputDebugString( "Flash size: %d (0x%X)\n", fi.size, fi.size );	EdbgOutputDebugString( "Write buffer size: %d\n", fi.wbufsize );	EdbgOutputDebugString( "Number of blocks: %d\n", fi.eblocks );	EdbgOutputDebugString( "Block size: %d (0x%X)\n", fi.eblocksize, fi.eblocksize );	EdbgOutputDebugString( "\n" );	StartFlash( FlashOffset, &fi );	if (img->copy) {		FlashXIP( img );		return;	}	WriteByte( 'B' );	WriteByte( '0' );	WriteByte( '0' );	WriteByte( '0' );	WriteByte( 'F' );	WriteByte( 'F' );	WriteByte( '\n' );	WriteDWord( img->start );	WriteDWord( img->len );	rec = (void *) (img->target + img->len);	for (;;) {		unsigned int addr = *rec++;		unsigned int len = *rec++;		unsigned int sum = *rec++;		unsigned int calcCRC = 0;		unsigned int i;		WriteDWord( addr );		WriteDWord( len );		WriteDWord( sum );		if (!addr && !sum) {			EndFlash();			return;		}		for (i = 0; i < len; i++) {			unsigned char d = *(unsigned char *) (addr++ - img->start + img->target);			WriteByte( d );			calcCRC += d;		}		if (calcCRC != sum)			Throw E_FL_CHECKSUM;	}}static voidFlashCommand( uint8_t cmd, uint32_t addr ){	uint32_t command = cmd;	FLASH( addr ) = (command << 16) | command;}/* 4.1 */voidFlashReadArray( void ){	FlashCommand( CFI_CMD_READ_ARRAY1, 0x00 );}/* 4.2 */#define	DOUBLETEST(val)		{ if (((val) & 0xFFFF) != ((val) >> 16)) return 0; }#define	COMBINEREAD(adr1, adr2)	((FLASH( adr1 ) & 0xFF00FF) | ((FLASH( adr2 ) & 0xFF00FF) << 8))intFlashReadInfo( struct FlashInfo *fi ){	uint32_t dw;	FlashCommand( CFI_CMD_QUERY, CFI_CMD_QUERY_OFFSET );	/* 	 * 4.2.1 - 4.2.3	 */	/* (nothing to do) */	/* 	 * 4.2.4 CFI Query Interface String	 */	/* check query-unique ascii string */	if (FLASH( CFI_QUERY_ID_OFFSET ) != 0x00510051)		return 0;			/* Q */	if (FLASH( CFI_QUERY_ID_OFFSET + 1 ) != 0x00520052)		return 0;			/* R */	if (FLASH( CFI_QUERY_ID_OFFSET + 2) != 0x00590059)		return 0;			/* Y */	/* check vendor specific algorithm */	if (COMBINEREAD( 0x13, 0x14 ) != 0x00010001)		return 0;	/* check extended query table primary algorithm address */	if (COMBINEREAD( 0x15, 0x16 ) != 0x00310031)		return 0;	/* check alternate vendor command set */	if (COMBINEREAD( 0x17, 0x18 ) != 0x00000000)		return 0;	/* check secondary algorithm extended query table address */	if (COMBINEREAD( 0x19, 0x1A ) != 0x00000000)		return 0;	/* 	 * 4.2.5 System Interface Information	 */	/* check Vcc logic supply minimum program/erase voltage */	if (FLASH( 0x1B ) != 0x00270027)		return 0;	/* check Vcc logic supply maximum program/erase voltage */	if (FLASH( 0x1C ) != 0x00360036)		return 0;	/* check Vpp [programming] supply minimum program/erase voltage */	if (FLASH( 0x1D ) != 0x00000000)		return 0;	/* check Vpp [programming] supply maximum program/erase voltage */	if (FLASH( 0x1E ) != 0x00000000)		return 0;	/* TODO: addresses 0x1F - 0x26 */	/* 	 * 4.2.6 Device Geometry Definition	 */	/* read device size */	DOUBLETEST( dw = FLASH( 0x27 ) );	/* device size is multiplied by two, because we have two ICs */	fi->size = (1 << (dw & 0xFFFF)) * 2;	/* read max. number of bytes in write buffer */	DOUBLETEST( dw = COMBINEREAD( 0x2A, 0x2B ) );	/* write buffer size is multiplied by two, because we have two ICs */	fi->wbufsize = (1 << (dw & 0xFFFF)) * 2;	/* check number of erase block regions */	if (FLASH( 0x2C ) != 0x00010001)		return 0;	/* read number of erase blocks */	DOUBLETEST( dw = COMBINEREAD( 0x2D, 0x2E ) );	fi->eblocks = (uint16_t) ((dw & 0xFFFF) + 1);	/* read erase block size */	DOUBLETEST( dw = COMBINEREAD( 0x2F, 0x30 ) );	/* erase block size is multiplied by two, because we have two ICs */	fi->eblocksize = ((dw & 0xFFFF) << 8) * 2;	/* 	 * 4.2.7 Primary-Vendor Specific Extended Query Table	 * TODO	 */	return 1;}#undef COMBINEREAD#undef DOUBLETEST/* 4.3 */intFlashReadID( void ){	FlashCommand( 0x90, 0x00 );	/* check Manufacturer Code */	if (FLASH( 0x00 ) != 0x890089)		return 0;	/* check Device Code */	switch (FLASH( 0x01 )) {		case 0x160016:			return 0x16;		case 0x170017:			return 0x17;		case 0x180018:			return 0x18;	}	return 0;}/* 4.4 TODO */uint32_tFlashReadStatusRegister( void ){	FlashCommand( 0x70, 0x00 );	return FLASH( 0x00 );}/* 4.5 */voidFlashClearStatusRegister( void ){	FlashCommand( 0x50, 0x00 );}/* 4.6 */uint32_tFlashBlockErase( int block ){	FlashClearStatusRegister();	FlashCommand( 0x20, block << 16 );	/* Block Erase Command */	FlashCommand( 0xD0, block << 16 );	/* confirm */	while ((FlashReadStatusRegister() & 0x00800080) != 0x00800080)	/* wait for SR.7 = 1 */		;	return FlashReadStatusRegister() & 0x007E007E;	/* return masked SR */}/* 4.8 */uint32_tFlashWriteToBuffer( uint32_t dst, const uint32_t *src, uint32_t size ){	uint32_t i;	dst >>= 2;	FlashClearStatusRegister();		/* clear status register */	do {		FlashCommand( 0xE8, dst );	/* Write to Buffer Command */	} while ((FLASH( dst ) & 0x00800080) != 0x00800080);	/* repeat until XSR.7 = 1 */	FlashCommand( (uint8_t) (size - 1), dst );	/* set word count */	for (i = 0; i < size; i++)		FLASH( dst++ ) = *src++;	/* copy data to write buffer */	FlashCommand( 0xD0, 0x00 );		/* confirm */	while ((FlashReadStatusRegister() & 0x00800080) != 0x00800080)	/* wait for SR.7 = 1 */		;	return FlashReadStatusRegister() & 0x007E007E;	/* return masked SR */}/* 4.14 */uint32_tFlashClearBlockLockBit( int block ){	FlashClearStatusRegister();	FlashCommand( CFI_INTEL_CMD_LOCK_SETUP, block << 16 );	FlashCommand( CFI_INTEL_CMD_UNLOCK_BLOCK, block << 16 );	while ((FlashReadStatusRegister() & 0x00800080) != 0x00800080)	/* wait for SR.7 = 1 */		;	return FlashReadStatusRegister() & 0x007E007E;	/* return masked SR */}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久av中文字幕片| 国产亚洲精品aa| 日韩伦理电影网| bt欧美亚洲午夜电影天堂| 精品国产免费一区二区三区四区| 亚洲欧美色综合| 在线观看一区日韩| 亚洲午夜视频在线| 欧美专区日韩专区| 一区二区三区欧美激情| 一本久久精品一区二区| 亚洲综合偷拍欧美一区色| 欧美亚洲免费在线一区| 亚洲专区一二三| 色94色欧美sute亚洲线路一久| 亚洲视频一二区| 色综合天天综合网天天狠天天| 亚洲精品高清视频在线观看| 欧美在线观看一区二区| 日韩影院免费视频| 久久久亚洲精品石原莉奈| 国产一区欧美日韩| 日本一区二区免费在线观看视频 | 欧美综合一区二区| 亚洲最色的网站| 91搞黄在线观看| 久久99国产乱子伦精品免费| 久久亚洲一区二区三区四区| 国产91在线观看丝袜| 国产精品久久久久久福利一牛影视 | 天天综合日日夜夜精品| 日韩亚洲国产中文字幕欧美| 狠狠网亚洲精品| 国产精品国产三级国产三级人妇| 色综合久久久久网| 免费人成精品欧美精品| 久久只精品国产| av不卡在线播放| 香港成人在线视频| 精品国产1区二区| 波多野结衣在线一区| 亚洲色图欧美激情| 欧美哺乳videos| 91在线观看一区二区| 亚洲成av人片一区二区梦乃| 精品播放一区二区| 在线亚洲欧美专区二区| 亚洲大型综合色站| 久久久久久97三级| 欧美三级电影在线看| 久久99精品国产麻豆婷婷| 亚洲人成亚洲人成在线观看图片 | 午夜激情一区二区| 久久精品人人做人人爽97| 欧美天天综合网| 99在线精品免费| 热久久国产精品| 亚洲欧洲成人精品av97| 精品福利一区二区三区免费视频| 99re8在线精品视频免费播放| 蜜桃一区二区三区在线观看| 亚洲欧美综合在线精品| 日韩一二三区视频| 色综合天天做天天爱| 国产福利一区二区| 免费精品视频最新在线| 中文字幕综合网| 国产欧美中文在线| 欧美成人精品二区三区99精品| 欧美性极品少妇| 99久久伊人网影院| av电影天堂一区二区在线观看| 成人免费观看视频| 国产电影精品久久禁18| 成人午夜视频在线| 懂色av噜噜一区二区三区av| 成人一级视频在线观看| 国产成人av自拍| 成人av资源在线| 色域天天综合网| 91激情在线视频| 91久久一区二区| 色婷婷久久一区二区三区麻豆| 91视频在线观看| 在线观看日韩一区| 欧美视频一二三区| 91精品国产福利| 欧美成人精品高清在线播放| 2023国产一二三区日本精品2022| 精品国产乱码久久久久久蜜臀 | 亚洲丝袜美腿综合| 亚洲一区二区三区自拍| 婷婷夜色潮精品综合在线| 免费人成精品欧美精品| 国产一区在线精品| 成人av资源网站| 在线观看亚洲专区| 日韩三级视频在线观看| 久久久精品欧美丰满| 国产精品午夜春色av| 一区二区三区波多野结衣在线观看| 亚洲综合成人在线| 捆绑变态av一区二区三区| 国产成人综合精品三级| 91网站在线播放| 欧美日韩一级二级三级| 日韩欧美精品三级| 欧美国产一区视频在线观看| 一卡二卡三卡日韩欧美| 日韩avvvv在线播放| 国产91在线观看丝袜| 欧美优质美女网站| 精品国产乱码久久久久久久久 | 亚洲一区二区三区精品在线| 毛片av中文字幕一区二区| www..com久久爱| 91精品国产丝袜白色高跟鞋| 国产喷白浆一区二区三区| 亚洲一区二区三区四区五区黄| 久久国产免费看| 91网站黄www| 精品人在线二区三区| 亚洲免费观看视频| 激情小说亚洲一区| 欧美影视一区在线| 国产精品欧美一区二区三区| 性欧美疯狂xxxxbbbb| 欧美一卡在线观看| 日本一区二区三区久久久久久久久不| 亚洲一区二区三区精品在线| 国产精品99久久久久久有的能看 | 亚洲自拍都市欧美小说| 国模套图日韩精品一区二区| 欧洲一区二区三区免费视频| 国产日韩欧美综合一区| 午夜精品久久久久久不卡8050| 丁香亚洲综合激情啪啪综合| 日韩一区二区三区视频在线| 亚洲人成亚洲人成在线观看图片| 国产精品一区二区久久精品爱涩| 欧美日韩一区三区| 亚洲日穴在线视频| 成人午夜视频福利| 精品成人在线观看| 免费日本视频一区| 欧美老肥妇做.爰bbww视频| 亚洲天堂网中文字| 风间由美一区二区av101| 欧美videos大乳护士334| 亚洲成a人片在线观看中文| 一本大道久久a久久综合 | 亚洲精品免费电影| 成人高清视频免费观看| 久久先锋影音av| 久久国产精品色| 538prom精品视频线放| 亚洲国产精品自拍| 欧美日韩一卡二卡三卡 | 一区二区三区四区在线播放| 国产91精品入口| 久久久久久久久免费| 精品中文字幕一区二区| 精品伦理精品一区| 久久99精品国产麻豆不卡| 欧美xxx久久| 精品一区二区三区在线播放| 日韩欧美一区二区视频| 婷婷丁香久久五月婷婷| 在线不卡一区二区| 日韩成人av影视| 91精品国产品国语在线不卡| 日本午夜精品一区二区三区电影| 欧美酷刑日本凌虐凌虐| 日本午夜一区二区| 精品免费一区二区三区| 国产真实乱子伦精品视频| 国产农村妇女精品| 99国产精品久久久久| 亚洲丝袜制服诱惑| 欧美日韩视频第一区| 视频一区二区三区入口| 欧美一级日韩免费不卡| 国产乱码一区二区三区| 国产精品不卡一区| 色天使久久综合网天天| 亚洲va欧美va人人爽| 91精品国产手机| 国产激情一区二区三区四区 | 日韩欧美专区在线| 九九在线精品视频| 国产人妖乱国产精品人妖| 成人高清在线视频| 一区二区三区日韩精品| 欧美一级免费观看| 国产剧情一区在线| 伊人婷婷欧美激情| 精品久久久久久亚洲综合网| www.66久久| 另类成人小视频在线| 国产视频不卡一区|