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

📄 define.h

📁 ST72T63游戏杆源程序
💻 H
字号:
/**************** (c) 1998          STMicroelectronics **********************

PROJECT : USB - ST7
COMPILER : ST7 HICROSS C (HIWARE)

MODULE  :  define.h
VERSION :  V 1.0

CREATION DATE :  25/05/98

AUTHOR : / MICROCONTROLLER DIVISION / ST Rousset

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

DESCRIPTION : 

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

MODIFICATIONS :


******************************************************************************/

#ifndef DEFINE_H
#define DEFINE_H

#define MAXPACKETSIZE                     8              // Maximum packet size for Endpoint zero
#define DEVDESCSIZE                       18             // Device descriptor Length
#define HIDDESCSIZE                       9              // Size of HID descriptor
#define HIDDESCADD                        18             // Index of descriptor  describing HID
#define INTERFACEDESCADD                  9             // Size of Interface descriptor
#define STATUSADD                         2
#define CONFVALADD                        29


/********************************************/
/*                                              Mask bits                                         */
/********************************************/

#define EP                                      0x30      // Read the endpoint number
#define CNT                                     0x0F      // Read received byte number
                                                                                  
#define DATA_STAGE_IN   0x01      // Transfer with IN data phase
#define DATA_STAGE_OUT  0x02      // Transfer with OUT data phase
#define LAST_OUT_TRANS  0x04      // The Status Stage (IN) must be performed
#define LAST_IN_TRANS   0x08      // The Status Stage (OUT) must be performed
#define NO_MORE_DATA            0x10      // No more data to send during Data Stage
#define NO_DATA_STAGE   0x20      // No Data transfer
#define ADDRESS2SET             0x40      // Device address

#define TP                                      0xC0      // Read Token PID
#define TP_OUT                          0x00      // OUT Transaction
#define TP_IN                           0x80      // IN Transaction
#define TP_SETUP                        0xC0      // Control transfer

// Endpoint Register (EPnR)
#define ST_OUT                          0x80      // Status OUT of Endpoint register
#define STAT                            0x30      // Status bit of Endpoint register
#define NOT_VALID                       0x0
#define STALL                           0x10      // STALL mask
#define NAK                                     0x20      // NAK mask
#define VALID                           0x30      // VALID mask

#define VbusON                          0x80

// Interrupt Status Register (ISTR) 
#define Int_Susp                        0x80      // Suspend mode signaling     
#define Int_Ctr                 0x20      // Correct transfer
#define Int_Esusp                       0x04      // End of suspend mode
#define Int_Reset                       0x02      // USB Reset
#define Int_Sof                 0x01      // Start of Frame

// Control Register (CTLR)
#define CtrlFres                        0x01      // Force Reset
#define CtrlSusp                        0x02      // Suspend Mode
#define CtrlPdwn                        0x04      // Power Down
#define CTRL_RESUME             0x08      // Resume
 

// USB bmRequestType Type
#define TYPE                            0x60
#define STANDARD                        0x00
#define CLASS                           0x20
#define VENDOR                          0x40

// USB bmRequestType Recipient
#define RECIPIENT                       0x03 // Used to mask the recipient part D2..D0 in bmRequestType
#define REDEVICE                        0x00                                                                                              
#define REINTERFACE             0x01
#define REENDPOINT              0x02

// USB standard bRequest value
#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 SYNC_FRAME                                12

// USB Feature Selector
#define DEVICE_REMOTE_WAKEUP      1
#define ENDPOINT_HALT                     0

// USB Class bRequest value
#define GET_REPORT                                1
#define GET_IDLE                                          2
#define GET_PROTOCOL                              3
#define SET_REPORT                                9
#define SET_IDLE                                         10
#define SET_PROTOCOL                             11

// USB Descriptor Types
#define DEVICE                                            1
#define CONFIGURATION                     2
#define STRING                                            3
#define INTERFACE                                         4
#define ENDPOINT                                          5

// USB Class Descriptor Types
#define HID                                                       0x21
#define REPORT                                            0x22
#define PHYSDESC                                          0x23

#endif

⌨️ 快捷键说明

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