Studio:SCL Structure

From STRIDE Wiki
Revision as of 17:48, 2 October 2008 by Ivailop (talk | contribs) (→‎See Also)
Jump to navigation Jump to search

The STRIDE Communication Language (SCL) defines several identifiers and their formats that are required for remote function calls, messaging, and tracing operations.

The STRIDE Message ID (SMID)

The SMID is a 32-bit structure consisting of a unique ID and a set of message attributes. The STRIDE Communication Model (SCM) defines the SUID portion as the first 24 bits of the SMID (bits 0 — 23), allowing unique identifiers up to 16,777,215. The message attributes use the highest 8 bits of the SMID (bits 24 — 31).

Each SCL-compliant message within the system must be assigned a unique message ID.

SUID attributes.gif

SMID Attributes

The attributes are used to declare the message type, describe how to send the option payload and indicate, if applicable, the pointer memory usage attribute for the payload. The attributes, shown below, are the message type (MT), send type for command (STc), send type for response (STr), pointer usage for command (PUc), pointer usage for response (PUr), and Access Class (AC).

SMID attributes format.gif

Message Type (MT) Attributes

The Message Type (MT) attribute defines the type of message being used for communication between the owner and user. The following values are used for different message types:

00 One-way command
01 One-way response
10 Two-way command-response
11 Broadcast message


Send Type for Command (STc) Attributes

The Send Type (ST) attribute is used to indicate how to transmit the payload. There are two ways to send the payload: by value or by pointer. The STRIDE Runtime is required to use the ST attribute when determining whether to route locally or remotely across platform boundaries. The following tables describe the ST attribute settings:

0 Pointer
1 Value

Send Type for Response (STr) Attributes

0 Pointer
1 Value

Note: When a command or response does not contain a payload, the ST attribute is set to zero (0).

When a payload is passed by pointer, a Pointer Usage (PU) attribute is required. The PU attribute indicates if the payload is using pool memory or private memory. When the PU attribute indicates pool, the SCM requires that the memory be allocated from the common pool being used by the system. When the PU attribute indicates private, the STRIDE Runtime environment makes no assumptions on how the payload memory is being managed between the Owner and User when they are executing on the same target platform. If the payload crosses platform boundaries, however, the Runtime is required to dynamically allocate memory from the common pool. The temporary memory that is allocated is used to hold the payload, and the address of the memory is passed to the reader. Once the reader returns the message memory to the Runtime, the temporary memory is automatically freed. The original memory from the sender is not affected or synchronized with the other platform.

The PU attributes are listed below:

Pointer Usage for Command (PUc) Attribute

0 Pool
1 Private

Pointer Usage for Response (PUr) Attribute

0 Pool
1 Private

Access Class (AC) Attributes

The Access Class (AC) attribute ensures that the intercept module will not register each SUID, and function calls with no registered owner will be routed to the intercept module STID.

00 Message
01 Function
10 Reserved
11 System/Application

The following is an excerpt of the installed header file, sr.h, showing the definitions of the SMID attributes:

/* Message Types (MT) */ 
#define srMT_ONE_CMD   0x00000000 
#define srMT_ONE_RSP   0x01000000 
#define srMT_TWO       0x02000000 
#define srMT_BRD       0x03000000
 
/* Abbreviations MT */
#define srMT_ONE       srMT_ONE_CMD
#define srMT_ONEc      srMT_ONE_CMD
#define srMT_ONEr      srMT_ONE_RSP
 
/* Send Type for Command (ST_CMD) */
#define srST_CMD_PTR   0x00000000
#define srST_CMD_VAL   0x04000000
 
/* Send Type for Response (ST_RSP) */
#define srST_RSP_PTR   0x00000000
#define srST_RSP_VAL   0x08000000
 
/* Pointer Usage for Command (PU_CMD) */
#define srPU_CMD_POL   0x00000000
#define srPU_CMD_PRI   0x10000000
 
/* Pointer Usage for Response (PU_RSP) */
#define srPU_RSP_POL   0x00000000
#define srPU_RSP_PRI   0x20000000
 
/* Access Class (AC) */
#define srAC_MSG       0x00000000
#define srAC_FUNCTION  0x40000000
#define srAC_SYS       0x80000000

Refer to the STRIDE Runtime Developer's Guide for additional information and usage of these definitions.

The STRIDE Unique ID (SUID)

The SUID is a unique 24-bit value used to identify interfaces such as remote function calls and messages. A SUID is required when using a two-way message in order to identify the message user and allow the response payload to be routed correctly. The message user provides this unique ID to the STRIDE Runtime, which in turn sends it to the message owner. The message owner is then required to supply this same unique ID when sending a response back to the STRIDE Runtime, so that the response payload can be routed correctly.

STRIDE Transactor ID (STID)

The STID is a unique 8-bit value used to represent messaging and tracing operations associated with a native thread as defined by an operating system. STIDs provide a link between the STRIDE transactor and application native transactor IDs.

The STRIDE Runtime allocates resources for each STID created within the system, as well as configures the maximum size of a STID name (via #define srCFG_STID_NAME_SIZE in srcfg.h) for the target.

Generally, each thread will have its own STID.

STRIDE Trace Point ID (STPID)

The STPID consists of a unique 32-bit ID and an optional payload, and is used for trace points. The STPID value of zero (0) is reserved for the system. There are no constraints on different application threads using the same trace point. The trace point payload is used to define the format of the data associated with it. The only additional constraint unique to trace point payloads versus message payloads is that there is no support for embedded pointers. The memory block pointed to is not transferred over to the host Runtime environment. Trace points also use payloads to represent debug information that is being provided to the host Runtime environment.

See Also

  • SCL Pragmas
  • Refer to the SCL Wizard section of the STRIDE Online Help for information on how to create SCL pragmas.