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

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

?? flash.c.txt

?? 讀寫am29F040的C語言程序
?? TXT
?? 第 1 頁 / 共 2 頁
字號:
/************************************************************************/
/*                                                                      */
/*  AMD Flash Memory Drivers                                            */
/*  File name: FLASH.C                                                  */
/*  Revision:  1.2  1/07/99                                             */
/*                                                                      */
/* Copyright (c) 1999 ADVANCED MICRO DEVICES, INC. All Rights Reserved. */
/* This software is unpublished and contains the trade secrets and      */
/* confidential proprietary information of AMD. Unless otherwise        */
/* provided in the Software Agreement associated herewith, it is        */
/* licensed in confidence "AS IS" and is not to be reproduced in whole  */
/* or part by any means except for backup. Use, duplication, or         */
/* disclosure by the Government is subject to the restrictions in       */
/* paragraph (b) (3) (B) of the Rights in Technical Data and Computer   */
/* Software clause in DFAR 52.227-7013 (a) (Oct 1988).                  */
/* Software owned by                                                    */
/* Advanced Micro Devices, Inc.,                                        */
/* One AMD Place,                                                       */
/* P.O. Box 3453                                                        */
/* Sunnyvale, CA 94088-3453.                                            */
/************************************************************************/
/*  This software constitutes a basic shell of source code for          */
/*  programming all AMD Flash components. AMD                           */
/*  will not be responsible for misuse or illegal use of this           */
/*  software for devices not supported herein. AMD is providing         */
/*  this source code "AS IS" and will not be responsible for            */
/*  issues arising from incorrect user implementation of the            */
/*  source code herein. It is the user's responsibility to              */
/*  properly design-in this source code.                                */
/*                                                                      */ 
/************************************************************************/                                                                        
#include "flash.h"

/*********************************************************************/
/* The purpose of get_flash_memptr() is to return a memory pointer   */
/* which points to the beginning of memory space allocated for the   */
/* flash.  All function pointers are then referenced from this       */
/* pointer. 							     */
/*                                                                   */
/* Different systems will implement this in different ways:          */
/* possibilities include:                                            */
/*  - A direct memory pointer                                        */
/*  - A pointer to a memory map                                      */
/*  - A pointer to a hardware port from which the linear             */
/*    address is translated                                          */
/*  - Output of an MMU function / service                            */
/*                                                                   */
/* Also note that this function expects the pointer to a specific    */
/* sector of the device.  This can be provided by dereferencing      */
/* the pointer from a translated offset of the sector from a         */
/* global base pointer (e.g. flashptr = base_pointer + sector_offset)*/
/*                                                                   */
/* Important: Many AMD flash devices need both bank and or sector    */
/* address bits to be correctly set (bank address bits are A18-A16,  */
/* and sector address bits are A18-A12, or A12-A15).  Flash parts    */
/* which do not need these bits will ignore them, so it is safe to   */
/* assume that every part will require these bits to be set.         */
/*********************************************************************/

extern unsigned char FAR *get_flash_memptr(int sector);

struct flashinfo *meminfo; /* A pointer into a specific field defined
                              in memdesc below */
/*********************************************************************/
/* Memdesc is a global storage array for sector and bank parameters. */
/* This can be found and inputted directly from any AMD specification*/
/* sheet.  If minimal static data storage is required, all other     */
/* declarations can be removed except for the flash component being  */
/* used in the application.                                          */
/* Four examples are provided of common flash devices                */
/* Also note the specifics to bank / sector locations when dealing   */
/* with DL flash parts.                                              */
/*********************************************************************/

