⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pb_dp.h

📁 profibus dp主站于从站通信
💻 H
📖 第 1 页 / 共 4 页
字号:

typedef struct _T_DP_SET_PRM_REQ
{
  USIGN8          rem_add;                                        /* 0..126 */
  USIGN8          dummy;                              /* PCI alignment byte */
  T_DP_PRM_DATA   prm_data;                       /* 9..DP_MAX_PRM_DATA_LEN */

} T_DP_SET_PRM_REQ;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_SET_PRM_CON
{
  USIGN16   status;                           /* OK, DS, NA, RS, RR, UE, RE */

} T_DP_SET_PRM_CON;

/*==========================================================================*/

typedef struct _T_DP_CHK_CFG_REQ
{
  USIGN8           rem_add;                                       /* 0..126 */
  USIGN8           dummy;                             /* PCI alignment byte */
  T_DP_CFG_DATA    cfg_data;                      /* 3..DP_MAX_CFG_DATA_LEN */

} T_DP_CHK_CFG_REQ;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_CHK_CFG_CON
{
  USIGN16   status;                           /* OK, DS, NA, RS, RR, UE, RE */

} T_DP_CHK_CFG_CON;

/*==========================================================================*/

typedef struct _T_DP_GET_CFG_REQ
{
  USIGN8    rem_add;                                              /* 0..126 */
  USIGN8    dummy;                                    /* SDU alignment byte */

} T_DP_GET_CFG_REQ;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_GET_CFG_CON
{
  USIGN16         status;                     /* OK, DS, NA, RS, UE, NR, RE */
  USIGN8          rem_add;                                        /* 0..126 */
  USIGN8          dummy;                              /* PCI alignment byte */
  T_DP_CFG_DATA   real_cfg_data;                  /* 3..DP_MAX_CFG_DATA_LEN */

} T_DP_GET_CFG_CON;

/*==========================================================================*/

typedef struct _T_DP_GLOBAL_CONTROL_REQ
{
  USIGN8    rem_add;               /* 0..126, 127 DP_GLOBAL_STATION_ADDRESS */
  USIGN8    dummy;                                    /* PCI alignment byte */
  USIGN8    control_command;                              /* DP_CONTROL_xxx */
  USIGN8    group_select;                  /* group_ident see T_DP_PRM_DATA */

} T_DP_GLOBAL_CONTROL_REQ;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_GLOBAL_CONTROL_CON
{
  USIGN16   status;                                       /* OK, DS, NO, IV */
  USIGN8    rem_add;               /* 0..126, 127 DP_GLOBAL_STATION_ADDRESS */
  USIGN8    dummy;                                    /* SDU alignment byte */

} T_DP_GLOBAL_CONTROL_CON;

/*==========================================================================*/

typedef struct _T_DP_SET_SLAVE_ADD_REQ
{
   USIGN8    rem_add;               /* 0..125, 126 DP_DEFAULT_SLAVE_ADDRESS */
   USIGN8    dummy;                                   /* PCI alignment byte */
   USIGN16   rem_slave_data_len;            /* 0..DP_MAX_REM_SLAVE_DATA_LEN */
   USIGN8    new_slave_add;                                       /* 0..125 */
   USIGN8    ident_number_high;     /* alignment problem in DIN 19245-3 !!! */
   USIGN8    ident_number_low;   /* USIGN16 ident_number at odd address !!! */
   PB_BOOL   no_add_chg;        /* DP_TRUE: address change after reset only */
/* OCTET     rem_slave_data [rem_slave_data_len];                           */

} T_DP_SET_SLAVE_ADD_REQ;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_SET_SLAVE_ADD_CON
{
  USIGN16   status;                           /* OK, DS, NA, RS, RR, UE, RE */
  USIGN8    rem_add;                /* 0..125, 126 DP_DEFAULT_SLAVE_ADDRESS */
  USIGN8    dummy;                                    /* SDU alignment byte */

} T_DP_SET_SLAVE_ADD_CON;

/*==========================================================================*/

typedef struct _T_DP_ACT_PARA_BRCT_REQ      /* MM: function_num --> rem_add */
{
  USIGN8    rem_add;               /* 0..125, 127 DP_GLOBAL_STATION_ADDRESS */
  USIGN8    area_code;                                 /* DP_AREA_BUS_PARAM */

} T_DP_ACT_PARA_BRCT_REQ;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_ACT_PARA_BRCT_CON
{
  USIGN16   status;                                               /* OK, DS */

} T_DP_ACT_PARA_BRCT_CON;

/*==========================================================================*/

typedef struct _T_DP_FM2_EVENT_IND
{
  USIGN16   reason;                                    /* FM2 event message */

} T_DP_FM2_EVENT_IND;

/*--------------------------------------------------------------------------*/
/*--- DPV1 DATA STRUCTURES -------------------------------------------------*/
/*--------------------------------------------------------------------------*/

typedef struct _T_ADDR
{
   USIGN8   api;                                       /* default: set to 0 */
   USIGN8   scl;                                       /* default: set to 0 */
   OCTET    network_address[6];     /* use only when [d|s]_type is set to 1 */
/* OCTET    mac_address[x_len-8]; *//* use only when [d|s]_type is set to 1 */

} T_ADDR;

/*--------------------------------------------------------------------------*/

