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

📄 cifuser.h

📁 PROFIBUS-dp PROGRAMS 主从站源程序
💻 H
📖 第 1 页 / 共 2 页
字号:
/* <St> *******************************************************************

  FILENAME      : CIFUSER.H

  -------------------------------------------------------------------------
  CREATETED     : R. Mayer,  Hilscher GmbH
  DATE          : 28.11.95
  PROJEKT       : CIF device driver
  =========================================================================

  DISCRIPTION

    User interface definition.
    
    ----------------------------------------------------------------
    ATTENTION : THIS IS THE 16 BIT VERSION OF THE CIF USER INTERFACE
                FOR 32 BIT APPLICATIONS, USE THE cifuser.h GIVEN IN
                THE 32 BIT API !!
    ----------------------------------------------------------------
    

  =========================================================================

  CHANGES

  version name        date        Discription
  -------------------------------------------------------------------------

  V2.220  MY          07.07.99    - #pragma pack(1) command moved to start and
                                    end of file
  
  V1.010  MY          28.10.97    - Modes in DevExchangeIOErr changed from
                                    0,1,2 to 2,3,4

  V1.009  MY          14.10.97    - All pointers to FAR * defined
                                  - MS-C++ support include (#ifdef _cplusplus)
                                  - Function: DevReadWriteRAW()
                                              DevExchangeIOEx()
                                              DevExchangeIOErr() included.
                                  - MSG.data in MSG_STRUCT reduced to
                                    255 Byte, which is the max. data length.
                                  - New reset definition BOOTSTART included,
                                    to save parameters on CIF40
                                  - PcWatchDog into HostWatchDog renamed
                                  - Error numbers -6, -26, -27 included
                                  - Reset mode BOOTSTART included
                                  - New handshake and definitions for
                                    state field transfer included

  V1.008  MY          05.06.97    - GETMESSAGECMD, size of message included,
                                    to prevent overwriting of user buffer

  V1.007  MY          05.06.97    - static definition of the
                                    IOSEND and IORECEIVE data area removed
                                  - BOARD_INFOEX structure and function
                                    DevGetBoardInfoEx included

  V1.006  MY          25.04.97    - function DevGetExtendedInfo included

  V1.005  MY          30.11.96    - function DevExtendedData, DevGetMBXData
                                    included
                                  - error -25 included

  V1.004  MY          18.06.96    - IO function IOCTLREADSEND
                                    included

  V1.003  MY          25.04.96    - IO function IOCTLEXIO
                                                IOGETPARAM
                                                IOSETHOST
                                    included

  V1.002  MY          28.02.96    - function DevGetMBXState included
                                  - Variable name MSG_STRUC.daten
                                    changed into data

  V1.001  MY          31.01.96    - user interface changed

  V1.000  MY


  ******************************************************************** <En> */

#if defined( _MSC_VER)          /* Microsoft C */
  #ifdef __cplusplus            /* C++ definition */
    extern "C" {
  #endif  /* _cplusplus */

  #pragma pack(1)               /* Byte Alignment   */
#endif


#ifdef _WINDLL
  #define APIENTRY WINAPI
#else
  #define APIENTRY
#endif

/* ------------------------------------------------------------------------------------ */
/*  global definitions                                                                  */
/* ------------------------------------------------------------------------------------ */

#define MAX_DEV_BOARDS              4       /* maximum numbers of boards                */

/* ------------------------------------------------------------------------------------ */
/*  driver errors                                                                       */
/* ------------------------------------------------------------------------------------ */

#define DRV_NO_ERROR                 0      /* no error                                     */
#define DRV_BOARD_NOT_INITIALIZED   -1      /* DRIVER board not initialized                 */
#define DRV_INIT_STATE_ERROR        -2      /* DRIVER error in internal init state          */
#define DRV_READ_STATE_ERROR        -3      /* DRIVER error in internal read state          */
#define DRV_CMD_ACTIVE              -4      /* DRIVER command on this chanal is activ       */
#define DRV_PARAMETER_UNKNOWN       -5      /* DRIVER unknown parameter in function occured */
#define DRV_WRONG_DRIVER_VERSION    -6      /* DRIVER driver version is incompatible with DLL*/
                                                                                            
#define DRV_DEV_DPM_ACCESS_ERROR    -10     /* DEVICE dual port ram not accessable          */
#define DRV_DEV_NOT_READY           -11     /* DEVICE not ready (ready flag failed)         */
#define DRV_DEV_NOT_RUNNING         -12     /* DEVICE not running (running flag failed)     */
#define DRV_DEV_WATCHDOG_FAILED     -13     /* DEVICE watch dog test failed                 */
#define DRV_DEV_OS_VERSION_ERROR    -14     /* DEVICE signals wrong OS version              */
#define DRV_DEV_SYSERR              -15     /* DEVICE error in dual port flags              */
#define DRV_DEV_MAILBOX_FULL        -16     /* DEVICE send mailbox is full                  */
#define DRV_DEV_PUT_TIMEOUT         -17     /* DEVICE PutMessage timeout                    */
#define DRV_DEV_GET_TIMEOUT         -18     /* DEVICE GetMessage timeout                    */
#define DRV_DEV_GET_NO_MESSAGE      -19     /* DEVICE no message available                  */
#define DRV_DEV_RESET_TIMEOUT       -20     /* DEVICE RESET command timeout                 */
#define DRV_DEV_NO_COM_FLAG         -21     /* DEVICE COM-flag not set                      */
#define DRV_DEV_EXCHANGE_FAILED     -22     /* DEVICE IO data exchange failed               */
#define DRV_DEV_EXCHANGE_TIMEOUT    -23     /* DEVICE IO data exchange timeout              */
#define DRV_DEV_COM_MODE_UNKNOWN    -24     /* DEVICE IO data mode unknown                  */
#define DRV_DEV_FUNCTION_FAILED     -25     /* DEVICE Function call failed                  */
#define DRV_DEV_DPMSIZE_MISMATCH    -26     /* DEVICE DPM size differs from configuration   */
#define DRV_DEV_STATE_MODE_UNKNOWN  -27     /* DEVICE COM state mode unknown                */

/* Error from Interface functions */
#define DRV_USR_OPEN_ERROR          -30     /* USER driver not opened                       */
#define DRV_USR_INIT_DRV_ERROR      -31     /* USER can't connect with DEV board            */
#define DRV_USR_NOT_INITIALIZED     -32     /* USER board not initialized                   */
#define DRV_USR_COMM_ERR            -33     /* USER IOCTRL function faild                   */
#define DRV_USR_DEV_NUMBER_INVALID  -34     /* USER parameter for DEV number invalid        */
#define DRV_USR_INFO_AREA_INVALID   -35     /* USER parameter InfoArea unknown              */
#define DRV_USR_NUMBER_INVALID      -36     /* USER parameter Number invalid                */
#define DRV_USR_MODE_INVALID        -37     /* USER parameter Mode invalid                  */
#define DRV_USR_MSG_BUF_NULL_PTR    -38     /* USER NULL pointer assignment                 */
#define DRV_USR_MSG_BUF_TOO_SHORT   -39     /* USER Messagebuffer too short                 */
#define DRV_USR_SIZE_INVALID        -40     /* USER size parameter invalid                  */
#define DRV_USR_SIZE_ZERO           -42     /* USER size parameter with zero length         */
#define DRV_USR_SIZE_TOO_LONG       -43     /* USER size parameter too long                 */
#define DRV_USR_DEV_PTR_NULL        -44     /* USER device address null pointer             */
#define DRV_USR_BUF_PTR_NULL        -45     /* USER pointer to buffer is a null pointer     */

#define DRV_USR_SENDSIZE_TOO_LONG   -46     /* USER SendSize parameter too long             */
#define DRV_USR_RECVSIZE_TOO_LONG   -47     /* USER ReceiveSize parameter too long          */
#define DRV_USR_SENDBUF_PTR_NULL    -48     /* USER pointer to buffer is a null pointer     */
#define DRV_USR_RECVBUF_PTR_NULL    -49     /* USER pointer to buffer is a null pointer     */


#define DRV_RCS_ERROR_OFFSET       1000     /* RCS error number start                       */


/* ------------------------------------------------------------------------------------ */
/*  message definition                                                                  */
/* ------------------------------------------------------------------------------------ */

/* max. length is 288 Bytes, max message length is 255 + 8 Bytes */
typedef struct tagMSG_STRUC {
  unsigned char   rx;
  unsigned char   tx;
  unsigned char   ln;
  unsigned char   nr;
  unsigned char   a;
  unsigned char   f;
  unsigned char   b;
  unsigned char   e;
  unsigned char   data[255];
  unsigned char   dummy[25];      /* for compatibility with older definitions (288 Bytes)*/
} MSG_STRUC;


/* ------------------------------------------------------------------------------------ */
/*  INFO structure definitions                                                          */
/* ------------------------------------------------------------------------------------ */

/* DEVRESET */

#define COLDSTART           2
#define WARMSTART           3
#define BOOTSTART           4

/* DEVMBXINFO */

#define DEVICE_MBX_EMPTY    0
#define DEVICE_MBX_FULL     1
#define HOST_MBX_EMPTY      0
#define HOST_MBX_FULL       1

/* TRIGGERWATCHDOG */

#define WATCHDOG_STOP       0
#define WATCHDOG_START      1

/* GETINFO InfoArea definitions */

#define GET_DRIVER_INFO     1
#define GET_VERSION_INFO    2
#define GET_FIRMWARE_INFO   3
#define GET_TASK_INFO       4
#define GET_RCS_INFO        5
#define GET_DEV_INFO        6
#define GET_IO_INFO         7
#define GET_IO_SEND_DATA    8

/* HOST mode definition */

#define HOST_NOT_READY      0
#define HOST_READY          1

/* DEVREADWRITERAW */

#define PARAMETER_READ      1
#define PARAMETER_WRITE     2

/* STATE definition */

#define STATE_ERR_NON       0
#define STATE_ERR           1

#define STATE_MODE_2        2
#define STATE_MODE_3        3
#define STATE_MODE_4        4

/* Device exchange IO information */
typedef struct tagIOINFO {
  unsigned char   bComBit;                /* Actual state of the COM bit                */
  unsigned char   bIOExchangeMode;        /* Actual data exchange mode (0..5)           */
  unsigned long   ulIOExchangeCnt;        /* Exchange IO counter                        */
} IOINFO;

/* Device version information */
typedef struct tagVERSIONINFO {           /* DEV serial number and OS versions          */
  unsigned long   ulDate;
  unsigned long   ulDeviceNo;
  unsigned long   ulSerialNo;
  unsigned long   ulReserved;
  unsigned char   abPcOsName0[4];
  unsigned char   abPcOsName1[4];
  unsigned char   abPcOsName2[4];
  unsigned char   abOemIdentifier[4];
} VERSIONINFO;

⌨️ 快捷键说明

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