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

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

?? f34x_usb_standard_requests.c

?? c8051f340的詳細程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
//-----------------------------------------------------------------------------
// F34x_USB_Standard_Requests.c
//-----------------------------------------------------------------------------
// Copyright 2005 Silicon Laboratories, Inc.
// http://www.silabs.com
//
// Program Description:
//
// This source file contains the subroutines used to handle incoming 
// setup packets. These are called by Handle_Setup in USB_ISR.c and used for 
// USB chapter 9 compliance.
//

// How To Test:    See Readme.txt
//
//
// FID:            34X000022
// Target:         C8051F34x
// Tool chain:     Keil C51 7.50 / Keil EVAL C51
//                 Silicon Laboratories IDE version 2.6
// Command Line:   See Readme.txt
// Project Name:   F34x_USB_Interrupt
//
//
// Release 1.0
//    -Initial Revision (GP)
//    -22 NOV 2005
//    -Ported from 'F320_USB_Bulk
//

//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------

#include "c8051F340.h"
#include "F34x_USB_Register.h"
#include "F34x_USB_Main.h"
#include "F34x_USB_Descriptor.h"

//-----------------------------------------------------------------------------
// Externs
//-----------------------------------------------------------------------------

// These are created in USB_DESCRIPTOR.h

extern device_descriptor DeviceDesc;            
extern configuration_descriptor ConfigDesc;
extern interface_descriptor InterfaceDesc;
extern endpoint_descriptor Endpoint1Desc;
extern endpoint_descriptor Endpoint2Desc;
extern BYTE* StringDescTable[];

extern setup_buffer Setup;             // Buffer for current device request
extern unsigned int DataSize;
extern unsigned int DataSent;
extern BYTE* DataPtr;

extern BYTE Ep_Status[];               // Contains status bytes for EP 0-2

extern BYTE USB_State;                 // Determines current usb device state

//-----------------------------------------------------------------------------
// Global Variables
//-----------------------------------------------------------------------------

// These are response packets used for communication with host
code BYTE ONES_PACKET[2] = {0x01, 0x00};        
code BYTE ZERO_PACKET[2] = {0x00, 0x00};        

//-----------------------------------------------------------------------------
// Support Subroutines
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Get_Status
//-----------------------------------------------------------------------------
//
// Return Value : None
// Parameters   : None
//
// This routine returns a two byte status packet to the host
//
//-----------------------------------------------------------------------------

void Get_Status(void)                  
{                                      

   if (Setup.wValue.c[MSB] || Setup.wValue.c[LSB] ||
                                                
   // If non-zero return length or data length not  equal to 2 then send a stall
   // indicating invalid request
   Setup.wLength.c[MSB]    || (Setup.wLength.c[LSB] != 2))                                               
   {                                            
      Force_Stall();
   }

   // Determine if recipient was device, interface, or EP
   switch(Setup.bmRequestType)                  
   {
      // If recipient was device
      case OUT_DEVICE:                          
         if (Setup.wIndex.c[MSB] || Setup.wIndex.c[LSB])
         {
		    // Send stall if request is invalid
            Force_Stall();             
         }
         else
         {
		    // Otherwise send 0x00, indicating bus power and no
			// remote wake-up supported
            DataPtr = (BYTE*)&ZERO_PACKET;      
            DataSize = 2;                       
         }
         break;

      // See if recipient was interface
      case OUT_INTERFACE:                       
	     // Only valid if device is configured and non-zero index
         if ((USB_State != DEV_CONFIGURED) ||
              Setup.wIndex.c[MSB] || Setup.wIndex.c[LSB])                                                
         {
		    // Otherwise send stall to host
            Force_Stall();                      
         }
         else
         {
		    // Status packet always returns 0x00
            DataPtr = (BYTE*)&ZERO_PACKET;      
            DataSize = 2;
         }
         break;

      // See if recipient was an endpoint
      case OUT_ENDPOINT:                        
	     // Make sure device is configured and index msb = 0x00
         if ((USB_State != DEV_CONFIGURED) || Setup.wIndex.c[MSB])                   
         {                                     
            Force_Stall();              // otherwise return stall to host
         }
         else
         {
            // Handle case if request is directed to EP 1
            if (Setup.wIndex.c[LSB] == IN_EP1)  
            {
               if (Ep_Status[1] == EP_HALT)
               {                                
			      // If endpoint is halted, return 0x01,0x00
                  DataPtr = (BYTE*)&ONES_PACKET;
                  DataSize = 2;
               }
               else
               {
			      // Otherwise return 0x00,0x00 to indicate endpoint active
                  DataPtr = (BYTE*)&ZERO_PACKET;
                  DataSize = 2;
               }
            }
            else
            {
			   // If request is directed to endpoint 2, send either
			   // 0x01,0x00 if endpoint halted or 0x00,0x00 if endpoint is active
               if (Setup.wIndex.c[LSB] == OUT_EP2)
                                                
               {                                
                  if (Ep_Status[2] == EP_HALT)
                  {
                     DataPtr = (BYTE*)&ONES_PACKET;
                     DataSize = 2;
                  }
                  else
                  {
                     DataPtr = (BYTE*)&ZERO_PACKET;
                     DataSize = 2;
                  }
               }
               else
               {
                  Force_Stall();       // Send stall if unexpected data
               }
            }
         }
         break;

      default:
         Force_Stall();
         break;
   }
   if (Ep_Status[0] != EP_STALL)
   {
      // Set serviced Setup Packet, Endpoint 0 intransmit mode, 
	  // and reset DataSent counter
      POLL_WRITE_BYTE(E0CSR, rbSOPRDY);        
      Ep_Status[0] = EP_TX;                     
      DataSent = 0;
   }
}

