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

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

?? amd29f016.c

?? motorola自己開發的針對coldfire 5272的Dbug bootloader程序
?? C
字號:
/*
 * File:		amd29f016.c
 * Purpose:		Device driver for the AMD 29F016 Flash.
 *
 * Notes:       This driver supports a single type (AMD29F016) and
 *              width of FLASH.  The width support is done during
 *              compilation.  It can support multiple banks of
 *              same-width ADM29F016 FLASH.
 *
 *              If different types and width of FLASH are required,
 *              see driver amd29f0x0.c.
 *
 * Author:		Eric DeVolder
 * Date:		12-3-95
 *
 * Modifications:
 *
 */

#include "src/include/dbug.h"
#include "src/dev/flash/amd29f016.h"

/*
 * The AMD29F016 FLASH devices.  These devices are 2M x 8 devices.
 *
 * Note:  This driver supports one of the following configurations
 * for these devices.  Possible configurations are:
 *
 *      1 AMD29F016  as a single  8-bit memory device
 *      2 AMD29F016s as a single 16-bit memory device
 *      4 AMD29F016s as a single 32-bit memory device
 *
 * One of the following C pre-processor define statements must
 * exist prior to compilation:
 *
 * #define AMD29F016_8BIT_WIDE
 * #define AMD29F016_16BIT_WIDE
 * #define AMD29F016_32BIT_WIDE
 *
 * IMPORTANT:  It is not possible to execute any of these routines
 * if the code for these routines is in the FLASH itself.  This is
 * because these routines change the mode of the device so that reads
 * from it are not always possible.  The code must be executed out of
 * DRAM.
 */

/*
 * WARNING:  To eliminate playing alot of games with the linker
 * to properly treat this PIC driver, the two routines/symbols
 * amd29f016_start and amd29f016_end are used to determine the 
 * start and end of the FLASH PIC driver in ROM/FLASH so that it
 * can be copied out to DRAM and then executed.  In other words,
 * any modifications/additions must be between these two functions!
 */
/*****************************************************************/
void
amd29f016_start (void)
{
}

/*****************************************************************/
void
amd29f016_read (AMD29F016 *amd29f016)
{
	/*
	 * This routine places the FLASH in the read/reset mode.
	 */
	amd29f016->device.cmdreg1 = AMD29F016_READ_CMD1;
	amd29f016->device.cmdreg2 = AMD29F016_READ_CMD2;
	amd29f016->device.cmdreg1 = AMD29F016_READ_CMD3;
}

/*****************************************************************/
int
amd29f016_sector_erase (AMD29F016 *amd29f016, AMD29F016_SECTOR sector)
{
	/*
	 * This routine erases one sector in the FLASH.
	 */
	AMD29F016_CELL	*s;

	/*
	 * Point to beginning of the desired sector
	 */
	s = (AMD29F016_CELL *)&(amd29f016->sector[sector]);

	/*
	 * Perform the Sector Erase command sequence.
	 */
	amd29f016->device.cmdreg1 = AMD29F016_SECTORERASE_CMD1;
	amd29f016->device.cmdreg2 = AMD29F016_SECTORERASE_CMD2;
	amd29f016->device.cmdreg1 = AMD29F016_SECTORERASE_CMD3;
	amd29f016->device.cmdreg1 = AMD29F016_SECTORERASE_CMD4;
	amd29f016->device.cmdreg2 = AMD29F016_SECTORERASE_CMD5;
	*s = AMD29F016_SECTORERASE_CMD6;

	/*
	 * Wait for the device to erase the sector
	 */

	while ((*s & AMD29F016_SECTORERASE_DONE) != AMD29F016_SECTORERASE_DONE)
		;

	/*
	 * Place the device back in the Read/Reset mode.
	 */
	amd29f016_read (amd29f016);

	return 1;
}


/*****************************************************************/
int
amd29f016_id (AMD29F016 *amd29f016)
{
	/*
	 * This routine extracts from the FLASH the manufacturer and
	 * and device code.  If the codes match those for the AMD29F016,
	 * then 1 is returned, else 0.
	 */
	volatile unsigned int manuf, device;

	/*
	 * Perform the Autoselect command sequence.
	 */
	amd29f016->device.cmdreg1 = AMD29F016_AUTOSELECT_CMD1;
	amd29f016->device.cmdreg2 = AMD29F016_AUTOSELECT_CMD2;
	amd29f016->device.cmdreg1 = AMD29F016_AUTOSELECT_CMD3;

	/*
	 * Read the manufacturer and device id codes.
	 */
	manuf = amd29f016->device.manuf;
	device = amd29f016->device.id;

	/*
	 * Place the device back in the Read/Reset mode.
	 */
	amd29f016_read (amd29f016);

	/*
	 * Determine if an AMD29F016 or not.
	 */
	if (device == AMD29F016_DEVICE_CODE)
		return TRUE;
	else
		return FALSE;
}


