Home » Source Code » » usb100.h

usb100.h ( File view )

From:
  • By 2010-08-29
  • View(s):8
  • Download(s):0
  • Point(s): 1
			#ifndef   __USB100_H__
#define   __USB100_H__


#include <PSHPACK1.H>


//bmRequest.Dir
#define BMREQUEST_HOST_TO_DEVICE        0
#define BMREQUEST_DEVICE_TO_HOST        1

//bmRequest.Type
#define BMREQUEST_STANDARD              0
#define BMREQUEST_CLASS                 1
#define BMREQUEST_VENDOR                2

//bmRequest.Recipient
#define BMREQUEST_TO_DEVICE             0
#define BMREQUEST_TO_INTERFACE          1
#define BMREQUEST_TO_ENDPOINT           2
#define BMREQUEST_TO_OTHER              3


#define MAXIMUM_USB_STRING_LENGTH 255

// values for the bits returned by the USB GET_STATUS command
#define USB_GETSTATUS_SELF_POWERED                0x01
#define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED       0x02


#define USB_DEVICE_DESCRIPTOR_TYPE                0x01
#define USB_CONFIGURATION_DESCRIPTOR_TYPE         0x02
#define USB_STRING_DESCRIPTOR_TYPE                0x03
#define USB_INTERFACE_DESCRIPTOR_TYPE             0x04
#define USB_ENDPOINT_DESCRIPTOR_TYPE              0x05

// descriptor types defined by DWG documents
#define USB_RESERVED_DESCRIPTOR_TYPE              0x06
#define USB_CONFIG_POWER_DESCRIPTOR_TYPE          0x07
#define USB_INTERFACE_POWER_DESCRIPTOR_TYPE       0x08

#define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i) ((USHORT)((USHORT)d<<8 | i))

//
// Values for bmAttributes field of an
// endpoint descriptor
//

#define USB_ENDPOINT_TYPE_MASK                    0x03

#define USB_ENDPOINT_TYPE_CONTROL                 0x00
#define USB_ENDPOINT_TYPE_ISOCHRONOUS             0x01
#define USB_ENDPOINT_TYPE_BULK                    0x02
#define USB_ENDPOINT_TYPE_INTERRUPT               0x03


//
// definitions for bits in the bmAttributes field of a 
// configuration descriptor.
//
#define USB_CONFIG_POWERED_MASK                   0xc0

#define USB_CONFIG_BUS_POWERED                    0x80
#define USB_CONFIG_SELF_POWERED                   0x40
#define USB_CONFIG_REMOTE_WAKEUP                  0x20

//
// Endpoint direction bit, stored in address
//

#define USB_ENDPOINT_DIRECTION_MASK               0x80

// test direction bit in the bEndpointAddress field of
// an endpoint descriptor.
#define USB_ENDPOINT_DIRECTION_OUT(addr)          (!((addr) & USB_ENDPOINT_DIRECTION_MASK))
#define USB_ENDPOINT_DIRECTION_IN(addr)           ((addr) & USB_ENDPOINT_DIRECTION_MASK)

//
// USB defined request codes
// see chapter 9 of the USB 1.0 specifcation for
// more information.
//

// These are the correct values based on the USB 1.0
// specification

#define USB_REQUEST_GET_STATUS                    0x00
#define USB_REQUEST_CLEAR_FEATURE                 0x01

#define USB_REQUEST_SET_FEATURE                   0x03

#define USB_REQUEST_SET_ADDRESS                   0x05
#define USB_REQUEST_GET_DESCRIPTOR                0x06
#define USB_REQUEST_SET_DESCRIPTOR                0x07
#define USB_REQUEST_GET_CONFIGURATION             0x08
#define USB_REQUEST_SET_CONFIGURATION             0x09
#define USB_REQUEST_GET_INTERFACE                 0x0A
#define USB_REQUEST_SET_INTERFACE                 0x0B
#define USB_REQUEST_SYNC_FRAME                    0x0C


//
// defined USB device classes
//


#define USB_DEVICE_CLASS_RESERVED           0x00
#define USB_DEVICE_CLASS_AUDIO              0x01
#define USB_DEVICE_CLASS_COMMUNICATIONS     0x02
#define USB_DEVICE_CLASS_HUMAN_INTERFACE    0x03
#define USB_DEVICE_CLASS_MONITOR            0x04
#define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
#define USB_DEVICE_CLASS_POWER              0x06
#define USB_DEVICE_CLASS_PRINTER            0x07
#define USB_DEVICE_CLASS_STORAGE            0x08
#define USB_DEVICE_CLASS_HUB                0x09
#define USB_DEVICE_CLASS_VENDOR_SPECIFIC    0xFF

//
// USB Core defined Feature selectors
//

#define USB_FEATURE_ENDPOINT_STALL          0x0000
#define USB_FEATURE_REMOTE_WAKEUP           0x0001

//
// USB DWG defined Feature selectors
//

#define USB_FEATURE_INTERFACE_POWER_D0      0x0002
#define USB_FEATURE_INTERFACE_POWER_D1      0x0003
#define USB_FEATURE_INTERFACE_POWER_D2      0x0004
#define USB_FEATURE_INTERFACE_POWER_D3      0x0005

typedef struct _USB_DEVICE_DESCRIPTOR {

    UCHAR bLength;
    UCHAR bDescriptorType;
    USHORT bcdUSB;
    UCHAR bDeviceClass;
    UCHAR bDeviceSubClass;
    UCHAR bDeviceProtocol;
    UCHAR bMaxPacketSize0;
    USHORT idVendor;
    USHORT idProduct;
    USHORT bcdDevice;
    UCHAR iManufacturer;
    UCHAR iProduct;
    UCHAR iSerialNumber;
    UCHAR bNumConfigurations;

} USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;

typedef struct _USB_ENDPOINT_DESCRIPTOR {

    UCHAR bLength;
    UCHAR bDescriptorType;
    UCHAR bEndpointAddress;
    UCHAR bmAttributes;
    USHORT wMaxPacketSize;
    UCHAR bInterval;

} USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR;

typedef struct _USB_CONFIGURATION_DESCRIPTOR {

    UCHAR bLength;
    UCHAR bDescriptorType;
    USHORT wTotalLength;
    UCHAR bNumInterfaces;
    UCHAR bConfigurationValue;
    UCHAR iConfiguration;
    UCHAR bmAttributes;
    UCHAR MaxPower;

} USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;

typedef struct _USB_INTERFACE_DESCRIPTOR {

    UCHAR bLength;
    UCHAR bDescriptorType;
    UCHAR bInterfaceNumber;
    UCHAR bAlternateSetting;
    UCHAR bNumEndpoints;
    UCHAR bInterfaceClass;
    UCHAR bInterfaceSubClass;
    UCHAR bInterfaceProtocol;
    UCHAR iInterface;

} USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR;

typedef struct _USB_STRING_DESCRIPTOR {

    UCHAR bLength;
    UCHAR bDescriptorType;
    WCHAR bString[1];

} USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR;

typedef struct _USB_COMMON_DESCRIPTOR {

    UCHAR bLength;
    UCHAR bDescriptorType;

} USB_COMMON_DESCRIPTOR, *PUSB_COMMON_DESCRIPTOR;


//
// Standard USB HUB definitions 
//
// See Chapter 11 USB core specification
//

typedef struct _USB_HUB_DESCRIPTOR {

    UCHAR        bDescriptorLength;      // Length of this descriptor
    UCHAR        bDescriptorType;        // Hub configuration type
    UCHAR        bNumberOfPorts;         // number of ports on this hub
    USHORT       wHubCharacteristics;    // Hub Charateristics
    UCHAR        bPowerOnToPowerGood;    // port power on till power good in 2ms
    UCHAR        bHubControlCurrent;     // max current in mA
    //
    // room for 255 ports power control and removable bitmask
    UCHAR        bRemoveAndPowerMask[64];       

} USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;


//
// Structures defined by various DWG feature documents
//


//
// See DWG USB Feature Specification: Interface Power Management
//

#define USB_SUPPORT_D0_COMMAND      0x01
#define USB_SUPPORT_D1_COMMAND      0x02
#define USB_SUPPORT_D2_COMMAND      0x04
#define USB_SUPPORT_D3_COMMAND      0x08

#define USB_SUPPORT_D1_WAKEUP       0x10
#define USB_SUPPORT_D2_WAKEUP       0x20


typedef struct _USB_CONFIGURATION_POWER_DESCRIPTOR {

    UCHAR bLength;
    UCHAR bDescriptorType;
    UCHAR SelfPowerConsumedD0[3];
    UCHAR bPowerSummaryId;
    UCHAR bBusPowerSavingD1;
    UCHAR bSelfPowerSavingD1;
    UCHAR bBusPowerSavingD2;
    UCHAR bSelfPowerSavingD2; 
    UCHAR bBusPowerSavingD3;
    UCHAR bSelfPowerSavingD3; 
    USHORT TransitionTimeFromD1;
    USHORT TransitionTimeFromD2;
    USHORT TransitionTimeFromD3;

} USB_CONFIGURATION_POWER_DESCRIPTOR, *PUSB_CONFIGURATION_POWER_DESCRIPTOR;


