Quelltext /~heha/basteln/PC/fx2/fx2ata-200917.zip/dscr.c

#include "fx2.h"
#include "atapi.h"

#define W(x) LSB(x),MSB(x)

code BYTE DeviceDscr[]={
  18,		// Descriptor length
  1,		// Decriptor type
  W(0x0200),	// Specification Version (BCD)
  0,		// Device class
  0,		// Device sub-class
  0,		// Device protocol
  64,		// Maximum packet size
  W(0x04B4),	// Vendor ID - Cypress
  W(0x6830),	// Product ID - set to chip id = CY68300
  W(8),		// Product version (BCD)
  1,		// Manufacturer string index
  2,		// Product string index
  3,		// Serial number string index
  1,		// Number of configurations
};

code BYTE DeviceQualDscr[]={
  10,		// Descriptor length
  6,		// Decriptor type
  W(0x0200),	// Specification Version (BCD)
  0,		// Device class
  0,		// Device sub-class
  0,		// Device protocol
  64,		// Maximum packet size
  1,		// Number of configurations
  0,		// Reserved
};

#if HID_SUPPORT
code BYTE HIDReportDscr[]={
  0x06,0xA0,0xFF,// Usage Page (vendor defined) FFA0
  0x09, 0xA5,	// Usage (vendor defined)
  0xA1, 0x01,	// Collection (Application)
  0x09, 0xA6,	//  Usage (vendor defined)
//The input report
  0x09, 0xA7,	//  usage - vendor defined
  0x15, 0x80,	//  Logical Minimum (-128)
  0x25, 0x7F,	//  Logical Maximum (127)
  0x75, 0x08,	//  Report Size (8)  (bits)
  0x95, 0x02,	//  Report Count (2)  (fields)
  0x81, 0x02,	//  Input (Data, Variable, Absolute)  
//The output report
  0x09, 0xA9,	//  usage - vendor defined
  0x15, 0x80,	//  Logical Minimum (-128)
  0x25, 0x7F,	//  Logical Maximum (127)
  0x75, 0x08,	//  Report Size (8)  (bits)
  0x95, 0x02,	//  Report Count (2)  (fields)
  0x91, 0x02,	//  Output (Data, Variable, Absolute)  
  0xC0,		// End Collection
};
#endif

#define DLEN (9+9+7+7 + CSM_SUPPORT*(9+4+9+6) + HID_SUPPORT*(9+9) +7)

code BYTE FullSpeedConfigDscr[]={
  9,		// Descriptor length
  2,		// Descriptor type, **patched!**
  W(DLEN),	// Total Length
  1+HID_SUPPORT+CSM_SUPPORT,      // Number of interfaces
  1,		// Configuration number
  0,		// Configuration string
  0xC0,		// Attributes (b7=1, b6 - selfpwr, b5 - rwu), **patched!**
  0,		// Power requirement * 2 mA, **patched!**
// Interface Descriptor
  9,		// Descriptor length
  4,		// Descriptor type
  0,		// Zero-based index of this interface
  0,		// Alternate setting
  3-HID_SUPPORT,// Number of end points 
  8,		// Interface class, **patched!**
  6,		// Interface sub class
  0x50,		// Interface protocol
  4,		// Interface descriptor string index
// Endpoint Descriptor
  7,		// Descriptor length
  5,		// Descriptor type
  2,		// Endpoint number and direction: EP2OUT
  2,		// Endpoint type: Bulk
  W(64),	// Maximun packet size, **patched!**
  0,		// Polling interval
// Endpoint Descriptor
  7,		// Descriptor length
  5,		// Descriptor type
  0x86,		// Endpoint number and direction: EP6IN
  2,		// Endpoint type: Bulk
  W(64),	// Maximun packet size, **patched!**
  0,		// Polling interval
#if CSM_SUPPORT
// Interface Descriptor
  9,		// Descriptor length
  4,		// Descriptor type
  1,		// Zero-based index of this interface
  0,		// Alternate setting
  0,		// Number of endpoints 
  13,		// Interface class
  0,		// Interface sub class
  0,		// Interface protocol
  0,		// Interface descriptor string index
//CSMGeneralDscr:
  4,		// Length
  0x21,		// Type
  W(0x0100),	// version
//CSMChannelDscr:	// Channel Descriptor for CSM
  9,
  0x22,
  0,		// Number of the channel
  1,		// Recipient type = Interface
  0,		// Interface number that we're providing Content Security for
  0,		// Alt setting that we're providing Content Security for
  0,		// LUN that we're providing Content Security for
  1,		// CSM descriptor index:  Index of a class-specific CSM descriptor that describes one of the Content Security Methods offered by the device, must be a one-based value that is unique across the device. The value of 0 (zero) is reserved and must not be used in this field. See Table A-5.
  0,		// Zero-based value that points to a CSM Variant descriptor. If there is no CSM Variant descriptor than it has the value of zero.
//CSMCSMDscr:
  6,
  0x23,
  1,		// CSM Method ID
  0,		// CSM string index
  W(0x0100),	// BCD version number
//CSMCSMVDscr:
//  2,
//  0x24,
//CSMCSMVDscrEnd:
#endif

#if HID_SUPPORT
//HIDIntrfcDscr:
  9,		// Descriptor length
  4,		// Descriptor type
  2,		// Zero-based index of this interface
  0,		// Alternate setting
  1,		// Number of endpoints 
  3,		// Interface class (HID)
  0,		// Interface sub class
  0,		// Interface protocol
  0,		// Interface descriptor string index
//HIDDscr:
  9,
  0x21,		// type: HID
  W(0x0110),	// release: HID class rev 1.1
  0,		// country code (none)
  1,		// number of HID class descriptors to follow
  0x22,		// report descriptor type (HID)
  W(sizeof HIDReportDscr), //; length of HID descriptor
#endif
//interruptEPDscr:
  7,		// Descriptor length
  5,		// Descriptor type
  0x81,		// Endpoint number and direction: EP1IN
  3,		// Endpoint type: Interrupt
  W(4),		// Maximun packet size
  10,		// Polling interval
};

#define ct_assert(e) ((void)sizeof(char[1 - 2*!(e)]))

//ct_assert(sizeof FullSpeedConfigDscr == DLEN)

//      .db   0       // NULL needed here to tell the dscr parser to stop.
code BYTE StringDscr0[]={
//StringDscr0:
  4,3,		// String descriptor length
  W(0x0409),	// english-US
};
//StringDscr0End:

code BYTE StringDscr1[]={
  16,3,		// String descriptor length
  'C',0,'y',0,'p',0,'r',0,'e',0,'s',0,'s',0,
};
//StringDscr1End:

code BYTE StringDscr2[]={
  26,3,		// String descriptor length
  '0',0,'0',0,'0',0,'0',0,'0',0,'0',0,'0',0,'0',0,'0',0,'0',0,'0',0,'0',0,
};
//StringDscr2End:

code BYTE StringDscr3[]={
  42,3,		// String descriptor length
  'C',0,'y',0,'p',0,'r',0,'e',0,'s',0,'s',0,' ',0,
  'C',0,'Y',0,'4',0,'6',0,'1',0,'1',0,'B',0,' ',0,'R',0,'C',0,'1',0,'3',0,
};
Vorgefundene Kodierung: ASCII (7 bit)2