Teledyne LeCroy Voyager Exerciser Generation Script Language Manual User Manual
Page 73

Teledyne LeCroy
Voyager USB 3.0 Exerciser Generation Script Language Reference Manual
64
{
Data = ...
}
}
AddDescriptor has the following instruction parameters:
type: Descriptor Type as defined by the USB specification. Default value is 0.
index: Descriptor Index as defined by the USB specification. Default value is 0.
request type: Request type as defined by the USB specification for the request used to
retrieve the descriptor. Default value is 0, for Standard type.
recipient: Request recipient as defined by the USB specification for the request used to
retrieve the descriptor. Default value is 0, for Device.
language id: Language ID as defined by the USB specification, for String descriptors only.
Default value is 0.
bRequest: bRequest value as defined by the USB specification for the request used to
retrieve the descriptor. Default value is 6, for standard GET_DESCRIPTOR request.
device index: Specifies the zero-based index of the device for which to add descriptor.
Default value is 0. Note: Current version supports only one emulated device.
The instruction accepts the data for the descriptor itself as a Packet structure variable with an
array of data. The structure has to be declared in the script, as shown in the example below.
Examples of calling the AddDescriptor instruction
# Device emulation
# Include file with descriptor structures and constant definitions
%include "Generation\Include\DeviceRequestConstants.ginc"
# Define data structure to be used with AddDescriptor.
Packet DescriptorData
{
Data : *
}
Main
{
# Start the handler task at the beginning of the script.
StartDeviceFrameworkHandler
()
# Initialize device to default state and clear all descriptors.
InitDevice
()
# Add required descriptors.
$DeviceDescriptorPayLoad = DeviceDescriptor
$DeviceDescriptorPayLoad
{
Length = 0x12
DescriptorType = DEVICE_DESC
bcdUSB = 0x0300
DeviceClass = 0x00
DeviceSubClass = 0x00