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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? jedec.c

?? 根據(jù)fs2410移植過后的mtd驅(qū)動(dòng)源碼
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
   // Wait for any write/erase operation to settle   OldVal = flread(base);   for (I = 0; OldVal != flread(base) && I < 10000; I++)      OldVal = flread(base);   // Reset the chip   flwrite(Reset,0x555);   // Send the sequence   flwrite(AutoSel1,0x555);   flwrite(AutoSel2,0x2AA);   flwrite(AutoSel3,0x555);   // Test #1, JEDEC numbers are readable from 0x??00/0x??01   if (flread(0) != flread(0x100) ||       flread(1) != flread(0x101))   {      flwrite(Reset,0x555);      return 0;   }   // Split up the JEDEC numbers   OldVal = flread(0);   for (I = 0; I != 4; I++)      Mfg[I] = (OldVal >> (I*8));   OldVal = flread(1);   for (I = 0; I != 4; I++)      Id[I] = (OldVal >> (I*8));   Size = handle_jedecs(map,Mfg,Id,4,base,priv);   if (Size == 0)   {      flwrite(Reset,0x555);      return 0;   }   /* Check if there is address wrap around within a single bank, if this      returns JEDEC numbers then we assume that it is wrap around. Notice      we call this routine with the JEDEC return still enabled, if two or      more flashes have a truncated address space the probe test will still      work */   if (base + (Size<<2)+0x555 < map->size &&       base + (Size<<2)+0x555 < (base & (~(my_bank_size-1))) + my_bank_size)   {      if (flread(base+Size) != flread(base+Size + 0x100) ||	  flread(base+Size + 1) != flread(base+Size + 0x101))      {	 jedec_probe32(map,base+Size,priv);      }   }   // Reset.   flwrite(0xF0F0F0F0,0x555);   return 1;   #undef flread   #undef flwrite}/* Linear read. */static int jedec_read(struct mtd_info *mtd, loff_t from, size_t len,		      size_t *retlen, u_char *buf){   struct map_info *map = mtd->priv;   map_copy_from(map, buf, from, len);   *retlen = len;   return 0;}/* Banked read. Take special care to jump past the holes in the bank   mapping. This version assumes symetry in the holes.. */static int jedec_read_banked(struct mtd_info *mtd, loff_t from, size_t len,			     size_t *retlen, u_char *buf){   struct map_info *map = mtd->priv;   struct jedec_private *priv = map->fldrv_priv;   *retlen = 0;   while (len > 0)   {      // Determine what bank and offset into that bank the first byte is      unsigned long bank = from & (~(priv->bank_fill[0]-1));      unsigned long offset = from & (priv->bank_fill[0]-1);      unsigned long get = len;      if (priv->bank_fill[0] - offset < len)	 get = priv->bank_fill[0] - offset;      bank /= priv->bank_fill[0];      map_copy_from(map,buf + *retlen,bank*my_bank_size + offset,get);      len -= get;      *retlen += get;      from += get;   }   return 0;}/* Pass the flags value that the flash return before it re-entered read   mode. */static void jedec_flash_failed(unsigned char code){   /* Bit 5 being high indicates that there was an internal device      failure, erasure time limits exceeded or something */   if ((code & (1 << 5)) != 0)   {      printk("mtd: Internal Flash failure\n");      return;   }   printk("mtd: Programming didn't take\n");}/* This uses the erasure function described in the AMD Flash Handbook,   it will work for flashes with a fixed sector size only. Flashes with   a selection of sector sizes (ie the AMD Am29F800B) will need a different   routine. This routine tries to parallize erasing multiple chips/sectors   where possible */static int flash_erase(struct mtd_info *mtd, struct erase_info *instr){   // Does IO to the currently selected chip   #define flread(x) map_read8(map,chip->base+((x)<<chip->addrshift))   #define flwrite(v,x) map_write8(map,v,chip->base+((x)<<chip->addrshift))   unsigned long Time = 0;   unsigned long NoTime = 0;   unsigned long start = instr->addr, len = instr->len;   unsigned int I;   struct map_info *map = mtd->priv;   struct jedec_private *priv = map->fldrv_priv;   // Verify the arguments..   if (start + len > mtd->size ||       (start % mtd->erasesize) != 0 ||       (len % mtd->erasesize) != 0 ||       (len/mtd->erasesize) == 0)      return -EINVAL;   jedec_flash_chip_scan(priv,start,len);   // Start the erase sequence on each chip   for (I = 0; priv->chips[I].jedec != 0 && I < MAX_JEDEC_CHIPS; I++)   {      unsigned long off;      struct jedec_flash_chip *chip = priv->chips + I;      if (chip->length == 0)	 continue;      if (chip->start + chip->length > chip->size)      {	 printk("DIE\n");	 return -EIO;      }      flwrite(0xF0,chip->start + 0x555);      flwrite(0xAA,chip->start + 0x555);      flwrite(0x55,chip->start + 0x2AA);      flwrite(0x80,chip->start + 0x555);      flwrite(0xAA,chip->start + 0x555);      flwrite(0x55,chip->start + 0x2AA);      /* Once we start selecting the erase sectors the delay between each         command must not exceed 50us or it will immediately start erasing         and ignore the other sectors */      for (off = 0; off < len; off += chip->sectorsize)      {	 // Check to make sure we didn't timeout	 flwrite(0x30,chip->start + off);	 if (off == 0)	    continue;	 if ((flread(chip->start + off) & (1 << 3)) != 0)	 {	    printk("mtd: Ack! We timed out the erase timer!\n");	    return -EIO;	 }      }   }   /* We could split this into a timer routine and return early, performing      background erasure.. Maybe later if the need warrents */   /* Poll the flash for erasure completion, specs say this can take as long      as 480 seconds to do all the sectors (for a 2 meg flash).      Erasure time is dependent on chip age, temp and wear.. */   /* This being a generic routine assumes a 32 bit bus. It does read32s      and bundles interleved chips into the same grouping. This will work      for all bus widths */   Time = 0;   NoTime = 0;   for (I = 0; priv->chips[I].jedec != 0 && I < MAX_JEDEC_CHIPS; I++)   {      struct jedec_flash_chip *chip = priv->chips + I;      unsigned long off = 0;      unsigned todo[4] = {0,0,0,0};      unsigned todo_left = 0;      unsigned J;      if (chip->length == 0)	 continue;      /* Find all chips in this data line, realistically this is all         or nothing up to the interleve count */      for (J = 0; priv->chips[J].jedec != 0 && J < MAX_JEDEC_CHIPS; J++)      {	 if ((priv->chips[J].base & (~((1<<chip->addrshift)-1))) ==	     (chip->base & (~((1<<chip->addrshift)-1))))	 {	    todo_left++;	    todo[priv->chips[J].base & ((1<<chip->addrshift)-1)] = 1;	 }      }      /*      printk("todo: %x %x %x %x\n",(short)todo[0],(short)todo[1],	      (short)todo[2],(short)todo[3]);      */      while (1)      {	 __u32 Last[4];	 unsigned long Count = 0;	 /* During erase bit 7 is held low and bit 6 toggles, we watch this,	    should it stop toggling or go high then the erase is completed,  	    or this is not really flash ;> */	 switch (map->buswidth) {	 case 1:	    Last[0] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);	    Last[1] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);	    Last[2] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);	    break;	 case 2:	    Last[0] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);	    Last[1] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);	    Last[2] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);	    break;	 case 3:	    Last[0] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);	    Last[1] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);	    Last[2] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);	    break;	 }	 Count = 3;	 while (todo_left != 0)	 {	    for (J = 0; J != 4; J++)	    {	       __u8 Byte1 = (Last[(Count-1)%4] >> (J*8)) & 0xFF;	       __u8 Byte2 = (Last[(Count-2)%4] >> (J*8)) & 0xFF;	       __u8 Byte3 = (Last[(Count-3)%4] >> (J*8)) & 0xFF;	       if (todo[J] == 0)		  continue;	       if ((Byte1 & (1 << 7)) == 0 && Byte1 != Byte2)	       {//		  printk("Check %x %x %x\n",(short)J,(short)Byte1,(short)Byte2);		  continue;	       }	       if (Byte1 == Byte2)	       {		  jedec_flash_failed(Byte3);		  return -EIO;	       }	       todo[J] = 0;	       todo_left--;	    }/*	    if (NoTime == 0)	       Time += HZ/10 - schedule_timeout(HZ/10);*/	    NoTime = 0;	    switch (map->buswidth) {	    case 1:	       Last[Count % 4] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);	      break;	    case 2:	       Last[Count % 4] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);	      break;	    case 4:	       Last[Count % 4] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);	      break;	    }	    Count++;/*	    // Count time, max of 15s per sector (according to AMD)	    if (Time > 15*len/mtd->erasesize*HZ)	    {	       printk("mtd: Flash Erase Timed out\n");	       return -EIO;	    }	    */	 }	 // Skip to the next chip if we used chip erase	 if (chip->length == chip->size)	    off = chip->size;	 else	    off += chip->sectorsize;	 if (off >= chip->length)	    break;	 NoTime = 1;      }      for (J = 0; priv->chips[J].jedec != 0 && J < MAX_JEDEC_CHIPS; J++)      {	 if ((priv->chips[J].base & (~((1<<chip->addrshift)-1))) ==	     (chip->base & (~((1<<chip->addrshift)-1))))	    priv->chips[J].length = 0;      }   }   //printk("done\n");   instr->state = MTD_ERASE_DONE;   mtd_erase_callback(instr);   return 0;   #undef flread   #undef flwrite}/* This is the simple flash writing function. It writes to every byte, in   sequence. It takes care of how to properly address the flash if   the flash is interleved. It can only be used if all the chips in the   array are identical!*/static int flash_write(struct mtd_info *mtd, loff_t start, size_t len,		       size_t *retlen, const u_char *buf){   /* Does IO to the currently selected chip. It takes the bank addressing      base (which is divisible by the chip size) adds the necessary lower bits      of addrshift (interleave index) and then adds the control register index. */   #define flread(x) map_read8(map,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))   #define flwrite(v,x) map_write8(map,v,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))   struct map_info *map = mtd->priv;   struct jedec_private *priv = map->fldrv_priv;   unsigned long base;   unsigned long off;   size_t save_len = len;   if (start + len > mtd->size)      return -EIO;   //printk("Here");   //printk("flash_write: start is %x, len is %x\n",start,(unsigned long)len);   while (len != 0)   {      struct jedec_flash_chip *chip = priv->chips;      unsigned long bank;      unsigned long boffset;      // Compute the base of the flash.      off = ((unsigned long)start) % (chip->size << chip->addrshift);      base = start - off;      // Perform banked addressing translation.      bank = base & (~(priv->bank_fill[0]-1));      boffset = base & (priv->bank_fill[0]-1);      bank = (bank/priv->bank_fill[0])*my_bank_size;      base = bank + boffset;    //  printk("Flasing %X %X %X\n",base,chip->size,len);     // printk("off is %x, compare with %x\n",off,chip->size << chip->addrshift);      // Loop over this page      for (; off != (chip->size << chip->addrshift) && len != 0; start++, len--, off++,buf++)      {	 unsigned char oldbyte = map_read8(map,base+off);	 unsigned char Last[4];	 unsigned long Count = 0;	 if (oldbyte == *buf) {	//	 printk("oldbyte and *buf is %x,len is %x\n",oldbyte,len);	    continue;	 }	 if (((~oldbyte) & *buf) != 0)	    printk("mtd: warn: Trying to set a 0 to a 1\n");	 // Write	 flwrite(0xAA,0x555);	 flwrite(0x55,0x2AA);	 flwrite(0xA0,0x555);	 map_write8(map,*buf,base + off);	 Last[0] = map_read8(map,base + off);	 Last[1] = map_read8(map,base + off);	 Last[2] = map_read8(map,base + off);	 /* Wait for the flash to finish the operation. We store the last 4	    status bytes that have been retrieved so we can determine why	    it failed. The toggle bits keep toggling when there is a	    failure */	 for (Count = 3; Last[(Count - 1) % 4] != Last[(Count - 2) % 4] &&	      Count < 10000; Count++)	    Last[Count % 4] = map_read8(map,base + off);	 if (Last[(Count - 1) % 4] != *buf)	 {	    jedec_flash_failed(Last[(Count - 3) % 4]);	    return -EIO;	 }      }   }   *retlen = save_len;   return 0;}/* This is used to enhance the speed of the erase routine,   when things are being done to multiple chips it is possible to   parallize the operations, particularly full memory erases of multi   chip memories benifit */static void jedec_flash_chip_scan(struct jedec_private *priv,unsigned long start,		     unsigned long len){   unsigned int I;   // Zero the records   for (I = 0; priv->chips[I].jedec != 0 && I < MAX_JEDEC_CHIPS; I++)      priv->chips[I].start = priv->chips[I].length = 0;   // Intersect the region with each chip   for (I = 0; priv->chips[I].jedec != 0 && I < MAX_JEDEC_CHIPS; I++)   {      struct jedec_flash_chip *chip = priv->chips + I;      unsigned long ByteStart;      unsigned long ChipEndByte = chip->offset + (chip->size << chip->addrshift);      // End is before this chip or the start is after it      if (start+len < chip->offset ||	  ChipEndByte - (1 << chip->addrshift) < start)	 continue;      if (start < chip->offset)      {	 ByteStart = chip->offset;	 chip->start = 0;      }      else      {	 chip->start = (start - chip->offset + (1 << chip->addrshift)-1) >> chip->addrshift;	 ByteStart = start;      }      if (start + len >= ChipEndByte)	 chip->length = (ChipEndByte - ByteStart) >> chip->addrshift;      else	 chip->length = (start + len - ByteStart + (1 << chip->addrshift)-1) >> chip->addrshift;   }}int __init jedec_init(void){	register_mtd_chip_driver(&jedec_chipdrv);	return 0;}static void __exit jedec_exit(void){	unregister_mtd_chip_driver(&jedec_chipdrv);}module_init(jedec_init);module_exit(jedec_exit);MODULE_LICENSE("GPL");MODULE_AUTHOR("Jason Gunthorpe <jgg@deltatee.com> et al.");MODULE_DESCRIPTION("Old MTD chip driver for JEDEC-compliant flash chips");

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
a4yy欧美一区二区三区| 91精品国产aⅴ一区二区| 国产欧美一区二区精品婷婷 | 亚洲成va人在线观看| 91蜜桃视频在线| 日产欧产美韩系列久久99| 天堂久久久久va久久久久| 欧美日韩在线免费视频| 一区二区三区欧美亚洲| 97精品久久久午夜一区二区三区| 中文av一区二区| 风间由美性色一区二区三区| 久久久久久久久岛国免费| 国产老妇另类xxxxx| 国产校园另类小说区| 国产成人午夜电影网| 国产精品人人做人人爽人人添| 成人综合婷婷国产精品久久免费| 欧美激情一区二区三区全黄| 不卡影院免费观看| 综合久久一区二区三区| 色综合一个色综合亚洲| 亚洲一区二区3| 一区二区三区鲁丝不卡| 中文字幕在线不卡一区二区三区| 色婷婷久久久综合中文字幕| 精品一区二区久久久| 美女久久久精品| 精品国产凹凸成av人网站| 精品国产污污免费网站入口| 在线观看日韩电影| 极品少妇xxxx偷拍精品少妇| 91蜜桃网址入口| 亚洲宅男天堂在线观看无病毒| 欧美私人免费视频| 日韩在线卡一卡二| 精品美女在线观看| 成人深夜福利app| 亚洲精品大片www| 欧美精品欧美精品系列| 国精品**一区二区三区在线蜜桃| 国产女同性恋一区二区| 日本精品一级二级| 全国精品久久少妇| 欧美国产欧美亚州国产日韩mv天天看完整 | 免费在线观看日韩欧美| 久久久久9999亚洲精品| 91亚洲精品久久久蜜桃| 天天操天天干天天综合网| 久久在线免费观看| aaa亚洲精品| 天天影视网天天综合色在线播放| 久久综合久久鬼色| 色婷婷综合中文久久一本| 奇米一区二区三区| 中文字幕av一区二区三区| 欧美怡红院视频| 韩国av一区二区三区四区| ...av二区三区久久精品| 欧美午夜免费电影| 国产精品影视在线| 亚洲国产精品自拍| 国产香蕉久久精品综合网| 色丁香久综合在线久综合在线观看| 日本va欧美va瓶| 最新中文字幕一区二区三区| 中文字幕日韩av资源站| 欧美日韩国产一区| 国产精品一区二区黑丝 | 久久久综合精品| 91黄色免费观看| 国产一区二区三区在线观看精品 | 亚洲精品国产精华液| 日韩一区二区免费在线电影| 97久久精品人人爽人人爽蜜臀| 免费在线欧美视频| 亚洲欧美日韩一区二区 | 欧美国产综合色视频| 欧美日韩一区中文字幕| 成人综合婷婷国产精品久久蜜臀 | 日韩激情视频网站| 91污在线观看| 久久精品视频在线免费观看| 亚洲色图在线看| 91伊人久久大香线蕉| 美女一区二区三区| 亚洲日本va午夜在线电影| 久久亚洲综合av| 欧美色成人综合| 不卡一区二区在线| 毛片不卡一区二区| 亚洲一区二区美女| 自拍偷拍亚洲激情| 久久久影视传媒| 91精品国产色综合久久ai换脸| 色噜噜狠狠一区二区三区果冻| 国产二区国产一区在线观看| 青青草国产成人av片免费| 亚洲午夜av在线| 亚洲欧美一区二区三区孕妇| 国产亚洲污的网站| 日韩丝袜情趣美女图片| 欧美日韩国产一级| 91久久精品一区二区| 不卡av免费在线观看| 国产成人在线网站| 久久国产剧场电影| 日韩va欧美va亚洲va久久| 亚洲制服欧美中文字幕中文字幕| 中文字幕在线一区二区三区| 久久精品人人做人人综合 | 成人18精品视频| 国产传媒久久文化传媒| 极品少妇xxxx精品少妇| 麻豆专区一区二区三区四区五区| 日日夜夜一区二区| 亚洲国产成人高清精品| 亚洲综合成人在线| 亚洲伦理在线免费看| 亚洲男同性视频| 亚洲男人的天堂在线观看| 中文字幕欧美一区| 国产精品免费视频网站| 国产精品视频一二三| 欧美极品另类videosde| 国产精品私房写真福利视频| 国产精品丝袜久久久久久app| 欧美国产精品一区二区| 国产欧美久久久精品影院| 国产午夜精品福利| 欧美极品少妇xxxxⅹ高跟鞋| 国产网红主播福利一区二区| 国产人成一区二区三区影院| 久久久久综合网| 中文字幕欧美国产| 国产精品不卡一区二区三区| 中文字幕综合网| 亚洲黄一区二区三区| 亚洲丶国产丶欧美一区二区三区| 午夜精品福利一区二区蜜股av | 亚洲欧美日韩一区二区| 亚洲精品视频免费观看| 有坂深雪av一区二区精品| 亚洲国产成人av好男人在线观看| 偷拍一区二区三区四区| 奇米影视一区二区三区| 精久久久久久久久久久| 国产99一区视频免费| www.欧美色图| 在线日韩av片| 欧美一二三四区在线| 久久综合九色综合97婷婷女人 | 欧美精品久久天天躁| 日韩三级高清在线| 国产喂奶挤奶一区二区三区| 中文字幕亚洲不卡| 亚洲五月六月丁香激情| 美女高潮久久久| 粉嫩蜜臀av国产精品网站| 91麻豆免费观看| 欧美精品亚洲二区| 久久亚洲精品小早川怜子| 综合久久久久综合| 亚洲高清在线精品| 激情都市一区二区| 成人av在线播放网站| 欧美四级电影网| 亚洲精品在线一区二区| 国产精品久久久久影院老司| 亚洲国产裸拍裸体视频在线观看乱了 | 青娱乐精品视频| 国产福利精品一区二区| 色婷婷狠狠综合| 日韩一级片网址| 国产精品久久午夜| 亚洲1区2区3区4区| 国产很黄免费观看久久| 在线观看亚洲专区| wwwwww.欧美系列| 亚洲欧美激情小说另类| 久久福利资源站| 91香蕉视频在线| 精品久久久久久亚洲综合网| 亚洲欧美日韩国产手机在线| 免费欧美高清视频| 成人av动漫在线| 欧美一区二区三区小说| 国产精品网友自拍| 日韩成人一区二区三区在线观看| 国产999精品久久久久久绿帽| 欧美丝袜第三区| 国产日韩精品一区二区浪潮av| 亚洲午夜免费电影| 丁香六月综合激情| 91精品国产欧美一区二区| 国产精品久久久久久久久免费相片| 五月天欧美精品| 99久久免费精品| 亚洲精品一区二区三区99| 一区二区高清在线|