LeCroy USB Protocol Suite Reference Manual

PROTOCOL SOLUTIONS GROUP
SCOTT BLVD
3385
ANTA CLARA, CA 95054
S
for
LeCroy USB Protocol Suite
Reference Manual
Manual Version 1.2
For USB Protocol Suite version 3.71
December 2009
LeCroy Corporation Verification Script Engine Reference Manual
Document Disclaimer
The information contained in this document has been carefully checked and is believed to be reliable. However, no responsibility can be assumed for inaccuracies that may not have been detected.
LeCroy reserves the right to revise the information presented in this document without notice or penalty.
Trademarks and Servicemarks
LeCroy, CATC, and USB Protocol Suite are trademarks of LeCroy. Microsoft and Windows are registered trademarks of Microsoft Inc.
All other trademarks are property of their respective companies.
Copyright
Copyright © 2009, LeCroy Corporation. All Rights Reserved. This document may be printed and reproduced without additional permission, but all copies should
contain this copyright notice.
Page 2 of 107
LeCroy Corporation Verification Script Engine Reference Manual
Contents
1
INTRODUCTION ..............................................................................................................................................6
2 VERIFICATION SCRIPT STRUCTURE...........................................................................................................7
3 INTERACTION BETWEEN APPLICATION AND VERIFICATION SCRIPT................................................ 10
4 RUNNING VERIFICATION SCRIPTS FROM APPLICATION...................................................................... 12
4.1 RUNNING VERIFICATION SCRIPTS............................................................................................................ 14
4.2 VSE GUI SETTINGS ............................................................................................................................... 16
5 VERIFICATION SCRIPT ENGINE INPUT CONTEXT MEMBERS............................................................... 17
5.1 TRACE EVENT-INDEPENDENT SET OF MEMBERS...................................................................................... 17
5.2 TRACE EVENT-DEPENDENT SET OF MEMBERS......................................................................................... 18
5.2.1 USB Packet-specific Set of Members.............................................................................................. 18
5.2.1.1 USB Bus Condition-specific Set of Members.......................................................................... 19
5.2.1.2 USB2 Packet-specific Set of Members................................................................................... 20
5.2.1.3 USB3 Packet-specific Set of Members................................................................................... 23
5.2.2 Transaction-specific Set of Members ............................................................................................. 28
5.2.3 Split Transaction-specific Set of Members..................................................................................... 30
5.2.4 Transfer-specific Set of Members.................................................................................................... 31
6 VERIFICATION SCRIPT ENGINE OUTPUT CONTEXT MEMBERS........................................................... 32
7 VERIFICATION SCRIPT ENGINE EVENTS................................................................................................. 33
7.1 PACKET LEVEL EVENTS.......................................................................................................................... 34
7.2 TRANSACTION LEVEL EVENTS................................................................................................................. 35
7.3 SPLIT TRANSACTION LEVEL EVENTS....................................................................................................... 35
7.4 TRANSFER LEVEL EVENTS...................................................................................................................... 35
8 SENDING FUNCTIONS................................................................................................................................. 36
8.1 SENDLEVEL()......................................................................................................................................... 36
8.2 SENDLEVELONLY()................................................................................................................................ 37
8.3 DONTSENDLEVEL()................................................................................................................................ 38
8.4 SENDCHANNEL().................................................................................................................................... 39
8.5 SENDCHANNELONLY()........................................................................................................................... 40
8.6 DONTSENDCHANNEL()........................................................................................................................... 41
8.7 SENDALLCHANNELS()............................................................................................................................ 42
8.8 SENDTRACEEVENT().............................................................................................................................. 43
8.9 DONTSENDTRACEEVENT() ..................................................................................................................... 44
8.10 SENDTRACEEVENTONLY() ..................................................................................................................... 45
8.11 SENDALLTRACEEVENTS()...................................................................................................................... 46
8.12 SENDDIRECTION() .................................................................................................................................. 47
8.13 SENDUSB2BUSCONDITIONS()................................................................................................................. 48
8.14 SENDUSB2TOKENPACKETS()................................................................................................................. 49
8.15 SENDUSB2DATAPACKETS ().................................................................................................................. 50
8.16 SENDUSB2HSKPACKETS()..................................................................................................................... 51
8.17 SENDTRANSACTION()............................................................................................................................. 52
8.18 SENDTRANSFER() .................................................................................................................................. 53
8.19 SENDPKTSWITHBADCRC().................................................................................................................... 54
Page 3 of 107
LeCroy Corporation Verification Script Engine Reference Manual
PACKET AND SCRIPT DECODED FIELDS RETRIEVING FUNCTIONS................................................... 55
9
9.1 GETDECODEDPKTFIELD()....................................................................................................................... 55
9.2 GETHEXPKTFIELD()............................................................................................................................... 56
9.3 GETDECODEDSCRIPTFIELD().................................................................................................................. 57
9.4 GETHEXSCRIPTFIELD().......................................................................................................................... 58
10 TIMER FUNCTIONS................................................................................................................................. 59
10.1 VSE TIME OBJECT ................................................................................................................................. 59
10.2 SETTIMER()............................................................................................................................................ 60
10.3 KILLTIMER()........................................................................................................................................... 61
10.4 GETTIMERTIME().................................................................................................................................... 62
11 TIME CONSTRUCTION FUNCTIONS..................................................................................................... 63
11.1 TIME().................................................................................................................................................... 63
12 TIME CALCULATION FUNCTIONS........................................................................................................ 64
12.1 ADDTIME()............................................................................................................................................. 64
12.2 SUBTRACTTIME() ................................................................................................................................... 65
12.3 MULTIMEBYINT().................................................................................................................................... 66
12.4 DIVTIMEBYINT()..................................................................................................................................... 67
13 TIME LOGICAL FUNCTIONS.................................................................................................................. 68
13.1 ISEQUALTIME()...................................................................................................................................... 68
13.2 ISLESSTIME()......................................................................................................................................... 69
13.3 ISGREATERTIME() .................................................................................................................................. 70
13.4 ISTIMEININTERVAL()............................................................................................................................... 71
14 TIME TEXT FUNCTIONS......................................................................................................................... 72
14.1 TIMETOTEXT() ....................................................................................................................................... 72
15 OUTPUT FUNCTIONS............................................................................................................................. 73
15.1 REPORTTEXT()....................................................................................................................................... 73
15.2 ENABLEOUTPUT().................................................................................................................................. 74
15.3 DISABLEOUTPUT() ................................................................................................................................. 75
16 INFORMATION FUNCTIONS.................................................................................................................. 76
16.1 GETTRACENAME() ................................................................................................................................. 76
16.2 GETSCRIPTNAME() ................................................................................................................................ 77
16.3 GETAPPLICATIONFOLDER() .................................................................................................................... 78
16.4 GETCURRENTTIME()............................................................................................................................... 79
17 NAVIGATION FUNCTIONS..................................................................................................................... 80
17.1 GOTOEVENT()........................................................................................................................................ 80
17.2 SETMARKER()........................................................................................................................................ 81
18 FILE FUNCTIONS.................................................................................................................................... 82
18.1 OPENFILE()............................................................................................................................................ 83
18.2 CLOSEFILE().......................................................................................................................................... 84
18.3 WRITESTRING()...................................................................................................................................... 85
18.4 WRITE() ................................................................................................................................................. 86
18.5 SHOWINBROWSER()............................................................................................................................... 87
Page 4 of 107
LeCroy Corporation Verification Script Engine Reference Manual
TRACE FILE EXPORTING FUNCTIONS................................................................................................ 88
19
19.1 CREATETRACEFILE().............................................................................................................................. 89
19.2 CLOSETRACEFILE()................................................................................................................................ 90
19.3 ADDEVENTTOTRACEFILE()..................................................................................................................... 91
19.4 OPENTRACEFILE()................................................................................................................................. 92
20 COM/AUTOMATION COMMUNICATION FUNCTIONS......................................................................... 93
20.1 NOTIFYCLIENT() ..................................................................................................................................... 93
21 USER INPUT FUNCTIONS...................................................................................................................... 94
21.1 MSGBOX() ............................................................................................................................................. 94
21.2 INPUTBOX() ........................................................................................................................................... 96
21.3 GETUSERDLGLIMIT() ............................................................................................................................. 98
21.4 SETUSERDLGLIMIT().............................................................................................................................. 99
22 STRING MANIPULATION/FORMATING FUNCTIONS ........................................................................ 100
22.1 FORMATEX()........................................................................................................................................ 100
23 MISCELLANEOUS FUNCTIONS .......................................................................................................... 102
23.1 SCRIPTFORDISPLAYONLY().................................................................................................................. 102
23.2 SLEEP() ............................................................................................................................................... 103
23.3 CONVERTTOHTML()............................................................................................................................ 104
23.4 PAUSE()............................................................................................................................................... 105
24 THE IMPORTANT VSE SCRIPT FILES ................................................................................................ 106
HOW TO CONTACT LECROY........................................................................................................................... 107
Page 5 of 107
LeCroy Corporation Verification Script Engine Reference Manual
1 Introduction
This document describes the LeCroy USB Protocol Suite™ Verification Script Engine (VSE), which allows users to perform complicated custom analyses of traffic recorded using the LeCroy protocol analyzers.
The VSE allows you to ask the application to send “events” (currently only frame-level events are available) that occur in the recorded trace to a verification script written using LeCroy script language. This script then evaluates the sequence of events (timing, data, or both) in accordance with user-defined conditions and performs post-processing tasks; such as exporting key information to external files (in text or binary format) or sending special Automation™/COM notifications to client applications.
The VSE fully utilizes the high performance and intelligence of LeCroy decoding capabilities, making processing of information easy and fast. VSE can:
Retrieve information about any field in frame headers, contents of frame payloads, serial data, and bus
states.
Make complex timing calculations between different events in pre-recorded traces.
Filter-in or filter-out data with dynamically changing filtering conditions.
Port information to a special output window.
Save data to text or binary files.
Send data to COM clients connected to the application.
Page 6 of 107
LeCroy Corporation Verification Script Engine Reference Manual
2 Verification Script Structure
Writing verification scripts is easy, if you understand how the application interacts with running scripts and if you follow some rules imposed by the verification script syntax.
The main file with the text of the verification script must have extension .vse. It must be located in the subfolder ..\Scripts\VFScripts of the main folder. Some other files must be included in the main script file using the directive %include.
The following schema presents a common structure of a verification script. It is similar to the script template VSTemplate.vs_, which is included with VSE.
# # VS1.vse # # Verification script # # Brief Description: # Verify something. # ############################################################################################ # Module info # ############################################################################################ # Filling of this block is necessary for proper verification script operation... #
set DecoderDesc = “<Your Verification Script description>”; # Optional
# # Include main Verification Script Engine definitions. # %include “VSTools.inc” # Should be set for all verification scripts.
Page 7 of 107
LeCroy Corporation Verification Script Engine Reference Manual
###################################################################################### # Global Variables and Constants #
# Define your verification script-specific global variables and constant in this section. # (Optional)
const MY_GLOBAL_CONSTANT = 10; set g_MyGlobalVariable = 0;
# OnStartScript() # # #
# Main intialization routine for setting up all necessary # # script parameters before running the script. #
# #
OnStartScript() {
###################################################################################### # Specify in the body of this function the initial values for global variables # # and what kinds of trace events should be passed to the script. # # (By default, only Primitive events from all channels # # are passed to the script. # # #
# For details about how to specify the kind of events to pass to the script, #
# please see the topic ‘Sending Functions’. # # # # OPTIONAL. # ######################################################################################
# Uncomment the line below if you want to disable output from # ReportText()-functions. # # DisableOutput();
}
Page 8 of 107
LeCroy Corporation Verification Script Engine Reference Manual
###################################################################################### # ProcessEvent() #
# # #
# Main script function called by the application when the next waited event # # occurs in the evaluated trace. # # # # !!! REQUIRED !!! MUST BE IMPLEMENTED IN THE VERIFICATION SCRIPT #
# #
ProcessEvent() {
# # The function below shows the specified message only once, # no matter how many times ProcessEvent is called. # ShowStartPrompt(“ShowStartPrompt\n”);
# Write the body of this function depending on your needs.
Return Complete();
}
# OnFinishScript() # #
# Main script function called by the application when the script has completed # # running. Specify in this function some resetting procedures for a successive run # # of this script. # # # # OPTIONAL. #
OnFinishScript() {
return 0;
}
# Additional script functions. # # #
# Write your own script-specific functions here. # # #
MyFunction(arg) { if(arg == “Blah”) return 1; return 0; }
Page 9 of 107
LeCroy Corporation Verification Script Engine Reference Manual
3 Interaction between Application and Verification
Script
The following steps describe the interaction between the application and a verification script run over a recorded trace:
1. Before sending any information to the script main processing function ProcessEvent() (which must be present in any verification script),VSE looks for function OnStartScript() and calls it if it is found. In this function, some setup routines can be made, like specifying the channels, specifying the trace events to pass to the script, and setting up initial values of the global script-specific global variables.
2. Then VSE goes through the recorded trace and checks if the current frame in the trace meets specified sending criteria. If it does, VSE calls the script main processing function ProcessEvent(), providing some information about the current event in the script input context variables.
(See the topic “Input context variables” below in this document for a full description of verification script input context variables.)
3. ProcessEvent() is the main verification routine, in which all processing of incoming trace events is done. Basically, when the whole verification program consists of a few stages, this function processes the event sent to the script, verifies that information contained in the event is appropriate for the current stage, and decides if VSE should continue script running. If the whole result is clear on the current stage, it tells VSE to complete execution of the script. The completion of the test before the whole trace has been evaluated is usually done by setting the output context variable: out.Result = _VERIFICATION_PASSED or _VERIFICATION_FAILED. (See the topic “Output context variables” below in this document for a full description of verification script output context variables.)
Note: Not only does a verification script verify recorded traces by some criteria, but it is also possible to extract some information of interest and post-process it later by third-party applications. (There is a set of script functions to save extracted data in text or binary files or send it to other applications via COM/Automation™ interfaces.)
1 When script running is finished, VSE looks for the function OnFinishScript() and calls it if it is found. In
this function, some resetting procedures can be done.
The following picture presents the interaction between the application and a running verification script:
Page 10 of 107
LeCroy Corporation Verification Script Engine Reference Manual
S
F
V
erification Sc ript
A pplicatio n
(Run verification script)
OnStartScript()
Call..
tarting VSE running …
ProcessEvent()
ProcessEvent()
ProcessEvent()
ProcessEvent()
Data…
File
ProcessEvent()
Set out.Re su lt = _VERIFICATION_PASSED or _VERIFICATION_FAILED will comp le t e the scr ipt run.
COM Client
Call..
(If expected event )
Call..
(If expected event )
Call..
(If expected event )
Call..
(If expected event )
Call..
(If expected
event )
OnFinishScript()
PASSED
FAILED
Call..
DONE
erification Script results
Note: Verification script result <DONE> means that the script is intended for extracting and displaying some information from recorded traces only, and you do not care about results. To specify that your script is for displaying information only, call the function ScriptForDisplayOnly() somewhere in your script (in OnStartScript(), for instance).
inishing VSE running … …
Page 11 of 107
LeCroy Corporation Verification Script Engine Reference Manual
4 Running Verification Scripts from Application
To run a verification script over a trace, you select the main menu item Report > Run verification scripts or click the Run verification scripts button on the main tool bar (if it is not hidden):
Page 12 of 107
LeCroy Corporation Verification Script Engine Reference Manual
V
The Run verification scripts dialog opens where you choose then run one or several verification scripts:
erification Script List.
Name for scripts are file names without extension.
Verification Script description. Descriptions for scripts are defined in set DecoderDesc= "MyDescription";
Finds a view related to the verified trace and place this window under it.
Expands output windows. ( Shortcut key : F11. Shift+F11 also maximizes dialog. )
Starts running selected verif ica tio n scrip ts
Finds a view related to the verified trace and place this window by the right side of it.
Tabbed output windows for selected verification script s.
Saves contents of ou tput window s in text files.
Allows to set different settings.
Page 13 of 107
LeCroy Corporation Verification Script Engine Reference Manual
4.1 Running Verification Scripts
Push the button Run scripts after you select scripts to run. VSE starts running the selected verification scripts, shows script report information in the output windows, and presents the results of verifications in the script list:
Page 14 of 107
LeCroy Corporation Verification Script Engine Reference Manual
Right-clicking the script list displays some additional operations over selected scripts:
Run verification script(s): Edit script: Edit selected scripts in the editor application specified in Editor settings. New script: Create a new script file using the template specified in Editor settings. Show Grid
Show Description window
Show Output Settings: Open a special Setting dialog to specify different settings for VSE.
: Show/hide a grid in the verification script list.
: Show/hide the script output windows (Shortcut key F3).
Start running selected script(s).
: Show/hide the script description window (Shortcut key F2).
Page 15 of 107
LeCroy Corporation Verification Script Engine Reference Manual
p
g
p
4.2 VSE GUI Settings
After choosing Settings, the following dialog appears:
This option (if set) allows editor applications supporting multi-document interface (MDI) to edit a ll s cr ip t files related to the selected scripts in one application instance.
Otherwise, a new application instance will be launched for each script file.
This option (if set) allows editor applications to edit all included files (extension : *.inc) along with main verification script files (extension : *.vs e )
Otherwise, only main verification script files will be opened for editing.
Launches editor application in full screen mode.
Full path to the file to be used as a template for a new script.
This setting (if set) specifies that the last saved output for selected scripts should be loaded into the out
This setting (if set) brings Run VS dialog to foreground when scripts stopped runnin
.
This option specifies that potential run­time errors and warnings like calling not defined functions etc. shouldn't be reported.
This setting (if set) forces the application to save output automatically when the scri
ts stopped running.
ut windows.
See screen pop-up tooltips for explanation of other settings…
Page 16 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5 Verification Script Engine Input Context Members
All verification scripts have input contexts, special structures that can be used inside of the scripts. The application fills their members. The verification script input contexts have two sets of members:
Trace event-independent set of members
Trace event-dependent set of members
Note: All input context members have integer type values unless their types are explicitly specified. If possible values for input context members are not explicitly specified, they should comply with the current USB specifications.
5.1 Trace Event-independent Set of Members
This set of members is defined and can be used for any event passed to a script:
in.Level: Transaction level of the trace event. It can be one of the following constants:
_PKT: Packet level (value = 0) _TRA: Transaction level (value = 1) _SPL_TRA: Split Transaction level (value = 2) _XFER: Transfer level (value = 3)
in.Index: Index of the event in the trace file (packet number for packets etc). in.Time: Time of the event (type = list, having format = 2 sec 125 ns -> [2 , 125]. For more information, see
section 10.1 VSE Time Object
In.Channel: Indicates on which channel the event occured. It can be one of the following constants:
_USB2: USB2 traffic (value = 1) _USB3_RX: USB3 Host Receive traffic (Upstream, value = 2) _USB3_TX: USB3 Host Transmit traffic (Downstream, value = 3)
in.Speed: Indicates the speed for the trace event. It can be one of the following constants:
_FS: USB2 Full Speed (value = 1) _LS: USB2 Low Speed (value = 2) _HS: USB2 High Speed (value = 3) _SS: USB3 Super Speed (value = 4)
in.Direction: Indicates the direction for the trace event. It can be one of the following constants:
_IN: Direction is from Host to Device (value = 2) _OUT: Direction is from Device to Host (value = 3) _BOTH: Trace event involves traffic in both directions (value = 4)
in.TraceEvent: Type of trace events. (Application predefined constants are used. See list of possible events
in Chapter 7. Verification Script Engine Events
in.Notification: Type of notifications. (Application predefined constants are used. Currently no notifications
are defined.)
.
.)
Page 17 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2 Trace Event-dependent Set of Members
This set of members is defined and can be used only for a specific event or after calling functions that provide values of variables:
5.2.1 USB Packet-specific Set of Members
Members of this set are valid for all USB packet events:
in.RawPacket: Bit source of the whole packet. (You can extract any necessary information using the
GetNBits(), NextNBits(), or PeekNBits() functions.
In.RawPacketLength: Length of the packet (in bytes). In.Duration: Time it took to transmit the packet on the bus (VSE Time object In.Errors: A bitmap of packet level errors. The table below describes the current list of possible packet errors
and their bit positions in the error bitmap:
Error type Bit position Description USB2 Errors:
PID_ERROR 1 Bad PID value CRC5_ERROR 2 Bad CRC5 CRC16_ERROR 3 Bad CRC16 PACKETLEN_ERROR 4 Wrong packet length BIT_STUFF_ERROR 5 Bit stuffing error EOP_ERROR 6 Bad End Of Packet BABBLE_START_ERROR 7 Babble start error BABBLE_END_ERROR 8 Babble end (Loss Of Activity) error FRAME_LENGTH_ERROR 9 Wrong frame length HANDSHAKE_TIMEOUT_ERROR 10 Bad turnaroud timing or timeout
condition for handshake
INTERNAL_ERROR 11 Analyzer internal error DATA_TOGGLE_ERROR 12 Data toggling error MICROFRAME_ERROR 13 Bad frame or microframe number MOD_8_ERROR 14 Last Byte Incomplete error OTG_ERROR 15 Bad OTG Signal value
USB3 Errors. TBD.
).
Page 18 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2.1.1 USB Bus Condition-specific Set of Members
Note: Valid for Bus Condition trace events only, undefined for other events.
In.BusCondition: Type of Bus Condition events.
The table below describes the current list of possible Bus Condition events and values of in.BusCondition:
Bus Condition in.BusCondition Value Description
CHIRP_K _CHIRP_K 0 Device “K” Chirp to notify host
of Hi Speed capability
CHIRP_J _CHIRP_J 1 Device “J” Chirp to notify host
of Hi Speed capability
FS_K_ON_HS _FS_K_ON_HS 2 Full Speed “K” signaling on Hi
Speed branch
FS_J_ON_HS _FS_J_ON_HS 3 Full Speed “J” signaling on Hi
Speed branch
SUSPEND _SUSPEND 4 Suspend signaling RESUME _RESUME 5 Resume signaling SE1 _SE1 6 SE1 signaling SE0 _SE0 7 SE0 FS or LS signaling (can
be keep-alive for LS)
VBUS_VOLTAGE_CHANGE _VBUS_VOLTAGE_CHANGE 44(0x2C) Change of Vbus Voltage
in.BusConditionDuration: Duration of the Bus Condition event in nanoseconds.
Page 19 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2.1.2 USB2 Packet-specific Set of Members
Note: Valid for USB2 packets only, undefined for other events.
The following input context members apply to most of the USB2 packets.
In.Pid: Packet Identifier value for the packet. It is the full PID value, the following constants are defined in the
VS_constants.inc include file and can be used by scripts: # USB 2.0 PID values
const PID_OUT = 0x87; const PID_IN = 0x96; const PID_SOF = 0xA5; const PID_SETUP = 0xB4; const PID_DATA0 = 0xC3; const PID_DATA1 = 0xD2; const PID_DATA2 = 0xE1; const PID_MDATA = 0xF0; const PID_ACK = 0x4B; const PID_NAK = 0x5A; const PID_STALL = 0x78; const PID_NYET = 0x69; const PID_PRE = 0x3C; const PID_ERR = 0x3C; const PID_SPLIT = 0x1E; const PID_PING = 0x2D; const PID_EXT = 0x0F;
in.SubPidPacket: If non-zero, signals that this packet is a protocol extension token as defined by the Link
Power Management ECN. In this case the Pid value should be treated as the SubPid (only LPM currently defined).
In.CRC5: CRC5 value for packets (not relevant for Data packets).
Page 20 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2.1.2.1 USB2 Token Packet Members
in.Addr: Value of the Address (ADDR) field of the Token packet. In.Endp: Value of the Endpoint (ENDP) field of the Token packet.
5.2.1.2.2 USB2 Start Of Frame Packet Members
in.FrmNum: Frame number for the current USB2 frame. In.MicroFrmNum: Microframe number for the current microframe as determined by the Analyzer (would be
zero for Full Speed frames).
5.2.1.2.3 USB2 Data Packet Members
in.Payload: Bit source of the packet payload. (You can extract any necessary information using GetNBits(),
NextNBits(), or PeekNBits() function.
In.PayloadLength: Length (in bytes) of the packet payload. In.CRC16: CRC16 value for the Data packet.
5.2.1.2.4 USB2 Split Token Packet Members
in.HubAddr: Value of the Hub Address field, the USB device address of the hub supporting the specified full-
/low-speed device for this full-/low-speed transaction.
In.SC: Value of the Start/Complete bit for the split token. In.Port: Value of the Port field – the port number of the target hub for which this full-/low-speed transaction is
destined.
In.S: Value of the Speed bit for the split token. In.E: Value of the End bit for the split token. In.ET: Value of the Endpoint Type field for the split token.
Page 21 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2.1.2.5 Link Power Management Extended Token Members
in.HIRD: Value of the Host Initiated Resume Duration field. In.bLinkState: Value of the bLinkState field for the LPM extended token. In.bRemoteWake: Value of the bRemoteWake bit for the LPM extended token. In.Reserved: Value of the reserved field for the LPM extended token.
Page 22 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2.1.3 USB3 Packet-specific Set of Members
Note 1: Valid for USB3 packets only, undefined for other events. Note 2: The system does not pass all possible fields of USB3 packets as members of Input Context. If a script
needs to use the values of those fields, use the GetHexPktField
5.2.1.3.12
for examples.
5.2.1.3.1 TSEQ Training Sequence Ordered Set Members
in.Count: Value of TSEQ count, the number of sequential TSEQ sequences sent
5.2.1.3.2 TS1/TS2 Training Sequence Ordered Set Members
in.Count: Value of TS count, the number of sequential TS1 or TS2 sequences sent in.LnkFunctionality: Value of the whole Link Functionality (Link Configuration) byte in the training
sequence
in.Reset: Value of the Reset bit in the Link Configuration byte. In.SSDisable: Value of the Spread Spectrum bit in the Link Configuration byte. In.Loopback: Value of the Loopback asserted/deasserted bit in the Link Configuration byte. In.ScrDisable: Value of the Disable Scrambling bit in the Link Configuration byte.
and GetDecodedPktField functions. See
5.2.1.3.3 LFPS Packet Members
in.Type: Type of LFP signaling in.Duration: Duration of LFP signaling in nanoseconds
5.2.1.3.4 Inter-Packet Symbols Packet Members
in.NumOfSymbols: Number of symbols in the IPS sequence
5.2.1.3.5 Link Command Packet Members
in.LnkCmd: Value of Link Command information for the Link command
Page 23 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2.1.3.6 SKIP Packet Members
in.Count: Count of symbols in the SKIP sequence
5.2.1.3.7 Logical Idle Packet Members
in.Count: Count of symbols in the Logical Idle sequence
5.2.1.3.8 Link Management Packet Members
in.SubType: SubType value for LMP. Use constant definitions in VS_constants.inc.
5.2.1.3.9 Isochronous Timestamp Packet Members
in.BusICounter: Bus Interval Counter value for ITP, in 1/8 of a millisecond in.Delta: Time Delta value for ITP in.BusIAdjCtrl: Bus Interval Adjustment Control value for ITP, specifying the device in control of
bus interval adjustment
5.2.1.3.10 Transaction Packet Members
in.SubType: SubType value for Transaction Packet. Use constant definitions in VS_constants.inc. in.Addr: Address of the device that receives this Transaction Packet in.Endp: Endpoint number on the device that receives this Transaction Packet in.Dir: Direction for the specified Endpoint in.StreamID: Value of the StreamID field
Page 24 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2.1.3.11 Data Packet Members
in.Addr: Address of the device which is the recipient of this Data Packet in.Endp: Endpoint number on the device which is the recipient of this Data Packet in.Dir: Direction for the specified Endpoint in.StreamID: Value of the StreamID field in.SeqN: Value of the Sequence Number for this Data Packett in.DataLength: Length of the payload for this Data Packet in.PayloadLength: Length of the payload actually recorded for this Data Packet in.Payload: Bit source of the packet payload for this Data Packet. (You can extract any necessary
information using the GetNBits(), NextNBits(), or PeekNBits() function.)
in.CRC32: Value of CRC32 protecting the payload for this Data Packet
Note: In USB Protocol Suite software versions earlier than 3.71 (namely, 3.60 and 3.70), Data Packet Header and Data Packet Payload were two separate packet types with input context members split accordingly between them. Those were combined into a single Data Packet starting with version 3.71.
Page 25 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2.1.3.12 Getting Values of the Fields not present in Input Context
As mentioned earlier, not all the possible fields of USB3 packets are passed as members of Input Context. The following are examples of using GetHexPktField not present in Input Context.
If( in.TraceEvent == _USB3_LMP_PKT ) { # Example of using decoded packet information for LMPs.
# ‘SubType’ field, # String value str = FormatEx(“\tSubType(str) = ‘%s’”, GetDecodedPktField(“SubType”)); ReportText( str );
# Hex Value val = GetHexPktField ( “SubType” ); str = FormatEx( “\tSubType(hex) = 0x%X\n”, val ); ReportText( str );
# ‘Hseq’ field # String value str = FormatEx( “\tHseq(str) = ‘%s’”, GetDecodedPktField ( “Hseq” ) ); ReportText( str );
# Hex Value val = GetHexPktField ( “Hseq” ); str = FormatEx( “\tHseq(hex) = 0x%X\n”, val ); ReportText( str ); }
if( ( in.TraceEvent == _USB3_TP_PKT ) && ( in.SubType == TP_ACK ) ) { # Example of using decoded packet information for TPs.
# ‘SeqN’ field # String value str = FormatEx( “\tSeqN(str) = ‘%s’”, GetDecodedPktField ( “SeqN” ) ); ReportText( str );
# Hex Value val = GetHexPktField ( “SeqN” ); str = FormatEx( “\tSeqN(hex) = 0x%X\n”, val ); ReportText( str );
# ‘NumP’ field # String value str = FormatEx( “\tNumP(str) = ‘%s’”, GetDecodedPktField ( “NumP” ) ); ReportText( str );
and GetDecodedPktField functions to get values of the fields
Page 26 of 107
LeCroy Corporation Verification Script Engine Reference Manual
# Hex Value val = GetHexPktField ( “NumP” ); str = FormatEx( “\tNumP(hex) = 0x%X\n”, val ); ReportText( str ); }
if( in.TraceEvent == _USB3_DP_PKT ) { # Example of using decoded packet information for DPs.
# ‘SeqN’ field # String value str = FormatEx( “\tSeqN(str) = ‘%s’”, GetDecodedPktField ( “SeqN” ) ); ReportText( str );
# Hex Value val = GetHexPktField ( “SeqN” ); str = FormatEx( “\tSeqN(hex) = 0x%X\n”, val ); ReportText( str );
# ‘ENDP’ field # String value str = FormatEx( “\tENDP(str) = ‘%s’”, GetDecodedPktField ( “ENDP” ) ); ReportText( str );
# Hex Value val = GetHexPktField ( “ENDP” ); str = FormatEx( “\tENDP(hex) = 0x%X\n”, val ); ReportText( str ); }
# Link Control Word if( ( in.TraceEvent == _USB3_TP_PKT ) || ( in.TraceEvent == _USB3_DP_PKT ) ) { ReportText( “LCW:” ); val = GetHexPktField ( “Hseq” ); str = FormatEx( “\tHseq = %d”, val ); ReportText( str );
val = GetHexPktField ( “Hdepth” ); str = FormatEx( “\tHDepth = %d”, val ); ReportText( str );
val = GetHexPktField ( “D1” ); str = FormatEx( “\tDelayed (D1) = %d”, val ); ReportText( str );
val = GetHexPktField ( “D2” ); str = FormatEx( “\tDeferred (D2) = %d\n”, val ); ReportText( str ); }
Page 27 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2.2 Transaction-specific Set of Members
in.TraToken: Token PID for the transaction. Possible values are:
const PID_OUT = 0x87; const PID_IN = 0x96; const PID_SETUP = 0xB4; const PID_SPLIT = 0x1E; const PID_PING = 0x2D; const PID_EXT = 0x0F;
in.Addr: Device Address value for this Usb transaction. In.Endp: Device Endpoint Number value for this Usb transaction. In.TraCompletionFlag: Handshake PID for the transaction (if any). Possible values are:
const PID_ACK = 0x4B; const PID_NAK = 0x5A; const PID_STALL = 0x78; const PID_NYET = 0x69; const PID_ERR = 0x3C; 0xFFFFFFFF – in case no handshake was sent for the transaction.
In.Complete: Flag, signaling if the transaction was complete. In.XferType: Type of the USB Transfer this transaction belongs to. See Transfer Types for possible values. In.CtrlDirection: For a Setup transaction represents the direction of the corresponding Control Transfer.
0 = Host-to-device 1 = Device-to-host
in.FirstInXfer: This flag is set when the transaction is first in the transfer it belongs to. In.LastInXfer: This flag is set when the transaction is last in the transfer it belongs to. In.Errors: Error code for the transaction, if any error happened.
If the transaction is a Setup transaction, the following input context members provide values of the corresponding fields of the USB Device Request:
in.ReqType in.ReqRecipient in.bRequest in.wIndex in.wValue in.wLength
Page 28 of 107
LeCroy Corporation Verification Script Engine Reference Manual
in.Split: Signals that the transaction is a start-split or complete-split. In.HubAddr: Value of the Hub Address field, the USB device address of the hub supporting the specified full-
/low-speed device for this full-/low-speed transaction.
In.SC: Value of the Start/Complete bit for the split token. In.Port: Value of the Port field – the port number of the target hub for which this full-/low-speed transaction is
destined.
In.S: Value of the Speed bit for the split token. In.E: Value of the End bit for the split token. In.ET: Value of the Endpoint Type field for the split token. In.OTGHostId: For USB On-The-Go transactions, indicates if the A-device is acting as the host (value of 0) or
the B-device is acting as the host (value of 1).
In.OTGErrorCode: For USB On-The-Go transactions, indicates error code if non-zero. In.OTGErrorCodeOffset: For USB On-The-Go transactions with errors, indicates the offset from the first
packet in the transaction to the packet with error.
In.PayloadLength: Length (in bytes) of the packet payload. If zero, the transaction does not have any
payload.
In.Payload: Bit source of the transaction data payload. Note: You can extract any necessary information using
the GetNBits(), NextNBits(), or PeekNBits() function.
Page 29 of 107
LeCroy Corporation Verification Script Engine Reference Manual
5.2.3 Split Transaction-specific Set of Members
All the input context members that are defined for USB2 transactions are also applicable to Split Transactions. In addition to those, Split Transactions define the following members:
in.TraHalted: Indicates that this split transaction was halted.
Page 30 of 107
Loading...
+ 77 hidden pages