📄 ext_share.h
字号:
/* File: ext_share.h
* Absract:
* External mode shared data structures used by the external communication
* mex link, the generated code, and Simulink.
*
* Copyright 1994-2000 The MathWorks, Inc.
*
* $Revision: 1.14 $
*/
/* modifications: (FW-02-03)
*
* (1) defined new target responses (enum ExtModeAction)
* (2) defined transport layer macros
* (3) defined macro RB_SIZE (1600)
* (4) defined struct ringBuf_tag
*
*/
#ifndef __EXTSHARE__
#define __EXTSHARE__
#include "tmwtypes.h"
typedef enum {
/*================================
* Messages/actions to target.
*==============================*/
/* connection actions */
EXT_CONNECT, /* 0 */
EXT_DISCONNECT_REQUEST,
EXT_DISCONNECT_CONFIRMED,
/* parameter upload/download actions */
EXT_SETPARAM,
EXT_GETPARAMS,
/* data upload actions */
EXT_SELECT_SIGNALS,
EXT_SELECT_TRIGGER,
EXT_ARM_TRIGGER,
EXT_CANCEL_LOGGING,
EXT_CHECK_UPLOAD_DATA,
/* model control actions */
EXT_MODEL_START,
EXT_MODEL_STOP,
EXT_MODEL_PAUSE,
EXT_MODEL_STEP,
EXT_MODEL_CONTINUE,
/* data request actions */
EXT_GET_TIME, /* 15 */
/*================================
* Messages/actions from target.
*==============================*/
/* responses */
EXT_CONNECT_RESPONSE, /* must not be 0! */
EXT_DISCONNECT_REQUEST_RESPONSE,
EXT_SETPARAM_RESPONSE,
EXT_GETPARAMS_RESPONSE,
EXT_MODEL_SHUTDOWN,
EXT_MODEL_SHUTDOWN_DATA_PENDING, /* 21, new in R13 */
EXT_GET_TIME_RESPONSE, /* 22 (R13) */
EXT_MODEL_START_RESPONSE, /* 23 (R13) */
EXT_MODEL_PAUSE_RESPONSE, /* 24 (R13) */
EXT_MODEL_STEP_RESPONSE, /* 25 (R13) */
EXT_MODEL_CONTINUE_RESPONSE, /* 26 (R13) */
/* new responses (RTC167-Target) -- FW-02-03 */
EXT_DATA_UPLD_NOACK_REQUEST, /* 27 */
EXT_RESET_SER_BUFFER_REQUEST, /* 28 */
EXT_RECEIVE_USER_DATA, /* 29 */
EXTENDED = 255 /* reserved for extending beyond 254 ID's */
} ExtModeAction;
/* transport layer defines (FW-02-03) */
#define ACK_SUCCESS 31
#define ACK_NO_SUCCESS 32
#define USR 33 /* user data telegrams */
#define DAT 34 /* log data telegrams */
#define MSG 35 /* message telegrams */
typedef enum {
LittleEndian,
BigEndian
} MachByteOrder;
#ifndef TARGETSIMSTATUS_DEFINED
#define TARGETSIMSTATUS_DEFINED
typedef enum {
TARGET_STATUS_NOT_CONNECTED,
TARGET_STATUS_WAITING_TO_START,
TARGET_STATUS_STARTING, /* in the process of starting - host waiting
for confirmation */
TARGET_STATUS_RUNNING,
TARGET_STATUS_PAUSED
} TargetSimStatus;
#endif
/*
* The message header used for the message socket consists of 2 32 bit
* unsigned ints [size, type]. size is the number of bytes coming after
* the header. It is always expressed in target bytes.
*/
typedef struct MsgHeader_tag {
uint32_T type; /* message type */
uint32_T size; /* number of bytes */
} MsgHeader;
#define NUM_HDR_ELS (2)
#ifndef FALSE
enum {FALSE, TRUE};
#endif
#define NO_ERR (0)
#define EXT_NO_ERROR ((boolean_T)(0))
#define EXT_ERROR ((boolean_T)(1))
typedef enum {
UPMSG_PRETRIG_FIRST_DATA_PT, /* first pre-trig point */ /* xxx need? */
UPMSG_PRETRIG_DATA_PT, /* other pre-trig point */
UPMSG_FIRST_DATA_PT, /* first post trig data point */ /* xxx need? */
UPMSG_DATA_PT, /* other post-trig data point */
/*
* This message is sent from the target to signal the end of a data
* collection event (e.g., each time that the duration is reached).
* This message only applies to normal mode (see
* UPMSG_TERMINATE_LOG_SESSION)
*/
UPMSG_TERMINATE_LOG_EVENT,
/*
* This message is sent from the target at the end of each data logging
* session. This occurs either at the end of a oneshot or at the end
* of normal mode (i.e., the last in a series of oneshots).
*/
UPMSG_TERMINATE_LOG_SESSION
} UploadMsgType;
#define UNKNOWN_BYTES_NEEDED (-1)
#define PRIVATE static
#define PUBLIC
/* General ring buffer where signal points are temporaly allocated *
* by the rt-controller before the background process sends them *
* through the RS-232 serial port. By having this ring buffer we *
* have better control of the signal points flow. */
#define RB_SIZE 800
typedef struct {
uint_T head;
uint_T tail;
uint_T size;
uint_T nRecords;
char_T buf[RB_SIZE+3]; /* '+3' ... to allow for byte inversion (9S12) -- fw-03-05 */
} ringBuf_tag;
#endif /* __EXTSHARE__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -