/*
 * online.h     Defines the public macros for the online debugging environment.
 *
 * Copyright (c) 1993 by Siemens AG. All rights reserved.
 *
 * $Header:   P:/VCS/TS/ONLINE.H_V   1.1   09 Dec 1993 17:11:36   ror  $
 */

#ifndef __ONLINE_H__
#define __ONLINE_H__

/*****************
 * Public Macros *
 *****************/

/* ASCII characters used by the serial version of the link level */

#define ONLINE_ASCII_XOFF               ('S' & 0x1f)    /* ASCII XOFF = control-S */
#define ONLINE_ASCII_XON                ('Q' & 0x1f)    /* ASCII XON = control-Q */

/* Escape sequence characters for the serial version of the link level */

#define ONLINE_LINK_ESC                 0x81        /* Escape sequence byte 1 */
#define ONLINE_LINK_XOFF                0x82        /* XOFF escape sequence byte 2 */
#define ONLINE_LINK_XON                 0x83        /* XON escape sequence byte 2 */

/* Indexes of special entries in the debugging table */

#define ONLINE_DTINDEX_NITEMS           0           /* Number of items in debugging table */
#define ONLINE_DTINDEX_VERINFO          1           /* Target debugging environment version information */
#define ONLINE_DTINDEX_CHGID            2           /* Offline change id */
#define ONLINE_DTINDEX_ITER             3           /* Iteration number (model var "iteration") */
#define ONLINE_DTINDEX_SPA              4           /* #samples per autosend */
#define ONLINE_DTINDEX_FPPREC           5           /* #significant digits sent for FLOAT values */
#define ONLINE_DTINDEX_ERRINFO          6           /* Target side error information */
#define ONLINE_DTINDEX_FLAGS            7           /* Online debugging global flags */
#define ONLINE_DTINDEX_CBUFSIZE         8           /* Online debugging capture buffer size */
#define ONLINE_DTINDEX_CTRIGGER         9           /* Debugging table index for "trigger condition" */
#define ONLINE_DTINDEX_CTTOEND          10          /* #samples from trigger to end of target capture */

#define ONLINE_NSPECIALS                11          /* #special debug table entries */

/* Types of debugging table entries */

#define ONLINE_TYPE_VAR                 0x00        /* Entry is for an FPL VAR object */
#define ONLINE_TYPE_PLIST               0x01        /* Entry is for a point-list for an FPL MEMBER object */
#define ONLINE_TYPE_SFUNC               0x02        /* Entry is for a SFUNC, ZFUNC or PIFUNC FPL MEMBER object */
#define ONLINE_TYPE_MAP                 0x03        /* Entry is for a map for an FPL MEMBER object */
#define ONLINE_TYPE_MATHINFOF           0x04        /* Entry is for a float mathinfo for an FPL MEMBER object */
#define ONLINE_TYPE_MATHINFOH           0x05        /* Entry is for a huge mathinfo for an FPL MEMBER object */
#define ONLINE_TYPE_SINGLETON           0x06        /* Entry is for a singleton (ombf) for an FPL MEMBER object */
#define ONLINE_TYPE_USER_INFO           0x07        /* Entry is for ombf info for a USER defined IDM */
#define ONLINE_TYPE_RULEBASE            0x08        /* Entry is a count of fired rules for an FPL RULEBASE object */
#define ONLINE_TYPE_FIXED_PREMISE       0x09        /* Entry is a premise truth for a normal FPL RULE object */
#define ONLINE_TYPE_UNUSED_PREMISE      0x0a        /* Entry is a premise truth for an unused extra RULE object */
#define ONLINE_TYPE_USED_PREMISE        0x0b        /* Entry is a premise truth for a used extra RULE object */
#define ONLINE_TYPE_IMBF_INDEX          0x0c        /* Entry is an input MEMBER temp index for a RULE object */
#define ONLINE_TYPE_IMBF_TRUTH          0x0d        /* Entry is a input MEMBER truth value */
#define ONLINE_TYPE_OP_INDEX            0x0e        /* Entry is a premise operator index for a RULE object */
#define ONLINE_TYPE_OMBF_INDEX          0x0f        /* Entry is an output MEMBER table index for a RULE object */
#define ONLINE_TYPE_WEIGHT              0x10        /* Entry is a weight for a RULE object */
#define ONLINE_TYPE_FIXED_OTHER         0x11        /* Entry is a normal "other" */
#define ONLINE_TYPE_UNUSED_OTHER        0x12        /* Entry is a unused extra "other" */
#define ONLINE_TYPE_USED_OTHER          0x13        /* Entry is a used extra "other" */
#define ONLINE_TYPE_SPECIAL             0x14        /* Entry is "special" */
#define ONLINE_TYPE_CONSTANT            0x15        /* Entry is a trigger constant */
#define ONLINE_TYPE_BAD                 0xff        /* Fake online type for entries with unknown type */

/* Classes of debugging table entries */

#define ONLINE_CLASS_SCALAR             0x00        /* Scalar (single-element) entries */
#define ONLINE_CLASS_ARRAY              0x01        /* Array of scalar entries */
#define ONLINE_CLASS_PLIST              0x02        /* Array of points */

/*
 * Online debug target banner message
 *
 * Note:  DO NOT change any part of this banner except for the version
 *        number, which must be in the format Vx.x.x, and the year of
 *        the copyright, which must be in the format yyyy.  Otherwise
 *        the SieFuzzy test communications feature may not work properly.
 */

#define ONLINE_BANNER                   "Target Online Debugging Environment V1.0.0\nCopyright (c) 1993 Siemens AG.  All rights reserved."

