📄 pb_dp.h
字号:
#define DP_STATE_STATION_TYPE 0x80 /* station status bits */
#define DP_STATE_MASTER_STATION 0x80
#define DP_STATE_SLAVE_STATION 0x00
#define DP_STATE_SLAVE_DIAG_DATA 0x02
#define DP_STATE_MASTER_DIAG_DATA 0x02
#define DP_STATE_SLAVE_ERROR 0x01
#define DP_STATE_MASTER_UP_DOWN_LOAD 0x01
/*--- DP BAUDRATES ---------------------------------------------------------*/
#define DP_KBAUD_9_6 0x00
#define DP_KBAUD_19_2 0x01
#define DP_KBAUD_45_45 0x0B
#define DP_KBAUD_93_75 0x02
#define DP_KBAUD_187_5 0x03
#define DP_KBAUD_500 0x04
#define DP_KBAUD_750 0x05
#define DP_KBAUD_1500 0x06
#define DP_MBAUD_1_5 0x06
#define DP_KBAUD_3000 0x07
#define DP_MBAUD_3 0x07
#define DP_KBAUD_6000 0x08
#define DP_MBAUD_6 0x08
#define DP_KBAUD_12000 0x09
#define DP_MBAUD_12 0x09
/****************************************************************************/
/* DP DATA STRUCTURE DEFINITIONS */
/****************************************************************************/
/* PCI: Protocol Control Information */
/* SDU: Service Data Unit */
/* PDU: Protocol Data Unit = PCI + SDU */
/* */
/* !!! DATA STRUCTURES: MOTOROLA BYTE ORDERING (HIGH, LOW) !!! */
/****************************************************************************/
/*--- DP SLAVE PARAMETERIZATION DATA ---------------------------------------*/
typedef struct _T_DP_PRM_DATA
{
USIGN16 prm_data_len; /* 9..DP_MAX_PRM_DATA_LEN */
OCTET station_status; /* DP_PRM_xxx */
OCTET wd_fact_1; /* watch dog time factors */
OCTET wd_fact_2;
OCTET min_tsdr; /* delay of DP-Slaves before response */
USIGN16 ident_number; /* PNO ident number */
OCTET group_ident; /* groups for GLOBAL_CONTROL */
OCTET user_prm_data [3];
} T_DP_PRM_DATA;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_CFG_DATA
{
USIGN16 cfg_data_len; /* 2..244 */
OCTET cfg_data [4]; /* */
} T_DP_CFG_DATA;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_AAT_DATA
{
USIGN16 aat_data_len; /* 2..2^16-31 */
// USIGN8 number_inputs; /* 0..244 */
// USIGN8 number_outputs; /* 0..244 */
/* USIGN16 offset_input [0..244]; */
/* USIGN16 offset_output [0..244]; */
} T_DP_AAT_DATA;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_SLAVE_USER_DATA
{
USIGN16 slave_user_data_len; /* 2..2^16-31 */
/* OCTET slave_user_data [slave_user_data_len - 2]; */
} T_DP_SLAVE_USER_DATA;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_SLAVE_PARA_SET
{
USIGN16 slave_para_len; /* 0..MAX_SLAVE_PARA_LEN */
USIGN8 sl_flag; /* DP_SL_ACTIVE, DP_SL_FLAG_NEW_PRM */
USIGN8 slave_type; /* DP_SLAVE_TYPE_DP */
OCTET reserved [12];
T_DP_PRM_DATA prm_data;
T_DP_CFG_DATA cfg_data;
T_DP_AAT_DATA aat_data;
/* T_DP_USER_DATA user_data; */
} T_DP_SLAVE_PARA_SET;
/*==========================================================================*/
typedef struct _T_DP_BUS_PARA_SET
{
USIGN16 bus_para_len; /* 66..2^16-1 */
USIGN8 fdl_add; /* 0..125 */
USIGN8 baud_rate; /* DP_xBAUD_xxx */
USIGN16 tsl; /* see DIN 19245-1 for details */
USIGN16 min_tsdr;
USIGN16 max_tsdr;
USIGN8 tqui;
USIGN8 tset;
USIGN32 ttr;
USIGN8 g;
USIGN8 hsa;
USIGN8 max_retry_limit;
USIGN8 bp_flag; /* DP_BP_ERROR_ACTION */
USIGN16 min_slave_interval; /* 1..2^16-1 [100 micros] */
USIGN16 poll_timeout; /* 1..2^16-1 [1 ms] */
USIGN16 data_control_time; /* 1..2^16-1 [10 ms] */
OCTET reserved [6];
USIGN16 master_user_data_len; /* 34..2^16-33 */
STRINGV master_class2_name [32]; /* DP Master (class 2) vendor name */
/* OCTET master_user_data [DP_MASTER_USER_DATA_LEN - 34]; */
} T_DP_BUS_PARA_SET;
/*==========================================================================*/
typedef struct _T_DP_DIAG_DATA
{
OCTET station_status_1; /* DP_DIAG_1_xxx */
OCTET station_status_2; /* DP_DIAG_2_xxx */
OCTET station_status_3; /* DP_DIAG_3_xxx */
USIGN8 master_add; /* DP Master which parameterized the DP Slave */
USIGN16 ident_number; /* PNO ident number of the DP Slave */
/* OCTET ext_diag_data [DP_MAX_EXT_DIAG_DATA_LEN]; */
} T_DP_DIAG_DATA;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_MASTER_STATUS
{
OCTET usif_state; /* DP_OP_MODE_xxx */
USIGN8 ident_number_high; /* alignment problem in DIN 19245-3 !!! */
USIGN8 ident_number_low; /* USIGN16 ident_number at odd address !!! */
OCTET dp_hardware_version; /* DDLM/USIF release information */
OCTET dp_firmware_version;
OCTET user_hardware_version; /* USER release information */
OCTET user_firmware_version;
OCTET reserved [9];
} T_DP_MASTER_STATUS;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_SLAVE_PARAM_SLAVE_INFO
{
USIGN16 diag_entries; /* available DIAG messages */
USIGN16 offset_inputs; /* offset of input area within I/O memory */
USIGN16 offset_outputs; /* offset of output area within I/O memory */
USIGN8 number_inputs; /* inputs of I/O memory */
USIGN8 number_outputs; /* outputs of I/O memory */
USIGN8 sl_flag; /* DP_SL_ACTIVE, DP_SL_FLAG_NEW_PRM */
USIGN8 slave_type; /* DP_SLAVE_TYPE_DP */
} T_DP_SLAVE_PARAM_SLAVE_INFO;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_SLAVE_PARAM_SYS_INFO
{
USIGN8 loaded_slaves; /* number downloaded slaves */
USIGN8 active_slaves; /* number active slaves */
INT16 diag_entries; /* number available DIAG messages */
USIGN16 slave_io_image_len; /* length of slave I/O memory */
} T_DP_SLAVE_PARAM_SYS_INFO;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_SET_IDENT_NUMBER
{
USIGN16 ident_number; /* new master ident_number */
OCTET dp_hardware_version; /* vendor specific release information */
OCTET dp_firmware_version;
OCTET user_hardware_version;
OCTET user_firmware_version;
} T_DP_SET_IDENT_NUMBER;
/*--------------------------------------------------------------------------*/
/*--- DP USIF SERVICE STRUCTURES -------------------------------------------*/
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_INIT_MASTER_REQ
{
USIGN8 master_default_address; /* station address for default BP */
PB_BOOL master_class2; /* use M2 requester functionality ? */
STRINGV master_class2_name [32]; /* vendor name of M2 */
USIGN8 lowest_slave_address; /* station address of first DP Slave */
USIGN8 slave_io_address_mode; /* Address Assignment Mode of slave I/O */
PB_BOOL clear_outputs; /* clear output areas in DP_OP_MODE_CLEAR ? */
USIGN8 auto_remote_services; /* DP_AUTO_xxx */
PB_BOOL cyclic_data_transfer; /* no DATA_TRANSFER service requests ? */
USIGN8 dummy; /* alignment byte */
} T_DP_INIT_MASTER_REQ;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_INIT_MASTER_CON
{
USIGN16 status; /* OK, IV, NO */
} T_DP_INIT_MASTER_CON;
/*==========================================================================*/
typedef struct _T_DP_EXIT_MASTER_CON
{
USIGN16 status; /* OK, NO */
} T_DP_EXIT_MASTER_CON;
/*==========================================================================*/
typedef struct _T_DP_START_SEQ_REQ /* MM: function_num --> rem_add */
{
USIGN8 rem_add; /* station address DP Master (class 1) */
USIGN8 area_code; /* DP_AREA_xxx */
USIGN16 timeout; /* download timeout [1ms] */
} T_DP_START_SEQ_REQ;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_START_SEQ_IND /* MM: req_add --> function_num */
{
USIGN8 req_add; /* station address DP Master (class 2) */
USIGN8 area_code; /* DP_AREA_xxx */
USIGN16 timeout; /* download timeout [1ms] */
} T_DP_START_SEQ_IND;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_START_SEQ_RES_CON
{
USIGN16 status; /* status of start sequence service */
USIGN8 max_len_data_unit; /* 1..240 */
USIGN8 dummy; /* SDU alignment byte */
} T_DP_START_SEQ_RES_CON;
/*==========================================================================*/
typedef struct _T_DP_END_SEQ_REQ /* MM: function_num --> rem_add */
{
USIGN8 rem_add; /* station address DP Master (class 1) */
USIGN8 dummy; /* SDU alignment byte */
} T_DP_END_SEQ_REQ;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_END_SEQ_IND /* MM: req_add --> function_num */
{
USIGN8 req_add; /* station address DP Master (class 2) */
USIGN8 dummy; /* SDU alignment byte */
} T_DP_END_SEQ_IND;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_END_SEQ_RES_CON
{
USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, FE, RE, */
/* NE, AD, IP, NI, SE, SC, EA, LE */
} T_DP_END_SEQ_RES_CON;
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_END_SEQ_LOC_IND
{
USIGN16 status; /* TO */
} T_DP_END_SEQ_LOC_IND;
/*==========================================================================*/
typedef struct _T_DP_DOWNLOAD_REQ /* MM: function_num --> rem_add */
{
USIGN16 data_len; /* 0..DP_MAX_DOWNLOAD_DATA_LEN */
USIGN8 rem_add; /* station address DP Master (class 1) */
USIGN8 area_code; /* destination area of download service */
USIGN16 add_offset; /* starting offset within this area */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -