00001
00030 #ifndef _CANLIB_H_
00031 #define _CANLIB_H_
00032
00033 #include <stdlib.h>
00034 # include <windows.h>
00035 # include "predef.h"
00036 # include "canevt.h"
00037 # define CANLIB_DECLARE_ALL
00038 #include "canstat.h"
00039
00041 typedef int canHandle;
00042
00043 # define canINVALID_HANDLE (-1)
00044
00046 # define CanHandle int
00047
00050 # define WM__CANLIB (WM_USER+16354)
00051
00067 #define canOPEN_EXCLUSIVE 0x0008
00068
00080 #define canOPEN_REQUIRE_EXTENDED 0x0010
00081
00089 # define canOPEN_ACCEPT_VIRTUAL 0x0020
00090
00099 # define canOPEN_OVERRIDE_EXCLUSIVE 0x0040
00100
00116 # define canOPEN_REQUIRE_INIT_ACCESS 0x0080
00117
00125 # define canOPEN_NO_INIT_ACCESS 0x0100
00126
00138 # define canOPEN_ACCEPT_LARGE_DLC 0x0200 // DLC can be greater than 8
00139
00146 # define canOPEN_CAN_FD 0x0400
00147
00161 # define canOPEN_CAN_FD_NONISO 0x0800
00162
00173 #define canFILTER_ACCEPT 1
00174 #define canFILTER_REJECT 2
00175
00176 #define canFILTER_SET_CODE_STD 3
00177
00178 #define canFILTER_SET_MASK_STD 4
00179
00180 #define canFILTER_SET_CODE_EXT 5
00181
00182 #define canFILTER_SET_MASK_EXT 6
00183
00184 #define canFILTER_NULL_MASK 0L
00185
00201 #define canDRIVER_NORMAL 4
00202
00209 #define canDRIVER_SILENT 1
00210
00214 #define canDRIVER_SELFRECEPTION 8
00215
00219 #define canDRIVER_OFF 0
00220
00243 #define canBITRATE_1M (-1)
00244
00245 #define canBITRATE_500K (-2)
00246
00247 #define canBITRATE_250K (-3)
00248
00249 #define canBITRATE_125K (-4)
00250
00251 #define canBITRATE_100K (-5)
00252
00253 #define canBITRATE_62K (-6)
00254
00255 #define canBITRATE_50K (-7)
00256
00257 #define canBITRATE_83K (-8)
00258
00259 #define canBITRATE_10K (-9)
00260
00261
00265 #define canFD_BITRATE_500K_80P (-1000)
00266
00269 #define canFD_BITRATE_1M_80P (-1001)
00270
00273 #define canFD_BITRATE_2M_80P (-1002)
00274
00277 #define canFD_BITRATE_4M_80P (-1003)
00278
00281 #define canFD_BITRATE_8M_60P (-1004)
00282
00284 #define BAUD_1M (-1)
00285
00286 #define BAUD_500K (-2)
00287
00288 #define BAUD_250K (-3)
00289
00290 #define BAUD_125K (-4)
00291
00292 #define BAUD_100K (-5)
00293
00294 #define BAUD_62K (-6)
00295
00296 #define BAUD_50K (-7)
00297
00298 #define BAUD_83K (-8)
00299
00302
00303
00304
00305
00306
00307 #ifndef CANLIBAPI
00308 # define CANLIBAPI __stdcall
00309 # define DLLIMPORT __declspec(dllimport)
00310 # define DLLEXPORT __declspec(dllexport)
00311 #endif
00312
00313
00314 #ifdef __cplusplus
00315 extern "C" {
00316 #endif
00317
00339 void CANLIBAPI canInitializeLibrary (void);
00340
00365 canStatus CANLIBAPI canClose (const CanHandle hnd);
00366
00391 canStatus CANLIBAPI canBusOn (const CanHandle hnd);
00392
00412 canStatus CANLIBAPI canBusOff (const CanHandle hnd);
00413
00460 canStatus CANLIBAPI canSetBusParams (const CanHandle hnd,
00461 long freq,
00462 unsigned int tseg1,
00463 unsigned int tseg2,
00464 unsigned int sjw,
00465 unsigned int noSamp,
00466 unsigned int syncmode);
00467
00499 canStatus CANLIBAPI canSetBusParamsFd(const CanHandle hnd,
00500 long freq_brs,
00501 unsigned int tseg1_brs,
00502 unsigned int tseg2_brs,
00503 unsigned int sjw_brs);
00504
00505
00537 canStatus CANLIBAPI canGetBusParams (const CanHandle hnd,
00538 long *freq,
00539 unsigned int *tseg1,
00540 unsigned int *tseg2,
00541 unsigned int *sjw,
00542 unsigned int *noSamp,
00543 unsigned int *syncmode);
00544
00545
00568 canStatus CANLIBAPI canGetBusParamsFd(const CanHandle hnd,
00569 long *freq_brs,
00570 unsigned int *tseg1_brs,
00571 unsigned int *tseg2_brs,
00572 unsigned int *sjw_brs);
00597 canStatus CANLIBAPI canSetBusOutputControl (const CanHandle hnd,
00598 const unsigned int drivertype);
00599
00634 canStatus CANLIBAPI canGetBusOutputControl (const CanHandle hnd,
00635 unsigned int *drivertype);
00636
00679 canStatus CANLIBAPI canAccept (const CanHandle hnd,
00680 const long envelope,
00681 const unsigned int flag);
00682
00706 canStatus CANLIBAPI canReadStatus (const CanHandle hnd,
00707 unsigned long *const flags);
00708
00745 canStatus CANLIBAPI canReadErrorCounters (const CanHandle hnd,
00746 unsigned int *txErr,
00747 unsigned int *rxErr,
00748 unsigned int *ovErr);
00749
00791 canStatus CANLIBAPI canWrite (const CanHandle hnd,
00792 long id,
00793 void *msg,
00794 unsigned int dlc,
00795 unsigned int flag);
00796
00824 canStatus CANLIBAPI canWriteSync (const CanHandle hnd, unsigned long timeout);
00825
00878 canStatus CANLIBAPI canRead (const CanHandle hnd,
00879 long *id,
00880 void *msg,
00881 unsigned int *dlc,
00882 unsigned int *flag,
00883 unsigned long *time);
00884
00933 canStatus CANLIBAPI canReadWait (const CanHandle hnd,
00934 long *id,
00935 void *msg,
00936 unsigned int *dlc,
00937 unsigned int *flag,
00938 unsigned long *time,
00939 unsigned long timeout);
00940
00941 #if defined(CANLIB_DECLARE_ALL)
00942
00991 canStatus CANLIBAPI canReadSpecific (const CanHandle hnd, long id, void * msg,
00992 unsigned int * dlc, unsigned int * flag,
00993 unsigned long * time);
00994
01025 canStatus CANLIBAPI canReadSync (const CanHandle hnd, unsigned long timeout);
01026
01058 canStatus CANLIBAPI canReadSyncSpecific (const CanHandle hnd,
01059 long id,
01060 unsigned long timeout);
01061
01105 canStatus CANLIBAPI canReadSpecificSkip (const CanHandle hnd,
01106 long id,
01107 void * msg,
01108 unsigned int * dlc,
01109 unsigned int * flag,
01110 unsigned long * time);
01111 #endif
01112
01113
01152 canStatus CANLIBAPI canSetNotify (const CanHandle hnd,
01153 HWND aHWnd,
01154 unsigned int aNotifyFlags);
01155
01156
01191 canStatus CANLIBAPI canTranslateBaud (long *const freq,
01192 unsigned int *const tseg1,
01193 unsigned int *const tseg2,
01194 unsigned int *const sjw,
01195 unsigned int *const nosamp,
01196 unsigned int *const syncMode);
01197
01220 canStatus CANLIBAPI canGetErrorText (canStatus err, char *buf, unsigned int bufsiz);
01221
01261 unsigned short CANLIBAPI canGetVersion (void);
01262
01292 canStatus CANLIBAPI canIoCtl (const CanHandle hnd,
01293 unsigned int func,
01294 void *buf,
01295 unsigned int buflen);
01296
01297
01298
01331 unsigned long CANLIBAPI canReadTimer (const CanHandle hnd);
01332
01383 CanHandle CANLIBAPI canOpenChannel (int channel, int flags);
01384
01405 canStatus CANLIBAPI canGetNumberOfChannels (int *channelCount);
01406
01407
01415 #define kvREMOTE_TYPE_NOT_REMOTE 0 ///<
01416 #define kvREMOTE_TYPE_WLAN 1 ///<
01417 #define kvREMOTE_TYPE_LAN 2 ///<
01418
01427 #define kvLOGGER_TYPE_NOT_A_LOGGER 0 ///<
01428 #define kvLOGGER_TYPE_V1 1 ///<
01429 #define kvLOGGER_TYPE_V2 2 ///<
01430
01462 canStatus CANLIBAPI canGetChannelData (int channel,
01463 int item,
01464 void *buffer,
01465 size_t bufsize);
01466
01485 #define canCHANNELDATA_CHANNEL_CAP 1
01486
01500 #define canCHANNELDATA_TRANS_CAP 2
01501
01508 #define canCHANNELDATA_CHANNEL_FLAGS 3 // available, etc
01509
01518 #define canCHANNELDATA_CARD_TYPE 4
01519
01534 #define canCHANNELDATA_CARD_NUMBER 5
01535
01543 #define canCHANNELDATA_CHAN_NO_ON_CARD 6
01544
01554 #define canCHANNELDATA_CARD_SERIAL_NO 7
01555
01569 #define canCHANNELDATA_TRANS_SERIAL_NO 8
01570
01581 #define canCHANNELDATA_CARD_FIRMWARE_REV 9
01582
01593 #define canCHANNELDATA_CARD_HARDWARE_REV 10
01594
01604 #define canCHANNELDATA_CARD_UPC_NO 11
01605
01620 #define canCHANNELDATA_TRANS_UPC_NO 12
01621
01639 #define canCHANNELDATA_CHANNEL_NAME 13
01640 #if defined(CANLIB_DECLARE_ALL)
01641
01662 # define canCHANNELDATA_DLL_FILE_VERSION 14
01663
01684 # define canCHANNELDATA_DLL_PRODUCT_VERSION 15
01685
01705 # define canCHANNELDATA_DLL_FILETYPE 16
01706
01720 # define canCHANNELDATA_TRANS_TYPE 17
01721
01749 # define canCHANNELDATA_DEVICE_PHYSICAL_POSITION 18
01750
01767 # define canCHANNELDATA_UI_NUMBER 19
01768
01796 # define canCHANNELDATA_TIMESYNC_ENABLED 20
01797
01817 # define canCHANNELDATA_DRIVER_FILE_VERSION 21
01818
01838 # define canCHANNELDATA_DRIVER_PRODUCT_VERSION 22
01839
01852 # define canCHANNELDATA_MFGNAME_UNICODE 23
01853
01861 # define canCHANNELDATA_MFGNAME_ASCII 24
01862
01875 # define canCHANNELDATA_DEVDESCR_UNICODE 25
01876
01884 # define canCHANNELDATA_DEVDESCR_ASCII 26
01885
01901 # define canCHANNELDATA_DRIVER_NAME 27
01902
01919 # define canCHANNELDATA_CHANNEL_QUALITY 28
01920
01933 # define canCHANNELDATA_ROUNDTRIP_TIME 29
01934
01947 # define canCHANNELDATA_BUS_TYPE 30
01948
01964 # define canCHANNELDATA_DEVNAME_ASCII 31
01965
01980 # define canCHANNELDATA_TIME_SINCE_LAST_SEEN 32
01981
01995 # define canCHANNELDATA_REMOTE_OPERATIONAL_MODE 33
01996
02009 # define canCHANNELDATA_REMOTE_PROFILE_NAME 34
02010
02023 # define canCHANNELDATA_REMOTE_HOST_NAME 35
02024
02037 # define canCHANNELDATA_REMOTE_MAC 36
02038
02047 # define canCHANNELDATA_MAX_BITRATE 37
02048
02059 # define canCHANNELDATA_CHANNEL_CAP_MASK 38
02060
02068 # define canCHANNELDATA_IS_REMOTE 40
02069
02077 # define canCHANNELDATA_REMOTE_TYPE 41
02078
02086 # define canCHANNELDATA_LOGGER_TYPE 42
02087
02088
02089
02090
02091 #endif
02092
02101 #define canCHANNELDATA_CUST_CHANNEL_NAME 39
02102
02116 #define canCHANNEL_IS_EXCLUSIVE 0x0001
02117
02119 #define canCHANNEL_IS_OPEN 0x0002
02120
02124 #define canCHANNEL_IS_CANFD 0x0004
02125
02126
02127
02146 #define canHWTYPE_NONE 0 ///< Unknown or undefined
02147 #define canHWTYPE_VIRTUAL 1 ///< The virtual CAN bus
02148 #define canHWTYPE_LAPCAN 2 ///< LAPcan Family
02149 #define canHWTYPE_CANPARI 3 ///< CANpari (obsolete).
02150 #define canHWTYPE_PCCAN 8 ///< PCcan Family
02151 #define canHWTYPE_PCICAN 9 ///< PCIcan Family
02152 #define canHWTYPE_USBCAN 11 ///< USBcan (obsolete).
02153 #define canHWTYPE_PCICAN_II 40 ///< PCIcan II family
02154 #define canHWTYPE_USBCAN_II 42 ///< USBcan II, USBcan Rugged, Kvaser Memorator
02155 #define canHWTYPE_SIMULATED 44 ///< Simulated CAN bus for Kvaser Creator (obsolete).
02156 #define canHWTYPE_ACQUISITOR 46 ///< Kvaser Acquisitor (obsolete).
02157 #define canHWTYPE_LEAF 48 ///< Kvaser Leaf Family
02158 #define canHWTYPE_PC104_PLUS 50 ///< Kvaser PC104+
02159 #define canHWTYPE_PCICANX_II 52 ///< Kvaser PCIcanx II
02160 #define canHWTYPE_MEMORATOR_II 54 ///< Kvaser Memorator Professional family
02161 #define canHWTYPE_MEMORATOR_PRO 54 ///< Kvaser Memorator Professional family
02162 #define canHWTYPE_USBCAN_PRO 56 ///< Kvaser USBcan Professional
02163 #define canHWTYPE_IRIS 58 ///< Obsolete name, use canHWTYPE_BLACKBIRD instead
02164 #define canHWTYPE_BLACKBIRD 58 ///< Kvaser BlackBird
02165 #define canHWTYPE_MEMORATOR_LIGHT 60 ///< Kvaser Memorator Light
02166 #define canHWTYPE_MINIHYDRA 62 ///< Obsolete name, use canHWTYPE_EAGLE instead
02167 #define canHWTYPE_EAGLE 62 ///< Kvaser Eagle family
02168 #define canHWTYPE_BAGEL 64 ///< Obsolete name, use canHWTYPE_BLACKBIRD_V2 instead
02169 #define canHWTYPE_BLACKBIRD_V2 64 ///< Kvaser BlackBird v2
02170 #define canHWTYPE_MINIPCIE 66 ///< Kvaser Mini PCI Express
02171 #define canHWTYPE_USBCAN_KLINE 68 ///< USBcan Pro HS/K-Line
02172 #define canHWTYPE_ETHERCAN 70 ///< Kvaser Ethercan
02173 #define canHWTYPE_USBCAN_LIGHT 72 ///< Kvaser USBcan Light
02174 #define canHWTYPE_USBCAN_PRO2 74 ///< Kvaser USBcan Pro 5xHS and variants
02175 #define canHWTYPE_PCIE_V2 76 ///< Kvaser PCIEcan 4xHS and variants
02176 #define canHWTYPE_MEMORATOR_PRO2 78 ///< Kvaser Memorator Pro 5xHS and variants
02177 #define canHWTYPE_LEAF2 80 ///< Kvaser Leaf Pro HS v2 and variants
02178 #define canHWTYPE_MEMORATOR_V2 82 ///< Kvaser Memorator (2nd generation)
02179
02180
02189 #define canCHANNEL_CAP_EXTENDED_CAN 0x00000001L ///< Can use extended identifiers
02190 #define canCHANNEL_CAP_BUS_STATISTICS 0x00000002L ///< Can report busload etc
02191 #define canCHANNEL_CAP_ERROR_COUNTERS 0x00000004L ///< Can return error counters
02192 #define canCHANNEL_CAP_CAN_DIAGNOSTICS 0x00000008L ///< Can report CAN diagnostics
02193 #define canCHANNEL_CAP_GENERATE_ERROR 0x00000010L ///< Can send error frames
02194 #define canCHANNEL_CAP_GENERATE_OVERLOAD 0x00000020L ///< Can send CAN overload frame
02195 #define canCHANNEL_CAP_TXREQUEST 0x00000040L ///< Can report when a CAN messsage transmission is initiated
02196 #define canCHANNEL_CAP_TXACKNOWLEDGE 0x00000080L ///< Can report when a CAN messages has been transmitted
02197 #define canCHANNEL_CAP_VIRTUAL 0x00010000L ///< Virtual CAN channel
02198 #define canCHANNEL_CAP_SIMULATED 0x00020000L ///< Simulated CAN channel
02199 #define canCHANNEL_CAP_RESERVED_1 0x00040000L ///< Obsolete, use canCHANNEL_CAP_REMOTE_ACCESS or \ref canGetChannelData() instead.
02200 #define canCHANNEL_CAP_CAN_FD 0x00080000L ///< CAN-FD ISO compliant channel
02201 #define canCHANNEL_CAP_CAN_FD_NONISO 0x00100000L ///< CAN-FD NON-ISO compliant channel
02202 #define canCHANNEL_CAP_SILENT_MODE 0x00200000L ///< Channel supports Silent mode
02203 #define canCHANNEL_CAP_SINGLE_SHOT 0x00400000L ///< Channel supports Single Shot messages
02204 #define canCHANNEL_CAP_LOGGER 0x00800000L ///< Channel has logger capabilities.
02205 #define canCHANNEL_CAP_REMOTE_ACCESS 0x01000000L ///< Channel has remote capabilities
02206 #define canCHANNEL_CAP_SCRIPT 0x02000000L ///< Channel has script capabilities.
02207
02216 #define canCHANNEL_OPMODE_NONE 1 ///< Not applicable, or unknown
02217 #define canCHANNEL_OPMODE_INFRASTRUCTURE 2 ///< Infrastructure mode
02218 #define canCHANNEL_OPMODE_RESERVED 3 ///< Reserved value, do not use
02219 #define canCHANNEL_OPMODE_ADHOC 4 ///< Adhoc mode
02220
02230 #define canDRIVER_CAP_HIGHSPEED 0x00000001L
02231
02254 #define canIOCTL_PREFER_EXT 1
02255
02266 #define canIOCTL_PREFER_STD 2
02267
02268
02282 #define canIOCTL_CLEAR_ERROR_COUNTERS 5
02283
02294 #define canIOCTL_SET_TIMER_SCALE 6
02295
02311 #define canIOCTL_SET_TXACK 7
02312
02325 #define canIOCTL_GET_RX_BUFFER_LEVEL 8
02326
02339 #define canIOCTL_GET_TX_BUFFER_LEVEL 9
02340
02350 #define canIOCTL_FLUSH_RX_BUFFER 10
02351
02361 #define canIOCTL_FLUSH_TX_BUFFER 11
02362
02371 #define canIOCTL_GET_TIMER_SCALE 12
02372
02384 #define canIOCTL_SET_TXRQ 13
02385
02413 #define canIOCTL_GET_EVENTHANDLE 14
02414
02421 #define canIOCTL_SET_BYPASS_MODE 15
02422
02428 #define canIOCTL_SET_WAKEUP 16
02429
02430 #if defined(CANLIB_DECLARE_ALL)
02431
02439 # define canIOCTL_GET_DRIVERHANDLE 17
02440
02446 # define canIOCTL_MAP_RXQUEUE 18
02447
02453 # define canIOCTL_GET_WAKEUP 19
02454
02466 # define canIOCTL_SET_REPORT_ACCESS_ERRORS 20
02467
02475 # define canIOCTL_GET_REPORT_ACCESS_ERRORS 21
02476
02484 # define canIOCTL_CONNECT_TO_VIRTUAL_BUS 22
02485
02493 # define canIOCTL_DISCONNECT_FROM_VIRTUAL_BUS 23
02494
02502 # define canIOCTL_SET_USER_IOPORT 24
02503
02512 # define canIOCTL_GET_USER_IOPORT 25
02513
02519 # define canIOCTL_SET_BUFFER_WRAPAROUND_MODE 26
02520
02535 # define canIOCTL_SET_RX_QUEUE_SIZE 27
02536
02542 # define canIOCTL_SET_USB_THROTTLE 28
02543
02549 # define canIOCTL_GET_USB_THROTTLE 29
02550
02561 # define canIOCTL_SET_BUSON_TIME_AUTO_RESET 30
02562
02574 # define canIOCTL_GET_TXACK 31
02575
02590 # define canIOCTL_SET_LOCAL_TXECHO 32
02591
02602 # define canIOCTL_SET_ERROR_FRAMES_REPORTING 33
02603
02615 # define canIOCTL_GET_CHANNEL_QUALITY 34
02616
02624 # define canIOCTL_GET_ROUNDTRIP_TIME 35
02625
02632 # define canIOCTL_GET_BUS_TYPE 36
02633
02644 # define canIOCTL_GET_DEVNAME_ASCII 37
02645
02655 # define canIOCTL_GET_TIME_SINCE_LAST_SEEN 38
02656
02657
02671 # define canIOCTL_GET_TREF_LIST 39
02672
02694 # define canIOCTL_TX_INTERVAL 40
02695
02706 # define canIOCTL_SET_BRLIMIT 43
02707
02711 # define canIOCTL_SET_USB_THROTTLE_SCALED 41
02712
02725 # define canIOCTL_SET_THROTTLE_SCALED 41
02726
02730 # define canIOCTL_GET_USB_THROTTLE_SCALED 42
02731
02744 # define canIOCTL_GET_THROTTLE_SCALED 42
02745
02752 # define canIOCTL_RESET_OVERRUN_COUNT 44
02753 #endif
02754
02756 #if defined(CANLIB_DECLARE_ALL)
02757
02758 typedef struct {
02759 unsigned int portNo;
02760 unsigned int portValue;
02761 } canUserIoPortData;
02762
02763 #endif
02764
02765 #if defined(CANLIB_DECLARE_ALL)
02766
02794 canStatus CANLIBAPI canWaitForEvent (const CanHandle hnd, DWORD timeout);
02795 #endif
02796
02837 canStatus CANLIBAPI canSetBusParamsC200 (const CanHandle hnd, unsigned char btr0, unsigned char btr1);
02838
02839 #if defined(CANLIB_DECLARE_ALL)
02840
02880 canStatus CANLIBAPI canSetDriverMode (const CanHandle hnd, int lineMode, int resNet);
02881
02922 canStatus CANLIBAPI canGetDriverMode (const CanHandle hnd, int *lineMode, int *resNet);
02923 #endif
02924
02942 #define canVERSION_CANLIB32_VERSION 0
02943
02954 #define canVERSION_CANLIB32_PRODVER 1
02955
02967 #define canVERSION_CANLIB32_PRODVER32 2
02968
02976 #define canVERSION_CANLIB32_BETA 3
02977
02979 #if defined(CANLIB_DECLARE_ALL)
02980
02998 unsigned int CANLIBAPI canGetVersionEx (unsigned int itemCode);
02999
03017 canStatus CANLIBAPI canParamGetCount (void);
03018
03042 canStatus CANLIBAPI canParamCommitChanges (void);
03043
03068 canStatus CANLIBAPI canParamDeleteEntry (int index);
03069
03092 canStatus CANLIBAPI canParamCreateNewEntry (void);
03093
03121 canStatus CANLIBAPI canParamSwapEntries (int index1, int index2);
03122
03151 canStatus CANLIBAPI canParamGetName (int index, char *buffer, int maxlen);
03152
03173 canStatus CANLIBAPI canParamGetChannelNumber (int index);
03174
03203 canStatus CANLIBAPI canParamGetBusParams (int index,
03204 long* bitrate,
03205 unsigned int *tseg1,
03206 unsigned int *tseg2,
03207 unsigned int *sjw,
03208 unsigned int *noSamp);
03209
03232 canStatus CANLIBAPI canParamSetName (int index, const char *buffer);
03233
03255 canStatus CANLIBAPI canParamSetChannelNumber (int index, int channel);
03256
03289 canStatus CANLIBAPI canParamSetBusParams (int index,
03290 long bitrate,
03291 unsigned int tseg1,
03292 unsigned int tseg2,
03293 unsigned int sjw,
03294 unsigned int noSamp);
03295
03315 canStatus CANLIBAPI canParamFindByName (const char *name);
03335 canStatus CANLIBAPI canObjBufFreeAll (const CanHandle hnd);
03336
03357 canStatus CANLIBAPI canObjBufAllocate (const CanHandle hnd, int type);
03358
03367 #define canOBJBUF_TYPE_AUTO_RESPONSE 0x01 ///< The buffer is an auto-response buffer.
03368 #define canOBJBUF_TYPE_PERIODIC_TX 0x02 ///< The buffer is an auto-transmit buffer.
03369
03391 canStatus CANLIBAPI canObjBufFree (const CanHandle hnd, int idx);
03392
03393
03394
03420 canStatus CANLIBAPI canObjBufWrite (const CanHandle hnd,
03421 int idx,
03422 int id,
03423 void* msg,
03424 unsigned int dlc,
03425 unsigned int flags);
03426
03453 canStatus CANLIBAPI canObjBufSetFilter (const CanHandle hnd,
03454 int idx,
03455 unsigned int code,
03456 unsigned int mask);
03457
03478 canStatus CANLIBAPI canObjBufSetFlags (const CanHandle hnd,
03479 int idx,
03480 unsigned int flags);
03481
03499 # define canOBJBUF_AUTO_RESPONSE_RTR_ONLY 0x01
03500
03522 canStatus CANLIBAPI canObjBufSetPeriod (const CanHandle hnd,
03523 int idx,
03524 unsigned int period);
03525
03546 canStatus CANLIBAPI canObjBufSetMsgCount (const CanHandle hnd,
03547 int idx,
03548 unsigned int count);
03549
03569 canStatus CANLIBAPI canObjBufEnable (const CanHandle hnd, int idx);
03570
03590 canStatus CANLIBAPI canObjBufDisable (const CanHandle hnd, int idx);
03591
03615 canStatus CANLIBAPI canObjBufSendBurst (const CanHandle hnd,
03616 int idx,
03617 unsigned int burstlen);
03618
03635 #define canVERSION_DONT_ACCEPT_LATER 0x01
03636
03643 #define canVERSION_DONT_ACCEPT_BETAS 0x02
03644
03683 BOOL CANLIBAPI canProbeVersion (const CanHandle hnd,
03684 int major,
03685 int minor,
03686 int oem_id,
03687 unsigned int flags);
03688 #endif
03689
03712 canStatus CANLIBAPI canResetBus (const CanHandle hnd);
03713
03750 canStatus CANLIBAPI canWriteWait (const CanHandle hnd,
03751 long id,
03752 void *msg,
03753 unsigned int dlc,
03754 unsigned int flag,
03755 unsigned long timeout);
03756
03757
03758 #if defined(CANLIB_DECLARE_ALL)
03759
03784 canStatus CANLIBAPI canUnloadLibrary (void);
03785
03843 canStatus CANLIBAPI canSetAcceptanceFilter (const CanHandle hnd,
03844 unsigned int code,
03845 unsigned int mask,
03846 int is_extended);
03847
03871 canStatus CANLIBAPI canFlushReceiveQueue (const CanHandle hnd);
03872
03897 canStatus CANLIBAPI canFlushTransmitQueue (const CanHandle hnd);
03898
03918 canStatus CANLIBAPI kvGetApplicationMapping (int busType,
03919 char *appName,
03920 int appChannel,
03921 int *resultingChannel);
03922
03944 canStatus CANLIBAPI kvBeep (const CanHandle hnd,
03945 int freq,
03946 unsigned int duration);
03947
03967 canStatus CANLIBAPI kvSelfTest (const CanHandle hnd, unsigned long *presults);
03968
03977 #define kvLED_ACTION_ALL_LEDS_ON 0 ///< Turn all LEDs on.
03978 #define kvLED_ACTION_ALL_LEDS_OFF 1 ///< Turn all LEDs off.
03979 #define kvLED_ACTION_LED_0_ON 2 ///< Turn LED 0 on.
03980 #define kvLED_ACTION_LED_0_OFF 3 ///< Turn LED 0 off.
03981 #define kvLED_ACTION_LED_1_ON 4 ///< Turn LED 1 on.
03982 #define kvLED_ACTION_LED_1_OFF 5 ///< Turn LED 1 off.
03983 #define kvLED_ACTION_LED_2_ON 6 ///< Turn LED 2 on.
03984 #define kvLED_ACTION_LED_2_OFF 7 ///< Turn LED 2 off.
03985 #define kvLED_ACTION_LED_3_ON 8 ///< Turn LED 3 on.
03986 #define kvLED_ACTION_LED_3_OFF 9 ///< Turn LED 3 off.
03987 #define kvLED_ACTION_LED_4_ON 10 ///< Turn LED 4 on.
03988 #define kvLED_ACTION_LED_4_OFF 11 ///< Turn LED 4 off.
03989 #define kvLED_ACTION_LED_5_ON 12 ///< Turn LED 5 on.
03990 #define kvLED_ACTION_LED_5_OFF 13 ///< Turn LED 5 off.
03991 #define kvLED_ACTION_LED_6_ON 14 ///< Turn LED 6 on.
03992 #define kvLED_ACTION_LED_6_OFF 15 ///< Turn LED 6 off.
03993 #define kvLED_ACTION_LED_7_ON 16 ///< Turn LED 7 on.
03994 #define kvLED_ACTION_LED_7_OFF 17 ///< Turn LED 7 off.
03995 #define kvLED_ACTION_LED_8_ON 18 ///< Turn LED 8 on.
03996 #define kvLED_ACTION_LED_8_OFF 19 ///< Turn LED 8 off.
03997 #define kvLED_ACTION_LED_9_ON 20 ///< Turn LED 9 on.
03998 #define kvLED_ACTION_LED_9_OFF 21 ///< Turn LED 9 off.
03999 #define kvLED_ACTION_LED_10_ON 22 ///< Turn LED 10 on.
04000 #define kvLED_ACTION_LED_10_OFF 23 ///< Turn LED 10 off.
04001 #define kvLED_ACTION_LED_11_ON 24 ///< Turn LED 11 on.
04002 #define kvLED_ACTION_LED_11_OFF 25 ///< Turn LED 11 off.
04003
04027 canStatus CANLIBAPI kvFlashLeds (const CanHandle hnd, int action, int timeout);
04028
04068 canStatus CANLIBAPI canRequestChipStatus (const CanHandle hnd);
04069
04096 canStatus CANLIBAPI canRequestBusStatistics (const CanHandle hnd);
04097
04104 typedef struct canBusStatistics_s {
04105 unsigned long stdData;
04106 unsigned long stdRemote;
04107 unsigned long extData;
04108 unsigned long extRemote;
04109 unsigned long errFrame;
04110
04115 unsigned long busLoad;
04116 unsigned long overruns;
04117 } canBusStatistics;
04118
04141 canStatus CANLIBAPI canGetBusStatistics (const CanHandle hnd,
04142 canBusStatistics *stat,
04143 size_t bufsiz);
04144
04165 canStatus CANLIBAPI canSetBitrate (const CanHandle hnd, int bitrate);
04166
04184 canStatus CANLIBAPI kvAnnounceIdentity (const CanHandle hnd,
04185 void *buf,
04186 size_t bufsiz);
04200 canStatus CANLIBAPI kvAnnounceIdentityEx (const CanHandle hnd,
04201 int type,
04202 void *buf,
04203 size_t bufsiz);
04204
04225 canStatus CANLIBAPI canGetHandleData (const CanHandle hnd,
04226 int item,
04227 void *buffer,
04228 size_t bufsize);
04229
04231 typedef void *kvTimeDomain;
04232
04234 typedef canStatus kvStatus;
04235
04241 typedef struct kvTimeDomainData_s {
04242 int nMagiSyncGroups;
04243 int nMagiSyncedMembers;
04244 int nNonMagiSyncCards;
04245 int nNonMagiSyncedMembers;
04246 } kvTimeDomainData;
04247
04276 kvStatus CANLIBAPI kvTimeDomainCreate (kvTimeDomain *domain);
04277
04300 kvStatus CANLIBAPI kvTimeDomainDelete (kvTimeDomain domain);
04301
04327 kvStatus CANLIBAPI kvTimeDomainResetTime (kvTimeDomain domain);
04328
04353 kvStatus CANLIBAPI kvTimeDomainGetData (kvTimeDomain domain,
04354 kvTimeDomainData *data,
04355 size_t bufsiz);
04356
04379 kvStatus CANLIBAPI kvTimeDomainAddHandle(kvTimeDomain domain,
04380 const CanHandle hnd);
04381
04403 kvStatus CANLIBAPI kvTimeDomainRemoveHandle (kvTimeDomain domain,
04404 const CanHandle hnd);
04405
04425 typedef void (CANLIBAPI *kvCallback_t) (CanHandle hnd, void* context, unsigned int notifyEvent);
04426
04460 kvStatus CANLIBAPI kvSetNotifyCallback (const CanHandle hnd,
04461 kvCallback_t callback,
04462 void* context,
04463 unsigned int notifyFlags);
04464
04472 #define kvBUSTYPE_NONE 0 ///< Unkown bus type.
04473 #define kvBUSTYPE_PCI 1 ///< Bus of type PCI.
04474 #define kvBUSTYPE_PCMCIA 2 ///< Bus of type PCMCIA
04475 #define kvBUSTYPE_USB 3 ///< Bus of type USB
04476 #define kvBUSTYPE_WLAN 4 ///< Bus of type WLAN
04477 #define kvBUSTYPE_PCI_EXPRESS 5 ///< Bus of type PCI Express
04478 #define kvBUSTYPE_ISA 6 ///< Bus of type ISA
04479 #define kvBUSTYPE_VIRTUAL 7 ///< Bus of type virtual
04480 #define kvBUSTYPE_PC104_PLUS 8 ///< Bus of type PC104+
04481 #define kvBUSTYPE_LAN 9 ///< Bus of type LAN
04482
04492 #define kvBUSTYPE_GROUP_VIRTUAL 1 ///< \ref kvBUSTYPE_VIRTUAL
04493 #define kvBUSTYPE_GROUP_LOCAL 2 ///< \ref kvBUSTYPE_USB
04494 #define kvBUSTYPE_GROUP_REMOTE 3 ///< \ref kvBUSTYPE_WLAN, \ref kvBUSTYPE_LAN
04495 #define kvBUSTYPE_GROUP_INTERNAL 4 ///< \ref kvBUSTYPE_PCI, \ref kvBUSTYPE_PCMCIA, ...
04496
04548 kvStatus CANLIBAPI kvGetSupportedInterfaceInfo (int index,
04549 char *hwName,
04550 size_t nameLen,
04551 int *hwType,
04552 int *hwBusType);
04553
04576 kvStatus CANLIBAPI kvReadDeviceCustomerData (const CanHandle hnd,
04577 int userNumber,
04578 int itemNumber,
04579 void *data,
04580 size_t bufsiz);
04581
04582
04583
04584
04585
04586
04600 #define kvENVVAR_TYPE_INT 1
04601
04607 #define kvENVVAR_TYPE_FLOAT 2
04608
04614 #define kvENVVAR_TYPE_STRING 3
04615
04630 #define kvEVENT_TYPE_KEY 1
04631
04638 typedef __int64 kvEnvHandle;
04639
04659 kvStatus CANLIBAPI kvScriptStart (const CanHandle hnd, int slotNo);
04660
04667 #define kvSCRIPT_STOP_NORMAL 0
04668 #define kvSCRIPT_STOP_FORCED -9
04692 kvStatus CANLIBAPI kvScriptStop (const CanHandle hnd, int slotNo, int mode);
04693
04713 kvStatus CANLIBAPI kvScriptUnload (const CanHandle hnd, int slotNo);
04714
04737 kvStatus CANLIBAPI kvScriptSendEvent (const CanHandle hnd,
04738 int slotNo,
04739 int eventType,
04740 int eventNo,
04741 unsigned int data);
04742
04767 kvEnvHandle CANLIBAPI kvScriptEnvvarOpen (const CanHandle hnd,
04768 char* envvarName,
04769 int *envvarType,
04770 int *envvarSize);
04771
04789 kvStatus CANLIBAPI kvScriptEnvvarClose (kvEnvHandle eHnd);
04790
04811 kvStatus CANLIBAPI kvScriptEnvvarSetInt (kvEnvHandle eHnd, int val);
04812
04834 kvStatus CANLIBAPI kvScriptEnvvarGetInt (kvEnvHandle eHnd, int *val);
04835
04856 kvStatus CANLIBAPI kvScriptEnvvarSetFloat (kvEnvHandle eHnd, float val);
04857
04879 kvStatus CANLIBAPI kvScriptEnvvarGetFloat (kvEnvHandle eHnd, float *val);
04880
04905 kvStatus CANLIBAPI kvScriptEnvvarSetData (kvEnvHandle eHnd,
04906 void *buf,
04907 int start_index,
04908 int data_len);
04909
04933 kvStatus CANLIBAPI kvScriptEnvvarGetData (kvEnvHandle eHnd,
04934 void *buf,
04935 int start_index,
04936 int data_len);
04937
04961 kvStatus CANLIBAPI kvScriptLoadFileOnDevice (const CanHandle hnd,
04962 int slotNo,
04963 char *localFile);
04964
04988 kvStatus CANLIBAPI kvScriptLoadFile (const CanHandle hnd,
04989 int slotNo,
04990 char *filePathOnPC);
04991
04992
04993
04994
05008 #define kvSCRIPT_REQUEST_TEXT_UNSUBSCRIBE 1
05009
05013 #define kvSCRIPT_REQUEST_TEXT_SUBSCRIBE 2
05014
05018 #define kvSCRIPT_REQUEST_TEXT_ALL_SLOTS 255
05019
05043 kvStatus CANLIBAPI kvScriptRequestText(const CanHandle hnd,
05044 unsigned int slot,
05045 unsigned int request);
05046
05047
05048
05071 kvStatus CANLIBAPI kvScriptGetText(const CanHandle hnd,
05072 int *slot,
05073 unsigned long *time,
05074 unsigned int *flags,
05075 char *buf,
05076 size_t bufsize
05077 );
05078
05079
05080
05087 #define kvSCRIPT_STATUS_LOADED 1
05088 #define kvSCRIPT_STATUS_RUNNING 2
05108 kvStatus CANLIBAPI kvScriptStatus(const CanHandle hnd,
05109 int slot,
05110 unsigned int *status);
05111
05112
05113
05114
05137 kvStatus CANLIBAPI kvFileCopyToDevice (const CanHandle hnd,
05138 char *hostFileName,
05139 char *deviceFileName);
05140
05163 kvStatus CANLIBAPI kvFileCopyFromDevice (const CanHandle hnd,
05164 char *deviceFileName,
05165 char *hostFileName);
05166
05188 kvStatus CANLIBAPI kvFileDelete (const CanHandle hnd, char *deviceFileName);
05189
05212 kvStatus CANLIBAPI kvFileGetName (const CanHandle hnd,
05213 int fileNo,
05214 char *name,
05215 int namelen);
05216
05236 kvStatus CANLIBAPI kvFileGetCount (const CanHandle hnd, int *count);
05237
05260 kvStatus CANLIBAPI kvFileGetSystemData (const CanHandle hnd,
05261 int itemCode,
05262 int *result);
05263
05281 #define kvDEVICE_MODE_INTERFACE 0x00
05282
05287 #define kvDEVICE_MODE_LOGGER 0x01
05288
05313 kvStatus CANLIBAPI kvDeviceSetMode (const CanHandle hnd, int mode);
05314
05337 kvStatus CANLIBAPI kvDeviceGetMode (const CanHandle hnd, int *result);
05338
05339
05357 kvStatus CANLIBAPI kvPingRequest (const CanHandle hnd,
05358 unsigned int *requestTime);
05359
05377 kvStatus CANLIBAPI kvPingGetLatest (const CanHandle hnd,
05378 unsigned int *requestTime,
05379 unsigned int *pingTime);
05380
05381
05391
05392
05393
05394 #if defined(_CANEVT_H_)
05395 canStatus CANLIBAPI canReadEvent (const CanHandle hnd, CanEvent *event);
05396 #endif
05397
05399 void CANLIBAPI canSetDebug(int d);
05401 canStatus CANLIBAPI canSetNotifyEx (const CanHandle hnd,
05402 HANDLE event,
05403 unsigned int flags);
05405 canStatus CANLIBAPI canSetTimer (const CanHandle hnd,
05406 DWORD interval,
05407 DWORD flags);
05409 #define canTIMER_CYCLIC 0x01
05410
05411 #define canTIMER_EXPENSIVE 0x02
05412
05413 int CANLIBAPI canSplitHandle (CanHandle hnd, int channel);
05415 int CANLIBAPI canOpenMultiple (DWORD bitmask, int flags);
05444 kvStatus CANLIBAPI kvReadTimer (const CanHandle hnd, unsigned int *time);
05445
05474 kvStatus CANLIBAPI kvReadTimer64 (const CanHandle hnd, KVINT64 *time);
05476 #endif
05477
05478 #ifdef __cplusplus
05479 }
05480 #endif
05481
05482 # include "obsolete.h"
05483
05484 #ifdef KVASER_EYES_ONLY
05485 canStatus CANLIBAPI lowLevelAccess (const CanHandle hnd, void * data, int size);
05486 #endif
05487
05488 #endif