struct flashinfo memdesc[] = {
	 /* DL800T */
	{"Am29DL800T", 0L, 0, 22, 14, 0 ,{
	{65536,     0x00000,    2},
	{65536,     0x10000,    2},
	{65536,     0x20000,    2},
	{65536,     0x30000,    2},
	{65536,     0x40000,    2},
	{65536,     0x50000,    2},
	{65536,     0x60000,    2},
	{65536,     0x70000,    2},
	{65536,     0x80000,    2},
	{65536,     0x90000,    2},
	{65536,     0xA0000,    2},
	{65536,     0xB0000,    2},
	{65536,     0xC0000,    2},
	{65536,     0xD0000,    2},
	{16384,     0xE0000,    1},
	{32768,     0xE4000,    1},
	{8192,      0xEC000,    1},
	{8192,      0xEE000,    1},
	{8192,      0xF0000,    1},
	{8192,      0xF2000,    1},
	{32768,     0xF4000,    1},
	{16384,     0xFC000,    1}
	}
	 },
	 /* DL800B */
	{"Am29DL800B", 0L, 0, 22, 0, 8 ,{
	{16384,     0x00000,    1},
	{32768,     0x04000,    1},
	{8192,      0x0C000,    1},
	{8192,      0x0E000,    1},
	{8192,      0x10000,    1},
	{8192,      0x12000,    1},
	{32768,     0x14000,    1},
	{16384,     0x1C000,    1},
	{65536,     0x20000,    2},
	{65536,     0x30000,    2},
	{65536,     0x40000,    2},
	{65536,     0x50000,    2},
	{65536,     0x60000,    2},
	{65536,     0x70000,    2},
	{65536,     0x80000,    2},
	{65536,     0x90000,    2},
	{65536,     0xA0000,    2},
	{65536,     0xB0000,    2},
	{65536,     0xC0000,    2},
	{65536,     0xD0000,    2},
	{65536,     0xE0000,    2},
	{65536,     0xF0000,    2}
	}
	},
	 /* LV800T */
	{"Am29LV800T", 0L, 0, 19, 0, 4 ,{
	{65536,     0x00000,    1},
	{65536,     0x10000,    1},
	{65536,     0x20000,    1},
	{65536,     0x30000,    1},
	{65536,     0x40000,    1},
	{65536,     0x50000,    1},
	{65536,     0x60000,    1},
	{65536,     0x70000,    1},
	{65536,     0x80000,    1},
	{65536,     0x90000,    1},
	{65536,     0xA0000,    1},
	{65536,     0xB0000,    1},
	{65536,     0xC0000,    1},
	{65536,     0xD0000,    1},
	{65536,     0xE0000,    1},
	{32768,     0xF0000,    1},
	{8192,      0xF8000,    1},
	{8192,      0xFA000,    1},
	{16384,     0xFC000,    1}
	}
	},
	 /* LV800B */
	{"Am29LV800B", 0L, 0, 19, 0, 4 ,{
	{16384,     0x00000,    1},
	{8192,      0x04000,    1},
	{8192,      0x06000,    1},
	{32768,     0x08000,    1},
	{65536,     0x10000,    1},
	{65536,     0x20000,    1},
	{65536,     0x30000,    1},
	{65536,     0x40000,    1},
	{65536,     0x50000,    1},
	{65536,     0x60000,    1},
	{65536,     0x70000,    1},
	{65536,     0x90000,    1},
	{65536,     0xA0000,    1},
	{65536,     0xB0000,    1},
	{65536,     0xC0000,    1},
	{65536,     0xD0000,    1},
	{65536,     0xE0000,    1},
	{65536,     0xF0000,    1}
	}
	},
	/* LV160B - same as LV800B, but limited to 2MB addressing window*/
	{"Am29LV160B", 0L, 0, 19, 0, 0 ,{
	{16384,     0x00000,    1},
	{8192,      0x04000,    1},
	{8192,      0x06000,    1},
	{32768,     0x08000,    1},
	{65536,     0x10000,    1},
	{65536,     0x20000,    1},
	{65536,     0x30000,    1},
	{65536,     0x40000,    1},
	{65536,     0x50000,    1},
	{65536,     0x60000,    1},
	{65536,     0x70000,    1},
	{65536,     0x80000,    1},
	{65536,     0x90000,    1},
	{65536,     0xA0000,    1},
	{65536,     0xB0000,    1},
	{65536,     0xC0000,    1},
	{65536,     0xD0000,    1},
	{65536,     0xE0000,    1},
	{65536,     0xF0000,    1}
	}
	},
	/* LV400B */
	{"Am29LV400B", 0L, 0, 11, 0, 0 ,{
	{16384,     0x00000,    1},
	{8192,      0x04000,    1},
	{8192,      0x06000,    1},
	{32768,     0x08000,    1},
	{65536,     0x10000,    1},
	{65536,     0x20000,    1},
	{65536,     0x30000,    1},
	{65536,     0x40000,    1},
	{65536,     0x50000,    1},
	{65536,     0x60000,    1},
	{65536,     0x70000,    1},
	}
	}
};

