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

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

?? periph.c

?? CY7C68033芯片 USB DEVICE 代碼;標準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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一卡二卡三卡| 亚洲韩国一区二区三区| 国产激情精品久久久第一区二区 | 日本欧美韩国一区三区| 911精品国产一区二区在线| 一区二区三区自拍| 欧美精品在线视频| 久久国产精品99精品国产| wwwwxxxxx欧美| 99精品久久久久久| 成人性生交大片免费 | 日韩黄色免费网站| 欧美一级二级在线观看| 麻豆中文一区二区| 国产精品素人一区二区| 欧美专区在线观看一区| 久久国产麻豆精品| 亚洲区小说区图片区qvod| 欧美精品少妇一区二区三区| 激情综合亚洲精品| 亚洲一区二区在线观看视频| 久久综合视频网| 天涯成人国产亚洲精品一区av| 看电影不卡的网站| 国产精品夫妻自拍| 欧美一区二区三区人| 成人黄色av网站在线| 性欧美疯狂xxxxbbbb| 国产精品午夜电影| 欧美成人vps| 7777精品伊人久久久大香线蕉完整版| 国产不卡在线一区| 激情文学综合丁香| 麻豆专区一区二区三区四区五区| 亚洲第一在线综合网站| 亚洲视频一二三区| 中文字幕五月欧美| 国产欧美一区二区三区在线老狼| 日韩精品一区二| 日韩精品中午字幕| 欧美成人性战久久| 欧美va天堂va视频va在线| 91精品国产全国免费观看| 欧美日韩色一区| 91精品国产全国免费观看| 91精品啪在线观看国产60岁| 在线播放91灌醉迷j高跟美女| 欧美视频完全免费看| 欧美午夜不卡视频| 日韩一级黄色片| 26uuu国产日韩综合| 欧美国产综合一区二区| 国产精品护士白丝一区av| 亚洲精品成人在线| 欧洲国产伦久久久久久久| 国产视频一区二区在线| 国产亚洲欧美日韩俺去了| 久久亚洲精华国产精华液| 久久久蜜桃精品| 欧美成人一区二区| 国产精品久久二区二区| 一区二区高清免费观看影视大全| 亚洲1区2区3区4区| 捆绑调教美女网站视频一区| 成人激情免费视频| 欧美片在线播放| 中文字幕成人av| 日韩av午夜在线观看| eeuss鲁片一区二区三区在线看| 日本韩国欧美国产| 久久色.com| 午夜精品久久一牛影视| 国产成a人亚洲| 日韩一区二区高清| 国产精品乱码久久久久久| 亚洲一线二线三线视频| 成人黄色av电影| 精品福利在线导航| 亚洲午夜一二三区视频| 国产a级毛片一区| 久久久精品黄色| 午夜精品成人在线视频| 欧美伊人久久久久久久久影院| 久久亚洲影视婷婷| 国内精品国产成人国产三级粉色| 欧洲av一区二区嗯嗯嗯啊| 亚洲激情在线播放| 国产乱码精品一区二区三区av| 国产精一区二区三区| 久久久亚洲欧洲日产国码αv| 青青草国产成人99久久| 欧美另类久久久品| 日韩一区欧美二区| 欧美日韩国产影片| 日韩精品福利网| 欧美一区二区免费| 蜜臀a∨国产成人精品| 欧美一区二区在线看| 蜜臀av性久久久久蜜臀av麻豆 | 国产999精品久久久久久绿帽| 精品区一区二区| 国产精品18久久久久久久久久久久| 精品国产免费一区二区三区四区| 精品一区二区三区在线观看| 26uuu成人网一区二区三区| 99精品视频在线免费观看| 亚洲免费高清视频在线| 欧美亚洲国产一区在线观看网站| 丝袜亚洲另类欧美| 日韩女优毛片在线| 99精品国产视频| 日韩精品成人一区二区三区| 欧美国产一区二区在线观看| 色婷婷综合久久久久中文一区二区| 婷婷久久综合九色综合绿巨人| 精品国产免费久久| 在线视频国内一区二区| 国产美女精品在线| 亚洲精品成人少妇| 国产午夜一区二区三区| 欧美视频一区在线| 成人av网站免费| 秋霞电影网一区二区| 亚洲色图在线播放| 国产日产欧美一区| 精品国产伦一区二区三区观看方式 | 国产欧美中文在线| 日韩三级高清在线| 欧美日韩精品一区视频| 91丨九色porny丨蝌蚪| 国产精品456露脸| 韩国一区二区在线观看| 日本va欧美va欧美va精品| 在线视频一区二区免费| 国产成人丝袜美腿| 欧美性色欧美a在线播放| 亚洲v日本v欧美v久久精品| 在线免费观看日本欧美| 国产精品69久久久久水密桃| 久久久亚洲午夜电影| 一本久久精品一区二区| 亚洲精品日韩综合观看成人91| 97se亚洲国产综合在线| 免费的国产精品| 亚洲午夜视频在线观看| 亚洲成人7777| 国产精品久久久久永久免费观看 | 91美女在线视频| 国产精品996| 偷拍亚洲欧洲综合| 欧美主播一区二区三区| 欧美色欧美亚洲另类二区| 国产成人在线免费观看| 亚洲sss视频在线视频| 蜜臀av性久久久久蜜臀aⅴ流畅| 亚洲福利国产精品| 一区二区三区四区乱视频| 欧美日韩午夜在线视频| 97精品电影院| 99视频精品全部免费在线| 成人av先锋影音| 国产91精品欧美| 成人精品鲁一区一区二区| 韩国三级在线一区| 国产成人亚洲综合色影视| 日韩电影在线一区| 亚洲视频综合在线| 欧美精品一区二区三区一线天视频| 91精品国产综合久久久久| 中文在线一区二区| 日本欧美在线看| av一区二区久久| 福利电影一区二区三区| 最新日韩av在线| 中文字幕不卡在线播放| 亚洲欧美国产毛片在线| 亚洲视频一区二区在线| 国产精品欧美一区喷水| 精品美女一区二区| 亚洲欧美日韩人成在线播放| 国产精品女人毛片| 日本一区二区三区在线不卡 | 国模少妇一区二区三区| 免费在线看成人av| 欧美日韩免费一区二区三区| 日本aⅴ亚洲精品中文乱码| 久久99九九99精品| 亚洲超碰97人人做人人爱| 国产精品久久久久久久久果冻传媒 | 精品久久久久久最新网址| 在线一区二区视频| 亚洲在线成人精品| 一本到不卡精品视频在线观看| 91视频在线观看| 欧美亚洲一区二区在线| 欧美精品v国产精品v日韩精品| 中文字幕一区免费在线观看| 亚洲国产精品一区二区久久恐怖片| 欧美成人福利视频| 欧美性xxxxx极品少妇|