Sas Sata Verification Script Engine Manual
Sas Sata Verification Script Engine Manual
1
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. Teledyne LeCroy reserves the right to revise the information presented in this
document without notice or penalty.
Copyright
© 2012, Teledyne LeCroy, Inc. All Rights Reserved.
This document may be printed and reproduced without additional permission, but all copies
should contain this copyright notice.
2
Table of Contents
CHAPTER 1: INTRODUCTION .......................................................................................................................... 6
CHAPTER 2: VERIFICATION SCRIPT STRUCTURE....................................................................................... 7
CHAPTER 3: INTERACTION BETWEEN SASSUITE/SATASUITE AND A VERIFICATION SCRIPT ............ 9
CHAPTER 4: RUNNING VERIFICATION SCRIPTS FROM SASSUITE/SATASUITE ................................... 11
4.1 RUNNING VERIFICATION SCRIPTS ................................................................................. 14
4.2 VSE GUI SETTINGS .................................................................................................... 17
CHAPTER 5: VERIFICATION SCRIPT ENGINE INPUT CONTEXT MEMBERS ........................................... 18
5.1 TRACE EVENT-INDEPENDENT SET OF MEMBERS ........................................................... 19
5.2 TRACE EVENT-DEPENDENT SET OF MEMBERS .............................................................. 23
5.2.1 Primitives ...................................................................................................... 23
5.2.2 OOB .............................................................................................................. 23
5.2.3 SAS/SATA Generic Frame members ........................................................... 24
5.2.4 How to Access Frame Members .................................................................. 24
SAS Open Address Frame members ....................................................................... 25
5.2.5 SAS Identify Address Frame members ........................................................ 25
5.2.6 SAS12 Training Sequence members ........................................................... 26
5.2.7 SAS SSP Frame members ........................................................................... 26
5.2.8 SAS SMP Frame members .......................................................................... 27
5.2.9 SATA/STP Frame Members ......................................................................... 31
5.2.10 SCSI Command Frame Members ................................................................ 32
5.2.11 ATA Commands Frame Members ................................................................ 33
5.2.12 Metrics Fields for SCSI and ATA Commands (ONLY) ................................. 34
5.3 RAW DATA FIELD VALUE .............................................................................................. 35
CHAPTER 6: VERIFICATION SCRIPT ENGINE OUTPUT CONTEXT MEMBERS ....................................... 38
CHAPTER 7: VERIFICATION SCRIPT ENGINE EVENTS.............................................................................. 39
7.1 FRAME LEVEL EVENTS................................................................................................. 40
CHAPTER 8: DECLARATIONS ....................................................................................................................... 41
8.1 ARRAY DECLARATIONS ................................................................................................ 42
8.2 MAP DECLARATION...................................................................................................... 44
CHAPTER 9: SENDING FUNCTIONS ............................................................................................................. 45
9.1 SENDLEVEL() .............................................................................................................. 46
9.2 SENDLEVELONLY()...................................................................................................... 47
9.3 DONTSENDLEVEL() ..................................................................................................... 48
9.4 SENDCHANNEL() ......................................................................................................... 49
9.5 SENDCHANNELONLY()................................................................................................. 50
9.6 DONTSENDCHANNEL() ................................................................................................ 51
9.7 SENDALLCHANNELS() ................................................................................................. 52
9.8 SENDTRACEEVENT() ................................................................................................... 53
9.9 DONTSENDTRACEEVENT() .......................................................................................... 54
9.10 SENDTRACEEVENTONLY()........................................................................................... 55
9.11 SENDALLTRACEEVENTS() ........................................................................................... 56
9.12 SENDPROTOCOLERROR() ............................................................................................ 57
9.13 SENDPROTOCOLERRORONLY() ................................................................................... 58
9.14 DONTSENDPROTOCOLERROR() ................................................................................... 59
9.15 SENDPAIRSASADDRESS() .......................................................................................... 60
9.16 SENDPAIRSASADDRESSONLY() .................................................................................. 61
9.17 DONTSENDPAIRSASADDRESS().................................................................................. 62
9.18 SENDALLPAIRSASADDRESS() ..................................................................................... 63
9.19 SENDPRIMITIVE() ........................................................................................................ 64
3
9.20 SENDSSPTRANSPORT() .............................................................................................. 65
9.21 SENDSTPTRANSPORT() .............................................................................................. 67
9.22 SENDSMPTRANSPORT() ............................................................................................. 68
9.23 SENDSCSICOMMAND() ............................................................................................... 70
9.24 SENDATACOMMAND()................................................................................................. 71
9.25 SENDSMPCOMMAND() ................................................................................................ 72
9.26 SENDTASKMGMCOMMAND() ........................................................................................ 73
CHAPTER 10: TIME CONSTRUCTION FUNCTIONS .......................................................................... 74
10.1 TIME()......................................................................................................................... 75
CHAPTER 11: TIMER FUNCTIONS ...................................................................................................... 76
11.1 SETTIMER() ................................................................................................................ 77
11.2 GETTIMERTIME()......................................................................................................... 78
11.3 KILLTIMER() ................................................................................................................ 79
CHAPTER 12: TIME CALCULATION FUNCTIONS ............................................................................. 79
12.1 ADDTIME() .................................................................................................................. 80
12.2 SUBTRACTTIME() ........................................................................................................ 81
12.3 MULTIMEBYINT()......................................................................................................... 83
12.4 DIVTIMEBYINT() .......................................................................................................... 84
CHAPTER 13: TIME LOGICAL FUNCTIONS ....................................................................................... 85
13.1 ISEQUALTIME() ........................................................................................................... 86
13.2 ISLESSTIME() .............................................................................................................. 87
13.3 ISGREATERTIME() ....................................................................................................... 89
13.4 ISTIMEININTERVAL() .................................................................................................... 90
CHAPTER 14: TIME TEXT FUNCTIONS .............................................................................................. 91
14.1 TIMETOTEXT() ............................................................................................................ 92
CHAPTER 15: OUTPUT FUNCTIONS .................................................................................................. 93
15.1 ENABLEOUTPUT()........................................................................................................ 94
15.2 DISABLEOUTPUT() ....................................................................................................... 95
15.3 REPORTTEXT() ........................................................................................................... 96
CHAPTER 16: INFORMATION FUNCTIONS ........................................................................................ 97
16.1 GETTRACENAME() ...................................................................................................... 98
16.2 GETSCRIPTNAME() ..................................................................................................... 99
16.3 GETAPPLICATIONFOLDER()........................................................................................ 100
16.4 GETCURRENTTIME() ................................................................................................. 102
16.5 GETEVENTSEGNUMBER().......................................................................................... 103
16.6 GETTRIGGERPACKETNUMBER()................................................................................. 104
16.7 GETTRACESTARTPACKETTIME() ................................................................................ 106
16.8 GETTRACEENDTPACKETTIME() ................................................................................. 107
CHAPTER 17: NAVIGATION FUNCTIONS ........................................................................................ 108
17.1 GOTOEVENT() ........................................................................................................... 109
17.2 SETMARKER() ........................................................................................................... 111
CHAPTER 18: FILE FUNCTIONS ....................................................................................................... 112
18.1 OPENFILE()............................................................................................................... 113
18.2 W RITESTRING() ........................................................................................................ 114
18.3 CLOSEFILE() ............................................................................................................. 115
18.4 W RITEBIN () .............................................................................................................. 117
18.5 READBIN () ............................................................................................................... 118
18.6 SEEKTOBEGIN () ....................................................................................................... 120
18.7 SEEKTOEND()........................................................................................................... 121
4
18.8 SHOW INBROWSER() .................................................................................................. 122
CHAPTER 19: COM/AUTOMATION COMMUNICATION FUNCTIONS............................................. 123
19.1 NOTIFYCLIENT() ........................................................................................................ 124
CHAPTER 20: USER INPUT FUNCTIONS ......................................................................................... 125
20.1 MSGBOX() ................................................................................................................ 126
20.2 INPUTBOX() .............................................................................................................. 128
20.3 GETUSERDLGLIMIT()................................................................................................. 130
20.4 SETUSERDLGLIMIT() ................................................................................................. 131
CHAPTER 21: STRING MANIPULATION/FORMATTING FUNCTIONS............................................ 132
21.1 FORMATEX() ............................................................................................................. 133
21.2 LEFT(), RIGHT(), AND MID()........................................................................................ 135
21.3 GET AND SET CHARACTERS IN STRINGS ..................................................................... 136
CHAPTER 22: MISCELLANEOUS FUNCTIONS ................................................................................ 137
22.1 SCRIPTFORDISPLAYONLY() ....................................................................................... 138
22.2 SLEEP() .................................................................................................................... 139
22.3 CONVERTTOHTML() ................................................................................................. 140
22.4 PAUSE().................................................................................................................... 141
22.5 GETPACKETDATA() ................................................................................................... 142
22.6 FORMATRAW BYTES(RAW BYTES) ............................................................................... 143
22.7 SETMAXIMUMITERATIONS .......................................................................................... 144
CHAPTER 23: THE VSE IMPORTANT SCRIPT FILES ...................................................................... 145
23.1 EXAMPLE SCRIPT FILES ............................................................................................. 146
APPENDIX A – PRIMITIVE CODES ................................................................................................................... 148
APPENDIX B – ATA COMMANDS..................................................................................................................... 150
APPENDIX C – SCSI COMMANDS.................................................................................................................... 152
APPENDIX D – SMP COMMANDS .................................................................................................................... 156
APPENDIX E – LIMITATION OF FOR AND WHILE LOOPS ............................................................................ 157
APPENDIX F: HOW TO CONTACT TELEDYNE LECROY ............................................................................... 158
5
Chapter 1: Introduction
This document contains a description of the Teledyne LeCroy Verification Script Engine (VSE),
a new utility in the SATASuite/SASSuite software that allows users to perform custom analyses
of SAS/SATA traffic, recorded using the new generation of SAS/SATA protocol analyzers.
VSE allows users to ask the SASSuite/SATASuite application to send some desired "events"
(currently defined as Primitive/Frame/Transaction/Command) from a trace to a verification
script written using the Teledyne 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 text-based files
or sending special Automation/COM notifications to user client applications.
VSE was designed to allow users to easily retrieve information about any field in a SAS/SATA
Frame/Transaction/Command and to make complex timing calculations between different
events in a pre-recorded trace. It also allows data filtering-in or filtering-out with dynamically
changing filtering conditions, porting of information to a special output window, saving data to
text files, and sending data to COM clients connected to a SASSuite/SATASuite application.
6
Chapter 2: Verification Script Structure
Writing a verification script is easy, as long as you follow a few rules and have some
understanding of how the SASSuite/SATASuite application interacts with running scripts.
The main script file, which contains the text of the verification script, should have extension
.sasvs and be in the subfolder SASVFScripts of the main SASSuite/SATASuite folder. Some
other files might be included in the main script file using directive %include.
(See the CATC Scripting Language Reference Manual for details.)
The following schema presents a common structure of a verification script. This script is similar
to the content of the script template VSTemplate.sasv_ included with VSE:
#
#
# VS1.sasvs
#
# Verification script
#
# Brief Description:
# Performs specific verification
#
######################################################################################
# Module info
######################################################################################
# Filling of this block is necessary for proper verification script operation.
######################################################################################
set ModuleType = "Verification Script"; # Should be set for all verification scripts.
set OutputType = "VS"; # Should be set for all verification scripts
# that output only Report string and Result.
set InputType = "VS";
######################################################################################
# include main Verification Script Engine definitions
#
%include "VSTools.inc" # Should be set for all verification scripts.
######################################################################################
# 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()
######################################################################################
#
# It is a main intialization routine for setting up all necessary
# script parameters before running the script.
#
######################################################################################
7
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, all packet level events from all channels
# will be passed to the script.
#
# For details about how to specify what kind of events should be passed to the script
# please see the topic 'sending functions'.
#
# OPTIONAL
####################################################################################
g_MyGlobalVariable = 0;
######################################################################################
# ProcessEvent()
######################################################################################
#
######################################################################################
# It is a main script function called by the application when the next waited event
# occured in the evaluated trace.
#
# !!! REQUIRED !!! – MUST BE IMPLEMENTED IN VERIFICATION SCRIPT
######################################################################################
ProcessEvent()
{
# Write the body of this function depending upon your needs.
# It might require branching on event type:
# select {
# in. TraceEvent == … : …
# in. TraceEvent == … : …
# …
# }
return Complete();
}
######################################################################################
# OnFinishScript()
######################################################################################
#
######################################################################################
# It is a main script function called by the application when the script completes
# 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 == "My Arg" ) return 1;
return 0;
}
8
Chapter 3: Interaction Between
SASSuite/SATASuite and a Verification Script
When you run a script against a pre-recorded trace, the following sequence occurs:
Prior to sending information to the script's main processing function ProcessEvent(), VSE
looks for the function OnStartScript() and calls it if it is found. In this function, setup actions are
defined, such as specifying the kind of trace events that should be passed to the script and
setting up initial values for script-specific global variables.
Next, VSE parses the recorded trace to verify that the current packet or other event meets
specific criteria. If it does, VSE calls the script's main processing function ProcessEvent(),
placing information about the current event in the script's input context variables.
(Please refer to the topic "Input context variables" later in this document for a full description of
verification script input context variables.)
ProcessEvent() is the main verification routine for processing incoming trace events. This
function must be present in all verification scripts. When the verification program consists of a
few stages, the ProcessEvent() 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 running the script or, if the whole result is clear on the current stage, tells VSE
to complete execution of the script.
The completion of the test before the entire trace has been evaluated is usually done by setting
the output context variable:
out.Result = _VERIFICATION_PASSED or _VERIFICATION_FAILED
(Please refer to the topic "Output context variables" later in this document for a full description
of verification script output context variables.)
NOTE: Not only does a verification script evaluate recorded traces against some criteria,
but it can also extract information of interest and post-process it later by some
third-party applications. A set of script functions allows you to save extracted data in
text files, or send it to other applications, via COM/Automation interfaces.
When the script has completed running, VSE looks for the function OnFinishScript() and calls
it if found. In this function, some resetting procedures can be done.
The following figure illustrates the interaction between the SASSuite/SATASuite application and
a running verification script:
9
Verification Script SASSuite Application
(Run verification script)
OnStartScript() Call..
Starting VSE running …
ProcessEvent() Call..
(If expected event )
ProcessEvent() Call..
(If expected event )
ProcessEvent() Call..
(If expected event )
ProcessEvent() Call..
(If expected event )
Data…
Text COM
File Client
ProcessEvent()
Set out.Result =
_VERIFICATION_PASSED Call..
or (If expected
_VERIFICATION_FAILED event )
will complete the script run.
OnFinishScript() Call..
The Verification script result DONE occurs when the script has been configured to extract and
display some information about the trace, but not to display PASSED/FAILED results. To
configure a script so that it only displays information, place a call somewhere in your script to
the function ScriptForDisplayOnly(), for example in OnStartScript().
10
Chapter 4: Running Verification Scripts from
SASSuite/SATASuite
To run a verification script over a trace, open the SASSuite/SATASuite main menu item
Tools/Verification scripts or push the icon on the main toolbar if it is not hidden.
Tools
The special dialog will open displaying a list of verifications scripts. You can select one script to
run, or several scripts from the list to run in parallel:
11
The special dialog will open and display a list of verifications scripts. You can select one script
to run, or several scripts to run in parallel:
output windows
Expands. ( Shortcut key : F11. Tabbed output Saves contents of Allows to set
Shift+F11 also maximizes windows for selected output windows in different settings.
dialog. ) verification scripts. text files.
12
13
4.1 Running Verification Scripts
After you select the script(s) to run, push the button Run scripts. VSE starts running the
selected verification script(s), shows script report information in the output windows, and
presents results of verifications in the script list:
14
Right-click in the script list to open a pop-up menu with options for performing additional
operations on the selected scripts:
Edit script Allows editing of the selected script(s) using the editor
specified in the Editor settings.
New script Creates a new script file using the template specified in
the Editor settings.
15
16
4.2 VSE GUI Settings
After choosing Settings, the following dialog appears:
17
Chapter 5: Verification Script Engine Input Context
Members
All verification scripts have input contexts –special structures whose members are filled by the
application and can be used inside of the scripts. (For more details about input contexts, refer
to the CATC Script Language(CSL) Manual.. The verification script input contexts have two
sets of members:
o Trace event-independent set of members
o Trace event-dependent set of members
18
5.1 Trace Event-independent Set of Members
This set of members is defined and can be used for any event passed to script:
in.Index Index of the event in the trace file: frame number for frames,
sequence number for sequences.
In.DWORDS All DWORDs of current packet: type = list of list, having format
[ DWORD, Count, HasError]
HasError: 0 means it has no error, 1 means it has error
Example
[[“SOF”, 1, 0], [“50E80050”, 1, 1], … ]
[[“D10.2”, 258, 0]]
Example:
if(event_type == _FRM_OOB_SIGNAL)
{
if(in.OOBType == SAS_OOB_COMWAKE)
{
PhyCapBitPos = in.COMWAKE_PHYCAP_BIT;
}
}
19
In.I_PHYCAP 32-bit SNW3 Phy-Capabilities Value of Initiator
Example:
if(in.Level == _OOB_SEQ)
{
SNW3_Initiator_Phy_Cap = in.I_PHY_CAPABILITIES;
SNW3_Target_Phy_Cap = in.T_PHY_CAPABILITIES;
}
20
In.T_PHYCAP_G4WITHOUTSSC Value of the field G4 WITHOUT SSC of Target
Phy-Capabilities
Example:
if(in.Level == _OOB_SEQ)
{
ReportText( FormatEx( "\t Start => %d", in.I_PhyCap_Start));
ReportText( FormatEx( "\t TX SSC Type => %d", in.I_PhyCap_TXSSCType));
}
Note: For SATA/STP frame, if trace has been captured with M6-4, M6-2 or M6-1, “Host” and
“Device” are coming sequentially one after other: [ [Host], [Device], [Host], [Device], ….]
21
22
5.2 Trace Event-dependent Set of Members
This set of members is defined and can be used only for specific events or after calling some
functions and filling out some of the variables:
Note: As a general rule for all fields' values, if the field length is less than or equal to 4 bytes (32
bits), it is returned as an integer value, but if the field length is larger than 4 bytes, it is returned as a
raw data type.
For example:
- In.CRC: 4-Byte value is returned as an Integer.
- in.Lnk_SourceSASAddress: 8-Byte value is returned as Raw Data.
For more information about Raw Data values, please see section 5.3 "Raw Data field Value" section.
5.2.1 Primitives
5.2.2 OOB
oob_burst_idle_list = in.OOBBurstIdleList;
23
5.2.3 SAS/SATA Generic Frame members
in.SOF,
in.StartOfFrame 4-byte value of Start of frame primitive
in.EOF,
in.EndOfFrame 4-byte value of End of frame primitive
For all function-specific fields of any frame/command type, refer to the actual field name in the
trace file and access the same as follows:
For <Field Name>, include field name of the frame WITHOUT SPACES.
For example, for "Write Data Len", use <FieldName> = 'WriteDataLen'.
Example
Following the above, to access a SMP Transport -> 'Ignore Zone Group' field,
use In.Trp_IgnoreZoneGroup
24
SAS Open Address Frame members
Note: All members return the content of the matching field name ("in.xyz" returns the value of
field "xyz") based on the SAS specification.
in.Lnk_AddressFrameType
in.Lnk_Protocol
in.Lnk_InitiatorPort
in.Lnk_ConnectionRate
in.Lnk_Features
in.Lnk_InitiatorConnectionTag
in.Lnk_DestinationSASAddress
in.Lnk_SourceSASAddress
in.Lnk_SourceZoneGroup
in.Lnk_PathwayBlockedCount
in.Lnk_ArbitrationWaitTime
in.Lnk_MoreCompatibleFeatures
Note: All members return the content of the matching field name ("in.xyz" returns the value of
field "xyz") based on the SAS specification.
in.Lnk_AddressFrameType
in.Lnk_DeviceType
in.Lnk_Reason
in.Lnk_Restricted
in.Lnk_SMPInitiatorPort
in.Lnk_STPInitiatorPort
in.Lnk_SSPInitiatorPort
in.Lnk_SMPTargetPort
in.Lnk_STPTargetPort
in.Lnk_SSPTargetPort
in.Lnk_DeviceName
in.Lnk_SASAddress
25
in.Lnk_PhyIdentifier
in.Lnk_Break_ReplyCapable
in.Lnk_RequestedInsideZPSDS
in.Lnk_InsideZPSDSPersistent
in.Lnk_PARTIALCAPABLE
in.Lnk_SLUMBERCAPABLE
in.Lnk_ControlField
in.Lnk_CoefficientSettings
in.Lnk_PatternType
in.Lnk_Coefficient1Request
in.Lnk_Coefficient2Request
in.Lnk_Coefficient3Request
in.Lnk_StatusField
in.Lnk_BALANCE
in.Lnk_TXInit
in.Lnk_TRAINCOMP
in.Lnk_Coefficient1Status
in.Lnk_Coefficient2Status
in.Lnk_Coefficient3Status
in.Trp_ReqOffset
in.Trp_WriteDataLen
in.Trp_LogicalUnitNumber
in.Trp_TaskAttribute
in.Trp_TaskPriority
in.Trp_EnableFirstBurst
in.Trp_AddiCDBLen
in.Trp_CDB
26
5.2.7.3 RESPONSE SSP Frame
in.Trp_SSPFrameType is SSP_FRAME_TYPE_RESPONSE (0x07)
in.Trp_STATUSQUALIFIER
in.Trp_DataPresent
in.Trp_Status
in.Trp_SenseDataLen
in.Trp_RespDataLen
in.Trp_LogicalUnitNumber
in.Trp_TaskMngFunc
in.Trp_TagofTasktobeMng
in.Trp_Data
in.Trp_SMPFrameType
in.Trp_Func
in.Trp_AllocRespLen
in.Trp_ReqLength
in.Trp_ReqLength
in.Trp_ReqLength
in.Trp_Ignorezonegroup
in.Trp_PhyId
Note: Follow the same procedure explained in Section 5.2.4 for the remaining
Command/Function/OpCode specific frame members:
27
5.2.8.2.6 Report zone permission table members
28
5.2.8.3 SMP Response Frames members
in.Trp_FuncResult
in.Trp_RespLength
in.Trp_ExpanderChgCount
in.Trp_ExpanderRouteIdx
in.Trp_LongResponse
in.Trp_NumofPhys
in.Trp_Externallyconfigurableroutetable
in.Trp_Config
in.Trp_Configuresothers
in.Trp_OpenRejectRetrySupported
in.Trp_ContinueAWT
in.Trp_SelfConfiguring
in.Trp_ZoneConfiguring
in.Trp_Tabletotablesupported
in.Trp_EnclosureLogicalIdentifier
in.Trp_businactivitytimelimit
in.Trp_maximumconnecttimelimit
in.Trp_SMPI_Tnexuslosstime
in.Trp_Zoningenabled
in.Trp_Zoningsupported
in.Trp_Physicalpresenceasserted
in.Trp_Physicalpresencesupported
in.Trp_ZoneLocked
in.Trp_Numberofzonegroups
in.Trp_Savingzoningenabledsupported
in.Trp_Savingzonepermissiontablesupported
in.Trp_Savingzonephyinformationsupported
.
.
.
And so on
Note: Follow the same procedure explained in Section 5.2.4 for the remaining
Command/Function/OpCode specific frame members:
29
5.2.8.3.1.1.1.9 Report phy SATA members
30
5.2.9 SATA/STP Frame Members
Note: All members return the content of the matching field name ("in.xyz" returns the value of
field "xyz") based on the SATA specification.
in.Trp_D
in.Trp_I
in.Trp_A
in.Trp_DMABufferidLow
in.Trp_DMABufferidHi
in.Trp_DMABufferOffset
in.Trp_DMABufferTransferCount
Note: Follow the same procedure explained in Section 5.2.4 for the remaining
Command/Function/OpCode specific frame members:
31
5.2.10 SCSI Command Frame Members
Note: All members return the content of the matching field name ("in.xyz" returns the value of
field "xyz") based on the SAS specification.
in.App_SourceAddress
in.App_DestinationAddress
in.App_OperationCode
in.App_Control
in.App_TaskAttribute
in.App_Tag
in.App_Status
in.App_LUN
Note: Follow the same procedure explained in Section 5.2.4 for the remaining
Command/Function/OpCode specific frame members:
And so on.
32
5.2.11 ATA Commands Frame Members
Note: All members return the content of the matching field name ("in.xyz" returns the value of
field "xyz") based on the SATA specification.
in.App_SourceSASAddress
in.App_DestinationSASAddress
in.App_Command
in.App_Input
in.App_PMPort
in.App_Protocol
in.App_Status
Note: Follow the same procedure explained in Section 5.2.4 for the remaining
Command/Function/OpCode specific frame members:
And so on.
33
5.2.12 Metrics Fields for SCSI and ATA Commands (ONLY)
Note: All members return the content of the matching field name ("in.xyz" returns the value of
field "xyz") based on the SAS and SATA specification.
in.TrpNo Number of Transports: total number of transports that compose this exchange
Type: integer
in.RespTime Response Time: time it took to transmit this exchange on the link(s)
Type: integer
in.Latency Latency: time measured from the transmission of SCSI/ ATA Command to the first data
transmitted to this SCSI/ ATA IO Operation
in.DataStatTime Data to Status Time: time between end of data transmission for this SCSI/ATA
Command and the status frame
Type: integer
Format: KB/s (multiple by 1024 to get MB/s)
34
5.3 Raw Data field Value
As a general rule for all fields' values, if the field length is less than or equal to 4 bytes (32 bits), it is
returned as an integer value, but if the field length is larger than 4 bytes, it is returned as a raw data
type. If a field has variable size such as LBA, sizeof() must be used to verified the field length.
For example, LBA has variable length that depends on its command and it must be checked like this:
IsGreaterLBA(LeftLBA, RightLBA)
{
# It is a raw data.
If(sizeof(LeftLBA) >4)
{
# This method has been implemented as an example of Raw Data in the following.
Return IsGreaterRawData (LeftLBA, RightLBA);
}
# It is an integer value
return (LeftLBA > RightLBA)
}
The Raw Data is actually a "Raw Bytes" value format which has been defined in the CSL_RefManual
document.
For example:
'FFF' is interpreted as '0FFF'
Raw data field values are stored as Little Endian.
It is stored as
‘8877665544332211’
Here is an example of how to use raw data, which returns a 1 if the first passed RawData is greater
than the second one, otherwise it returns 0:
IsGreaterRawData (LeftRaw, RightRaw)
{
# if both Raw Data are equal
if(LeftRaw == RightRaw)
return 0;
# If size of the Left Raw Data is greater than Right Raw Data, the value is greater too.
if(LeftRawSize > RightRawSize)
return 1;
35
# If the size of the Left Raw Data is less than the Right Raw Data, the value is less too.
if(LeftRawSize < RightRawSize)
return 0;
return 0;
}
36
37
Chapter 6: Verification Script Engine Output
Context Members
All verification scripts have output contexts –special structures whose members are filled by the
script and can be used inside of the application. (For more details about output contexts, refer
to the CATC Script Language(CSL) Manual.) The verification script output contexts have only
one member:
out.Result Result of the whole verification program defined in the verification script
The last two values should be set if you decide that the recorded trace does (or does not)
satisfy the imposed verification conditions. In both cases, the verification script will stop running.
If you do not specify any of those values, the result of script execution is set as
_VERIFICATION_FAILED at exit.
Note: If you do not care about the results of the script that's running, call the function
ScriptForDisplayOnly() once before stopping the script. Then the result will be DONE.
38
Chapter 7: Verification Script Engine Events
VSE defines a large group of trace "events", on packet, link, and split transaction levels, that
can be passed to a verification script for evaluation or for retrieving and displaying some
contained information. The information about the type of event can be seen in in.TraceEvent.
Refer to the topic Sending functions for details about how to specify transaction levels and
which events should be sent to verification scripts.
39
7.1 Frame Level Events
The table below describes the current list of Frame Level events (transaction level 0) and value
of in.TraceEvent:
40
Chapter 8: Declarations
41
8.1 Array Declarations
Scripts can declare an array object.
Parameters
default_value (optional) Default value to fill array, if size is greater than size of source.
Examples
Remarks
Arrays can be iterated using the same syntax as lists (but more efficiently):
Arrays can use the operators sizeof(), first(), more(), next(), prev(), and last().
Therefore, the example array code above can be written:
i = 0;
for( item = first(MyArray); more(MyArray); item = next(MyArray) )
{
ReportText( FormatEx( "MyArray[%d] = %d", i, item ) );
i++;
}
Arrays can grow and change dynamically through the functions: InsertAt, RemoveAt, and
SetAt:
42
InsertAt ( MyArray, 0, 0 ); # [0, 1, 2, 3, 4, 5, 6]
RemoveAt( MyArray, 0 ); # [1, 2, 3, 4, 5, 6]
SetAt( MyArray, 8, 8); # [1, 2, 3, 4, 5, 6, null, 8]
43
8.2 Map Declaration
Scripts can declare a map object.
Parameters
Example 1
set WiNetFrameTable =
Map(
[
#--------------------------------------------------------------------
# Type , Type Name, Full Type name, Color, Decoder function|
#--------------------------------------------------------------------
[0xFFFF, null, null , null, null ],
[0, "DATA", "Standard Data", WN_DATA_COLOR, "ShowWNDataFrame" ],
[1, "ABBR DATA", "Abbreviated Data", WN_ABBR_DATA_COLOR,
"ShowWNAbbrDataFrame" ],
[2, "CONTROL", "Control Frame", WN_CONTROL_COLOR, "ShowCtrlFrame"],
[3, "ASSOC", "Association Frame", WN_ASSOC_COLOR, "ShowAssocFrame"]
]
);
The above example creates a map ( hash-table ) with the following key/value pairs:
key : Value:
0xFFFF : [0xFFFF, null, null ,null, null ]
0 : [0, "DATA", "Standard Data", WN_DATA_COLOR,"ShowWNDataFrame"]
1 : [1, "ABBR DATA", "Abbreviated Data", WN_ABBR_DATA_COLOR,
"ShowWNAbbrDataFrame" ]
2 : [2, "CONTROL", "Control Frame", WN_CONTROL_COLOR,
"ShowCtrlFrame"]
3 : [3, "ASSOC", "Association Frame", WN_ASSOC_COLOR,
"ShowAssocFrame"]
This syntax can transform lists used like maps into map objects in existing scripts.
Example 2
# Example of map having mixed types of keys - both integer and string.
44
# Keys in the map object are : 0, 1, 2, "JoJo", "PaPa"
Remarks
Maps can use the operators sizeof(), first(), more(), and next().
Maps can use the functions IsNull(), IsInt(), IsString(), IsList(), IsArray(), and IsMap().
These functions determine a type of script object inside a script.
45
9.1 SendLevel()
This function specifies that events of the specified transaction level should be sent to the script.
All layers and IDLE filtering are included by the SendLevel(level) method.
Parameters
Example
Remark
If NO level-sending-function was specified, no events will be sent to the script by default, and it
generates an error.
46
9.2 SendLevelOnly()
This function specifies that ONLY events of the specified transaction level should be sent to the
script.
Parameters
level This parameter can be one of the values of the SendLevel() command
(see above).
Example
…
SendLevelOnly( _LINK ); # Send ONLY Link level events.
47
9.3 DontSendLevel()
This function specifies that events of the specified transaction level should NOT be sent to the
script.
Parameters
level This parameter can be one of the values of the SendLevel() command
(see above).
Example
…
DontSendLevel( _LINK ); # DO NOT send Link level events.
48
9.4 SendChannel()
This function specifies that events that have occurred on the specified channel should be sent
to script.
Parameters
Example
…
SendChannel(_I1); # Send events from Channel I1.
Remark
If NO channel-sending-function was specified, no events will be sent to the script by default,
and it generates an error.
49
9.5 SendChannelOnly()
This function specifies that ONLY events that have occurred on the specified channel should be
sent to the script.
Parameters
channel This parameter can be one of the values of the SendChannel() command
(see above).
Example
…
SendChannelOnly( _I1 ); # Send ONLY events from Channel I1.
50
9.6 DontSendChannel()
This function specifies that events that have occurred on the specified channel should NOT be
sent to the script.
Parameters
channel This parameter can be one of the values of the SendChannel() command
(see above).
Example
…
DontSendChannel ( _I1 ); # DO NOT send events from Channel I1.
51
9.7 SendAllChannels()
This function specifies to send all events with any channel.
.
Format : SendAllChannels ()
Example
…
SendAllChannels (); # Send events from ALL channels.
52
9.8 SendTraceEvent()
This function specifies the events to be sent to the script.
Parameters
event Refer to Verification Script Engine Events for all possible values.
Example
…
SendTraceEvent( _FRM_AF_OPEN );
53
9.9 DontSendTraceEvent()
This function specifies that the event specified in this function should not be sent to script.
Parameters
Example
…
if( SomeCondition )
{
DontSendTraceEvent( _FRM_AF_OPEN );
}
54
9.10 SendTraceEventOnly()
This function specifies that ONLY the event specified in this function will be sent to the script.
Parameters
Remark
This function may be useful when many events are to be sent, yet you need to send only one
kind of event and turn off the rest.
Example
…
if( SomeCondition )
{
SendTraceEventOnly (_FRM_AF_OPEN );
}
55
9.11 SendAllTraceEvents()
This function specifies that ALL trace events relevant for the selected transaction level will be
sent to the script.
Format : SendAllTraceEvents ()
Example
…
SendAllTraceEvents ( );
56
9.12 SendProtocolError()
This function specifies that a selected Protocol Error event be sent to the script along with any
other events (if sent any already)
Parameters
_ANY
OOB_SEQUENCE_ERROR
SYMBOL_VIOLATION_ERROR
DISPARITY_ERROR
ALIGN_NOTIFY_ERROR
STP_SIGNALING_LATENCY_ERROR
STP_UNEXPECTED_PRIMITIVE_ERROR
STP_PRIMITIVE_RESPONSE_TIMEOUT_ERROR
FRAME_TYPE_ERROR
FRAME_LENGTH_ERROR
FRAME_DIRECTION_ERROR
CRC_ERROR
ACK_NAK_TIMEPOT_ERROR
Example
…
SendProtocolErrorOnly( OOB_SEQUENCE_ERROR );
SendProtocolError ( CRC_ERROR );
# This sends OOB_Sequence_Error events and CRC_Error events
# only
57
9.13 SendProtocolErrorOnly()
This function specifies that ONLY the selected Protocol Error event to be sent to the script and
no other events to be sent.
Format : SendProtocolError(PError)
Parameters
Protocol Error Possible values are the same as for SendProtocolError() (see above).
Example
…
SendProtocolErrorOnly( OOB_SEQUENCE_ERROR );
# This sends OOB_Sequence_Error events only.
Remark
If you send two or more events using SendProtocolErrorOnly(), then only the later
function call will be sent to the script. Previous calls will be ignored. For example:
SendProtocolErrorOnly(CRC_ERROR);
SendProtocolErrorOnly(OOB_SEQUENCE_ERROR);.
Then only OOB-Sequence_Error events will be sent to the script.
58
9.14 DontSendProtocolError()
This function specifies NOT to send the selected Protocol Error event to the Verification script.
Parameters
Protocol Error Possible values are the same as for SendProtocolError() (see above).
Example
…
SendAllProtocolError();
DontSendProtocolError ( CRC_ERROR );
# Sends all protocol error events except CRC_Error Events.
59
9.15 SendPairSASAddress()
This function specifies a selected Pair SAS Address event to send to the script, along with any
other events specified/sent before this.
Parameters
_ANY
'5000C500001047B5'
'5000E85000000001'
'5000C50000103D91'
… and so on
Example
…
SendPairSASAddressOnly ('5000E85000000001', '5000C50000103D91');
SendPairSASAddress ('5000C500001047B5', '5000C50000103D91');
# This sends Pair-1 & Pair-2 SAS Address events only.
60
9.16 SendPairSASAddressOnly()
This function specifies that ONLY the selected Pair-SAS-Address event be sent to the script,
and no other events be sent.
Parameters
Source SAS Address [ format: raw data ] See SendPairSASAddress() above.
Destination SAS Address [ format: raw data ]
Example
…
SendPairSASAddressOnly ('5000E85000000001', '5000C50000103D91');
# Send only events with the above specified SAS Address Pair.
Remark
If you send two or more events using SendPairSASAddressOnly(), then only the later
function call will be sent to the script. Previous calls will be ignored. For example,
SendPairSASAddressOnly('5000E85000000001', '5000C50000103D91');
# Pair – 1
SendPairSASAddressOnly('500062B000001074', '50060560000003C4');
# Pair – 2
Then only Pair-2 events will be sent to the script.
61
9.17 DontSendPairSASAddress()
This function specifies NOT to send a selected Pair-SAS-Address event to the script.
Parameters
Source SAS Address [ format: raw data ] See SendPairSASAddress() above.
Destination SAS Address [ format: raw data ]
Example
…
SendAllPairSASAddress();
DontSendPairSASAddress('5000C500001047B5', '5000C50000103D91');
# This sends all events to the script except the one with a pair
# SAS address mentioned inside DontSendPairSASAddress()
62
9.18 SendAllPairSASAddress()
This function specifies to send events with all possible combinations of the above specified set
of SAS Addresses.
Format : SendAllPairSASAddress()
Example
…
SendAllPairSASAddress();
63
9.19 SendPrimitive()
This function specifies to send a selected Primitive event to the script for verification.
Parameters
PRIM_CODE_ERROR
PRIM_CODE_AIP_NORMAL
(For a complete list of Primitive Codes, refer to Appendix-A.
Example
…
SendPrimitive(PRIM_CODE_DONE_NORMAL);
# Sends all Done-Normal Primitive event.
64
9.20 SendSSPTransport()
This function specifies to send a selected SSP Transport event to the script.
Parameters
Field Name String form of any particular field name of the frame.
For example: “Tag” / “HashedDestSASAddr”
(Field names should be WITHOUT SPACES.
NO need to Prefix or Suffix the field name with any of event or
level-specific keywords, such as Trp_, Lnk_, or App_.)
Nexus Info Information about source and destination SAS address and Tag/Port.
according to the command types
Structure is:
[Source SAS Address, Destination SAS Address, Tag/ Port]
All fields are optional subject to usage of succeeding fields.
For example:
To set a value for destination address alone, set source
address value to _ANY.
To set only Tag/Port value, set preceding fields (Source SAS Address
and Destination SAS Address) to _ANY.
Tag / Port Use Tag value only for SCSI Commands/SSP Frames
Use Port value only for ATA Commands/STP Frames
65
Example
…
SendSSPTransport (SSP_FRAME_TYPE_XFER_RDY);
66
9.21 SendSTPTransport()
This function specifies to send a selected STP Transport event to the script.
Parameters
Example
…
SendSTPTransport (STP_FIS_TYPE_DATA);
67
9.22 SendSMPTransport()
This function specifies to send a selected SMP Transport event to the script.
Parameters
Example
…
SendSMPTransport (SMP_FRAME_TYPE_REQUEST);
68
69
9.23 SendSCSICommand()
This function specifies to send a selected SCSI Command event to the script.
Parameters
ServiceAction: Service Action of the SCSI Command event. The Value combines with
the OpCode value and results in the formation of different
combinations of SCSI Commands.
OpCode + Service Action Value-1 = SCSI Command-1
OpCode + Service Action Value-2 = SCSI Command-2
Example:
0xA3 + 0x10 = MANAGEMENT_PROTOCOL_IN
0xA3 + 0x0E = REPORT_PRIORITY
0xA3 + 0x0F = REPORT_TIME_STAMP
Example
…
SendSCSICommand (_ANY);
70
9.24 SendATACommand()
This function specifies to send a selected ATA Command event to the script.
Format : SendATACommand( Command, Feature, Field Name, Field Value, Nexus Info);
Parameters
Example
…
SendATACommand (_ANY);
71
9.25 SendSMPCommand()
This function specifies to send a selected SMP Command event to the script.
Parameters
Example
…
SendSMPCommand (_ANY);
72
9.26 SendTaskMgmCommand()
This function specifies to send a selected Task Management Command event to the script.
Parameters
Example
…
SendTaskMgmCommand (_ANY);
73
Chapter 10: Time Construction Functions
This group of functions constructs VSE time objects.
74
10.1 Time()
Constructs a verification script time object.
Format : Time(nanoseconds)
Time(seconds, nanoseconds)
Return values
First function returns [0, nanoseconds], and second returns [seconds, nanoseconds].
Parameters
Example
75
Chapter 11: Timer Functions
This group of functions covers VSE capability to work with timers –-- internal routines that
repeatedly measure a timing intervals between different events.
Using VSE Timer Functions is a stage-by-stage process of 'Set the Timer', followed by
'Get the Timer Time' and finally 'Kill the Timer'. All three stages are interdependent on each
other using a unique timer identifier, which can be any user-defined positive integer.
Prototypes for each of the functions, along with their corresponding usage explanations, are
provided below.
76
11.1 SetTimer()
Sets/starts timer for timing calculation from the event where this function was called.
Parameter
Example
Remark
If this function is called a second time with the same timer id, it resets the timer and starts
timing calculations again from the point where it was called.
77
11.2 GetTimerTime()
Calculates and returns the timing interval (VSE Time object) between the Time-at SetTimer()
and Current Time. For example, if
T1 is the time when SetTimer(<timer_id>) is being called for an event; and
T2 is the current time when GetTimerTime(<timer_id>) is called.
Then
T = T2 – T1 is the timing interval returned by the GetTimerTime(<timer_id>) function, where T
is of type VSE Time object, which can be converted into a string using the TimeToText()
function (refer to Chapter 13 for detailed explanation).
Parameters
Return value
Example
Remark
78
11.3 KillTimer()
Kills/stops a specific running Timer (with Timer-ID = <timer_id> used by SetTimer()) and frees
its corresponding resources.
Parameter
Example
79
12.1 AddTime()
Adds two VSE time objects.
Return values
Returns VSE time object representing the time interval equal to the sum of time_1 and time_2.
Parameters
Example
80
12.2 SubtractTime()
Subtracts two VSE time objects.
Return values
Returns VSE time object representing the time interval equal to the difference between time_1
and time_2.
Parameters
Example
81
82
12.3 MulTimeByInt()
Multiplies VSE time object by integer value.
Return values
Returns VSE time object representing the time interval equal to the product of time * mult.
Parameters
Example
83
12.4 DivTimeByInt()
Divides VSE time object by integer value.
Return values
Returns VSE time object representing the time interval equal to the quotient of time / div.
Parameters
Example
84
Chapter 13: Time Logical Functions
This group of functions covers VSE capability to compare VSE time objects.
85
13.1 IsEqualTime()
Verifies whether one VSE time object is equal to the other VSE time object.
Return values
Parameters
Example
t1 = Time(100); t2 = Time(500);
If( IsEqualTime( t1, t2 ) ) DoSomething();
86
13.2 IsLessTime()
Verifies whether or not one VSE time object is less than the other VSE time object
Return values
Parameters
Example
t1 = Time(100); t2 = Time(500);
If( IsLessTime ( t1, t2 ) ) DoSomething();
87
88
13.3 IsGreaterTime()
Verifies whether or not one VSE time object is greater than the other VSE time object.
Return values
Parameters
Example
t1 = Time(100); t2 = Time(500);
If( IsGreaterTime ( t1, t2 ) ) DoSomething();
89
13.4 IsTimeInInterval()
Verifies that a VSE time object is greater than some VSE time object and less than the other
VSE time object.
Return values
Parameters
Example
t1 = Time(100);
t = Time(400);
t2 = Time(500);
If( IsTimeInInterval ( t1, t, t2 ) ) DoSomething();
90
Chapter 14: Time Text Functions
This group of functions covers VSE capability to convert VSE time objects into text strings.
91
14.1 TimeToText()
Converts a VSE time object into text.
Return values
Parameters
Example
t = Time(100);
ReportText( TimeToText( t ) ); # See ReportText() function below.
92
Chapter 15: Output Functions
This group of functions covers VSE capability to Enable, Disable, and Display of
information/results in the output window.
93
15.1 EnableOutput()
Enables showing information in the output window and sending COM reporting notifications to
COM clients.
Format : EnableOutput ()
Example
EnableOutput ( );
94
15.2 DisableOutput()
Disables showing information in the output window and sending COM reporting notifications to
COM clients.
Format : DisableOutput ()
Example
DisableOutput ();
95
15.3 ReportText()
Reports/Displays textual information in the output window of verification script engine.
Parameters
Example
…
ReportText ( "Some text" );
…
t = "Some text"
ReportText ( t );
…
num_of_frames = in.NumOfFrames;
text = Format( "Number of frames : %d", num_of_frames );
ReportText ( text );
…
x = 0xAAAA;
y = 0xBBBB;
text = FormatEx( "x = 0x%04X, y = 0x%04X", x, y );
ReportText( "Text : " + text );
…
96
Chapter 16: Information Functions
97
16.1 GetTraceName()
This function returns the filename of the trace file being processed by VSE.
If the script is being run over a multi-segmented trace, this function returns the path to the
current segment being processed.
Parameters
filepath_compatible If this parameter is present and not equal to 0, the returned value
may be used as part of the filename.
Example
98
16.2 GetScriptName()
This function returns the name of the verification script where this function is called.
Format : GetScriptName()
Example
99
16.3 GetApplicationFolder()
This function returns the full path of the folder where the SASSuite/SATASuite application was
started.
Format : GetApplicationFolder()
Example
ReportText( "SASTracer folder : " + GetApplicationFolder () );
100
101
16.4 GetCurrentTime()
This function returns the string representation of the current system time.
Format : GetCurrentTime()
Example
102
16.5 GetEventSegNumber()
If a multi-segmented trace is being processed, this function returns the index of the segment for
the current event.
Note: When a multi-segmented trace file (extension *.smt or *.smat) is processed by VSE,
different trace events in different segments of the same trace file may have the same indexes
(value stored in in.Index input context members), but they will have different segment numbers.
Format : GetEventSegNumber()
Example
103
16.6 GetTriggerPacketNumber()
This function returns the index of a link packet for which a Trigger was set. In case no trigger
event was recorded in the trace, a value of 0xFFFFFFFF is returned.
Format : GetTriggerPacketNumber()
Example
104
105
16.7 GetTraceStartPacketTime()
This function returns time stamp of the first packet in trace file.
Format : GetTriggerPacketNumber()
Return Value
Time = GetTraceStartPacketTime();
ReportText(GetFullTimestamp(Time)); #print time stamp
106
16.8 GetTraceEndtPacketTime()
This function returns time stamp of the last packet in trace file.
Format : GetTriggerPacketNumber()
Return Value
Time = GetTraceEndPacketTime();
ReportText(GetFullTimestamp(Time)); #print time stamp
107
Chapter 17: Navigation Functions
108
17.1 GotoEvent()
This function forces the application to jump to some trace event and show it in the main trace
view.
Parameters
Remarks
If no parameters were specified, the application will jump to the current event being processed
by VSE.
The segment parameter is used only when the verification script is running over a
multi-segmented trace (extensions: *.smt, *.samt). For regular traces, it is ignored.
If wrong parameters were specified (such as an index exceeding the maximum index for the
specified transaction level), the function will do nothing, and an error message will be sent to
the output window.
Example
…
if( Something == interesting ) GotoEvent(); # Go to the current event.
…
if( SomeCondition )
{
interesting_segment = GetEventSegNumber();
interesting_level = in.Level;
interesting_index = in.Index;
}
…
OnFinishScript()
{
…
# Go to the interesting event.
GotoEvent( interesting_level, interesting_index,
interesting_segment );
}
109
110
17.2 SetMarker()
This function sets a marker (bookmark) for some trace event.
Parameters
Remarks
If no parameters were specified, other than marker_text, the application sets a marker to the
current event being processed by VSE.
The segment parameter is used only when a verification script is running over a
multi-segmented trace (extensions: *.smt, *.samt). For regular traces, it is ignored.
If wrong parameters were specified (such as an index exceeding the maximum index for a
specified transaction level), the function will do nothing, and an error message will be sent to
the output window.
Example
…
# Set marker to the current event.
if( Something == interesting ) SetMarker( "!!! Something cool !!!" );
…
if( SomeCondition )
{
interesting_segment = GetEventSegNumber();
interesting_level = in.Level;
interesting_index = in.Index;
}
…
OnFinishScript()
{
…
# Set marker to the interesting event.
SetMarker( " !!! Cool Marker !!! ", interesting_level,
interesting_index, interesting_segment );
111
Chapter 18: File Functions
This group of functions covers VSE capabilities to work with the external files.
112
18.1 OpenFile()
This function opens a read-write file for writing or appending content.
Parameters
file_path Full path of the file to open (for '\' use '\\')
If the path is not specified, the file is in the USER folder.
file_creation_type _FC_RW_CREATE
Writes new content to the file by replacing the previous content.
Note: _FC_RW_CREATE ERASEs the file content (if any)
while it is opening.
_FC_RW_APPEND
Appends/adds new content at the end of the previous file
content without replacing the same.
Return Values
The "handle" to the file to be used in other file functions.
Example
…
set file_handle = 0;
113
18.2 WriteString()
This function writes a text string to the file.
Parameters
Example
…
set file_handle = 0;
…
file_handle = OpenFile( "D:\\Log.txt" ); # Opens file.
# The previous contents are erased.
…
WriteString( file_handle, "Some Text1" ); # Write text string to file.
WriteString( file_handle, "Some Text2" ); # Write text string to file.
…
CloseFile( file_handle ); # Closes file.
…
114
18.3 CloseFile()
This function closes an opened file.
Parameters
Example
…
set file_handle = 0;
…
file_handle = OpenFile( "D:\\Log.txt" ); # Opens file.
# The previous contents are erased.
…
WriteString( file_handle, "Some Text1" ); # Write text string to file.
WriteString( file_handle, "Some Text2" ); # Write text string to file.
…
CloseFile( file_handle ); # Closes file.
…
115
116
18.4 WriteBin ()
This function writes content to a binary file.
Parameters
bin_file_handle File handle for the binary file (only opened using
_FO_BINARY), to which the contents are to be written.
variable Any variable type (integer, string, list, and raw string)
Return Value
_BF_RW_OK Read/Write binary returns succesfully
_BF_RW_INVALID_HANDLE (1) Invalid File Handle
_BR_RW_INALID_VALUE Invalid Value
Example
…
# Opens file in binary mode with _CREATE functionality.
bin_file_handle = OpenFile("Sample.bin", _FC_RW_CREATE,
_FO_BINARY );
…
raw_data = '00112233445566778899AABBCCDD';
list_val = ["one", 2, "three", [4, [5, [6]]]];
117
18.5 ReadBin ()
This function reads content from a binary file.
Case 2: Reading the just-written content from an already opened binary file.
The file might have already been opened in CREATE or APPEND mode (to write the content),
so to read the written content, use the SeekToBegin() function, as explained in case 1 above,
and start reading sequentially.
Before reading a binary file, you should know the content inside the file in terms of its order of
data types. The ReadBin function should be called in the exact sequence of the WriteBin
function. (Refer to the example of WriteBin() to compare the sequence of data read/write
from/to file.)
Parameters
bin_file_handle File handle for the binary file (only opened using _FO_BINARY)
from which the contents are to be read.
Note: Opening the file in _FC_RW_CREATE mode erases
content (if any) of the file.
Return Value
Content of the opened binary file, which can be any data type
(integer, string, raw data, and so on).
118
Example
# This example demonstrates CASE 1, how to open and read data.
# Opens file in binary mode with _APPEND functionality,
# to read data.
bin_file_handle = OpenFile("Sample.bin", _FC_RW_APPEND,
_FO_BINARY );
…
# Start reading from beginning of file.
SeekToBegin( bin_file_handle );
# "Some Text1"
string_val = ReadBin( bin_file_handle);
# 0x1234ABCD
integer_val= ReadBin( bin_file_handle);
# '00112233445566778899AABBCCDD'
raw_data = ReadBin( bin_file_handle,);
# ["one", 2, "three", [4, [5, [6]]]]
list_val = ReadBin( bin_file_handle);
…
CloseFile( bin_file_handle ); # Closes file.
……………………………………………………………………………………………………………………………………………………………………
# "Some Text1"
string_val = ReadBin( bin_file_handle);
# 0x1234ABCD
integer_val= ReadBin( bin_file_handle);
# '00112233445566778899AABBCCDD'
raw_data1 = ReadBin( bin_file_handle,);
# ["one", 2, "three", [4, [5, [6]]]]
list_val1 = ReadBin( bin_file_handle);
…
CloseFile( bin_file_handle ); # Closes file.
119
18.6 SeekToBegin ()
This function seeks the file read-write pointer from current position to the BEGIN of the file.
Format : SeekToBegin(file_handle )
Parameters
file_handle Handle of the file (Text or Binary) on which the
Seek funcitonality has to be performed
Example
…
SeekToBegin (file_handle);
…
120
18.7 SeekToEnd()
This function seeks the file read-write pointer from current position to the END of the file.
Format : SeekToEnd(file_handle )
Parameters
file_handle Handle of the file (Text or Binary) on which the Seek
funcitonality has to be performed
Example
…
SeekToEnd (file_handle);
…
121
18.8 ShowInBrowser()
This function allows you to open a file in the Windows Explorer. If the extension of the file has
the application registered to open files with such extensions, it will launch.
For example, if Internet Explorer is registered to open files with extension *.htm, and the file
handle passed to the ShowInBrowser() function belongs to a file with such an extension, this
file opens in Internet Explorer.
Parameters
Example
…
set html_file = 0;
…
html_file = OpenFile( "D:\\Log.htm" );
…
WriteString( html_file, "<html><head><title>LOG</title></head>" );
WriteString( html_file, "<body>" );
…
WriteString( html_file, "</body></html>" );
ShowInBrowser( html_file ); # Opens the file in Internet Explorer.
CloseFile( html_file );
…
122
Chapter 19: COM/Automation Communication
Functions
This group of functions covers VSE capabilities to communicate with COM/Automation clients
connected to the SASSuite/SATASuite application. (Refer to the SASSuite/SATASuite
Automation manual for the details on how to connect to the SASSuite/SATASuite application
and VSE.)
123
19.1 NotifyClient()
This function allows you to send information to COM/Automation client applications in a custom
format. The client application will receive a VARIANT object, which it is supposed to parse.
Parameters
Example
…
if( SomeCondition() )
{
NotifyClient( 2, [ in.Index, in.Level,
TimeToText( in.Time )] );
}
…
# Here we sent 2 parameters to client applications :
# 2 ( integer ) and
# [ in.Index, in.Level, TimeToText( in.Time )] ( list )
Remark
See an example of handling this notification by client applications and parsing code in the
SASSuite/SATASuite Automation document.
124
Chapter 20: User Input Functions
125
20.1 MsgBox()
Displays a dialog-based message in a dialog box, waits for the user to click a button, and
returns an Integer indicating which button the user clicked.
Parameters
prompt Required. String expression displayed as the message in the dialog box.
type Optional. Numeric expression that is the sum of values specifying the number
and type of buttons to display, the icon style to use, the identity of the default
button, and the modality of the message box.
If omitted, the default value for buttons is _MB_OK.
(See the list of possible values in the table below.)
title Optional. String expression displayed in the title bar of the dialog box.
If you omit the title, the script name is placed in the title bar.
Return Values
This function returns an integer value indicating which button the user clicked.
Constant Description
126
_MB_OK OK button was clicked.
_MB_CANCEL Cancel button was clicked.
_MB_YES Yes button was clicked.
_MB_NO No button was clicked.
_MB_RETRY Retry button was clicked.
_MB_IGNORE Ignore button was clicked.
_MB_ABORT Abort button was clicked.
Remark
This function works only for VS Engines controlled via the GUI. For VSEs controlled by
COM/Automation clients, it does nothing.
This function "locks" the SASSuite/SATASuite application, which means that there is no access
to other application features until the dialog box is closed. In order to prevent too many MsgBox
calls, in the case of a script not written correctly, VSE keeps track of all function calls
demanding user interaction and does not show dialog boxes if a customizable dialog limit was
exceeded (and returns _MB_OK in this case).
Example
…
if( Something )
{
…
str = "Something happened!!!\nShould we continue?"
result = MsgBox( str , _MB_YESNOCANCEL | _MB_EXCLAMATION,
"Some Title" );
127
20.2 InputBox()
Displays a dialog-based input prompt in a dialog box, waits for the user to input text or click a
button, and returns a CSL list object (see the CSL Manual for details about list objects) or a
string containing the contents of the text box.
Parameters
prompt Required. String expression displayed as the message in the dialog box.
title Optional. String expression displayed in the title bar of the dialog box.
If you omit the title, the script name is placed in the title bar.
default_text Optional. String expression displayed in the text box as the default
response if no other input is provided.
If you omit default_text, the text box is displayed empty.
Return Values
Depending upon the return_type argument, this function returns either a CSL list object or the
text typed in the text box.
In case of return_type = _IB_LIST (by default), the text in the text box is considered as a set
of list items delimited by ',' (only hexadecimal, decimal, and string items are currently
supported).
Text example
Note: Although the dialog box input text parser tries to determine a type of list item
automatically, a text enclosed in quote signs "" is always considered a string.
128
Remark
This function works only for VS Engines controlled via the GUI. For VSEs controlled by
COM/Automation clients, it does nothing.
This function "locks" the SASSuite/SATASuite application, which means that there is no access
to other application features until the dialog box is closed. In order to prevent too many
InputBox calls, in the case of a script not written correctly, VSE keeps track of all function calls
demanding user interaction and does not show dialog boxes if a customizable limit was
exceeded (and returns null object in that case).
Example
…
if( Something )
{
…
v = InputBox( "Enter the list", "Some stuff", "Hello world !!!,
0x12AAA, Some, 34" );
ReportText ( FormatEx( "input = %s, 0x%X, %s, %d", v[0], v[1], v[2],
v[3] ) );
… # Go on…
129
20.3 GetUserDlgLimit()
This function returns the current limit of user dialogs (message box or input box) allowed in the
verification script. If the script reaches this limit, no user dialogs will be shown, and the script
will not stop. By default, this limit is set to 20.
Format : GetUserDlgLimit()
Example
…
result = MsgBox( Format( "UserDlgLimit = %d", GetUserDlgLimit() ),
_MB_OKCANCEL | _MB_EXCLAMATION, "Some Title !!!" );
130
20.4 SetUserDlgLimit()
This function sets the current limit of user dialogs allowed in the verification script. If the script
reaches this limit, no user dialogs will pop up, and script will continue with its next instruction
statement. By default, this limit is set to 20.
Format : SetUserDlgLimit()
Example
…
result = MsgBox( Format( "UserDlgLimit = %d", GetUserDlgLimit() ),
_MB_OKCANCEL | _MB_EXCLAMATION, "Some Title !!!" );
131
Chapter 21: String Manipulation/Formatting
Functions
132
21.1 FormatEx()
This function writes formatted data to a string. FormatEx() controls the way that arguments
print. The format string may contain conversion specifications that affect the way in which the
arguments in the value string are returned. Format conversion characters, flag characters, and
field-width modifiers define the conversion specifications.
Parameters
Return Values
Formatted string.
Conversion Characters
Remark
A conversion specification begins with a percent sign (%) and ends with a conversion
character. The following optional items can be included, in order, between the % and the
conversion character, to further control argument formatting:
Flag characters are used to further specify the formatting. There are five flag characters:
133
• A minus sign (-) causes an argument to be left-aligned in its field. Without the minus sign,
the default position of the argument is right-aligned.
• A plus sign (+) inserts a plus sign before a positive signed integer. This only works with the
conversion characters d and i.
• A space inserts a space before a positive signed integer. This only works with the
conversion characters d and i. If both a space and a plus sign are used, the space flag is
ignored.
• A hash mark (#) prepends a 0 to an octal number when used with the conversion character
o. If # is used with x or X, it prepends 0x or 0X to a hexadecimal number.
• A zero (0) pads the field with zeros instead of with spaces.
Field width specification is a positive integer that defines the field width, in spaces, of the
converted argument. If the number of characters in the argument is smaller than the field width,
then the field is padded with spaces. If the argument has more characters than the field width
has spaces, then the field will expand to accommodate the argument.
Example
str = "String";
i = 12;
hex_i = 0xAABBCCDD;
…
formatted_str = FormatEx( "%s, %d, 0x%08X", str, i, hex_i );
134
21.2 Left(), Right(), and Mid()
The Left(), Right(), and Mid() functions extract substrings.
Format : Left ( )
Right ( )
Mid ( )
135
21.3 Get and Set Characters in Strings
You can set and get characters at positions in CSL-script-file string objects.
Parameter
Example
136
Chapter 22: Miscellaneous Functions
137
22.1 ScriptForDisplayOnly()
This function specifies that the script is designed for displaying information only and that its
author does not care about the verification script result. Such a script has a result of DONE
after execution.
Format : ScriptForDisplayOnly ()
Example
ScriptForDisplayOnly();
#Use this function call anywhere in the OnStartScript() function.
138
22.2 Sleep()
This function asks VSE not to send any events to a script until the timestamp of the next event
is greater than the timestamp of the current event plus sleeping time.
Parameters
time VSE time object specifying sleep time
Example
Sleep ( Time(1000) ); # Don't send any event occurred during 1 ms
# from the current event.
139
22.3 ConvertToHTML()
This function replaces spaces with " " and carriage return symbols with "<br>" in a text
string.
Parameters
text_string Text string
Example
str = "Hello world !!!\n";
str += "How are you today?";
Note: Some other useful miscellaneous functions can be found in the file VSTools.inc.
140
22.4 Pause()
Pauses a running script. Later, script execution can be resumed or cancelled.
Format : Pause()
Example
…
If( Something_Interesting() )
{
GotoEvent(); # Jump to the trace view.
Pause(); # Pause script execution.
}
…
Remark
This function works only for VS Engine controlled via a GUI. For VSEs controlled by
COM/Automation clients, it does nothing.
When script execution is paused, the Run Verification Script window looks like:
141
22.5 GetPacketData()
This function returns packet's data in unscramble 8 bits format as a list of DWORDs. Each item
of the list includes one DWORD of packet. It also returns 0xFFFFFFFF for XXXX.
Format : GetPacketData();
Example
ListOfData = GetPacketData();
for(i=0;i<sizeof(ListOfData);i++)
ReportText(FormatEx("[%d]=0x%x\t", i, ListOfData[i]));
142
22.6 FormatRawBytes(RawBytes)
To convert any raw data field to a string. It is a utility method in VSTools.inc file, which can be
included and used.
Format : FormatRawBytes(RawBytes)
Parameters
Return Values
Example
143
22.7 SetMaximumIterations
It is used to change maximum number of iterations that can be executed by “for” and “while”
loops. Its default value is 200000 iterations.
Format : SetMaximumIterations(max_iteration)
Parameters
Example
144
Chapter 23: The VSE Important Script Files
The VSE working files are located in the ..\SASVFScripts or ..\SATAVFScripts subfolder of
the main SAS Protocol Suite or SATA Protocol Suite folder. The current version of VSE
includes the following files:
File Description
VSTools.inc Main VSE file containing definitions of some generic and
SAS/SATA-specific VSE script functions provided by Teledyne
LeCroy (must be included in every script).
NOTE: The files VS_constants.inc and VS_Primitives.inc are
included.
VS_constants.inc File containing definitions of some important generic and
SAS/SATA-specific VSE global constants
VSTemplate.sasv_ Template file for new verification scripts.
VSUser_globals.inc File of user global variable and constant definitions (In this file, it
is useful to enter definitions of constants, variables, and functions
to be used in many scripts you write.)
VS_OOB.inc OOB definitions and utilities
VS_Primitives.inc Primitives definitions and utilities
VS_SMPFrames.inc SMP Frames definitions and utilities
VS_SSPFrames.inc SSP Frames definitions and utilities
VS_STPFrames.inc STP Frames definitions and utilities
VS_AddressFrames.inc Address Frames definitions and utilities
VS_ATACommands.inc ATA Commands definitions and utilities
VS_SCSICommands.inc SCSI Commands definitions
145
23.1 Example Script Files
The VSE example files are located in the ..\SASVFScripts\Examples or
..\SATAVFScripts\Examples subfolder of the main SAS Protocol Suite or SATA Protocol Suite
folder. The current version of VSE includes the following files:
File Description
sample_ata_commands.sasvs Sample script that explains how to handle ATA
command events
sample_ssp_protocol.sasvs Sample script that explains how to manage SSP
Protocol event Information
SMP_DiscoverAndReporTracking.sasvs Sample script that outputs SMP Functional
specific information
SampleViewer_ALL.sasvs Sample script to output all trace events
sample_event_count.sasvs Sample script to show how count number of
events for a category, sub-category and their
corresponding fields
TimeLogicalFunc.sasvs Sample script that shows how to work with Time
Logical functions of VSE
ProtocolError.sasvs Sample script to detect protocol errors
146
147
Appendix A – Primitive Codes
PRIM_CODE_ERROR
PRIM_CODE_AIP_NORMAL
PRIM_CODE_AIP_RESERVED_0
PRIM_CODE_AIP_RESERVED_1
PRIM_CODE_AIP_RESERVED_2
PRIM_CODE_AIP_RESERVED_WAITING_ON_PARTIAL
PRIM_CODE_AIP_WAITING_ON_CONNECTION
PRIM_CODE_AIP_WAITING_ON_DEVICE
PRIM_CODE_AIP_WAITING_ON_PARTIAL
PRIM_CODE_BROADCAST_CHANGE
PRIM_CODE_BROADCAST_SES
PRIM_CODE_BROADCAST_EXPANDER
PRIM_CODE_BROADCAST_ASYNC_EVENT
PRIM_CODE_BROADCAST_RESERVED_3
PRIM_CODE_BROADCAST_RESERVED_4
PRIM_CODE_BROADCAST_RESERVED_CHANGE_0
PRIM_CODE_BROADCAST_RESERVED_CHANGE_1
PRIM_CODE_CLOSE_CLEAR_AFFILIATION
PRIM_CODE_CLOSE_NORMAL
PRIM_CODE_CLOSE_RESERVED_0
PRIM_CODE_CLOSE_RESERVED_1
PRIM_CODE_HARD_RESET
PRIM_CODE_OOB_IDLE
PRIM_CODE_OPEN_REJECT_BAD_DESTINATION
PRIM_CODE_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED
PRIM_CODE_OPEN_REJECT_NO_DESTINATION
PRIM_CODE_OPEN_REJECT_PATHWAY_BLOCKED
PRIM_CODE_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED
PRIM_CODE_OPEN_REJECT_ZONING_VIOLATION
PRIM_CODE_OPEN_REJECT_RESERVED_ABANDON_1
PRIM_CODE_OPEN_REJECT_RESERVED_ABANDON_2
PRIM_CODE_OPEN_REJECT_RESERVED_ABANDON_3
PRIM_CODE_OPEN_REJECT_RESERVED_CONTINUE_0
PRIM_CODE_OPEN_REJECT_RESERVED_CONTINUE_1
PRIM_CODE_OPEN_REJECT_RESERVED_INITIALIZE_0
PRIM_CODE_OPEN_REJECT_RESERVED_INITIALIZE_1
PRIM_CODE_OPEN_REJECT_RESERVED_STOP_0
PRIM_CODE_OPEN_REJECT_RESERVED_STOP_1
PRIM_CODE_OPEN_REJECT_RETRY
PRIM_CODE_OPEN_REJECT_STP_RESOURCES_BUSY
PRIM_CODE_OPEN_REJECT_WRONG_DESTINATION
PRIM_CODE_OPEN_ACCEPT
PRIM_CODE_ACK
PRIM_CODE_CREDIT_BLOCKED
PRIM_CODE_DONE_ACK_NAK_TIMEOUT
PRIM_CODE_DONE_CREDIT_TIMEOUT
PRIM_CODE_DONE_NORMAL
PRIM_CODE_DONE_RESERVED_0
PRIM_CODE_DONE_CLOSE
PRIM_CODE_DONE_RESERVED_TIMEOUT_0
PRIM_CODE_DONE_RESERVED_TIMEOUT_1
PRIM_CODE_NAK_CRC_ERROR
PRIM_CODE_NAK_RESERVED_0
PRIM_CODE_NAK_RESERVED_1
PRIM_CODE_NAK_RESERVED_2
148
PRIM_CODE_RRDY_NORMAL
PRIM_CODE_RRDY_RESERVED_0
PRIM_CODE_RRDY_CLOSE
PRIM_CODE_NOTIFY_ENABLE_SPINUP
PRIM_CODE_NOTIFY_POWER_FAILURE_EXPECTED
PRIM_CODE_NOTIFY_RESERVED_1
PRIM_CODE_NOTIFY_RESERVED_2
PRIM_CODE_BREAK
PRIM_CODE_BREAK_REPLY
PRIM_CODE_TRAIN
PRIM_CODE_TRAIN_DONE
PRIM_CODE_MUX_0
PRIM_CODE_MUX_1
PRIM_CODE_PS_REQ_PARTIAL
PRIM_CODE_PS_REQ_SLUMBER
PRIM_CODE_PS_ACK
PRIM_CODE_PS_NAK
PRIM_CODE_SATA_SOF
PRIM_CODE_SATA_EOF
PRIM_CODE_SATA_CONT
PRIM_CODE_SATA_DMAT
PRIM_CODE_SATA_HOLD
PRIM_CODE_SATA_HOLDA
PRIM_CODE_SATA_PMACK
PRIM_CODE_SATA_PMNAK
PRIM_CODE_SATA_PMREQ_P
PRIM_CODE_SATA_PMREQ_S
PRIM_CODE_SATA_R_ERR
PRIM_CODE_SATA_R_IP
PRIM_CODE_SATA_R_OK
PRIM_CODE_SATA_R_RDY
PRIM_CODE_SATA_SYNC
PRIM_CODE_SATA_WTRM
PRIM_CODE_SATA_X_RDY
PRIM_CODE_SATA_ERROR
PRIM_CODE_D10_2
PRIM_CODE_EXTEND_CONNECTION_NORMAL
PRIM_CODE_EXTEND_CONNECTION_CLOSE
149
Appendix B – ATA Commands
See the include file “VS_ATA_Commands.inc“ in the ..\SASVFScripts or ..\SATAVFScripts subfolder of the
main SAS Protocol Suite or SATA Protocol Suite folder for defined constants for use in scripts.
Note: This file needs to be included in the VSE Script to be able to use the defined constants.
Note: The SCSI commands listed below are defined with the following prefix ATA_CMD_ (e.g.
CFA_ERASE_SECTORS would be ATA_CMD_ CFA_ERASE_SECTORS)
CFA_ERASE_SECTORS = 0xC0
CFA_REQUEST_EXTENDED_ERROR_CODE = 0x03
CFA_TRANSLATE_SECTOR = 0x87
CFA_WRITE_MULTIPLE_WITHOUT_ERASE = 0xcd
CFA_WRITE_SECTORS_WITHOUT_ERASE = 0x38
CHECK_MEDIA_CARD_TYPE = 0xD1
CHECK_POWER_MODE = 0xE5
DEVICE_CONFIGURATION = 0xB1
DEVICE_RESET = 0x08
DOWNLOAD_MICROCODE = 0x92
EXECUTE_DEVICE_DIAGNOSTIC = 0x90
FLUSH_CACHE = 0xE7
FLUSH_CACHE_EXT = 0xEA
GET_MEDIA_STATUS = 0xDA
IDENTIFY_DEVICE = 0xEC
IDENTIFY_PACKET_DEVICE = 0xA1
IDLE = 0xE3
IDLE_IMMEDIATE = 0xE1
MEDIA_EJECT = 0xED
MEDIA_LOCK = 0xDE
MEDIA_UNLOCK = 0xDF
NOP = 0x00
PACKET = 0xA0
READ_BUFFER = 0xE4
READ_DMA = 0xC8
READ_DMA_EXT = 0x25
READ_DMA_QUEUED = 0xC7
READ_DMA_QUEUED_EXT = 0x26
READ_LOG_EXT = 0x2F
READ_MULTIPLE = 0xC4
READ_MULTIPLE_EXT = 0x29
READ_NATIVE_MAX_ADDRESS = 0xF8
READ_NATIVE_MAX_ADDRESS_EXT = 0x27
READ_SECTORS = 0x20
READ_SECTORS_WITHOUT_RETRY = 0x21
READ_SECTORS_EXT = 0x24
READ_VERIFY_SECTORS = 0x40
READ_VERIFY_SECTORS_WITHOUT_RETRY = 0x41
READ_VERIFY_SECTORS_EXT = 0x42
SECURITY_DISABLE_PASSWORD = 0xF6
SECURITY_ERASE_PREPARE = 0xF3
SECURITY_ERASE_UNIT = 0xF4
SECURITY_FREEZE_LOCK = 0xF5
SECURITY_SET_PASSWORD = 0xF1
SECURITY_UNLOCK = 0xF2
SEEK = 0x70
150
SERVICE = 0xA2
SET_FEATURES = 0xEF
SET_MAX = 0xF9
SET_MAX_ADDRESS_EXT = 0x37
SET_MULTIPLE_MODE = 0xC6
SLEEP = 0xE6
SMART = 0xB0
STANDBY = 0xE2
STANDBY_IMMEDIATE = 0xE0
WRITE_BUFFER = 0xE8
WRITE_DMA = 0xCA
WRITE_DMA_EXT = 0x35
WRITE_DMA_QUEUED = 0xCC
WRITE_DMA_QUEUED_EXT = 0x36
WRITE_LOG_EXT = 0x3F
WRITE_MULTIPLE = 0xC5
WRITE_MULTIPLE_EXT = 0x39
WRITE_SECTORS = 0x30
WRITE_SECTORS_EXT = 0x34
INITIALIZE_DEVICE_PARAMETERS = 0x91
RECALIBRATE = 0x10
READ_FPDMA_QUEUED = 0x60
WRITE_FPDMA_QUEUED = 0x61
READ_STREAM_DMA = 0x2A
READ_STREAM_PIO = 0x2B
WRITE_STREAM_DMA = 0x3A
WRITE_STREAM_PIO = 0x3B
WRITE_DMA_FUA_EXT = 0x3D
WRITE_DMA_QUEUED_FUA_EXT = 0x3E
WRITE_MULTIPLE_FUA_EXT = 0xCE
CONFIGURE_STREAM = 0x51
NCQ_QUEUE_MANAGEMENT = 0x63
DATA_SET_MANAGEMENT = 0x06
SOFT_RESET = 0xFF
READ_LOG_DMA_EXT = 0x47
TRUSTED_NON_DATA = 0x5B
WRITE_LOG_DMA_EXT = 0x57
WRITE_UNCORRECTABLE_EXT = 0x45
WRITE_MULTIPLE_C3 = 0xC3
NV_CACHE = 0xB6
READ_PORT_MULTIPLIER = 0xE4
WRITE_PORT_MULTIPLIER = 0xE8
TRUSTED_RECEIVE = 0x5C
TRUSTED_RECEIVE_DMA = 0x5D
TRUSTED_SEND = 0x5E
TRUSTED_SEND_DMA = 0x5F
DOWNLOAD MICROCODE DMA = 0X93
READ BUFFER DMA = 0xE9
WRITE BUFFER DMA = 0xEB
RECEIVE FPDMA QUEUED = 0x65
SEND FPDMA QUEUED = 0x64
BLOCK ERASE EXT = 0xB4
CRYPTO SCRAMBLE EXT = 0xB4
OVERWRITE EXT = 0xB4
REQUEST SENSE DATA EXT = 0x0B
SANITIZE FREEZE LOCK EXT = 0xB4
SANITIZE STATUS EXT = 0xB4
151
Appendix C – SCSI Commands
See the include file “VS_SCSICommands.inc“ in the ..\SASVFScripts or ..\SATAVFScripts subfolder of the
main SAS Protocol Suite or SATA Protocol Suite folder for defined constants for use in scripts.
Note: This file needs to be included in the VSE Script to be able to use the defined constants.
Note: The SCSI commands listed below are defined with the following prefix SCSI_CMD_ (e.g.
SBC_FORMAT_UNIT would be SCSI_CMD_ SBC_FORMAT_UNIT)
//SBC
SBC_FORMAT_UNIT = 0x04
SBC_LOCK_UNLOCK_CACHE10 = 0x36
SBC_LOCK_UNLOCK_CACHE16 = 0x92
SBC_PRE_FETCH10 = 0x34
SBC_PRE_FETCH16 = 0x90
SBC_READ6 = 0x08
SBC_READ10 = 0x28
SBC_READ12 = 0xA8
SBC_READ16 = 0x88
SBC_READ_CAPACITY10 = 0x25
SBC_9E = 0x9E
SBC_READ_DEFECT_DATA10 = 0x37
SBC_READ_DEFECT_DATA12 = 0xB7
SBC_READ_LONG = 0x3E
SBC_REASSIGN_BLOCKS = 0x07
SBC_REBUILD16 = 0x81
SBC_7F = 0x7F
SBC_REGENERATE16 = 0x82
SBC_REZERO_UNIT = 0x01
SBC_SEEK6 = 0x0B
SBC_SEEK10 = 0x2B
SBC_SET_LIMITS10 = 0x33
SBC_SET_LIMITS12 = 0xB3
SBC_START_STOP_UNIT = 0x1B
SBC_SYNCHRONIZE_CACHE10 = 0x35
SBC_SYNCHRONIZE_CACHE16 = 0x91
SBC_VERIFY10 = 0x2F
SBC_VERIFY12 = 0xAF
SBC_VERIFY16 = 0x8F
SBC_WRITE6 = 0x0A
SBC_WRITE10 = 0x2A
SBC_WRITE12 = 0xAA
SBC_WRITE16 = 0x8A
SBC_WRITE_AND_VERIFY10 = 0x2E
SBC_WRITE_AND_VERIFY12 = 0xAE
SBC_WRITE_AND_VERIFY16 = 0x8E
SBC_WRITE_LONG = 0x3F
SBC_WRITE_SAME10 = 0x41
SBC_WRITE_SAME16 = 0x93
SBC_XDREAD10 = 0x52
SBC_XDWRITE10 = 0x50
SBC_XDWRITEREAD10 = 0x53
SBC_XDWRITEEXTENDED16 = 0x80
SBC_XPWRITE10 = 0x51
SBC_ERASE10 = 0x2C
152
SBC_ERASE12 = 0xAC
SBC_MEDIUM_SCAN = 0x38
SBC_READ_GENERATION = 0x29
SBC_READ_UPDATED_BLOCK = 0x2D
SBC_UPDATE_BLOCK = 0x3D
SBC_ORWRITE = 0x8B
SBC_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E
SBC_WRITE_LONG16 = 0x9F
SBC_SKIP_READ = 0xE8
SBC_SKIP_WRITE = 0xEA
SBC_UNMAP = 0x42
//MMC
MMC_BLANK = 0xA1
MMC_CLOSE_TRACKSESSION = 0x5B
MMC_GET_CONFIGURATION = 0x46
MMC_GET_EVENT_STATUS_NOTIFICATION = 0x4A
MMC_GET_PERFORMANCE = 0xAC
MMC_LOAD_UNLOAD_MEDIUM = 0xA6
MMC_MECHANISM_STATUS = 0xBD
MMC_PAUSE_RESUME = 0x4B
MMC_PLAY_AUDIO10 = 0x45
MMC_PLAY_AUDIO12 = 0xA5
MMC_PLAY_AUDIO_MSF = 0x47
MMC_READ_BUFFER_CAPACITY = 0x5C
MMC_SET_STREAMING = 0xB6
MMC_SYNCHRONIZE_CACHE = 0x35
MMC_STOP_PLAYSCAN = 0x4E
MMC_SEND_CUE_SHEET = 0x5D
MMC_RESERVE_TRACK = 0x53
MMC_READ_CD = 0xBE
MMC_READ_CD_MSF = 0xB9
MMC_READ_DISC_INFORMATION = 0x51
MMC_READ_DVD_STRUCTURE = 0xAD
MMC_READ_FORMAT_CAPACITIES = 0x23
MMC_READ_TOC_PMA_ATIP = 0x43
MMC_READ_SUB_CHANNEL = 0x42
MMC_READ_TRACK_INFORMATION = 0x52
MMC_REPAIR_TRACK = 0x58
MMC_REPORT_KEY = 0xA4
MMC_SEND_KEY = 0xA3
MMC_SEND_DVD_STRUCTURE = 0xBF
MMC_SCAN = 0xBA
MMC_SEND_OPC_INFORMATION = 0x54
MMC_SET_CD_SPEED = 0xBB
MMC_SET_READ_AHEAD = 0xA7
//SSC
SSC_ERASE16 =0x93
SSC_READ16 =0x88
SSC_READ_REVERSE16 =0x81
SSC_VERIFY16 =0x8F
SSC_WRITE16 =0x8A
SSC_WRITE_FILEMARKS16 =0x80
SSC_ERASE6 =0x19
SSC_LOCATE10 =0x2B
153
SSC_READ6 =0x08
SSC_READ_REVERSE6 =0x0F
SSC_SPACE6 =0x11
SSC_VERIFY6 =0x13
SSC_WRITE6 =0x0A
SSC_WRITE_FILEMARKS6 =0x10
SSC_FORMAT_MEDIUM =0x04
SSC_LOAD_UNLOAD =0x1B
SSC_LOCATE16 =0x92
SSC_READ_BLOCK_LIMITS =0x05
SSC_READ_POSITION =0x34
SSC_RECOVER_BUFFERED_DATA =0x14
SSC_REPORT_DENSITY_SUPPORT =0x44
SSC_REWIND =0x01
SSC_SET_CAPACITY =0x0B
SSC_SPACE16 =0x91
SSC_REQUEST_BLOCK_ADDRESS = 0x02
SSC_SEEK_BLOCK = 0x0C
//SCC
SCC_SPARE_IN = 0x22
SCC_MAINTENANCE_IN = 0xA3
SCC_VOLUME_SET_IN = 0xBE
SCC_VOLUME_SET_OUT = 0xBF
//OSD
OSD_7F =0x7F
//ADC
ADC_9F = 0x9F
ADC_A9 = 0xA9
//SMC
SMC_EXCHANGE_MEDIUM = 0xA6
SMC_INITIALIZE_ELEMENT_STATUS = 0x07
SMC_INITIALIZE_ELEMENT_STATUS_WITH_RANGE = 0x37
SMC_MOVE_MEDIUM = 0xA5
SMC_MOVE_MEDIUM_ATTACHED = 0xA7
SMC_POSITION_TO_ELEMENT = 0x2B
SMC_READ_ATTRIBUTE = 0x8C
SMC_READ_ELEMENT_STATUS = 0xB8
SMC_READ_ELEMENT_STATUS_ATTACHED = 0xB4
SMC_REQUEST_VOLUME_ELEMENT_ADDRESS = 0xB5
SMC_SEND_VOLUME_TAG = 0xB6
SMC_WRITE_ATTRIBUTE = 0x8D
SMC_OPEN_CLOSE_IMPORT_EXPORT_ELEMENT = 0x1B
SMC_REPORT_VOLUME_TYPES_SUPPORTED = 0x44
SMC_REQUEST_DATA_TRANSFER_ELEMENT_INQUIRY = 0xA3
SMC_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E
//SPC
SPC_ACCESS_CONTROL_IN = 0x86
SPC_ACCESS_CONTROL_OUT = 0x87
SPC_A4 = 0xA4
SPC_EXTENDED_COPY = 0x83
154
SPC_INQUIRY = 0x12
SPC_LOGSELECT = 0x4C
SPC_LOGSENSE = 0x4D
SPC_MODESELECT6 = 0x15
SPC_MODESELECT10 = 0x55
SPC_MODESENSE6 = 0x1A
SPC_MODESENSE10 = 0x5A
SPC_MOVE_MEDIUM_ATTACHED = 0xA7
SPC_PERSISTENT_RESERVE_IN = 0x5E
SPC_PERSISTENT_RESERVE_OUT = 0x5F
SPC_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E
SPC_READ_ATTRIBUTE = 0x8C
SPC_READ_BUFFER = 0x3C
SPC_READ_ELEMENT_STATUS_ATTACHED = 0xB4
SPC_READ_MEDIA_SERIAL_NUMBER = 0xAB
SPC_RECEIVE_COPY_RESULT = 0x84
SPC_RECEIVE_DIAGNOSTIC_RESULTS = 0x1C
SPC_A3 = 0xA3
SPC_REPORT_LUNS = 0xA0
SPC_REQUEST_SENSE = 0x03
SPC_SEND_DIAGNOSTIC = 0x1D
SPC_TEST_UNIT_READY = 0x00
SPC_WRITE_ATTRIBUTE = 0x8D
SPC_WRITE_BUFFER = 0x3B
SPC_RESERVE6 = 0x16
SPC_RELEASE6 = 0x17
SPC_RESERVE10 = 0x56
SPC_RELEASE10 = 0x57
SPC_SECURITY_PROTOCOL_IN = 0xA2
SPC_SECURITY_PROTOCOL_OUT = 0xB5
SPC_ATA_PASS_THROUGH_16 = 0x85
SPC_ATA_PASS_THROUGH_12 = 0xA1
155
Appendix D – SMP Commands
156
Appendix E – Limitation of For and While Loops
To prevent infinite loops in improperly written script code there is a maximum limitation of 40,000 iterations in the
case of “For” and “While” loops.
Use the following nested loop get around this limitation:
157
Appendix F:
How to Contact Teledyne LeCroy
Send e-mail… psgsupport@teledynelecroy.com
Contact support… teledynelecroy.com/support/contact
Visit Teledyne LeCroy’s web site… teledynelecroy.com
Tell Teledyne LeCroy… Report a problem to Teledyne LeCroy
Support via e-mail by selecting Help >
Tell Teledyne LeCroy from the
application toolbar. This requires that
an e-mail client be installed and
configured on the host machine.
158