-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRtusbapi.h
414 lines (352 loc) · 17.6 KB
/
Rtusbapi.h
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
//---------------------------------------------------------------------------
#ifndef __RTUSBAPIH__
#define __RTUSBAPIH__
//---------------------------------------------------------------------------
#include <windows.h>
// âåðñèÿ áèáëèîòåêè
#define VERMAJOR_RTUSBAPI (0x1) // òîëüêî îäíà öèôðà
#define VERMINOR_RTUSBAPI (0x5) // òîëüêî îäíà öèôðà
#define CURRENT_VERSION_RTUSBAPI ((VERMAJOR_RTUSBAPI << 0x10) | VERMINOR_RTUSBAPI)
// âìåñòî ReleaseDevice áóäåì èñïîëüçîâàòü ReleaseInstance
#define ReleaseDevice ReleaseInstance
// äàëüøå òîëüêî äëÿ C++
#ifdef __cplusplus
// ýêñïîðòèðóåìûå ôóíêöèè
extern "C" DWORD WINAPI RtGetDllVersion(void);
extern "C" LPVOID WINAPI RtCreateInstance(PCHAR const DeviceName);
// USB èíòåðôåéñ äëÿ ìîäóëåé îò R-Technology
struct IRTUSB
{
virtual BOOL WINAPI OpenDevice(WORD VirtualSlot) = 0;
virtual BOOL WINAPI CloseDevice(void) = 0;
virtual HANDLE WINAPI GetModuleHandle(void) = 0;
virtual BOOL WINAPI GetUsbSpeed(BYTE * const UsbSpeed) = 0;
virtual BOOL WINAPI GetModuleName(PCHAR const ModuleName) = 0;
virtual BOOL WINAPI GetModuleSerialNumber(PCHAR const SerialNumber) = 0;
virtual BOOL WINAPI GetAvrVersion(PCHAR const AvrVersion) = 0;
virtual BOOL WINAPI ReleaseInstance(void) = 0;
};
// USB è DSP èíòåðôåéñ äëÿ ìîäóëåé îò R-Technology
template <class Type>
struct IRTUSBDSP
{
// ôóíêöèè äëÿ ðàáîòû ñ USB èíòåðôåéñîì ìîäóëÿ
virtual BOOL WINAPI OpenDevice(WORD VirtualSlot) = 0;
virtual BOOL WINAPI CloseDevice(void) = 0;
virtual HANDLE WINAPI GetModuleHandle(void) = 0;
virtual BOOL WINAPI GetUsbSpeed(BYTE * const UsbSpeed) = 0;
virtual BOOL WINAPI GetModuleName(PCHAR const ModuleName) = 0;
virtual BOOL WINAPI GetModuleSerialNumber(PCHAR const SerialNumber) = 0;
virtual BOOL WINAPI GetAvrVersion(PCHAR const AvrVersion) = 0;
virtual BOOL WINAPI ReleaseInstance(void) = 0;
// ôóíêöèè äëÿ ðàáîòû ñ DSP ìîäóëÿ
virtual BOOL WINAPI RESET_DSP(void) = 0;
virtual BOOL WINAPI LOAD_DSP(PCHAR const FileName = NULL) = 0;
virtual BOOL WINAPI MODULE_TEST(void) = 0;
virtual BOOL WINAPI GET_DSP_INFO(Type * const DspInfo) = 0;
virtual BOOL WINAPI SEND_COMMAND(WORD Command) = 0;
// ôóíêöèè äëÿ ðàáîòû ñ ïàìÿòüþ DSP ìîäóëÿ
virtual BOOL WINAPI PUT_VAR_WORD(WORD Address, SHORT Data) = 0;
virtual BOOL WINAPI GET_VAR_WORD(WORD Address, SHORT * const Data) = 0;
virtual BOOL WINAPI PUT_DM_WORD(WORD Address, SHORT Data) = 0;
virtual BOOL WINAPI GET_DM_WORD(WORD Address, SHORT * const Data) = 0;
virtual BOOL WINAPI PUT_PM_WORD(WORD Address, LONG Data) = 0;
virtual BOOL WINAPI GET_PM_WORD(WORD Address, LONG * const Data) = 0;
virtual BOOL WINAPI PUT_DM_ARRAY(WORD BaseAddress, WORD NPoints, SHORT * const Data) = 0;
virtual BOOL WINAPI GET_DM_ARRAY(WORD BaseAddress, WORD NPoints, SHORT * const Data) = 0;
virtual BOOL WINAPI PUT_PM_ARRAY(WORD BaseAddress, WORD NPoints, LONG * const Data) = 0;
virtual BOOL WINAPI GET_PM_ARRAY(WORD BaseAddress, WORD NPoints, LONG * const Data) = 0;
};
// èíòåðôåéñ äëÿ ðàáîòû â ðåæèìå ââîäà äàííûõ íà ìîäóëÿõ îò R-Technology
template <class Type>
struct IRTREAD
{
virtual BOOL WINAPI GET_INPUT_PARS(Type * const ap) = 0;
virtual BOOL WINAPI SET_INPUT_PARS(Type * const ap) = 0;
virtual BOOL WINAPI START_READ(void) = 0;
virtual BOOL WINAPI STOP_READ(void) = 0;
virtual BOOL WINAPI READ_KADR(SHORT * const Data) = 0;
virtual BOOL WINAPI READ_SAMPLE(WORD Channel, SHORT * const Sample) = 0;
virtual BOOL WINAPI ReadData(SHORT * const lpBuffer, DWORD * const nNumberOfWordsToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) = 0;
};
// èíòåðôåéñ äëÿ ðàáîòû â ðåæèìå âûâîäà äàííûõ íà ìîäóëÿõ îò R-Technology
template <class Type>
struct IRTWRITE
{
virtual BOOL WINAPI GET_OUTPUT_PARS(Type * const dp) = 0;
virtual BOOL WINAPI SET_OUTPUT_PARS(Type * const dp) = 0;
virtual BOOL WINAPI START_WRITE(void) = 0;
virtual BOOL WINAPI STOP_WRITE(void) = 0;
virtual BOOL WINAPI WRITE_SAMPLE(WORD Channel, SHORT * const Sample) = 0;
virtual BOOL WINAPI WriteData(SHORT * const lpBuffer, DWORD * const nNumberOfWordsToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped) = 0;
};
// èíòåðôåéñ äëÿ ðàáîòû ñ îáëàñòüþ ïîëüçîâàòåëüñêîãî ÏÏÇÓ íà ìîäóëÿõ îò R-Technology
template <class Type>
struct IRTFLASH
{
virtual BOOL WINAPI ENABLE_FLASH_WRITE(BOOL EnableFlashWrite) = 0;
virtual BOOL WINAPI PUT_FLASH(Type * const fi) = 0;
virtual BOOL WINAPI GET_FLASH(Type * const fi) = 0;
};
// èíòåðôåéñ äëÿ ðàáîòû ñ ÒÒË ëèíèÿìè íà ìîäóëÿõ îò R-Technology
struct IRTTTL
{
virtual BOOL WINAPI ENABLE_TTL_OUT(BOOL EnabledTtlOut) = 0;
virtual BOOL WINAPI TTL_OUT(WORD TtlOut) = 0;
virtual BOOL WINAPI TTL_IN(WORD * const TtlIn) = 0;
};
//==============================================================================
// Î Á Í À Ð Ó Æ Å Í È Å U S B - Ì Î Ä Ó Ë Å É îò R - T E C H N O L O G Y
//==============================================================================
// èíòåðôåéñ äëÿ îáíàðóæåíèÿ (ìîíèîðèíãà) USB-ìîäóëåé îò R-Technology
struct IRTUSBDETECT : IRTUSB
{
// ôóíêöèÿ âûäà÷è ñòðîêè ñ ïîñëåäíåé îøèáêîé
virtual int WINAPI GetLastErrorString(LPTSTR const lpBuffer, DWORD nSize) = 0;
};
//==============================================================================
// Ì Î Ä Ó Ë Ü U S B - 2 1 8 5
//==============================================================================
// ïðîñòðàíñòâî èì¸í äëÿ ðàáîòû ñ ìîäóëåì USB-2185
namespace RTUSB2185
{
// àäðåñ íà÷àëà ñåãìåíòà áëîêà äàííûõ â ïàìÿòè ïðîãðàìì DSP
const WORD VarsBaseAddress = 0x30;
// òàêòîâàÿ ÷àñòîòà ðàáîòû DSP â êÃö
const DWORD DSP_CLOCK_OUT = 72000;
// íîìåðà äîñòóïíûõ ïîëüçîâàòåëüñêèõ çàïðîñîâ äëÿ USB (vendor request)
enum { V_RESET_DSP,
V_PUT_ARRAY, V_GET_ARRAY,
V_START_READ, V_START_WRITE,
V_COMMAND_IRQ,
V_GET_USB_SPEED,
V_PUT_FLASH = 8, V_GET_FLASH = 9,
V_GET_MODULE_NAME = 11,
V_GET_MODULE_SERIAL_NUMBER = 13
};
// íîìåðà äîñòóïíûõ êîìàíä øòàòíîãî äðàéâåðà DSP
enum { C_TEST,
C_START_READ, C_STOP_READ,
C_START_WRITE, C_STOP_WRITE,
C_LAST_COMMAND
};
// âîçìîæíûå èíäåêñû ñêîðîñòè ðàáîòû øèíû USB
enum { USB11, USB20, INVALID_USB_SPEED };
#pragma pack(1)
// ñòðóêòóðà ïîëüçîâàòåëüñêîãî ÏÏÇÓ
struct FLASH
{
BYTE FlashBytes[256];
};
// ñòðóêòóðà, ñîäåðæàùàÿ èíôîðìàöèþ î âåðñèè äðàéâåðà AVR
struct AVR_VERSION
{
BYTE avrstr[10];
BYTE avrprefix[4];
BYTE avrmajor;
BYTE avrminor;
};
// ñòðóêòóðà, ñîäåðæàùàÿ èíôîðìàöèþ î âåðñèè äðàéâåðà DSP
struct DSP_INFO
{
BYTE Target[10];
BYTE Label[6];
BYTE DspMajor;
BYTE DspMinor;
};
#pragma pack()
// àäðåñà ïåðåìåííûõ øòàòíîãî äðàéâåðà DSP (ðàñïîëàãàþòñÿ â ïàìÿòè ïðîãðàìì DSP)
const WORD D_PROGRAM_BASE_ADDRESS = (VarsBaseAddress + 0x0);
const WORD D_TARGET = (VarsBaseAddress + 0x1);
const WORD D_LABEL = (VarsBaseAddress + 0x6);
const WORD D_VERSION = (VarsBaseAddress + 0x9);
const WORD D_TEST_VAR1 = (VarsBaseAddress + 0xA);
const WORD D_TEST_VAR2 = (VarsBaseAddress + 0xB);
const WORD D_TEST_INTR_VAR = (VarsBaseAddress + 0xC);
const WORD D_MODULE_READY = (VarsBaseAddress + 0xD);
const WORD D_COMMAND = (VarsBaseAddress + 0xE);
const WORD D_READ_RATE = (VarsBaseAddress + 0x10);
const WORD D_READ_ENABLED = (VarsBaseAddress + 0x11);
const WORD D_READ_FIFO_BASE_ADDRESS = (VarsBaseAddress + 0x12);
const WORD D_READ_FIFO_LENGTH = (VarsBaseAddress + 0x13);
const WORD D_WRITE_RATE = (VarsBaseAddress + 0x20);
const WORD D_WRITE_ENABLED = (VarsBaseAddress + 0x21);
const WORD D_WRITE_FIFO_BASE_ADDRESS = (VarsBaseAddress + 0x22);
const WORD D_WRITE_FIFO_LENGTH = (VarsBaseAddress + 0x23);
}
// èíòåðôåéñ ìîäóëÿ USB2185
struct IRTUSB2185: IRTUSBDSP<RTUSB2185::DSP_INFO>
{
// ôóíêöèè äëÿ îðãàíèçàöèè ÷òåíèÿ äàííûõ èç ìîäóëÿ
virtual BOOL WINAPI START_READ(void) = 0;
virtual BOOL WINAPI STOP_READ(void) = 0;
virtual BOOL WINAPI ReadData(SHORT * const lpBuffer, DWORD * const nNumberOfWordsToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) = 0;
// ôóíêöèè äëÿ îðãàíèçàöèè ïåðåäà÷è äàííûõ â ìîäóëü
virtual BOOL WINAPI START_WRITE(void) = 0;
virtual BOOL WINAPI STOP_WRITE(void) = 0;
virtual BOOL WINAPI WriteData(SHORT * const lpBuffer, DWORD * const nNumberOfWordsToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped) = 0;
// ôóíêöèè äëÿ ðàáîòû ñ ïîëüçîâàòåëüñêèì ÏÏÇÓ
virtual BOOL WINAPI GET_FLASH(RTUSB2185::FLASH * const fi) = 0;
virtual BOOL WINAPI PUT_FLASH(RTUSB2185::FLASH * const fi) = 0;
// ôóíêöèÿ âûäà÷è ñòðîêè ñ ïîñëåäíåé îøèáêîé
virtual int WINAPI GetLastErrorString(LPTSTR const lpBuffer, DWORD nSize) = 0;
};
//==============================================================================
// Ì Î Ä Ó Ë Ü U S B - 3 0 0 0
//==============================================================================
// ïðîñòðàíñòâî èì¸í äëÿ ðàáîòû ñ ìîäóëåì USB-3000
namespace RTUSB3000
{
// àäðåñ íà÷àëà ñåãìåíòà áëîêà äàííûõ â ïàìÿòè ïðîãðàìì DSP
const WORD VarsBaseAddress = 0x30;
// òàêòîâàÿ ÷àñòîòà ðàáîòû DSP â êÃö
const DWORD DSP_CLOCK_OUT = 72000;
// âîçìîæíûå èñòî÷íèêè òàêòîâûõ èìïóëüñîâ äëÿ ââîäà äàííûõ
enum { INTERNAL_INPUT_CLOCK, EXTERNAL_INPUT_CLOCK, INVALID_INPUT_CLOCK };
// âîçìîæíûå òèïû ñèíõðîíèçàöèè ââîäèìûõ ñ ìîäóëÿ äàíûõ
enum { NO_SYNCHRO, TTL_START_SYNCHRO, TTL_KADR_SYNCHRO, ANALOG_SYNCHRO, INVALID_INPUT_SYNCHRO };
// âîçìîæíûå òèïû ââîäèìûõ ñ ìîäóëÿ äàíûõ
enum { EMPTY_DATA, ADC_DATA, TTL_DATA, MIXED_DATA, INVALID_INPUT_DATA };
// âîçìîæíûå èíäåêñû ñêîðîñòè ðàáîòû øèíû USB
enum { USB11, USB20, INVALID_USB_SPEED };
#pragma pack(1)
// ñòðóêòóðà, çàäàþùàÿ ðåæèìû ââîäà äàííûõ äëÿ ìîäóëÿ USB-3000
struct INPUT_PARS
{
WORD size;
BOOL InputEnabled; // ôëàæîê ðàçðåøåíèå/çàïðåùåíèå ââîäà äàííûõ (òîëüêî ïðè ÷òåíèè)
BOOL CorrectionEnabled; // óïðàâëåíèå êîððåêòèðîâêîé âõîäíûõ äàííûõ (ñ ÀÖÏ)
WORD InputClockSource; // èñòî÷íèê òàêòîâûõ èìïóëüñîâ äëÿ ââîäà äàííûõ
WORD InputType; // òèï ââîäèìûõ ñ ìîäóëÿ äàíûõ (ÀÖÏ èëè ÒÒË)
WORD SynchroType; // òèï ñèíõðîíèçàöèè ââîäèìûõ ñ ìîäóëÿ äàíûõ
WORD SynchroAdType; // òèï àíàëîãîâîé ñèíõðîíèçàöèè
WORD SynchroAdMode; // ðåæèì àíàëîãîâîé ñèõðîíèçàöèè
WORD SynchroAdChannel; // ñèíõðîêàíàë ÀÖÏ ïðè àíàëîãîâîé ñèíõðîíèçàöèè
SHORT SynchroAdPorog; // ïîðîã ñðàáàòûâàíèÿ ÀÖÏ ïðè àíàëîãîâîé ñèíõðîíèçàöèè
WORD ChannelsQuantity; // ÷èñëî àêòèâíûõ ëîãè÷åñêèõ êàíàëîâ
WORD ControlTable[128]; // óïðàâëÿþùàÿ òàáëèöà ñ àêòèâíûìè ëîãè÷åñêèìè êàíàëàìè
WORD InputFifoBaseAddress; // áàçîâûé àäðåñ FIFO áóôåðà ââîäà â DSP ìîäóëÿ
WORD InputFifoLength; // äëèíà FIFO áóôåðà ââîäà â DSP ìîäóëÿ
double InputRate; // òàêòîâàÿ ÷àñòîòà ââîäà äàííûõ â êÃö
double InterKadrDelay; // ìåæêàäðîâàÿ çàäåðæêà â ìñ
double ChannelRate; // ÷àñòîòà ââîäà ôèêñèðîâàííîãî ëîãè÷åñêîãî êàíàëà
double AdcOffsetCoef[8]; // êîððåêòèðîâî÷íûå êîýô. ñìåùåíèå íóëÿ äëÿ ÀÖÏ
double AdcScaleCoef[8]; // êîððåêòèðîâî÷íûå êîýô. ìàñøòàáà äëÿ ÀÖÏ
};
// ñòðóêòóðà, çàäàþùàÿ ðåæèìû âûâîäà äàííûõ äëÿ ìîäóëÿ USB-3000
struct OUTPUT_PARS
{
WORD size;
BOOL OutputEnabled; // ðàçðåøåíèå/çàïðåùåíèå âûâîäà äàííûõ
double OutputRate; // ÷àñòîòà âûâîäà äàííûõ â êÃö
WORD OutputFifoBaseAddress; // áàçîâûé àäðåñ FIFO áóôåðà âûâîäà
WORD OutputFifoLength; // äëèíà FIFO áóôåðà âûâîäà
};
// ñòðóêòóðà ïîëüçîâàòåëüñêîãî ÏÏÇÓ
struct FLASH
{
WORD CRC16; // êîíòðîëüíàÿ ñóììà
WORD size; // ðàçìåð äàííîé ñòðóêòóðû â áàéòàõ
BYTE SerialNumber[9]; // ñåðèéíûé íîìåð ìîäóëÿ
BYTE Name[11]; // íàçâàíèå ìîäóëÿ
BYTE Revision; // ðåâèçèÿ ìîäóëÿ
BYTE DspType[17]; // òèï óñòàíîâëåííîãî DSP
BYTE IsDacPresented; // ôëàæîê íàëè÷èÿ ÖÀÏ
DWORD DspClockout; // òàêòîâàÿ ÷àñòîòà DSP â Ãö
float AdcOffsetCoef[8]; // êîððåêòèðîâî÷íûå êîýô. ñìåùåíèÿ íóëÿ äëÿ ÀÖÏ
float AdcScaleCoef[8]; // êîððåêòèðîâî÷íûå êîýô. ìàñøòàáà äëÿ ÀÖÏ
float DacOffsetCoef[2]; // êîððåêòèðîâî÷íûå êîýô. ñìåùåíèÿ íóëÿ äëÿ ÖÀÏ
float DacScaleCoef[2]; // êîððåêòèðîâî÷íûå êîýô. ìàñøòàáà äëÿ ÖÀÏ
BYTE ReservedByte[129]; // çàðåçåðâèðîâàíî
};
// ñòðóêòóðà, ñîäåðæàùàÿ èíôîðìàöèþ î âåðñèè äðàéâåðà AVR
struct AVR_INFO
{
BYTE avrstr[10];
BYTE avrprefix[4];
BYTE avrmajor;
BYTE avrminor;
};
// ñòðóêòóðà, ñîäåðæàùàÿ èíôîðìàöèþ î âåðñèè äðàéâåðà DSP
struct DSP_INFO
{
BYTE Target[10]; // ìîäóëü, äëÿ êîòîðîãî ïðåäíàçíà÷åí äàííûé äðàéâåð DSP
BYTE Label[6]; // ìåòêà ðàçðàáîò÷èêà äðàéâåðà DSP
BYTE DspMajor; // ñòàðøèå ÷èñëî âåðñèè äðàéâåðà DSP
BYTE DspMinor; // ìëàäøåå ÷èñëî âåðñèè äðàéâåðà DSP
};
#pragma pack()
// àäðåñà ïåðåìåííûõ øòàòíîãî äðàéâåðà DSP (ðàñïîëàãàþòñÿ â ïàìÿòè ïðîãðàìì DSP)
const WORD D_PROGRAM_BASE_ADDRESS = (VarsBaseAddress + 0x0);
const WORD D_TARGET = (VarsBaseAddress + 0x1);
const WORD D_LABEL = (VarsBaseAddress + 0x6);
const WORD D_VERSION = (VarsBaseAddress + 0x9);
const WORD D_TEST_VAR1 = (VarsBaseAddress + 0xA);
const WORD D_TEST_VAR2 = (VarsBaseAddress + 0xB);
const WORD D_TEST_INTR_VAR = (VarsBaseAddress + 0xC);
const WORD D_MODULE_READY = (VarsBaseAddress + 0xD);
const WORD D_COMMAND = (VarsBaseAddress + 0xE);
const WORD D_INPUT_CLOCK_SOURCE = (VarsBaseAddress + 0x10);
const WORD D_CONTROL_TABLE_LENGHT = (VarsBaseAddress + 0x20);
const WORD D_INPUT_SAMPLE = (VarsBaseAddress + 0x21);
const WORD D_INPUT_CHANNEL = (VarsBaseAddress + 0x22);
const WORD D_INPUT_RATE = (VarsBaseAddress + 0x23);
const WORD D_INTER_KADR_DELAY = (VarsBaseAddress + 0x24);
const WORD D_FIRST_SAMPLE_DELAY = (VarsBaseAddress + 0x25);
const WORD D_INPUT_ENABLED = (VarsBaseAddress + 0x26);
const WORD D_INPUT_FIFO_BASE_ADDRESS = (VarsBaseAddress + 0x27);
const WORD D_INPUT_FIFO_LENGTH = (VarsBaseAddress + 0x28);
const WORD D_CUR_INPUT_FIFO_LENGTH = (VarsBaseAddress + 0x29);
const WORD D_CORRECTION_ENABLED = (VarsBaseAddress + 0x2B);
const WORD D_INPUT_TYPE = (VarsBaseAddress + 0x2C);
const WORD D_SYNCHRO_TYPE = (VarsBaseAddress + 0x2D);
const WORD D_SYNCHRO_AD_TYPE = (VarsBaseAddress + 0x2E);
const WORD D_SYNCHRO_AD_MODE = (VarsBaseAddress + 0x2F);
const WORD D_SYNCHRO_AD_CHANNEL = (VarsBaseAddress + 0x30);
const WORD D_SYNCHRO_AD_POROG = (VarsBaseAddress + 0x31);
const WORD D_OUTPUT_SAMPLE = (VarsBaseAddress + 0x40);
const WORD D_OUTPUT_SCLK_DIV = (VarsBaseAddress + 0x41);
const WORD D_OUTPUT_RATE = (VarsBaseAddress + 0x42);
const WORD D_OUTPUT_ENABLED = (VarsBaseAddress + 0x43);
const WORD D_OUTPUT_FIFO_BASE_ADDRESS = (VarsBaseAddress + 0x44);
const WORD D_OUTPUT_FIFO_LENGTH = (VarsBaseAddress + 0x45);
const WORD D_CUR_OUTPUT_FIFO_LENGTH = (VarsBaseAddress + 0x46);
const WORD D_ENABLE_TTL_OUT = (VarsBaseAddress + 0x4D);
const WORD D_TTL_OUT = (VarsBaseAddress + 0x4E);
const WORD D_TTL_IN = (VarsBaseAddress + 0x4F);
const WORD D_ADC_SCALE = (VarsBaseAddress + 0x50);
const WORD D_ADC_ZERO = (VarsBaseAddress + 0x58);
const WORD D_CONTROL_TABLE = (0x100);
}
// èíòåðôåéñ ìîäóëÿ USB3000 `
struct IRTUSB3000 : IRTUSBDSP<RTUSB3000::DSP_INFO>
{
// ôóíêöèè äëÿ ðàáîòû â ðåæèìå ââîäà äàííûõ èç ìîäóëÿ â ÐÑ
virtual BOOL WINAPI GET_INPUT_PARS(RTUSB3000::INPUT_PARS * const ap) = 0;
virtual BOOL WINAPI SET_INPUT_PARS(RTUSB3000::INPUT_PARS * const ap) = 0;
virtual BOOL WINAPI START_READ(void) = 0;
virtual BOOL WINAPI STOP_READ(void) = 0;
virtual BOOL WINAPI READ_KADR(SHORT * const Data) = 0;
virtual BOOL WINAPI READ_SAMPLE(WORD Channel, SHORT * const Sample) = 0;
virtual BOOL WINAPI ReadData(SHORT * const lpBuffer, DWORD * const nNumberOfWordsToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) = 0;
// ôóíêöèè äëÿ ðàáîòû c âûâîäîì äàííûõ èç ÐÑ â ìîäóëü
virtual BOOL WINAPI GET_OUTPUT_PARS(RTUSB3000::OUTPUT_PARS * const dp) = 0;
virtual BOOL WINAPI SET_OUTPUT_PARS(RTUSB3000::OUTPUT_PARS * const dp) = 0;
virtual BOOL WINAPI START_WRITE(void) = 0;
virtual BOOL WINAPI STOP_WRITE(void) = 0;
virtual BOOL WINAPI WRITE_SAMPLE(WORD Channel, SHORT * const Sample) = 0;
virtual BOOL WINAPI WriteData(SHORT * const lpBuffer, DWORD * const nNumberOfWordsToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped) = 0;
// ôóíêöèè äëÿ ðàáîòû ñ ÒÒË ëèíèÿìè
virtual BOOL WINAPI ENABLE_TTL_OUT(BOOL EnableTtlOut) = 0;
virtual BOOL WINAPI TTL_OUT(WORD TtlOut) = 0;
virtual BOOL WINAPI TTL_IN(WORD * const TtlIn) = 0;
// ôóíêöèè äëÿ ðàáîòû ñ ïîëüçîâàòåëüñêèì ÏÏÇÓ
virtual BOOL WINAPI ENABLE_FLASH_WRITE(BOOL EnableFlashWrite) = 0;
virtual BOOL WINAPI PUT_FLASH(RTUSB3000::FLASH * const fi) = 0;
virtual BOOL WINAPI GET_FLASH(RTUSB3000::FLASH * const fi) = 0;
// ôóíêöèÿ âûäà÷è ñòðîêè ñ ïîñëåäíåé îøèáêîé
virtual int WINAPI GetLastErrorString(LPTSTR const lpBuffer, DWORD nSize) = 0;
};
#define MAKE_PM_BUFFER_RTUSBAPI(PmPoints, Buffer) (WORD)(PmPoints), Transform_Buffer((WORD)(PmPoints), (LONG *)(Buffer))
#endif
#endif