/* Global flags bits */

#define ONLINE_FLAG_AUTOSEND            0x01        /* Automatic value send */
#define ONLINE_FLAG_CAPTURE             0x02        /* Automatic value capture (RFU) */
#define ONLINE_FLAG_SWAPBYTES           0x04        /* Swap bytes of words */
#define ONLINE_FLAG_SWAPWORDS           0x08        /* Swap words of longs */
#define ONLINE_FLAG_PAUSED              0x10        /* Stop (paused) state */
#define ONLINE_FLAG_STEP                0x20        /* Single-step */
#define ONLINE_FLAG_DEFER               0x40        /* Deferred command exec mode */
#define ONLINE_FLAG_TRIGGER             0x80        /* Test trigger condition */

/* Debug object flags bits */

#define ONLINE_OBJFLAG_AUTOSEND         0x01        /* Automatic value send */
#define ONLINE_OBJFLAG_CAPTURE          0x02        /* Automatic value capture (RFU) */
#define ONLINE_OBJFLAG_DEAD             0x04        /* Object has been deleted and handle is now invalid */

/* Command packet types for the command protocol */

#define ONLINE_PKT_SETOBJFLAGS          0x00        /* Set object flags */
#define ONLINE_PKT_RSTOBJFLAGS          0x01        /* Reset object flags */
#define ONLINE_PKT_SETGBLFLAGS          0x02        /* Set global flags */
#define ONLINE_PKT_RSTGBLFLAGS          0x03        /* Reset global flags */
#define ONLINE_PKT_READ                 0x04        /* Read object */
#define ONLINE_PKT_SETUP                0x05        /* Setup "other" entry */
#define ONLINE_PKT_WRITE                0x06        /* Write object */
#define ONLINE_PKT_CAPT_GET             0x07        /* Read target data-capture buffer */
#define ONLINE_PKT_SETCONST             0x08        /* Set up a trigger constant */
#define ONLINE_PKT_TRIGGER              0x09        /* Force trigger */

/* Reply packet types for the command protocol */

#define ONLINE_PKT_ERROR                0x00        /* Error packet */
#define ONLINE_PKT_READ_ERR             0x01        /* Read-error packet */
#define ONLINE_PKT_READREPLY            0x02        /* Read-reply packet */
#define ONLINE_PKT_AUTOSEND_REPLY       0x03        /* Autosend-reply packet */
#define ONLINE_PKT_AUTOSEND             0x04        /* Autosend data packet */
#define ONLINE_PKT_CAPT_DATA            0x05        /* Capture-data reply packet */
#define ONLINE_PKT_CAPT_STOPPED         0x06        /* Target capture stopped */
#define ONLINE_PKT_CAPT_TRIGGERED       0x07        /* Target capture triggered */

/* Error codes */

#define ONLINE_ERR_NONE                 0x00        /* No error */
#define ONLINE_ERR_AUTOSEND_OVERFLOW    0x01        /* Autosend size overflow */
#define ONLINE_ERR_AUTOSEND_TIMEOUT     0x02        /* Autosend time overflow */
#define ONLINE_ERR_DEFER_OVERFLOW       0x03        /* Deferred exec size overflow */
#define ONLINE_ERR_CMD_TIME             0x04        /* Deferred exec time overflow */
#define ONLINE_ERR_DEFER_TIMEOUT        0x05        /* Timeout on end of defer */
#define ONLINE_ERR_PROTOCOL             0x06        /* Protocol error */
#define ONLINE_ERR_WRITE_SIZE           0x07        /* Size in write is wrong */
#define ONLINE_ERR_ASSERT               0x08        /* Target assert failure */
#define ONLINE_ERR_READ                 0x09        /* Read error */
#define ONLINE_ERR_LIMIT                0x0a        /* Not enough time to do anything */

/* Size of the error information array in the debug table */

#define ONLINE_ERR_SIZE                 6

/* Various timing values.  LATER - should these be elsewhere? */

#define ONLINE_SECS_READ_FLUSH          1
#define ONLINE_SECS_WRITE_WAIT          2

/* Trigger condition flags */

#define ONLINE_TRIGGER_AND              0x00        /* connop is AND */
#define ONLINE_TRIGGER_OR               0x01        /* connop is OR */
#define ONLINE_TRIGGER_FIRST            0x02        /* connop is "first" */
#define ONLINE_TRIGGER_LAST             0x80        /* Last condition word-triple */

#define ONLINE_TRIGGER_EQ               0x00        /* relation is "=" */
#define ONLINE_TRIGGER_NE               0x01        /* relation is "!=" */
#define ONLINE_TRIGGER_LT               0x02        /* relation is "<" */
#define ONLINE_TRIGGER_LE               0x03        /* relation is "<=" */
#define ONLINE_TRIGGER_GT               0x04        /* relation is ">" */
#define ONLINE_TRIGGER_GE               0x05        /* relation is ">=" */

/* FPL data types */

#define IO_FLOAT                        0           /* float */
#define IO_UBYTE                        1           /* unsigned byte */
#define IO_SBYTE                        2           /* signed byte */
#define IO_UWORD                        3           /* unsigned word */
#define IO_SWORD                        4           /* signed word */
#define IO_SLONG                        5           /* signed long */
#define IO_ULONG                        6           /* unsigned long */
#define IO_FUBYTE                       7           /* fixed unsigned byte */
#define IO_FSBYTE                       8           /* fixed signed byte */
#define IO_FUWORD                       9           /* fixed unsigned word */
#define IO_FSWORD                       10          /* fixed signed word */

#endif  /* not defined (__ONLINE_H__) */
