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

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

?? flash.c.txt

?? 讀寫am29F040的C語言程序
?? TXT
?? 第 1 頁 / 共 2 頁
字號:
	 if (stat != STATUS_READY || nbytes != 0) {
		if (retry-- > 0) {
		  ++retried;
		  --dst, --src;   /* back up */
		  goto again;     /* and retry the last word */
		}
		if (ub == FALSE)
                  flash_command(FLASH_RESET,sector,0,0);
	 }

	 return (char *)src - buf;
}

/*********************************************************************/
/* Flash_status utilizes the DQ6, DQ5, and DQ3 polling algorithms    */
/* described in the flash data book.  It can quickly ascertain the   */
/* operational status of the flash device, and return an             */
/* appropriate status code (defined in flash.h)                      */
/*********************************************************************/
 
int flash_status(word far *fp)
{
	 unsigned char d, t;
	 int retry = 1;

again:

	 d = *fp;        /* read data */
	 t = d ^ *fp;    /* read it again and see what toggled */

	 if (t == 0) {           /* no toggles, nothing's happening */
		return STATUS_READY;
	 }
	 else if (t == 0x04) { /* erase-suspend */
		if (retry--) goto again;    /* may have been write completion */
		return STATUS_ERSUSP;
	 }
	 else if (t & 0x40) {
		if (d & 0x20) {     /* timeout */
		  return STATUS_TIMEOUT;
		}
		else {
		  return STATUS_BUSY;
		}
	 }

	 if (retry--) goto again;    /* may have been write completion */

	 return STATUS_ERROR;
}
/*********************************************************************/
/* BEGIN API WRAPPER FUNCTIONS                                       */
/*********************************************************************/
/* Flash_sector_erase() will erase a single sector dictated by the   */
/* sector parameter.                                                 */
/* Note: this function will merely BEGIN the erase program.  Code    */
/* execution will immediately return to the calling function         */
/*********************************************************************/

byte flash_sector_erase(byte sector)
{
	flash_command(FLASH_SERASE,sector,0,0);
	return(1);
}

/*********************************************************************/
/* Flash_sector_erase_int() is identical to flash_sector_erase(),    */
/* except it will wait until the erase is completed before returning */
/* control to the calling function.  This can be used in cases which */
/* require the program to hold until a sector is erased, without     */
/* adding the wait check external to this function.                  */
/*********************************************************************/

byte flash_sector_erase_int(byte sector)
{
	flash_command(FLASH_SERASE,sector,0,0);
	while (flash_status(get_flash_memptr(sector))
			 == STATUS_BUSY) { }
	return(1);
}

/*********************************************************************/
/* flash_reset() will reset the flash device to reading array data.  */
/* It is good practice to call this function after autoselect        */
/* sequences had been performed.                                     */
/*********************************************************************/

byte flash_reset(void)
{
  flash_command(FLASH_RESET,1,0,0);
  return(1);
}

/*********************************************************************/
/* flash_get_device_id() will perform an autoselect sequence on the  */
/* flash device, and return the device id of the component.          */
/* This function automatically resets to read mode.                  */
/*********************************************************************/

word flash_get_device_id(byte sector)
{
	 word far *fwp; /* flash window */
	 word answer;

	 fwp = (word *)get_flash_memptr(sector);

	 flash_command(FLASH_AUTOSEL,sector,0,0);
	 answer = *(fwp++);
	 
         flash_command(FLASH_RESET,sector,0,0);   /* just to be safe */
	 return( (word) answer );
}

/*********************************************************************/
/* flash_get_manuf_code() will perform an autoselect sequence on the */
/* flash device, and return the manufacturer code of the component.  */
/* This function automatically resets to read mode.                  */
/*********************************************************************/

byte flash_get_manuf_code(byte sector)
{
	 word far *fwp; /* flash window */
	 word answer;

	 fwp = (word *)get_flash_memptr(sector);

	 flash_command(FLASH_AUTOSEL,sector,0,0);
         answer = *fwp;

         flash_command(FLASH_RESET,sector,0,0);   /* just to be safe */	
	 return( (byte) (answer & 0x00FF) );
}

/*********************************************************************/
/* flash_sector_protect_verify() performs an autoselect command      */
/* sequence which checks the status of the sector protect CAM        */
/* to check if the particular sector is protected.  Function will    */
/* return a '0' is the sector is unprotected, and a '1' if it is     */
/* protected.                                                        */
/*********************************************************************/

byte flash_sector_protect_verify(byte sector)
{
	 word far *fwp; /* flash window */
	 byte answer;

	 fwp = (word *)get_flash_memptr(sector);

	 flash_command(FLASH_AUTOSEL,sector,0,0);

	 fwp += ((meminfo->sec[sector].base)/2);
	 fwp += 2;

	 answer = (byte) (*fwp & 0x0001); /* Only need DQ0 to check */

	 flash_command(FLASH_RESET,sector,0,0);

	 return( (byte) answer );
}

/*********************************************************************/
/* flash_get_status() will return the current operational status of  */
/* the flash device.  A list of return codes is outlined in flash.h  */
/* Note: for DL parts, status will be bank dependent.                */
/*********************************************************************/

byte flash_get_status(byte sector)
{
	 word far *fwp;

	 fwp = (word *)get_flash_memptr(sector);
	 return flash_status(fwp);
}

/*********************************************************************/
/* flash_chip_erase() will perform a complete erasure of the flash   */
/* device.  							     */
/*********************************************************************/

byte flash_chip_erase(byte sector)
{
  flash_command(FLASH_CERASE,sector,0,0);
  return(1);
}

/*********************************************************************/
/* flash_write_word() will program a single word of data at the      */
/* specified offset from the beginning of the sector parameter.      */
/* Note: this offset must be word aligned, or else errors are        */
/* possible (this can happen when dealing with odd offsets due to    */
/* only partial programming.                                         */
/* Note: It is good practice to check the desired offset by first    */
/* reading the data, and checking to see if it contains 0xFFFF       */
/*********************************************************************/

byte flash_write_word(byte sector, word offset, word data)
{
  flash_command(FLASH_PROG, sector, offset, data);
  return (1);
}

/*********************************************************************/
/* flash_read_word() reads a single word of data from the specified  */
/* offset from the sector parameter.  This function will auto align  */
/* the offset to return word data.                                   */
/*********************************************************************/

word flash_read_word(byte sector, word offset)
{
  word far *fwp;

  flash_command(FLASH_SELECT,sector,0,0);
  fwp = (word *)get_flash_memptr(sector);
  if (offset & 0x0001){ /* Is odd? */
	 offset--;
  }
  fwp += offset;

  return( (word) *fwp );
}
/*********************************************************************/
/* flash_write_string() functions like flash_write_word(), except    */
/* that it accepts a pointer to a buffer to be programmed.  This     */
/* function will align the data to a word offset, then bulk program  */
/* the flash device with the provided data.                          */
/* The maximum buffer size is currently only limited to the data     */
/* size of the numbytes parameter (which in the test system is       */
/* 16 bits = 65535 words                                             */
/* Since the current maximum flash sector size is 64kbits, this      */
/* should not present a problem.                                     */
/*********************************************************************/

byte flash_write_string(byte sector, word offset, 
                        byte *buffer, word numbytes)
{
  word value=0;

  if(numbytes == 0)
	 value = (word) strlen(buffer);
  else
	 value = numbytes;

  if (value & 0x0001)
	 value--; /* Need to make sure we don't overrun buffer */

  flash_write(sector, offset, buffer, value,FALSE);
  return (1);
}

/*********************************************************************/
/* flash_erase_suspend() will suspend an erase process in the        */
/* specified sector.  Array data can then be read from other sectors */
/* (or any other sectors in other banks), and the erase can be       */
/* resumed using the flash_erase_resume function.                    */
/* Note: multiple sectors can be queued for erasure, so long as the  */
/* 80 uS erase suspend window has not terminated (see AMD data sheet */
/* concerning erase_suspend restrictions).                           */
/*********************************************************************/

byte flash_erase_suspend(byte sector)
{
  flash_command(FLASH_ESUSPEND, sector, 0, 0);
  return (1);
}

/*********************************************************************/
/* flash_erase_resume() will resume all pending erases in the bank   */
/* in which the sector parameter is located.                         */
/*********************************************************************/

byte flash_erase_resume(byte sector)
{
  flash_command(FLASH_ERESUME, sector, 0, 0);
  return (1);
}

/*********************************************************************/
/* flash_get_sector_size() is provided for cases in which the size   */
/* of a sector is required by a host application.  The sector size   */
/* (in bytes) is returned in the data location pointed to by the     */
/* 'size' parameter.                                                 */
/*********************************************************************/

byte flash_get_sector_size(byte sector, dword *size)
{
  *size = meminfo->sec[sector].size;
  return(1);
}