typedef struct _USB_INTERFACE_POWER_DESCRIPTOR {

    UCHAR bLength;
    UCHAR bDescriptorType;
    UCHAR bmCapabilitiesFlags;
    UCHAR bBusPowerSavingD1;
    UCHAR bSelfPowerSavingD1;
    UCHAR bBusPowerSavingD2;
    UCHAR bSelfPowerSavingD2; 
    UCHAR bBusPowerSavingD3;
    UCHAR bSelfPowerSavingD3; 
    USHORT TransitionTimeFromD1;
    USHORT TransitionTimeFromD2;
    USHORT TransitionTimeFromD3;

} USB_INTERFACE_POWER_DESCRIPTOR, *PUSB_INTERFACE_POWER_DESCRIPTOR;


#include <POPPACK.H>


#endif   /* __USB100_H__ */

			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
源码文件 <USB_Interrupt><USB_Interrupt>0.00 B21-05-07 20:33
源码文件 <Driver_Source><Driver_Source>0.00 B21-05-07 20:33
code file intdev.cintdev.c35.10 kB13-02-07 15:32
code file intdev.hintdev.h1.90 kB13-02-07 15:32
code file intpnp.cintpnp.c73.07 kB13-02-07 15:32
code file intpnp.hintpnp.h3.18 kB13-02-07 15:32
code file intpwr.cintpwr.c39.15 kB13-02-07 15:32
code file intpwr.hintpwr.h2.95 kB13-02-07 15:32
code file intrwr.cintrwr.c27.17 kB13-02-07 15:32
code file intrwr.hintrwr.h1.84 kB13-02-07 15:32
源码文件 intusb.bmfintusb.bmf698.00 B13-02-07 15:32
code file intusb.cintusb.c12.75 kB13-02-07 15:32
code file intusb.hintusb.h6.98 kB13-02-07 15:32
源码文件 intusb.mofintusb.mof572.00 B13-02-07 15:32
code file intusb.rcintusb.rc2.88 kB13-02-07 15:32
code file intusr.hintusr.h1.61 kB13-02-07 15:32
code file intwdm98.cintwdm98.c2.74 kB13-02-07 15:32
code file intwdm98.hintwdm98.h843.00 B13-02-07 15:32
code file intwmi.cintwmi.c15.72 kB13-02-07 15:32
code file intwmi.hintwmi.h1.61 kB13-02-07 15:32
code file makefilemakefile269.00 B13-02-07 15:32
code file makefile.incmakefile.inc128.00 B13-02-07 15:32
code file ReadMe.txtReadMe.txt3.25 kB13-02-07 15:32
code file resource.hresource.h453.00 B13-02-07 15:32
源码文件 sourcessources602.00 B13-02-07 15:32
源码文件 <Firmware><Firmware>0.00 B01-08-07 13:15
code file cyglink.txtcyglink.txt477.00 B01-08-07 13:15
源码文件 F34x_USB0_Interrupt.wspF34x_USB0_Interrupt.wsp35.28 kB13-02-07 15:32
源码文件 F34X_USB_DESCRIPTORF34X_USB_DESCRIPTOR16.46 kB01-08-07 13:15
源码文件 F34x_USB_Descriptor.#1F34x_USB_Descriptor.#112.43 kB01-08-07 13:13
源码文件 F34x_USB_Descriptor.#2F34x_USB_Descriptor.#212.43 kB23-05-07 09:07
code file F34x_USB_Descriptor.cF34x_USB_Descriptor.c4.59 kB13-02-07 15:32
code file F34x_USB_Descriptor.hF34x_USB_Descriptor.h5.95 kB13-02-07 15:32
源码文件 F34x_USB_Descriptor.LSTF34x_USB_Descriptor.LST8.20 kB01-08-07 13:13
源码文件 F34X_USB_DESCRIPTOR.M51F34X_USB_DESCRIPTOR.M5154.31 kB01-08-07 13:15
源码文件 F34x_USB_Descriptor.OBJF34x_USB_Descriptor.OBJ1.85 kB01-08-07 13:13
code file F34x_USB_ISR.cF34x_USB_ISR.c18.84 kB13-02-07 15:32
源码文件 F34x_USB_ISR.LSTF34x_USB_ISR.LST27.60 kB01-08-07 13:13
源码文件 F34x_USB_ISR.OBJF34x_USB_ISR.OBJ6.83 kB01-08-07 13:13
code file F34x_USB_Main.cF34x_USB_Main.c13.64 kB13-02-07 15:32
code file F34x_USB_Main.hF34x_USB_Main.h8.38 kB13-02-07 15:32
源码文件 F34x_USB_Main.LSTF34x_USB_Main.LST19.78 kB01-08-07 13:13
源码文件 F34x_USB_Main.OBJF34x_USB_Main.OBJ3.90 kB01-08-07 13:13
code file F34x_USB_Register.hF34x_USB_Register.h5.17 kB13-02-07 15:32
code file F34x_USB_Standard_Requests.cF34x_USB_Standard_Requests.c21.45 kB13-02-07 15:32
源码文件 F34x_USB_Standard_Requests.LSTF34x_USB_Standard_Requests.LST31.58 kB01-08-07 13:13
源码文件 F34x_USB_Standard_Requests.OBJF34x_USB_Standard_Requests.OBJ6.92 kB01-08-07 13:13
源码文件 <Interrupt><Interrupt>0.00 B39896 28194
code file ReadMe.txtReadMe.txt2.43 kB13-02-07 15:32
源码文件 tmp.outtmp.out684.00 B01-08-07 13:15
源码文件 <Host><Host>0.00 B0 0%
code file 3DMeterCtrl.cpp3DMeterCtrl.cpp14.69 kB13-02-07 15:32
code file 3DMeterCtrl.h3DMeterCtrl.h2.40 kB13-02-07 15:32
code file DynamicLED.cppDynamicLED.cpp11.51 kB13-02-07 15:32
code file DynamicLED.hDynamicLED.h2.25 kB13-02-07 15:32
code file DynLED.hDynLED.h1.15 kB13-02-07 15:32
code file MemDC.hMemDC.h3.21 kB13-02-07 15:32
code file ReadMe.txtReadMe.txt1.85 kB13-02-07 15:32
源码文件 <res><res>0.00 B23-05-07 08:57
源码文件 bitmap1.bmpbitmap1.bmp13.03 kB13-02-07 15:32
源码文件 blackchip.icoblackchip.ico3.19 kB13-02-07 15:32
源码文件 SilabsLogo.icoSilabsLogo.ico3.19 kB13-02-07 15:32
源码文件 Thumbs.dbThumbs.db4.50 kB23-05-07 08:58
源码文件 USBTest.rc2USBTest.rc2398.00 B13-02-07 15:32
code file resource.hresource.h1.43 kB13-02-07 15:32
code file StdAfx.cppStdAfx.cpp209.00 B13-02-07 15:32
code file StdAfx.hStdAfx.h1.03 kB13-02-07 15:32
code file usb100.husb100.h7.90 kB13-02-07 15:32
code file UsbIF.cppUsbIF.cpp3.35 kB13-02-07 15:32
code file UsbIF.hUsbIF.h1.04 kB13-02-07 15:32
code file USBTest.cppUSBTest.cpp1.93 kB13-02-07 15:32
源码文件 USBTest.dspUSBTest.dsp4.75 kB13-02-07 15:32
code file USBTest.hUSBTest.h1.30 kB13-02-07 15:32
code file USBTest.rcUSBTest.rc7.33 kB13-02-07 15:32
源码文件 USBTest.slnUSBTest.sln903.00 B13-02-07 15:32
源码文件 USBTest.vcprojUSBTest.vcproj8.07 kB13-02-07 15:32
code file USBTestDlg.cppUSBTestDlg.cpp10.35 kB13-02-07 15:32
code file USBTestDlg.hUSBTestDlg.h1.93 kB13-02-07 15:32
code file ReadMe.txtReadMe.txt3.29 kB13-02-07 15:32
源码文件 SiInt.sysSiInt.sys38.25 kB13-02-07 15:32
源码文件 SilabsInt.infSilabsInt.inf2.05 kB13-02-07 15:32
源码文件 USBTest.exeUSBTest.exe220.00 kB13-02-07 15:32
...
Sponsored links
×

usb100.h (311.42 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

×

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com
×

切换到中文版?

CodeForge Chinese Version
CodeForge English Version
×

Where are you going?

×

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK
×

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D