Kvaser CANLIB: canlib.h Source File

canlib.h

Go to the documentation of this file.
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;
00043 # define CanHandle int
00044 
00045 # define canINVALID_HANDLE      (-1)
00046 
00048 # define WM__CANLIB              (WM_USER+16354)
00049 
00065 #define canOPEN_EXCLUSIVE               0x0008
00066 
00078 #define canOPEN_REQUIRE_EXTENDED        0x0010
00079 
00087 # define canOPEN_ACCEPT_VIRTUAL         0x0020
00088 
00097 # define canOPEN_OVERRIDE_EXCLUSIVE     0x0040
00098 
00114 # define canOPEN_REQUIRE_INIT_ACCESS    0x0080
00115 
00123 # define canOPEN_NO_INIT_ACCESS         0x0100
00124 
00136 # define canOPEN_ACCEPT_LARGE_DLC       0x0200  // DLC can be greater than 8
00137 
00144 # define canOPEN_CAN_FD                 0x0400
00145 
00159 # define canOPEN_CAN_FD_NONISO          0x0800
00160 
00171 #define canFILTER_ACCEPT        1
00172 #define canFILTER_REJECT        2
00173 
00174 #define canFILTER_SET_CODE_STD  3
00175 
00176 #define canFILTER_SET_MASK_STD  4
00177 
00178 #define canFILTER_SET_CODE_EXT  5
00179 
00180 #define canFILTER_SET_MASK_EXT  6
00181 
00182 #define canFILTER_NULL_MASK     0L
00183 
00199 #define canDRIVER_NORMAL           4
00200 
00207 #define canDRIVER_SILENT           1
00208 
00212 #define canDRIVER_SELFRECEPTION    8
00213 
00217 #define canDRIVER_OFF              0
00218 
00241 #define canBITRATE_1M        (-1)
00242 
00243 #define canBITRATE_500K      (-2)
00244 
00245 #define canBITRATE_250K      (-3)
00246 
00247 #define canBITRATE_125K      (-4)
00248 
00249 #define canBITRATE_100K      (-5)
00250 
00251 #define canBITRATE_62K       (-6)
00252 
00253 #define canBITRATE_50K       (-7)
00254 
00255 #define canBITRATE_83K       (-8)
00256 
00257 #define canBITRATE_10K       (-9)
00258 
00259 // CAN FD Bit Rates
00263 #define canFD_BITRATE_500K_80P     (-1000)
00264 
00267 #define canFD_BITRATE_1M_80P       (-1001)
00268 
00271 #define canFD_BITRATE_2M_80P       (-1002)
00272 
00275 #define canFD_BITRATE_4M_80P       (-1003)
00276 
00279 #define canFD_BITRATE_8M_60P       (-1004)
00280 
00282 #define BAUD_1M              (-1)
00283 
00284 #define BAUD_500K            (-2)
00285 
00286 #define BAUD_250K            (-3)
00287 
00288 #define BAUD_125K            (-4)
00289 
00290 #define BAUD_100K            (-5)
00291 
00292 #define BAUD_62K             (-6)
00293 
00294 #define BAUD_50K             (-7)
00295 
00296 #define BAUD_83K             (-8)
00297 
00300 //
00301 // Define CANLIBAPI unless it's done already.
00302 // (canlib.c provides its own definitions of CANLIBAPI, DLLIMPORT
00303 // and DLLEXPORT before including this file.)
00304 //
00305 #ifndef CANLIBAPI
00306 #   define CANLIBAPI __stdcall
00307 #   define DLLIMPORT __declspec(dllimport)
00308 #   define DLLEXPORT __declspec(dllexport)
00309 #endif
00310 
00311 
00312 #ifdef __cplusplus
00313 extern "C" {
00314 #endif
00315 
00337 void CANLIBAPI canInitializeLibrary (void);
00338 
00363 canStatus CANLIBAPI canClose (const CanHandle hnd);
00364 
00389 canStatus CANLIBAPI canBusOn (const CanHandle hnd);
00390 
00410 canStatus CANLIBAPI canBusOff (const CanHandle hnd);
00411 
00458 canStatus CANLIBAPI canSetBusParams (const CanHandle hnd,
00459                                      long freq,
00460                                      unsigned int tseg1,
00461                                      unsigned int tseg2,
00462                                      unsigned int sjw,
00463                                      unsigned int noSamp,
00464                                      unsigned int syncmode);
00465 
00497 canStatus CANLIBAPI canSetBusParamsFd(const CanHandle hnd,
00498                                       long freq_brs,
00499                                       unsigned int tseg1_brs,
00500                                       unsigned int tseg2_brs,
00501                                       unsigned int sjw_brs);
00502 
00503 
00535 canStatus CANLIBAPI canGetBusParams (const CanHandle hnd,
00536                                      long  *freq,
00537                                      unsigned int *tseg1,
00538                                      unsigned int *tseg2,
00539                                      unsigned int *sjw,
00540                                      unsigned int *noSamp,
00541                                      unsigned int *syncmode);
00542 
00543 
00566 canStatus CANLIBAPI canGetBusParamsFd(const CanHandle hnd,
00567                                       long  *freq_brs,
00568                                       unsigned int *tseg1_brs,
00569                                       unsigned int *tseg2_brs,
00570                                       unsigned int *sjw_brs);
00595 canStatus CANLIBAPI canSetBusOutputControl (const CanHandle hnd,
00596                                             const unsigned int drivertype);
00597 
00632 canStatus CANLIBAPI canGetBusOutputControl (const CanHandle hnd,
00633                                             unsigned int *drivertype);
00634 
00677 canStatus CANLIBAPI canAccept (const CanHandle hnd,
00678                                const long envelope,
00679                                const unsigned int flag);
00680 
00704 canStatus CANLIBAPI canReadStatus (const CanHandle hnd,
00705                                    unsigned long *const flags);
00706 
00743 canStatus CANLIBAPI canReadErrorCounters (const CanHandle hnd,
00744                                           unsigned int *txErr,
00745                                           unsigned int *rxErr,
00746                                           unsigned int *ovErr);
00747 
00789 canStatus CANLIBAPI canWrite (const CanHandle hnd,
00790                               long id,
00791                               void *msg,
00792                               unsigned int dlc,
00793                               unsigned int flag);
00794 
00822 canStatus CANLIBAPI canWriteSync (const CanHandle hnd, unsigned long timeout);
00823 
00876 canStatus CANLIBAPI canRead (const CanHandle hnd,
00877                              long *id,
00878                              void *msg,
00879                              unsigned int *dlc,
00880                              unsigned int *flag,
00881                              unsigned long *time);
00882 
00931 canStatus CANLIBAPI canReadWait (const CanHandle hnd,
00932                                  long *id,
00933                                  void *msg,
00934                                  unsigned int  *dlc,
00935                                  unsigned int  *flag,
00936                                  unsigned long *time,
00937                                  unsigned long timeout);
00938 
00939 #if defined(CANLIB_DECLARE_ALL)
00940 
00989 canStatus CANLIBAPI canReadSpecific (const CanHandle hnd, long id, void * msg,
00990                                      unsigned int * dlc, unsigned int * flag,
00991                                      unsigned long * time);
00992 
01023 canStatus CANLIBAPI canReadSync (const CanHandle hnd, unsigned long timeout);
01024 
01056 canStatus CANLIBAPI canReadSyncSpecific (const CanHandle hnd,
01057                                          long id,
01058                                          unsigned long timeout);
01059 
01103 canStatus CANLIBAPI canReadSpecificSkip (const CanHandle hnd,
01104                                          long id,
01105                                          void * msg,
01106                                          unsigned int * dlc,
01107                                          unsigned int * flag,
01108                                          unsigned long * time);
01109 #endif
01110 
01111 
01150 canStatus CANLIBAPI canSetNotify (const CanHandle hnd,
01151                                   HWND aHWnd,
01152                                   unsigned int aNotifyFlags);
01153 
01154 
01189 canStatus CANLIBAPI canTranslateBaud (long *const freq,
01190                                       unsigned int *const tseg1,
01191                                       unsigned int *const tseg2,
01192                                       unsigned int *const sjw,
01193                                       unsigned int *const nosamp,
01194                                       unsigned int *const syncMode);
01195 
01218 canStatus CANLIBAPI canGetErrorText (canStatus err, char *buf, unsigned int bufsiz);
01219 
01259 unsigned short CANLIBAPI canGetVersion (void);
01260 
01290 canStatus CANLIBAPI canIoCtl (const CanHandle hnd,
01291                               unsigned int func,
01292                               void *buf,
01293                               unsigned int buflen);
01294 
01295 /* Note the difference from the windows version */
01296 
01329 unsigned long CANLIBAPI canReadTimer (const CanHandle hnd);
01330 
01381 CanHandle CANLIBAPI canOpenChannel (int channel, int flags);
01382 
01403 canStatus CANLIBAPI canGetNumberOfChannels (int *channelCount);
01404 
01434 canStatus CANLIBAPI canGetChannelData (int channel,
01435                                        int item,
01436                                        void *buffer,
01437                                        size_t bufsize);
01438 
01457 #define canCHANNELDATA_CHANNEL_CAP                1
01458 
01472 #define canCHANNELDATA_TRANS_CAP                  2
01473 
01480 #define canCHANNELDATA_CHANNEL_FLAGS              3   // available, etc
01481 
01490 #define canCHANNELDATA_CARD_TYPE                  4
01491 
01506 #define canCHANNELDATA_CARD_NUMBER                5
01507 
01515 #define canCHANNELDATA_CHAN_NO_ON_CARD            6
01516 
01526 #define canCHANNELDATA_CARD_SERIAL_NO             7
01527 
01541 #define canCHANNELDATA_TRANS_SERIAL_NO            8
01542 
01553 #define canCHANNELDATA_CARD_FIRMWARE_REV          9
01554 
01565 #define canCHANNELDATA_CARD_HARDWARE_REV          10
01566 
01576 #define canCHANNELDATA_CARD_UPC_NO                11
01577 
01592 #define canCHANNELDATA_TRANS_UPC_NO               12
01593 
01611 #define canCHANNELDATA_CHANNEL_NAME               13
01612 #if defined(CANLIB_DECLARE_ALL)
01613 
01634 # define canCHANNELDATA_DLL_FILE_VERSION          14
01635 
01656 # define canCHANNELDATA_DLL_PRODUCT_VERSION       15
01657 
01677 # define canCHANNELDATA_DLL_FILETYPE              16
01678 
01692 # define canCHANNELDATA_TRANS_TYPE                17
01693 
01721 # define canCHANNELDATA_DEVICE_PHYSICAL_POSITION  18
01722 
01739 # define canCHANNELDATA_UI_NUMBER                 19
01740 
01768 # define canCHANNELDATA_TIMESYNC_ENABLED          20
01769 
01789 # define canCHANNELDATA_DRIVER_FILE_VERSION       21
01790 
01810 # define canCHANNELDATA_DRIVER_PRODUCT_VERSION    22
01811 
01824 # define canCHANNELDATA_MFGNAME_UNICODE           23
01825 
01833 # define canCHANNELDATA_MFGNAME_ASCII             24
01834 
01847 # define canCHANNELDATA_DEVDESCR_UNICODE          25
01848 
01856 # define canCHANNELDATA_DEVDESCR_ASCII            26
01857 
01873 # define canCHANNELDATA_DRIVER_NAME               27
01874 
01891 #  define canCHANNELDATA_CHANNEL_QUALITY           28
01892 
01905 #  define canCHANNELDATA_ROUNDTRIP_TIME            29
01906 
01919 #  define canCHANNELDATA_BUS_TYPE                  30
01920 
01936 #  define canCHANNELDATA_DEVNAME_ASCII             31
01937 
01952 #  define canCHANNELDATA_TIME_SINCE_LAST_SEEN      32
01953 
01967 #  define canCHANNELDATA_REMOTE_OPERATIONAL_MODE   33
01968 
01981 #  define canCHANNELDATA_REMOTE_PROFILE_NAME   34
01982 
01995 #  define canCHANNELDATA_REMOTE_HOST_NAME   35
01996 
02009 #  define canCHANNELDATA_REMOTE_MAC   36
02010 
02019 #  define canCHANNELDATA_MAX_BITRATE   37
02020 
02031 #define canCHANNELDATA_CHANNEL_CAP_MASK  38
02032 
02033 
02034 
02035 #endif
02036 
02045 #define canCHANNELDATA_CUST_CHANNEL_NAME  39
02046 
02060 #define canCHANNEL_IS_EXCLUSIVE         0x0001
02061 
02063 #define canCHANNEL_IS_OPEN              0x0002
02064 
02068 #define canCHANNEL_IS_CANFD             0x0004
02069 
02070 //#define canCHANNEL_IS_CANFD_NON_ISO          0x0008 Reserved for when needed
02071 
02090 #define canHWTYPE_NONE                0  ///< Unknown or undefined
02091 #define canHWTYPE_VIRTUAL             1  ///< The virtual CAN bus
02092 #define canHWTYPE_LAPCAN              2  ///< LAPcan Family
02093 #define canHWTYPE_CANPARI             3  ///< CANpari (obsolete).
02094 #define canHWTYPE_PCCAN               8  ///< PCcan Family
02095 #define canHWTYPE_PCICAN              9  ///< PCIcan Family
02096 #define canHWTYPE_USBCAN             11  ///< USBcan (obsolete).
02097 #define canHWTYPE_PCICAN_II          40  ///< PCIcan II family
02098 #define canHWTYPE_USBCAN_II          42  ///< USBcan II, USBcan Rugged, Kvaser Memorator
02099 #define canHWTYPE_SIMULATED          44  ///< Simulated CAN bus for Kvaser Creator (obsolete).
02100 #define canHWTYPE_ACQUISITOR         46  ///< Kvaser Acquisitor (obsolete).
02101 #define canHWTYPE_LEAF               48  ///< Kvaser Leaf Family
02102 #define canHWTYPE_PC104_PLUS         50  ///< Kvaser PC104+
02103 #define canHWTYPE_PCICANX_II         52  ///< Kvaser PCIcanx II
02104 #define canHWTYPE_MEMORATOR_II       54  ///< Kvaser Memorator Professional family
02105 #define canHWTYPE_MEMORATOR_PRO      54  ///< Kvaser Memorator Professional family
02106 #define canHWTYPE_USBCAN_PRO         56  ///< Kvaser USBcan Professional
02107 #define canHWTYPE_IRIS               58  ///< Obsolete name, use canHWTYPE_BLACKBIRD instead
02108 #define canHWTYPE_BLACKBIRD          58  ///< Kvaser BlackBird
02109 #define canHWTYPE_MEMORATOR_LIGHT    60  ///< Kvaser Memorator Light
02110 #define canHWTYPE_MINIHYDRA          62  ///< Obsolete name, use canHWTYPE_EAGLE instead
02111 #define canHWTYPE_EAGLE              62  ///< Kvaser Eagle family
02112 #define canHWTYPE_BAGEL              64  ///< Obsolete name, use canHWTYPE_BLACKBIRD_V2 instead
02113 #define canHWTYPE_BLACKBIRD_V2       64  ///< Kvaser BlackBird v2
02114 #define canHWTYPE_MINIPCIE           66  ///< Kvaser Mini PCI Express
02115 #define canHWTYPE_USBCAN_KLINE       68  ///< USBcan Pro HS/K-Line
02116 #define canHWTYPE_ETHERCAN           70  ///< Kvaser Ethercan
02117 #define canHWTYPE_USBCAN_LIGHT       72  ///< Kvaser USBcan Light
02118 #define canHWTYPE_USBCAN_PRO2        74  ///< Kvaser USBcan Pro 5xHS and variants
02119 #define canHWTYPE_PCIE_V2            76  ///< Kvaser PCIEcan 4xHS and variants
02120 #define canHWTYPE_MEMORATOR_PRO2     78  ///< Kvaser Memorator Pro 5xHS and variants
02121 #define canHWTYPE_LEAF2              80  ///< Kvaser Leaf Pro HS v2 and variants
02122 #define canHWTYPE_MEMORATOR_V2       82  ///< Kvaser Memorator (2nd generation)
02123 
02124 
02133 #define canCHANNEL_CAP_EXTENDED_CAN      0x00000001L ///< Can use extended identifiers
02134 #define canCHANNEL_CAP_BUS_STATISTICS    0x00000002L ///< Can report busload etc
02135 #define canCHANNEL_CAP_ERROR_COUNTERS    0x00000004L ///< Can return error counters
02136 #define canCHANNEL_CAP_CAN_DIAGNOSTICS   0x00000008L ///< Can report CAN diagnostics
02137 #define canCHANNEL_CAP_GENERATE_ERROR    0x00000010L ///< Can send error frames
02138 #define canCHANNEL_CAP_GENERATE_OVERLOAD 0x00000020L ///< Can send CAN overload frame
02139 #define canCHANNEL_CAP_TXREQUEST         0x00000040L ///< Can report when a CAN messsage transmission is initiated
02140 #define canCHANNEL_CAP_TXACKNOWLEDGE     0x00000080L ///< Can report when a CAN messages has been transmitted
02141 #define canCHANNEL_CAP_VIRTUAL           0x00010000L ///< Virtual CAN channel
02142 #define canCHANNEL_CAP_SIMULATED         0x00020000L ///< Simulated CAN channel
02143 #define canCHANNEL_CAP_REMOTE            0x00040000L ///< Remote CAN channel (e.g. BlackBird).
02144 #define canCHANNEL_CAP_CAN_FD            0x00080000L ///< CAN-FD ISO compliant channel
02145 #define canCHANNEL_CAP_CAN_FD_NONISO     0x00100000L ///< CAN-FD NON-ISO compliant channel
02146 #define canCHANNEL_CAP_SILENT_MODE       0x00200000L ///< Channel supports Silent mode
02147 #define canCHANNEL_CAP_SINGLE_SHOT       0x00400000L ///< Channel supports Single Shot messages
02148 
02157 #define canCHANNEL_OPMODE_NONE                 1  ///< Not applicable, or unknown
02158 #define canCHANNEL_OPMODE_INFRASTRUCTURE       2  ///< Infrastructure mode
02159 #define canCHANNEL_OPMODE_RESERVED             3  ///< Reserved value, do not use
02160 #define canCHANNEL_OPMODE_ADHOC                4  ///< Adhoc mode
02161 
02171 #define canDRIVER_CAP_HIGHSPEED             0x00000001L
02172 
02195 #define canIOCTL_PREFER_EXT             1
02196 
02207 #define canIOCTL_PREFER_STD             2
02208 // 3,4 reserved.
02209 
02223 #define canIOCTL_CLEAR_ERROR_COUNTERS   5
02224 
02235 #define canIOCTL_SET_TIMER_SCALE        6
02236 
02252 #define canIOCTL_SET_TXACK              7
02253 
02266 #define canIOCTL_GET_RX_BUFFER_LEVEL              8
02267 
02280 #define canIOCTL_GET_TX_BUFFER_LEVEL              9
02281 
02291 #define canIOCTL_FLUSH_RX_BUFFER                  10
02292 
02302 #define canIOCTL_FLUSH_TX_BUFFER                  11
02303 
02312 #define canIOCTL_GET_TIMER_SCALE                  12
02313 
02325 #define canIOCTL_SET_TXRQ                         13
02326 
02354 #define canIOCTL_GET_EVENTHANDLE                  14
02355 
02362 #define canIOCTL_SET_BYPASS_MODE                  15
02363 
02369 #define canIOCTL_SET_WAKEUP                       16
02370 
02371 #if defined(CANLIB_DECLARE_ALL)
02372 
02380 # define canIOCTL_GET_DRIVERHANDLE                17
02381 
02387 # define canIOCTL_MAP_RXQUEUE                     18
02388 
02394 # define canIOCTL_GET_WAKEUP                      19
02395 
02407 # define canIOCTL_SET_REPORT_ACCESS_ERRORS        20
02408 
02416 # define canIOCTL_GET_REPORT_ACCESS_ERRORS        21
02417 
02425 # define canIOCTL_CONNECT_TO_VIRTUAL_BUS          22
02426 
02434 # define canIOCTL_DISCONNECT_FROM_VIRTUAL_BUS     23
02435 
02443 # define canIOCTL_SET_USER_IOPORT                 24
02444 
02453 # define canIOCTL_GET_USER_IOPORT                 25
02454 
02460 # define canIOCTL_SET_BUFFER_WRAPAROUND_MODE      26
02461 
02476 # define canIOCTL_SET_RX_QUEUE_SIZE               27
02477 
02483 # define canIOCTL_SET_USB_THROTTLE                28
02484 
02490 # define canIOCTL_GET_USB_THROTTLE                29
02491 
02502 # define canIOCTL_SET_BUSON_TIME_AUTO_RESET       30
02503 
02515 # define canIOCTL_GET_TXACK                       31
02516 
02531 # define canIOCTL_SET_LOCAL_TXECHO                32
02532 
02543 #  define canIOCTL_SET_ERROR_FRAMES_REPORTING      33
02544 
02556 # define canIOCTL_GET_CHANNEL_QUALITY             34
02557 
02565 #  define canIOCTL_GET_ROUNDTRIP_TIME              35
02566 
02573 #  define canIOCTL_GET_BUS_TYPE                    36
02574 
02585 #  define canIOCTL_GET_DEVNAME_ASCII               37
02586 
02596 #  define canIOCTL_GET_TIME_SINCE_LAST_SEEN        38
02597 
02598 
02612 #  define canIOCTL_GET_TREF_LIST                   39
02613 
02635 #  define canIOCTL_TX_INTERVAL                     40
02636 
02647 #  define canIOCTL_SET_BRLIMIT                            43
02648 
02652 #  define canIOCTL_SET_USB_THROTTLE_SCALED                41
02653 
02666 #  define canIOCTL_SET_THROTTLE_SCALED                    41
02667 
02671 #  define canIOCTL_GET_USB_THROTTLE_SCALED                42
02672 
02685 #  define canIOCTL_GET_THROTTLE_SCALED                    42
02686 
02693 #  define canIOCTL_RESET_OVERRUN_COUNT                          44
02694 #endif
02695 
02697 #if defined(CANLIB_DECLARE_ALL)
02698 
02699 typedef struct {
02700   unsigned int portNo;     
02701   unsigned int portValue;  
02702 } canUserIoPortData;
02703 
02704 #endif
02705 
02706 #if defined(CANLIB_DECLARE_ALL)
02707 
02735 canStatus CANLIBAPI canWaitForEvent (const CanHandle hnd, DWORD timeout);
02736 #endif
02737 
02778 canStatus CANLIBAPI canSetBusParamsC200 (const CanHandle hnd, unsigned char btr0, unsigned char btr1);
02779 
02780 #if defined(CANLIB_DECLARE_ALL)
02781 
02821 canStatus CANLIBAPI canSetDriverMode (const CanHandle hnd, int lineMode, int resNet);
02822 
02863 canStatus CANLIBAPI canGetDriverMode (const CanHandle hnd, int *lineMode, int *resNet);
02864 #endif
02865 
02883 #define canVERSION_CANLIB32_VERSION     0
02884 
02895 #define canVERSION_CANLIB32_PRODVER     1
02896 
02908 #define canVERSION_CANLIB32_PRODVER32   2
02909 
02917 #define canVERSION_CANLIB32_BETA        3
02918 
02920 #if defined(CANLIB_DECLARE_ALL)
02921 
02939 unsigned int CANLIBAPI canGetVersionEx (unsigned int itemCode);
02940 
02958 canStatus CANLIBAPI canParamGetCount (void);
02959 
02983 canStatus CANLIBAPI canParamCommitChanges (void);
02984 
03009 canStatus CANLIBAPI canParamDeleteEntry (int index);
03010 
03033 canStatus CANLIBAPI canParamCreateNewEntry (void);
03034 
03062 canStatus CANLIBAPI canParamSwapEntries (int index1, int index2);
03063 
03092 canStatus CANLIBAPI canParamGetName (int index, char *buffer, int maxlen);
03093 
03114 canStatus CANLIBAPI canParamGetChannelNumber (int index);
03115 
03144 canStatus CANLIBAPI canParamGetBusParams (int index,
03145                                           long* bitrate,
03146                                           unsigned int *tseg1,
03147                                           unsigned int *tseg2,
03148                                           unsigned int *sjw,
03149                                           unsigned int *noSamp);
03150 
03173 canStatus CANLIBAPI canParamSetName (int index, const char *buffer);
03174 
03196 canStatus CANLIBAPI canParamSetChannelNumber (int index, int channel);
03197 
03230 canStatus CANLIBAPI canParamSetBusParams (int index,
03231                                           long bitrate,
03232                                           unsigned int tseg1,
03233                                           unsigned int tseg2,
03234                                           unsigned int sjw,
03235                                           unsigned int noSamp);
03236 
03256 canStatus CANLIBAPI canParamFindByName (const char *name);
03276 canStatus CANLIBAPI canObjBufFreeAll (const CanHandle hnd);
03277 
03298 canStatus CANLIBAPI canObjBufAllocate (const CanHandle hnd, int type);
03299 
03308 #define canOBJBUF_TYPE_AUTO_RESPONSE            0x01 ///< The buffer is an auto-response buffer.
03309 #define canOBJBUF_TYPE_PERIODIC_TX              0x02 ///< The buffer is an auto-transmit buffer.
03310 
03332 canStatus CANLIBAPI canObjBufFree (const CanHandle hnd, int idx);
03333 
03334 // Writes CAN data to the object buffer with the specified index.
03335 
03361 canStatus CANLIBAPI canObjBufWrite (const CanHandle hnd,
03362                                     int idx,
03363                                     int id,
03364                                     void* msg,
03365                                     unsigned int dlc,
03366                                     unsigned int flags);
03367 
03394 canStatus CANLIBAPI canObjBufSetFilter (const CanHandle hnd,
03395                                         int idx,
03396                                         unsigned int code,
03397                                         unsigned int mask);
03398 
03419 canStatus CANLIBAPI canObjBufSetFlags (const CanHandle hnd,
03420                                        int idx,
03421                                        unsigned int flags);
03422 
03440 # define canOBJBUF_AUTO_RESPONSE_RTR_ONLY        0x01
03441 
03463 canStatus CANLIBAPI canObjBufSetPeriod (const CanHandle hnd,
03464                                         int idx,
03465                                         unsigned int period);
03466 
03487 canStatus CANLIBAPI canObjBufSetMsgCount (const CanHandle hnd,
03488                                           int idx,
03489                                           unsigned int count);
03490 
03510 canStatus CANLIBAPI canObjBufEnable (const CanHandle hnd, int idx);
03511 
03531 canStatus CANLIBAPI canObjBufDisable (const CanHandle hnd, int idx);
03532 
03556 canStatus CANLIBAPI canObjBufSendBurst (const CanHandle hnd,
03557                                         int idx,
03558                                         unsigned int burstlen);
03559 
03576 #define canVERSION_DONT_ACCEPT_LATER      0x01
03577 
03584 #define canVERSION_DONT_ACCEPT_BETAS      0x02
03585 
03624 BOOL CANLIBAPI canProbeVersion (const CanHandle hnd,
03625                                 int major,
03626                                 int minor,
03627                                 int oem_id,
03628                                 unsigned int flags);
03629 #endif
03630 
03653 canStatus CANLIBAPI canResetBus (const CanHandle hnd);
03654 
03691 canStatus CANLIBAPI canWriteWait (const CanHandle hnd,
03692                                   long id,
03693                                   void *msg,
03694                                   unsigned int dlc,
03695                                   unsigned int flag,
03696                                   unsigned long timeout);
03697 
03698 
03699 #if defined(CANLIB_DECLARE_ALL)
03700 
03720 canStatus CANLIBAPI canUnloadLibrary (void);
03721 
03779 canStatus CANLIBAPI canSetAcceptanceFilter (const CanHandle hnd,
03780                                             unsigned int code,
03781                                             unsigned int mask,
03782                                             int is_extended);
03783 
03807 canStatus CANLIBAPI canFlushReceiveQueue (const CanHandle hnd);
03808 
03833 canStatus CANLIBAPI canFlushTransmitQueue (const CanHandle hnd);
03834 
03854 canStatus CANLIBAPI kvGetApplicationMapping (int busType,
03855                                              char *appName,
03856                                              int appChannel,
03857                                              int *resultingChannel);
03858 
03880 canStatus CANLIBAPI kvBeep (const CanHandle hnd,
03881                             int freq,
03882                             unsigned int duration);
03883 
03903 canStatus CANLIBAPI kvSelfTest (const CanHandle hnd, unsigned long *presults);
03904 
03913 #define kvLED_ACTION_ALL_LEDS_ON    0 ///< Turn all LEDs on.
03914 #define kvLED_ACTION_ALL_LEDS_OFF   1 ///< Turn all LEDs off.
03915 #define kvLED_ACTION_LED_0_ON       2 ///< Turn LED 0 on.
03916 #define kvLED_ACTION_LED_0_OFF      3 ///< Turn LED 0 off.
03917 #define kvLED_ACTION_LED_1_ON       4 ///< Turn LED 1 on.
03918 #define kvLED_ACTION_LED_1_OFF      5 ///< Turn LED 1 off.
03919 #define kvLED_ACTION_LED_2_ON       6 ///< Turn LED 2 on.
03920 #define kvLED_ACTION_LED_2_OFF      7 ///< Turn LED 2 off.
03921 #define kvLED_ACTION_LED_3_ON       8 ///< Turn LED 3 on.
03922 #define kvLED_ACTION_LED_3_OFF      9 ///< Turn LED 3 off.
03923 
03946 canStatus CANLIBAPI kvFlashLeds (const CanHandle hnd, int action, int timeout);
03947 
03987 canStatus CANLIBAPI canRequestChipStatus (const CanHandle hnd);
03988 
04015 canStatus CANLIBAPI canRequestBusStatistics (const CanHandle hnd);
04016 
04023 typedef struct canBusStatistics_s {
04024   unsigned long  stdData;   
04025   unsigned long  stdRemote; 
04026   unsigned long  extData;   
04027   unsigned long  extRemote; 
04028   unsigned long  errFrame;  
04029 
04034   unsigned long  busLoad;
04035   unsigned long  overruns;  
04036 } canBusStatistics;
04037 
04060 canStatus CANLIBAPI canGetBusStatistics (const CanHandle hnd,
04061                                          canBusStatistics *stat,
04062                                          size_t bufsiz);
04063 
04084 canStatus CANLIBAPI canSetBitrate (const CanHandle hnd, int bitrate);
04085 
04103 canStatus CANLIBAPI kvAnnounceIdentity (const CanHandle hnd,
04104                                         void *buf,
04105                                         size_t bufsiz);
04119 canStatus CANLIBAPI kvAnnounceIdentityEx (const CanHandle hnd,
04120                                           int type,
04121                                           void *buf,
04122                                           size_t bufsiz);
04123 
04144 canStatus CANLIBAPI canGetHandleData (const CanHandle hnd,
04145                                       int item,
04146                                       void *buffer,
04147                                       size_t bufsize);
04148 
04150 typedef void *kvTimeDomain;
04151 
04153 typedef canStatus kvStatus;
04154 
04160 typedef struct kvTimeDomainData_s {
04161   int nMagiSyncGroups;        
04162   int nMagiSyncedMembers;     
04163   int nNonMagiSyncCards;      
04164   int nNonMagiSyncedMembers;  
04165 } kvTimeDomainData;
04166 
04195 kvStatus CANLIBAPI kvTimeDomainCreate (kvTimeDomain *domain);
04196 
04219 kvStatus CANLIBAPI kvTimeDomainDelete (kvTimeDomain domain);
04220 
04246 kvStatus CANLIBAPI kvTimeDomainResetTime (kvTimeDomain domain);
04247 
04272 kvStatus CANLIBAPI kvTimeDomainGetData (kvTimeDomain domain,
04273                                         kvTimeDomainData *data,
04274                                         size_t bufsiz);
04275 
04298 kvStatus CANLIBAPI kvTimeDomainAddHandle(kvTimeDomain domain,
04299                                          const CanHandle hnd);
04300 
04322 kvStatus CANLIBAPI kvTimeDomainRemoveHandle (kvTimeDomain domain,
04323                                              const CanHandle hnd);
04324 
04344 typedef void (CANLIBAPI *kvCallback_t) (CanHandle hnd, void* context, unsigned int notifyEvent);
04345 
04379 kvStatus CANLIBAPI kvSetNotifyCallback (const CanHandle hnd,
04380                                         kvCallback_t callback,
04381                                         void* context,
04382                                         unsigned int notifyFlags);
04383 
04391 #define kvBUSTYPE_NONE          0   ///< Unkown bus type.
04392 #define kvBUSTYPE_PCI           1   ///< Bus of type PCI.
04393 #define kvBUSTYPE_PCMCIA        2   ///< Bus of type PCMCIA
04394 #define kvBUSTYPE_USB           3   ///< Bus of type USB
04395 #define kvBUSTYPE_WLAN          4   ///< Bus of type WLAN
04396 #define kvBUSTYPE_PCI_EXPRESS   5   ///< Bus of type PCI Express
04397 #define kvBUSTYPE_ISA           6   ///< Bus of type ISA
04398 #define kvBUSTYPE_VIRTUAL       7   ///< Bus of type virtual
04399 #define kvBUSTYPE_PC104_PLUS    8   ///< Bus of type PC104+
04400 #define kvBUSTYPE_LAN           9   ///< Bus of type LAN
04401 
04411 #define kvBUSTYPE_GROUP_VIRTUAL  1 ///< \ref kvBUSTYPE_VIRTUAL
04412 #define kvBUSTYPE_GROUP_LOCAL    2 ///< \ref kvBUSTYPE_USB
04413 #define kvBUSTYPE_GROUP_REMOTE   3 ///< \ref kvBUSTYPE_WLAN, \ref kvBUSTYPE_LAN
04414 #define kvBUSTYPE_GROUP_INTERNAL 4 ///< \ref kvBUSTYPE_PCI, \ref kvBUSTYPE_PCMCIA, ...
04415 
04467 kvStatus CANLIBAPI kvGetSupportedInterfaceInfo (int index,
04468                                                 char *hwName,
04469                                                 size_t nameLen,
04470                                                 int *hwType,
04471                                                 int *hwBusType);
04472 
04501 kvStatus CANLIBAPI kvReadTimer (const CanHandle hnd, unsigned int *time);
04502 
04503 #if defined(KVINT64)
04504 
04532 kvStatus CANLIBAPI kvReadTimer64 (const CanHandle hnd, KVINT64 *time);
04533 #endif
04534 
04557 kvStatus CANLIBAPI kvReadDeviceCustomerData (const CanHandle hnd,
04558                                              int userNumber,
04559                                              int itemNumber,
04560                                              void *data,
04561                                              size_t bufsiz);
04562 
04563 //
04564 //
04565 // APIs for t-script
04566 //
04567 
04581 #define kvENVVAR_TYPE_INT       1
04582 
04588 #define kvENVVAR_TYPE_FLOAT     2
04589 
04595 #define kvENVVAR_TYPE_STRING    3
04596 
04611 #define kvEVENT_TYPE_KEY        1
04612 
04619 typedef __int64 kvEnvHandle;
04620 
04640 kvStatus CANLIBAPI kvScriptStart (const CanHandle hnd, int slotNo);
04641 
04648 #define kvSCRIPT_STOP_NORMAL         0 
04649 #define kvSCRIPT_STOP_FORCED        -9 
04673 kvStatus CANLIBAPI kvScriptStop (const CanHandle hnd, int slotNo, int mode);
04674 
04694 kvStatus CANLIBAPI kvScriptUnload (const CanHandle hnd, int slotNo);
04695 
04718 kvStatus CANLIBAPI kvScriptSendEvent (const CanHandle hnd,
04719                                       int slotNo,
04720                                       int eventType,
04721                                       int eventNo,
04722                                       unsigned int data);
04723 
04748 kvEnvHandle CANLIBAPI kvScriptEnvvarOpen (const CanHandle hnd,
04749                                           char* envvarName,
04750                                           int *envvarType,
04751                                           int *envvarSize); // returns scriptHandle
04752 
04770 kvStatus CANLIBAPI kvScriptEnvvarClose (kvEnvHandle eHnd);
04771 
04792 kvStatus CANLIBAPI kvScriptEnvvarSetInt (kvEnvHandle eHnd, int val);
04793 
04815 kvStatus CANLIBAPI kvScriptEnvvarGetInt (kvEnvHandle eHnd, int *val);
04816 
04837 kvStatus CANLIBAPI kvScriptEnvvarSetFloat (kvEnvHandle eHnd, float val);
04838 
04860 kvStatus CANLIBAPI kvScriptEnvvarGetFloat (kvEnvHandle eHnd, float *val);
04861 
04886 kvStatus CANLIBAPI kvScriptEnvvarSetData (kvEnvHandle eHnd,
04887                                           void *buf,
04888                                           int start_index,
04889                                           int data_len);
04890 
04914 kvStatus CANLIBAPI kvScriptEnvvarGetData (kvEnvHandle eHnd,
04915                                           void *buf,
04916                                           int start_index,
04917                                           int data_len);
04918 
04942 kvStatus CANLIBAPI kvScriptLoadFileOnDevice (const CanHandle hnd,
04943                                              int slotNo,
04944                                              char *localFile);
04945 
04969 kvStatus CANLIBAPI kvScriptLoadFile (const CanHandle hnd,
04970                                      int slotNo,
04971                                      char *filePathOnPC);
04972 
04973 
04974 
04975 
04989 #define kvSCRIPT_REQUEST_TEXT_UNSUBSCRIBE  1
04990 
04994 #define kvSCRIPT_REQUEST_TEXT_SUBSCRIBE    2
04995 
04999 #define kvSCRIPT_REQUEST_TEXT_ALL_SLOTS    255
05000 
05024 kvStatus CANLIBAPI kvScriptRequestText(const CanHandle hnd,
05025                                        unsigned int slot,
05026                                        unsigned int request);
05027 
05028 
05029 
05052 kvStatus CANLIBAPI kvScriptGetText(const CanHandle hnd,
05053                                         int  *slot,
05054                                         unsigned long *time,
05055                                         unsigned int  *flags,
05056                                         char *buf,
05057                                         size_t bufsize
05058                                         );
05059 
05060 
05061 
05068 #define kvSCRIPT_STATUS_LOADED      1 
05069 #define kvSCRIPT_STATUS_RUNNING     2 
05089 kvStatus CANLIBAPI kvScriptStatus(const CanHandle hnd,
05090                                   int  slot,
05091                                   unsigned int *status);
05092 
05093 
05094 
05095 
05118 kvStatus CANLIBAPI kvFileCopyToDevice (const CanHandle hnd,
05119                                        char *hostFileName,
05120                                        char *deviceFileName);
05121 
05144 kvStatus CANLIBAPI kvFileCopyFromDevice (const CanHandle hnd,
05145                                          char *deviceFileName,
05146                                          char *hostFileName);
05147 
05169 kvStatus CANLIBAPI kvFileDelete (const CanHandle hnd, char *deviceFileName);
05170 
05193 kvStatus CANLIBAPI kvFileGetName (const CanHandle hnd,
05194                                   int fileNo,
05195                                   char *name,
05196                                   int namelen);
05197 
05217 kvStatus CANLIBAPI kvFileGetCount (const CanHandle hnd, int *count);
05218 
05241 kvStatus CANLIBAPI kvFileGetSystemData (const CanHandle hnd,
05242                                         int itemCode,
05243                                         int *result);
05244 
05262 #define kvDEVICE_MODE_INTERFACE      0x00
05263 
05268 #define kvDEVICE_MODE_LOGGER      0x01
05269 
05294 kvStatus CANLIBAPI kvDeviceSetMode (const CanHandle hnd, int mode);
05295 
05318 kvStatus CANLIBAPI kvDeviceGetMode (const CanHandle hnd, int *result);
05319 
05320 
05338 kvStatus CANLIBAPI kvPingRequest (const CanHandle hnd,
05339                                   unsigned int *requestTime);
05340 
05358  kvStatus CANLIBAPI kvPingGetLatest (const CanHandle hnd,
05359                                      unsigned int *requestTime,
05360                                      unsigned int *pingTime);
05361 
05362 
05372 //
05373 //
05374 //
05375 #if defined(_CANEVT_H_)
05376 canStatus CANLIBAPI canReadEvent (const CanHandle hnd, CanEvent *event);
05377 #endif
05378 
05380 void CANLIBAPI canSetDebug(int d);
05382 canStatus CANLIBAPI canSetNotifyEx (const CanHandle hnd,
05383                                     HANDLE event,
05384                                     unsigned int flags);
05386 canStatus CANLIBAPI canSetTimer (const CanHandle hnd,
05387                                  DWORD interval,
05388                                  DWORD flags);
05390 #define canTIMER_CYCLIC             0x01
05391 
05392 #define canTIMER_EXPENSIVE          0x02
05393 
05394 int CANLIBAPI canSplitHandle (CanHandle hnd, int channel);
05396 int CANLIBAPI canOpenMultiple (DWORD bitmask, int flags);
05398 #endif
05399 
05400 #ifdef __cplusplus
05401 }
05402 #endif
05403 
05404 # include "obsolete.h"
05405 
05406 #ifdef KVASER_EYES_ONLY
05407 canStatus CANLIBAPI lowLevelAccess (const CanHandle hnd, void * data, int size);
05408 #endif
05409 
05410 #endif