/*********************************************************************/
/* init_flash() performs any initial memory allocation, setting of   */
/* parameters, and also initializes the appropriate sector table     */
/* defined above.                                                    */
/* Memory mapping or allocation specifics will need to be provided   */
/* by the programmer of the driver, and will be highly dependant on  */
/* on the system being used.                                         */
/*********************************************************************/

unsigned int init_flash(unsigned int flashtype)
{
  /* Insert any memory initialization or memory mapping here */

  meminfo = &memdesc[flashtype];

  return(1);
}

/*********************************************************************/
/* Flash_command() is the main driver function.  It performs         */
/* every possible command available to AMD B revision                */
/* flash parts. Note that this command is not used directly, but     */
/* rather called through the API wrapper functions provided below.   */
/* This function can be called directly if desired (see wrapper      */
/* functions defined below.                                          */
/*********************************************************************/

void flash_command(int command, int sector, int offset,
						 unsigned int data)
{
	 static dword base;    /* base offset for our sector */
	 static word *selp;
	 static dword sechigh;
	 static word far *flashptr;  /* flash window (64K bytes) */
	 static int oldsector = -1;
	 int retry;
       
         /**************************************************************/
	 /* IMPORTANT: Note that flashptr is defined as a WORD pointer */
         /* If BYTE pointers are used, the command tables will have to */
         /* be remapped						       */
         /* Note 1: flashptr is declared far - if system does not      */
         /*         support far pointers, this will have to be changed */
         /* Note 2: flashptr is declared static to avoid calling       */
         /*         get_flash_memptr() on successive sector accesses   */
         /**************************************************************/

	 /******************************************************************/
	 /* On systems where bus glitching is prevalent, some long command */
  	 /* strings may be interrupted and cause the command to fail (this */
         /* is most probable on six cycle commands such as chip erase). In */
         /* order to ensure that flash_command executes the command        */
         /* properly, it may be necessary to issue the command more than   */
         /* once in order for it to be accepted by the flash device.  In   */
         /* these cases it is recommended that the retry number be made    */
         /* positive (such as 1 or 2), so that flash_command will try      */
         /* to issue the command more than once.  Keep in mind that this   */
         /* will only be attempted if the command fails in the first       */
         /* attempt.                                                       */
         /******************************************************************/
         
         static int retrycount[] = {0,0,0,0,0,0,0,0,0,0};

	 retry = retrycount[command];

	 if(sector != oldsector) {
		flashptr = (word far *) get_flash_memptr(sector);
	 }

again:

	 if (command == FLASH_SELECT) {
		return;
	 } else if (command == FLASH_RESET || command > FLASH_LASTCMD) {
		  flashptr[0] = 0xF0;   /* assume reset device to read mode */
	 } else if (command == FLASH_ESUSPEND) {
		  flashptr[0] = 0xB0;   /* suspend sector erase */
	 } else if (command == FLASH_ERESUME) {
		  flashptr[0] = 0x30;   /* resume suspended sector erase */
	 } else if (command == FLASH_UBPROG) {
		  flashptr[0] = 0xA0;
		  flashptr[((meminfo->sec[sector].base)+offset)/2] = data;
	 } else if (command == FLASH_UBRESET) {
		  flashptr[0] = 0x90;
		  flashptr[0] = 0x00;
	 }
	 else {
		  flashptr[0x555] = 0xAA;       /* unlock 1 */
		  flashptr[0x2AA] = 0x55;       /* unlock 2 */
		  switch (command) {
			 case FLASH_AUTOSEL:
				flashptr[0x555] = 0x90;
				break;
			 case FLASH_PROG:
				flashptr[0x555] = 0xA0;
				flashptr[((meminfo->sec[sector].base)+offset)/2] = data;
				break;
			 case FLASH_CERASE:
				flashptr[0x555] = 0x80;
				flashptr[0x555] = 0xAA;
				flashptr[0x2AA] = 0x55;
				flashptr[0x555] = 0x10;
				break;
			 case FLASH_SERASE:
				flashptr[0x555]  = 0x80;
				flashptr[0x555]  = 0xAA;
				flashptr[0x2AA]  = 0x55;
				flashptr[(meminfo->sec[sector].base)/2] = 0x30;
				break;
			 case FLASH_UB:
				flashptr[0x555] = 0x20;
				break;
		  }
	 }

	 if (retry-- > 0 && flash_status(flashptr) == STATUS_READY) {
		goto again;
	 }
}
/*********************************************************************/
/* Flash_write extends the functionality of flash_program() by       */
/* providing an faster way to program multiple data words, without   */
/* needing the function overhead of looping algorithms which         */
/* program word by word.  This function utilizes fast pointers       */
/* to quickly loop through bulk data.                                */
/*********************************************************************/
int flash_write(int sector, unsigned offset, byte *buf, 
                int nbytes, int ub)
{
	 word far *flashptr; /* flash window */
	 word far *src, *dst;
	 int stat;
	 int retry = 0, retried = 0;

	 flashptr = (word *)get_flash_memptr(sector);
	 dst = flashptr + offset/2;   /* (byte offset) */
	 src = (word *)buf;

	 if ((nbytes | offset) & 1) {
		return -1;
	 }

again:

	 /* Check to see if we're in unlock bypass mode */
         if (ub == FALSE)
		flashptr[0] = 0xF0;  /* reset device to read mode */

	 while ((stat = flash_status(flashptr)) == STATUS_BUSY) {}
	 if (stat != STATUS_READY) {
		return (char *)src - buf;
	 }

	 while (nbytes > 0) {
		if (ub == FALSE){
		  flashptr[0x555] = 0xAA;      /* unlock 1 */
		  flashptr[0x2AA] = 0x55;      /* unlock 2 */
		}
		flashptr[0x555] = 0xA0;
		*dst++ = *src++;
		while ((stat = flash_status(flashptr)) == STATUS_BUSY) {}
		if (stat != STATUS_READY) break;
		nbytes -= 2;
	 }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
制服丝袜亚洲播放| 亚洲老妇xxxxxx| 亚洲欧洲一区二区在线播放| 天堂影院一区二区| 国产九九视频一区二区三区| 欧美另类高清zo欧美| 中文字幕乱码久久午夜不卡| 久久机这里只有精品| 欧美色图片你懂的| 亚洲毛片av在线| 国产精品一卡二卡在线观看| 欧美电影在线免费观看| 最新中文字幕一区二区三区| 国产另类ts人妖一区二区| 日韩三级伦理片妻子的秘密按摩| 亚洲欧美区自拍先锋| 国产一区二区三区美女| 337p亚洲精品色噜噜狠狠| 亚洲人成在线播放网站岛国| 成人午夜av在线| 国产午夜久久久久| 国产一区二三区| 日韩精品一区二区三区在线观看| 亚洲午夜久久久久| 91麻豆免费在线观看| 国产精品伦一区| 丁香婷婷综合激情五月色| 2020国产精品久久精品美国| 蜜桃一区二区三区在线| 日韩视频123| 久久精品国产久精国产| 日韩午夜精品电影| 免费人成在线不卡| 日韩欧美一级片| 日本一道高清亚洲日美韩| 欧美久久久影院| 天天综合天天做天天综合| 欧美日韩高清一区二区不卡| 亚洲高清中文字幕| 欧美一区二区在线不卡| 免费看黄色91| 欧美r级在线观看| 精品一区二区日韩| 久久久久9999亚洲精品| 国产成人精品网址| 国产精品伦一区| 在线区一区二视频| 亚洲成av人片一区二区| 欧美日韩国产小视频| 石原莉奈在线亚洲三区| 欧美刺激脚交jootjob| 国产一区二区三区高清播放| 久久精品视频在线免费观看| www.日韩av| 亚洲国产视频网站| 欧美精品一区二| 成人在线视频首页| 依依成人综合视频| 日韩三区在线观看| www.欧美亚洲| 亚洲一区二区三区激情| 7777女厕盗摄久久久| 久久9热精品视频| 中文在线资源观看网站视频免费不卡| 成人av在线播放网站| 午夜国产精品一区| 久久综合色之久久综合| 91免费看片在线观看| 日韩电影在线一区| 欧美国产精品中文字幕| 欧美体内she精高潮| 麻豆国产精品777777在线| 国产精品视频一二三| 欧美妇女性影城| 成人免费的视频| 日韩av电影天堂| 中文一区在线播放| 欧美一区二区播放| 色综合久久久久久久久久久| 免费观看在线色综合| 成人欧美一区二区三区黑人麻豆| 91麻豆精品国产91久久久使用方法 | 欧美三级三级三级| 成人黄色片在线观看| 日韩黄色一级片| 亚洲人xxxx| 国产午夜精品在线观看| 欧美一级一级性生活免费录像| www.成人在线| 黄一区二区三区| 日韩av一级电影| 一级女性全黄久久生活片免费| 久久久亚洲精品石原莉奈| 欧美色图在线观看| 9l国产精品久久久久麻豆| 久久99久久99| 日精品一区二区| 亚洲精品中文字幕在线观看| 国产精品视频免费看| 日韩欧美亚洲一区二区| 欧美日韩亚洲不卡| 欧美性大战久久久久久久| 成人免费不卡视频| 国产精品一区二区久久不卡 | 亚洲欧美日韩中文字幕一区二区三区 | 中文字幕一区二区三区不卡在线| 欧美mv日韩mv国产网站| 欧美精品 国产精品| 欧美色图免费看| 欧美日韩亚洲综合一区二区三区| 91欧美一区二区| 99精品热视频| 99久久精品免费看国产免费软件| 高清不卡在线观看av| 国产电影精品久久禁18| 国产一区二区美女诱惑| 九九国产精品视频| 久久国产精品色婷婷| 久久er精品视频| 国产精品2024| va亚洲va日韩不卡在线观看| 成人av电影在线观看| 成人午夜激情影院| 色婷婷久久久综合中文字幕| 在线观看不卡视频| 欧美精品v日韩精品v韩国精品v| 欧美三级三级三级| 欧美一级日韩一级| 精品国产百合女同互慰| 国产夜色精品一区二区av| 国产蜜臀av在线一区二区三区| 国产亚洲美州欧州综合国| 国产精品欧美精品| 亚洲综合色婷婷| 日韩电影免费一区| 久久成人综合网| 国产成人精品免费在线| 成人激情文学综合网| 91视频一区二区三区| 欧美日韩高清影院| 精品国产三级电影在线观看| 欧美国产亚洲另类动漫| 亚洲精品乱码久久久久久| 蜜桃视频一区二区| 成人性生交大片免费看视频在线| 99精品久久99久久久久| 欧美日韩精品一区二区三区蜜桃| 欧美成人午夜电影| 国产精品狼人久久影院观看方式| 亚洲精品中文在线| 美女一区二区久久| a在线欧美一区| 欧美一区二区三区公司| 亚洲国产精品成人综合色在线婷婷 | 9色porny自拍视频一区二区| 欧美三级电影网| 久久久久国产一区二区三区四区| 亚洲美女偷拍久久| 极品尤物av久久免费看| 一本色道亚洲精品aⅴ| 欧美电视剧在线看免费| 中文字幕亚洲在| 日本在线播放一区二区三区| 99久久国产综合精品女不卡| 欧美精品一二三| 国产精品久99| 久久精品理论片| 欧美日韩综合在线免费观看| 欧美国产一区二区在线观看| 人人狠狠综合久久亚洲| 色综合天天天天做夜夜夜夜做| 欧美大胆一级视频| 亚洲成人一二三| 97成人超碰视| 国产午夜精品在线观看| 美国一区二区三区在线播放| 欧洲色大大久久| 成人欧美一区二区三区黑人麻豆| 韩国毛片一区二区三区| 在线综合视频播放| 一区二区三区欧美日| www.视频一区| 国产精品三级久久久久三级| 久久成人免费电影| 日韩欧美激情四射| 午夜精品福利在线| 欧美三区免费完整视频在线观看| 国产精品久久影院| 粉嫩aⅴ一区二区三区四区五区| 日韩一区二区免费在线观看| 午夜精品久久久| 欧美日韩激情一区| 丝袜亚洲另类欧美综合| 欧美丝袜丝nylons| 五月激情综合网| 欧美日产国产精品| 午夜精品久久久久久久久| 欧美巨大另类极品videosbest| 图片区小说区国产精品视频| 欧美日韩一区二区三区不卡|