亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
色综合久久久久| 国产美女在线观看一区| 狠狠色丁香婷综合久久| 五月天欧美精品| 亚洲va天堂va国产va久| 亚洲成人av福利| 麻豆精品一区二区av白丝在线| 首页亚洲欧美制服丝腿| 捆绑调教一区二区三区| 国产麻豆精品95视频| 极品美女销魂一区二区三区| 久久se精品一区精品二区| 亚洲国产毛片aaaaa无费看 | 日韩精品一区二区三区四区 | 欧美视频一区在线观看| 欧美色图免费看| 2023国产精品自拍| 玉米视频成人免费看| 久久久久99精品国产片| 欧美人xxxx| 色一区在线观看| 国产98色在线|日韩| 喷白浆一区二区| 一区二区三区高清| 国产精品国产三级国产a| 日韩美女视频在线| 制服丝袜一区二区三区| 7777精品久久久大香线蕉 | 精品蜜桃在线看| 欧美成人在线直播| 国产精品污网站| 亚洲私人黄色宅男| 午夜精品久久久久久久99樱桃| 亚洲成av人影院| 国产精品白丝av| 欧洲一区在线电影| 国产日韩av一区二区| 亚洲天堂av老司机| 麻豆久久一区二区| 福利一区在线观看| 欧美一区二区三区在线观看| 国产午夜三级一区二区三| 亚洲欧美一区二区不卡| 麻豆91在线播放免费| 国产原创一区二区| 欧美一卡二卡在线观看| 国产精品美女久久久久久久久| 夜夜嗨av一区二区三区中文字幕| 不卡在线视频中文字幕| 日韩一级完整毛片| 亚洲丝袜制服诱惑| 色综合久久久网| 亚洲免费资源在线播放| 99精品欧美一区二区三区小说| 国产精品人妖ts系列视频| 99久久精品国产一区二区三区 | 欧美日韩你懂的| 99re这里只有精品视频首页| 精品sm捆绑视频| 精品一区二区三区的国产在线播放| 欧美久久高跟鞋激| 亚洲第一在线综合网站| 97久久精品人人爽人人爽蜜臀| 国产精品私人自拍| 国产乱子轮精品视频| 久久久久久久久一| 国产精品99久久久久久久女警 | 欧美tk—视频vk| 青青国产91久久久久久| 日韩一区二区免费在线电影| 麻豆精品久久久| 精品国产乱码久久久久久浪潮| 九一九一国产精品| 国产区在线观看成人精品 | 国产精品区一区二区三区| 久久久久久亚洲综合影院红桃| 国产激情偷乱视频一区二区三区| 亚洲免费观看高清完整版在线观看| 欧美一二三区在线| 91福利在线观看| 93久久精品日日躁夜夜躁欧美| 久久成人18免费观看| 一区二区三区国产精品| 亚洲国产经典视频| 久久色在线视频| 欧美一级电影网站| 欧美日韩黄视频| 91老司机福利 在线| 成人午夜视频在线观看| 国产一区二区三区免费观看| 青椒成人免费视频| 日韩经典中文字幕一区| 亚洲一区二区三区在线看| 亚洲精品老司机| 中文字幕亚洲欧美在线不卡| 中文字幕乱码亚洲精品一区| 精品嫩草影院久久| 欧美videofree性高清杂交| 91.麻豆视频| 日韩欧美国产一二三区| 日韩一区二区三区高清免费看看| 91精品国产综合久久精品app | 日韩欧美一区二区三区在线| 欧美男人的天堂一二区| 国产乱人伦偷精品视频免下载| 一区在线中文字幕| 久久久国产精品午夜一区ai换脸| 日韩美女在线视频| 欧美成人video| 久久蜜桃av一区精品变态类天堂| 日韩免费性生活视频播放| 777a∨成人精品桃花网| 日韩亚洲国产中文字幕欧美| 欧美一区二区三区免费大片 | 精品综合免费视频观看| 男女性色大片免费观看一区二区| 午夜成人免费电影| 青青草97国产精品免费观看无弹窗版 | 国产精品嫩草久久久久| 日本一区二区三区免费乱视频| 精品国产麻豆免费人成网站| 欧美激情一区不卡| 亚洲一区二区三区四区在线观看 | 91在线国产观看| 欧美日韩精品一区二区三区四区| 久久综合九色综合97婷婷| 一色屋精品亚洲香蕉网站| 日韩精品成人一区二区三区 | 亚洲欧美一区二区三区国产精品 | 午夜av一区二区| 欧美a一区二区| 国产美女主播视频一区| 国产河南妇女毛片精品久久久| 国产一区二区三区美女| 成人av资源站| 欧美日本国产一区| 欧美成人性福生活免费看| 国产亚洲美州欧州综合国| 亚洲国产精品激情在线观看| 最新久久zyz资源站| 亚洲va韩国va欧美va| 韩国av一区二区三区四区| 不卡影院免费观看| 欧美一区二区三区在线电影| 国产校园另类小说区| 一区二区三区久久| 国产又粗又猛又爽又黄91精品| 成人美女视频在线观看18| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 暴力调教一区二区三区| 欧美情侣在线播放| 亚洲欧美偷拍另类a∨色屁股| 久久精品国产亚洲aⅴ| 91在线观看免费视频| 欧美大片一区二区| 亚洲乱码日产精品bd| 丁香天五香天堂综合| 欧美日韩国产在线观看| 综合网在线视频| 国产精品一区二区三区四区| 6080国产精品一区二区| 一区二区中文视频| 成人午夜免费av| 久久综合国产精品| 五月开心婷婷久久| 欧美日韩国产免费一区二区 | 日韩二区三区在线观看| 色综合中文字幕| 亚洲欧美国产77777| 一本色道久久综合精品竹菊| 国产精品视频一二三| 国产乱码精品一品二品| 日韩欧美三级在线| 久久狠狠亚洲综合| 精品国产一区二区三区av性色| 久久国产精品一区二区| 精品久久人人做人人爰| 久久99久国产精品黄毛片色诱| 欧美色综合天天久久综合精品| 一区二区三区久久| 欧美在线free| 美女视频黄 久久| 欧美精品一区二区久久婷婷 | 1000精品久久久久久久久| 99re热这里只有精品视频| 亚洲另类在线制服丝袜| 欧美视频一区二区| 免费av成人在线| 久久精品一区二区三区四区| 99久久精品国产一区二区三区| 国产成人免费视频一区| 国产精品久久久久婷婷二区次| 91同城在线观看| 美女视频黄 久久| 中文字幕av一区二区三区免费看 | 国产成人在线视频免费播放| 中文字幕在线一区免费| 欧美日韩一级视频| 成人午夜激情在线| 日韩av中文字幕一区二区三区|