Note: You can find more examples in the USB Protocol Suite application folder.
Example Script 1
############################################################################
# NewGenSettings.usb3g
# Line comment
/*
Block comment
*/
# General constant
const INFINITE = 0xFFFFFFFF
const AUTO = 0xFFFFFFFF
############################################################################
# This generaton script contains new or modified generation settings
# since the previous release of the Lecroy USB Suite.
#
# For all the other settings please refer to
# Voyager™ USB 3.2 Exerciser Generation Script Language Reference Manual
# contained in the VoyagerUSB3ExerciserScriptLanguage.pdf.
#
# NOTE: All generation setting examples are for illustration purposes only.
# Change settings from default values ONLY if you understand them.
############################################################################
##########################################################################
# Some Link management settings
# Power state accept flags
const AU1 = 0x1# Accept the request of entering U1 by sending LAU.
const AU2 = 0x2# Accept the request of entering U2 by sending LAU.
const AU3 = 0x4# Accept the request of entering U3 by sending LAU.
const AU_AUTO = 0x8# AUTO mode. Reply to the LGO_Un based on the
# configured value through LMPs.
const AU_ALL = (AU1 | AU2 | AU3)
# This setting controls the behavior of the device in response to
# Power Management states entry request (LGO_Un).
Set PwrStateAccept = AU1 # Accept only U1
# This setting enables/disables sending of LPMA in response to LAU.
Set DisableLPMA = 1# disables sending of LPMA in response to LAU.
# If the appropriate response in LC handshake of Power State change
# has not be received during specified timeout, this error will be raised.
# This setting allows not to raise such error in the Exercizer link layer.
Set DisablePMLCTimeout = 1# Disables detection of timeout on receiving
# response to PM Link command.
# This setting controls the behavior of device in response to PortConfig LMP.
# Value 0: Don’t respond to PortConfig LMP.
# Value 1: Automatically respond to PortConfig LMPs. (Default)
Set PortCfgAck = 0# Don't respond to PortConfig LMPs.
# If the LUP is not received by HOST during specified timeout,
# this error will be raised.
# This setting allows not to raise such error in the Exercizer link layer.
# For DEVICE mode, this setting has the same meaning as DisableLDNTimeout.
Set DisableLUPTimeout = 1
# If the LDN is not received by DEVICE during specified timeout,
# this error will be raised.
# This setting allows not to raise such error in the Exercizer link layer.
# For HOST mode this setting has the same meaning as DisableLUPTimeout.
Set DisableLDNTimeout = 1
# This setting controls the timing schedule of LUP generation.
# For DEVICE mode, this setting has the same meaning as LDNInterval.
Set LUPInterval = 80
# This setting controls the timing schedule of LDN generation.
# For DEVICE mode, this setting has the same meaning as LUPInterval.
Set LDNInterval = 80
# This setting controls the timeout of receiving LUP in HOST mode.
# If time has passed without any LUP received, an error will be raised
# and LTSSSM will be directed to Recovery state.
# For DEVICE mode, this setting has the same meaning as LDNDetectTimeout.
Set LUPDetectTimeout = 20# LUP timeout is set to 20 ns. 0xFFFFFFFF
# means AUTO (defined by spec).
# This setting controls the timeout of receiving LDN in DEVICE mode.
# If time has passed without any LDN received, an error will be raised
# and LTSSSM will be directed to Recovery state.
# For HOST mode, this setting has the same meaning as LUPDetectTimeout.
Set LDNDetectTimeout = 20# LDN timeout is set to 20 ns. 0xFFFFFFFF
# means AUTO (defined by spec)
# This setting controls LDN LC generation in HOST emulation mode.
# If it is set to 1, it disables LDN generation.
# For DEVICE mode, this setting has the same meaning as DisableLUP.
Set DisableLDN = 0
# This setting controls LUP LC generation in DEVICE emulation mode.
# If it is set to 1, it disables LUP generation.
# For HOST mode, this setting has the same meaning as DisableLDN.
Set DisableLUP = 0
# This setting controls timeout of receiving LC response
# during PM entry handshake.
# It means time between LGO_Un to LAU or LXU and time between LAU to LPMA.
Set PMLCTimeout = 40# PM LC timeout is set to 40 ns. 0xFFFFFFFF
# means AUTO (defined by spec)
##########################################################################
# Link Delay settings
# This setting adds a specific delay to the response time of LGOODn.
# Please note that requested time will be added to normal (minimum) response
# time of the system.
# Currently, time delay has 100 ns granularity.
Set DelayLGOOD = 200# delay in ns to add.
Set DelayLGOODCnt = 4# number of times (4) to apply this custom delay.
# This setting adds a specific delay to the response time of LBADn.
Set DelayLBAD = 300# delay in ns to add.
Set DelayLBADCnt = 7# number of times (7) to apply this custom delay.
# This setting adds a specific delay to the response time of LCRDn.
Set DelayLCRD = 100 # delay in ns to add.
Set DelayLCRDCnt = 0xFFFFFFFF# apply this setting infinite number of times
##########################################################################
# Link Advertisement Error Injection settings
# This setting instructs Exercizer link layer not to send LGOODn LC
# during advertisement phases.
Set ErrLostLGOODAdv = 4# number of times to apply this error injection.
# This setting forces the link layer to send an incorrect index number
# in LGOODn LC during advertisement phase.
# For advertisement after reset, it’s expected to be a LGOOD_7.
# After Recovery, it’s expected to be the last Acknowledged header
# sequence number.
# This setting forces the link layer to send some index different
# than expected value.
Set ErrWrongLGOODAdv = 100# number of times to apply this error injection.
# This setting instructs Exercizer link layer not to send LCRDn LC
# during advertisement phases.
Set ErrLostLCRDAdv = 10
# This setting forces the link layer to send LCRDx LCs during advertisement
# phase in wrong order.
# Instead of sending LCRD_A and continuing up to number of free Rx buffers,
# this command forces the link layer to send LCRDx LCs in shuffled order.
Set ErrWrongLCRDAdv = 3
##########################################################################
# Framing Corruption settings
# Binary bit masks defining which symbols to
# corrupt in framing sequences. Bit 0 = 1 symbol, bit 1 = second etc.
const CRPT_SYM1 = _0001# 0x1
const CRPT_SYM2 = _0010# 0x2
const CRPT_SYM3 = _0100# 0x4
const CRPT_SYM4 = _1000# 0x8
Set ErrCorruptSHPMap = CRPT_SYM1 # Symbol 1 in the SHP framing sequence
# to be corrupted
Set ErrCorruptSHP = 16# Perform SHP framing corruption error
# 16 times, then use correct framing.
Set ErrCorruptSDPMap = CRPT_SYM1 | CRPT_SYM3 # Symbol 2 and 3 in the SDP
# framing sequence to corrupt
Set ErrCorruptSDP = 5# Perform SDP framing corruption error 5 times,
# then use correct framing.
Set ErrCorruptENDMap = _0101# Symbols 1,3 in the SLC framing sequence
# to be corrupted
Set ErrCorruptEND = 0xFFFFFFFF# !!! ALWAYS Perform END framing
# corruption error !!!
Set ErrCorruptSLCMap = _1100# Symbols 3,4 in the SLC framing sequence
# to be corrupted
Set ErrCorruptSLC = 2# Perform framing corruption error 2 times,
# then use correct framing.
##########################################################################
# LTSSM Settings
# LTSSM Setting flags
const DISABLE_LFPS = 0x1# disables Polling.LFPS detection
const CUSTOM_TSEQ = 0x2# send specified number of TSEQ
# (TSEQNumber setting) then go to the next state.
const CUSTOM_TS1 = 0x4# send TS1 for specified period of time
# (TS1Time setting) then go to the next state.
const CUSTOM_TS2 = 0x8# send TS2 for specified period of time
# (TS2Time setting) then go to the next state.
const DISABLE_IDLE = 0x10# disables Logical Idle handshake.
# LTSSM will jump over relevant sub-state.
# setting 0 means AUTO
# DISABLE_LFPS | CUSTOM_TSEQ | CUSTOM_TS1 | CUSTOM_TS2 | DISABLE_IDLE
Set LTSSMSettings = CUSTOM_TS1
# number of TSEQ Ordered Sets to be sent in Polling.RxEQ sub-state,
# if CUSTOM_TSEQ bit is set in LTSSMSettings setting.
Set TSEQNumber = 64000
# Specifies time of staying in Polling.Active or Recovery.Active sub-states
# regardless of received pattern,
# if bit CUSTOM_TS1 of the LTSSMSettings is set.
Set TS1Time = 2000
# Specifies time of staying in Polling.Active or Recovery.Active sub-states
# regardless of received pattern,
# if bit CUSTOM_TS2 of the LTSSMSettings is set.
Set TS2Time = 1000
# Custom Flow Control flags
const NO_LGOOD_DETECT = _0001
const NO_LCRD_DETECT = _0010
const NO_LGOOD_GENERATION = _0100
const NO_LCRD_GENERATION = _1000
const NO_FLOW_CTRL = _1111
# Allows to override automatic USB 3.2 Link flow control settings
# as required by the USB 3.2 spec
# and instructs the Exerciser to use custom link flow control settings.
# Don't detect LCRD (Exerciser assumes that the DUT always has
# enough credits)
# and disable LCRD generation (Exerciser will ignore Rx buffer space
# check and also will not respond with LCRD).
Set CustomFlowControl = NO_LCRD_DETECT | NO_LCRD_GENERATION
##########################################################################
# LFPS Duty cycle setting
# LFPS Duty cycle constants
const DC_50_PERCENT = 0 # default
const DC_60_PERCENT = 1
const DC_40_PERCENT = 3
Set LFPSDutyCycle = DC_60_PERCENT
##########################################################################
# LFPS Period setting
# LFPS Period constants
const PD_16_NS = 0
const PD_20_NS = 1
const PD_24_NS = 2
const PD_32_NS = 3
const PD_40_NS = 4# default
const PD_48_NS = 5
const PD_56_NS = 6
const PD_64_NS = 7
const PD_72_NS = 8
const PD_80_NS = 9
const PD_88_NS = 10
const PD_96_NS = 11
const PD_100_NS = 12
const PD_104_NS = 13
const PD_112_NS = 14
const PD_120_NS = 15
Set LFPSPeriod = PD_24_NS
###########################################################################
# LFPS Settings
# LFPS Transmitter Timing defined in USB 3.2 Specificaion rev. 1.0
# Polling.LFPS: tBurst Min= 0.6us, Max = 1.4us, Typ = 1us,
# tRepeat Min = 6us, Max = 14us, Typ = 10us
# Ping.LFPS: tBurst Min = 40ns, Max = 200ns
# tRepeat Min = 160ms, Max = 240ms, Typ = 200ms
# Minimum number of LFPS Cycles 2
# tReset: tBurst Min = 800ms, Max = 120ms, Typ = 100ms
# U1 Exit: tBurst Min = 300ns, Max = 900ns/2ms
# (both ports are in U1/one port is in U1 and another is in U2)
# U2/Loopback Exit: tBurst Min = 80us, Max = 2ms
# U3 Wakeup: tBurst Min = 80us, Max = 10ms
###########################################################################
# Specifies user-defined value of T_burst of Polling.LFPS.
# 0xFFFFFFFF - instructs to use the spec value.
Set LFPSPollingTBurst = 600
# Specifies user-defined value of T_repeat of Polling.LFPS.
# 0xFFFFFFFF - instructs to use the spec value.
Set LFPSPollingTRepeat = 6000
# Specifies user-defined value of T_burst of Ping.LFPS.
# 0xFFFFFFFF - instructs to use the spec value.
Set LFPSPingTBurst = 40
# Specifies user-defined value of T_repeat of Ping.LFPS.
# 0xFFFFFFFF - instructs to use the spec value.
Set LFPSPingTRepeat = 160000000
# Specifies user-defined value of T_burst of WarmReset.
# 0xFFFFFFFF - instructs to use the spec value.
Set LFPSWarmResetTBurst = 800000000
# Specifies user-defined value of T_burst of U1 Exit.
# 0xFFFFFFFF - instructs to use the spec value.
Set LFPSU1ExitTBurst = 300
# Specifies user-defined value of T_burst of U2 Exit.
# 0xFFFFFFFF - instructs to use the spec value.
Set LFPSU2ExitTBurst = 80
# Specifies user-defined value of T_burst of U3 Exit.
# 0xFFFFFFFF - instructs to use the spec value.
Set LFPSU3ExitTBurst = 80
#---------------------- Generation procedures ----------------------------
Main()
{
# All settings can be changed during run-time.
Set LFPSU3ExitTBurst = 80
Set CustomFlowControl = _1111# NO_FLOW_CTRL
#...
}
Example Script 2
# Packet Type constants
const LMP=0x0
const TP=0x4
const DPH=0x8
const ITP=0xC
Packet USB3Common
{
Type : 5 = LMP
}
struct LinkCtrlWord
{
Hseq : 3
LcwRsvd : 3
HDepth : 3
D1 : 1
D2 : 1
CRC_5 : 5# Auto calculated
}
Packet DataPacket : USB3Common
{
#Dword 0
Type = DPH
RouteStr : 20
DevAddr : 7
#Dword 1
SeqNum : 5
Rsvd1 : 1
Delayed : 1
EOB : 1
Endp : 4
Rsvd2 : 3
Setup : 1
DataLen : 16
#Dword 2
StreamID : 16
Rsvd3 : 11
PP : 1
Rsvd4 : 4
#Dword 3
CRC_16 : 16 # Auto calculated
: LinkCtrlWord # structure template insertion
Data : *
CRC32 : 32
}
Const AUTO = 0xFFFFFFFF
Set TxScramble = 1
Set RxDescramble = AUTO
Set TxInvertPolarity = 1
Set SkipTimer = 94
Main()
{
# Tracing templates
PTraceTemplate( DataPacket, LinkCtrlWord )
# Send 10 Data packets with different patterns.
for( i = 0, i <10, i++ )
{
Send DataPacket
{
Data = {AA BB CC i }
}
}
}