SDC C-Project CF Review 프로그램
LYW
2021-09-23 c08b701c90c8998b241c82638d5c488e03238214
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
/***************************************************************************
  (C) Copyright DELTA TAU DATA SYSTEMS Inc., 1992
 
  Title:    UtilDT.h
 
  Version:  1.00
 
  Date:   11/18/1992
 
  Author(s):  Dennis Smith
 
  Header file for Utility functions.
 
  Note(s):
 
----------------------------------------------------------------------------
 
  Change log:
 
    Date       Rev   Who      Description
  --------- ----- ----- --------------------------------------------
17Aug99 JET added PmacNetActualPosition()
19Nov97 JET added PmacLMH()
**************************************************************************/
 
#ifndef _UTILDT_H
  #define _UTILDT_H
 
  #include <stdio.h>
  #include "pmacsock.h"
 
///////////////////////////////////////////////////////////////////////////
// Status structures
 
typedef struct {
  BOOL  plc_enabled;
  UINT  plc_start_addr;
  UINT  plc_end_addr;
  UINT  plc_size;
 } PLC_STATUS_STRUCT;
 
typedef struct {
 BOOL  plcc_loaded;
 BOOL  plcc_enabled;
 UINT  plcc_start_addr;
 UINT  plcc_end_addr;
 UINT  plcc_size;
} PLCC_STATUS_STRUCT;
 
typedef struct {
 UINT num_plc;
 UINT num_plcc;
 UINT I5;
 PLC_STATUS_STRUCT plc[32];
 PLCC_STATUS_STRUCT plcc[32];
} TOTAL_PLC_STATUS_STRUCT;
 
///////////////////////////////////////////////////////////////////////////
// Functions
  #ifdef __cplusplus
extern "C" {
  #endif
 
  // Internal functions
  BOOL   GetFileName( HWND hWindow, BOOL save, LPTSTR title, LPTSTR fileName, LPTSTR filter );
  FILE *getFilePointer( const char *full_path, const char *mode );
  BOOL   SetPmacType( DWORD dwDevice );
  DWORD  SetMaxMotors( DWORD dwDevice );
  BOOL   SetRomDate( DWORD dwDevice );
  BOOL   SetRomVersion( DWORD dwDevice );
  BOOL   SetLinkList( DWORD dwDevice );
  BOOL  CALLBACK BackupLinkList( DWORD dwDevice );
  BOOL  CALLBACK  RestoreLinkList( char *szFirmwareVersion );
  BOOL   SetScales( DWORD dwDevice );
  void   ReportSystemError( PCHAR name );
  BOOL   CalibrateTimeout( DWORD timeoutMsec, DWORD * timeoutCount );
  int    CALLBACK PmacGetEnumeration(DWORD dwDevice);
  LOCATIONTYPE CALLBACK PmacGetLocation(DWORD dwDevice);
 
  // Exported functions
  BOOL   CALLBACK OpenPmacDevice( DWORD dwDevice );
  BOOL   CALLBACK ClosePmacDevice( DWORD dwDevice );
  BOOL CALLBACK VMETestOpenPmacDevice( DWORD dwDevice, BOOL bMailboxOnly );
  BOOL CALLBACK VMETestClosePmacDevice( DWORD dwDevice );
  BOOL CALLBACK bPMACIsTurbo( DWORD dwDevice );
 
  BOOL CALLBACK StoreUSResponse(DWORD dwDevice,CHAR * buf, DWORD size);
  BOOL CALLBACK GetUSResponse(DWORD dwDevice, PCHAR buf, UINT maxchar);
  BOOL CALLBACK USReadReady(DWORD dwDevice);
  BOOL CALLBACK ChangeStore(DWORD dwDevice,CHAR * buf);
  BOOL CALLBACK ChangeGet(DWORD dwDevice, PCHAR buf, UINT maxchar);
  BOOL CALLBACK ChangeReadReady(DWORD dwDevice);
  DWORD CALLBACK MapDeviceNumToEnumAndLocation(LOCATIONTYPE loc,DWORD dwEnum);
  DWORD CALLBACK MapLocAndEnumFromDeviceNum(DWORD dwDevNum, LOCATIONTYPE  *loc,DWORD *dwEnum);
  BOOL CALLBACK ShutdownPmacDevice(DWORD dwDevice,BOOL bForceShutdown);
 
  BOOL   CALLBACK PmacNcAvailable( void );
  BOOL   CALLBACK PmacSetLanguage( const DWORD dwDevice, char *locale );
  void   CALLBACK PmacLMH( HANDLE * hndl );
  BOOL   CALLBACK SetLanguageModule( const char *locale, const HMODULE hProcess, HMODULE * h );
  void   CALLBACK PmacSetWindow( DWORD dwDevice, HWND hWnd );
  LPSTR  CALLBACK szLoadStringA( HMODULE hInst, int iID );
  PCHAR  CALLBACK szStripControlCharA( PCHAR str );
  PCHAR  CALLBACK szStripWhiteSpaceA( PCHAR str );
  BOOL   CALLBACK PmacReadReady( DWORD dwDevice );
  DWORD  CALLBACK PmacReadReadyEx( DWORD dwDevice );
  int    CALLBACK PmacGetError( DWORD dwDevice );
  ASCIIMODE CALLBACK PmacGetAsciiComm( DWORD dwDevice );
  BOOL   CALLBACK PmacSetAsciiComm( DWORD dwDevice, ASCIIMODE m );
  BOOL   CALLBACK PmacMotionBufOpen( DWORD dwDevice );
  BOOL   CALLBACK PmacRotBufOpen( DWORD dwDevice );
  BYTE   CALLBACK PmacGetIntStatusReg( DWORD dwDevice );
 
  BOOL CALLBACK PmacLoadNTDriver( DWORD dwDevice );
  BOOL CALLBACK PmacUnloadNTDriver( DWORD dwDevice );
  BOOL CALLBACK PmacNTDriverLoaded( DWORD dwDevice );
  BOOL CALLBACK PmacRemoveNTDriver( DWORD dwDevice );
  void CALLBACK LockPmac( DWORD dwDevice );
  void CALLBACK ReleasePmac( DWORD dwDevice );
 
  BOOL CALLBACK  PmacSetCriticalIVars(DWORD dwDevice);
 
  BOOL   CALLBACK PmacGetVariableStrA( DWORD dwDevice, CHAR ch, LPSTR str, UINT num );
  short int CALLBACK PmacGetVariable( DWORD dwDevice, CHAR ch, UINT num, short int def );
  short int CALLBACK PmacGetIVariable( DWORD dwDevice, UINT num, short int def );
  long   CALLBACK PmacGetVariableLong( DWORD dwDevice, TCHAR ch, UINT num, long def );
  double CALLBACK PmacGetVariableDouble( DWORD dwDevice, TCHAR ch, UINT num, double def );
  long   CALLBACK PmacGetIVariableLong( DWORD dwDevice, UINT num, long def );
  double CALLBACK PmacGetIVariableDouble( DWORD dwDevice, UINT num, double def );
 
  void   CALLBACK PmacSetVariable( DWORD dwDevice, CHAR ch, UINT num, short int val );
  void   CALLBACK PmacSetIVariable( DWORD dwDevice, UINT num, short int val );
  void   CALLBACK PmacSetVariableLong( DWORD dwDevice, TCHAR ch, UINT num, long val );
  void   CALLBACK PmacSetVariableDouble( DWORD dwDevice, TCHAR ch, UINT num, double val );
  void   CALLBACK PmacSetIVariableLong( DWORD dwDevice, UINT num, long val );
  void   CALLBACK PmacSetIVariableDouble( DWORD dwDevice, UINT num, double val );
  int    CALLBACK PmacGetProgramInfo( DWORD dwDevice, BOOL plc, int num, UINT * sadr, UINT * fadr );
  PUSER_HANDLE CALLBACK PmacGetUserHandle( DWORD dwDevice );
  BOOL   CALLBACK PmacConfigure( HWND hwnd, DWORD dwDevice );
  double CALLBACK PmacGetDrvVersion( DWORD dwDevice );
  BOOL   CALLBACK PmacGetDpramAvailable( DWORD dwDevice );
  BOOL   CALLBACK PmacInBootStrapMode( DWORD dwDevice );
 
  // ASCII string exported functions
  BOOL  CALLBACK PmacDoChecksums( DWORD dwDevice, BOOL bVal );
  PCHAR CALLBACK PmacGetRomDateA( DWORD dwDevice, PCHAR s, int maxchar );
  PCHAR CALLBACK PmacGetRomVersionA( DWORD dwDevice, PCHAR s, int maxchar );
 
  int   CALLBACK PmacGetResponseA( DWORD dwDevice, PCHAR s, UINT maxchar, PCHAR outstr );
  int   CALLBACK PmacGetResponseExA( DWORD dwDevice, PCHAR s, UINT maxchar, PCHAR outstr );
  int   CALLBACK PmacGetControlResponseA( DWORD dwDevice, PCHAR s, UINT maxchar, CHAR outchar );
  int   CALLBACK PmacGetControlResponseExA( DWORD dwDevice, PCHAR s, UINT maxchar, CHAR outchar );
 
  BOOL  CALLBACK PmacSendCharA( DWORD dwDevice, CHAR outchar );
  int   CALLBACK PmacSendLineA( DWORD dwDevice, PCHAR outchar );
  int   CALLBACK PmacGetLineA( DWORD dwDevice, PCHAR linebuf, UINT maxCHAR );
  int   CALLBACK PmacGetLineExA(DWORD dwDevice,PCHAR linebuf,UINT maxchar);
  int   CALLBACK PmacGetBufferA( DWORD dwDevice, PCHAR linebuf, UINT maxchar );
  void  CALLBACK PmacSendCommandA( DWORD dwDevice, PCHAR outCHAR );
  void  CALLBACK PmacFlush( DWORD dwDevice );
  int   CALLBACK PmacGetPmacType( DWORD dwDevice );
  BOOL  CALLBACK PmacGetIVariableStrA( DWORD dwDevice, LPSTR str, UINT num );
  int   CALLBACK PmacMultiDownloadA( DWORD dwDevice, DOWNLOADMSGPROC msgp, PCHAR outfile,
                   PCHAR inifile, PCHAR szUserId, BOOL macro, BOOL map, BOOL log, BOOL dnld );
  int   CALLBACK PmacAddDownloadFileA( DWORD dwDevice, PCHAR inifile, PCHAR szUserId, PCHAR szDLFile );
  int   CALLBACK PmacRemoveDownloadFileA( DWORD dwDevice, PCHAR inifile, PCHAR szUserId, PCHAR szDLFile );
  void  CALLBACK PmacRenumberFilesA( DWORD dwDevice, int file_num, PCHAR szIniFile );
  int   CALLBACK PmacGetErrorStrA( DWORD dwDevice, PCHAR str, int maxchar );
 
  // Unicode string exported functions
  int  CALLBACK PmacGetResponseW( DWORD dwDevice, PWCHAR s, UINT maxchar, PWCHAR outstr );
  int  CALLBACK PmacGetResponseExW( DWORD dwDevice, PWCHAR s, UINT maxchar, PWCHAR outstr );
  int  CALLBACK PmacGetControlResponseW( DWORD dwDevice, PWCHAR s, UINT maxchar, WCHAR outchar );
  int  CALLBACK PmacGetControlResponseExW( DWORD dwDevice, PWCHAR s, UINT maxchar, WCHAR outchar );
  BOOL CALLBACK PmacSendCharW( DWORD dwDevice, WCHAR outchar );
  int  CALLBACK PmacSendLineW( DWORD dwDevice, PWCHAR outchar );
  int  CALLBACK PmacGetLineW( DWORD dwDevice, PWCHAR linebuf, UINT maxCHAR );
  int  CALLBACK PmacGetLineExW(DWORD dwDevice,PWCHAR linebuf,UINT maxchar);
  int  CALLBACK PmacGetBufferW( DWORD dwDevice, PWCHAR linebuf, UINT maxchar );
  void CALLBACK PmacSendCommandW( DWORD dwDevice, PWCHAR outchar );
  BOOL CALLBACK PmacGetIVariableStrW( DWORD dwDevice, LPWSTR str, UINT num );
  WORD CALLBACK PmacGetPlcStatus( DWORD dwDevice, TOTAL_PLC_STATUS_STRUCT * plc_stat );
  BOOL CALLBACK PmacIsAnyPLCRunning(DWORD dwDevice);
  int  CALLBACK PmacMultiDownloadW( DWORD dwDevice, DOWNLOADMSGPROC msgp, PWCHAR outfile,
                   PWCHAR inifile, PWCHAR szUserId, BOOL macro, BOOL map, BOOL log, BOOL dnld );
  int  CALLBACK PmacAddDownloadFileW( DWORD dwDevice, PWCHAR inifile, PWCHAR szUserId, PWCHAR szDLFile );
  int  CALLBACK PmacRemoveDownloadFileW( DWORD dwDevice, PWCHAR inifile, PWCHAR szUserId, PWCHAR szDLFile );
  void CALLBACK PmacRenumberFilesW( DWORD dwDevice, int file_num, PWCHAR szIniFile );
  int  CALLBACK PmacGetErrorStrW( DWORD dwDevice, PWCHAR str, int maxchar );
 
  // Functions  pertaining to status
  BOOL CALLBACK PmacGetGlobalStatus( DWORD dwDevice, DWORD * status );
  BOOL CALLBACK PmacGetCoordStatus( DWORD dwDevice, UINT csn, DWORD * status );
  BOOL CALLBACK PmacGetMotorStatus( DWORD dwDevice, UINT mtr, DWORD * status );
 
  // Functions  pertaining to global
  BOOL CALLBACK PmacSysServoError( DWORD dwDevice );
  BOOL CALLBACK PmacSysReEntryError( DWORD dwDevice );
  BOOL CALLBACK PmacSysMemChecksumError( DWORD dwDevice );
  BOOL CALLBACK PmacSysPromChecksumError( DWORD dwDevice );
 
  // Functions pertaining to position
  double CALLBACK PmacGetCommandedPos( DWORD dwDevice, int mtr, double units );
  double CALLBACK PmacPosition( DWORD dwDevice, int mtr, double units );
  double CALLBACK PmacNetActualPosition(DWORD dwDevice,int mtr,double units);
  double CALLBACK PmacFollowError( DWORD dwDevice, int mtr, double units );
  double CALLBACK PmacGetVel( DWORD dwDevice, int mtr, double units );
  void   CALLBACK PmacGetMasterPos( DWORD dwDevice, int mtr, double units, double *the_double );
  void   CALLBACK PmacGetCompensationPos( DWORD dwDevice, int mtr, double units, double *the_double );
 
 
  // Functions pertaining to coord systems
  long CALLBACK PmacPe( DWORD dwDevice, int cs );
  BOOL CALLBACK PmacRotBufFull( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacSysInposition( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacSysWarnFError( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacSysFatalFError( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacSysRunTimeError( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacSysCircleRadError( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacSysAmpFaultError( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacProgRunning( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacProgStepping( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacProgContMotion( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacProgContRequest( DWORD dwDevice, int crd );
  int  CALLBACK PmacProgRemaining( DWORD dwDevice, int crd );
  BOOL CALLBACK PmacMotionBufOpen( DWORD dwDevice );
  BOOL CALLBACK PmacRotBufOpen( DWORD dwDevice );
  double CALLBACK PmacGetFeedRateMode( DWORD dwDevice, int csn, int * mode );
  double CALLBACK PmacGetAxisTargetPos( DWORD dwDevice, int crd, char axchar );
 
  // Functions pertaining to individual motors
  BOOL  CALLBACK PmacAmpEnabled( DWORD dwDevice, int mtr );
  BOOL  CALLBACK PmacWarnFError( DWORD dwDevice, int mtr );
  BOOL  CALLBACK PmacFatalFError( DWORD dwDevice, int mtr );
  BOOL  CALLBACK PmacAmpFault( DWORD dwDevice, int mtr );
  BOOL  CALLBACK PmacOnPositionLimit( DWORD dwDevice, int mtr );
  BOOL  CALLBACK PmacHomeComplete( DWORD dwDevice, int mtr );
  BOOL  CALLBACK PmacInposition( DWORD dwDevice, int mtr );
  double CALLBACK PmacGetTargetPos( DWORD dwDevice, int motor, double posscale );
  double CALLBACK PmacGetBiasPos( DWORD dwDevice, int motor, double posscale );
  long  CALLBACK PmacTimeRemInMove( DWORD dwDevice, int cs );
  long  CALLBACK PmacTimeRemInTATS( DWORD dwDevice, int cs );
  BOOL CALLBACK PmacDataBlock( DWORD dwDevice, int mtr );
  BOOL CALLBACK PmacPhasedMotor( DWORD dwDevice, int mtr );
  BOOL CALLBACK PmacMotorEnabled( DWORD dwDevice, int mtr );
  BOOL CALLBACK PmacHandwheelEnabled( DWORD dwDevice, int mtr );
  BOOL CALLBACK PmacOpenLoop( DWORD dwDevice, int mtr );
  BOOL CALLBACK PmacOnNegativeLimit( DWORD dwDevice, int mtr );
  BOOL CALLBACK PmacOnPositiveLimit( DWORD dwDevice, int mtr );
  void CALLBACK PmacSetJogReturn( DWORD dwDevice, int mtr );
 
  // Command Logging
  BOOL CALLBACK CommandLogging( DWORD dwDevice, PCHAR str, BOOL dirn );
  BOOL CALLBACK CommandLoggingW( DWORD dwDevice, PWCHAR outstr, BOOL dirn );
 
  // Logical query functions
  PROGRAM    CALLBACK PmacGetProgramMode( DWORD dwDevice, int csn );
  MOTIONMODE CALLBACK PmacGetMotionMode( DWORD dwDevice, int csn );
  MOTION     CALLBACK PmacGetMotorMotion( DWORD dwDevice, int mtr );
 
  #ifdef __cplusplus
}
  #endif
 
  #ifdef UNICODE
    #define PmacGetResponse PmacGetResponseW
    #define PmacGetControlResponse PmacGetControlResponseW
    #define PmacGetControlResponseEx PmacGetControlResponseExW
    #define PmacSendChar PmacSendCharW
    #define PmacSendLine PmacSendLineW
    #define PmacGetLine PmacGetLineW
    #define PmacGetLineEx PmacGetLineExW
    #define PmacGetBuffer PmacGetBufferW
    #define PmacSendCommand PmacSendCommandW
    #define PmacMultiDownload PmacMultiDownloadW
    #define PmacAddDownloadFile PmacAddDownloadFileW
    #define PmacRemoveDownloadFile PmacRemoveDownloadFileW
    #define PmacRenumberFiles PmacRenumberFilesW
    #define PmacGetErrorStr PmacGetErrorStrW
  #else
    #define PmacGetResponse PmacGetResponseA
    #define PmacGetControlResponse PmacGetControlResponseA
    #define PmacGetControlResponseEx PmacGetControlResponseExA
    #define PmacSendChar PmacSendCharA
    #define PmacSendLine PmacSendLineA
    #define PmacGetLine PmacGetLineA
    #define PmacGetLineEx PmacGetLineExA
    #define PmacGetBuffer PmacGetBufferA
    #define PmacSendCommand PmacSendCommandA
    #define PmacMultiDownload PmacMultiDownloadA
    #define PmacAddDownloadFile PmacAddDownloadFileA
    #define PmacRemoveDownloadFile PmacRemoveDownloadFileA
    #define PmacRenumberFiles PmacRenumberFilesA
    #define PmacGetErrorStr PmacGetErrorStrA
  #endif // !UNICODE
 
#endif