/*****************************************************************/
int
amd29f016_write (AMD29F016 *amd29f016,
	void *data, unsigned length, AMD29F016_SECTOR sector, void (*func)(void))
{
	/*
	 * This routine programs the device beginning at 'sector' with
	 * 'data' for 'length' bytes.  This routine is capable of
	 * programming multiple consecutive sectors.
	 */
	int index, written, done;
	AMD29F016_CELL *source;
	AMD29F016_CELL *target;
	AMD29F016_CELL rdata;

	/*
	 * Step 1)  ID the flash as a AMD29F016.
	 */
	if (!amd29f016_id(amd29f016))
		return 0;

	/*
	 * Step 2)  Point to the beginning sector.
	 */
	target = (AMD29F016_CELL *)&(amd29f016->sector[sector]);

	source = (AMD29F016_CELL *)data;

	done = 0;
	written = 0;
	while (!done)
	{
		/*
		 * Step 3)  Erase the sector.
		 */
		if (!amd29f016_sector_erase (amd29f016, sector))
			return -1;

		/*
		 * Step 5)  Program the FLASH with the sector(s) contained in RAM.
		 */
		for (index = 0; (index < AMD29F016_SECTOR_SIZE) && (written < length);
			++index)
		{
			/*
			 * Perform the Byte Program command sequence.
			 */
			amd29f016->device.cmdreg1 = AMD29F016_BYTEPROG_CMD1;
			amd29f016->device.cmdreg2 = AMD29F016_BYTEPROG_CMD2;
			amd29f016->device.cmdreg1 = AMD29F016_BYTEPROG_CMD3;
			*target = *source;

			/*
			 * Poll to make sure it is done before continuing...
			 */
			while (1)
			{
				int timeouts;

				timeouts = 0;

				rdata = *(AMD29F016_CELL *)target;

				if ((rdata & AMD29F016_DATA_POLL_MASK) ==
					(*source & AMD29F016_DATA_POLL_MASK))
				{
					break;
				}
				else
				{
					rdata = *(AMD29F016_CELL *)target;

					if (rdata & AMD29F016_TIME_EXCEEDED)
					{
						rdata = *(AMD29F016_CELL *)target;

						if ((rdata & AMD29F016_DATA_POLL_MASK) ==
							(*source & AMD29F016_DATA_POLL_MASK))
						{
							break;
						}

						if (++timeouts > 1024)
						{
							break;
						}
					}
				}
			}

			/*
			 * Verify write and increment bytes written counter.
			 */
			if (*target == *source)
			{
				written += sizeof(AMD29F016_CELL);

				++target;
				++source;
			}
			else
			{
				done = 1;
				break;
			}
		}

		if (++sector >= AMD29F016_SECTORS)
			done = 1;

		if (written >= length)
			done = 1;
	}

	/*
	 * Step 6)  Place the device back in the read mode.
	 */
	amd29f016_read (amd29f016);

	if (func != NULL)
	{
		func();
	}

	return written;
}

void
amd29f016_end(void)
{
	/*
	 * This function is empty and at the END of all code so that it
	 * can be used to compute the size of the code contained in this
	 * driver.
 	 */
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久午夜免费电影| 亚洲精品国久久99热| 国产精品久久福利| 亚洲成a人片在线观看中文| 韩国理伦片一区二区三区在线播放 | 色婷婷综合久色| 久久伊99综合婷婷久久伊| 亚洲大片免费看| 91碰在线视频| 亚洲欧洲在线观看av| 国产乱码精品一区二区三区五月婷 | 国产成人精品aa毛片| 欧美视频你懂的| 亚洲人成伊人成综合网小说| 国产精品资源网站| 26uuu色噜噜精品一区| 视频一区二区三区中文字幕| 91福利在线看| 一区二区高清免费观看影视大全| 国产毛片精品视频| 精品少妇一区二区三区日产乱码 | 欧美在线观看一二区| 国产欧美日韩在线看| 国产自产高清不卡| 精品久久久久久久久久久久久久久久久 | 青草av.久久免费一区| 在线观看一区不卡| 亚洲男同性恋视频| 色综合久久综合中文综合网| 国产精品久久午夜| av在线播放成人| 成人欧美一区二区三区视频网页 | 免费观看一级欧美片| 在线不卡a资源高清| 香蕉久久一区二区不卡无毒影院| 欧美亚洲动漫另类| 艳妇臀荡乳欲伦亚洲一区| 91蜜桃婷婷狠狠久久综合9色| 一区二区中文视频| 在线视频你懂得一区二区三区| 亚洲色图都市小说| 欧美日韩专区在线| 麻豆国产欧美一区二区三区| 久久在线观看免费| 成人免费视频播放| 亚洲乱码国产乱码精品精98午夜| 91激情在线视频| 日韩二区在线观看| 久久久综合九色合综国产精品| 国产精品一区二区三区乱码| 国产精品三级av在线播放| 9人人澡人人爽人人精品| 亚洲午夜一区二区三区| 欧美一区二区三区在线电影 | 2欧美一区二区三区在线观看视频| 国产一区二区0| **欧美大码日韩| 欧美日韩一级黄| 国产制服丝袜一区| 一区二区三区美女| 欧美大度的电影原声| 成人动漫一区二区| 亚洲在线视频免费观看| 欧美成人女星排行榜| www.亚洲激情.com| 青青草伊人久久| 国产精品国产a| 欧美一级片免费看| av午夜精品一区二区三区| 日本中文字幕一区二区有限公司| 久久久精品国产免费观看同学| 91影视在线播放| 韩国欧美国产1区| 亚洲一区二区三区激情| 久久精品视频一区二区| 91成人在线精品| 国产成人午夜视频| 视频一区二区中文字幕| 亚洲欧美一区二区在线观看| 91精品国产一区二区三区蜜臀| 成人网男人的天堂| 免费视频一区二区| 一区二区三区资源| 国产亚洲美州欧州综合国| 在线91免费看| 一本久久综合亚洲鲁鲁五月天 | 日韩精品一区在线观看| 色呦呦国产精品| 国产成人午夜精品影院观看视频| 午夜精品福利久久久| 日韩毛片一二三区| 久久综合色8888| 欧美一区二区性放荡片| 欧美三级电影精品| 色婷婷综合久久久中文一区二区 | 中文字幕乱码日本亚洲一区二区| 欧美一区二区三区系列电影| 欧美视频你懂的| 91成人在线精品| 91在线精品一区二区| 国产成都精品91一区二区三 | 午夜精品久久久久久久蜜桃app| 国产欧美日韩综合| 久久久久久久久一| 日韩免费看的电影| 91精品国产色综合久久不卡电影| 欧美无砖砖区免费| 欧美亚洲禁片免费| 欧洲一区在线观看| 色综合久久99| 91久久免费观看| 在线观看日韩高清av| 在线观看日产精品| 欧美中文字幕一区二区三区亚洲| 日本久久一区二区三区| 色88888久久久久久影院野外| 91麻豆swag| 在线欧美小视频| 精品视频在线视频| 91精品国产黑色紧身裤美女| 日韩一区二区免费电影| 日韩欧美国产综合| 2023国产精品| 亚洲国产精品国自产拍av| 国产精品丝袜一区| 中文字幕第一页久久| 亚洲男人的天堂在线aⅴ视频| 一区二区在线看| 日韩av在线免费观看不卡| 免费在线视频一区| 国产精品一区在线观看乱码| 大桥未久av一区二区三区中文| 不卡的看片网站| 91官网在线观看| 欧美一区二区成人6969| 精品国产91亚洲一区二区三区婷婷| 久久久99精品久久| 国产精品久久久久久久久免费樱桃| 亚洲素人一区二区| 性做久久久久久免费观看欧美| 毛片不卡一区二区| 国产不卡视频在线观看| 91年精品国产| 欧美一区二区视频观看视频| 国产欧美一区视频| 亚洲午夜在线视频| 国产精品一区二区91| 在线观看欧美日本| 精品欧美黑人一区二区三区| 亚洲国产精品v| 午夜视频一区二区三区| 国产乱码一区二区三区| 欧洲视频一区二区| 久久人人爽人人爽| 一区二区欧美视频| 国产一区二区精品久久99| 在线观看亚洲精品视频| 美女脱光内衣内裤视频久久网站| 国产成人鲁色资源国产91色综| 欧美午夜视频网站| 中文字幕不卡在线播放| 日韩影院免费视频| 91麻豆国产在线观看| 欧美www视频| 亚洲妇女屁股眼交7| 成人av电影在线播放| 日韩欧美另类在线| 一区二区三区视频在线看| 国产精品18久久久久久vr| 欧美在线观看一二区| 国产精品你懂的在线欣赏| 久久精品噜噜噜成人av农村| 色婷婷av一区二区三区大白胸| 久久嫩草精品久久久久| 偷拍自拍另类欧美| 色婷婷综合久久久中文字幕| 国产婷婷色一区二区三区四区 | 亚洲国产岛国毛片在线| 美女视频黄a大片欧美| 欧美少妇一区二区| 亚洲欧洲日韩一区二区三区| 国产麻豆成人精品| 日韩精品在线一区| 奇米888四色在线精品| 欧美三级中文字幕在线观看| 亚洲人123区| 91蜜桃传媒精品久久久一区二区| 久久久99精品免费观看| 国产美女av一区二区三区| 日韩视频一区二区在线观看| 午夜精品一区二区三区免费视频| 91激情五月电影| 亚洲自拍都市欧美小说| 91豆麻精品91久久久久久| 一区二区三区四区不卡视频| 91亚洲精品乱码久久久久久蜜桃| 国产精品毛片久久久久久| 成人免费高清视频| 亚洲少妇最新在线视频| 91激情在线视频|