PROTOCOL SOLUTIONS GROUP 3385 SCOTT BLVD SANTA CLARA, CA 95054 CATC Scripting Language Reference Manual for CATC USB Analyzers A Scripting Language for Voyager, Advisor T3, and CATC USBTracer, USBMobile, and USBAdvisor USB Protocol Analyzers Manual Version 1.
CATC Scripting Language for USB LeCroy Corporation Document Disclaimer The information contained in this document has been carefully checked and is believed to be reliable. However, no responsibility can be assumed for inaccuracies that may not have been detected. LeCroy reserves the right to revise the information presented in this document without notice or penalty. Trademarks and Servicemarks LeCroy, CATC, Voyager, Advisor T3, USBTracer, USBMobile, and USBAdvisor are trademarks of LeCroy.
CATC Scripting Language for USB Table of Contents TABLE OF CONTENTS Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Features of CATC Scripting Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Literals . . . . . . . . . . . . . . . . . . .
CATC Scripting Language for USB Table of Contents 8 Preprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 9 Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 10 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 11 Primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Call() . . . . . . . . . . . . . . . . . . . . . . . . . .
CATC Scripting Language for USB Table of Contents 14 USB Decoders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Decoder Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Script Decoding Mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Reserved Variable and Constant Names . . . . . . . . . . . . . . . . . . . . . . . . . 56 UsbEndpDir . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CATC Scripting Language for USB Table of Contents PrepareZeroFieldForDlg() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 PrepareFieldForDlgExt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 AddCaptionToDlg() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 AddStringToDlg(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 AddDataBlockToDlg() . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 1 CATC Scripting Language for USB Introduction CHAPTER 1: INTRODUCTION CATC Scripting Language (CSL) was developed to create scripts that would allow users to do file-based decoding with CATC USBTracer, USBMobile, and USBAdvisor analyzers. CSL is used to edit CATC Decode Scripting (CDS) files. CATC analyzers are equipped with built-in decoders in addition to script-based decoders that can be modified by the users or implemented as-is.
CHAPTER 1 CATC Scripting Language for USB Introduction 2
CHAPTER 2 CATC Scripting Language for USB Values CHAPTER 2: VALUES There are five value types that may be manipulated by a script: integers, strings, lists, raw bytes, and null. CSL is not a strongly typed language. Value types need not be pre-declared. Literals, variables and constants can take on any of the five value types, and the types can be reassigned dynamically. Literals Literals are data that remain unchanged when the program is compiled.
CHAPTER 2 CATC Scripting Language for USB Values Escape Sequences These are the available escape sequences in CSL: Character Escape Sequence backslash Example Output \\ "This is a backslash: \\" This is a backslash: \ double quote \" "\"Quotes!\"" "Quotes!" horizontal tab \t "Before tab\tAfter tab" Before tab newline \n "This is how\nto get a newline." This is how to get a newline. single quote \' "\'Single quote\'" After tab 'Single quote' Table 2.
CHAPTER 2 CATC Scripting Language for USB Values result = null; Variables Variables are used to store information, or data, that can be modified. A variable can be thought of as a container that holds a value. All variables have names. Variable names must contain only alphanumeric characters and the underscore ( _ ) character, and they cannot begin with a number. Some possible variable names are x _NewValue name_2 A variable is created when it is assigned a value.
CHAPTER 2 CATC Scripting Language for USB Values will create a local variable called Local, which will only be visible within the function Function. Additionally, it will change the value of Global to "cat", which will be visible to all functions. This will also change its value type from an integer to a string. Local Variables Local variables are not declared. Instead, they are created as needed.
CHAPTER 3 CATC Scripting Language for USB Expressions CHAPTER 3: EXPRESSIONS An expression is a statement that calculates a value. The simplest type of expression is assignment: x = 2 The expression x = 2 calculates 2 as the value of x. All expressions contain operators, which are described in Chapter 4, Operators, on page 9. The operators indicate how an expression should be evaluated in order to arrive at its value. For example x + 2 says to add 2 to x to find the value of the expression.
CHAPTER 3 CATC Scripting Language for USB Expressions x = 10 Value_of_x = select { x < 5 : "Less than 5"; x >= 5 : "Greater than or equal to 5"; }; The above expression will evaluate to “Greater than or equal to 5” because the first true expression is x >= 5. Note that a semicolon is required at the end of a select expression because it is not a compound statement and can be used in an expression context. There is also a keyword default, which in effect always evaluates to true.
CHAPTER 4 CATC Scripting Language for USB Operators CHAPTER 4: OPERATORS An operator is a symbol that represents an action, such as addition or subtraction, that can be performed on data. Operators are used to manipulate data. The data being manipulated are called operands. Literals, function calls, constants, and variables can all serve as operands. For example, in the operation x + 2 the variable x and the integer 2 are both operands, and + is the operator.
CHAPTER 4 CATC Scripting Language for USB Operators The associative operator () is used to group parts of the expression, forcing those parts to be evaluated first. In this way, the rules of precedence can be overridden. For example, ( 4 + 9 ) * 5 causes the addition to be performed before the multiplication, resulting in a value of 65. When operators of equal precedence occur in an expression, the operands are evaluated according to the associativity of the operators.
CHAPTER 4 CATC Scripting Language for USB Operators Operator Symbol = += -= *= /= ^= %= |= Associativity >>= <<= &= Right to left Table 4.
CHAPTER 4 CATC Scripting Language for USB Operator Operand Symbol Description Types Operators Result Types Examples Index Operator [ ] Index or subscript Raw Bytes Integer Raw = '001122' Raw[1] = 0x11 List Any List = [0, 1, 2, 3, [4, 5]] List[2] = 2 List[4] = [4, 5] List[4][1] = 5 *Note: if an indexed Raw value is assigned to any value that is not a byte ( > 255 or not an integer), the variable will be promoted to a list before the assignment is performed.
CHAPTER 4 CATC Scripting Language for USB Operator Operand Symbol Description Types Operators Result Types Examples Equality Operators == != Equal Not equal Integer-integer Integer 2 == 2 String-string Integer "three" == "three" Raw byte-raw byte Integer '001122' == '001122' List-list Integer [1, [2, 3]] == [1, [2, 3]] *Note: equality operations on values of different types will evaluate to false.
CHAPTER 4 CATC Scripting Language for USB Operator Operand Symbol Description Types Operators Result Types Examples Bitwise Logical Operators ~ Bitwise complement Integer-integer Integer ~0b11111110 = 0b00000001 & Bitwise AND Integer-integer Integer 0b11111110 & 0b01010101 = 0b01010100 ^ Bitwise exclusive OR Integer-integer Integer 0b11111110 ^ 0b01010101 = 0b10101011 | Bitwise inclusive OR Integer-integer Integer 0b11111110 | 0b01010101 = 0b11111111 Shift Operators << Left shift
CHAPTER 4 CATC Scripting Language for USB Operator Operand Symbol Description Types Operators Result Types Examples Assignment Operators (continued) &= Bitwise AND assignment Integer-integer Integer a = 0b11111110 a &= 0b01010101 = 0b01010100 ^= Bitwise exclusive OR assignment Integer-integer Integer e = 0b11111110 e ^= 0b01010101 = 0b10101011 |= Bitwise inclusive OR assignment Integer-integer Integer i = 0b11111110 i |= 0b01010101 = 0b11111111 Number of elements Any Integer sizeof([1
CHAPTER 4 CATC Scripting Language for USB Operators 16
CHAPTER 5 CATC Scripting Language for USB Comments CHAPTER 5: COMMENTS Comments may be inserted into scripts as a way of documenting what the script does and how it does it. Comments are useful as a way to help others understand how a particular script works. Additionally, comments can be used as an aid in structuring the program. Comments in CSL begin with a hash mark (#) and finish at the end of the line. The end of the line is indicated by pressing the Return or Enter key.
CHAPTER 5 CATC Scripting Language for USB Comments 18
CHAPTER 6 CATC Scripting Language for USB Keywords CHAPTER 6: KEYWORDS Keywords are reserved words that have special meanings within the language. They cannot be used as names for variables, constants or functions.
CHAPTER 6 CATC Scripting Language for USB Keywords 20
CHAPTER 7 CATC Scripting Language for USB Statements CHAPTER 7: STATEMENTS Statements are the building blocks of a program. A program is made up of list of statements. Seven kinds of statements are used in CSL: expression statements, if statements, ifelse statements, while statements, for statements, return statements, and compound statements. Expression Statements An expression statement describes a value, variable, or function.
CHAPTER 7 CATC Scripting Language for USB Statements if ( 3 - 3 || 2 - 2 ) Trace ( "Yes" ); else Trace ( "No" ); will cause “No” to be printed, because 3 - 3 || 2 - 2 will evaluate to False (neither 3 - 3 nor 2 - 2 is nonzero).
CHAPTER 7 CATC Scripting Language for USB Statements The example for ( x = 2; x < 5; x = x + 1 ) Trace ( x, "\n" ); would output 2 3 4 The example above works out like this: the expression x = 2 is executed. The value of x is passed to x < 5, resulting in 2 < 5. This evaluates to true, so the statement Trace (x, "\n" ) is performed, causing 2 and a new line to print. Next, the third expression is executed, and the value of x is increased to 3.
CHAPTER 7 CATC Scripting Language for USB Statements Trace ( HiThere() ); ... HiThere() { a = "Hi there"; return a; b = "Goodbye"; return b; } will output only Hi there because when return a; is encountered, execution of the function terminates, and the second return statement (return b;) is never processed. However, Trace ( HiThere() ); ... HiThere() { a = "Hi there"; b = "Goodbye"; if ( 3 != 3 ) return a; else return b; } will output Goodbye because the if statement evaluates to false.
CHAPTER 7 CATC Scripting Language for USB Statements ... ; } An example of a compound statement is { x = 2; x + 3; } It's also possible to nest compound statements, like so: { x = 2; { y = 3; } x + 3; } Compound statements can be used anywhere that any other kind of statement can be used. if (3 && 3) { result = "True!"; Trace(result); } Compound statements are required for function declarations and are commonly used in if, if-else, while, and for statements.
CHAPTER 7 CATC Scripting Language for USB Statements 26
CHAPTER 8 CATC Scripting Language for USB Preprocessing CHAPTER 8: PREPROCESSING The preprocessing command %include can be used to insert the contents of a file into a script. It has the effect of copying and pasting the file into the code. Using %include allows the user to create modular script files that can then be incorporated into a script. This way, commands can easily be located and reused. The syntax for %include is this: %include “includefile.
CHAPTER 8 CATC Scripting Language for USB Preprocessing 28
CHAPTER 9 CATC Scripting Language for USB Context CHAPTER 9: CONTEXT The context is the mechanism by which transaction data is passed in and out of the scripts. There is an output context that is modified by the script, and there are possibly multiple input contexts that the script will be invoked on separately. A context serves two roles: firstly, it functions as a symbol table whose values are local to a particular transaction; secondly, it functions as an interface to the application.
CHAPTER 9 CATC Scripting Language for USB Context 30
CHAPTER 10 CATC Scripting Language for USB Functions CHAPTER 10: FUNCTIONS A function is a named statement or a group of statements that are executed as one unit. All functions have names. Function names must contain only alphanumeric characters and the underscore ( _ ) character, and they cannot begin with a number. A function can have zero or more parameters, which are values that are passed to the function statement(s). Parameters are also known as arguments.
CHAPTER 10 CATC Scripting Language for USB Functions the parameter x will be assigned to 1, and the parameter y will be assigned to null, resulting in a return value of 1. But if add is called with more than two arguments add(1, 2, 3); x will be assigned to 1, y to 2, and 3 will be ignored, resulting in a return value of 3. All parameters are passed by value, not by reference, and can be changed in the function body without affecting the values that were passed in.
CHAPTER 11 CATC Scripting Language for USB Primitives CHAPTER 11: PRIMITIVES Primitive functions are called similarly to regular functions, but they are implemented outside of the language. Some primitives support multiple types for certain arguments, but in general, if an argument of the wrong type is supplied, the function will return null.
CHAPTER 11 CATC Scripting Language for USB Primitives Comments Format is used to control the way that arguments will print out. 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 are used to define the conversion specifications. Example Format("0x%02X", 20); would yield the string 0x14.
CHAPTER 11 CATC Scripting Language for USB • Primitives • A space will insert 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 will be ignored. • A hash mark (#) will prepend a 0 to an octal number when used with the conversion character o. If # is used with x or X, it will prepend 0x or 0X to a hexadecimal number. • A zero (0) will pad the field with zeros instead of with spaces.
CHAPTER 11 CATC Scripting Language for USB Primitives result = C # The result is given in hexadecimal. The result in binary is 1100. In the call to GetNBits: starting at bit 2, reads 4 bits (1100), and returns the value 0xC. NextNBits() NextNBits () Parameter Meaning Default Value Comments bit_count integer Return value None.
CHAPTER 11 CATC Scripting Language for USB Primitives Resolve() Resolve( ) Parameter Meaning Default Value Comments symbol_name string Return value The value of the symbol. Returns null if the symbol is not found. Comments Attempts to resolve the value of a symbol. Can resolve global, constant and local symbols. Spaces in the symbol_name parameter are interpreted as the ‘_’ (underscore) character since symbol names cannot contain spaces.
CHAPTER 11 CATC Scripting Language for USB Primitives 38
CHAPTER 12 CATC Scripting Language for USB Decoder Primitives CHAPTER 12: DECODER PRIMITIVES Abort() Abort() Parameter Meaning Default Value Comments N/A Return value An integer that should be passed back to the application unchanged. Comments Called when an input context renders the currently pending transaction done, but is not itself a member of that transaction. An example would be an input transaction that represents some sort of reset condition that renders all pending transactions invalid.
CHAPTER 12 CATC Scripting Language for USB Parameter Meaning Decoder Primitives Default Value additional_info any Comments Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time. Possible values are: _COLLAPSED _ERROR _EXPANDED [_FIXEDWIDTH, w] _HIDDEN _MONOCOLOR _MONOFIELD _SHOWN (default) _WARNING Return value None. Comments Adds a display cell to the current output context.
CHAPTER 12 CATC Scripting Language for USB Decoder Primitives AddCell( "Warning", "Value5", "Warning cell", 0x00BB22, _WARNING ); # Use the [_FIXEDWIDTH, w] value to create a cell with a fixed width of 20 in conjuction with the error value to create a fixed width cell with a red value field: AddCell( "Fixed Width 20", "Value6", "Fixed Width and Error cell", 0x001122, [_FIXEDWIDTH, 20], _ERROR ); The output of the example is: Figure 12-1: Example output for AddCell AddDataCell() AddDataCell(
CHAPTER 12 CATC Scripting Language for USB Decoder Primitives Example # Creates a data cell with 2 dwords (32-bit integers) of data. AddDataCell( '0123456789ABCDEF', _DWORDS ); # Creates a data cell with 4 bytes. Integer data values are always interpreted as 32 bits of data.
CHAPTER 12 CATC Scripting Language for USB Decoder Primitives AddSeparator() AddSeparator(, ...) Parameter Meaning Default Value additional_info any Comments Used to create special cells or to modify cell attributes. The values are predefined constants. Possible values are: _COLLAPSED _EXPANDED _HIDDEN _SHOWN (default) Return value None. Comments Creates a separator cell. _COLLAPSED, _EXPANDED, _HIDDEN, and _SHOWN are all interpreted the same is in a regular AddCell call.
CHAPTER 12 CATC Scripting Language for USB Parameter Meaning Decoder Primitives Default Value value string Displays in the value field of the cell. description string or null color integer or list Comments Displays in tool tip. If not speci- Color can be specified as either a packed color fied, a default value in an integer, or as an array of RGB values color is used ranging from 0-255. Displays in the name field of the cell.
CHAPTER 12 CATC Scripting Language for USB Decoder Primitives # This cell will be displayed when the red group is collapsed: AddCell( "Red is", "Collapsed", null, 0x0000ff, _COLLAPSED ); # This begins the nested blue group.
CHAPTER 12 CATC Scripting Language for USB Decoder Primitives The output of the example is: Figure 12-4: Example output for BeginCellBlock with red group collapsed Figure 12-5: Example output for BeginCellBlock with red group expanded and blue group collapsed Figure 12-6: Example output for BeginCellBlock with red group expanded and blue group expanded Complete() Complete() Parameter Meaning Default Value Comments Return value An integer that should be passed back to the application unchanged.
CHAPTER 12 CATC Scripting Language for USB Decoder Primitives EndCellBlock() EndCellBlock() Parameter Meaning Default Value Comments Return value None. Comments Ends a cell block that was started with BeginCellBlock(). Example See BeginCellBlock(). GetBitOffset() GetBitOffset() Parameter Meaning Default Value Comments N/A Return value None. Comments Returns the current bit offset that is used in NextNBits or PeekNBits.
CHAPTER 12 CATC Scripting Language for USB Decoder Primitives PeekNBits() PeekNBits() Parameter Meaning Default Value Comments bit_count integer Return value None. Comments Reads bit_count bits from the data source. The difference between PeekNBits and NextNBits is that PeekNBits does not advance the global bit offset. PeekNBits can be used to make decisions about how to parse the next fields without affecting subsequent calls to NextNBits.
CHAPTER 12 CATC Scripting Language for USB Decoder Primitives Return value An integer that should be passed back to the application unchanged. Comments This should be called when it has been decided that an input context has been accepted into a transaction, but that the transaction still requires further input to be complete. This function could be used to associate input contexts with the output context.
CHAPTER 12 CATC Scripting Language for USB Decoder Primitives 50
CHAPTER 13 CATC Scripting Language for USB Modules CHAPTER 13: MODULES Modules are a collection of functions and global data dedicated to decoding a certain type of transaction. Each module consists of one primary file (.dec), and possibly several included files (.inc). Module Functions Three functions are used as entry-points into a decoding module. They are called by the application and are used both in the initial transaction decoding phase, and each time that a transaction needs to be displayed.
CHAPTER 13 CATC Scripting Language for USB Modules Module Data There are several standard global variables that should be defined in a module which are queried by the application to figure out what the module is supposed to do. ModuleType Required. A string describing the role of the script. Currently, only Transaction Decoder and DataBlock Decoder are valid. Example set ModuleType = "Transaction Decoder"; Transaction Decoder uses ProcessData(). DataBlock Decoder does not. OutputType Required.
CHAPTER 13 CATC Scripting Language for USB Modules Icon Optional. File name of an icon to display on the toolbar. Must be a 19x19 pixel bitmap file. Example set Icon = "bitmap.
CHAPTER 13 CATC Scripting Language for USB Modules 54
CHAPTER 14 CATC Scripting Language for USB USB Decoders CHAPTER 14: USB DECODERS Decoding scripts for the CATC USB Analyzers can now be written in the new CATC Script Decoding Language. The document describing this decoding language is included with the CATC software on the CD, and also online. USBTracer, USBMobile, and USB Advisor ship with decoder scripts for many of the classes and their attributes. These files are located in the USBTracer \Scripts directory (for example).
CHAPTER 14 CATC Scripting Language for USB USB Decoders When UsbScriptDecodeType=1, the decoding for the colored fields of the trace display are handled separately from the decoding for the text-based decoding seen in the decoding dialogs. If this variable is not initialized in a .dec file, this is the default behavior.
CHAPTER 14 CATC Scripting Language for USB USB Decoders UsbEndpType Values: “Bulk” or “Interrupt”. Used to distinguish transfer types of the endpoints. UsbEndpDir Values: “In” or “Out”. Used to distinguish the endpoint direction. Any endpoint can provide 2 pipes: one in each direction. UsbMaxPktSize Value: The maximum packet size allowed for this endpoint/direction combination. This will be used to help decode the file.
CHAPTER 14 CATC Scripting Language for USB USB Decoders the Mass Storage Class provides for Protocol 0x50 for Bulk-Only Transport, and Protocol 0 for CBI (Control/Bulk/Interrupt) Transport. UsbVendorId Value: If defined, it is provided for by the Vendor as registered with the USB IF. This is used in the case where you have vendor-specific decoding. For example, if CATC created a file to decode it’s communication for it’s analyzer’s USB connection, we would use our USB-IF identification number of 1059.
CHAPTER 14 CATC Scripting Language for USB USB Decoders UsbReqStr Value: This will contain the string you build up for the Request portion of the Request text decoding when you have selected “UsbDecodeType =1”. This string will be displayed in the left-hand pane of the text decode dialog. UsbDescTooltipStr Value: This will contain the string you build up for the Descriptor portion of the Request text decoding when you have selected “UsbDecodeType =1”.
CHAPTER 14 CATC Scripting Language for USB USB Decoders UsbDecExtraInfoBytePos Value: The byte offset in this transfer where the information byte potentially used for decoding the next transfer exists. For example, in CBI-UFI decoding, the byte at offset 8 contains the UFI Opcode. For Bulk-Only SCSI, the opcode is at offset 15. In both cases, this byte can be used to identify that a subsequent Transfer contains the response data to an issued command.
CHAPTER 14 CATC Scripting Language for USB USB Decoders ... tooltip = normal_tooltip + WARNING_SIGN + error_tooltip; Add...Cell( caption, value, tooltip, _ERROR ); ... Global Variables Globals set in DecoderTools2.inc val = 0 # global buffer for keeping temporary values of any type. str = "" # global buffer for keeping temporary values of presumedly string type. base_tooltip = "" # global buffer for keeping temporary values of presumedly parts of tooltips.
CHAPTER 14 CATC Scripting Language for USB USB Decoders set Global_BitField_offset = 0; # global variable that contains the offset, in bits, from the beginning of packet for beginning of current attribute. Roughly speaking, it is the entry point from which an attribute decoder starts decoding. set BitCurrentFieldOffset = 0; # global variable that contains the offset, in bits, from the starting point of decoding for the current field inside of the decoder.
CHAPTER 14 CATC Scripting Language for USB USB Decoders Comments Saves the global field settings. Can be used in conjunction with RestoreFieldSettings() to show one attribute inside another. Example ... ... # pre-decoding of container attribute SaveFieldSettings(); Global_BitField_offset = MAD_HEADER_LEN_BITS + amount_of_bits_before_attribute; ShowSomeAttribute(); RestoreFieldSettings( ); ... ...
CHAPTER 14 CATC Scripting Language for USB USB Decoders Example val = Find(AttrIDValue_Table, PacketType); ShowDataBlock() ShowDataBlock(len, no_cells) Parameter Meaning len Length of DataBlock no_cells No cells will be drawn Default Value Comments If this parameter is set, then data cells are not shown. Comments Used to display a DataBlock. Example ShowDataBlock(40, !VEX_MyDataBlock[in.
CHAPTER 14 CATC Scripting Language for USB USB Decoders Example if(in.Expanded) Warning("Bad value", "This is example of Warning-cell."); WarningForDlg() WarningForDlg(text, tooltip) Parameter Meaning Default Value Comments text string Warning text. tooltip string Tooltip text. Comments Creates a warning for dialog view. Example WarningForDlg(Format("Not correct AttrM(0x%X)", AttModifier),"Valid values for Attribute Modifier as a pointer to a block of 8 GUIDs\n" + "are from 0 to 31.
CHAPTER 14 CATC Scripting Language for USB USB Decoders AddSimplePLCell("LID", Format("%d", LID_number ), tooltip + AddWarningTooltip(error_tooltip), error); ... If there is an error for the cell, the tooltip will display this text: LID block number. !!! WARNING !!! LID number is out of range The warning message will be displayed in dark red in dialog view. Another way to add a warning message to a tooltip is to use the WARNING_SIGN constant like this: ...
CHAPTER 14 CATC Scripting Language for USB USB Decoders Example IncFieldOffset( 64 ); PrepareFieldForDlg() PrepareFieldForDlg(field_name, str_value, tooltip, addparam) Parameter Meaning Default Value Comments field_name str_value tooltip addparam Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time. Possible values are: _ERROR: creates a cell with a red value field to indicate an error.
CHAPTER 14 CATC Scripting Language for USB USB Decoders Comments ZeroField means that the field to be added to out.FieldsList is not a data field. Rather, it is an additional field such as a caption or a separator.
CHAPTER 14 CATC Scripting Language for USB Parameter Meaning USB Decoders Default Value addparam Comments Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time. Possible values are: _ERROR: creates a cell with a red value field to indicate an error. Comments Writes passed data to out.FieldList as a special field called ‘CAPTION’.
CHAPTER 14 CATC Scripting Language for USB USB Decoders Example AddDataBlockToDlg(72); CheckBadDataLength() CheckBadDataLength() Parameter Meaning Default Value Comments N/A Comments Checks offset from beginning of data payload for packet with bad data length and sets the current field color to the error color when the offset exceeds the length of the data payload.
CHAPTER 14 CATC Scripting Language for USB USB Decoders Example PeekNBits_(16); GetNBits_() GetNBits_(offset, len) Parameter Meaning Default Value Comments offset length Comments This is a redefinition of the GetNBits primitive which increments field offset and field length.
CHAPTER 14 CATC Scripting Language for USB USB Decoders Comments Extracts a bit (bit_needed) from source. Example GetBit(3, peek_value); AddCaptionCell() AddCaptionCell(caption, text, tooltip, addparam) Parameter Meaning Default Value Comments caption Displays in the name field of the cell. text Displays in the value field of the cell. tooltip Displays in tooltip. addparam Used to create special cells or to modify cell attributes.
CHAPTER 14 CATC Scripting Language for USB USB Decoders AddPayLoadCell() AddPayLoadCell(caption, text, tooltip, addparam) Parameter Meaning Default Value Comments caption Displays in the name field of the cell. text Displays in the value field of the cell. tooltip Displays in tooltip. addparam Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time.
CHAPTER 14 CATC Scripting Language for USB Parameter Meaning USB Decoders Default Value addparam Comments Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time. Possible values are: _ERROR: creates a cell with a red value field to indicate an error. _WARNING: creates a cell with a yellow value field to indicate a warning. _MONOFIELD: cell consists of only a name field.
CHAPTER 14 CATC Scripting Language for USB Parameter Meaning USB Decoders Default Value addparam Comments Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time. Possible values are: _ERROR: creates a cell with a red value field to indicate an error. _WARNING: creates a cell with a yellow value field to indicate a warning. _MONOFIELD: cell consists of only a name field.
CHAPTER 14 CATC Scripting Language for USB Parameter Meaning USB Decoders Default Value addparam Comments Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time. Possible values are: _ERROR: creates a cell with a red value field to indicate an error. _WARNING: creates a cell with a yellow value field to indicate a warning. _MONOFIELD: cell consists of only a name field.
CHAPTER 14 CATC Scripting Language for USB USB Decoders Comments Creates a monocolored cell. It is intended to be used to start a new group of cells but doesn’t create a table in dialog view. Note: all Add...Cell functions use colors as defined in the global variable FieldColor. Example AddPLCellMonoNoDlg("LIDs : ", "Valid Ports : ", ""); AddSimplePLCell() AddSimplePLCell(caption, text, tooltip, addparam) Parameter Meaning Default Value Comments caption Displays in the name field of the cell.
CHAPTER 14 CATC Scripting Language for USB USB Decoders AddSimpleCellMonoCap() AddSimpleCellMonoCap(caption, text, tooltip, addparam) Parameter Meaning Default Value Comments caption Displays in the name field of the cell. text Displays in the value field of the cell. tooltip Displays in tooltip. addparam Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time.
CHAPTER 14 CATC Scripting Language for USB Parameter Meaning USB Decoders Default Value addparam Comments Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time. Possible values are: _ERROR: creates a cell with a red value field to indicate an error. _WARNING: creates a cell with a yellow value field to indicate a warning. _MONOFIELD: cell consists of only a name field.
CHAPTER 14 CATC Scripting Language for USB Parameter Meaning USB Decoders Default Value addparam Comments Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time. Possible values are: _ERROR: creates a cell with a red value field to indicate an error. _WARNING: creates a cell with a yellow value field to indicate a warning. _MONOFIELD: cell consists of only a name field.
CHAPTER 14 CATC Scripting Language for USB Parameter Meaning USB Decoders Default Value addparam Comments Used to create special cells or to modify cell attributes. The values are predefined constants, and zero or more of them may be used at one time. Possible values are: _ERROR: creates a cell with a red value field to indicate an error. _WARNING: creates a cell with a yellow value field to indicate a warning. _MONOFIELD: cell consists of only a name field.
CHAPTER 14 CATC Scripting Language for USB USB Decoders Comments Used to determine whether an item defined with view_setting is shown. Example ShowDataBlock(bytes, !ShowItem(CME_ReadWriteData)); PLReservedCheck() PLReservedCheck(reserved_bits) Parameter Meaning Default Value Comments reserved_bits Comments Used to make a common check of reserved bits while taking into account the view settings. If these bits are not zero, a corresponding warning cell will be shown in the expanded state.
CHAPTER 14 CATC Scripting Language for USB USB Decoders (UnsignedCompare(AttModifier, low_limit) < 0) || (UnsignedCompare(AttModifier, high_limit) > 0) : { ... } default : {attrm_chk_error = null; chk_attrmod_tlp = null;} }; CurrentFldInit() CurrentFldInit() Parameter Meaning Default Value Comments N/A Comments This function performs necessary initialization routine for a field to be decoded. It must be called before starting field decoding.
CATC Scripting Language for USB LeCroy Corporation How to Contact LeCroy Type of Service Call for technical support… Fax your questions… Write a letter … Send e-mail… Visit LeCroy’s web site… Contract US and Canada: 1 (800) 909-7112 Worldwide: 1 (408) 653-1260 Worldwide: 1 (408) 727-6622 LeCroy Protocol Solutions Group Customer Support 3385 Scott Blvd. Santa Clara, CA 95054-3115 psgsupport@lecroy.com http://www.lecroy.