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

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

?? ide.c

?? CY7C68033芯片 USB DEVICE 代碼;標準c代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
//-----------------------------------------------------------------------------
// IDE.c
// This file contains the IDE specific portions of the code.
//
// Format:  indent 3.  NO TABS!
//
//--------------------------------------------------------------------------
// $Archive: /USB/atapifx2/NX2LP/SRC/CY3686FW/ide.c $
// $Modtime: 8/31/05 7:56a $
// $Revision: 2 $
//--------------------------------------------------------------------------
//
// Copyright 2005, Cypress Semiconductor Corporation.
//
// This software is owned by Cypress Semiconductor Corporation (Cypress)
// and is protected by and subject to worldwide patent protection (United
// States and foreign), United States copyright laws and international 
// treaty provisions. Cypress hereby grants to licensee a personal, 
// non-exclusive, non-transferable license to copy, use, modify, create 
// derivative works of, and compile the Cypress Source Code and derivative 
// works for the sole purpose of creating custom software in support of 
// licensee product to be used only in conjunction with a Cypress integrated 
// circuit as specified in the applicable agreement. Any reproduction, 
// modification, translation, compilation, or representation of this 
// software except as specified above is prohibited without the express 
// written permission of Cypress.
//
// Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, 
// WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// Cypress reserves the right to make changes without further notice to the
// materials described herein. Cypress does not assume any liability arising
// out of the application or use of any product or circuit described herein.
// Cypress does not authorize its products for use as critical components in
// life-support systems where a malfunction or failure may reasonably be
// expected to result in significant injury to the user. The inclusion of
// Cypress' product in a life-support systems application implies that the
// manufacturer assumes all risk of such use and in doing so indemnifies
// Cypress against all charges.
//
// Use may be limited by and subject to the applicable Cypress software
// license agreement.
//
//--------------------------------------------------------------------------

#include "globals.h"

void loadEP4BC(WORD dataLen);

void cMedia() { if (bEject) sensePtr = senseNoMedia; else sensePtr=senseOk; }

// This command is only used for removable DRIVES, not removable media
// An example of removable drive is Compact Flash 
#define checkForMedia(x) cMedia()


// From SCSI spec SPC (SCSI primary commands)
// Byte 0 -- 70 = Current error
// Byte 1 -- Segment number
// Byte 2 -- Sense key (SPC table 107)
//             5 = ILLEGAL REQUEST. Indicates that there was an illegal parameter in 
//                 the CDB or in the additional parameters supplied as data for some commands
//             B = ABORTED COMMAND. Indicates that the device server aborted the command.
//                 The application client may be able to recover by trying the command again.
//             E = MISCOMPARE. Indicates that the source data did not match the data read 
//                 from the medium.
// Byte 3-6  -- Information (not used)
// Byte 7    -- add'l sense length 
// byte 8-11 -- Command specific information
// byte 12   -- ASC (Add'l sense code)
// byte 13   -- ASQ (Add'l sense qualifier)
//                                                Key                                                        ASC   ASQ
//                                    0     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15
//const char code senseTemplate[]= {0x70,  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};   
//                                                SK    ASC   ASQ

const char code senseArray[senseWriteProtected+1][3] = 
{{0x0b, 0x08, 0x03},   // senseCRCError               0 // Set on CRC error.  Causes host to retry  
{0x05, 0x24, 0x00},    // senseInvalidFieldInCDB      1 
{0x00, 0x00, 0x00},    // senseOk                     2
{0x02, 0x3a, 0x00},    // senseNoMedia                3
{0x03, 0x03, 0x00},    // senseWriteFault             4
{0x03, 0x11, 0x00},    // senseReadError              5
{0x03, 0x12, 0x00},    // senseAddrNotFound           6
{0x05, 0x20, 0x00},    // senseInvalidOpcode          7
{0x05, 0x21, 0x00},    // senseInvalidLBA             8
{0x05, 0x26, 0x00},    // senseInvalidParameter       9
{0x05, 0x53, 0x02},    // senseCantEject              0xa
{0x06, 0x28, 0x00},    // senseMediaChanged           0xb
{0x06, 0x29, 0x00},    // senseDeviceReset            0xc 
{0x07, 0x27, 0x00}};   // senseWriteProtected         0xd

char sensePtr;

