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

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

?? periph.c

?? CY7C68033芯片 USB DEVICE 代碼;標(biāo)準(zhǔn)c代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
#pragma NOIV               // Do not generate interrupt vectors

//-----------------------------------------------------------------------------
// File:     periph.c
// Contents: Hooks required to implement USB peripheral function.
//
// Format:   indent 3.  NO TABS!
//
//--------------------------------------------------------------------------
// $Archive: /USB/atapifx2/NX2LP/SRC/CY3686FW/periph.c $
// $Modtime: 8/08/05 10:01a $
// $Revision: 1 $
//--------------------------------------------------------------------------
//
// 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"


//-----------------------------------------------------------------------------
// Hardware/Software Initialization will be done here
// Search for USER_INIT and modify the IOD, OED, OEA for addition HW 
// Modification
//-----------------------------------------------------------------------------
void TD_Init(void)             // Called once at startup
{
   MPAGE     = 0xe6;              // Map to Hardware register page 0xE600

   IFCONFIG = IFCONFIG_DEFAULT;
   CPUCS = 0x14;            // set clock to 48MHz.     

   // Enable both autoptrs. ONLY use AUTOPTR2 for writing small amounts of data 
   AUTOPTRSETUP = 0x7;
   AUTOPTRH2 = MSB(EP4FIFOBUF);

   IT0 = 0;                 // Make Interrupt 0 level triggered
   FLOWSTATE = 0x00;        // turn off flowstate 
   FIFOPINPOLAR = 0x00;     // ff pin is active low
   PINFLAGSAB = 0x00;       // FLAGA PF for FIFO selected by FIFOADR[1..0]
   PINFLAGSCD = 0x00;       // FLAGB FF for FIFO selected by FIFOADR[1..0]

   // GPIF and CTL configuration
   GPIFCTLCFG = 0x0;        // 
   GPIFIDLECS = 0;          // tristate data bus during idle interval
   EP2FIFOCFG = 0x00;       // byte wide
   EP6FIFOCFG = 0x00;       // byte wide
   EP8FIFOCFG = 0x00;       // byte wide
   EP2FIFOPFH = 0x00;       // PF=0 when BC > PF -> Decis=0 (1 byte in FIFO)
   EP2FIFOPFL = 0x00;       // PF and BC refer to the current pkt -> PKTSTAT=0
   EP2GPIFPFSTOP = 0;       // Do not stop on PF
   EP6GPIFFLGSEL = 0x01;
   EP2GPIFFLGSEL = 0x01;    //  Empty for the EP2

   // Single write is 3, Single read is 2, write is 1, Read is waveform 0 
   GPIFWFSELECT = 0xe4;
   GPIFREADYCFG = 0x20;     // RDY5 is the transaction count expired
   GPIFIDLECTL  = 0x7;      // x111x111 - CTL3 not enabled  
                            // ||||||||_CTL0 = 1 during idle
                            // |||||||__CTL1 = 1 during idle
                            // ||||||___CTL2 = 1 during idle
                            // ||||_____CTL0 output enable
                            // |||______CTL1 output enable
                            // ||_______CTL2 output enable

   // Endpoint initialization
   EP2CFG = EP2CFG_DEFAULT;
   EP4CFG = EP4CFG_DEFAULT;

   EP4FIFOCFG = EP4FIFOCFG_DEFAULT; // Setup EP4 FIFO CFG
   EP4GPIFFLGSEL = 0x02;            // GPIF will use the full flag as the fifoflag

   // mark all unused endpoints invalid - setting each reg to 0x22 instead of just clearing
   // the valid bit to save code space.  0x22 basically sets all of these endpoints to 
   // not valid, bulk, double 512 buffered.
#ifdef HID
   EP1INCFG = 0xb0;                      // Setup EP1 IN
#else
   EP1INCFG = 
#endif
   EP1OUTCFG = EP8CFG = EP6CFG = 0x22;
   P_EP6CFG = EP6CFG_IN_DEFAULT;         // Use from inand.h
   REVCTL = bmNOAUTOARM | bmSKIPCOMMIT;  // Enable enhanced packet handling.  
                                         // requires us to use OUTPKTEND to arm OUT endpoint
   // init state/reset variables
   currentState = UNCONFIGURED;
   phaseErrorState = 0;
   CKCON = 0x10;              // Zero wait state
   LED0_OFF();                // turn off both LEDs
   LED1_OFF();
   P_ECCCFG = 0x00;           // set the NAND ECC calculator to 256 byte mode

   GPIFABORT = 0xff;              // force GPIF goto idle
   P_EP6BCH = 0xff;           // default

   // USER_INIT:  
   //   - Default PortD: set all pins = output
   //   - Default PortE: set all pins = output, except pin 5.
   //   - 512 NAND FW: Only 2 NAND chip selects on PortD (PD0 and PD1)
   //   - 2K  NAND FW:  Support PD0-PD3
   
   OED = 0xFF;                // NAND chip select use PD0-7
   IOD = 0xFF;
   OEA = 0xDF;                // 1101 1111 -- PA5 (WP switch) is an input

   // relocate descriptor data to halfKBuffer when we know it's the first time
   // i.e. On POR, TR0=0 = firsttime
   if (!TR0)
   {        
      memset16(halfKBuffer+cHALF_BUFF_OFFSET, 0, (cNAND_CFG_LENGTH/16));   // clear all zeros
      mymemmovexx(halfKBuffer, (char xdata *) &DeviceDscr, (WORD)&DscrEndOffset);
      mymemmovexx(&GPIF_WAVE_DATA, (BYTE xdata *) WaveDataPioUDMA, 128);   // load wave forms in memory
      InitNAND();  // Only call this when POR
   }
   // reset the EP4 FIFO.  If we are here as the result of a USB reset or MSC
   // Reset Recovery, EP4 may need to be cleaned up.
   P_FIFORESET = 0x04;
   // arm the OUT endpoint.  By default OUT endpoints come up unarmed.
   ResetAndArmEp2();
}
//-----------------------------------------------------------------------------
// Task Dispatcher hooks:
//     The following hooks are called by the task dispatcher.
//     USB Mass storage Command Processing here
//-----------------------------------------------------------------------------
void TD_Poll(void)             // Called repeatedly while the device is idle
{
    BYTE cmd;
    // check EP2 EMPTY(busy) bit in EP2468STAT (SFR), core set's this bit when FIFO is empty
    if((P_EP2CS & bmEPEMPTY)) return;

    currentState = WAIT_FOR_CBW;
    AUTOPTR1H = MSB(EP2FIFOBUF); 
    AUTOPTR1L = LSB(EP2FIFOBUF); 

    if ((P_XAUTODAT1 != 'U' ||   // Check for "USBC"
         P_XAUTODAT1 != 'S' ||
         P_XAUTODAT1 != 'B' ||
         P_XAUTODAT1 != 'C')|| (EP2BC != 31)
        )
    {
         P_EP2CS = P_EP4CS = bmEPSTALL;
         phaseErrorState = 1;
         return;
    }

    LED0_ON();
    *(((BYTE *) &cbwTagLow)+0) = P_XAUTODAT1;
    *(((BYTE *) &cbwTagLow)+1) = P_XAUTODAT1;
    *(((BYTE *) &cbwTagHi)+0)  = P_XAUTODAT1;
    *(((BYTE *) &cbwTagHi)+1)  = P_XAUTODAT1;

    // Get the length (convert from little endian)
    *(((BYTE *) &dataTransferLen)+3) = P_XAUTODAT1; 
    *(((BYTE *) &dataTransferLen)+2) = P_XAUTODAT1;  // "Residue"
    *(((BYTE *) &dataTransferLen)+1) = P_XAUTODAT1;  // "Residue"
    *(((BYTE *) &dataTransferLen)+0) = P_XAUTODAT1;  // "Residue"

   directionIn = P_XAUTODAT1 & 0x80;
#ifdef USE_2LUN
   bLUN1       = P_XAUTODAT1;                        // extract LUN
#endif
   AUTOPTR1L = LSB(EP2FIFOBUF+CBW_DATA_START+2); 
   ((BYTE *) &gNextLBA)[0] = P_XAUTODAT1;
   ((BYTE *) &gNextLBA)[1] = P_XAUTODAT1;
   ((BYTE *) &gNextLBA)[2] = P_XAUTODAT1;
   ((BYTE *) &gNextLBA)[3] = P_XAUTODAT1;
   P_XAUTODAT1;
   ((BYTE *) &gSectorcount)[0] = P_XAUTODAT1;
   ((BYTE *) &gSectorcount)[1] = P_XAUTODAT1;
   bErr = 0;
   cmd = EP2FIFOBUF[0xf];
   if (gPartialCpy)
   {
      // if the current command is not a write to our expected LBA
      // then complete the partial block write
      if (!((cmd == WRITE_10) && (dwLBA == gNextLBA)))
      {
         NAND_PCPY(gPartialCpy, xLBA3);
         gPartialCpy = 0;  // Reset partial cpy
         nEraseBlock();
         DISABLE_NAND();
      }

   }

#ifdef USE_2LUN
   if (bLUN1)
      gNextLBA += (gDriveCapacity+1);  // adjust for next block
#endif

   dwLBA = gNextLBA;

   switch(cmd)
   {
      //    -- Read that starts after the end of the disk
      //    -- Read that starts inside the disk and continues beyond the end of the disk
      //    -- Unrecoverable ECC error
      // case READ_06:
      case READ_10:
         // Add support for BOT test
         cmd = xFerLen2>>1; 
         if (xFerLen1&1) cmd |= 0x80; 
         if ((cmd != xSector)  || bEject || !directionIn)
         {
            failedIn();
            cmd = USBS_FAILED;
            break;
         }
         nReadPages();
         cmd = ChkErr();
         break;
      //case WRITE_06:
      case WRITE_10:
      case WRITE_AND_VERIFY_10:
         P_OUTPKTEND = 0x82;
         // This check doesn't seem to be required by Windows.  They will read and obey the WP
         // state reported in the mode_sense data.  This code is here for SCSI passthrough-enabled

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲黄色小视频| 国产在线精品视频| 精品欧美黑人一区二区三区| 成人动漫精品一区二区| 欧美aa在线视频| 亚洲女人****多毛耸耸8| 精品免费国产一区二区三区四区| 成人av在线看| 久久av中文字幕片| 一区二区三区在线免费视频| 久久久久久电影| 91精品国产免费| 精品视频全国免费看| www.亚洲人| 国产福利一区二区三区在线视频| 日韩国产一二三区| 亚洲精选视频在线| 国产精品三级在线观看| 精品国产露脸精彩对白| 欧美日韩国产天堂| 欧美在线一区二区三区| 国产一区二区三区视频在线播放| 亚洲成av人**亚洲成av**| 中文字幕中文在线不卡住| 日韩三级视频中文字幕| 欧美片网站yy| 欧美人狂配大交3d怪物一区| 色嗨嗨av一区二区三区| av一区二区三区黑人| 国产精品一区二区果冻传媒| 久久国产综合精品| 麻豆91在线观看| 久久福利视频一区二区| 久久99热狠狠色一区二区| 视频一区欧美日韩| 亚洲成人av一区二区三区| 亚洲一区二区在线免费观看视频| 亚洲欧洲日韩综合一区二区| 国产精品福利一区二区| 亚洲欧洲国产日韩| 中文字幕亚洲在| 18成人在线观看| 最新国产の精品合集bt伙计| 亚洲欧美偷拍三级| 亚洲欧美aⅴ...| 亚洲无线码一区二区三区| 亚洲第一狼人社区| 日韩国产精品91| 捆绑变态av一区二区三区| 久久国产尿小便嘘嘘| 韩国av一区二区三区四区| 国产精品77777| 成人黄色小视频在线观看| 成人久久18免费网站麻豆| www.日韩在线| 色综合久久久久| 欧美日韩成人综合天天影院 | 亚洲久本草在线中文字幕| 亚洲欧美色一区| 亚洲一区二区三区四区在线| 视频精品一区二区| 激情五月播播久久久精品| 国产伦精一区二区三区| 国产精品亚洲人在线观看| 成人晚上爱看视频| 91国内精品野花午夜精品| 欧美日韩国产首页| 日韩欧美aaaaaa| 国产精品欧美综合在线| 夜夜揉揉日日人人青青一国产精品 | 日本道色综合久久| 7777精品伊人久久久大香线蕉超级流畅 | 色欧美片视频在线观看在线视频| 在线观看视频一区二区欧美日韩| 欧美高清视频一二三区 | 久久国产尿小便嘘嘘| 风间由美一区二区三区在线观看 | 亚洲成人福利片| 国产一区不卡视频| 一本久久a久久精品亚洲| 欧美精品精品一区| 久久精品网站免费观看| 一区二区三区中文在线观看| 日本成人在线看| 床上的激情91.| 欧美日韩国产高清一区二区三区 | 国产精品白丝jk黑袜喷水| 色乱码一区二区三区88| 日韩一区二区电影| 国产精品久久三| 奇米精品一区二区三区四区| 成人教育av在线| 欧美日韩国产123区| 欧美高清在线视频| 日本一道高清亚洲日美韩| 成人a免费在线看| 欧美大片在线观看一区| 又紧又大又爽精品一区二区| 国产一区二区精品久久| 欧美性videosxxxxx| 国产精品午夜在线观看| 免费日本视频一区| 在线视频欧美区| 国产精品网站在线| 老司机精品视频导航| 欧美在线观看18| 国产精品不卡一区二区三区| 激情文学综合网| 制服.丝袜.亚洲.另类.中文 | 亚洲第一狼人社区| 99精品在线观看视频| 久久视频一区二区| 日韩电影免费在线| 在线观看亚洲成人| 亚洲素人一区二区| 成人美女在线视频| 亚洲精品在线观看视频| 美国十次了思思久久精品导航| 91久久久免费一区二区| 亚洲欧美一区二区视频| 国产在线精品国自产拍免费| 3d成人h动漫网站入口| 亚洲亚洲人成综合网络| 色噜噜夜夜夜综合网| 椎名由奈av一区二区三区| 成人av网站在线| 中文字幕av一区 二区| 国产精品亚洲а∨天堂免在线| 精品电影一区二区| 激情综合网av| 欧美videossexotv100| 美女在线观看视频一区二区| 日韩一区二区三区免费看 | 久久免费电影网| 麻豆91小视频| 精品理论电影在线| 伦理电影国产精品| 精品91自产拍在线观看一区| 久久成人久久鬼色| 精品久久免费看| 国产在线不卡一区| 久久色.com| 成人精品鲁一区一区二区| 欧美激情一区二区三区蜜桃视频 | 日韩一区和二区| 午夜精品福利视频网站| 91精品午夜视频| 蜜桃视频在线一区| 精品日韩99亚洲| 国产+成+人+亚洲欧洲自线| 国产午夜精品久久| 不卡的av在线播放| 夜夜嗨av一区二区三区网页| 欧美亚洲动漫另类| 日本一区中文字幕| 精品国产乱码久久久久久图片| 国产一区二区在线观看免费| 国产日产精品一区| 一本久久精品一区二区| 视频一区二区国产| 2021中文字幕一区亚洲| a4yy欧美一区二区三区| 亚洲国产aⅴ成人精品无吗| 91精品国产综合久久小美女| 久草在线在线精品观看| 欧美国产激情一区二区三区蜜月| 91蝌蚪porny成人天涯| 爽好久久久欧美精品| 久久久久久久久久久99999| 91麻豆福利精品推荐| 日本在线播放一区二区三区| 国产欧美综合在线观看第十页| 94色蜜桃网一区二区三区| 日韩影院在线观看| 国产日韩精品一区| 欧美午夜片在线看| 久久se精品一区精品二区| 亚洲特黄一级片| 日韩欧美国产麻豆| 97久久超碰精品国产| 美女一区二区久久| 1区2区3区精品视频| 欧美一级日韩一级| 99精品久久免费看蜜臀剧情介绍| 天天操天天色综合| 国产精品久久夜| 日韩免费看的电影| 欧美性色黄大片| 国产成人av一区二区| 亚洲福利一二三区| 国产精品理伦片| 欧美va亚洲va在线观看蝴蝶网| 色婷婷久久99综合精品jk白丝| 久久精品免费看| 亚洲国产毛片aaaaa无费看 | 国产欧美精品一区| 欧美美女一区二区三区| 成人精品一区二区三区四区| 青青草成人在线观看| 亚洲色图制服诱惑|