//-----------------------------------------------------------------------------
// Clear_Feature
//-----------------------------------------------------------------------------
//
// Return Value : None
// Parameters   : None
//
// This routine can clear Halt Endpoint features on endpoint 1 and 2.
//
//-----------------------------------------------------------------------------

void Clear_Feature()                            
{                                               

   if ((USB_State != DEV_CONFIGURED)          ||// Send procedural stall if device isn't configured
   (Setup.bmRequestType == IN_DEVICE)         ||// or request is made to host(remote wakeup not supported)
   (Setup.bmRequestType == IN_INTERFACE)      ||// or request is made to interface
   Setup.wValue.c[MSB]  || Setup.wIndex.c[MSB]||// or msbs of value or index set to non-zero value
   Setup.wLength.c[MSB] || Setup.wLength.c[LSB])// or data length set to non-zero.
   {
      Force_Stall();
   }

   else
   {
      if ((Setup.bmRequestType == IN_ENDPOINT)&&// Verify that packet was directed at an endpoint
      (Setup.wValue.c[LSB] == ENDPOINT_HALT)  &&// the feature selected was HALT_ENDPOINT
      ((Setup.wIndex.c[LSB] == IN_EP1) ||       // and that the request was directed at EP 1 in
      (Setup.wIndex.c[LSB] == OUT_EP2)))        // or EP 2 out
      {
         if (Setup.wIndex.c[LSB] == IN_EP1)
         {
            POLL_WRITE_BYTE (INDEX, 1);         // Clear feature endpoint 1 halt
            POLL_WRITE_BYTE (EINCSR1, rbInCLRDT);
            Ep_Status[1] = EP_IDLE;             // Set endpoint 1 status back to idle
         }
         else
         {
            POLL_WRITE_BYTE (INDEX, 2);         // Clear feature endpoint 2 halt
            POLL_WRITE_BYTE (EOUTCSR1, rbOutCLRDT);
            Ep_Status[2] = EP_IDLE;             // Set endpoint 2 status back to idle
         }
      }
      else
      {
         Force_Stall();                         // Send procedural stall
      }
   }
   POLL_WRITE_BYTE(INDEX, 0);                   // Reset Index to 0
   if (Ep_Status[0] != EP_STALL)
   {
      // Indicate setup packet has been serviced
      POLL_WRITE_BYTE(E0CSR, rbSOPRDY);
   }
}

//-----------------------------------------------------------------------------
// Set_Feature
//-----------------------------------------------------------------------------
//
// Return Value : None
// Parameters   : None
//
// This routine will set the EP Halt feature for endpoints 1 and 2
//
//-----------------------------------------------------------------------------

