⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ctrlrequest.h

📁 增强型51单片机fs7821cf卡读写程序
💻 H
字号:
/*
**********************************************************************************************
* Project:	TK7821
* File:		CtrlRequest.h
* Contents: 
*           
*
* $Date: 02/25/05    Jason    v0.1
*        04/21/05    Mingo    v0.2   www.fameg.com
*
* Copyright (c) 2005 Fameg, Inc. All rights reserved
***********************************************************************************************
*/

#ifndef CtrlRequestH
#define CtrlRequestH

#include "Descriptor.h"
#ifdef DFU_ENABLE
  #include "Dfu.h" 
#endif

#define USB11_MAX_PKT_SIZE ((UINT16)64)
#define USB11_REVISION     ((UINT16)0x0110)
#define USB20_MAX_PKT_SIZE ((UINT16)512)
#define USB20_REVISION     ((UINT16)0x0200)
#define CTRL_PKT_SIZE          64
#define USB_BUFFER_SIZE        64

// Standard Request Codes
#define GET_STATUS             0
#define CLEAR_FEATURE          1
#define SET_FEATURE            3
#define SET_ADDRESS            5
#define GET_DESCRIPTOR         6
#define SET_DESCRIPTOR         7
#define GET_CONFIGURATION      8
#define SET_CONFIGURATION      9
#define GET_INTERFACE         10
#define SET_INTERFACE         11
#define SYNCH_FRAME           12
 // Hub Class.
#define HUB_GET_STATUS         0
#define HUB_CLEAR_FEATURE      1
#define HUB_GET_STATE          2
#define HUB_SET_FEATURE        3
#define HUB_GET_DESCRIPTOR     6
#define HUB_SET_DESCRIPTOR     7
#define HUB_CLEAR_TT_BUFFER    8
#define HUB_RESET_TT           9
#define HUB_GET_TT_STATE      10
#define HUB_STOP_TT           11
 // Vendor Specific 
#define GET_REGISTER         240
#define SET_REGISTER         241
#define READ_SROM            242
#define WRITE_SROM           243
 // Bulk Only Mass Storage Class
#define BULKONLY_GET_MAX_LUN 254
#define BULKONLY_RESET       255

// Feature Selectors
#define ENDPOINT_HALT         0 
#define DEVICE_REMOTE_WAKEUP  1
#define TEST_MODE             2
  #define TEST_J                1
  #define TEST_K                2
  #define TEST_SE0_NAK          3
  #define TEST_PACKET           4
  #define TEST_FORCE_ENABLE     5
  #define NO_TEST_PARAM         0xff
 // Hub Class.
#define C_HUB_LOCAL_POWER     0
#define C_HUB_OVER_CURRENT    1
#define PORT_CONNECTION       0
#define PORT_ENABLE           1
#define PORT_SUSPEND          2
#define PORT_OVER_CURRENT     3
#define PORT_RESET            4
#define PORT_POWER            8
#define PORT_LOW_SPEED        9
#define C_PORT_CONNECTION    16
#define C_PORT_ENABLE        17
#define C_PORT_SUSPEND       18
#define C_PORT_OVER_CURRENT  19 
#define C_PORT_RESET         20
#define PORT_TEST            21 
#define PORT_INDICATOR       22  
 

// Endpoint Number
#define EP1IN_NUMBER        0x81
#define EP2OUT_NUMBER       0x02 
#define EP3IN_NUMBER        0x83
#define EP4IN_NUMBER        0x84
#define EP5OUT_NUMBER       0x05 

// SOTA Request Token
#define SETUP_TOKEN         0
#define OUT_TOKEN           1 
#define IN_TOKEN            2
#define IN_OK_TOKEN         3
#define BAD_SETUP_TOKEN     4
#define UNKNOWN_TOKEN       5

//----------------------------------------------------------------------------
//  USB Request Structure.
//----------------------------------------------------------------------------
#define USB_REQUEST_LEN 8 
typedef struct
{
  BYTE   bmRequestType;
  BYTE   bRequest;
  UINT16 wValue;
  UINT16 wIndex;
  UINT16 wLength;
}USB_REQUEST, *PUSB_REQUEST;

//----------------------------------------------------------------------------
//  SOTA USB Request Structure
//----------------------------------------------------------------------------
typedef struct
{
  bool   InProgress; 
  BYTE   Token;
  bool   LoadInDataOk;
  bool   HaltStatus;         // Ctrl pipe halt status
  USB_REQUEST Request;
  UINT16 FinishedDataLen;    // Under one request transimited/received data length. 
}SOTA_USB_REQUEST, *PSOTA_USB_REQUEST;   

extern xdata BYTE UsbBuf[USB_BUFFER_SIZE];
extern xdata PSOTA_USB_REQUEST pSotaUsbRequest;
extern xdata BYTE CtrlPktSize;

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -