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

📄 pmacu.h

📁 美国Delta Tau公司PMAC多轴运动控制卡的VC++示例程序
💻 H
📖 第 1 页 / 共 2 页
字号:

  HWND   hWnd; // Window handle of app for use w/ messages boxes

  /////////////////////////////////
  // ADDED for the NEW PmacServer and not used by the
  // PComm32.dll or OLD PmacServer, !Do not remove these from
  // the end of the structure
#ifndef _PMACSERVER
  UINT   dummy1;
  HANDLE dummy2;
  HANDLE dummy3;
  BOOL   dummy4;
#else
  // Interrupt Stuff & inter-thread sync data
  UINT   uiINTRThreadId;
  HANDLE hINTRThread;
  HANDLE hINTRCompleteEvent;
  BOOL   bINTRTerminateThread;
#endif

} USER_HANDLE, *PUSER_HANDLE;


///////////////////////////////////////////////////////////////////////////////
// Global
///////////////////////////////////////////////////////////////////////////////
typedef struct _GLOBAL_HANDLE
{
  
  DWORD dwSize;       // Keep track of structure size
  BOOL  bInitialized; // Indicates that the global memory has been setup

  CHAR   version[VERSION_BUFFER_SIZE]; // store version string
  CHAR   date[DATE_BUFFER_SIZE];       // store date string
  CHAR   errorstr[80];                 // stored last error string
  PMACDEVICETYPE PmacType;             // 0 = DT_PMAC, 1 = DT_TURBO
  PMACFIRMWARETYPE PmacFirmware;
  DWORD  cpu_type;
  BOOL   bIsTurbo;

  LOCATIONTYPE Location; // PCBUS, SERIALPORT
  DWORD  dwEnum;         // Location Enumeration

  DWORD  dwMaxMotors;    // Maximum motors on PMAC, 32 if turbo else 8
  DWORD  dwMaxIMPQVars;  // Maximum IMPQ Vars on PMAC, 8191 if turbo else 1023
                         // BUS
  short  BUSCommError;   // BUS ascii comm error current value

  // LT_COM - SERIAL
  DCB           dcb;
  COMMTIMEOUTS  cto;
  DWORD         SERCommError;
  DWORD         SERPort;
  DWORD         SERBaudrate;
  UCHAR         SERParity;
  BOOL          SERCTSOutput;
  DWORD         SERRTSControl;

  // Status storage
  DWORD         DPRbuf_start;       // PMAC/TURBO DPR Start Address
  BOOL          bDPRInitialized;    // DPR has been initialized
  USHORT        DPRAsciiActive;     // DPR ASCII comm is currently active

  DWORD         DPRRealtActive;     // DPR foreground active
  DWORD         DPRRealtPeriod;     // DPR foreground update period in msec
  UINT          DPRNumMotors;       // number of motor/coords (i59) or masked

  DWORD         DPRAutoActive;      // DPR Automatic functions may need to be disabled for USB

  DWORD         DPRBackgActive;     // DPR background active
  DWORD         DPRBackgPeriod;     // DPR background update period in msec
  DWORD         EnableInterrupts;   // Enables Interrupts for PCI cards

  USHORT        DPRBackgvActive;    // DPR Background variable data buffer active
  USHORT        DPRCpanelActive;    // DPR control panel active
  USHORT        DPRRotaryActive;    // DPR Binary rotary buffer active
  struct realt  DPRRTBuffer;           // real time buffer        (ofs = 0x00D,size = 516)
  struct realtTURBO DPRRTBufferTurbo;  // Turbo real time buffer  (ofs = 0x068,size = 1556)
  struct backg  DPRBGBuffer;           // background buffer       (ofs = 0x228,size = 1028)
  struct backgTURBO DPRBGBufferTurbo;  // Turbo background buffer (ofs = 0x674,size = 1704)

  short         DPRCommError;       // DPR ascii comm error current value
  DWORD         i10;                // current i10 parameter
  double        posscale[32 ];      // current ix08 * 32 scale factor
  double        velscale[32 ];      // current ix09 * 32 scale factor

  USHORT        DPRRotSize[16];     // Size of DPRAM binary rotary 1 & 2
  USHORT        DPRBGVBnum_usrs;
  USHORT        DPRBGVBmulti_user_mode;
  DWORD         DPRVarStart;        // Start of DPR var & end of DPR buffers

  BOOL  CanUsePlcc;            // indicates can use compiled plc
  BOOL  WantUsePlcc;           // Want to compile PLC
  BOOL  Downloading;           // indicates download thread working
  BOOL  bootstrap_mode;        // In bootstrap mode
  DWORD linkfile[MAXLINKS];    // PLCC PMAC Link addresses
  DWORD plccbuffer;            // PLCC Program Scheduler Start Addresses
  DWORD plccret;               // PLCC Program RET
  DWORD plccstart;             // PLCC Program Start
  DWORD plccjmp;               // PLCC Program Scheduler Start


  // Gather stuff
  double ulGatherSampleTime;                    // Sample gather time in msec
  UINT   uGatherPeriod;                         // I19 number servo cycles per sample
  DWORD  dwGatherMask;                          // I20 (determines #sources & types)
  DWORD  dwGatherMask2;
  UINT   uGatherSources;                        // Number of sources gathered
  UINT   uGatherSamples;                        // Number of samples gathered
  UINT   uGatherSampleLen;                      // Number 24-bit words per sample
  BOOL   bGatherEnabled[MAXGATHERS2];           // Sources enabled
  char   szGatherAdr[MAXGATHERS2 ][MAXADRLEN ]; // Types and addresses of gathers
  UINT   uGatherSize[MAXGATHERS2];              // Size of gather type in 24bit words

  // Real gather stuff
  int    hRTGatherHandle;             // Handle to var background
  UINT   uRTGatherSources;            // Number of sources gathered
  UINT   uRTGatherSamples;            // Number of samples in gather array
  ULONG  ulRTGatherAdr[MAXRTGATHERS]; // Array of var buf gather sources

  // Mutex handle makes multi threading safe even from serial port
  //HANDLE hMutex;

  // Timeout values and counts
  DWORD  dwBaseTimeoutCount;

  DWORD  dwDPRRTimeoutCount;
  DWORD  dwDPRRTimeout;
  DWORD  dwDPRBKTimeoutCount;
  DWORD  dwDPRBKTimeout;
  DWORD  dwDPRCharTimeoutCount;
  DWORD  dwDPRCharTimeout;
  DWORD  dwDPRFlushTimeoutCount;
  DWORD  dwDPRFlushTimeout;
  DWORD  dwBUSCharTimeoutCount;
  DWORD  dwBUSCharTimeout;
  DWORD  dwSERFlushTimeout;
  DWORD  dwSERFlushTimeoutCount;
  DWORD  dwSERCharTimeout;
  DWORD  dwSERCharTimeoutCount;

  SOCKET initialSocket;
  DWORD  initialPID;
  WSAPROTOCOL_INFO ProtocolInfo;
  DWORD  dwUserCount;

  /////////////////////////////////
  // ADDED for the NEW PmacServer and not used by the
  // PComm32.dll or OLD PmacServer, !Do not remove these from
  // the end of the structure
#ifndef _PMACSERVER
#else
#endif

} GLOBAL_HANDLE, *PGLOBAL_HANDLE;

  #ifdef __cplusplus
}
  #endif

  #if defined( _DRIVER ) // DLL Include +++++++++++++++++++++++++++
                         // // debug macros
                         //  #if defined(DBG) || defined(_DEBUG)
                         //    void dbgPrintf(CHAR szFormat, ...);
                         //    extern int vcuDebugLevel;
                         //
                         //    #define dprintf(_x_)      dbgPrintf _x_
                         //    #define dprintf1(_x_)     if (vcuDebugLevel >= 1) dbgPrintf _x_
                         //    #define dprintf2(_x_)     if (vcuDebugLevel >= 2) dbgPrintf _x_
                         //    #define dprintf3(_x_)     if (vcuDebugLevel >= 3) dbgPrintf _x_
                         //    #define dprintf4(_x_)     if (vcuDebugLevel >= 4) dbgPrintf _x_
                         //  #else
                         //    #define dprintf(_x_)
                         //    #define dprintf1(_x_)
                         //    #define dprintf2(_x_)
                         //    #define dprintf3(_x_)
                         //    #define dprintf4(_x_)
                         // #endif

    #define WAIT_2SEC 2000 // Mutex object wait period of 2 sec.
    #define WAIT_5SEC 5000 // Mutex object wait period of 5 sec.
    #define TIMEOUT_COUNT_TIME    500


    #include <CRTDBG.H>
    #include <devioctl.h>
    #include <assert.h>
    #include "mcstruct.h"
    #include "mioctl.h"
    #include "registry.h"
    #include "bintoken.h"
    #include "cmplc56k.h"
    #include "pmacerr.h"
#ifndef _PMACSERVER
    #include "dprrealt.h"
    #include "dprbkg.h"
    #include "bus.h"
    #include "serial.h"
    #include "dprotlib.h"
    #include "cmplclib.h"
    #include "download.h"
    #include "utildt.h"
    #include "lips.h"
    #include "macro.h"
    #include "dialog.h"
#endif

// Global externals
typedef struct tagGlobalData
{
  DWORD         dwSize;
  DWORD         dwUserCount; // Count uf users

  REG_ACCESS    RegistryAccess[MAX_MOTION_DEVICES + 1]; // registry access global
  CONFIG_LOCATION cfg[MAX_MOTION_DEVICES];              // Configuration values from registry
  GLOBAL_HANDLE gh[MAX_MOTION_DEVICES + 1];             // driver access handle

  HMODULE       hLangModule;

  char USResponse[MAX_MOTION_DEVICES + 1][USRESPONSE_SIZE];// Unsolicited response buffer
  DWORD         usr_next_in[MAX_MOTION_DEVICES + 1];
  DWORD         usr_next_out[MAX_MOTION_DEVICES + 1];

  char ChangeMonitor[MAX_MOTION_DEVICES + 1][IVARCHANGEMONITOR_SIZE];// Used for monitoring I-Variable Mod's by apps
  DWORD         cm_next_in[MAX_MOTION_DEVICES + 1];
  DWORD         cm_next_out[MAX_MOTION_DEVICES + 1];

  HANDLE        hServerPID ;
  DWORD         dwServerPID;
  BOOL          My_g_bDPRThreadRunning;
} GLOBAL_DATA, *PGLOBAL_DATA;