/*********************************************************************/
/* UNLOCK BYPASS FUNCTIONS                                           */
/*********************************************************************/
/* Unlock bypass mode is useful whenever the calling application     */
/* wished to program large amounts of data in minimal time.  Unlock  */
/* bypass mode remove half of the bus overhead required to program   */
/* a single word, from 4 cycles down to 2 cycles.  Programming of    */
/* individual bytes does not gain measurable benefit from unlock     */
/* bypass mode, but programming large strings can see a significant  */
/* decrease in required programming time.                            */
/*********************************************************************/

/*********************************************************************/
/* flash_ub() places the flash into unlock bypass mode.  This        */
/* is REQUIRED to be called before any of the other unlock bypass    */
/* commands will become valid (most will be ignored without first    */
/* calling this function.                                            */
/*********************************************************************/
 
byte flash_ub(byte sector)
{
  flash_command(FLASH_UB, sector, 0, 0);
  return(1);
}

/*********************************************************************/
/* flash_write_word_ub() programs a single word using unlock bypass  */
/* mode.  Note that the calling application will see little benefit  */
/* from programming single words using this mode (outlined above)    */
/*********************************************************************/

byte flash_write_word_ub(byte sector, word offset, word data)
{
  flash_command(FLASH_UBPROG, sector, offset, data);
  return (1);
}

/*********************************************************************/
/* flash_write_string_ub() behaves in the exact same manner as       */
/* flash_write_string() (outlined above), expect that it utilizes    */
/* the unlock bypass mode of the flash device.  This can remove      */
/* significant overhead from the bulk programming operation, and     */
/* when programming bulk data a sizeable performance increase can be */
/* observed.                                                         */
/*********************************************************************/

byte flash_write_string_ub(byte sector, word offset,
   			   byte *buffer, word numbytes)
{
  word value=0;

  if(numbytes == 0)
	 value = (word) strlen(buffer);
  else
	 value = numbytes;

  if (value & 0x0001)
	 value--; /* Need to make sure we don't overrun buffer */

  flash_write(sector, offset, buffer, value,TRUE);
  return (1);
}

/*********************************************************************/
/* flash_reset_ub() is required to remove the flash from unlock      */
/* bypass mode.  This is important, as other flash commands will be  */
/* ignored while the flash is in unlock bypass mode.                 */
/*********************************************************************/

byte flash_reset_ub(void)
{
  flash_command(FLASH_UBRESET,1,0,0);
  return(1);
}

/*********************************************************************/
/* Usefull funtion to return the number of sectors in the device.    */
/* Can be used for functions which need to loop among all the        */
/* sectors, or wish to know the number of the last sector.           */
/*********************************************************************/

void flash_get_numsectors(int *num)
{
  *num = meminfo->nsect;
}

/*********************************************************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品在线视频| 色婷婷国产精品久久包臀| 中文字幕在线观看不卡视频| 欧美日韩成人综合在线一区二区 | 久久综合色8888| 91理论电影在线观看| 韩日av一区二区| 亚洲一区二区三区四区在线| 久久综合色婷婷| 欧美一级视频精品观看| 91丝袜美腿高跟国产极品老师| 免费精品视频在线| 亚洲国产综合色| 亚洲欧美日韩人成在线播放| 精品电影一区二区三区| 欧美日韩黄色一区二区| www.久久精品| 国产精品一区二区在线看| 日韩精品一二区| 亚洲一区二区三区中文字幕| 国产精品久久久久久久久果冻传媒 | 欧美日韩第一区日日骚| 99久久精品国产观看| 国产在线视频一区二区| 日韩主播视频在线| 一区二区在线观看免费| 国产精品久久毛片a| 久久免费的精品国产v∧| 91精品国产91综合久久蜜臀| 91成人在线观看喷潮| 波多野结衣一区二区三区| 韩国av一区二区三区四区| 日日夜夜一区二区| 亚洲成人手机在线| 一区二区三区 在线观看视频| 久久精品人人做人人爽人人| 日韩一区二区三区在线观看| 欧美女孩性生活视频| 在线精品视频免费观看| 色成人在线视频| 一本久久精品一区二区| 一本一道综合狠狠老| 97精品国产露脸对白| av不卡一区二区三区| 国产成a人亚洲精品| 高清av一区二区| 懂色av一区二区三区免费看| 国产传媒久久文化传媒| 国模娜娜一区二区三区| 极品少妇一区二区| 国产综合久久久久久鬼色 | 亚洲精品视频免费看| 亚洲精品国产品国语在线app| 最新欧美精品一区二区三区| ㊣最新国产の精品bt伙计久久| 亚洲欧美中日韩| 最新中文字幕一区二区三区| 一区二区三区四区激情| 亚洲丰满少妇videoshd| 日韩av中文在线观看| 久久99深爱久久99精品| 成人在线视频首页| 91视频观看免费| 欧美日韩国产小视频在线观看| 777亚洲妇女| 精品1区2区在线观看| 国产女主播视频一区二区| 一区精品在线播放| 亚洲福利一二三区| 极品少妇xxxx精品少妇偷拍| 成人精品高清在线| 欧美三级中文字幕| 日韩精品一区二区三区四区视频| 久久久亚洲午夜电影| 一区二区中文字幕在线| 午夜欧美电影在线观看| 国产精品一线二线三线| 欧美性三三影院| 亚洲精品在线网站| 中文字幕一区二区视频| 日韩在线一区二区| 福利电影一区二区三区| 欧美中文字幕一区| 精品国产91洋老外米糕| 综合激情成人伊人| 蜜臀av亚洲一区中文字幕| 国产在线精品免费av| 色就色 综合激情| 久久久亚洲精华液精华液精华液| 日韩久久一区二区| 久久99久国产精品黄毛片色诱| 成人夜色视频网站在线观看| 欧美日韩卡一卡二| 国产精品素人一区二区| 秋霞电影网一区二区| 国产精品亚洲成人| 欧美精品第1页| 成人免费在线视频| 激情欧美一区二区| 欧美日韩国产123区| 中文字幕一区在线观看| 久久99精品久久久久婷婷| 色哟哟在线观看一区二区三区| 精品剧情在线观看| 一区二区三区在线播| 成人影视亚洲图片在线| 欧美一级理论性理论a| 亚洲免费在线看| 国产精品一区在线观看乱码 | 成人性生交大片免费看中文网站| 欧美三级电影网站| 亚洲欧洲日韩一区二区三区| 激情亚洲综合在线| 在线不卡中文字幕播放| 亚洲日本一区二区三区| 国产aⅴ综合色| 久久久久久久久久久久电影| 日韩精品午夜视频| 欧美日韩黄色一区二区| 亚洲精品成人精品456| av中文字幕在线不卡| 久久久精品国产免费观看同学| 久久精品国产成人一区二区三区| 欧美三级日韩三级| 亚洲精品免费在线| 91亚洲精品久久久蜜桃| 国产欧美精品在线观看| 国产成人在线观看| 久久视频一区二区| 国产一区欧美日韩| 久久久久久久综合色一本| 久久99国产精品免费| 91精品国产乱码久久蜜臀| 性做久久久久久| 欧美日韩国产首页| 亚洲成人av电影| 欧美日韩国产精品自在自线| 亚洲成av人**亚洲成av**| 欧美日韩成人在线| 日韩电影免费在线观看网站| 欧美日韩高清影院| 日韩成人一区二区三区在线观看| 欧美色综合久久| 五月天视频一区| 91精品国产福利| 久草这里只有精品视频| 久久精品日产第一区二区三区高清版| 国产成人av电影在线| 中文字幕一区在线观看视频| 91美女片黄在线观看91美女| 一区二区高清免费观看影视大全| 日本福利一区二区| 无码av中文一区二区三区桃花岛| 666欧美在线视频| 韩国精品一区二区| 国产精品丝袜黑色高跟| 色综合久久久久综合| 偷拍与自拍一区| 精品盗摄一区二区三区| 丁香婷婷深情五月亚洲| 亚洲天堂成人网| 欧美日韩久久久一区| 狠狠狠色丁香婷婷综合激情| 欧美国产禁国产网站cc| 色噜噜狠狠色综合中国| 天堂在线亚洲视频| 久久久亚洲精华液精华液精华液| av影院午夜一区| 亚洲成a人片在线观看中文| 欧美日韩一区高清| 亚洲精品免费看| 日韩欧美综合在线| 激情文学综合网| 亚洲女与黑人做爰| 91精品国产综合久久精品性色| 日本亚洲三级在线| 精品少妇一区二区三区免费观看| 成人永久免费视频| 亚洲综合免费观看高清在线观看 | 成人av在线资源网站| 综合色中文字幕| 欧美午夜视频网站| 免费av网站大全久久| 久久婷婷国产综合国色天香| 成人免费高清视频在线观看| 亚洲国产精品一区二区久久恐怖片| 69堂亚洲精品首页| 国产乱子轮精品视频| 亚洲欧美综合色| 欧美精品国产精品| 国产激情一区二区三区四区| 国产日韩欧美精品综合| 欧美日韩免费视频| 狠狠v欧美v日韩v亚洲ⅴ| 日韩久久一区二区| 久久色中文字幕| 欧美亚洲精品一区| 风流少妇一区二区| 天堂蜜桃91精品| 亚洲人成人一区二区在线观看|