typedef struct _T_ADD_ADDR
{
   USIGN8   s_type;                                    /* default: set to 0 */
   USIGN8   s_len;                                     /* default: set to 2 */
   USIGN8   d_type;                                    /* default: set to 0 */
   USIGN8   d_len;                                     /* default: set to 2 */
/* USIGN8   s_addr[s_len];                                                  */
/* USIGN8   d_addr[d_len];                                                  */

} T_ADD_ADDR;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_INITIATE_REQ
{
  USIGN8        rem_add;                                          /* 0..126 */
  USIGN8        reserved [3];
  USIGN16       send_timeout;                          /* 1..2^16-1 [10 ms] */
  OCTET         features_supported [2];                       /* 0x01, 0x00 */
  OCTET         profile_features_supported [2];         /* profile specific */
  USIGN16       profile_ident_number;                   /* profile specific */
  T_ADD_ADDR    add_addr_param;           /* additional address information */

} T_DP_INITIATE_REQ;

/*--------------------------------------------------------------------------*/

#define DP_INITIATE_S_ADDR(x)     ((T_ADDR FAR*)(((USIGN8 FAR*)&((x)->add_addr_param))+sizeof(T_ADD_ADDR)))
#define DP_INITIATE_D_ADDR(x)     ((T_ADDR FAR*)(((USIGN8 FAR*)&((x)->add_addr_param))+sizeof(T_ADD_ADDR)+(x)->add_addr_param.s_len))

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_INITIATE_CON
{
  USIGN16       status;
  USIGN8        rem_add;                                          /* 0..126 */
  USIGN8        max_len_data_unit;                  /* 0..DP_MSAC2_DATA_LEN */
  OCTET         features_supported [2];                       /* 0x01, 0x00 */
  OCTET         profile_features_supported [2];         /* profile specific */
  USIGN16       profile_ident_number;                   /* profile specific */
  T_ADD_ADDR    add_addr_param;           /* additional address information */

} T_DP_INITIATE_CON;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_READ_REQ
{
  USIGN8    rem_add;               /* 0..126, interpreted only when MSAC_C1 */
  USIGN8    slot_number;                         /* 0..254, 255 is reserved */
  USIGN8    index;                               /* 0..254, 255 is reserved */
  USIGN8    length;                                 /* 0..DP_MSAC2_DATA_LEN */

} T_DP_READ_REQ;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_READ_CON
{
   USIGN16    status;
   USIGN8     rem_add;                                            /* 0..126 */
   USIGN8     slot_number;                       /* 0..254, 255 is reserved */
   USIGN8     index;                             /* 0..254, 255 is reserved */
   USIGN8     length;                               /* 0..DP_MSAC2_DATA_LEN */
/* OCTET      data [length]                                                 */

} T_DP_READ_CON;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_WRITE_REQ
{
   USIGN8   rem_add;               /* 0..126, interpreted only when MSAC_C1 */
   USIGN8   slot_number;                         /* 0..254, 255 is reserved */
   USIGN8   index;                               /* 0..254, 255 is reserved */
   USIGN8   length;                                 /* 0..DP_MSAC2_DATA_LEN */
/* OCTET    data [length]                                                   */

} T_DP_WRITE_REQ;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_WRITE_CON
{
  USIGN16   status;
  USIGN8    rem_add;                                              /* 0..126 */
  USIGN8    slot_number;                         /* 0..254, 255 is reserved */
  USIGN8    index;                               /* 0..254, 255 is reserved */
  USIGN8    length;                                 /* 0..DP_MSAC2_DATA_LEN */

} T_DP_WRITE_CON;

/*--------------------------------------------------------------------------*/
typedef struct _T_DP_DATA_TRANSPORT_REQ
{
   USIGN8   rem_add;                                              /* 0..126 */
   USIGN8   slot_number;                         /* 0..254, 255 is reserved */
   USIGN8   index;                               /* 0..254, 255 is reserved */
   USIGN8   length;                                 /* 0..DP_MSAC2_DATA_LEN */
/* OCTET    data [length]                                                   */

} T_DP_DATA_TRANSPORT_REQ;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_DATA_TRANSPORT_CON
{
   USIGN16   status;
   USIGN8    rem_add;                                             /* 0..126 */
   USIGN8    slot_number;                        /* 0..254, 255 is reserved */
   USIGN8    index;                              /* 0..254, 255 is reserved */
   USIGN8    length;                                /* 0..DP_MSAC2_DATA_LEN */
/* OCTET    data [length]                                                   */

} T_DP_DATA_TRANSPORT_CON;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_ABORT_REQ
{
  USIGN8    subnet;                             /* 0, 1, 2, others reserved */
  USIGN8    reason;                            /* user reason code: 0..0x3F */

} T_DP_ABORT_REQ;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_ABORT_IND
{
  PB_BOOL   locally_generated;
  USIGN8    subnet;                             /* 0, 1, 2, others reserved */
  USIGN8    reason;                 /* reason codes: see DPV1 specification */
  USIGN8    dummy;                                        /* alignment byte */
  USIGN16   additional_detail;              /* received timeout with RM-REQ */

} T_DP_ABORT_IND;

/*--------------------------------------------------------------------------*/

typedef struct _T_DP_ERROR_CON
{
  USIGN16   status;
  USIGN8    rem_add;
  USIGN8    error_decode;
  USIGN8    error_code_1;
  USIGN8    error_code_2;

} T_DP_ERROR_CON;

/****************************************************************************/

#pragma warning (disable : 4103)     /* used #pragma pack to reset alignment */
#ifdef WIN32
#pragma pack(pop)
#else
#pragma pack()
#endif
#pragma warning (default : 4103)


#endif /* __PB_DP__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -