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

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

?? mmc.c

?? ATMEL 89c51sndc mp3外接硬盤源碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
      }
      Usb_write_byte(Mmc_rd_byte());        /* read 16 bytes from FIFO */
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      gl_mem_tick = MMC_DATA_TIME;
      while (!Mmc_read_ready())             /* wait data in FIFO 1 */
      {
        if (gl_mem_tick == MMC_TIME_OUT)
        {
          gl_mem_failure = TRUE;
          return KO;
        }
      }
      Usb_write_byte(Mmc_rd_byte());        /* read 16 bytes from FIFO */
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      gl_mem_tick = MMC_DATA_TIME;
      while (!Mmc_read_ready())             /* wait data in FIFO 1 */
      {
        if (gl_mem_tick == MMC_TIME_OUT)
        {
          gl_mem_failure = TRUE;
          return KO;
        }
      }
      Usb_write_byte(Mmc_rd_byte());        /* read 16 bytes from FIFO */
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
      Usb_write_byte(Mmc_rd_byte());
  
      if (begin_ping_pong)
      {
        begin_ping_pong = FALSE;
      }
      else
      {
        while (!Usb_tx_complete());         /* wait end of transfer */
        Usb_clear_TXCMPL();                 /* ack transfer */
      }
      Usb_set_TXRDY();                      /* start usb transfer */
    }
    gl_ptr_mem += 512;
    nb_sector--;                            /* 1 more sector read */
    
  }
  while (nb_sector != 0);

  while (!Usb_tx_complete());             /* wait end of last transfer */
  Usb_clear_TXCMPL();                     /* ack transfer */

  return OK;                                /* read done */
}


/*F**************************************************************************
* NAME: mmc_write_open
*----------------------------------------------------------------------------
* PARAMS:
*   pos: address of the the next write data
*   global: gl_ptr_mem
*
* return:
*   status: OK: open done
*           KO: open not done
*----------------------------------------------------------------------------
* PURPOSE: 
*   Open memory card in write mode (write block)
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   - pos must always be synchronized on a block boundary address
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
bit mmc_write_open (Uint32 pos)
{
  gl_ptr_mem = pos << 9;                    /* gl_ptr_mem = pos * 512 */
  if (mmc_mem_busy)
  {
    mmc_mem_busy = FALSE;
    while (Mmc_card_busy());                /* wait end of programming */
  }
  Mmc_disable_flow_ctrl();                  /* enable clock for command */
  Mmc_set_write();                          /* dir from uc to card */
  Mmc_write_block_cmd(gl_ptr_mem);          /* send write block */
//  while (!Mmc_command_sent());              /* wait end of transmission */
  gl_mem_tick = MMC_RESP_TIME;
  while (mmc_check_response() == MMC_ERR_RESP)
  {
    if (gl_mem_tick == MMC_TIME_OUT)
    {
      return KO;
    }
  }
  if ((mmc_read_response() & MMC_TRAN_STATE_MSK) != MMC_TRAN_STATE)
  {
    return  KO;
  }
  else
  {
    Mmc_enable_flow_ctrl();                 /* stop clock when FIFO 1&2 empty */
    Mmc_enable_send();                      /* send data after response */
    return  OK;
  }
}


/*F**************************************************************************
* NAME: mmc_write_close
*----------------------------------------------------------------------------
* PARAMS:
*   global: gl_ptr_mem
*
* return:
*----------------------------------------------------------------------------
* PURPOSE: 
*   Memory card write close
*     finish programming end of block
*     release MMC card
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void mmc_write_close (void)
{
  while ((((Byte*)&gl_ptr_mem)[3] != 0x00) || ((((Byte*)&gl_ptr_mem)[2] & MMC_PAGE_MASK) != 0x00))
  {
    Mmc_wr_byte(0x00);                      /* dummy write to end of block */
    gl_ptr_mem++;
  }
  Mmc_disable_flow_ctrl();                  /* re-enable clock for CRC status */
  mmc_mem_busy = TRUE;                      /* memory is busy */
}


/*F**************************************************************************
* NAME: mmc_write_byte
*----------------------------------------------------------------------------
* PARAMS:
*   b: data to write
*   global: gl_ptr_mem
*
* return:
*   write status: OK: write done
*                 KO: write not done
*----------------------------------------------------------------------------
* PURPOSE: 
*   Card byte write function
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
bit mmc_write_byte (Byte b)
{
  if (mmc_mem_busy)
  {
    mmc_mem_busy = FALSE;
    while (Mmc_card_busy());                /* wait end of programming */
    Mmc_write_block_cmd(gl_ptr_mem);        /* write next block */
    Mmc_enable_flow_ctrl();                 /* stop clock when FIFO 1&2 empty */
    Mmc_enable_send();                      /* send data after response */
    Mmc_wr_byte(b);                         /* write 1 byte to card */
    gl_ptr_mem++;
    return OK;                              /* write done */
  }
  else
  {
    Mmc_wr_byte(b);                         /* write 1 byte to card */
    gl_ptr_mem++;
  
    /* check if end of block */
    if ((((Byte*)&gl_ptr_mem)[3] == 0x00) && ((((Byte*)&gl_ptr_mem)[2] & MMC_PAGE_MASK) == 0x00))
    {
      Mmc_disable_flow_ctrl();              /* re-enable clock for CRC status */
      mmc_mem_busy = TRUE;                  /* memory is busy */
    }  
    return OK;                              /* write done */
  }
}


/*F**************************************************************************
* NAME: mmc_write_sector
*----------------------------------------------------------------------------
* PARAMS:
*   nb_sector:  number of contiguous sector to write 
*   global:     gl_ptr_mem
*
* return:
*   write status: OK: write done
*                 KO: write not done
*----------------------------------------------------------------------------
* PURPOSE: 
*   This function is an optimized function that writes nb-sector * 512 bytes
*   from USB controller to MMC card
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   nb_sector always >= 1, can not be zero
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
bit mmc_write_sector (Uint16 nb_sector)
{
Byte i;

  do
  {
    if (mmc_mem_busy)
    {
      mmc_mem_busy = FALSE;
      while (Mmc_card_busy());              /* wait end of programming */
      Mmc_write_block_cmd(gl_ptr_mem);      /* write next block */
      Mmc_enable_flow_ctrl();               /* stop clock when FIFO 1&2 empty */
      Mmc_enable_send();                    /* send data after response */
    }
  
    for (i = 8; i != 0; i--)                /* write 8x64b = 512b */
    {
      while (!Usb_rx_complete());           /* wait end of reception */
      Mmc_wr_byte(Usb_read_byte());         /* write 16 bytes to FIFO */
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      while (Mmc_write_busy());             /* wait no more data in FIFO 1 */
      Mmc_wr_byte(Usb_read_byte());         /* write 16 bytes to FIFO */
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      while (Mmc_write_busy());             /* wait no more data in FIFO 1 */
      Mmc_wr_byte(Usb_read_byte());         /* write 16 bytes to FIFO */
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      while (Mmc_write_busy());             /* wait no more data in FIFO 1 */
      Mmc_wr_byte(Usb_read_byte());         /* write 16 bytes to FIFO */
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Mmc_wr_byte(Usb_read_byte());
      Usb_clear_RXOUT_PP();                  /* usb read acknowledgement */
    }
    /* always end of page */
    Mmc_disable_flow_ctrl();                /* re-enable clock for CRC status */
    mmc_mem_busy = TRUE;
    gl_ptr_mem += 512;
    nb_sector--;                            /* 1 more sector written */
    while (!Mmc_data_sent());               /* wait end of transmission */
  }
  while (nb_sector != 0);
  return OK;                                /* write done */
}


/*F**************************************************************************
* NAME: mmc_format
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*   Address of the format parameter structure in code
*----------------------------------------------------------------------------
* PURPOSE: 
*   This function is called by the fat_format function and returns a pointer
*   to a table containing the format parameters.
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   MMC FORMAT PARAMETERS
*   CAPACITY  LBAs      CYL   HDs   S/T   CLUSTs  S/C   S/F   FAT   HID
*   4MB       7872      123   2     32    975     8     3     12    32
*   8MB       15680     245   2     32    1950    8     6     12    32
*   16MB      31360     490   2     32    3908    8     12    12    32
*   28MB      54784     428   4     32    13652   4     54    16    32
*   32MB      62720     490   4     32    15632   4     62    16    32
*   64MB      125440    490   8     32    31282   4     123   16    32
*   128MB     250880    980   8     32    62581   4     245   16    32
*   256MB     501760    980   16    32    62720   8     245   16    32
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
s_format code * mmc_format (void)
{
code  s_format  mmc_tab_format[]=
  {
   /* nb_cylinder, nb_head,  nb_sector, nb_hidden, nb_sector_per_cluster */
    { (Uint16)123, (Byte)2,  (Byte)32,  (Byte)32,  (Byte)8 }, /* 4MB */
    { (Uint16)245, (Byte)2,  (Byte)32,  (Byte)32,  (Byte)8 }, /* 8MB */
    { (Uint16)490, (Byte)2,  (Byte)32,  (Byte)32,  (Byte)8 }, /* 16MB */
    { (Uint16)428, (Byte)4,  (Byte)32,  (Byte)32,  (Byte)4 }, /* 28MB */
    { (Uint16)490, (Byte)4,  (Byte)32,  (Byte)32,  (Byte)4 }, /* 32MB */
    { (Uint16)490, (Byte)8,  (Byte)32,  (Byte)32,  (Byte)4 }, /* 64MB */
    { (Uint16)980, (Byte)8,  (Byte)32,  (Byte)32,  (Byte)4 }, /* 128MB */
    { (Uint16)980, (Byte)16, (Byte)32,  (Byte)32,  (Byte)8 }, /* 256MB */
  };

  /* -- MMC Type Selection -- */
  if (Mmc_disk_size() >= MMC_SIZE_256MB) return &mmc_tab_format[MMC_256MB];
  if (Mmc_disk_size() >= MMC_SIZE_128MB) return &mmc_tab_format[MMC_128MB];
  if (Mmc_disk_size() >= MMC_SIZE_64MB)  return &mmc_tab_format[MMC_64MB];
  if (Mmc_disk_size() >= MMC_SIZE_32MB)  return &mmc_tab_format[MMC_32MB];
  if (Mmc_disk_size() >= MMC_SIZE_28MB)  return &mmc_tab_format[MMC_28MB];
  if (Mmc_disk_size() >= MMC_SIZE_16MB)  return &mmc_tab_format[MMC_16MB];
  if (Mmc_disk_size() >= MMC_SIZE_8MB)   return &mmc_tab_format[MMC_8MB];
  return &mmc_tab_format[MMC_4MB];
}





?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
激情五月婷婷综合| 欧美性色黄大片| 99久久国产免费看| 日韩一区二区三区观看| 综合婷婷亚洲小说| 国产一区二区看久久| 在线视频欧美区| 中文一区二区在线观看| 亚洲成年人影院| 成人网在线免费视频| 日韩欧美一级二级| 亚洲成av人片在线| av成人动漫在线观看| 欧美精品一区二区久久婷婷| 亚洲国产欧美在线人成| 99久久久精品免费观看国产蜜| 日韩女优视频免费观看| 亚洲国产va精品久久久不卡综合| 99久久精品国产导航| 国产人妖乱国产精品人妖| 精品一区二区三区蜜桃| 欧美女孩性生活视频| 一区二区三区四区在线播放| 成人av网站大全| 中文字幕欧美日韩一区| 国产高清精品网站| 久久久精品影视| 韩国成人精品a∨在线观看| 日韩视频免费观看高清完整版| 午夜精品福利一区二区三区av| 日本丰满少妇一区二区三区| 日韩美女久久久| 91在线一区二区三区| 综合久久给合久久狠狠狠97色| 成人精品一区二区三区四区| 国产精品久久久久影视| 成人精品免费网站| 一区二区中文字幕在线| 欧美综合天天夜夜久久| 亚洲一区二区精品久久av| 欧美日韩一区二区三区四区五区 | 成人一区在线观看| 久久精品男人天堂av| 福利一区二区在线| 中文字幕一区二区三| 色综合天天在线| 午夜在线成人av| 日韩欧美的一区| 国产一区二区三区在线看麻豆| 国产欧美一区二区精品仙草咪| 成人精品国产福利| 亚洲日本一区二区三区| 欧美性猛交xxxx黑人交| 奇米四色…亚洲| 久久久午夜精品| 91国产免费观看| 麻豆成人久久精品二区三区小说| 久久综合色之久久综合| 91小视频免费观看| 午夜精品一区二区三区电影天堂| 亚洲一区二区三区四区的| 日本一区二区三区四区| 欧美性受xxxx黑人xyx| 色综合久久天天| 日韩欧美一区电影| 亚洲午夜激情网站| 奇米影视在线99精品| 欧美私人免费视频| 亚洲第一久久影院| 国产精品久久久久久久蜜臀| 视频一区国产视频| 亚洲成a人片在线不卡一二三区 | 亚洲精品成人在线| 国产成人免费在线观看不卡| 成人一二三区视频| 国产亚洲欧洲一区高清在线观看| 欧美伦理电影网| 又紧又大又爽精品一区二区| 亚洲自拍偷拍网站| 成人成人成人在线视频| 紧缚捆绑精品一区二区| 欧美精品日韩精品| 亚洲欧美一区二区不卡| 亚洲乱码精品一二三四区日韩在线| 亚洲人精品一区| 欧美丝袜丝交足nylons图片| 欧美日韩国产中文| 欧美一区二区三区在线视频| 欧美日韩中字一区| 日本高清不卡在线观看| 91亚洲精华国产精华精华液| 蜜桃av一区二区三区电影| 一区二区三区在线视频免费观看| 国产欧美一区二区精品性| 日韩写真欧美这视频| 欧美无人高清视频在线观看| 成av人片一区二区| 国产伦精品一区二区三区视频青涩 | 91精品国产全国免费观看| 91在线免费看| 国产成人免费视频精品含羞草妖精 | 国产专区欧美精品| 日韩高清一区在线| 亚洲第一主播视频| 亚洲第一在线综合网站| 亚洲成人综合网站| 亚洲一区二区欧美日韩| 亚洲精品五月天| 亚洲欧美日韩一区二区| 中文字幕av一区二区三区免费看| wwwwww.欧美系列| 91 com成人网| 在线播放日韩导航| 欧美人妇做爰xxxⅹ性高电影| 欧美伊人久久大香线蕉综合69| 色婷婷一区二区三区四区| 91首页免费视频| 91视视频在线观看入口直接观看www| 成人18视频日本| 91福利社在线观看| 欧美视频完全免费看| 欧美日韩亚洲另类| 91麻豆精品久久久久蜜臀| 91麻豆精品国产91久久久久久久久| 欧美日本在线观看| 欧美一区二区三区四区久久| 日韩欧美在线网站| 久久久不卡网国产精品二区| 国产精品日日摸夜夜摸av| 亚洲欧美综合色| 亚洲靠逼com| 天天色天天操综合| 精品夜夜嗨av一区二区三区| 国产99精品视频| 色婷婷亚洲综合| 欧美一区二区免费| 久久久久国产成人精品亚洲午夜| 国产精品乱码人人做人人爱| 一区二区三区日韩欧美| 日本免费新一区视频| 激情综合色综合久久| 成人黄色大片在线观看| 欧美色精品在线视频| 欧美日韩国产综合视频在线观看| 欧美精品一区二区蜜臀亚洲| 亚洲私人黄色宅男| 日韩中文字幕一区二区三区| 国产美女av一区二区三区| 在线观看一区二区精品视频| 日韩一区二区三区高清免费看看| 日本一区二区三区国色天香| 午夜视频一区在线观看| 国产在线精品不卡| 欧美日韩一级二级三级| 国产色综合久久| 日韩电影网1区2区| 成人午夜精品在线| 6080午夜不卡| 国产精品传媒入口麻豆| 日本美女视频一区二区| 一本久久a久久免费精品不卡| 欧美一级艳片视频免费观看| 日韩一区在线播放| 国内精品国产成人| 欧美视频你懂的| 国产精品久久久久久久蜜臀| 精品影视av免费| 欧美三级视频在线| 国产精品久久久久久户外露出| 日韩福利电影在线观看| 91免费国产在线观看| 久久亚洲精品国产精品紫薇| 午夜精品影院在线观看| www.视频一区| 久久精品视频在线免费观看 | 欧美电影在线免费观看| 一区精品在线播放| 国产不卡视频一区二区三区| 精品久久久久久久久久久院品网| 夜夜嗨av一区二区三区中文字幕 | 久久婷婷国产综合精品青草| 亚洲va在线va天堂| 91蜜桃在线观看| 国产欧美一区二区三区在线老狼| 日本三级亚洲精品| 欧美日韩免费不卡视频一区二区三区| 国产精品国产三级国产普通话99 | 裸体健美xxxx欧美裸体表演| 在线观看日韩精品| 亚洲色图欧美偷拍| 福利一区二区在线观看| 国产日韩欧美a| 国产精品一区二区三区99| 欧美成人欧美edvon| 毛片不卡一区二区| 91精品国产综合久久福利软件| 婷婷久久综合九色国产成人 | 午夜亚洲国产au精品一区二区| 欧美亚洲综合另类| 亚洲成人精品一区|