void Set_Feature(void)                          
{                                             

   if ((USB_State != DEV_CONFIGURED)          ||// Make sure device is configured, setup data
   (Setup.bmRequestType == IN_DEVICE)         ||// is all valid and that request is directed at
   (Setup.bmRequestType == IN_INTERFACE)      ||// an endpoint
   Setup.wValue.c[MSB]  || Setup.wIndex.c[MSB]||
   Setup.wLength.c[MSB] || Setup.wLength.c[LSB])
   {
      Force_Stall();                            // Otherwise send stall to host
   }

   else
   {
      if ((Setup.bmRequestType == IN_ENDPOINT)&&// Make sure endpoint exists and that halt
      (Setup.wValue.c[LSB] == ENDPOINT_HALT)  &&// endpoint feature is selected
      ((Setup.wIndex.c[LSB] == IN_EP1)        ||
      (Setup.wIndex.c[LSB] == OUT_EP2)))
      {
         if (Setup.wIndex.c[LSB] == IN_EP1)
         {
            POLL_WRITE_BYTE (INDEX, 1);         // Set feature endpoint 1 halt
            POLL_WRITE_BYTE (EINCSR1, rbInSDSTL);
            Ep_Status[1] = EP_HALT;
         }
         else
         {
            POLL_WRITE_BYTE (INDEX, 2);         // Set feature Ep2 halt
            POLL_WRITE_BYTE (EOUTCSR1, rbOutSDSTL);
            Ep_Status[2] = EP_HALT;
         }
      }
      else

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91久久国产最好的精华液| 亚洲激情网站免费观看| 中文字幕不卡在线| 亚洲欧美一区二区三区国产精品 | 亚洲成人资源网| 久久国产免费看| av在线这里只有精品| 欧美日韩视频不卡| 久久在线观看免费| 一区二区三区.www| 激情文学综合丁香| 99re热这里只有精品视频| 欧美日韩在线播放一区| 久久亚洲精品小早川怜子| 亚洲欧美一区二区久久| 日韩和欧美一区二区| 国产宾馆实践打屁股91| 欧美日韩国产综合久久| 久久蜜桃香蕉精品一区二区三区| 亚洲免费观看高清完整版在线 | 欧美性感一区二区三区| 精品少妇一区二区三区视频免付费 | 日本一区二区三区高清不卡| 一区二区视频免费在线观看| 另类小说欧美激情| 一本大道久久a久久精品综合| 欧美α欧美αv大片| 亚洲欧美激情一区二区| 韩国三级中文字幕hd久久精品| heyzo一本久久综合| 日韩免费观看2025年上映的电影| 亚洲欧洲av在线| 国产在线精品一区二区| 欧美色精品在线视频| 国产精品视频一区二区三区不卡| 日韩成人免费在线| 91蜜桃网址入口| 久久久久久久电影| 日本不卡高清视频| 色狠狠一区二区| 欧美激情一二三区| 狠狠色丁香婷综合久久| 欧美日产国产精品| 亚洲精品免费一二三区| 国产精品亚洲第一| 日韩欧美久久久| 亚洲一区影音先锋| 99re热视频这里只精品| 久久男人中文字幕资源站| 日韩电影在线免费看| 日本道精品一区二区三区 | 99久久久久免费精品国产 | 国产成人精品影视| 日韩欧美一区电影| 日本网站在线观看一区二区三区 | 日韩成人dvd| 91黄色免费看| 日韩美女视频19| 成人aa视频在线观看| 久久久久久久久久久99999| 激情综合亚洲精品| 欧美电视剧在线观看完整版| 日本不卡视频一二三区| 91精品国产综合久久精品app | 欧美日韩精品欧美日韩精品一| 综合久久久久久| 不卡的av电影在线观看| 日本一区二区三区免费乱视频| 国产精品亚洲专一区二区三区| 久久久亚洲综合| 国产在线不卡一区| 国产偷国产偷亚洲高清人白洁| 国内精品国产三级国产a久久| 日韩精品一区二区三区老鸭窝| 免费精品视频最新在线| 欧美一级xxx| 久久99深爱久久99精品| 精品入口麻豆88视频| 久久精品国产亚洲aⅴ| 欧美成人精品3d动漫h| 久久99深爱久久99精品| 久久精品一区二区三区不卡 | 国产精品久久久久永久免费观看 | 中文字幕av一区二区三区| 国产成人av电影在线播放| 日本一区二区三区视频视频| 成人高清视频免费观看| 1024亚洲合集| 在线观看网站黄不卡| 亚洲电影激情视频网站| 欧美精品丝袜中出| 久久99精品久久久久久国产越南| 2020国产成人综合网| 国产成人午夜精品5599| 中文字幕一区二区三区视频| 91热门视频在线观看| 亚洲午夜av在线| 日韩一区国产二区欧美三区| 国产美女主播视频一区| 中文字幕欧美一| 欧美日韩一区高清| 国模娜娜一区二区三区| 国产精品蜜臀在线观看| 欧美午夜理伦三级在线观看| 男女男精品网站| 久久精品欧美一区二区三区不卡 | 亚洲另类春色国产| 欧美精品日韩一本| 国产裸体歌舞团一区二区| 国产精品久久久久久久久久免费看| 色综合天天综合在线视频| 午夜不卡av在线| 国产亚洲欧美一区在线观看| 色综合天天视频在线观看 | 精品理论电影在线| 成人99免费视频| 婷婷激情综合网| 日本一区二区不卡视频| 欧美日韩中文字幕一区二区| 激情小说欧美图片| 亚洲三级在线观看| 欧美成人精品高清在线播放| 91老司机福利 在线| 美国十次综合导航| 亚洲欧美经典视频| 久久夜色精品一区| 欧美日韩mp4| 99精品视频一区| 久久草av在线| 一区二区三区波多野结衣在线观看| 26uuu另类欧美| 欧美日韩在线精品一区二区三区激情 | 欧美色倩网站大全免费| 国产成人免费视频网站| 日韩中文字幕一区二区三区| 日本一区二区高清| 欧美va在线播放| 欧美在线不卡一区| 成人永久免费视频| 日韩av网站免费在线| 国产日韩欧美高清在线| 91在线免费看| 成人午夜私人影院| 日韩va欧美va亚洲va久久| 中文字幕高清一区| 欧美变态tickling挠脚心| 91蝌蚪porny九色| 国内精品国产三级国产a久久| 夜夜爽夜夜爽精品视频| 欧美国产精品专区| 91麻豆精品国产91久久久更新时间| 国产69精品久久久久777| 视频一区欧美日韩| 艳妇臀荡乳欲伦亚洲一区| 久久久久久久久久久电影| 欧美另类一区二区三区| 99麻豆久久久国产精品免费| 麻豆国产精品一区二区三区 | 亚洲亚洲精品在线观看| 久久色.com| 制服丝袜亚洲网站| 色婷婷亚洲婷婷| 国产成人精品一区二区三区四区| 亚洲成人精品一区二区| 亚洲欧美色图小说| 久久―日本道色综合久久| 欧美一区二区三区视频在线 | 成人美女在线观看| 黄色小说综合网站| 奇米色777欧美一区二区| 亚洲在线视频网站| 国产精品久久久一本精品| 精品国产电影一区二区| 欧美精三区欧美精三区| 欧美性大战久久| 色诱亚洲精品久久久久久| 成人黄色a**站在线观看| 国产一区二区主播在线| 日本怡春院一区二区| 日本亚洲欧美天堂免费| 亚洲成av人影院在线观看网| 亚洲免费视频中文字幕| 国产精品美女视频| 亚洲欧洲国产日韩| 国产精品国产自产拍高清av| 久久久久久久久99精品| 欧美二区在线观看| 欧美一区二区二区| 欧美精品久久99| 欧美日韩在线三区| 日韩免费在线观看| 日韩精品资源二区在线| 欧美精品高清视频| 欧美日韩亚州综合| 777午夜精品视频在线播放| 欧美日韩国产高清一区| 欧美伦理电影网| 欧美日韩一区二区三区视频| 欧美少妇bbb| 欧美二区三区的天堂|