canlib.h

Go to the documentation of this file.
1 /*
2  * Copyright 1994-2017 by KVASER AB, SWEDEN
3  *
4  * WWW: http://www.kvaser.com
5  *
6  * This software is furnished under a license and may be used and copied
7  * only in accordance with the terms of such license.
8  *
9  * \note MATLAB users on Windows: if you define WIN32_LEAN_AND_MEAN before
10  * including this file, you will see a lot less warnings.
11  *
12  */
13 
106 #ifndef _CANLIB_H_
107 #define _CANLIB_H_
108 
109 #include <stdlib.h>
110 
111 #include <windows.h>
112 #include "predef.h"
113 #include "canevt.h"
114 
115 #include "canstat.h"
116 
118 typedef int canHandle;
119 
120 #define canINVALID_HANDLE (-1)
121 
122 
123 #define CanHandle int
124 
126 #define WM__CANLIB (WM_USER+16354)
127 
150 #define canOPEN_EXCLUSIVE 0x0008
151 
163 #define canOPEN_REQUIRE_EXTENDED 0x0010
164 
172 #define canOPEN_ACCEPT_VIRTUAL 0x0020
173 
182 #define canOPEN_OVERRIDE_EXCLUSIVE 0x0040
183 
200 #define canOPEN_REQUIRE_INIT_ACCESS 0x0080
201 
213 #define canOPEN_NO_INIT_ACCESS 0x0100
214 
226 #define canOPEN_ACCEPT_LARGE_DLC 0x0200 // DLC can be greater than 8
227 
234 #define canOPEN_CAN_FD 0x0400
235 
249 #define canOPEN_CAN_FD_NONISO 0x0800
250 
251 
255 #define canOPEN_INTERNAL_L 0x1000
256 
268 #define canFILTER_ACCEPT 1
269 #define canFILTER_REJECT 2
270 
271 #define canFILTER_SET_CODE_STD 3
272 
273 #define canFILTER_SET_MASK_STD 4
274 
275 #define canFILTER_SET_CODE_EXT 5
276 
277 #define canFILTER_SET_MASK_EXT 6
278 
279 #define canFILTER_NULL_MASK 0L
280 
296 #define canDRIVER_NORMAL 4
297 
304 #define canDRIVER_SILENT 1
305 
309 #define canDRIVER_SELFRECEPTION 8
310 
314 #define canDRIVER_OFF 0
315 
338 #define canBITRATE_1M (-1)
339 
340 #define canBITRATE_500K (-2)
341 
342 #define canBITRATE_250K (-3)
343 
344 #define canBITRATE_125K (-4)
345 
346 #define canBITRATE_100K (-5)
347 
348 #define canBITRATE_62K (-6)
349 
350 #define canBITRATE_50K (-7)
351 
352 #define canBITRATE_83K (-8)
353 
354 #define canBITRATE_10K (-9)
355 
356 // CAN FD Bit Rates
360 #define canFD_BITRATE_500K_80P (-1000)
361 
364 #define canFD_BITRATE_1M_80P (-1001)
365 
368 #define canFD_BITRATE_2M_80P (-1002)
369 
372 #define canFD_BITRATE_2M_60P (-1007)
373 
376 #define canFD_BITRATE_4M_80P (-1003)
377 
380 #define canFD_BITRATE_8M_60P (-1004)
381 
384 #define canFD_BITRATE_8M_80P (-1005)
385 
388 #define canFD_BITRATE_8M_70P (-1006)
389 
391 #define BAUD_1M (-1)
392 
393 #define BAUD_500K (-2)
394 
395 #define BAUD_250K (-3)
396 
397 #define BAUD_125K (-4)
398 
399 #define BAUD_100K (-5)
400 
401 #define BAUD_62K (-6)
402 
403 #define BAUD_50K (-7)
404 
405 #define BAUD_83K (-8)
406 
409 //
410 // Define CANLIBAPI unless it's done already.
411 // (canlib.c provides its own definitions of CANLIBAPI, DLLIMPORT
412 // and DLLEXPORT before including this file.)
413 //
414 #ifndef CANLIBAPI
415 # define CANLIBAPI __stdcall
416 # define DLLIMPORT __declspec(dllimport)
417 # define DLLEXPORT __declspec(dllexport)
418 #endif /* CANLIBAPI */
419 
420 
421 #ifdef __cplusplus
422 extern "C" {
423 #endif /* __cplusplus */
424 
446 void CANLIBAPI canInitializeLibrary(void);
447 
469 canStatus CANLIBAPI canEnumHardwareEx(int *channelCount);
470 
495 canStatus CANLIBAPI canClose(const CanHandle hnd);
496 
521 canStatus CANLIBAPI canBusOn(const CanHandle hnd);
522 
543 canStatus CANLIBAPI canBusOff(const CanHandle hnd);
544 
594 canStatus CANLIBAPI canSetBusParams(const CanHandle hnd,
595  long freq,
596  unsigned int tseg1,
597  unsigned int tseg2,
598  unsigned int sjw,
599  unsigned int noSamp,
600  unsigned int syncmode);
601 
631 typedef struct kvBusParamsTq {
632  int tq;
633  int phase1;
634  int phase2;
635  int sjw;
636  int prop;
637  int prescaler;
638 } kvBusParamsTq;
639 
665  canStatus CANLIBAPI canSetBusParamsTq(const CanHandle hnd,
666  const kvBusParamsTq nominal);
667 
701 canStatus CANLIBAPI canSetBusParamsFd(const CanHandle hnd,
702  long freq_brs,
703  unsigned int tseg1_brs,
704  unsigned int tseg2_brs,
705  unsigned int sjw_brs);
706 
733 canStatus CANLIBAPI canSetBusParamsFdTq(const CanHandle hnd,
734  const kvBusParamsTq arbitration,
735  const kvBusParamsTq data);
736 
768 canStatus CANLIBAPI canGetBusParams(const CanHandle hnd,
769  long *freq,
770  unsigned int *tseg1,
771  unsigned int *tseg2,
772  unsigned int *sjw,
773  unsigned int *noSamp,
774  unsigned int *syncmode);
775 
795 canStatus CANLIBAPI canGetBusParamsTq(const CanHandle hnd,
796  kvBusParamsTq *nominal);
797 
820 canStatus CANLIBAPI canGetBusParamsFd(const CanHandle hnd,
821  long *freq_brs,
822  unsigned int *tseg1_brs,
823  unsigned int *tseg2_brs,
824  unsigned int *sjw_brs);
825 
846 canStatus CANLIBAPI canGetBusParamsFdTq(const CanHandle hnd,
847  kvBusParamsTq *nominal,
848  kvBusParamsTq *data);
849 
874 canStatus CANLIBAPI canSetBusOutputControl(const CanHandle hnd,
875  const unsigned int drivertype);
876 
911 canStatus CANLIBAPI canGetBusOutputControl(const CanHandle hnd,
912  unsigned int *drivertype);
913 
956 canStatus CANLIBAPI canAccept(const CanHandle hnd,
957  const long envelope,
958  const unsigned int flag);
959 
983 canStatus CANLIBAPI canReadStatus(const CanHandle hnd,
984  unsigned long *const flags);
985 
1022 canStatus CANLIBAPI canReadErrorCounters(const CanHandle hnd,
1023  unsigned int *txErr,
1024  unsigned int *rxErr,
1025  unsigned int *ovErr);
1026 
1068 canStatus CANLIBAPI canWrite(const CanHandle hnd,
1069  long id,
1070  void *msg,
1071  unsigned int dlc,
1072  unsigned int flag);
1073 
1101 canStatus CANLIBAPI canWriteSync(const CanHandle hnd, unsigned long timeout);
1102 
1156 canStatus CANLIBAPI canRead(const CanHandle hnd,
1157  long *id,
1158  void *msg,
1159  unsigned int *dlc,
1160  unsigned int *flag,
1161  unsigned long *time);
1214 canStatus CANLIBAPI canReadWait(const CanHandle hnd,
1215  long *id,
1216  void *msg,
1217  unsigned int *dlc,
1218  unsigned int *flag,
1219  unsigned long *time,
1220  unsigned long timeout);
1221 
1273 canStatus CANLIBAPI canReadSpecific(const CanHandle hnd, long id, void *msg,
1274  unsigned int *dlc, unsigned int *flag,
1275  unsigned long *time);
1276 
1307 canStatus CANLIBAPI canReadSync(const CanHandle hnd, unsigned long timeout);
1308 
1340 canStatus CANLIBAPI canReadSyncSpecific(const CanHandle hnd,
1341  long id,
1342  unsigned long timeout);
1343 
1389 canStatus CANLIBAPI canReadSpecificSkip(const CanHandle hnd,
1390  long id,
1391  void *msg,
1392  unsigned int *dlc,
1393  unsigned int *flag,
1394  unsigned long *time);
1395 
1396 
1435 canStatus CANLIBAPI canSetNotify(const CanHandle hnd,
1436  HWND aHWnd,
1437  unsigned int aNotifyFlags);
1438 
1439 
1474 canStatus CANLIBAPI canTranslateBaud(long *const freq,
1475  unsigned int *const tseg1,
1476  unsigned int *const tseg2,
1477  unsigned int *const sjw,
1478  unsigned int *const nosamp,
1479  unsigned int *const syncMode);
1480 
1503 canStatus CANLIBAPI kvBitrateToBusParamsTq(const canHandle hnd,
1504  int freq,
1505  kvBusParamsTq *nominal);
1506 
1532 canStatus CANLIBAPI kvBitrateToBusParamsFdTq(const canHandle hnd,
1533  int freqA,
1534  int freqD,
1535  kvBusParamsTq *arbitration,
1536  kvBusParamsTq *data);
1537 
1560 canStatus CANLIBAPI canGetErrorText(canStatus err, char *buf, unsigned int bufsiz);
1561 
1592 unsigned short CANLIBAPI canGetVersion(void);
1593 
1622 canStatus CANLIBAPI canIoCtl(const CanHandle hnd,
1623  unsigned int func,
1624  void *buf,
1625  unsigned int buflen);
1626 
1627 
1636 unsigned long CANLIBAPI canReadTimer(const CanHandle hnd);
1637 
1688 CanHandle CANLIBAPI canOpenChannel(int channel, int flags);
1689 
1710 canStatus CANLIBAPI canGetNumberOfChannels(int *channelCount);
1711 
1712 
1720 #define kvREMOTE_TYPE_NOT_REMOTE 0
1721 #define kvREMOTE_TYPE_WLAN 1
1722 #define kvREMOTE_TYPE_LAN 2
1723 
1732 #define kvLOGGER_TYPE_NOT_A_LOGGER 0
1733 #define kvLOGGER_TYPE_V1 1
1734 #define kvLOGGER_TYPE_V2 2
1735 
1768 canStatus CANLIBAPI canGetChannelData(int channel,
1769  int item,
1770  void *buffer,
1771  size_t bufsize);
1772 
1791 #define canCHANNELDATA_CHANNEL_CAP 1
1792 
1802 #define canCHANNELDATA_TRANS_CAP 2
1803 
1812 #define canCHANNELDATA_CHANNEL_FLAGS 3 // available, etc
1813 
1822 #define canCHANNELDATA_CARD_TYPE 4
1823 
1833 #define canCHANNELDATA_CARD_NUMBER 5
1834 
1842 #define canCHANNELDATA_CHAN_NO_ON_CARD 6
1843 
1853 #define canCHANNELDATA_CARD_SERIAL_NO 7
1854 
1864 #define canCHANNELDATA_TRANS_SERIAL_NO 8
1865 
1876 #define canCHANNELDATA_CARD_FIRMWARE_REV 9
1877 
1888 #define canCHANNELDATA_CARD_HARDWARE_REV 10
1889 
1899 #define canCHANNELDATA_CARD_UPC_NO 11
1900 
1911 #define canCHANNELDATA_TRANS_UPC_NO 12
1912 
1930 #define canCHANNELDATA_CHANNEL_NAME 13
1931 
1947 #define canCHANNELDATA_DLL_FILE_VERSION 14
1948 
1964 #define canCHANNELDATA_DLL_PRODUCT_VERSION 15
1965 
1981 #define canCHANNELDATA_DLL_FILETYPE 16
1982 
1991 #define canCHANNELDATA_TRANS_TYPE 17
1992 
2016 #define canCHANNELDATA_DEVICE_PHYSICAL_POSITION 18
2017 
2030 #define canCHANNELDATA_UI_NUMBER 19
2031 
2055 #define canCHANNELDATA_TIMESYNC_ENABLED 20
2056 
2071 #define canCHANNELDATA_DRIVER_FILE_VERSION 21
2072 
2087 #define canCHANNELDATA_DRIVER_PRODUCT_VERSION 22
2088 
2097 #define canCHANNELDATA_MFGNAME_UNICODE 23
2098 
2106 #define canCHANNELDATA_MFGNAME_ASCII 24
2107 
2116 #define canCHANNELDATA_DEVDESCR_UNICODE 25
2117 
2125 #define canCHANNELDATA_DEVDESCR_ASCII 26
2126 
2137 #define canCHANNELDATA_DRIVER_NAME 27
2138 
2151 #define canCHANNELDATA_CHANNEL_QUALITY 28
2152 
2161 #define canCHANNELDATA_ROUNDTRIP_TIME 29
2162 
2171 #define canCHANNELDATA_BUS_TYPE 30
2172 
2185 #define canCHANNELDATA_DEVNAME_ASCII 31
2186 
2197 #define canCHANNELDATA_TIME_SINCE_LAST_SEEN 32
2198 
2208 #define canCHANNELDATA_REMOTE_OPERATIONAL_MODE 33
2209 
2218 #define canCHANNELDATA_REMOTE_PROFILE_NAME 34
2219 
2228 #define canCHANNELDATA_REMOTE_HOST_NAME 35
2229 
2238 #define canCHANNELDATA_REMOTE_MAC 36
2239 
2248 #define canCHANNELDATA_MAX_BITRATE 37
2249 
2260 #define canCHANNELDATA_CHANNEL_CAP_MASK 38
2261 
2273 #define canCHANNELDATA_CUST_CHANNEL_NAME 39
2274 
2284 #define canCHANNELDATA_IS_REMOTE 40
2285 
2294 #define canCHANNELDATA_REMOTE_TYPE 41
2295 
2304 #define canCHANNELDATA_LOGGER_TYPE 42
2305 
2315 #define canCHANNELDATA_HW_STATUS 43
2316 
2326 #define canCHANNELDATA_FEATURE_EAN 44
2327 
2334 #define canCHANNELDATA_BUS_PARAM_LIMITS 45
2335 
2342 #define canCHANNELDATA_CLOCK_INFO 46
2343 
2364 #define canCHANNELDATA_CHANNEL_CAP_EX 47
2365 
2378 typedef struct kvClockInfo {
2379  int version;
2384 }kvClockInfo;
2385 
2400 typedef struct kvBusParamLimits {
2401  int version;
2407 
2418 #define canCHANNEL_IS_EXCLUSIVE 0x0001
2419 
2421 #define canCHANNEL_IS_OPEN 0x0002
2422 
2425 #define canCHANNEL_IS_CANFD 0x0004
2426 
2427 //#define canCHANNEL_IS_CANFD_NON_ISO 0x0008 Reserved for when needed
2428 
2431 #define canCHANNEL_IS_LIN 0x0010
2432 
2435 #define canCHANNEL_IS_LIN_MASTER 0x0020
2436 
2439 #define canCHANNEL_IS_LIN_SLAVE 0x0040
2440 
2441 
2460 #define canHWTYPE_NONE 0
2461 #define canHWTYPE_VIRTUAL 1
2462 #define canHWTYPE_LAPCAN 2
2463 #define canHWTYPE_CANPARI 3
2464 #define canHWTYPE_PCCAN 8
2465 #define canHWTYPE_PCICAN 9
2466 #define canHWTYPE_USBCAN 11
2467 #define canHWTYPE_PCICAN_II 40
2468 #define canHWTYPE_USBCAN_II 42
2469 #define canHWTYPE_SIMULATED 44
2470 #define canHWTYPE_ACQUISITOR 46
2471 #define canHWTYPE_LEAF 48
2472 #define canHWTYPE_PC104_PLUS 50
2473 #define canHWTYPE_PCICANX_II 52
2474 #define canHWTYPE_MEMORATOR_II 54
2475 #define canHWTYPE_MEMORATOR_PRO 54
2476 #define canHWTYPE_USBCAN_PRO 56
2477 #define canHWTYPE_IRIS 58
2478 #define canHWTYPE_BLACKBIRD 58
2479 #define canHWTYPE_MEMORATOR_LIGHT 60
2480 #define canHWTYPE_MINIHYDRA 62
2481 #define canHWTYPE_EAGLE 62
2482 #define canHWTYPE_BAGEL 64
2483 #define canHWTYPE_BLACKBIRD_V2 64
2484 #define canHWTYPE_MINIPCIE 66
2485 #define canHWTYPE_USBCAN_KLINE 68
2486 #define canHWTYPE_ETHERCAN 70
2487 #define canHWTYPE_USBCAN_LIGHT 72
2488 #define canHWTYPE_USBCAN_PRO2 74
2489 #define canHWTYPE_PCIE_V2 76
2490 #define canHWTYPE_MEMORATOR_PRO2 78
2491 #define canHWTYPE_LEAF2 80
2492 #define canHWTYPE_MEMORATOR_V2 82
2493 #define canHWTYPE_CANLINHYBRID 84
2494 #define canHWTYPE_DINRAIL 86
2495 #define canHWTYPE_U100 88
2496 #define canHWTYPE_LEAF3 90
2497 #define canHWTYPE_EDGE 92
2498 
2499 
2507 #define canCHANNEL_CAP_EXTENDED_CAN 0x00000001L
2508 #define canCHANNEL_CAP_BUS_STATISTICS 0x00000002L
2509 #define canCHANNEL_CAP_ERROR_COUNTERS 0x00000004L
2510 #define canCHANNEL_CAP_RESERVED_2 0x00000008L
2511 #define canCHANNEL_CAP_GENERATE_ERROR 0x00000010L
2512 #define canCHANNEL_CAP_GENERATE_OVERLOAD 0x00000020L
2513 #define canCHANNEL_CAP_TXREQUEST 0x00000040L
2514 #define canCHANNEL_CAP_TXACKNOWLEDGE 0x00000080L
2515 #define canCHANNEL_CAP_VIRTUAL 0x00010000L
2516 #define canCHANNEL_CAP_SIMULATED 0x00020000L
2517 #define canCHANNEL_CAP_RESERVED_1 0x00040000L
2518 #define canCHANNEL_CAP_CAN_FD 0x00080000L
2519 #define canCHANNEL_CAP_CAN_FD_NONISO 0x00100000L
2520 #define canCHANNEL_CAP_SILENT_MODE 0x00200000L
2521 #define canCHANNEL_CAP_SINGLE_SHOT 0x00400000L
2522 #define canCHANNEL_CAP_LOGGER 0x00800000L
2523 #define canCHANNEL_CAP_REMOTE_ACCESS 0x01000000L
2524 #define canCHANNEL_CAP_SCRIPT 0x02000000L
2525 #define canCHANNEL_CAP_LIN_HYBRID 0x04000000L
2526 #define canCHANNEL_CAP_IO_API 0x08000000L
2527 #define canCHANNEL_CAP_CANTEGRITY 0x10000000L
2528 
2529 
2540 #define canCHANNEL_CAP_EX_BUSPARAMS_TQ 0x0000000000000001L
2542 #define canCHANNEL_CAP_EX_ERRORFRAME_DATA 0x0000000000000002L
2544 #define canCHANNEL_CAP_EX_CAN 0x0000000000000004L
2546 #define canCHANNEL_CAP_EX_LIN 0x0000000000000008L
2548 
2562 #define canCHANNEL_OPMODE_NONE 1
2563 
2567 #define canCHANNEL_OPMODE_INFRASTRUCTURE 2
2568 
2572 #define canCHANNEL_OPMODE_RESERVED 3
2573 
2577 #define canCHANNEL_OPMODE_ADHOC 4
2578 
2588 #define canDRIVER_CAP_HIGHSPEED 0x00000001L
2589 
2615 #define canIOCTL_PREFER_EXT 1
2616 
2629 #define canIOCTL_PREFER_STD 2
2630 
2647 #define canIOCTL_CLEAR_ERROR_COUNTERS 5
2648 
2662 #define canIOCTL_SET_TIMER_SCALE 6
2663 
2683 #define canIOCTL_SET_TXACK 7
2684 
2697 #define canIOCTL_GET_RX_BUFFER_LEVEL 8
2698 
2711 #define canIOCTL_GET_TX_BUFFER_LEVEL 9
2712 
2722 #define canIOCTL_FLUSH_RX_BUFFER 10
2723 
2733 #define canIOCTL_FLUSH_TX_BUFFER 11
2734 
2743 #define canIOCTL_GET_TIMER_SCALE 12
2744 
2760 #define canIOCTL_SET_TXRQ 13
2761 
2789 #define canIOCTL_GET_EVENTHANDLE 14
2790 
2797 #define canIOCTL_SET_BYPASS_MODE 15
2798 
2804 #define canIOCTL_SET_WAKEUP 16
2805 
2815 #define canIOCTL_GET_DRIVERHANDLE 17
2816 
2822 #define canIOCTL_MAP_RXQUEUE 18
2823 
2829 #define canIOCTL_GET_WAKEUP 19
2830 
2842 #define canIOCTL_SET_REPORT_ACCESS_ERRORS 20
2843 
2851 #define canIOCTL_GET_REPORT_ACCESS_ERRORS 21
2852 
2862 #define canIOCTL_CONNECT_TO_VIRTUAL_BUS 22
2863 
2873 #define canIOCTL_DISCONNECT_FROM_VIRTUAL_BUS 23
2874 
2884 #define canIOCTL_SET_USER_IOPORT 24
2885 
2896 #define canIOCTL_GET_USER_IOPORT 25
2897 
2903 #define canIOCTL_SET_BUFFER_WRAPAROUND_MODE 26
2904 
2921 #define canIOCTL_SET_RX_QUEUE_SIZE 27
2922 
2928 #define canIOCTL_SET_USB_THROTTLE 28
2929 
2935 #define canIOCTL_GET_USB_THROTTLE 29
2936 
2951 #define canIOCTL_SET_BUSON_TIME_AUTO_RESET 30
2952 
2964 #define canIOCTL_GET_TXACK 31
2965 
2980 #define canIOCTL_SET_LOCAL_TXECHO 32
2981 
2997 #define canIOCTL_SET_ERROR_FRAMES_REPORTING 33
2998 
3012 #define canIOCTL_GET_CHANNEL_QUALITY 34
3013 
3025 #define canIOCTL_GET_ROUNDTRIP_TIME 35
3026 
3035 #define canIOCTL_GET_BUS_TYPE 36
3036 
3049 #define canIOCTL_GET_DEVNAME_ASCII 37
3050 
3062 #define canIOCTL_GET_TIME_SINCE_LAST_SEEN 38
3063 
3077 #define canIOCTL_GET_TREF_LIST 39
3078 
3100 #define canIOCTL_TX_INTERVAL 40
3101 
3113 #define canIOCTL_SET_BRLIMIT 43
3114 
3120 #define canIOCTL_SET_USB_THROTTLE_SCALED 41
3121 
3136 #define canIOCTL_SET_THROTTLE_SCALED 41
3137 
3143 #define canIOCTL_GET_USB_THROTTLE_SCALED 42
3144 
3159 #define canIOCTL_GET_THROTTLE_SCALED 42
3160 
3168 #define canIOCTL_RESET_OVERRUN_COUNT 44
3169 
3178 #define canIOCTL_LIN_MODE 45
3179 
3180 
3198 #define canIOCTL_SET_LOCAL_TXACK 46
3199 
3211 #define canIOCTL_SET_NATIVE_TICK_RESOLUTION 47
3212 
3220 #define canIOCTL_GET_NATIVE_TICK_RESOLUTION 48
3221 
3224 typedef struct {
3225  unsigned int portNo;
3226  unsigned int portValue;
3228 
3258 canStatus CANLIBAPI canWaitForEvent(const CanHandle hnd, DWORD timeout);
3259 
3300 canStatus CANLIBAPI canSetBusParamsC200(const CanHandle hnd, unsigned char btr0, unsigned char btr1);
3301 
3302 
3303 
3339 canStatus CANLIBAPI canSetDriverMode(const CanHandle hnd, int lineMode, int resNet);
3340 
3377 canStatus CANLIBAPI canGetDriverMode(const CanHandle hnd, int *lineMode, int *resNet);
3378 
3398 #define canVERSION_CANLIB32_VERSION 0
3399 
3410 #define canVERSION_CANLIB32_PRODVER 1
3411 
3423 #define canVERSION_CANLIB32_PRODVER32 2
3424 
3435 #define canVERSION_CANLIB32_BETA 3
3436 
3437 
3458 unsigned int CANLIBAPI canGetVersionEx(unsigned int itemCode);
3459 
3460 
3478 canStatus CANLIBAPI canParamGetCount(void);
3479 
3503 canStatus CANLIBAPI canParamCommitChanges(void);
3504 
3529 canStatus CANLIBAPI canParamDeleteEntry(int index);
3530 
3553 canStatus CANLIBAPI canParamCreateNewEntry(void);
3554 
3582 canStatus CANLIBAPI canParamSwapEntries(int index1, int index2);
3583 
3612 canStatus CANLIBAPI canParamGetName(int index, char *buffer, int maxlen);
3613 
3634 canStatus CANLIBAPI canParamGetChannelNumber(int index);
3635 
3664 canStatus CANLIBAPI canParamGetBusParams(int index,
3665  long *bitrate,
3666  unsigned int *tseg1,
3667  unsigned int *tseg2,
3668  unsigned int *sjw,
3669  unsigned int *noSamp);
3670 
3693 canStatus CANLIBAPI canParamSetName(int index, const char *buffer);
3694 
3716 canStatus CANLIBAPI canParamSetChannelNumber(int index, int channel);
3717 
3750 canStatus CANLIBAPI canParamSetBusParams(int index,
3751  long bitrate,
3752  unsigned int tseg1,
3753  unsigned int tseg2,
3754  unsigned int sjw,
3755  unsigned int noSamp);
3756 
3776 canStatus CANLIBAPI canParamFindByName(const char *name);
3796 canStatus CANLIBAPI canObjBufFreeAll(const CanHandle hnd);
3797 
3818 canStatus CANLIBAPI canObjBufAllocate(const CanHandle hnd, int type);
3819 
3828 #define canOBJBUF_TYPE_AUTO_RESPONSE 0x01
3829 #define canOBJBUF_TYPE_PERIODIC_TX 0x02
3830 
3852 canStatus CANLIBAPI canObjBufFree(const CanHandle hnd, int idx);
3853 
3854 // Writes CAN data to the object buffer with the specified index.
3855 
3881 canStatus CANLIBAPI canObjBufWrite(const CanHandle hnd,
3882  int idx,
3883  int id,
3884  void *msg,
3885  unsigned int dlc,
3886  unsigned int flags);
3887 
3913 canStatus CANLIBAPI canObjBufSetFilter(const CanHandle hnd,
3914  int idx,
3915  unsigned int code,
3916  unsigned int mask);
3917 
3938 canStatus CANLIBAPI canObjBufSetFlags(const CanHandle hnd,
3939  int idx,
3940  unsigned int flags);
3941 
3959 #define canOBJBUF_AUTO_RESPONSE_RTR_ONLY 0x01
3960 
3982 canStatus CANLIBAPI canObjBufSetPeriod(const CanHandle hnd,
3983  int idx,
3984  unsigned int period);
3985 
4006 canStatus CANLIBAPI canObjBufSetMsgCount(const CanHandle hnd,
4007  int idx,
4008  unsigned int count);
4009 
4029 canStatus CANLIBAPI canObjBufEnable(const CanHandle hnd, int idx);
4030 
4050 canStatus CANLIBAPI canObjBufDisable(const CanHandle hnd, int idx);
4051 
4075 canStatus CANLIBAPI canObjBufSendBurst(const CanHandle hnd,
4076  int idx,
4077  unsigned int burstlen);
4078 
4095 #define canVERSION_DONT_ACCEPT_LATER 0x01
4096 
4103 #define canVERSION_DONT_ACCEPT_BETAS 0x02
4104 
4142 BOOL CANLIBAPI canProbeVersion (const CanHandle hnd,
4143  int major,
4144  int minor,
4145  int oem_id,
4146  unsigned int flags);
4147 
4170 canStatus CANLIBAPI canResetBus(const CanHandle hnd);
4171 
4212 canStatus CANLIBAPI canWriteWait(const CanHandle hnd,
4213  long id,
4214  void *msg,
4215  unsigned int dlc,
4216  unsigned int flag,
4217  unsigned long timeout);
4218 
4219 
4249 canStatus CANLIBAPI canUnloadLibrary(void);
4250 
4312 canStatus CANLIBAPI canSetAcceptanceFilter(const CanHandle hnd,
4313  unsigned int code,
4314  unsigned int mask,
4315  int is_extended);
4339 canStatus CANLIBAPI canFlushReceiveQueue(const CanHandle hnd);
4340 
4365 canStatus CANLIBAPI canFlushTransmitQueue(const CanHandle hnd);
4366 
4386 canStatus CANLIBAPI kvGetApplicationMapping(int busType,
4387  char *appName,
4388  int appChannel,
4389  int *resultingChannel);
4390 
4412 canStatus CANLIBAPI kvBeep(const CanHandle hnd,
4413  int freq,
4414  unsigned int duration);
4415 
4435 canStatus CANLIBAPI kvSelfTest(const CanHandle hnd, unsigned long *presults);
4436 
4445 #define kvLED_ACTION_ALL_LEDS_ON 0
4446 #define kvLED_ACTION_ALL_LEDS_OFF 1
4447 #define kvLED_ACTION_LED_0_ON 2
4448 #define kvLED_ACTION_LED_0_OFF 3
4449 #define kvLED_ACTION_LED_1_ON 4
4450 #define kvLED_ACTION_LED_1_OFF 5
4451 #define kvLED_ACTION_LED_2_ON 6
4452 #define kvLED_ACTION_LED_2_OFF 7
4453 #define kvLED_ACTION_LED_3_ON 8
4454 #define kvLED_ACTION_LED_3_OFF 9
4455 #define kvLED_ACTION_LED_4_ON 10
4456 #define kvLED_ACTION_LED_4_OFF 11
4457 #define kvLED_ACTION_LED_5_ON 12
4458 #define kvLED_ACTION_LED_5_OFF 13
4459 #define kvLED_ACTION_LED_6_ON 14
4460 #define kvLED_ACTION_LED_6_OFF 15
4461 #define kvLED_ACTION_LED_7_ON 16
4462 #define kvLED_ACTION_LED_7_OFF 17
4463 #define kvLED_ACTION_LED_8_ON 18
4464 #define kvLED_ACTION_LED_8_OFF 19
4465 #define kvLED_ACTION_LED_9_ON 20
4466 #define kvLED_ACTION_LED_9_OFF 21
4467 #define kvLED_ACTION_LED_10_ON 22
4468 #define kvLED_ACTION_LED_10_OFF 23
4469 #define kvLED_ACTION_LED_11_ON 24
4470 #define kvLED_ACTION_LED_11_OFF 25
4471 
4472 
4495 canStatus CANLIBAPI kvFlashLeds (const CanHandle hnd, int action, int timeout);
4496 
4523 canStatus CANLIBAPI canRequestChipStatus(const CanHandle hnd);
4524 
4551 canStatus CANLIBAPI canRequestBusStatistics (const CanHandle hnd);
4552 
4558 typedef struct canBusStatistics_s {
4559  unsigned long stdData;
4560  unsigned long stdRemote;
4561  unsigned long extData;
4562  unsigned long extRemote;
4563  unsigned long errFrame;
4564 
4569  unsigned long busLoad;
4570  unsigned long overruns;
4572 
4595 canStatus CANLIBAPI canGetBusStatistics(const CanHandle hnd,
4596  canBusStatistics *stat,
4597  size_t bufsiz);
4598 
4619 canStatus CANLIBAPI canSetBitrate(const CanHandle hnd, int bitrate);
4620 
4638 canStatus CANLIBAPI kvAnnounceIdentity(const CanHandle hnd,
4639  void *buf,
4640  size_t bufsiz);
4641 
4662 canStatus CANLIBAPI kvAnnounceIdentityEx(const CanHandle hnd,
4663  int type,
4664  void *buf,
4665  size_t bufsiz);
4666 
4688 canStatus CANLIBAPI canGetHandleData(const CanHandle hnd,
4689  int item,
4690  void *buffer,
4691  size_t bufsize);
4692 
4694 typedef void *kvTimeDomain;
4695 
4698 
4703 typedef struct kvTimeDomainData_s {
4709 
4738 kvStatus CANLIBAPI kvTimeDomainCreate(kvTimeDomain *domain);
4739 
4762 kvStatus CANLIBAPI kvTimeDomainDelete(kvTimeDomain domain);
4763 
4789 kvStatus CANLIBAPI kvTimeDomainResetTime(kvTimeDomain domain);
4790 
4815 kvStatus CANLIBAPI kvTimeDomainGetData(kvTimeDomain domain,
4816  kvTimeDomainData *data,
4817  size_t bufsiz);
4818 
4841 kvStatus CANLIBAPI kvTimeDomainAddHandle(kvTimeDomain domain,
4842  const CanHandle hnd);
4843 
4865 kvStatus CANLIBAPI kvTimeDomainRemoveHandle(kvTimeDomain domain,
4866  const CanHandle hnd);
4867 
4885 typedef void(__stdcall *kvCallback_t)(CanHandle hnd, void *context, unsigned int notifyEvent);
4919 kvStatus CANLIBAPI kvSetNotifyCallback(const CanHandle hnd,
4920  kvCallback_t callback,
4921  void *context,
4922  unsigned int notifyFlags);
4923 
4937 #define kvBUSTYPE_NONE 0
4938 
4943 #define kvBUSTYPE_PCI 1
4944 
4949 #define kvBUSTYPE_PCMCIA 2
4950 
4955 #define kvBUSTYPE_USB 3
4956 
4961 #define kvBUSTYPE_WLAN 4
4962 
4967 #define kvBUSTYPE_PCI_EXPRESS 5
4968 
4973 #define kvBUSTYPE_ISA 6
4974 
4979 #define kvBUSTYPE_VIRTUAL 7
4980 
4985 #define kvBUSTYPE_PC104_PLUS 8
4986 
4991 #define kvBUSTYPE_LAN 9
4992 
5008 #define kvBUSTYPE_GROUP_VIRTUAL 1
5009 
5014 #define kvBUSTYPE_GROUP_LOCAL 2
5015 
5020 #define kvBUSTYPE_GROUP_REMOTE 3
5021 
5025 #define kvBUSTYPE_GROUP_INTERNAL 4
5026 
5080 kvStatus CANLIBAPI kvGetSupportedInterfaceInfo(int index,
5081  char *hwName,
5082  size_t nameLen,
5083  int *hwType,
5084  int *hwBusType);
5085 
5110 kvStatus CANLIBAPI kvReadDeviceCustomerData(const CanHandle hnd,
5111  int userNumber,
5112  int itemNumber,
5113  void *data,
5114  size_t bufsiz);
5115 
5129 #define kvENVVAR_TYPE_INT 1
5130 
5136 #define kvENVVAR_TYPE_FLOAT 2
5137 
5143 #define kvENVVAR_TYPE_STRING 3
5144 
5160 #define kvEVENT_TYPE_KEY 1
5161 
5169 typedef __int64 kvEnvHandle;
5170 
5190 kvStatus CANLIBAPI kvScriptStart(const CanHandle hnd, int slotNo);
5191 
5198 #define kvSCRIPT_STOP_NORMAL 0
5199 #define kvSCRIPT_STOP_FORCED -9
5223 kvStatus CANLIBAPI kvScriptStop(const CanHandle hnd, int slotNo, int mode);
5224 
5244 kvStatus CANLIBAPI kvScriptUnload(const CanHandle hnd, int slotNo);
5245 
5270 kvStatus CANLIBAPI kvScriptSendEvent(const CanHandle hnd,
5271  int slotNo,
5272  int eventType,
5273  int eventNo,
5274  unsigned int data);
5275 
5300 kvEnvHandle CANLIBAPI kvScriptEnvvarOpen(const CanHandle hnd,
5301  const char *envvarName,
5302  int *envvarType,
5303  int *envvarSize); // returns scriptHandle
5304 
5322 kvStatus CANLIBAPI kvScriptEnvvarClose(kvEnvHandle eHnd);
5323 
5344 kvStatus CANLIBAPI kvScriptEnvvarSetInt(kvEnvHandle eHnd, int val);
5345 
5367 kvStatus CANLIBAPI kvScriptEnvvarGetInt(kvEnvHandle eHnd, int *val);
5368 
5391 kvStatus CANLIBAPI kvScriptEnvvarSetFloat(kvEnvHandle eHnd, float val);
5392 
5416 kvStatus CANLIBAPI kvScriptEnvvarGetFloat(kvEnvHandle eHnd, float *val);
5417 
5444 kvStatus CANLIBAPI kvScriptEnvvarSetData(kvEnvHandle eHnd,
5445  const void *buf,
5446  int start_index,
5447  int data_len);
5448 
5474 kvStatus CANLIBAPI kvScriptEnvvarGetData(kvEnvHandle eHnd,
5475  void *buf,
5476  int start_index,
5477  int data_len);
5478 
5502 kvStatus CANLIBAPI kvScriptLoadFileOnDevice(const CanHandle hnd,
5503  int slotNo,
5504  char *localFile);
5505 
5534 kvStatus CANLIBAPI kvScriptLoadFile(const CanHandle hnd,
5535  int slotNo,
5536  char *filePathOnPC);
5537 
5538 
5552 #define kvSCRIPT_REQUEST_TEXT_UNSUBSCRIBE 1
5553 
5557 #define kvSCRIPT_REQUEST_TEXT_SUBSCRIBE 2
5558 
5562 #define kvSCRIPT_REQUEST_TEXT_ALL_SLOTS 255
5563 
5587 kvStatus CANLIBAPI kvScriptRequestText(const CanHandle hnd,
5588  unsigned int slot,
5589  unsigned int request);
5590 
5591 
5592 
5615 kvStatus CANLIBAPI kvScriptGetText(const CanHandle hnd,
5616  int *slot,
5617  unsigned long *time,
5618  unsigned int *flags,
5619  char *buf,
5620  size_t bufsize);
5621 
5628 #define kvSCRIPT_STATUS_LOADED 1
5629 #define kvSCRIPT_STATUS_RUNNING 2
5650 kvStatus CANLIBAPI kvScriptStatus(const CanHandle hnd,
5651  int slot,
5652  unsigned int *status);
5653 
5654 
5673 kvStatus CANLIBAPI kvScriptGetMaxEnvvarSize(int hnd, int *envvarSize);
5674 
5705 kvStatus CANLIBAPI kvScriptTxeGetData(const char *filePathOnPC,
5706  int item,
5707  void *buffer,
5708  unsigned int *bufsize);
5709 
5735 #define canTXEDATA_FILE_VERSION 1
5736 
5752 #define canTXEDATA_COMPILER_VERSION 2
5753 
5772 #define canTXEDATA_DATE 3
5773 
5784 #define canTXEDATA_DESCRIPTION 4
5785 
5799 #define canTXEDATA_SOURCE 5
5800 
5810 #define canTXEDATA_SIZE_OF_CODE 6
5811 
5821 #define canTXEDATA_IS_ENCRYPTED 7
5822 
5823 
5850 kvStatus CANLIBAPI kvFileCopyToDevice(const CanHandle hnd,
5851  char *hostFileName,
5852  char *deviceFileName);
5853 
5876 kvStatus CANLIBAPI kvFileCopyFromDevice(const CanHandle hnd,
5877  char *deviceFileName,
5878  char *hostFileName);
5879 
5901 kvStatus CANLIBAPI kvFileDelete(const CanHandle hnd, char *deviceFileName);
5902 
5925 kvStatus CANLIBAPI kvFileGetName(const CanHandle hnd,
5926  int fileNo,
5927  char *name,
5928  int namelen);
5929 
5949 kvStatus CANLIBAPI kvFileGetCount(const CanHandle hnd, int *count);
5950 
5973 kvStatus CANLIBAPI kvFileGetSystemData(const CanHandle hnd,
5974  int itemCode,
5975  int *result);
5976 
5995 kvStatus CANLIBAPI kvFileDiskFormat(const CanHandle hnd);
5996 
6014 #define kvDEVICE_MODE_INTERFACE 0x00
6015 
6020 #define kvDEVICE_MODE_LOGGER 0x01
6021 
6046 kvStatus CANLIBAPI kvDeviceSetMode(const CanHandle hnd, int mode);
6047 
6070 kvStatus CANLIBAPI kvDeviceGetMode(const CanHandle hnd, int *result);
6071 
6072 
6090 kvStatus CANLIBAPI kvPingRequest(const CanHandle hnd,
6091  unsigned int *requestTime);
6092 
6110 kvStatus CANLIBAPI kvPingGetLatest(const CanHandle hnd,
6111  unsigned int *requestTime,
6112  unsigned int *pingTime);
6113 
6115 
6124 //
6125 //
6126 //
6127 #if defined(_CANEVT_H_)
6128 canStatus CANLIBAPI canReadEvent(const CanHandle hnd, CanEvent *event);
6129 #endif /* _CANEVT_H_ */
6130 
6132 void CANLIBAPI canSetDebug(int d);
6134 canStatus CANLIBAPI canSetNotifyEx(const CanHandle hnd,
6135  HANDLE event,
6136  unsigned int flags);
6138 canStatus CANLIBAPI canSetTimer(const CanHandle hnd,
6139  DWORD interval,
6140  DWORD flags);
6142 #define canTIMER_CYCLIC 0x01
6143 
6144 #define canTIMER_EXPENSIVE 0x02
6145 
6146 int CANLIBAPI canSplitHandle(CanHandle hnd, int channel);
6148 int CANLIBAPI canOpenMultiple(DWORD bitmask, int flags);
6150 
6180 kvStatus CANLIBAPI kvReadTimer(const CanHandle hnd, unsigned int *time);
6181 
6210 kvStatus CANLIBAPI kvReadTimer64(const CanHandle hnd, KVINT64 *time);
6211 
6228 #define kvIO_INFO_GET_MODULE_TYPE 1
6229 
6235 #define kvIO_INFO_GET_DIRECTION 2
6236 
6242 #define kvIO_INFO_GET_PIN_TYPE 4
6243 
6249 #define kvIO_INFO_GET_NUMBER_OF_BITS 5
6250 
6258 #define kvIO_INFO_GET_RANGE_MIN 6
6259 
6267 #define kvIO_INFO_GET_RANGE_MAX 7
6268 
6276 #define kvIO_INFO_GET_DI_LOW_HIGH_FILTER 8
6277 
6285 #define kvIO_INFO_GET_DI_HIGH_LOW_FILTER 9
6286 
6294 #define kvIO_INFO_GET_AI_LP_FILTER_ORDER 10
6295 
6304 #define kvIO_INFO_GET_AI_HYSTERESIS 11
6305 
6311 #define kvIO_INFO_GET_MODULE_NUMBER 14
6312 
6318 #define kvIO_INFO_GET_SERIAL_NUMBER 15
6319 
6327 #define kvIO_INFO_GET_FW_VERSION 16
6328 
6349 #define kvIO_INFO_SET_DI_LOW_HIGH_FILTER 8
6350 
6358 #define kvIO_INFO_SET_DI_HIGH_LOW_FILTER 9
6359 
6367 #define kvIO_INFO_SET_AI_LP_FILTER_ORDER 10
6368 
6377 #define kvIO_INFO_SET_AI_HYSTERESIS 11
6378 
6395 #define kvIO_MODULE_TYPE_DIGITAL 1
6396 
6400 #define kvIO_MODULE_TYPE_ANALOG 2
6401 
6405 #define kvIO_MODULE_TYPE_RELAY 3
6406 
6410 #define kvIO_MODULE_TYPE_INTERNAL 4
6411 
6426 #define kvIO_PIN_TYPE_DIGITAL 1
6427 
6431 #define kvIO_PIN_TYPE_ANALOG 2
6432 
6436 #define kvIO_PIN_TYPE_RELAY 3
6437 
6452 #define kvIO_PIN_DIRECTION_IN 4
6453 
6457 #define kvIO_PIN_DIRECTION_OUT 8
6458 
6480 canStatus CANLIBAPI kvIoGetNumberOfPins(const CanHandle hnd, unsigned int *pinCount);
6481 
6498 canStatus CANLIBAPI kvIoConfirmConfig(const CanHandle hnd);
6499 
6519 canStatus CANLIBAPI kvIoPinGetInfo(const CanHandle hnd, unsigned int pin, int item, void *buffer, const unsigned int bufsize);
6520 
6540 canStatus CANLIBAPI kvIoPinSetInfo(const CanHandle hnd, unsigned int pin, int item, const void *buffer, const unsigned int bufsize);
6541 
6559 canStatus CANLIBAPI kvIoPinSetDigital(const CanHandle hnd, unsigned int pin, unsigned int value);
6560 
6580 canStatus CANLIBAPI kvIoPinGetDigital(const CanHandle hnd, unsigned int pin, unsigned int *value);
6581 
6603 canStatus CANLIBAPI kvIoPinGetOutputDigital(const CanHandle hnd, unsigned int pin, unsigned int *value);
6604 
6622 canStatus CANLIBAPI kvIoPinSetRelay(const CanHandle hnd, unsigned int pin, unsigned int value);
6623 
6643 canStatus CANLIBAPI kvIoPinGetOutputRelay(const CanHandle hnd, unsigned int pin, unsigned int *value);
6644 
6662 canStatus CANLIBAPI kvIoPinSetAnalog(const CanHandle hnd, unsigned int pin, float value);
6663 
6681 canStatus CANLIBAPI kvIoPinGetAnalog(const CanHandle hnd, unsigned int pin, float *value);
6682 
6702 canStatus CANLIBAPI kvIoPinGetOutputAnalog(const CanHandle hnd, unsigned int pin, float *value);
6703 
6709 typedef struct {
6710  int type;
6711  unsigned char DO1 : 1;
6712  unsigned char DO2 : 1;
6713  unsigned char DO3 : 1;
6714  unsigned char DO4 : 1;
6715  unsigned char DO5 : 1;
6716  unsigned char DO6 : 1;
6717  unsigned char DO7 : 1;
6718  unsigned char DO8 : 1;
6719  unsigned char DO9 : 1;
6720  unsigned char DO10: 1;
6721  unsigned char DO11: 1;
6722  unsigned char DO12: 1;
6723  unsigned char DO13: 1;
6724  unsigned char DO14: 1;
6725  unsigned char DO15: 1;
6726  unsigned char DO16: 1;
6727  unsigned char DI1 : 1;
6728  unsigned char DI2 : 1;
6729  unsigned char DI3 : 1;
6730  unsigned char DI4 : 1;
6731  unsigned char DI5 : 1;
6732  unsigned char DI6 : 1;
6733  unsigned char DI7 : 1;
6734  unsigned char DI8 : 1;
6735  unsigned char DI9 : 1;
6736  unsigned char DI10: 1;
6737  unsigned char DI11: 1;
6738  unsigned char DI12: 1;
6739  unsigned char DI13: 1;
6740  unsigned char DI14: 1;
6741  unsigned char DI15: 1;
6742  unsigned char DI16: 1;
6744 
6745 
6751 typedef struct {
6752  int type;
6753  unsigned char DO: 1;
6754  unsigned char DI: 1;
6756 
6757 
6764 typedef struct {
6765  int type;
6766  unsigned char RO1 : 1;
6767  unsigned char RO2 : 1;
6768  unsigned char RO3 : 1;
6769  unsigned char RO4 : 1;
6770  unsigned char RO5 : 1;
6771  unsigned char RO6 : 1;
6772  unsigned char RO7 : 1;
6773  unsigned char RO8 : 1;
6774  unsigned char DI1 : 1;
6775  unsigned char DI2 : 1;
6776  unsigned char DI3 : 1;
6777  unsigned char DI4 : 1;
6778  unsigned char DI5 : 1;
6779  unsigned char DI6 : 1;
6780  unsigned char DI7 : 1;
6781  unsigned char DI8 : 1;
6782 } kvIoModuleRelay;
6783 
6790 typedef struct {
6791  int type;
6792  float AO1;
6793  float AO2;
6794  float AO3;
6795  float AO4;
6796  float AI1;
6797  float AI2;
6798  float AI3;
6799  float AI4;
6801 
6802 
6825 canStatus CANLIBAPI kvIoGetModulePins(const CanHandle hnd, unsigned int module, void *buffer, const unsigned int bufsize);
6826 
6827 
6851 canStatus CANLIBAPI kvIoSetModulePins(const CanHandle hnd, unsigned int module, const void *buffer, const unsigned int bufsize);
6852 
6853 
6854 #ifdef __cplusplus
6855 }
6856 #endif /* __cplusplus */
6857 
6858 #include "obsolete.h"
6859 
6860 #endif /* _CANLIB_H_ */