PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
SEIDrv32.h
Go to the documentation of this file.
1 /************************ Functions/Constants Declarations ***********************/
2 
3 
4 /*********** Version ***********/
5 //const char* versiontxt = "SEIDrv32.DLL version 5.22\n";
6 #define versiontxt = "SEIDrv32.DLL version 5.22\n"
7 
8 #ifdef __cplusplus
9 extern "C"{
10 #endif
11 
12 
13 /********** General functions ***********/
14 long __stdcall GetDLLVersionText(char* pstr);
15  // function: gets the DLL version text.
16  // pstr: pointer to the version text.
17  // return: length of dll version text.
18 
19 long __stdcall GetLastErrorText(char* pstr);
20  // function: gets the error messages from the last error that occured
21  // pstr: pointer to the messages
22  // return: 0
23 
24 /*********** SEI functions ***********/
25 extern long __stdcall InitializeSEI(long comm, long mode);
26  // function: Initializes the SEI bus
27  // comm: CommPort of SEI devices
28  // -If comm is zero, INITIALIZESEI will search all available comm ports
29  // mode:
30  // -Modes may be combined together
31  // -If SKIPDEVICEINFO is set, AUTOASSIGN is ignored
32  // -If SKIPDEVICESEARCH is set, AUTOASSIGN is ignored
33  const long AUTOASSIGN = 0x0001; // autoassign addresses if they conflict
34  const long SKIPDEVICESEARCH = 0x0002; // don't check if devices exist on chosen comm port
35  const long SKIPDEVICEINFO = 0x0004; // don't retrieve devices info
36  const long NORESET = 0x0008; // don't generate reset to SEI devices
37  const long NOCHECKSUM = 0x0010; // don't check checksum of commands
38  const long REINITIALIZE = 0x0020; // reinitialize if already initialized
39  const long NOA2ERRORCLEAR = 0x0040; // don't clear A2 errors on powerup
40  // return: 0 if no error
41 extern long __stdcall IsInitialized();
42  // function: returns status of initialization
43  // return: 0 if not initialized, 1 if initialized
44 extern long __stdcall GetCommPort();
45  // function: returns the initialized CommPort number
46  // return: the CommPort number 1 to 8, -1 if CommPort is not initialized
47 extern long __stdcall ReopenCommPort();
48  // function: re-opens the last opened CommPortreturns the initialized CommPort number
49  // return: the CommPort number 1 to 8, -1 if CommPort is not initialized
50 extern long __stdcall IsAnalog();
51  // function: returns true if the device is analog
52  // return: 0 if not an analog device, 1 if analog device
53 extern long __stdcall GetNumberOfDevices();
54  // function: returns number of devices found on the SEI bus
55  // return: number of devices 0-15, any number other than 0-15 is an error code
56 extern long __stdcall GetDeviceInfo(long devnum, long *model, long *serialnum, long *version, long *addr);
57  // function: Gets some information about a device
58  // devnum: 0 To GetNumberOfDevices - 1
59  // model: devnum's model#, M1=1, A2=2, ED2=3, AD5=5
60  // serialnum: devnum's serial#
61  // version: devnum's firmware version#
62  // addr: devnum's address
63  // return: 0 if no error
64 extern long __stdcall GetAllDeviceInfo(long devnum, long *model, long *serialnum, long *version, long *addr, long *month, long *day, long *year, long *configuration);
65  // function: Gets all information about a device
66  // devnum: 0 To GetNumberOfDevices - 1
67  // model: devnum's model#, M1=1, A2=2, ED2=3, AD5=5
68  // serialnum: devnum's serial#
69  // version: devnum's firmware version#
70  // addr: devnum's address
71  // month: devnum's manufacturing month
72  // day: devnum's manufacturing day
73  // year: devnum's manufacturing year
74  // configuration: devnum's configuration#
75  // return: 0 if no error
76 extern long __stdcall SetDeviceAddress(long SN, long address);
77  // function: changes the address of a device on the SEI bus
78  // SN: Serial number of the device you want to change the address of
79  // address: New address for the device
80  // return: 0 if no error
81 extern long __stdcall SetBaudRate(long baudrate);
82  // function: changes the baudrate of the SEI bus
83  // baudrate: new baudrate, valid baudrates are: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200
84  // return: 0 if no error
85 extern long __stdcall ResetSEI();
86  // function: resets the SEI bus by sending a break condition
87  // return: 0 if no error
88 extern long __stdcall GetBusyStatus();
89  // function: returns the status of the busy line
90  // return: 1 if busy is true, 0 if busy is false
91 extern long __stdcall CloseSEI();
92  // function: closes the SEI bus
93  // return: 0
94 extern long __stdcall Mcommand(char* bufout, long sizeout, char* bufin, long sizein); // generic command
95  // function: generic read/write command for the SEI bus
96  // bufout: the array to be written on the SEI bus
97  // sizeout: number of bytes to write
98  // bufin: the array of bytes read back
99  // sizein: number of bytes to read back
100  // return: 0 if no error
101 extern long __stdcall McommandLong(long* bufout, long sizeout, long* bufin, long sizein); // generic command w/long array
102  // function: generic read/write command for the SEI bus using longs
103  // bufout: the array to be written on the SEI bus
104  // sizeout: number of longs to write
105  // bufin: the array to be read back
106  // sizein: number of longs to read back
107  // return: 0 if no error
108 
109 
110 /*********** A2 functions ***********/
111 extern long __stdcall A2SetStrobe();
112  // function: if the A2 is in strobe mode, it will take a position reading after receiving this command.
113  // return: 0 if no error
114 extern long __stdcall A2SetSleep();
115  // function: makes all A2's on the SEI bus go to sleep, the current consumption then drops below 0.6 mA / device
116  // return: 0 if no error
117 extern long __stdcall A2SetWakeup();
118  // function: wakes up all A2's on the SEI bus, wait at least 5mSec before sending the next command
119  // return: 0 if no error
120 extern long __stdcall A2SetOrigin(long address);
121  // function: Sets the absolute zero to the current position, in single-turn mode the new position is stored in EEPROM
122  // address: SEI address 0-15
123  // return: 0 if no error
124 extern long __stdcall A2GetMode(long address, long *mode);
125  // function: Gets the mode of an A2
126  // address: SEI address 0-14
127  // mode: A2's mode, see A2 Communications Protocol Datasheet
128  // return: 0 if no error
129 extern long __stdcall A2SetMode(long address, long mode);
130  // function: Sets the mode of an A2
131  // address: SEI address 0-15
132  // mode: A2's mode, see A2 Communications Protocol Datasheet
133  // return: 0 if no error
134 extern long __stdcall A2GetResolution(long address, long *res);
135  // function: Gets the resolution of an A2
136  // address: SEI address 0-14
137  // res: A2's resolution
138  // return: 0 if no error
139 extern long __stdcall A2SetResolution(long address, long res);
140  // function: Sets the resolution of an A2
141  // address: SEI address 0-15
142  // res: A2's resolution
143  // return: 0 if no error
144 extern long __stdcall A2GetPosition(long address, long *pos);
145  // function: Gets the position of an A2
146  // address: SEI address 0-14
147  // pos: A2's position
148  // return: 0 if no error
149 extern long __stdcall A2SetPosition(long address, long pos);
150  // function: Sets the position of an A2
151  // address: SEI address 0-15
152  // pos: A2's position
153  // return: 0 if no error
154 extern long __stdcall A2StopClocks(long lngMilliseconds);
155  // function: stops the clocks of all A2's on bus
156  // lngMilliseconds: the number of milliseconds to look for a
157  // confirmation wakeup character before going back to the
158  // the stopped clock state
159  // return: 0 if no error (will return error if no A2's on bus)
160 extern long __stdcall A2RestartClocks(long lngTries);
161  // function: restarts the clocks of all A2's after A2StopClocks()
162  // lngTries: the number of wakeup characters to send before giving up
163  // returns 0 if successful
164 extern long __stdcall A2ComputeCRC(long lngSEIAddress, long lngCRCStart, long lngCRCLength, long *plResult);
165  // function: computes 16 bit CRC over the specified block of A2 memory
166  // lngSEIAddress: SEI address, 0-14
167  // lngCRCStart: starting point for CRC (0xE080 is code image start)
168  // lngCRCLength: length of block over which to computer (0x1F80 is normal for code image)
169  // lngplResult: pointer to long result of CRC computation
170 extern long __stdcall A2LockParameters(long lngSEIAddress);
171  // function: disables ability to write to A2 parameter space;
172  // (code space writes are always disabled)
173  // lngSEIAddress: SEI address, 0-14
174 extern long __stdcall A2GetPositionTimeStatus(long address, long *ptr_pos, long *ptr_time, long *ptr_status);
175  // function: returns position, time, and status of device to caller
176  // lngSEIAddress: SEI address, 0-14
177  // ptr_pos: pointer to long that will be updated with 12-bit position value
178  // ptr_time: pointer to long that will be updated with 16-bit timer value from microprocessor timer
179  // ptr_status: pointer to long that will be updated with 8 bit error status/checksum information
180 extern long __stdcall A2GetPositionLongTimeStatus(long address, long *ptr_pos, unsigned long *ptr_time, long *ptr_status);
181  // function: returns position, time, and status of device to caller
182  // lngSEIAddress: SEI address, 0-14
183  // ptr_pos: pointer to long that will be updated with 12-bit position value
184  // ptr_time: pointer to long that will be updated with 32-bit timer value from microprocessor timer
185  // ptr_status: pointer to long that will be updated with 8 bit error status/checksum information
186 
187 /*********** M1 functions ***********/
188 extern long __stdcall M1GetInput(long address, long *input);
189  // function: Gets the input status of an M1
190  // address: SEI address 0-14
191  // input: input value of M1
192  // return: 0 if no error
193 extern long __stdcall M1SetOutput(long address, long output);
194  // function: Sets the output of an M1
195  // address: SEI address 0-15
196  // output: output value of an M1
197  // return: 0 if no error
198 extern long __stdcall M1SetMotors(long address, long motors);
199  // function: Sets the motors of an M1
200  // address: SEI address 0-15
201  // motors: control byte
202  // -bit0: A1, 1 = Enable Driver Output; 0 = Disable Driver Output
203  // -bit1: B1, 1 = Enable Driver Output; 0 = Disable Driver Output
204  // -bit2: A2, 1 = Enable Driver Output; 0 = Disable Driver Output
205  // -bit3: B2, 1 = Enable Driver Output; 0 = Disable Driver Output
206  // -bit4: A1, 1 = Drive output High; 0 = Drive output Low
207  // -bit5: B1, 1 = Drive output High; 0 = Drive output Low
208  // -bit6: A2, 1 = Drive output High; 0 = Drive output Low
209  // -bit7: B2, 1 = Drive output High; 0 = Drive output Low
210  // return: 0 if no error
211 extern long __stdcall M1SetInitialOutput(long address, long output);
212  // function: Same as M1SetOutput but the M1 stores this value in its EEPROM
213  // address: SEI address 0-15
214  // output: output value of an M1
215  // return: 0 if no error
216 extern long __stdcall M1SetInitialMotors(long address, long motors);
217  // function: Same as M1SetMotors but the M1 stores this value in its EEPROM
218  // address: SEI address 0-15
219  // motors: control byte
220  // return: 0 if no error
221 
222 
223 /*********** ED2 functions ***********/
224 extern long __stdcall ED2SetOrigin(long address);
225  // function: Resets both counters
226  // address: SEI address 0-15
227  // return: 0 if no error
228 extern long __stdcall ED2GetMode(long address, long *mode);
229  // function: Gets the mode of an ED2
230  // address: SEI address 0-14
231  // mode: ED2's mode, see ED2 Communications Protocol Datasheet
232  // return: 0 if no error
233 extern long __stdcall ED2SetMode(long address, long mode);
234  // function: Sets the mode of an ED2
235  // address: SEI address 0-15
236  // mode: ED2's mode, see ED2 Communications Protocol Datasheet
237  // return: 0 if no error
238 extern long __stdcall ED2GetResolution(long address, long *res);
239  // function: Gets the resolution of an ED2
240  // address: SEI address 0-14
241  // res: ED2's resolution
242  // return: 0 if no error
243 extern long __stdcall ED2SetResolution(long address, long res);
244  // function: Sets the resolution of an ED2
245  // address: SEI address 0-15
246  // res: ED2's resolution
247  // return: 0 if no error
248 extern long __stdcall ED2GetPosition1(long address, long *pos);
249  // function: Gets the position of an ED2, counter 1
250  // address: SEI address 0-14
251  // pos: ED2's position
252  // return: 0 if no error
253 extern long __stdcall ED2GetPosition2(long address, long *pos);
254  // function: Gets the position of an ED2, counter 2
255  // address: SEI address 0-14
256  // pos: ED2's position
257  // return: 0 if no error
258 extern long __stdcall ED2SetPosition1(long address, long pos);
259  // function: Sets the position of an ED2, counter 1
260  // address: SEI address 0-15
261  // pos: ED2's position
262  // return: 0 if no error
263 extern long __stdcall ED2SetPosition2(long address, long pos);
264  // function: Sets the position of an ED2, counter 2
265  // address: SEI address 0-15
266  // pos: ED2's position
267  // return: 0 if no error
268 extern long __stdcall ED2GetInput(long address, long *input);
269  // function: Gets the status of an ED2's digital inputs
270  // address: SEI address 0-14
271  // input: input's status
272  // -bit0: Push Button #1 State
273  // -bit1: Push Button #2 State
274  // -bit2: Push Button #3 State
275  // -bit3: TTL Input #1 State
276  // -bit4: TTL Input #2 State
277  // -bit5: TTL Input #3 State
278  // -bit6: TTL Input #4 State
279  // -bit7: Back Switch State
280  // return: 0 if no error
281 extern long __stdcall ED2SetOutput(long address, long output);
282  // function: Sets the status of an ED2's digital outputs
283  // address: SEI address 0-15
284  // output: output's status
285  // -bit0: Push Button #1 State
286  // -bit1: Push Button #2 State
287  // -bit2: Push Button #3 State
288  // -bit3: TTL Input #1 State
289  // -bit4: TTL Input #2 State
290  // -bit5: TTL Input #3 State
291  // -bit6: TTL Input #4 Enable, OR this value with TTL Input #4
292  // -bit7: Or this value with the back switch's state
293  // return: 0 if no error
294 extern long __stdcall ED2ComputeCRC(long lngSEIAddress, long lngCRCStart, long lngCRCLength, long *plResult);
295  // function: computes 16 bit CRC over the specified block of A2 memory
296  // lngSEIAddress: SEI address, 0-14
297  // lngCRCStart: starting point for CRC (0xE080 is code image start)
298  // lngCRCLength: length of block over which to computer (0x1F80 is normal for code image)
299  // lngplResult: pointer to long result of CRC computation
300 
301 
302 /*********** AD5 functions ***********/
303 extern long __stdcall AD5Reset(long address, long port);
304  // function: Resets a counter of an AD5
305  // address: SEI address 0-15
306  // port: 0-3
307  // return: 0 if no error
308 extern long __stdcall AD5GetMode(long address, long *mode);
309  // function: Gets the mode of an AD5
310  // address: SEI address 0-14
311  // mode: AD5's mode
312  // -bit0: 1 = Port#1 is active; 0 = Port#1 is disabled
313  // -bit1: 1 = Port#1's index is active; 0 = Port#1's index is disabled
314  // -bit2: 1 = Port#2 is active; 0 = Port#2 is disabled
315  // -bit3: 1 = Port#2's index is active; 0 = Port#2's index is disabled
316  // -bit4: 1 = Port#3 is active; 0 = Port#3 is disabled
317  // -bit5: 1 = Port#3's index is active; 0 = Port#3's index is disabled
318  // -bit6: 1 = Port#4 is active; 0 = Port#4 is disabled
319  // -bit7: 1 = Port#4's index is active; 0 = Port#4's index is disabled
320  // return: 0 if no error
321 extern long __stdcall AD5SetMode(long address, long mode);
322  // function: Sets the mode of an AD5, writes it to EEPROM
323  // address: SEI address 0-15
324  // mode: AD5's mode
325  // return: 0 if no error
326 extern long __stdcall AD5GetResolution(long address, long port, long *res);
327  // function: Gets the resolution of an AD5
328  // address: SEI address 0-14
329  // port: 0-3
330  // res: resolution of an AD5
331  // return: 0 if no error
332 extern long __stdcall AD5SetResolution(long address, long port, long res);
333  // function: Sets the resolution of an AD5
334  // address: SEI address 0-15
335  // port: 0-3
336  // res: resolution of an AD5
337  // return: 0 if no error
338 extern long __stdcall AD5GetPosition(long address, long port, long *pos);
339  // function: Gets the position of an AD5
340  // address: SEI address 0-14
341  // port: 0-3
342  // pos: position of an AD5
343  // return: 0 if no error
344 extern long __stdcall AD5SetPosition(long address, long port, long pos);
345  // function: Sets the position of an AD5
346  // address: SEI address 0-15
347  // port: 0-3
348  // pos: position of an AD5
349  // return: 0 if no error
350 extern long __stdcall AD5GetAllPositions(long address, long *pos1, long *pos2, long *pos3, long *pos4);
351  // function: Gets all the position of an AD5 at once
352  // address: SEI address 0-14
353  // pos1: position of an AD5 port 4
354  // pos2: position of an AD5 port 3
355  // pos3: position of an AD5 port 2
356  // pos4: position of an AD5 port 1
357  // return: 0 if no error
358 extern long __stdcall AD5SetCMR(long address, long port, long cmr);
359  // function: Sets the CMR registry of the counter, see the LS7266R1 datasheet for more information on the counter
360  // address: SEI address 0-15
361  // port: 0-3
362  // cmr: CMR registry
363  // return: 0 if no error
364 extern long __stdcall AD5GetCMR(long address, long port, long *cmr);
365  // function: Gets the CMR registry of the counter, see the LS7266R1 datasheet for more information on the counter
366  // address: SEI address 0-15
367  // port: 0-3
368  // cmr: CMR registry
369  // return: 0 if no error
370 extern long __stdcall AD5SetModeVolatile(long address, long mode);
371  // function: Sets the mode of an AD5, not written to EEPROM
372  // address: SEI address 0-15
373  // mode: AD5's mode
374  // return: 0 if no error
375 extern long __stdcall AD5GetAllPositionsOrdered(long address, long *pos1, long *pos2, long *pos3, long *pos4);
376  // function: Gets all the position of an AD5 at once
377  // address: SEI address 0-14
378  // pos1: position of an AD5 port 1
379  // pos2: position of an AD5 port 2
380  // pos3: position of an AD5 port 3
381  // pos4: position of an AD5 port 4
382  // return: 0 if no error
383 extern long __stdcall AD5ComputeCRC(long lngSEIAddress, long lngCRCStart, long lngCRCLength, long *plResult);
384  // function: computes 16 bit CRC over the specified block of A2 memory
385  // lngSEIAddress: SEI address, 0-14
386  // lngCRCStart: starting point for CRC (0xE080 is code image start)
387  // lngCRCLength: length of block over which to computer (0x1F80 is normal for code image)
388  // lngplResult: pointer to long result of CRC computation
389 
390 #ifdef __cplusplus
391 }
392 #endif
long __stdcall InitializeSEI(long comm, long mode)
long __stdcall ED2SetPosition2(long address, long pos)
long __stdcall A2StopClocks(long lngMilliseconds)
long __stdcall AD5SetResolution(long address, long port, long res)
long __stdcall AD5GetMode(long address, long *mode)
long __stdcall SetDeviceAddress(long SN, long address)
Phidget_MeshMode mode
Definition: phidget22.h:1332
long __stdcall ResetSEI()
const long SKIPDEVICESEARCH
Definition: SEIDrv32.h:34
long __stdcall M1SetInitialOutput(long address, long output)
long __stdcall A2GetMode(long address, long *mode)
Definition: SEIDrv.cpp:193
long __stdcall IsInitialized()
Definition: SEIDrv.cpp:107
long __stdcall AD5SetCMR(long address, long port, long cmr)
long __stdcall A2LockParameters(long lngSEIAddress)
long __stdcall A2SetStrobe()
Definition: SEIDrv.cpp:158
long __stdcall A2SetOrigin(long address)
Definition: SEIDrv.cpp:179
long __stdcall GetCommPort()
long __stdcall McommandLong(long *bufout, long sizeout, long *bufin, long sizein)
long __stdcall ED2SetMode(long address, long mode)
long __stdcall GetDeviceInfo(long devnum, long *model, long *serialnum, long *version, long *addr)
long __stdcall M1GetInput(long address, long *input)
long __stdcall A2RestartClocks(long lngTries)
int port
Definition: phidget22.h:2454
long __stdcall A2ComputeCRC(long lngSEIAddress, long lngCRCStart, long lngCRCLength, long *plResult)
long __stdcall AD5SetMode(long address, long mode)
long __stdcall AD5SetModeVolatile(long address, long mode)
long __stdcall A2SetWakeup()
Definition: SEIDrv.cpp:174
long __stdcall GetDLLVersionText(char *pstr)
long __stdcall M1SetInitialMotors(long address, long motors)
const long AUTOASSIGN
Definition: SEIDrv32.h:33
long __stdcall A2GetPosition(long address, long *pos)
Definition: SEIDrv.cpp:259
long __stdcall AD5GetAllPositions(long address, long *pos1, long *pos2, long *pos3, long *pos4)
long __stdcall A2SetSleep()
Definition: SEIDrv.cpp:169
const long NOCHECKSUM
Definition: SEIDrv32.h:37
const char * address
Definition: phidget22.h:2552
long __stdcall ED2GetResolution(long address, long *res)
long __stdcall AD5GetResolution(long address, long port, long *res)
long __stdcall AD5GetAllPositionsOrdered(long address, long *pos1, long *pos2, long *pos3, long *pos4)
long __stdcall M1SetOutput(long address, long output)
long __stdcall GetNumberOfDevices()
Definition: SEIDrv.cpp:112
const long NOA2ERRORCLEAR
Definition: SEIDrv32.h:39
long __stdcall ED2SetOrigin(long address)
long __stdcall A2GetPositionTimeStatus(long address, long *ptr_pos, long *ptr_time, long *ptr_status)
long __stdcall AD5SetPosition(long address, long port, long pos)
const long NORESET
Definition: SEIDrv32.h:36
long __stdcall A2GetPositionLongTimeStatus(long address, long *ptr_pos, unsigned long *ptr_time, long *ptr_status)
long __stdcall ReopenCommPort()
long __stdcall ED2SetPosition1(long address, long pos)
long __stdcall GetAllDeviceInfo(long devnum, long *model, long *serialnum, long *version, long *addr, long *month, long *day, long *year, long *configuration)
long __stdcall ED2SetOutput(long address, long output)
long __stdcall AD5GetCMR(long address, long port, long *cmr)
long __stdcall A2GetResolution(long address, long *res)
Definition: SEIDrv.cpp:226
long __stdcall ED2GetPosition2(long address, long *pos)
long __stdcall IsAnalog()
long __stdcall GetBusyStatus()
long __stdcall CloseSEI()
Definition: SEIDrv.cpp:141
long __stdcall ED2GetInput(long address, long *input)
long __stdcall GetLastErrorText(char *pstr)
long __stdcall ED2GetMode(long address, long *mode)
long __stdcall AD5GetPosition(long address, long port, long *pos)
long __stdcall M1SetMotors(long address, long motors)
long __stdcall SetBaudRate(long baudrate)
long __stdcall AD5ComputeCRC(long lngSEIAddress, long lngCRCStart, long lngCRCLength, long *plResult)
long __stdcall A2SetMode(long address, long mode)
Definition: SEIDrv.cpp:212
const long SKIPDEVICEINFO
Definition: SEIDrv32.h:35
long __stdcall ED2SetResolution(long address, long res)
long __stdcall AD5Reset(long address, long port)
const long REINITIALIZE
Definition: SEIDrv32.h:38
long __stdcall Mcommand(char *bufout, long sizeout, char *bufin, long sizein)
long __stdcall A2SetResolution(long address, long res)
Definition: SEIDrv.cpp:245
long __stdcall ED2GetPosition1(long address, long *pos)
long __stdcall ED2ComputeCRC(long lngSEIAddress, long lngCRCStart, long lngCRCLength, long *plResult)
long __stdcall A2SetPosition(long address, long pos)
Definition: SEIDrv.cpp:281