/////////////////////////////////////////////////////////////////////////////////
//
// Called when we have received a valid CBW from the host
//
// Input:
//    EP2FIFOBUF -- Contains CBW
//   
// Output:
//    EP4FIFOBUF -- Used to send the data phase of the command back to the host.
//    Returns a byte to be sent as the CSW status byte.
//////////////////////////////////////////////////////////////////////////////////
bit IDECommand()
{
   BYTE cmd;

   bShortPacketSent = !directionIn;
   
   cmd = EP2FIFOBUF[0xf]; 

#ifndef NO_WP
   ////////////////////////////////////////////////////////////////////////////////////////////////////
   // Check for WP status changed.  If the WP status has changed, fail ANY command that comes in and
   // set the status to "media changed"
   if (bWriteProtectEnable)
   {
      if ((bWPSwitchState != NAND_WP_SWITCH) )
         {
         // Free the OUT buffer containing the command, load the error pointer, store new switch value and fail the command   
         OUTPKTEND = 0x82;
         bWPSwitchState = NAND_WP_SWITCH;
         sensePtr = senseMediaChanged; 
         if (directionIn) failedIn();
         else stallEP2OUT();
         //bEject = 0;  // toggle the switch will enable device again
         return(USBS_FAILED);
         }
   }
#endif

   switch (cmd)
   {
/// IN Command
      //////////////////////////////////////////////////////////////////////////////////
      // Good example of the processing required for a case in this switch statement.
      // -- Gives OUT bulk buffer back to the host
      // -- Loads IN buffer with a response
      // -- Adjusts dataTransferLen (inside loadEP4BC)
      // -- Returns PASSED or FAILED
      case INQUIRY:
      {
         OUTPKTEND = 0x82;
         // Send out our stored inquiry data
         waitForInBuffer();
         AUTOPTRL2 = LSB(EP4FIFOBUF);
#ifdef USE_2LUN
         if (!bLUN1) P_XAUTODAT2 = 0; else P_XAUTODAT2 = cDriveType;
#else
         P_XAUTODAT2 = 0;
#endif

#ifndef NO_WP
         if (bWriteProtectEnable) P_XAUTODAT2 = SCSI_INQUIRY_REMOVABLE_BIT;
         else P_XAUTODAT2 = 0;
#else
         P_XAUTODAT2 = SCSI_INQUIRY_REMOVABLE_BIT;
#endif
         P_XAUTODAT2 = 0;
         P_XAUTODAT2 = 0;
         P_XAUTODAT2 = 0x1F;
         P_XAUTODAT2 = 0;
         P_XAUTODAT2 = 0;
         P_XAUTODAT2 = 0;
         // copy SCSI Inquiry string
         mymemmovexx(EP4FIFOBUF+8, halfKBuffer+cHALF_BUFF_OFFSET, cINQUIRY_LENGTH); 
         loadEP4BC(0x1F+5);
         sensePtr = senseOk;
         return(USBS_PASSED);
      }

      case NAND_SCSI_CMD_VENDOR_CBW: return handleVendorCBW();

      // This command is "spoofed".  We tell the host that the command has succeeded but
      // don't actually do anything.
      case SYNCHRONIZE_CACHE:
      case SEEK_10:
      {
            // relinquish control of the bulk buffer occupied by the CBW
            OUTPKTEND = 0x82;
            return(USBS_PASSED);
      }                

      case READ_FORMAT_CAPACITIES:
      case READ_CAPACITY:
      {
         BYTE num_bytes = 8;

         // Nand Mfg support
         GetNandCfg();
         // add this for 30ns cycle support
         if (b30nsCycle && EZUSB_HIGHSPEED())
         {
              GPIF_40();
              b30nsCycle = 0;  // load only one time
         }
         // relinquish control of the bulk buffer occupied by the CBW
         OUTPKTEND = 0x82;       
         checkForMedia(1);
                 
         waitForInBuffer();
         if (sensePtr == senseOk)
         {
            AUTOPTRL2 = LSB(EP4FIFOBUF);
            if(cmd == READ_FORMAT_CAPACITIES) // add 4 byte capacity list header
            {
               P_XAUTODAT2 = 0x0;
               P_XAUTODAT2 = 0x0;
               P_XAUTODAT2 = 0x0;
               P_XAUTODAT2 = 0x08;
               num_bytes = 12;
            }
#ifdef USE_2LUN
            if (bLUN1)
            {
               P_XAUTODAT2 = (cLUN1_Capacity >> 24);
               P_XAUTODAT2 = (cLUN1_Capacity >> 16);
               P_XAUTODAT2 = (cLUN1_Capacity >>  8);
               P_XAUTODAT2 = (cLUN1_Capacity >>  0);
            }
            else
            {
               P_XAUTODAT2 = ((BYTE *) &gDriveCapacity)[0];
               P_XAUTODAT2 = ((BYTE *) &gDriveCapacity)[1];
               P_XAUTODAT2 = ((BYTE *) &gDriveCapacity)[2];
               P_XAUTODAT2 = ((BYTE *) &gDriveCapacity)[3];
            }
#else
            P_XAUTODAT2 = ((BYTE *) &gDriveCapacity)[0];
            P_XAUTODAT2 = ((BYTE *) &gDriveCapacity)[1];
            P_XAUTODAT2 = ((BYTE *) &gDriveCapacity)[2];
            P_XAUTODAT2 = ((BYTE *) &gDriveCapacity)[3];
#endif
            if(cmd == READ_FORMAT_CAPACITIES) 
               P_XAUTODAT2 = ((NAND_ATA_SECTOR_SIZE >> 24) & 0xff) | 2;     // Report media type -- Formatted
            else
               P_XAUTODAT2 = (NAND_ATA_SECTOR_SIZE >> 24) & 0xff;
            P_XAUTODAT2 = (NAND_ATA_SECTOR_SIZE >> 16) & 0xff;
            P_XAUTODAT2 = (NAND_ATA_SECTOR_SIZE >>  8) & 0xff;
            P_XAUTODAT2 = (NAND_ATA_SECTOR_SIZE >>  0) & 0xff;

            loadEP4BC(num_bytes);
            return(USBS_PASSED);
         }
         else
         {
            failedIn();
            return(USBS_FAILED);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品乱码妇女bbbb| 久久精品久久综合| 国产欧美日韩在线| 久久这里只有精品首页| 91精品国产综合久久精品性色 | 欧美撒尿777hd撒尿| 97精品久久久午夜一区二区三区 | 色综合咪咪久久| 91麻豆国产福利精品| 91成人免费在线| 欧美欧美午夜aⅴ在线观看| 欧美日韩成人一区| 日韩欧美在线123| 久久久久久夜精品精品免费| 久久久亚洲高清| 亚洲欧洲99久久| 亚洲韩国一区二区三区| 日韩在线卡一卡二| 精品一区二区影视| 成人妖精视频yjsp地址| 91麻豆产精品久久久久久| 欧美日韩aaa| 国产欧美视频一区二区| 亚洲精品少妇30p| 久久精工是国产品牌吗| 成人精品鲁一区一区二区| 色中色一区二区| 日韩三级av在线播放| 久久精品亚洲一区二区三区浴池| 国产精品激情偷乱一区二区∴| 亚洲成人自拍一区| 国产传媒日韩欧美成人| 在线看国产一区| 精品久久久久久久久久久久久久久| 日本一区二区不卡视频| 香蕉成人啪国产精品视频综合网| 九九视频精品免费| 欧美色视频在线| 欧美国产日韩a欧美在线观看 | 欧美日本精品一区二区三区| xvideos.蜜桃一区二区| 亚洲国产一区二区a毛片| 激情综合色综合久久综合| 97se狠狠狠综合亚洲狠狠| 日韩精品影音先锋| 亚洲精品欧美专区| 国产精品一区二区三区网站| 欧美日韩亚洲丝袜制服| 国产精品久久久久影院老司| 蜜臀av性久久久久蜜臀aⅴ四虎| 成人sese在线| 久久精品人人做人人爽人人| 日韩制服丝袜av| 一本到高清视频免费精品| 精品国精品国产| 婷婷成人激情在线网| 不卡电影免费在线播放一区| 日韩免费电影一区| 日日夜夜精品视频天天综合网| aa级大片欧美| 国产精品天美传媒| 色天天综合色天天久久| 久久一二三国产| 麻豆久久一区二区| 91精品免费在线| 日韩制服丝袜先锋影音| 欧美日韩免费高清一区色橹橹| 亚洲人成在线播放网站岛国| 国产91丝袜在线播放| 精品黑人一区二区三区久久 | 国产精品高潮呻吟| 风流少妇一区二区| 中文字幕va一区二区三区| 成人性生交大合| 国产日韩欧美在线一区| 丁香一区二区三区| 中文字幕在线一区二区三区| www.亚洲色图.com| 亚洲欧美电影一区二区| 色国产综合视频| 亚洲国产精品久久一线不卡| 在线播放欧美女士性生活| 日韩电影免费一区| 日韩免费视频一区二区| 国产精品综合二区| 国产女人18毛片水真多成人如厕| 丁香亚洲综合激情啪啪综合| 综合在线观看色| 欧美日韩国产影片| 蜜桃免费网站一区二区三区| 精品国产一区二区三区不卡| 韩国精品一区二区| 国产精品久久久久精k8| 日本黄色一区二区| 日本成人中文字幕在线视频| 亚洲精品在线三区| 99麻豆久久久国产精品免费| 亚洲第一福利视频在线| 精品国产乱码久久久久久夜甘婷婷 | 国产在线国偷精品产拍免费yy| 久久午夜羞羞影院免费观看| a美女胸又www黄视频久久| 午夜伦理一区二区| 久久久久久久久久久久久夜| aa级大片欧美| 久久97超碰国产精品超碰| 亚洲国产精品精华液2区45| 欧美午夜精品久久久久久孕妇| 奇米一区二区三区av| 国产精品丝袜一区| 欧美欧美欧美欧美首页| 大胆亚洲人体视频| 婷婷激情综合网| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆 | 自拍偷拍国产精品| 欧美一区二区免费| 91在线小视频| 精品一区二区三区免费毛片爱 | 婷婷开心久久网| 国产精品福利影院| 2021久久国产精品不只是精品| 色噜噜狠狠成人中文综合 | 中文字幕亚洲综合久久菠萝蜜| 欧美精品日韩综合在线| 97精品久久久午夜一区二区三区| 美国毛片一区二区| 亚洲国产日韩综合久久精品| 国产精品国产三级国产三级人妇 | 在线观看国产一区二区| 国产精品自拍网站| 奇米影视一区二区三区| 一区二区在线电影| 国产精品伦理在线| 久久久www成人免费无遮挡大片| 欧美日韩一区二区三区视频| 95精品视频在线| 大胆亚洲人体视频| 国产成人免费视频网站| 国产精品99久| 国产一区二区精品久久91| 琪琪一区二区三区| 美女爽到高潮91| 美女免费视频一区二区| 免费高清在线一区| 日韩精品免费专区| 五月天久久比比资源色| 亚洲动漫第一页| 午夜成人免费电影| 日韩国产欧美在线视频| 日韩精品一区第一页| 丝袜亚洲精品中文字幕一区| 亚洲国产精品欧美一二99| 亚洲午夜久久久久久久久电影院| 亚洲综合在线视频| 亚洲v日本v欧美v久久精品| 亚洲影视在线播放| 亚洲成在人线免费| 免费成人av在线| 国产精品18久久久久久久久久久久| 国产在线不卡视频| av午夜精品一区二区三区| 91捆绑美女网站| 精品视频123区在线观看| 在线观看91av| 国产无人区一区二区三区| 国产精品盗摄一区二区三区| 亚洲欧美怡红院| 午夜精品在线看| 狠狠色丁香婷婷综合| 99久久99久久精品免费看蜜桃| 色婷婷av一区二区三区之一色屋| 欧美午夜影院一区| 精品国产露脸精彩对白| 国产精品家庭影院| 日韩精品91亚洲二区在线观看 | 欧美亚洲一区二区三区四区| 欧美乱妇15p| 久久九九影视网| 亚洲伊人色欲综合网| 日本网站在线观看一区二区三区 | 亚洲日本在线a| 日韩主播视频在线| 国产大陆精品国产| 欧美日韩国产三级| 久久精品亚洲乱码伦伦中文| 亚洲精品菠萝久久久久久久| 日本欧洲一区二区| 99久久精品国产一区| 欧美久久久久免费| 18成人在线观看| 久草热8精品视频在线观看| 99麻豆久久久国产精品免费优播| 91精品欧美综合在线观看最新 | 一本色道久久综合精品竹菊| 欧美人体做爰大胆视频| 国产欧美一区二区精品性色超碰| 亚洲一区二区三区中文字幕| 国产电影一区二区三区| 欧美一区二区三区公司| ...xxx性欧美|