Teledyne LeCroy, Sierra M6-4, Sierra M6-2, STX A6-4, Sierra M6-1.
Microsoft and Windows are registered trademarks of Microsoft Corporation.
Intel and Pentium are registered trademarks of Intel Corporation.
All other trademarks and registered trademarks are property of their respective owners.
THE SPECIFICATIONS AND INFORMATION REGARDING THE PRODUCTS IN THIS MANUAL ARE
SUBJECT TO CHANGE WITHOUT NOTICE. ALL INFORMATION, EXAMPLES AND
RECOMMENDATIONS IN THIS MANUAL ARE BELIEVED TO BE ACCURATE BUT ARE REPRESENTED
WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. USERS ARE FULLY RESPONSIBLE FOR
THEIR APPLICATION OF ANY PRODUCTS.
THE SOFTWARE LICENSE AND LIMITED WARRANTY FOR THE ACCOMPANYING PRODUCT ARE
SET FORTH IN INFORMATION THAT SHIPPED WITH THE PRODUCT AND ARE INCORPORATED
HEREIN BY THIS REFERENCE. IF YOU ARE UNABLE TO LOCATE THE SOFTWARE LICENSE OR
LIMITED WARRANTY, CONTACT LeCroy FOR A COPY.
China Restriction of Hazardous Substances Table ............................................................... 964
How to Contact LeCroy....................................................................................................... 965
Index .............................................................................................................. 966
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
API Description 28
Page 29
Introduction
The SAS/SATA API has three types of API:
• STX API: For analyzer, emulators, and Trainer
• CATC API: For analyzer and Trainer
• Infusion API: Only for Infusion
SASEngine is a COM-based library that enables programmers to use some SAS software
functionality in their programs. This library manages all hardware functions. The library includes
some internal Interfaces to detect and set device options and to program SAS hardware.
The software is for use with applications developed under COM-supported platforms, such as
Microsoft® Visual C++™, Borland® Delphi™, and Microsoft Visual Basic™.
First, you must use a COM-supported platform.
Second, you must follow some instructions in programs.
To use API functions, you initialize your application and attach to a board. After initializing your
application and attaching to a board, create an instance of the COM Object. Then use the API
functions.
The most important sections of the SAS/SATA Protocol Suite, STX software are Analyzer and
Emulators.
API Description
The following is the Object Model:
GeneralSrv
This COM class can initialize, shut down the system, and attach to and detach from board.
SerialSCSICaptureProject
This COM Object can trigger, capture, and run a project.
ExerciserEngine
This COM Object can set up an initiator/host emulator and run it.
InitiatorErrorInjection
This COM Object can inject errors on commands or frames in host emulator.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
API Description 29
Page 30
TargetEmulatorEngine
This COM Object can set up a target/device emulator and activate it.
TargetErrorInjection
This COM Object can inject errors on commands or frames in device emulator.
Extraction
This COM Object can create and open sample files and get information about packets.
Search
This COM Object can search inside sample files.
APISrv
This object comes from merging Trainer API functionality and analyzer API functionality.
This object can create all other API objects. You can get other objects from this object and then
use them.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
API Description 30
Page 31
GeneralSrv
SerialSCSICaptureProject
TargetErrorInjection
Extraction
APISrv
TargetEmulatorEngine
ExerciserEngine
InitiatorErrorInjection
The API supports Interfaces, Constants, and Parameters. You can also view API errors.
COM Interfaces Supported
The SAS/SATA Protocol Suite, STX software supports the following COM Interfaces:
• ISASAPISrvs o Methods
• ISerialSCSICaptureProject
o Methods
o Properties
• ISASGeneralService
Methods
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
API Description 31
Page 32
• IExerciserEngine
o Default Interface Methods
o Properties
o Error Injection Interface Methods
• ITargetEmulEngine
o Default Interface Methods
o Properties
o Error Injection Interface Methods
• ISerialSCSIExtraction
o Methods
o Properties
• ISearchInfo
o Methods
o Properties
Constants
The SAS/SATA Protocol Suite, STX software supports the following Constants, which are typically
used by several methods:
• Address Frame type definition
• Addressing Type definition
• Affiliation Setting definition
• ATA Capacity Type definition
• ATA Command Timeout Recovery definition
• ATA Device Emul Error and Status Register definition
• Block Descriptor Type definition
• Bus Condition definition
• Capacity Unit Definition
• Capture ID definition
• Capture Project Mode definition
• Capture strategy definition
• CCEI Data Type definition
• Close Sequence Type definition
• Command type definition
• Condition type definition
• Correction Type definition
• CRC Error Type definition
• Delay on Responding to Close definition
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
API Description 32
Page 33
• Device Types definition
• Dp Direct definition
• EOF Error Type definition
• Error Injection Frame Protocol Type definition
• Exerciser Transport Frame Type definition
• Expression Token Type definition
• Expression Type definition
• FIS Type definition
• Frame Length Error Type definition
• Handshake Error Type definition
• Handshake Type definition
• Inserted Frame Status definition
• Instruction Memory Status definition
• Instruction type definition
• SAS Layer definition
• Link mode packet definition
• Loop type definition
• Option ID definition
• Pattern Types definition
• Pattern Using Type definition
• Port Type definition
• Power Management Instruction Type definition
• Power Mng Instr definition
• PrimitivesEnum
• Primitive type definition
• Product Type definition
• Project Type definition
• Protocol Type definition
• Radix definition
• Resolution definition
• SAS Speed Negotiation Failure Type definition
• SATA Speed Negotiation Failure Type definition
• SCSI Command type definition
• SCSI Spec definition
• Search direction definition
• Sending Frame Type For Terminate Reception Frame definition
• Sense Data definition
• SMP Frame Function definition
• SMP Frame type definition
• SMP Function Result definition
• SOF Error Type definition
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
API Description 33
Page 34
• Speed definition
• Speed Negotiation Failure By definition
• Speed Negotiation Failure definition
• SSP Frame type definition
• SSP Task Management Response definition
• Target Element Type definition
• Target Emul Device Type definition
• Target Emulator ATA PE definition
• Target Emulator ATA Protocol Command Type definition
• Target Emulator ATAPI Command Type definition
• Target Emulator ATAPI Error Status Reg definition
• Target Emulator CmnEr Interval Type definition
• Target Emulator Device Type definition
• Target Emulator Error Injection Type On Command definition
• Target Emulator PE definition
• Target Emulator SCSI Command Error Type definition
• Target Emulator SCSI Page definition
• Target Emulator STP Command Error Type definition
• Target Emulator Task Mangment Error Type definition
• Target Emulator User-defined Command Protocol Type definition
• Target Emulator User-defined Command Type definition
• Task Attribute definition
• Task Management Type definition
• Time Unit definition
• Trig strategy definition
• Trigger Source definition
• TX Frame Error on Field definition
• Wake Up Instr Type definition
• Wake Up Instruction Type definition
• Wide Port Type definition
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
API Description 34
Page 35
Parameters
The SAS/SATA Protocol Suite, STX software supports the following Parameters, which are useds
by several methods and are in different pattern groups:
• External Trigs Pattern parameters
• BUS Condition Pattern parameters
• Symbol Pattern parameter
• Primitive Pattern parameter
• FIS Pattern parameters
• ATA Command Pattern parameters
• ATA Command Pattern parameters
• Address Frame Pattern parameters
• SMP,STP and SMP Pattern parameters
• Data Pattern parameters
• Protocol Errors Pattern parameters
• Soft Reset Pattern parameters
• SCSI Command Pattern parameters
API Errors
Error description files are:
• (Release folder) …/system/CEIMsg.cem
• (Release folder) …/system/SAS.cem
To get an error description, if error code is less than 15000, see the SAS.cem file in the System
folder of the release. Otherwise, see the CEIMsg.cem file in the System folder of the release.
In these files, you can find the error code and description, for example:
error code 1029 in CEIMsg.cem file :
[#1029]The Root Directory Path is invalid.
NOTE: You can open these files with a text editor.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
API Description 35
Page 36
How to Use the API
To use the API, first create your application, then consider the following steps:
• Setup API application.
• Initialize your application.
• Connect to the board.
• How to Set/ Initialize Connection Points
• Use Analyzer API.
• Use Initiator/Host Emulator API.
• Use Target/Device Emulator API.
• Use Trainer API.
• Navigate through trace file.
• Use CATC API.
• Use Infusion API.
• SATA Protocol Suite Device Emulator API
NOTE: Document images are examples only. Use the actual project files listed in the Refer
heading of each section or subsection. Do not use the project files listed in the images.
Setup your API Application
First create your new API application project.
(If using VC++, create MFC Application as Single Document Type and check
Document–View Architecture support.)
NOTE: Browse the project creation path to the \APIExamples\Analyzer_Emulator_API\VC
folder of the SAS/SATA Installed directory or STX Software directory.
Then import required DLLs into your application. (Refer to Test CaptureProject -> stdafx.h.)
NOTE: Before importing, confirm that the location of the DLLs is the EXE folder inside your
software installation directory. If not, use the complete path of the folder containing the
DLLs.
For example:
#import "C:\Program Files\Common Files\LeCroy
Shared\CEIEnums.dll"
Open the stdafx.h file of your project and add the following lines at the end of the file.
Add the APITestSink class (APITestSink.cpp + APITestSink.h) from a current API example to
your application, for uploading and creating the sample.
Add the APIHeader.h file into your application by including the same in stdafx.h, to include all
required class/ library dependencies.
Visual C++: Copy and paste the APITestSink.h, APITestSink.cpp, and APIHeader.h files from any
of the API Examples (for example, Test Capture Project) into your project folder. Then include
these files into your project by using File -> Add Existing Item.
Initialize Your Application
To initialize your API application, do the following:
• Set a valid path for the output file in the settings of your application.
• Declare two required objects in main class of your application.
• Create instances of the two objects declared in the main class of your application.
• Finalize initialization by calling InitializeSystem function.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Initialize Your Application 37
Page 38
Set a valid path for the output file of your application
Set output file location to the \API folder of your installed SAS/SATA Protocol Suite or STX
Software (for example, C:\\Program Files\...\SAS_XX\API). For reference, check the project
settings page (ProjectMenu -> Properties -> OutputDirectory) of any current API Example.
Declare two required objects in main class of your application
Declare two smart pointers) for Data Block and SASGeneral Service) in the main class of your
program.
Inputs CLSID is ID of the class object for which an instance needs to be created.
(Use the __uuidof() method to retrieve CLSID of any class.)
** sets default values for the remaining parameters.
Return Value HRESULT (Success/Failure in terms of instance creation)
Description Call the CreateInstance() method to create an instance of any class object.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Initialize Your Application 39
Page 40
Finalize initialization by calling “InitializeSystem ()”.
Call the InitializeSystem function of the SAS General Service object in the main class. Set the
parameter to the path of your SAS/SATA Protocol Suite or STX software.
(Refer to TestCaptureProject -> TestCaptureProject.cpp -> InitInstance ().)
m_pIGeneralSrvPtr->InitializeSystem (bstrCurrentDir)
[can be a NULL string also]
Usage BOOL bIsInitialized = <SAS General Service object> -> InitializeSystem
(<Current Directory String in BSTR form>);
Inputs Current Directory String in BSTR format
Return Value BOOL (Success/Failure in terms of system initialization)
Description Call the InitializeSystem() method to initialize the system at the specified
location.
Connecting to the Board
To connect to the board, you must know three parameters:
•Connection Type (yConnectionType): Connection type can be either USB or TCP. The
values for this parameter can be specified using pre-defined constants
(APIHeader.h), such as CEI_CONNECTION_USB or CEI_CONNECTION_TCP.
•Device Id (vDeviceId): Device Identification Number of the Board found on the label
of the Teledyne LeCroy hardware. This parameter is Variant, and so it needs a
conversion from string form of Device Id to Variant. This conversion can be done
using:
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Connecting to the Board 40
Page 41
Refer to any API Example to find the declaration, implementation, and usage of this
function and then duplicate the same in your project files.
NOTE: If you are providing a static value for the device ID in the source code itself
(instead of using a dialog-based input entry), append “0020” for
CEI_CONNECTION_USB or “0040” for CEI_CONNECTION_TCP at the beginning of
the Device ID string.
For example, if the device Id is “000E850001BD”:
For USB: CString strDevId = “0020000E850001BD”
For TCP: CString strDevId = “0040000E850001BD”
•Product Type (eProductType): An enumeration specifies PROJECT_TYPE_SAS for SAS
and PROJECT_TYPE_SATA for SATA. These enumerations are imported from
CEIStorageEnum.Dll.
Connect to the board using the function Attach () of the SAS General Service Object. Call this
function with the above set of parameters in the InitInstance () function of the main class of
your application.
(Refer to TestCaptureProject -> TestCaptureProject.cpp -> InitInstance ().)
Device ID: Identification Number of the Hardware Board
Product Type: PROJECT_TYPE_SAS and PROJECT_TYPE_SATA
Return Value Integer error code (Success/Failure in terms of connecting to board)
Description Call the Attach () method to programmatically connect to any of the physically
attached hardware board.
Rather than use static values for the Attach function, you can use dynamic values by creating a
common dialog box.
(Refer to the Port Select Dialogof any API Example, which takes the input as these three
parameters and passes their corresponding values onto the attach function.)
If any of the above mentioned functions are unsuccessful, they return an Error Code. (They
return Zero if successful.). The error description is in one of the following files:
CEIMsg.cem: In System folder of the installed software path.
SAS.cem: In System folder of the installed software path.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Connecting to the Board 43
Page 44
How t o Set/Initia liz e Conne c t ion Points
To use the APIs of SAS/ SATA, you must set and initialize required connection points for the
Interface needed in your test project. And to perform the same, you need to create Sink objects
and set correct IIDs (Interface Identifiers) specific to the product (SAS/ SATA) and also to the
Interface (Ex: SerialSCSIExtraction or so).
To declare the Interface Identifiers, you need to create a Sink implementation class (Can be
generated automatically using MS Visual Studio) and set the relevant Interface Identifiers as
shown below in the example images
This figure demonstrates IID declaration for Extraction’s Event Interface.
This figure demonstrates IID declaration for FindDevice’s Event Interface.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
How to Set/Initialize Connection Points 44
Page 45
This figure demonstrates IID declaration for CaptureProject’s Event Interface
Once the sink object and its corresponding identifiers are set, you can proceed with setting up
the connection points for the same. But before that one need to make sure regarding the
necessary functions to be overwritten in order to validate the connection.
For example, for SerialSCSIExtraction interface, you need to overwrite ExtractionInProgress().
Refer to APITestSink.h and APITestSink.cpp of any API Examples provided for declaration &
implementation of the same. Similarly for other interfaces, we need to set both the IIDs and
also implementations of the functions to be overwritten. Refer to SASFindDeviceCPSink.h and
SASFindDeviceCPSink.cpp of FindDeviceAPI location in APIExamples folder.
Next step is to create and initialize connection points with respect to the interface of
requirement and to do so, you need to include set of lines of code as shown below in the image
provided.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
How to Set/Initialize Connection Points 45
Page 46
Using Analyzer API
To use analyzer APIs, you must create an instance of a capture project object, then you can
create a new capture project or open a saved one. After these steps, the capture project is
ready for modifying and running. After running the project, you can stop the project and upload
and create the sample.
• Initialize a capture project object
• Create a new Analyzer capture project
• Run an Analyzer capture project
• Stop an Analyzer capture project
• Upload and create the sample file
• Open a saved Analyzer capture project
• Modify an existing Analyzer capture project
o Set trigger mode/strategy
o Add trigger pattern
o Remove trigger pattern
o Set capture mode/strategy
o Add capture pattern
o Remove capture pattern
o Exclude/include pattern items
o Set memory usage parameters
Put entire memory
Put segmented memory
Put partial memory
Set trigger position in memory
o Set output sample file path
o Set port configuration
• Summary
• Set a timer to check status of the hardware after run
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 46
Page 47
Initialize a Capture Project Object
Define a smart pointer to SerialSCSICaptureProject and create its instance using the
CreateInstance () function.
(Refer to TestCaptureProject -> TestCaptureProjectView.h -> CTestCaptureProjectView.)
(Refer to TestCaptureProject -> TestCaptureProjectView.cpp -> OnInitialUpdate ().)
ProjectTypeEnum eProjectType = ID_PROJECT_TYPE_ANALYZER_ONLY;
or
ID_PROJECT_TYPE_ANALYZER_EXERCISER
m_pICaptureProject->New (eProjectType);
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 47
Page 48
CSerialSCSICaptureProject::New ()
Prototype HRESULT New (CEIEENUMSLib::ProjectTypeEnum eProjectType);
Usage <Capture Project Object> -> New (<Project Type Enum>);
Inputs Project Type Enum: Type of Project (Analyzer-only or Analyzer-with-Exerciser)
Return Value None
Description Call the New () method to create a new capture project of type Analyzer or
Analyzer-with-Exerciser.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 48
Page 49
Run an Analyzer Capture Project
To run the newly created capture project, call the Run () function of the Capture Project object
and use the SetTimer () function to check the running status of the hardware in regular
intervals.
(Refer to TestCaptureProject -> TestCaptureProjectView.cpp -> OnRunButton ().)
m_pICaptureProject->Run ();
SetTimer (IDT_RUN, 1000, NULL);
To manage the running status conditions, declare and implement an OnTimer () function that
includes the hardware status checking functions of the SAS General Service Object, such as
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 49
Page 50
IsHWRunning () and IsHWTriggered ().
(Refer to TestCaptureProject -> TestCaptureProjectView.cpp ->
OnTimer ().)
afx_msg void OnTimer(UINT nIDEvent);
CSerialSCSICaptureProject::Run ()
Prototype long Run (void)
Usage long lErrorCode = <Capture Project Object> -> Run ();
Inputs None
Return Value If method succeeds, return value equals CEI_OK. Otherwise, returns an error
code.
Description Call the Run () method to start running the new Analyzer capture project.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Usage SetTimer (<Event ID>, <Elapse time in milliseconds>, NULL);
Inputs UINT nIDEvent: Event index
UINT nElapse: Elapse/sleep time for Timer check-up
(Gap time between each interval)
Return Value None
Description Call the SetTimer () method to set a timer to check the running status of the
hardware at regular intervals based on the elapse time specified.
<THIS>::OnTimer ()
Prototype void OnTimer (UINT nIDEvent);
Usage Automatic method call with the use of SetTimer () function. No need to call
explicitly.
Inputs UINT nIDEvent: Event Index
Return Value None
Description Declare and implement this routine to handle the hardware running status
conditions.
Stop an Analyzer Capture Project
To stop running hardware, kill the timer first by calling the KillTimer () function with the same
event index, and then call the HalAnalyzerStop () function of the SAS General Service Object to
finally bring the hardware to a halt.
(Refer to TestCaptureProject -> TestCaptureProjectView.cpp -> OnTimer ().)
KillTimer (IDT_RUN);
theApp.m_pIGeneralService->HalAnalyzerStop ();
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Next, set some extraction features such as Speed and Links. To set the analyzer speed, use
get_AnalyzerSpeed () of Capture Project, put_AnalyzerSpeed () of Extraction.
After that, upload and create the sample, by calling the DumpAndExtract () function of the
Extraction object with sample file path string as its only parameter.
For Function Prototypes and Descriptions
(Refer to Create Instances of the two objects just declared in the main class of your application
for prototype and description of CreateInstance ().)
Inputs unsigned char yBoardIndex: Index of the Board
ProjectTypeEnum eProjectType: Current running project type
Long bLink1IsEnable: Specifies whether first link in this board is enabled
Long bLink2IsEnable: Specifies whether second link in this board is enabled
Return Value None
Description Call the SetAnalyzerLinkEnable () method to set the enable status of both the
links of each connection board according to its board index. If you want to use
the entire memory of one board for a link, you should enable one link and
disable another link.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 54
Page 55
CSerialSCSIExtraction::DumpAndExtract ()
Prototype int DumpAndExtract (_bstr_t bstrSampleFileName);
Inputs BSTR bstrSampleFileName: BSTR format of the sample file path and name
Return Value Returns zero if success, otherwise an error code.
Description Call the DumpAndExtract () method to upload and create the sample data from
an Analyzer into the specified sample file name.
Open a Saved Capture Project
To open a saved capture project, call the Open () function of the capture project object with File
path and Error code as IN and OUT parameters, respectively.
(Refer to TestCaptureProject -> TestCaptureProjectView.cpp ->
OnFileOpen ().)
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 55
Page 56
CSerialSCSICaptureProject::Open ()
Prototype long Open (BSTR bstrFileName, IDataBlocks *pIDB, long bDoneConvertIfNeeded);
Usage <Capture Project object> -> Open (<BSTR form of Project File name>, NULL,
FALSE);
Inputs BSTR bstrFileName: Path of the project file
IDataBlocks *pIDB: Pointer of DataBlocks that must be correct in Analyzer/
Exerciser Project
Long bDoneConvertIfNeeded: If saved project is in X1, X2 or X4 and you want to
open in another type, sometimes you must delete some pattern or direction of a
pattern. If bDoneConvertIfNeeded is TRUE, this item will get deleted. Otherwise,
an error code is returned by the Open function.
Return Value If this method succeeds, the return value equals to CEI_OK.
Otherwise, the return value equals to the status error code
Description Call the Open () method to open a saved analyzer project.
Modifying an Existing Analyzer Project
Modifying an Analyzer Project involves modifying pattern strategies of Trigger/ Condition
Expression Items, Capture Items, and settings of Trigger Position, Memory Mode and Output
sample file path.
Set Trigger Mode/Strategy
To set the trigger strategy (Don’t Care [Snapshot] / Manual / Pattern), call the SetTrigStrategy ()
function of the Capture Project object with TrigStrategyEnum as its only parameter.
(Refer to TestCaptureProject -> TestCaptureProjectView.cpp -> OnRunButton ().)
Prototype long AddConditionExprPattern (int nStateIndex, int nConditionIndex,
PatternTypeEnum ePatternType, VARIANT *vtDirection,
VARIANT *vtSubChannelDirection, long *pErrorCode);
Usage long lPatternIndex = <Capture Project object> -> AddConditionExprPattern
( <State Index>, <Condition Index>, <Pattern Type>,
<Pattern Direction>, <Sub-channel direction of the pattern>,
<Pointer to the Error code>);
Inputs Int nStateIndex: ID for a state in advanced mode. (“Don’t care” in Easy mode)
Int nConditionIndex: Index for a condition in advanced mode
(“Don’t care in easy mode”)
PatternTypeEnum ePatternType: Pattern Type Option Index
VARIANT *vtDirection: Direction of the Pattern
This variant comes from a ByteArray Type
This Byte Array contains direction of all boards as byte
VARIANT * vtSubChannelDirection: Sub channel direction of the pattern
This variant comes from a byte array type. This byte array contains Sub channel
direction of all boards as byte. This parameter is for the muxing feature. If the
muxing feature is disabled, insert zero for the byte array for the sub channel
directions. Size of this array is equal to the size of the Direction array.
Long *pErrorCode: Saves the error code if any error occurs.
Return Value None
Description Call the AddConditionExprPattern () method to add a trigger pattern in
easy mode or a state condition expression in advanced mode.
Once after adding a pattern, you can change its parameters by using some
other set of functions. Then call UpdateHardwareResource () function to assign
the related pattern to the added pattern.
List of Pattern Types for PatternTypeEnum Option (for Trigger / Condition Expression) and their
corresponding functions to set the required parameters:
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
To remove a trigger pattern/state condition, call the RemoveConditionExprPattern () function
of the Capture Project object with State Index, Condition Index, Expression Token Index, and
Update Resource status-check as its set of parameters, in the same order.
Usage long <Pattern Index> = <Capture Project Object> ->
AddCapturePattern (<State Index>, <Pattern Type Enum>, <Direction of
Pattern>,
<Sub channel direction of pattern>, <Pointer to Error Code>);
Inputs int nStateId: ID for a state in advanced mode and Capture ID
PatternTypeEnum ePatternType: Pattern Type Index
VARIANT *vtDirection: Direction of Pattern
(This variant comes from a ByteArray type. This ByteArray Type contains
direction of all Boards as byte)
VARIANT *vtSubChannelDirection: Sub Channel Direction of the pattern
(This variant comes from a ByteArray type. This byte array contains sub channel
directions of all boards as bytes.
This parameter is for the Muxing feature. If the Muxing feature is disabled, then
insert zero to the byte array for the subchannel directions. Size of this array is
equal to the size of Direction array.)
Long *lErrorCode: Saves the error code if any error occurs.
Return Value Returns the index of Added pattern.
Description Adds a pattern to Capture (Pre or Post) in easy mode or a state in advanced
mode, specified by its ID, and returns the new added pattern index and error
code if error occurs. If you want to change default strategy of capturing
(Everything), use this function to add a pattern to capturing items. You can
change the parameter value after adding a pattern by other functions, and then
call UpdateHardwareResource to assign related resources to the added pattern.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 64
Page 65
The following table lists the Patttern Types for the PatternTypeEnum Option (for Capture
Pattern) and their corresponding functions to set the required parameters:
PatternTypeEnum Index Functions to set parameters
ID_PATTERN_TYPE_FIS
ID_PATTERN_TYPE_FIS_PATTERN
(STP Frame)
ID_PATTERN_TYPE_ADDRESS_FRA
ME
(Address Frame)
ID_PATTERN_TYPE_SMP_FRAME
(SMP Frame)
ID_PATTERN_TYPE_SSP_FRAME
(SSP Frame)
SetFISCapturePattern ()
SetCapturePatternParameterValu
eBy
OptionId ()
SetCapturePatternDirection ()
SetAddressFrameCapturePattern
()
SetCapturePatternDirection ()
SetSMPFrameCapturePattern ()
SetCapturePatternDirection ()
SetSSPFrameCapturePattern ()
SetCapturePatternDirection ()
SetCapturePatternSSPCDBType ()
SetCapturePatternSSPDataPres ()
SetCapturePatternSSPUseHashAdr
ess ()
ID_PATTERN_TYPE_DATA_PATTER
N
(Data Pattern)
ID_PATTERN_TYPE_PROTOCOL_ER
RORS
(Protocol Errors)
SetDataCapturePattern ()
SetCapturePatternDataOffset ()
SetCapturePatternDirection ()
SetCapturePatternIsNot ()
SetCapturePatternParameterValu
e ()
SetProtocolErrorCapturePattern ()
SetCapturePatternDirection ()
SetCapturePatternParameterValu
e ()
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 65
Page 66
Remove a Capture Pattern
To remove an added capture pattern, call the RemoveCapturePattern () function of the
Capture Project object with the order of its parameters as below.
Inputs int nStateId: ID for a state in advanced mode and Capture ID in easy mode
WORD wExcludePayloadOffset: Offset that defines data payload to exclude
frdata packet
Return Value None
Description Call the SetExcludePayloadOffset () function to set the offset to
exclude from the data packet.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 67
Page 68
Set Memory Usage Parameters
Memory usage parameters can be categorized into four sub sections:
• Put Entire Memory
• Put Partial Memory
• Put Segmented memory
• Set Trigger position in memory
Put Entire Memory
To put entire memory for sample collection, use put_IsEntireMemory () function of the SCSI
capture project with set-status (TRUE/ FALSE) as its parameter
Inputs BOOL bNewVal: Specifies the request status for Entire memory
Return Value None
Description Call the put_IsEntireMemory () function with TRUE to set entire memory,
and FALSE for not to set entire memory.
Put Segmented Memory
To divide entire memory into individual segments of specified size, first set number of segments
for memory division and then set each segment’s buffer size.
Usage <Capture Project Object> -> put_SegmentBufferSize (<Segment buffer size in
long>);
Inputs long lNewVal: Size of each segment’s buffer in KBs
Return Value None
Description Call the put_SegmentBufferSize () function to set size of individual segment
buffer
Put Partial Memory
To set partial memory for sample collection, use the put_PartialMemory () function of SCSI
capture project with an Integer value of memory size as its parameter.
(Refer to TestCaptureProject -> TestCaptureProjectView.cpp -> OnRunButton ().)
Usage <Capture Project Object> -> put_PartialMemory (<long value of memory size>);
Inputs long lNewVal: Size of partial memory to be considered for sample extraction
Return Value None
Description Call the put_PartialMemory () function to set size of memory for sample
extraction.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 69
Page 70
Set Trigger Position in Memory
To set the trigger position in memory, call the put_TrigPosition () function of SCSI capture
project with percentage of pre-memory size as its parameter.
(Refer to TestCaptureProject -> TestCaptureProjectView.cpp -> OnRunButton ().)
Usage <Capture Project Object> -> put_TrigPosition (<Percentage of Memory Size>);
Inputs short sNewVal: Percentage of pre-memory size in short integer terms
Return Value None
Description Call the put_TrigPosition () function to set the position of the trigger in memory
as per the input of percentage of pre-memory size.
Set Output Sample File Path
To set path of a sample file, call the put_OutputFile () function of the SCSI Capture Project.
(Refer to TestCaptureProject -> TestCaptureProjectView.cpp ->
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 70
Page 71
CSerialSCSICaptureProject::put_OutputFile ()
Prototype HRESULT put_OutputFile (BSTR bstrVal);
Usage <Capture Project Object> -> put_OutputFile (<BSTR form of sample file path>);
Inputs BSTR bstrVal: Output sample file path in BSTR format
Return Value None
Description Call the put_OutputFile () function to set the file path of the output sample.
Set Port Configuration
To set port configuration for an Analyzer capture project, call the SetDeviceType () function of
the SCSI capture project with Device Index and Device Type as its two required parameters, in
that order. An optional third parameter accommodates an Integer pointer for returning Error
codes in case of any failures.
Inputs int nDeviceIndex: Index of the attached device
DeviceConfigurationTypeEnum eDeviceType: Specifies that each port
has a kind of functionality.
For example with device type DEVICE_CONFIG_A_A_HE_HE, it specifies that first
& second ports are of Analyzer and Third & Fourth ports belong to Host/
Initiator Emulator.
Return Value Returns CEI_OK in case of method success. Otherwise, an error code.
Description Call the SetDeviceType () function to set/ modify port functionality for each
attached unit before running the project.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Analyzer API 71
Page 72
Summary
Using an Analyzer API involves a stage-by-stage process of Create, Run, Open, and Modify of an
Analyzer capture project, which can be summarized into a tabular form as given below.
Two emulators are in the SAS/SATA Protocol Suite or STX software: Initiator Emulator and
Target Emulator.
To use APIs of initiator, you must create an instance of Exerciser Capture Project and then you
can create a new Exerciser Capture project or open a saved one. After these steps it can be
modified and run like an Analyzer Capture Project.
• Initialize an Initiator capture project object
• Create a new Initiator capture project
• Run, stop, and create sample for an Initiator capture project
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
73
Page 74
Add/insert Frame Packet
o Add/insert events in Initiator
o Add/insert an instruction in Initiator
o Remove/delete an inserted packet
o Remove/delete an inserted instruction
o Error injection on packets in Initiator
Protocol errors and command settings
Error injection on outgoing frame
Error injection on incoming frame
Error injection on outgoing open error
• Summary
Initialize an Initiator Capture Project Object
Because Host Emulator is embedded in the capture project, to initialize an Initiator capture
project, declare a smart pointer to the SerialSCSICaptureProject and create its instance using
the CreateInstance () function.
(Refer to: ATAPISample -> ATAPISampleDoc.cpp -> OnNewDocument ().)
(Refer to Create a New Analyzer Capture Project for prototype and description of CSerialSCSICaptureProject::New ().)
Run, Stop and Create-Sample for an Initiator Capture Project
To run the newly created capture project, call the Run () function of the Capture Project object
and use the SetTimer () function to check the running status of the hardware in regular
intervals.
(Refer to ATAPISample -> ATAPISampleView.cpp -> OnRunButton ().)
m_pICaptureProject->Run ();
SetTimer (IDT_RUN, 1000, NULL);
To manage the running status conditions, declare and implement an OnTimer () function that
includes hardware status checking functions of the SAS General Service Object, such as
IsHWRunning () and IsHWTriggered ().
(Refer to ATAPISample -> ATAPISampleView.cpp -> OnTimer ().)
To stop the running hardware, kill the timer by calling the KillTimer () function with the same
event index, and then call the HalAnalyzerStop () function of the SAS General Service Object to
finally bring the hardware to halt.
Next, set some extraction features, such as Speed and Links. To set the analyzer speed, use
get_AnalyzerSpeed () of Capture Project, put_AnalyzerSpeed () of Extraction.
After that, upload and create the sample, by calling the DumpAndExtract () function of the
Extraction object with the sample file path string as its only parameter.
(Refer to Run an Analyzer Capture Project , Stop an Analyzer Capture Project, and Upload and
create sample file for prototypes and descriptions of all the methods involved in Run, Stop, and
Create-Sample functionalities.)
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 76
Page 77
Open a Saved Initiator Capture Project
To open a saved capture project, call the Open () function of the capture project object with File
path and Error code as IN and OUT parameters, respectively.
Prototype long Open (BSTR bstrFileName, IDataBlocks *pIDB, long bDoneConvertIfNeeded);
Usage <Capture Project object> -> Open (<BSTR form of Project File name>, NULL,
FALSE);
Inputs BSTR bstrFileName: Path of the project file
IDataBlocks *pIDB: Pointer of DataBlocks that must be correct in
Analyzer/ Exerciser Project
Long bDoneConvertIfNeeded: If saved project is in X1, X2 or X4, and you want to
open in another type, sometimes you must delete some pattern or direction of a
pattern. If bDoneConvertIfNeeded is TRUE, this item will be deleted. Otherwise,
an error code is returned by the Open function.
Return Value If this method succeeds, the return value equals CEI_OK.
Otherwise, the return value equals to the status error code.
Description Call the Open () method to open a saved analyzer project.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 77
Page 78
Modify an Initiator Capture Project
To use special functions of the host exerciser, get the Exerciser interface from the capture
project. To use APIs of Initiator, you need an interface of the exerciser engine. First define an
object of the Exerciser engine interface and then call GetExerciserInterface ().
To use the exerciser engine, you must set the Data Block object to the exerciser engine by
calling SetDataBlock ().
(Refer to ATAPISample -> ATAPISampleDoc.h -> CATAPISampleDoc ().)
(Refer to ATAPISample -> ATAPISampleDoc.cpp -> OnNewDocument ().)
Return Value Returns a pointer to exerciser engine interface to use all of its special functions
meant for Host Emulator
Description Call the GetExerciserInterface () method of SCSI Capture Object to get the
interface of exerciser engine.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 78
Page 79
CExerciserEngine::SetDataBlock ()
Prototype long SetDataBlock (IDataBlocks *pIDB);
Usage <Exerciser Engine object> -> SetDataBlock
(<Pointer to an interface of CDataBlocks of DBELib>);
Inputs IDataBlocks* pIDB: Pointer to an Interface of CDataBlocks of DBELib
Return Value None
Description Call the SetDataBlock () method to set a DataBlocks interface for engine.
Add/ Insert a packet in Initiator
To add in initiator packet, call the InsertPacket () function of Exerciser Engine.
Types of the packets include ATA Packets, SCSI Packets, TASK Packets, SMP Packets, and
Frames.
(Refer to ATAPISample -> AddATAPIDlg.cpp -> OnOK ().)
int nRetVal = m_pExerciserEngine ->InsertPacket(nIndex, iLayerId,
iFormatId, bstrName);
CExerciserEngine::InsertPacket ()
Prototype HRESULT InsertPacket (int nIndex, short iLayerId, short iFormatID,
BSTR bstrName int* pRetVal);
Usage int nRetVal = <Exerciser Engine Object> -> InsertPacket
(< Packet Index>, <Layer Index of a packet>,
<Current Selected Command Format>, <Name of the Packet Type>);
Inputs Int nIndex: Object Index to insert packet in that position
Z
Short iLayerId: Layer Index of the current command packet
(Refer to SASLayerEnum.)
Short iFormatID: Format or Type of the packet
For SCSI Commands, refer to SCSICommandsEnum
For SMP Commands, refer to SMPFrameFunctionsEnum
For Task Commands, refer to SSPTaskManagementEnum
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 79
Page 80
For ATA Commands, refer to CommandTypeEnum
For ATAPI packets, use PACKET Command type of
CommandTypeEnum
combined with SCSI Command type of SCSICommandEnum
To insert a Transport Frame, refer to ExrTransportFrameTypeEnum
To insert an Identify Frame, use
ID_ADDRESS_FRAME_TYPE_IDENTIFY
BSTR bstrName: Name of the packet
Return Value Returns success/ failure status of the method with verification parameters as
Index and LayerID of the packet.
Description Call the InsertPacket () method of Exerciser Engine to add/ insert any packet in
an index with default value in a layer.
Examples of InsertPacket () functionality for each packet type (ATA/ SCSI/ SMP/ Task/ Frame)
are below.
Add/ Insert ATA Command Packet
Usage int nRetVal = <Exerciser Engine Object> -> InsertPacket
(<Packet Index>, LAYER_ATA_COMMAND, <Current Selected Command Format>,
<Name of the Packet Type>);
Example: int nRetVal = m_pExerciserEngine->InsertPacket (
To add/ insert events in initiator, call the InsertInstruction () function of Exerciser Engine with
Packet Index and Event/Instruction type as parameters.
int nRetVal = m_pExerciserEngine>InsertInstruction(nIndex,nEventType);
CExerciserEngine::InsertInstruction ()
Prototype HRESULT InsertInstruction (int nIndex, int nInstructionType, int* pRetVal);
Usage int nRetVal = <Exerciser Engine Object> -> InsertInstruction
(<Packet Index>, <Event/ Instruction Type ID>);
Inputs Int nIndex: Object Index to insert packet in that position
Int nInstructionType: Index of the exerciser event/ instruction type to be
added or inserted at the specified index
Return Value Returns success/ failure status of the method with verification parameters as
Index and Event/Instruction type.
Description Call the InsertInstruction () of Exerciser Engine to add/insert any
event/ instruction at the index specified as the first parameter of the function.
List of Event types include:
PS Request (SAS Only), PS Response (SAS Only), Wake Up, OOB Signal, Primitive, Attach, Detach,
Power On, Power Off, Self Test Exit (SATA Only), PM Response (SATA Only), PM Request (SATA
Only), Soft Reset (SATA Only).
(Refer to CEIStorageConstants.h to view their respective IDs.)
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 81
Page 82
Example
To use InsertInstruction functionality according to the above mentioned Event types:
int nEventType = INSTRUCTION_TYPE_PRIMITIVE // For Primitive
int nRetVal = m_pExerciserEngine-
>InsertInstruction(nIndex,nEventType);
FOR SAS
// PS Request - INSTRUCTION_TYPE_SATA_POW_MNG
// PS Response - INSTRUCTION_TYPE_SATA_PM_RESPONSE
// Wake Up - INSTRUCTION_TYPE_SATA_WAKE_UP
// OOB Signal - INSTRUCTION_TYPE_OOB_SIGNAL
// Primitive - INSTRUCTION_TYPE_PRIMITIVE
// Attach - INSTRUCTION_TYPE_ATTACH
// Detach - INSTRUCTION_TYPE_DETACH
// Power ON - INSTRUCTION_TYPE_POWER_ON
// Power OFF - INSTRUCTION_TYPE_POWER_OFF
FOR SATA
// Self Test Exit - INSTRUCTION_TYPE_SATA_EXIT_SELF_TEST
// PM Request - INSTRUCTION_TYPE_SATA_POW_MNG
// PM Response - INSTRUCTION_TYPE_SATA_PM_RESPONSE
// Wake Up - INSTRUCTION_TYPE_SATA_WAKE_UP
// Soft Reset - INSTRUCTION_TYPE_SATA_SOFT_RESET
// OOB Signal - INSTRUCTION_TYPE_OOB_SIGNAL
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 82
Page 83
Add/ Insert an Instruction in Initiator
To add/insert instructions (for Control Structures) in initiator, call the InsertInstruction ()
function of Exerciser Engine with Packet Index and Event/Instruction type as parameters.
int nRetVal = m_pExerciserEngine>InsertInstruction(nIndex,nEventType);
Function Prototypes and Descriptions:
(Refer to Section 2.5.5.1 for prototype, usage, and description of InsertInstruction method.)
List of Instruction types include:
Loop Start, Loop End, Go To, IF Last Received Frame, IF Last Handshake, IF Device Type, IF
Payload, IF Last Command Status, IF Aborted NCQ Command, IF Host Queue Count, IF PS
Request (SAS Only), IF PM Request (SATA Only), Wait For any Frame, Delay, Stop.
(Refer to CEIStorageConstants.h, CEIEngineLibConstants.h to view their respective IDs.)
Example
To use InsertInstruction functionality according to the above mentioned Instruction types:
int nEventType = INSTRUCTION_TYPE_END_LOOP // For End Loop
int nRetVal = m_pExerciserEngine->InsertInstruction(nIndex,nEventType);
// Loop Start - INSTRUCTION_TYPE_SATRT_LOOP
// Loop End - INSTRUCTION_TYPE_END_LOOP
// Go To - INSTRUCTION_TYPE_GO_TO
// IF - INSTRUCTION_TYPE_IF
// Last Received Frame - INSTRUCTION_TYPE_IF_LAST_FRMAE
// Last Handshake - INSTRUCTION_TYPE_IF_LAST_HANDSHAKE
// Device Type - INSTRUCTION_TYPE_IF_DEVICE_TYPE
// Payload - INSTRUCTION_TYPE_IF_PAYLOAD_BUFFER
// Last Command Status - INSTRUCTION_TYPE_IF
// Aborted NCQ Command - INSTRUCTION_TYPE_IF_ABORT_NCQ_COMMAND
// Host Queue Count - INSTRUCTION_TYPE_IF_HOST_QUEUE_COUNT
// PS Request (SAS) - INSTRUCTION_TYPE_SATA_IF_PM_REQUEST
// PM Request (SATA) - INSTRUCTION_TYPE_SATA_IF_PM_REQUEST
// Wait For Any Frame - INSTRUCTION_TYPE_WAIT_FOR_FRAME
// Delay - INSTRUCTION_TYPE_DELAY
// Stop - INSTRUCTION_TYPE_STOP
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 83
Page 84
Remove/Delete an Inserted Packet
To remove/delete an inserted packet from initiator, call the DeletePacket () function of
Exerciser Engine with Packet layer type and Packet Index in Layer as parameters, in the same
order as below.
int nRetVal = m_pExerciserEngine -> DeletePacket(iLayerType,
nPacketIndexInLayer);
CExerciserEngine::DeletePacket ()
Prototype HRESULT DeletePacket (short iLayerType, int nPacketIndexInLayer, int* pRetVal);
Usage int nRetVal = <Exerciser Engine Object> -> DeletePacket
(<Packet Layer Type>, <Index of insertion of packet in the layer>);
Inputs Short iLayerType: Layer ID of the packet (Refer to SASLayerEnum.)
Int nPacketIndexInLayer: Index of a packet corresponding to layer ID
Return Value Returns success/ failure status of the method with verification parameters as
Layer ID and Packet-Index-in-layer.
Description Call the DeletePacket () of Exerciser Engine to remove/delete any inserted
packet at the index specified as the second parameter of the function.
Remove/Delete an Inserted Event/Instruction
To remove/ delete an inserted Event/Instruction from initiator, call the DeleteInstruction ()
function of Exerciser Engine with Index of insertion as its only parameter.
int nRetVal = m_pExerciserEngine -> DeleteInstruction(nIndex);
DeleteInstruction (<Index of insertion of packet in the layer>);
Inputs Int nIndex: Index of a packet corresponding to layer ID
Return Value Returns success/failure status of the method in the form of an error code.
Description Call the DeleteInstruction () of Exerciser Engine to remove/ delete any inserted
event/ instruction at the index specified as the parameter of the function.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 84
Page 85
Error Injection on Packets in Initiator
To set an Error Injection on packets in Initiator, get an Instance of Initiator Error Injection
Interface. First, declare an Instance variable for the initiator Error Injection, and then Query it
using the QueryInterface () function of the Exerciser Engine.
(Refer to ATAPISample -> ATAPISampleDoc.h -> CATAPISampleDoc ().)
(Refer to ATAPISample -> ATAPISampleDoc.cpp -> OnNewDocument ().)
After obtaining a hold to the Error Injection interface, use its methods to set Error Injection on
Outgoing frames, on Incoming frames, and on Outgoing Open Error.
Inputs REFIID riid: ID of a reference object of an Interface
Void** ppv: Void reference to hold the instantiated address of the interface
Return Value None
Description Call QueryInterface () to query the Initiator Error Injection Interface.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 85
Page 86
Protocol Errors and Command Settings
To set protocol errors and command settings for an Initiator Packet, build a dialog with basic
required fields, such as Connection Rate, Trigger Source, External Trigger Out, Retry Count,
Random Error Injection Percentage, Close Connection Settings, Outgoing Frame Error Injection
Settings, Incoming Frame Error Injection Settings, and Outgoing Open Error Settings.
(Refer to ATAPISample -> ErrorInjectionDlg.h ().)
(Refer to ATAPISample -> ErrorInjectionDlg.cpp ().)
To popup and use the Error Injection Dialog, create an object of the CErrorInjectionDlg class.
Using that object, display the dialog with the help of DoModal function of CDialog class.
(Refer to ATAPISample -> ATAPISampleView.cpp -> OnInitialUpdate ().)
(Refer to ATAPISample -> ATAPISampleView.cpp ->
OnErrorInjectionButtonClick ().)
CErrorInjectionDlg *pErrorInjectionDialog = new
Error Injection Dialog specific from ATAPISample is shown here below:
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 86
Page 87
Out of all the required fields for an Error Injection Dialog, the three most-required features are
Error Injection on Outgoing Frame, Error Injection on Incoming Frame, and Error Injection on
Outgoing Open Error.
Error Injection on Outgoing Frame
To set Error Injection on an Outgoing frame, first set its corresponding attributes using the
SetOutgoingErrorAttribute () function of the Initiator Error Injection interface.
(Refer to ATAPISample -> ErrorInjectionDlg.cpp -> OnOKErrorInjection
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 87
Page 88
After setting the Outgoing error attributes, start with setting Error Injection on each of the
Outgoing frame options, such as Frame Type error, Frame Length Error, SOF Error, EOF Error,
CRC Error, Remove Frame From Sequence, Code Violation Error, Disparity Error, Insert Primitive,
Delay in Sending Frame, No WTRM, Code Violation on SATA Primitive, Disparity Error on SATA
Primitive, Ignore XRDY/RRDY sequence, Delay in HOLD Response, and Fill Byte for Reserved
Fields.
Each of the above options has a respective method call for Error Injection:
Outgoing Frame Error
Function Name
Injection Options
Frame Type Error ErInjSetFrameErrorType ()
Frame Length Error ErInjSetFrameLengthError ()
SOF Error ErInjSetSOFError ()
EOF Error ErInjSetEOFError ()
CRC Error ErInjSetCRCError ()
Remove Frame From Sequence ErInjSetOmitFrameFromSequence ()
(<Layer ID>, <Packet Index in Layer>, <Option Specific Parameter>,
<Pointer to Integer for return value>);
Return Value None
Description Call the respective functions to set error injection on any particular Outgoing
frame options.
Error Injection on Incoming Frame
To set Error Injection on an InComing frame, first set its corresponding attributes using the
SetInComingErrorAttribute () function of Initiator Error Injection interface.
(Refer to ATAPISample -> ErrorInjectionDlg.cpp -> OnOKErrorInjection
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 92
Page 93
After setting the Incoming error attributes, start setting Error Injection on each of the InComing
frame options, such as Handshake Errors and Defer Handshake After.
Both of the options have their respective method calls for Error Injection:
InComing Frame Error Injection
Function Name
Options
Handshake Errors ErInjSetHandshakeError ()
Defer handshake After ErInjSetSendDelayToSendHandshake
Options of Outgoing Open Error Frame include Frame Type Error, SOAF Error, EOAF Error, CRC
Error, Frame Length Error, Code Violation Error, and Disparity Error.
Corresponding function sets for each of the options mentioned above are:
Outgoing Open Error Frame
Function Name
Options
Frame Type Error SetOutGoingOpenFrameTypeError ()
SOAF Error SetOutGoingOpenFrameSOAFError ()
EOAF Error SetOutGoingOpenFrameEOAFError ()
CRC Error SetOutGoingOpenFrameCRCError ()
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
<Layer ID>, <Packet Index in Layer>, <Option Specific Parameter 1>,
<Option Specific Parameter 2 – If Any>);
Return Value None
Description Call the respective functions to set error injection on any particular
OutGoing Open Error frame options.
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 96
Page 97
Summary
Using an Initiator Emulator API involves a stage-by-stage process of Create, Run, Open, and
Modify of an Exerciser capture project, as given below.
Stages involved in using
Host Emulator API
Create a NEW Initiator/Host Exerciser
Capture Project
Initialize an Initiator Project Object
Create a New Initiator Capture Project
Run, Stop and Extract Sample
Run the Capture Project
Stop the Capture Project
Corresponding Function Calls
CSerialSCSICaptureProject::CreateInstance ()
CSerialSCSICaptureProject::New ()
CSerialSCSICaptureProject::Run ()
CWnd::SetTimer ()
OnTimer ()
CSASGeneralService::HalAnalyzerStop ()
Upload and Create Sample file
Open a Saved Host Emulator
Capture Project
Open an Initiator Capture Project
Modify an Existing Initiator
Capture Project
Get Exerciser Engine Interface
Set Data Block
Add/ Insert a Packet in Initiator
CSerialSCSIExtraction::put_AnalyzerSpeed ()
CSerialSCSIExtraction::SetAnalyzerLinkEnable ()
CSerialSCSIExtraction::DumpAndExtract ()
CSerialSCSICaptureProject::Open ()
CSerialSCSICaptureProject::GetExerciserInterface
()
CExerciserEngine::SetDataBlock ()
CExerciserEngine::InsertPacket ()
Add/ Insert an Event in Initiator
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
CExerciserEngine::InsertInstruction()
Using Initiator/Host Emulator API Functions 97
Page 98
Add/ Insert an Instruction in Initiator
CExerciserEngine::InsertInstruction()
Remove a Packet from Initiator
Remove an event/ Instruction from
initiator
Error Injection on Packets in Initiator
Query Error Injection Interface
Error Injection on OutGoing Frame
CExerciserEngine::DeletePacket()
CExerciserEngine::DeleteInstruction()
QueryInterface () – (using ExerciserEngine
object)
CExerciserEngine::SetOutGoingErrorAttribute ()
CExerciserEngine::ErInjSetFrameErrorType ()
CExerciserEngine::ErInjSetFrameLengthError ()
CExerciserEngine::ErInjSetSOFError ()
CExerciserEngine::ErInjSetEOFError ()
CExerciserEngine::ErInjSetCRCError ()
CExerciserEngine::ErInjSetOmitFrameFromSequen
ce ()
CExerciserEngine::ErInjSetCodeViolationError ()
CExerciserEngine::ErInjSetDisparityError ()
CExerciserEngine::ErInjSetSendingFrameDelay ()
CExerciserEngine::ErInjSetNoWTRM ()
CExerciserEngine::ErInjSetCodeViolationOnSATAP
rimitive ()
CExerciserEngine::ErInjSetDisparityErrorOnSATAP
rimitive ()
CExerciserEngine::ErInjSetIgnoreXRDYorRRDY ()
CExerciserEngine::ErInjSetDelayResponseToHold
()
CExerciserEngine::ErInjSetFillByteForReservedFiel
d ()
CExerciserEngine::ErInjSetInsertPrimitive ()
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 98
Page 99
CExerciserEngine::SetInComingErrorAttribute ()
CExerciserEngine::ErInjSetHandshakeError ()
Error Injection on
Incoming Frame
Error Injection on OutGoing
Open Error Frame
CExerciserEngine::ErInjSetSendDelayToSendHand
shake ()
CExerciserEngine::SetOutGoingOpenFrameTypeEr
ror ()
CExerciserEngine::SetOutGoingOpenFrameSOAFE
rror ()
CExerciserEngine::SetOutGoingOpenFrameEOAFE
rror ()
CExerciserEngine::SetOutGoingOpenFrameCRCErr
or ()
CExerciserEngine::SetOutGoingOpenFrame
FrameLengthError ()
CExerciserEngine::SetOutGoingOpenFrameCode
ViolationError ()
CExerciserEngine::SetOutGoingOpenFrameDispari
tyError ()
CExerciserEngine::SetOutGoingOpenFrameCodeVi
olation
AndDisparityErrorAttribute ()
CExerciserEngine::SetOutGoingOpenFrameInvalid
Fields ()
Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual
Using Initiator/Host Emulator API Functions 99
Page 100
Using Target/Device E m ulat or API Functions
To use APIs of Target/Device Emulator, you must create an instance of Target Emulator engine
and then you can create a new Target Emulator project or open a saved one. Using this object
of Target Emulator engine, you can modify settings of an existing project, such as Modifying
Pages, Error Injection, Modifying User-defined commands section, and Modifying Settings Page.
• Initialize and create a new target emulator object
• Open a saved target emulator
• Modify an existing target emulator project
o Modify pages
o Error injection on packets of target emulator
General Settings
Identification Settings
Connection management
Error injection on commands
Error injection on SAS commands
Error injection on SATA commands
o Modify settings
Modify SAS-specific configuration settings
Modify SATA-specific configuration settings
Modify settings common to both SAS and SATA configurations
• Summary
Initialize and Create a New Target Emulator Object
To initialize and create a New Target Emulator project, first define a smart pointer to the
Target Emulator Engine, and then create an Instance.