Source code files – Motorola USB08 User Manual

Page 94

Advertising
background image

Designer Reference Manual

USB08 Evaluation Board

94

Source Code Files

MOTOROLA

Source Code Files

//----------------------------------------------------------------------------

// Standard Interface Descriptor

// according to USB1.1 spec page 202

//

typedef struct {

uchar bLength;

// Size of this Descriptor in Bytes

uchar bDescriptorType;

// Descriptor Type (=4)

uchar bInterfaceNumber;

// Number of *this* Interface (0..)

uchar bAlternateSetting;

// Alternative for this Interface (if any)

uchar bNumEndpoints;

// No of EPs used by this IF (excl. EP0)

uchar bInterfaceClass;

// Interface Class Code

uchar bInterfaceSubClass;

// Interface Subclass Code

uchar bInterfaceProtocol;

// Interface Protocol Code

uchar iInterface;

// Index of String Desc for this Interface

} interface_descriptor;

//----------------------------------------------------------------------------

// Standard Endpoint Descriptor

// according to USB1.1 spec page 203

//

typedef struct {

uchar bLength;

// Size of this Descriptor in Bytes

uchar bDescriptorType;

// Descriptor Type (=5)

uchar bEndpointAddress;

// Endpoint Address (Number + Direction)

uchar bmAttributes;

// Endpoint Attributes (Transfer Type)

iword wMaxPacketSize;

// Max. Endpoint Packet Size

uchar bInterval;

// Polling Interval (Interrupt) in ms

} endpoint_descriptor;

//----------------------------------------------------------------------------

// Structure of Setup Packet sent during

// SETUP Stage of Standard Device Requests

// according to USB1.1 spec page 183

//

typedef struct {

uchar bmRequestType;

// Characteristics (Direction,Type,Recipient)

uchar bRequest;

// Standard Request Code

iword wValue;

// Value Field

iword wIndex;

// Index or Offset Field

iword wLength;

// Number of Bytes to transfer (Data Stage)

} setup_buffer;

//----------------------------------------------------------------------------

// USB Status Codes

//

#define US_ATTACHED

0x00

// (not used here)

#define US_POWERED

0x01

#define US_DEFAULT

0x02

#define US_ADDRESSED

0x03

#define US_CONFIGURED

0x04

#define US_SUSPENDED

0x80

Advertising