PulsarAPI
USB and TCP/IP control library for Pulsar 320E
PulsarAPI.h
Go to the documentation of this file.
1
36#ifdef OLD_LOG
81#endif
82
83
84#ifndef _PULSARAPI_H
85#define _PULSARAPI_H
86#ifdef _WIN32
87#include <wtypes.h>
88#include <oleauto.h>
89#endif
90
91// The following ifdef block is the standard way of creating macros which make exporting
92// from a DLL simpler. All files within this DLL are compiled with the PULSARAPI_EXPORTS
93// symbol defined on the command line. this symbol should not be defined on any project
94// that uses this DLL. This way any other project whose source files include this file see
95// PULSAR_API functions CALLSPEC as being imported from a DLL, wheras this DLL sees symbols
96// defined with this macro as being exported. If a non-Microsoft compiler is used the
97// PULSAR_API CALLSPEC is defined as a blank and no modifications are made to the function interfaces.
98#ifdef _MSC_VER
99 #define CALLSPEC __stdcall
100 #ifdef PULSARAPI_EXPORTS
101 #define PULSAR_API extern "C" __declspec(dllexport)
102 #else
103 #define PULSAR_API extern "C" __declspec(dllimport)
104 #endif
105#else
106 #define CALLSPEC
107 #define PULSAR_API extern "C"
108#endif
109
110/* Define name of USB device */
111#define API_PULSAR_PRODUCT_NAME "Ai Pulsar 320 Controller"
112
113/* MPD Standard data type definitions */
114#ifndef MPD_TYPES
115#define MPD_TYPES
116typedef unsigned char UINT8_T;
117typedef unsigned short UINT16_T;
118typedef unsigned int UINT32_T;
119typedef char INT8_T;
120typedef short INT16_T;
121typedef int INT32_T;
122typedef unsigned char BOOLEAN_T;
123typedef float FLOAT32_T;
128typedef INT16_T ERRCODE_T;
129#endif
130
135typedef struct
136{
138 UINT8_T trigger;
140 UINT8_T rising;
143 UINT8_T mode;
144 UINT8_T reserved_byte;
146 UINT32_T repeat_cnt;
148 UINT16_T delay;
150 FLOAT32_T current;
152 UINT32_T width;
154 UINT32_T offtime;
155} API_CHAN_CONFIG_STRUCT_T; /* 20 bytes */
156
157
162{
174
177{
178 //Channel 1
179 API_CHAN_1 = 1,
180 //Channel 2
181 API_CHAN_2,
182};
183
184#ifdef KKP
185#define API_NUM_CHAN 2
186#else
187#define API_NUM_CHAN 2
188#endif
189
193enum
194{
201};
202
203#ifdef KKP
204#define API_NUM_TRIG 2
205#else
206#define API_NUM_TRIG 2
207#endif
208
209/* Define identifiers used to handle how channel configuration data is used */
210#define API_CHAN_CONFIG_DEFAULT 1
211#define API_CHAN_CONFIG_ACTIVE 2
212
214enum
215{
216 API_POWER_TEST,
217 API_RAM_TEST,
218 API_FLASH_TEST,
219 API_EXTIO_TEST,
220 API_EEPROM_TEST,
221 API_EXT_DAC_TEST,
222 API_SCI_TEST,
223 API_NUM_TESTS
224};
225
226/* Optional diagnostics tests do not normally run on startup of the Pulsar */
227/* They require additional hardware beyond the PCB Assembly itself to complete */
228/* The optional SCI test requires a serial loopback connector between the external */
229/* modular connector and the internal 10-pin header */
230#define API_NUM_OPTIONAL_TESTS 1
231
232/* Define bit identifiers for the information returned by the api_get_user_data command */
233
234/* The rotary switch value is returned within a range of 0 to API_MAX_ROTARY */
235#define API_MAX_ROTARY 999
236
237/* Each bit is associated with one DIP switch position */
238#define API_DIP_MODE0 0x1
239#define API_DIP_MODE1 0x2
240#define API_DIP_MODE2 0x4
241#define API_DIP_MODE3 0x8
242
243/* Each bit is associated with one TRIG input */
244#define API_TRIG_IN1 0x1
245#define API_TRIG_IN2 0x2
246
247/* Connection state of lighthead, USB, and RS-232 */
248#define API_CONN_LH_DETECT 0x1
249#define API_CONN_USBDETECT 0x2
250#define API_CONN_PCPRESENT 0x4
251#define API_CONN_PC_READY 0x8
252
253/* Operating state of power supplies */
254#define API_SUPPLY_VIN_ON 0x1
255#define API_SUPPLY_LV_ON 0x2
256#define API_SUPPLY_HV_ON 0x4
257
258/* Additional expansion general purpose inputs */
259#define API_EXP_GPIN1 0x1
260#define API_EXP_GPIN2 0x2
261#define API_EXP_GPINOUT1 0x4
262#define API_EXP_GPINOUT2 0x8
263
264/* Define possible lighthead types returned by api_get_light_data command */
265#define API_SIGNATECH_I 0x01
266#define API_SIGNATECH_II 0x02
267
268/* Define analog input identifiers used with api_measure_voltage command */
269#define API_AI_VIN_SWMON 0x6F
270#define API_AI_V_HV_STRINGMON 0x8C
271#define API_AI_V_LV_STRINGMON 0xFF
272#define API_AI_VCH1MON 0xFF
273#define API_AI_VCH2MON 0xFF
274#define API_AI_VCH3MON 0xFF
275#define API_AI_VCH4MON 0xFF
276#define API_AI_GND1 0x74
277#define API_AI_SIG1_ID1_MON 0xFF
278#define API_AI_SIG1_ID2_MON 0xFF
279#define API_AI_CH1_DRV_LVL 0xFF
280#define API_AI_CH2_DRV_LVL 0xFF
281#define API_AI_CH3_DRV_LVL 0xFF
282#define API_AI_CH4_DRV_LVL 0xFF
283#define API_AI_GND2 0x75
284#define API_AI_10VMON 0xFF
285#define API_AI_CH1CURRSENS 0xA0
286#define API_AI_CH2CURRSENS 0xA1
287#define API_AI_CH3CURRSENS 0xFF
288#define API_AI_CH4CURRSENS 0xFF
289#define API_AI_INT_TEMP 0xFF
290#define API_AI_GND3 0xFF
291#define API_AI_33VMON 0xFF
292#define API_AI_5VMON 0x71
293//New values
294#define API_AI_15VMON 0x70
295#define API_AI_15VSWMON 0x72
296#define API_AI_USB5VMON 0x73
297#define API_AI_CH1INTTEMP 0x79
298#define API_AI_CH2INTTEMP 0x65
299
300
307PULSAR_API UINT16_T CALLSPEC api_get_dll_version(void);
308
322PULSAR_API UINT32_T CALLSPEC api_get_dll_full_version(void);
323
334PULSAR_API ERRCODE_T CALLSPEC api_get_error_name(ERRCODE_T ecode,char * nameptr,UINT16_T namelen);
335
345PULSAR_API ERRCODE_T CALLSPEC api_get_error_text(ERRCODE_T ecode,char * textptr,UINT16_T textlen);
346
359PULSAR_API ERRCODE_T CALLSPEC api_init(UINT8_T port, const INT8_T * product_name, const INT8_T * serial_num);
360
372PULSAR_API ERRCODE_T CALLSPEC api_connect(UINT8_T port, const INT8_T * product_name, const INT8_T * ip_addr);
373
386PULSAR_API ERRCODE_T CALLSPEC api_get_pulsar_version(UINT8_T port, INT8_T * fw_version, INT8_T * hw_version, INT8_T * serial_num);
387
401PULSAR_API ERRCODE_T CALLSPEC api_get_pulsar_ipaddr(UINT8_T port, INT8_T * ip_addr, INT8_T * subnet, INT8_T * gateway, INT8_T * mac_addr);
402
410PULSAR_API ERRCODE_T CALLSPEC api_get_status(UINT8_T port);
411
420PULSAR_API ERRCODE_T CALLSPEC api_run_diags(UINT8_T port, UINT8_T test_num);
421
422
434PULSAR_API ERRCODE_T CALLSPEC api_get_channel_config(UINT8_T port, UINT8_T chan, UINT8_T type,
435 API_CHAN_CONFIG_STRUCT_T * config_data);
436
448PULSAR_API ERRCODE_T CALLSPEC api_set_channel_config(UINT8_T port, UINT8_T chan, UINT8_T type,
449 API_CHAN_CONFIG_STRUCT_T * config_data);
450
451
468PULSAR_API ERRCODE_T CALLSPEC api_set_channel_config_nochecks(UINT8_T port, UINT8_T chan, UINT8_T type,
469 API_CHAN_CONFIG_STRUCT_T * config_data);
470
471
480PULSAR_API ERRCODE_T CALLSPEC api_trigger(UINT8_T port, UINT8_T trig);
481
482
497PULSAR_API ERRCODE_T CALLSPEC api_calc_led_temp(UINT8_T port, UINT8_T ch,
498 UINT32_T width, FLOAT32_T current, FLOAT32_T *temp);
499
513PULSAR_API ERRCODE_T CALLSPEC api_calc_max_width(UINT8_T port, UINT8_T ch,
514 FLOAT32_T current, UINT32_T * width);
515
529PULSAR_API ERRCODE_T CALLSPEC api_calc_max_current(UINT8_T port, UINT8_T ch,
530 UINT32_T width, FLOAT32_T *current);
531
544PULSAR_API ERRCODE_T CALLSPEC api_calc_supply_voltage(UINT8_T port, UINT8_T ch,
545 UINT32_T width, FLOAT32_T current, FLOAT32_T *voltage);
546
562PULSAR_API ERRCODE_T CALLSPEC api_calc_max_freq(UINT8_T port, UINT8_T ch,
563 UINT32_T width, FLOAT32_T current, UINT16_T *freq);
564
576PULSAR_API ERRCODE_T CALLSPEC api_measure_drive_current(UINT8_T port, UINT8_T ch, FLOAT32_T *current);
577
588PULSAR_API ERRCODE_T CALLSPEC api_measure_voltage(UINT8_T port, UINT8_T id, FLOAT32_T *voltage);
589
606PULSAR_API ERRCODE_T CALLSPEC api_get_user_data(UINT8_T port,UINT16_T *rotary,UINT8_T *dip,UINT8_T *trigger,
607 UINT8_T *connect,UINT8_T *supply,UINT8_T *expansion);
608
621PULSAR_API ERRCODE_T CALLSPEC api_get_light_data(UINT8_T port, UINT8_T *sig_model, UINT8_T *sig1_id, char *sig2_pn, char *sig2_sn);
622
631PULSAR_API ERRCODE_T CALLSPEC api_get_light_data2(UINT8_T port, UINT8_T channel, char *sig2_pn);
632
642PULSAR_API ERRCODE_T CALLSPEC api_set_stored_data(UINT8_T port, UINT8_T *data, UINT8_T len);
643
654PULSAR_API ERRCODE_T CALLSPEC api_get_stored_data(UINT8_T port, UINT8_T *data, UINT8_T len);
655
656
657
665PULSAR_API ERRCODE_T CALLSPEC api_shutdown(UINT8_T port);
666
677PULSAR_API ERRCODE_T CALLSPEC api_set_configuration(UINT8_T port, UINT8_T* slew_rate, UINT8_T* diff_trigger, UINT8_T limit48v, UINT8_T disable_prot);
678
689PULSAR_API ERRCODE_T CALLSPEC api_get_configuration(UINT8_T port, UINT8_T* pslew_rate, UINT8_T* pdiff_trigger, UINT8_T* limit48v, UINT8_T* disable_prot);
690
700PULSAR_API ERRCODE_T CALLSPEC api_set_pulsar_ipaddr(UINT8_T port, const char* ip_addr, const char* subnet, const char* gateway);
701
712PULSAR_API ERRCODE_T CALLSPEC api_get_pulsar_ipaddr(UINT8_T port, char* ip_addr, char* subnet, char* gateway, char* mac_addr);
713
722PULSAR_API ERRCODE_T CALLSPEC api_get_errors(UINT8_T port, INT16_T* err, UINT8_T* totalErrors);
723
730PULSAR_API int api_connected_device(UINT8_T port);
731
732// @private
733PULSAR_API ERRCODE_T CALLSPEC api_get_mac(UINT8_T port, UINT8_T* mac);
734// @private
735PULSAR_API ERRCODE_T CALLSPEC api_set_mac(UINT8_T port, UINT8_T* mac);
736// @private
737PULSAR_API ERRCODE_T CALLSPEC api_get_manufacturing_mac(UINT8_T port, UINT8_T* mac);
738
747PULSAR_API ERRCODE_T CALLSPEC api_get_pulsar_addrs(UINT32_T* addrs, UINT16_T max_addrs, UINT16_T* num_found);
748
749#if defined(_WIN32) && defined(USE_SAFEARRAY)
750long __declspec (dllexport) __stdcall AddLongs_SafeArray(
751 SAFEARRAY **psaArray, // the array to use
752 long *plSum); // returns the sum of all elements of the array
753#endif
754
755#endif /* _PULARAPI_H */
ERRCODE_T api_init(UINT8_T port, const INT8_T *product_name, const INT8_T *serial_num)
Initializes the connection to a specific Pulsar.
@ API_TRIG_NONE
No trigger input.
Definition: PulsarAPI.h:196
@ API_TRIG_2
Trigger input 2.
Definition: PulsarAPI.h:200
@ API_TRIG_1
Trigger input 1.
Definition: PulsarAPI.h:198
ERRCODE_T api_set_pulsar_ipaddr(UINT8_T port, const char *ip_addr, const char *subnet, const char *gateway)
Set Pulsar IP address.
ERRCODE_T api_get_stored_data(UINT8_T port, UINT8_T *data, UINT8_T len)
Reads a block of Ai defined data from EEPROM.
ERRCODE_T api_set_channel_config_nochecks(UINT8_T port, UINT8_T chan, UINT8_T type, API_CHAN_CONFIG_STRUCT_T *config_data)
Sets the configuration data for one drive channel.
ERRCODE_T api_get_light_data2(UINT8_T port, UINT8_T channel, char *sig2_pn)
Get Signatech II lighthead part and serial number.
ERRCODE_T api_measure_voltage(UINT8_T port, UINT8_T id, FLOAT32_T *voltage)
Measures the voltage of one of the signals monitored by the Pulsar.
ERRCODE_T api_get_status(UINT8_T port)
Reads status information from the device.
ERRCODE_T api_get_error_name(ERRCODE_T ecode, char *nameptr, UINT16_T namelen)
Returns the name of the error associated with the code.
INT16_T ERRCODE_T
API Error Code type – error codes documented in separate "ecodes.ini" file.
Definition: PulsarAPI.h:128
ERRCODE_T api_measure_drive_current(UINT8_T port, UINT8_T ch, FLOAT32_T *current)
Measures the drive current of the selected drive channel.
ERRCODE_T api_set_configuration(UINT8_T port, UINT8_T *slew_rate, UINT8_T *diff_trigger, UINT8_T limit48v, UINT8_T disable_prot)
Set hardware configuration.
ERRCODE_T api_get_channel_config(UINT8_T port, UINT8_T chan, UINT8_T type, API_CHAN_CONFIG_STRUCT_T *config_data)
Gets the configuration data for one drive channel.
ERRCODE_T api_get_errors(UINT8_T port, INT16_T *err, UINT8_T *totalErrors)
Reads the oldest posted error.
ERRCODE_T api_get_pulsar_ipaddr(UINT8_T port, INT8_T *ip_addr, INT8_T *subnet, INT8_T *gateway, INT8_T *mac_addr)
Reads iip configuration settings from the device Each string can be up to 32 characters long.
ERRCODE_T api_get_user_data(UINT8_T port, UINT16_T *rotary, UINT8_T *dip, UINT8_T *trigger, UINT8_T *connect, UINT8_T *supply, UINT8_T *expansion)
Gathers various information about the operating state of the Pulsar.
UINT32_T api_get_dll_full_version(void)
Returns the full version number of this software.
ERRCODE_T api_run_diags(UINT8_T port, UINT8_T test_num)
Runs one or all of the built in diagnostics.
ERRCODE_T api_connect(UINT8_T port, const INT8_T *product_name, const INT8_T *ip_addr)
Initializes the connection to a specific Pulsar.
ERRCODE_T api_calc_max_current(UINT8_T port, UINT8_T ch, UINT32_T width, FLOAT32_T *current)
Calculates the maximum pulse current for the selected channel based on the information stored in the ...
ERRCODE_T api_calc_max_width(UINT8_T port, UINT8_T ch, FLOAT32_T current, UINT32_T *width)
Calculates the maximum pulse width for the selected channel based on the information stored in the li...
API_CHAN_T
Define the drive channel identifiers used with the API interface.
Definition: PulsarAPI.h:177
UINT16_T api_get_dll_version(void)
Returns the current version number of this software.
ERRCODE_T api_get_pulsar_addrs(UINT32_T *addrs, UINT16_T max_addrs, UINT16_T *num_found)
Find pulsar devices on all attached network adapters.
ERRCODE_T api_trigger(UINT8_T port, UINT8_T trig)
Generates a software trigger on the selected trigger channel.
ERRCODE_T api_set_stored_data(UINT8_T port, UINT8_T *data, UINT8_T len)
Saves a block of Ai defined data to EEPROM.
ERRCODE_T api_shutdown(UINT8_T port)
Shuts down the connection to a specific Pulsar.
ERRCODE_T api_get_error_text(ERRCODE_T ecode, char *textptr, UINT16_T textlen)
Returns the text description of the error associated with the code.
ERRCODE_T api_get_configuration(UINT8_T port, UINT8_T *pslew_rate, UINT8_T *pdiff_trigger, UINT8_T *limit48v, UINT8_T *disable_prot)
Get hardware configuration.
ERRCODE_T api_set_channel_config(UINT8_T port, UINT8_T chan, UINT8_T type, API_CHAN_CONFIG_STRUCT_T *config_data)
Sets the configuration data for one drive channel.
ERRCODE_T api_get_pulsar_version(UINT8_T port, INT8_T *fw_version, INT8_T *hw_version, INT8_T *serial_num)
Reads firmware version, hardware version, and serial number Each string can be up to 32 characters lo...
ERRCODE_T api_calc_led_temp(UINT8_T port, UINT8_T ch, UINT32_T width, FLOAT32_T current, FLOAT32_T *temp)
Calculates the expected LED junction temperature based on the information stored in the lighthead dat...
API_MODE_T
Define possible operating modes.
Definition: PulsarAPI.h:162
@ API_MODE_PULSED
Pulse mode.
Definition: PulsarAPI.h:164
@ API_MODE_INTERNAL_TRIGGER
Used for test mode (10Hz internal trigger)
Definition: PulsarAPI.h:170
@ API_NUM_MODE
Number of enum entries (do not use as mode)
Definition: PulsarAPI.h:172
@ API_MODE_TIMING_BYPASS
Used for Continuous mode (with 1,000,000us pulsewidth)
Definition: PulsarAPI.h:168
@ API_MODE_REPEAT
Repeat mode, same as pulsed in 320E.
Definition: PulsarAPI.h:166
int api_connected_device(UINT8_T port)
Gets the type of device on the given port.
ERRCODE_T api_calc_max_freq(UINT8_T port, UINT8_T ch, UINT32_T width, FLOAT32_T current, UINT16_T *freq)
Calculates the maximum frequency allowed for a given width and current.
ERRCODE_T api_calc_supply_voltage(UINT8_T port, UINT8_T ch, UINT32_T width, FLOAT32_T current, FLOAT32_T *voltage)
Calculates the required supply voltage for a given width and current.
ERRCODE_T api_get_light_data(UINT8_T port, UINT8_T *sig_model, UINT8_T *sig1_id, char *sig2_pn, char *sig2_sn)
Gathers information regarding the lighthead type.
Channel/output configuration struct.
Definition: PulsarAPI.h:136
UINT32_T offtime
Off time between repeat pulses (microseconds)
Definition: PulsarAPI.h:154
UINT32_T repeat_cnt
Number of repeat pulses per trigger (0 = 1 pulse)
Definition: PulsarAPI.h:146
UINT16_T delay
Pulse delay (microseconds)
Definition: PulsarAPI.h:148
UINT8_T rising
Rising edge (1 = rising, 0 = falling)
Definition: PulsarAPI.h:140
UINT8_T trigger
Trigger input.
Definition: PulsarAPI.h:138
UINT32_T width
Pulse width (microseconds)
Definition: PulsarAPI.h:152
UINT8_T mode
Operating mode.
Definition: PulsarAPI.h:143
FLOAT32_T current
Pulse current (Amps)
Definition: PulsarAPI.h:150