标题: AT45DB041B AT45DB161D各种单片机驱动程序及其pdf下载 [打印本页]

作者: wudawei    时间: 2014-12-31 21:45
标题: AT45DB041B AT45DB161D各种单片机驱动程序及其pdf下载
at45db161d.rar (4.97 MB, 下载次数: 184)


作者: wudawei    时间: 2014-12-31 22:01
AT45DB161D 擦除算法:// 1 Chip = 16 Sectors = 512 Blocks = 4096 Pages
//            1 Sector = 32 Blocks  = 256 Pages
//                          1 Block = 8 Pages
//------------------------------------------------------------------------------
// Pm ... Pn [Bm ... Bn] [Sm ... Sn] [Bm ... Bn] Pm ... Pn
//------------------------------------------------------------------------------
// Caller must make dwAddress in Page boundary
// Example : AT45_ErasePages(247*512, 1+1*8+1*256+1*8+1);
//
void AT45_ErasePages(u32 dwAddress, u32 dwPageCount)
{
  if ( dwPageCount == 0)
    return;
  if ( ( dwAddress == 0) && ( dwPageCount >= 4096) )
  {
    AT45_ChipErase();
    return;
  }
  if ( dwPageCount >= 256 )
  {
    if ( (dwAddress & 0x1FFFF) == 0x00000000 )   // At Sector boundary
    {
      while ( dwPageCount >= 256 )
      {
        AT45_SectorErase(dwAddress);
        dwAddress += 256 * 512;
        dwPageCount -= 256;
      }
      BOOT_AT45_ErasePages(dwAddress, dwPageCount);
      return;
    }
  }
  if ( dwPageCount >= 8 )                      // Erase Blocks until Sector boundary
  {
    if ( (dwAddress & 0xFFF) == 0x00000000 )   // At Block boundary
    {
      while ( dwPageCount >= 8 )
      {
        if ( (dwAddress & 0x1FFFF) == 0x00000000 )   // At Sector boundary
        {
          if ( dwPageCount >= 256 )
          {
            BOOT_AT45_ErasePages(dwAddress, dwPageCount);
            return;
          }
        }
        AT45_BlockErase(dwAddress);
        dwAddress += 8 * 512;
        dwPageCount -= 8;
      }
      BOOT_AT45_ErasePages(dwAddress, dwPageCount);
      return;
    }
  }
  while ( dwPageCount > 0 )                    // Erase Pages until Block boundary
  {
    if ( (dwAddress & 0xFFF) == 0x00000000 )   // At Block boundary
    {
      if ( dwPageCount >= 8 )
      {
        BOOT_AT45_ErasePages(dwAddress, dwPageCount);
        return;
      }
    }
    AT45_PageErase(dwAddress);
    dwAddress += 1*512;
    dwPageCount -= 1;
  }
}

作者: owenql    时间: 2015-9-23 10:28
好东西啊,赞一个
作者: meimeide    时间: 2016-1-30 23:50
hao,henhao
作者: 648742653@qq.co    时间: 2016-3-21 10:44
好资料 学习一下
作者: fsss007    时间: 2016-4-9 20:50
下载了,看看我会不会用
作者: proe40    时间: 2016-7-25 22:13
谢谢!
作者: MuXuan    时间: 2016-8-14 17:13
下载看看   正好在做430与AT45的程序
作者: km958    时间: 2017-1-5 11:51
好,下载测试
作者: yanjiasheng    时间: 2017-1-12 09:01
感谢分享!!!
作者: 348085799    时间: 2017-10-16 10:27
不错 学习了 谢谢哦
作者: 348085799    时间: 2017-10-16 10:30
感谢分享!!!!!
作者: changhenjian    时间: 2018-1-18 16:05
好东西,赞一个
作者: 馒头宝宝    时间: 2018-4-9 21:02
不错不错,好东西.
作者: 阔爱的钊钊    时间: 2021-7-22 20:58
缺资料收藏了,STM32硬件SPI驱动试试
作者: dabin895888    时间: 2022-12-11 20:52
学习一下,看x5045能不能借用




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1