extern USER_HANDLE   vh[MAX_MOTION_DEVICES + 1 ]; // driver access handle
extern PGLOBAL_DATA  pGlobalData;
extern OSVERSIONINFO OsInfo;                      // Operating system information

  #ifdef __cplusplus
extern "C" {
  #endif


  #ifdef __cplusplus
}
  #endif

  #else // Application include +++++++++++++++++++++++++++++++++++++++++++++++++

    #include "Include\mioctl.h"
    #include <mmsystem.h>
    #include "Include\common.h"
    #include "Include\bus.h"
    #include "Include\dpr.h"
    #include "Include\serial.h"
    #include "Include\intr.h"
    #include "Include\dprotlib.h"
    #include "Include\dprbkg.h"
    #include "Include\cmplclib.h"
    #include "Include\pmacerr.h"
    #include "Include\download.h"
    #include "Include\utildt.h"
    #include "Include\gather.h"
    #include "Include\lips.h"
    #include "Include\macro.h"

  #ifdef __cplusplus
extern "C" {
  #endif

extern HANDLE *ghLangModule;
extern USER_HANDLE   vh[MAX_MOTION_DEVICES + 1 ]; // driver access handle
extern GLOBAL_HANDLE gh[MAX_MOTION_DEVICES + 1 ]; // device access handle

  #ifdef __cplusplus
}
  #endif

  #endif


#endif //_PMACU_H_

⌨️ 快捷键说明

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