51#if defined (WIN32) || defined (LINUX) || defined (__linux__)
55 #define STDCALL __stdcall
60 #define PUBLIC __stdcall
67 #define STDCALL far pascal
72 #define PUBLIC far pascal
77#if !defined (_TCHAR_DEFINED)
78 #if defined (__linux__)
79 #define _TCHAR_DEFINED
81 typedef wchar_t _TCHAR;
116#define USBCAN_SET_AMR(extended, can_id, rtr) \
117 (extended) ? ((((DWORD)can_id)<<3 )|((rtr)?0x000004:0)|0x00003) : \
118 ((((DWORD)can_id)<<21)|((rtr)?0x100000:0)|0xfffff)
119#define USBCAN_SET_ACR(extended, can_id, rtr) \
120 (extended) ? ((((DWORD)can_id)<<3 )|((rtr)?0x000004:0)) : \
121 ((((DWORD)can_id)<<21)|((rtr)?0x100000:0))
154#define USBCAN_CALCULATE_AMR(extended,from_id,to_id,rtr_only,rtr_too) \
155 (extended) ? ((((DWORD)(from_id)^(to_id))<<3 )|((rtr_too&!rtr_only)?0x000004:0)|0x00003) : \
156 ((((DWORD)(from_id)^(to_id))<<21)|((rtr_too&!rtr_only)?0x100000:0)|0xfffff)
157#define USBCAN_CALCULATE_ACR(extended,from_id,to_id,rtr_only,rtr_too) \
158 (extended) ? ((((DWORD)(from_id)&(to_id))<<3 )|((rtr_only)?0x000004:0)) : \
159 ((((DWORD)(from_id)&(to_id))<<21)|((rtr_only)?0x100000:0))
174#define USBCAN_MAJOR_VER(ver) ( (ver) & 0x000000FF)
175#define USBCAN_MINOR_VER(ver) (((ver) & 0x0000FF00) >> 8)
176#define USBCAN_RELEASE_VER(ver) (((ver) & 0xFFFF0000) >> 16)
183#if !defined (_WIN32_WCE)
186 #define USBCAN_MAX_MODULES 64
189 #define USBCAN_MAX_INSTANCES 64
194 #define USBCAN_MAX_MODULES 9
197 #define USBCAN_MAX_INSTANCES 9
204#define USBCAN_ANY_MODULE 255
207#define USBCAN_INVALID_HANDLE 0xff
212#define USBCAN_BAUD_1MBit 0x0014
213#define USBCAN_BAUD_800kBit 0x0016
214#define USBCAN_BAUD_500kBit 0x001c
215#define USBCAN_BAUD_250kBit 0x011c
216#define USBCAN_BAUD_125kBit 0x031c
217#define USBCAN_BAUD_100kBit 0x432f
218#define USBCAN_BAUD_50kBit 0x472f
219#define USBCAN_BAUD_20kBit 0x532f
220#define USBCAN_BAUD_10kBit 0x672f
226#define USBCAN_BAUD_USE_BTREX 0x0000
229#define USBCAN_BAUD_AUTO 0xFFFF
234#define USBCAN_BAUDEX_1MBit 0x00020354
235#define USBCAN_BAUDEX_800kBit 0x00030254
236#define USBCAN_BAUDEX_500kBit 0x00050354
237#define USBCAN_BAUDEX_250kBit 0x000B0354
238#define USBCAN_BAUDEX_125kBit 0x00170354
239#define USBCAN_BAUDEX_100kBit 0x00171466
240#define USBCAN_BAUDEX_50kBit 0x002F1466
241#define USBCAN_BAUDEX_20kBit 0x00771466
242#define USBCAN_BAUDEX_10kBit 0x80771466
247#define USBCAN_BAUDEX_SP2_1MBit 0x00020741
248#define USBCAN_BAUDEX_SP2_800kBit 0x00030731
249#define USBCAN_BAUDEX_SP2_500kBit 0x00050741
250#define USBCAN_BAUDEX_SP2_250kBit 0x000B0741
251#define USBCAN_BAUDEX_SP2_125kBit 0x00170741
252#define USBCAN_BAUDEX_SP2_100kBit 0x001D1741
253#define USBCAN_BAUDEX_SP2_50kBit 0x003B1741
254#define USBCAN_BAUDEX_SP2_20kBit 0x00771772
255#define USBCAN_BAUDEX_SP2_10kBit 0x80771772
267#define USBCAN_BAUDEX_G4_1MBit 0x40180001
268#define USBCAN_BAUDEX_G4_800kBit 0x401B0001
269#define USBCAN_BAUDEX_G4_500kBit 0x401C0002
270#define USBCAN_BAUDEX_G4_250kBit 0x401C0005
271#define USBCAN_BAUDEX_G4_125kBit 0x401C000B
272#define USBCAN_BAUDEX_G4_100kBit 0x412F000B
273#define USBCAN_BAUDEX_G4_50kBit 0x412F0017
274#define USBCAN_BAUDEX_G4_20kBit 0x412F003B
275#define USBCAN_BAUDEX_G4_10kBit 0x412F0077
286#define USBCAN_BAUDEX_G4X_1MBit 0xC01B0001
288#define USBCAN_BAUDEX_G4X_500kBit 0xC02F0002
289#define USBCAN_BAUDEX_G4X_250kBit 0xC02F0005
290#define USBCAN_BAUDEX_G4X_125kBit 0xC02F000B
291#define USBCAN_BAUDEX_G4X_100kBit 0xC12F000E
292#define USBCAN_BAUDEX_G4X_50kBit 0xC12F001D
293#define USBCAN_BAUDEX_G4X_20kBit 0xC12F004A
294#define USBCAN_BAUDEX_G4X_10kBit 0xC12F0095
303#define USBCAN_BAUDEX_USE_BTR01 0x00000000
304#define USBCAN_BAUDEX_AUTO 0xFFFFFFFF
307#define USBCAN_MSG_FF_STD 0x00
308#define USBCAN_MSG_FF_ECHO 0x20
309#define USBCAN_MSG_FF_RTR 0x40
310#define USBCAN_MSG_FF_EXT 0x80
313#define USBCAN_SUCCESSFUL 0x00
314#define USBCAN_ERR 0x01
315#define USBCAN_ERRCMD 0x40
316#define USBCAN_WARNING 0x80
317#define USBCAN_RESERVED 0xc0
320#define USBCAN_ERR_RESOURCE 0x01
321#define USBCAN_ERR_MAXMODULES 0x02
322#define USBCAN_ERR_HWINUSE 0x03
323#define USBCAN_ERR_ILLVERSION 0x04
324#define USBCAN_ERR_ILLHW 0x05
325#define USBCAN_ERR_ILLHANDLE 0x06
326#define USBCAN_ERR_ILLPARAM 0x07
327#define USBCAN_ERR_BUSY 0x08
328#define USBCAN_ERR_TIMEOUT 0x09
329#define USBCAN_ERR_IOFAILED 0x0a
330#define USBCAN_ERR_DLL_TXFULL 0x0b
331#define USBCAN_ERR_MAXINSTANCES 0x0c
332#define USBCAN_ERR_CANNOTINIT 0x0d
333#define USBCAN_ERR_DISCONNECT 0x0e
334#define USBCAN_ERR_DISCONECT USBCAN_ERR_DISCONNECT
335#define USBCAN_ERR_NOHWCLASS 0x0f
336#define USBCAN_ERR_ILLCHANNEL 0x10
337#define USBCAN_ERR_RESERVED1 0x11
338#define USBCAN_ERR_ILLHWTYPE 0x12
339#define USBCAN_ERR_SERVER_TIMEOUT 0x13
342#define USBCAN_ERRCMD_NOTEQU 0x40
343#define USBCAN_ERRCMD_REGTST 0x41
344#define USBCAN_ERRCMD_ILLCMD 0x42
345#define USBCAN_ERRCMD_EEPROM 0x43
346#define USBCAN_ERRCMD_RESERVED1 0x44
347#define USBCAN_ERRCMD_RESERVED2 0x45
348#define USBCAN_ERRCMD_RESERVED3 0x46
349#define USBCAN_ERRCMD_ILLBDR 0x47
350#define USBCAN_ERRCMD_NOTINIT 0x48
351#define USBCAN_ERRCMD_ALREADYINIT 0x49
352#define USBCAN_ERRCMD_ILLSUBCMD 0x4A
353#define USBCAN_ERRCMD_ILLIDX 0x4B
354#define USBCAN_ERRCMD_RUNNING 0x4C
358#define USBCAN_WARN_NODATA 0x80
359#define USBCAN_WARN_SYS_RXOVERRUN 0x81
360#define USBCAN_WARN_DLL_RXOVERRUN 0x82
361#define USBCAN_WARN_RESERVED1 0x83
362#define USBCAN_WARN_RESERVED2 0x84
363#define USBCAN_WARN_FW_TXOVERRUN 0x85
364#define USBCAN_WARN_FW_RXOVERRUN 0x86
365#define USBCAN_WARN_FW_TXMSGLOST 0x87
366#define USBCAN_WARN_NULL_PTR 0x90
367#define USBCAN_WARN_TXLIMIT 0x91
370#define USBCAN_WARN_BUSY 0x92
371#define USBCAN_WARN_CONFIG 0x93
378#define USBCAN_CHECK_VALID_RXCANMSG(ret) \
379 ((ret == USBCAN_SUCCESSFUL) || (ret > USBCAN_WARNING))
381#define USBCAN_CHECK_TX_OK(ret) \
382 ((ret == USBCAN_SUCCESSFUL) || (ret > USBCAN_WARNING))
385#define USBCAN_CHECK_TX_SUCCESS(ret) \
386 (ret == USBCAN_SUCCESSFUL)
388#define USBCAN_CHECK_TX_NOTALL(ret) \
389 (ret == USBCAN_WARN_TXLIMIT)
391#define USBCAN_CHECK_WARNING(ret) \
392 (ret >= USBCAN_WARNING)
394#define USBCAN_CHECK_ERROR(ret) \
395 ((ret != USBCAN_SUCCESSFUL) && (ret < USBCAN_WARNING))
397#define USBCAN_CHECK_ERROR_CMD(ret) \
398 ((ret >= USBCAN_ERRCMD) && (ret < USBCAN_WARNING))
403#define USBCAN_EVENT_INITHW 0
404#define USBCAN_EVENT_INITCAN 1
405#define USBCAN_EVENT_RECIEVE 2
406#define USBCAN_EVENT_RECEIVE 2
407#define USBCAN_EVENT_STATUS 3
408#define USBCAN_EVENT_DEINITCAN 4
409#define USBCAN_EVENT_DEINITHW 5
410#define USBCAN_EVENT_CONNECT 6
411#define USBCAN_EVENT_DISCONNECT 7
412#define USBCAN_EVENT_FATALDISCON 8
413#define USBCAN_EVENT_USBBUS_ERROR 16
414#define USBCAN_EVENT_RECONNECT 17
415#define USBCAN_EVENT_RESERVED1 0x80
418#define USBCAN_CANERR_OK 0x0000
419#define USBCAN_CANERR_XMTFULL 0x0001
420#define USBCAN_CANERR_OVERRUN 0x0002
421#define USBCAN_CANERR_BUSLIGHT 0x0004
422#define USBCAN_CANERR_BUSHEAVY 0x0008
423#define USBCAN_CANERR_BUSOFF 0x0010
424#define USBCAN_CANERR_QRCVEMPTY 0x0020
425#define USBCAN_CANERR_QOVERRUN 0x0040
426#define USBCAN_CANERR_QXMTFULL 0x0080
427#define USBCAN_CANERR_REGTEST 0x0100
428#define USBCAN_CANERR_MEMTEST 0x0200
429#define USBCAN_CANERR_TXMSGLOST 0x0400
433#define USBCAN_USBERR_OK 0x0000
434#define USBCAN_USBERR_STATUS_TIMEOUT 0x2000
435#define USBCAN_USBERR_WATCHDOG_TIMEOUT 0x4000
438#define USBCAN_AMR_ALL (DWORD) 0xffffffff
439#define USBCAN_ACR_ALL (DWORD) 0x00000000
441#define USBCAN_OCR_DEFAULT 0x1A
442#define USBCAN_OCR_RS485_ISOLATED 0x1E
443#define USBCAN_OCR_RS485_NOT_ISOLATED 0x0A
444#define USBCAN_DEFAULT_BUFFER_ENTRIES 4096
447#define USBCAN_CHANNEL_CH0 0
448#define USBCAN_CHANNEL_CH1 1
449#define USBCAN_CHANNEL_ANY 255
450#define USBCAN_CHANNEL_ALL 254
451#define USBCAN_CHANNEL_NO 253
452#define USBCAN_CHANNEL_CAN1 USBCAN_CHANNEL_CH0
453#define USBCAN_CHANNEL_CAN2 USBCAN_CHANNEL_CH1
454#define USBCAN_CHANNEL_LIN USBCAN_CHANNEL_CH1
457#define USBCAN_RESET_ALL 0x00000000
458#define USBCAN_RESET_NO_STATUS 0x00000001
459#define USBCAN_RESET_NO_CANCTRL 0x00000002
460#define USBCAN_RESET_NO_TXCOUNTER 0x00000004
461#define USBCAN_RESET_NO_RXCOUNTER 0x00000008
462#define USBCAN_RESET_NO_TXBUFFER_CH 0x00000010
463#define USBCAN_RESET_NO_TXBUFFER_DLL 0x00000020
464#define USBCAN_RESET_NO_TXBUFFER_FW 0x00000080
465#define USBCAN_RESET_NO_RXBUFFER_CH 0x00000100
466#define USBCAN_RESET_NO_RXBUFFER_DLL 0x00000200
467#define USBCAN_RESET_NO_RXBUFFER_SYS 0x00000400
468#define USBCAN_RESET_NO_RXBUFFER_FW 0x00000800
469#define USBCAN_RESET_FIRMWARE 0xFFFFFFFF
474#define USBCAN_RESET_NO_COUNTER_ALL (USBCAN_RESET_NO_TXCOUNTER | USBCAN_RESET_NO_RXCOUNTER)
475#define USBCAN_RESET_NO_TXBUFFER_COMM (USBCAN_RESET_NO_TXBUFFER_DLL | 0x00000040 | USBCAN_RESET_NO_TXBUFFER_FW)
476#define USBCAN_RESET_NO_RXBUFFER_COMM (USBCAN_RESET_NO_RXBUFFER_DLL | USBCAN_RESET_NO_RXBUFFER_SYS | USBCAN_RESET_NO_RXBUFFER_FW)
477#define USBCAN_RESET_NO_TXBUFFER_ALL (USBCAN_RESET_NO_TXBUFFER_CH | USBCAN_RESET_NO_TXBUFFER_COMM)
478#define USBCAN_RESET_NO_RXBUFFER_ALL (USBCAN_RESET_NO_RXBUFFER_CH | USBCAN_RESET_NO_RXBUFFER_COMM)
479#define USBCAN_RESET_NO_BUFFER_COMM (USBCAN_RESET_NO_TXBUFFER_COMM | USBCAN_RESET_NO_RXBUFFER_COMM)
480#define USBCAN_RESET_NO_BUFFER_ALL (USBCAN_RESET_NO_TXBUFFER_ALL | USBCAN_RESET_NO_RXBUFFER_ALL)
482#define USBCAN_RESET_ONLY_STATUS (0x0000FFFF & ~(USBCAN_RESET_NO_STATUS))
483#define USBCAN_RESET_ONLY_CANCTRL (0x0000FFFF & ~(USBCAN_RESET_NO_CANCTRL))
484#define USBCAN_RESET_ONLY_TXBUFFER_FW (0x0000FFFF & ~(USBCAN_RESET_NO_TXBUFFER_FW))
485#define USBCAN_RESET_ONLY_RXBUFFER_FW (0x0000FFFF & ~(USBCAN_RESET_NO_RXBUFFER_FW))
486#define USBCAN_RESET_ONLY_RXCHANNEL_BUFF (0x0000FFFF & ~(USBCAN_RESET_NO_RXBUFFER_CH))
487#define USBCAN_RESET_ONLY_TXCHANNEL_BUFF (0x0000FFFF & ~(USBCAN_RESET_NO_TXBUFFER_CH))
488#define USBCAN_RESET_ONLY_RX_BUFF (0x0000FFFF & ~(USBCAN_RESET_NO_RXBUFFER_ALL | USBCAN_RESET_NO_RXCOUNTER))
489#define USBCAN_RESET_ONLY_RX_BUFF_GW002 (0x0000FFFF & ~(USBCAN_RESET_NO_RXBUFFER_ALL | USBCAN_RESET_NO_RXCOUNTER | USBCAN_RESET_NO_TXBUFFER_FW))
490#define USBCAN_RESET_ONLY_TX_BUFF (0x0000FFFF & ~(USBCAN_RESET_NO_TXBUFFER_ALL | USBCAN_RESET_NO_TXCOUNTER))
491#define USBCAN_RESET_ONLY_ALL_BUFF (USBCAN_RESET_ONLY_RX_BUFF & USBCAN_RESET_ONLY_TX_BUFF)
492#define USBCAN_RESET_ONLY_ALL_COUNTER (0x0000FFFF & ~(USBCAN_RESET_NO_COUNTER_ALL))
537#define USBCAN_PRODCODE_MASK_DID 0xFFFF0000L
538#define USBCAN_PRODCODE_MASK_MFU 0x00008000L
539#define USBCAN_PRODCODE_PID_TWO_CHA 0x00000001L
540#define USBCAN_PRODCODE_PID_TERM 0x00000001L
541#define USBCAN_PRODCODE_PID_RBUSER 0x00000001L
542#define USBCAN_PRODCODE_PID_RBCAN 0x00000001L
543#define USBCAN_PRODCODE_PID_G4 0x00000020L
544#define USBCAN_PRODCODE_PID_RESVD 0x00000040L
545#define USBCAN_PRODCODE_MASK_PID 0x00007FFFL
546#define USBCAN_PRODCODE_MASK_PIDG3 (USBCAN_PRODCODE_MASK_PID & ~USBCAN_PRODCODE_PID_RESVD)
547#define USBCAN_PRODCODE_MASK_PIDG4 (USBCAN_PRODCODE_MASK_PID & ~USBCAN_PRODCODE_PID_RESVD)
549#define USBCAN_PRODCODE_PID_GW001 0x00001100L
550#define USBCAN_PRODCODE_PID_GW002 0x00001102L
551#define USBCAN_PRODCODE_PID_MULTIPORT 0x00001103L
552#define USBCAN_PRODCODE_PID_BASIC 0x00001104L
553#define USBCAN_PRODCODE_PID_ADVANCED 0x00001105L
554#define USBCAN_PRODCODE_PID_USBCAN8 0x00001107L
555#define USBCAN_PRODCODE_PID_USBCAN16 0x00001109L
556#define USBCAN_PRODCODE_PID_RESERVED3 0x00001110L
557#define USBCAN_PRODCODE_PID_ADVANCED_G4 0x00001121L
558#define USBCAN_PRODCODE_PID_BASIC_G4 0x00001122L
559#define USBCAN_PRODCODE_PID_USBCAN8_G4 0x00001123L
560#define USBCAN_PRODCODE_PID_USBCAN16_G4 0x00001125L
561#define USBCAN_PRODCODE_PID_RESERVED1 0x00001144L
562#define USBCAN_PRODCODE_PID_RESERVED2 0x00001145L
563#define USBCAN_PRODCODE_PID_RESERVED4 0x00001162L
587#define USBCAN_CHECK_IS_SYSWORXX(pHwInfoEx) \
588 (((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) >= USBCAN_PRODCODE_PID_MULTIPORT) && \
589 (((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) != USBCAN_PRODCODE_PID_RESERVED3)
592#define USBCAN_CHECK_IS_G4(pHwInfoEx) \
593 (((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_PID_G4) != 0)
596#define USBCAN_CHECK_IS_G3(pHwInfoEx) \
597 (USBCAN_CHECK_IS_SYSWORXX(pHwInfoEx) && !USBCAN_CHECK_IS_G4(pHwInfoEx))
600#define USBCAN_CHECK_IS_G2(pHwInfoEx) \
601 ((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) == USBCAN_PRODCODE_PID_GW002)
604#define USBCAN_CHECK_IS_G1(pHwInfoEx) \
605 ((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) == USBCAN_PRODCODE_PID_GW001)
608#define USBCAN_CHECK_SUPPORT_CYCLIC_MSG(pHwInfoEx) \
609 (USBCAN_CHECK_IS_SYSWORXX(pHwInfoEx) && \
610 (USBCAN_MAJOR_VER((pHwInfoEx)->m_dwFwVersionEx) > 3) || ( \
611 (USBCAN_MAJOR_VER((pHwInfoEx)->m_dwFwVersionEx) == 3) && \
612 (USBCAN_MINOR_VER((pHwInfoEx)->m_dwFwVersionEx) >= 6) ) )
615#define USBCAN_CHECK_SUPPORT_TWO_CHANNEL(pHwInfoEx) \
616 ((((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) >= USBCAN_PRODCODE_PID_MULTIPORT) && \
617 (((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_PID_TWO_CHA) != 0) )
620#define USBCAN_CHECK_SUPPORT_TERM_RESISTOR(pHwInfoEx) \
621 ((((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_PID_TERM) != 0))
624#define USBCAN_CHECK_SUPPORT_USER_PORT(pHwInfoEx) \
625 ((((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) != USBCAN_PRODCODE_PID_GW001) && \
626 (((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) != USBCAN_PRODCODE_PID_BASIC) && \
627 (((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) != USBCAN_PRODCODE_PID_RESERVED3) && \
628 (((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) != USBCAN_PRODCODE_PID_BASIC_G4) && \
629 (((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) != USBCAN_PRODCODE_PID_RESERVED1) && \
630 (((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_MASK_PID) != USBCAN_PRODCODE_PID_RESERVED4) && \
631 ( (USBCAN_MAJOR_VER ((pHwInfoEx)->m_dwFwVersionEx) > 2) || \
632 ((USBCAN_MAJOR_VER ((pHwInfoEx)->m_dwFwVersionEx) == 2) && \
633 (USBCAN_MINOR_VER ((pHwInfoEx)->m_dwFwVersionEx) >= 16)) ) )
636#define USBCAN_CHECK_SUPPORT_RBUSER_PORT(pHwInfoEx) \
637 ((((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_PID_RBUSER) != 0))
640#define USBCAN_CHECK_SUPPORT_RBCAN_PORT(pHwInfoEx) \
641 ((((pHwInfoEx)->m_dwProductCode & USBCAN_PRODCODE_PID_RBCAN) != 0))
644#define USBCAN_CHECK_SUPPORT_UCANNET(pHwInfoEx) \
645 (USBCAN_CHECK_IS_SYSWORXX(pHwInfoEx) && \
646 (USBCAN_MAJOR_VER((pHwInfoEx)->m_dwFwVersionEx) > 3) || ( \
647 (USBCAN_MAJOR_VER((pHwInfoEx)->m_dwFwVersionEx) == 3) && \
648 (USBCAN_MINOR_VER((pHwInfoEx)->m_dwFwVersionEx) >= 8) ) )
653#define USBCAN_MAX_CYCLIC_CANMSG 16
656#define USBCAN_CYCLIC_FLAG_STOPP 0x00000000L
659#define USBCAN_CYCLIC_FLAG_START 0x80000000L
660#define USBCAN_CYCLIC_FLAG_SEQUMODE 0x40000000L
662#define USBCAN_CYCLIC_FLAG_NOECHO 0x00010000L
666#define USBCAN_CYCLIC_FLAG_LOCK_0 0x00000001L
667#define USBCAN_CYCLIC_FLAG_LOCK_1 0x00000002L
668#define USBCAN_CYCLIC_FLAG_LOCK_2 0x00000004L
669#define USBCAN_CYCLIC_FLAG_LOCK_3 0x00000008L
670#define USBCAN_CYCLIC_FLAG_LOCK_4 0x00000010L
671#define USBCAN_CYCLIC_FLAG_LOCK_5 0x00000020L
672#define USBCAN_CYCLIC_FLAG_LOCK_6 0x00000040L
673#define USBCAN_CYCLIC_FLAG_LOCK_7 0x00000080L
674#define USBCAN_CYCLIC_FLAG_LOCK_8 0x00000100L
675#define USBCAN_CYCLIC_FLAG_LOCK_9 0x00000200L
676#define USBCAN_CYCLIC_FLAG_LOCK_10 0x00000400L
677#define USBCAN_CYCLIC_FLAG_LOCK_11 0x00000800L
678#define USBCAN_CYCLIC_FLAG_LOCK_12 0x00001000L
679#define USBCAN_CYCLIC_FLAG_LOCK_13 0x00002000L
680#define USBCAN_CYCLIC_FLAG_LOCK_14 0x00004000L
681#define USBCAN_CYCLIC_FLAG_LOCK_15 0x00008000L
685#define USBCAN_PENDING_FLAG_RX_DLL 0x00000001L
686#define USBCAN_PENDING_FLAG_RX_SYS 0x00000002L
687#define USBCAN_PENDING_FLAG_RX_FW 0x00000004L
688#define USBCAN_PENDING_FLAG_TX_DLL 0x00000010L
689#define USBCAN_PENDING_FLAG_TX_SYS 0x00000020L
690#define USBCAN_PENDING_FLAG_TX_FW 0x00000040L
693#define USBCAN_PENDING_FLAG_RX_ALL (USBCAN_PENDING_FLAG_RX_DLL | USBCAN_PENDING_FLAG_RX_SYS | USBCAN_PENDING_FLAG_RX_FW)
694#define USBCAN_PENDING_FLAG_TX_ALL (USBCAN_PENDING_FLAG_TX_DLL | USBCAN_PENDING_FLAG_TX_SYS | USBCAN_PENDING_FLAG_TX_FW)
695#define USBCAN_PENDING_FLAG_ALL (USBCAN_PENDING_FLAG_RX_ALL | USBCAN_PENDING_FLAG_TX_ALL)
697#define USBCAN_HWEX_FLAG_UCANNET 0x00000001L
698#define USBCAN_HWEX_FLAG_HWCTRL 0x00000002L
699#define USBCAN_HWEX_FLAG_USBBUS_ERROR 0x00000004L
700#define USBCAN_HWEX_FLAG_USBBUS_AUTO 0x00000100L
708#if !defined (_WIN32_WCE)
713#ifndef UCHANDLE_DEFINED
714 #define UCHANDLE_DEFINED
715 typedef BYTE tUcanHandle;
722#define UCANDWORD DWORD
724typedef BYTE tUcanMode;
726#define kUcanModeNormal 0x00
727#define kUcanModeListenOnly 0x01
728#define kUcanModeTxEcho 0x02
729#define kUcanModeRxOrderCh 0x04
730#define kUcanModeHighResTimer 0x08
731#define kUcanModeReserved 0x10
735typedef DWORD tUcanVersionType;
737#define kVerTypeUserLib 0x00000001L
738#define kVerTypeUserDll 0x00000001L
739#define kVerTypeSysDrv 0x00000002L
740#define kVerTypeFirmware 0x00000003L
741#define kVerTypeNetDrv 0x00000004L
742#define kVerTypeSysLd 0x00000005L
743#define kVerTypeSysL2 0x00000006L
744#define kVerTypeSysL3 0x00000007L
745#define kVerTypeSysL4 0x00000008L
746#define kVerTypeSysL5 0x00000009L
747#define kVerTypeCpl 0x0000000AL
748#define kVerTypeSysL21 0x0000000BL
749#define kVerTypeSysL22 0x0000000CL
750#define kVerTypeSysL23 0x0000000DL
751#define kVerTypeSysLex 0x0000000EL
755typedef void (PUBLIC *tCallbackFkt) (tUcanHandle UcanHandle_p, BYTE bEvent_p);
756typedef void (PUBLIC *tCallbackFktEx) (tUcanHandle UcanHandle_p, DWORD dwEvent_p, BYTE bChannel_p,
void* pArg_p);
759typedef void (PUBLIC *tConnectControlFkt) (BYTE bEvent_p, DWORD dwParam_p);
760typedef void (PUBLIC *tConnectControlFktEx) (DWORD dwEvent_p, DWORD dwParam_p,
void* pArg_p);
763typedef struct _tCanMsgStruct
791#define USBCAN_CALC_TIMEDIFF(old_time,new_time) ((new_time) - (old_time))
794typedef struct _tStatusStruct
802typedef struct _tUcanInitCanParam
820 WORD m_wNrOfRxBufferEntries;
821 WORD m_wNrOfTxBufferEntries;
826typedef struct _tUcanHardwareInfo
829 tUcanHandle m_UcanHandle;
845typedef struct _tUcanHardwareInfoEx
848 tUcanHandle m_UcanHandle;
851 DWORD m_dwFwVersionEx;
852 DWORD m_dwProductCode;
855 DWORD m_adwUniqueId[4];
859#define USBCAN_HWINFO_SIZE_V1 0x12
860#define USBCAN_HWINFO_SIZE_V2 0x22
861#define USBCAN_HWINFO_SIZE_V3 0x26
863typedef struct _tUcanHardwareInitInfo
866 BOOL m_fDoInitialize;
867 tUcanHandle* m_pUcanHandle;
868 tCallbackFktEx m_fpCallbackFktEx;
869 void* m_pCallbackArg;
872tUcanHardwareInitInfo;
874typedef void (PUBLIC *tUcanEnumCallback) (
877 tUcanHardwareInfoEx* pHwInfoEx_p,
878 tUcanHardwareInitInfo* pInitInfo_p,
881typedef struct _tUcanChannelInfo
897typedef struct _tUcanMsgCountInfo
899 WORD m_wSentMsgCount;
900 WORD m_wRecvdMsgCount;
904typedef struct _tUcanMsgCountInfoEx
906 DWORD m_dwSentMsgCount;
907 DWORD m_dwRecvdMsgCount;
909} tUcanMsgCountInfoEx;
911typedef struct _tUcanRtcStatus
919 BYTE m_bMonthsCentury;
924typedef struct _tUcanSdCardStatus
933#if !defined (_WIN32_WCE)
958BOOL PUBLIC UcanSetDebugMode (DWORD dwDbgLevel_p, _TCHAR* pszFilePathName_p, DWORD dwFlags_p);
979DWORD PUBLIC UcanGetVersion (
void);
1003DWORD PUBLIC UcanGetVersionEx (tUcanVersionType VerType_p);
1018DWORD PUBLIC UcanGetFwVersion (tUcanHandle UcanHandle_p);
1040UCANRET PUBLIC UcanInitHwConnectControl (tConnectControlFkt fpConnectControlFkt_p);
1041UCANRET PUBLIC UcanInitHwConnectControlEx (tConnectControlFktEx fpConnectControlFktEx_p,
void* pCallbackArg_p);
1056UCANRET PUBLIC UcanDeinitHwConnectControl (
void);
1079DWORD PUBLIC UcanEnumerateHardware (tUcanEnumCallback fpCallback_p,
void* pCallbackArg_p,
1080 BOOL fEnumUsedDevs_p,
1081 BYTE bDeviceNrLow_p, BYTE bDeviceNrHigh_p,
1082 DWORD dwSerialNrLow_p, DWORD dwSerialNrHigh_p,
1083 DWORD dwProductCodeLow_p, DWORD dwProductCodeHigh_p);
1111UCANRET PUBLIC UcanInitHardware (tUcanHandle* pUcanHandle_p, BYTE bDeviceNr_p, tCallbackFkt fpCallbackFkt_p);
1112UCANRET PUBLIC UcanInitHardwareEx (tUcanHandle* pUcanHandle_p, BYTE bDeviceNr_p, tCallbackFktEx fpCallbackFktEx_p,
void* pCallbackArg_p);
1113UCANRET PUBLIC UcanInitHardwareEx2 (tUcanHandle* pUcanHandle_p, DWORD dwSerialNr_p, tCallbackFktEx fpCallbackFktEx_p,
void* pCallbackArg_p);
1130UCANRET PUBLIC UcanSetDeviceNr (tUcanHandle UcanHandle_p, BYTE bDeviceNr_p);
1149UCANRET PUBLIC UcanGetModuleTime (tUcanHandle UcanHandle_p, DWORD* pdwTime_p);
1171UCANRET PUBLIC UcanGetHardwareInfo (tUcanHandle UcanHandle_p, tUcanHardwareInfo* pHwInfo_p);
1172UCANRET PUBLIC UcanGetHardwareInfoEx2 (tUcanHandle UcanHandle_p, tUcanHardwareInfoEx* pHwInfo_p, tUcanChannelInfo* pCanInfoCh0_p, tUcanChannelInfo* pCanInfoCh1_p);
1195UCANRET PUBLIC UcanInitCan (tUcanHandle UcanHandle_p, BYTE bBTR0_p, BYTE bBTR1_p, DWORD dwAMR_p, DWORD dwACR_p);
1196UCANRET PUBLIC UcanInitCanEx (tUcanHandle UcanHandle_p, tUcanInitCanParam* pInitCanParam_p);
1197UCANRET PUBLIC UcanInitCanEx2 (tUcanHandle UcanHandle_p, BYTE bChannel_p, tUcanInitCanParam* pInitCanParam_p);
1220UCANRET PUBLIC UcanSetBaudrate (tUcanHandle UcanHandle_p, BYTE bBTR0_p, BYTE bBTR1_p);
1221UCANRET PUBLIC UcanSetBaudrateEx (tUcanHandle UcanHandle_p, BYTE bChannel_p, BYTE bBTR0_p, BYTE bBTR1_p, DWORD dwBaudrate_p);
1241UCANRET PUBLIC UcanSetAcceptance (tUcanHandle UcanHandle_p, DWORD dwAMR_p, DWORD dwACR_p);
1242UCANRET PUBLIC UcanSetAcceptanceEx (tUcanHandle UcanHandle_p, BYTE bChannel_p, DWORD dwAMR_p, DWORD dwACR_p);
1262UCANRET PUBLIC UcanResetCan (tUcanHandle UcanHandle_p);
1263UCANRET PUBLIC UcanResetCanEx (tUcanHandle UcanHandle_p, BYTE bChannel_p, DWORD dwResetFlags_p);
1288UCANRET PUBLIC UcanReadCanMsg (tUcanHandle UcanHandle_p, tCanMsgStruct* pCanMsg_p);
1289UCANRET PUBLIC UcanReadCanMsgEx (tUcanHandle UcanHandle_p, BYTE* pbChannel_p, tCanMsgStruct* pCanMsg_p, DWORD* pdwCount_p);
1312UCANRET PUBLIC UcanWriteCanMsg (tUcanHandle UcanHandle_p, tCanMsgStruct* pCanMsg_p);
1313UCANRET PUBLIC UcanWriteCanMsgEx (tUcanHandle UcanHandle_p, BYTE bChannel_p, tCanMsgStruct* pCanMsg_p, DWORD* pdwCount_p);
1332UCANRET PUBLIC UcanGetStatus (tUcanHandle UcanHandle_p, tStatusStruct* pStatus_p);
1333UCANRET PUBLIC UcanGetStatusEx (tUcanHandle UcanHandle_p, BYTE bChannel_p, tStatusStruct* pStatus_p);
1353UCANRET PUBLIC UcanGetMsgCountInfo (tUcanHandle UcanHandle_p, tUcanMsgCountInfo* pMsgCountInfo_p);
1354UCANRET PUBLIC UcanGetMsgCountInfoEx (tUcanHandle UcanHandle_p, BYTE bChannel_p, tUcanMsgCountInfo* pMsgCountInfo_p);
1355UCANRET PUBLIC UcanGetMsgCountInfoEx2 (tUcanHandle UcanHandle_p, BYTE bChannel_p, tUcanMsgCountInfoEx* pMsgCountInfo_p);
1373UCANRET PUBLIC UcanDeinitCan (tUcanHandle UcanHandle_p);
1374UCANRET PUBLIC UcanDeinitCanEx (tUcanHandle UcanHandle_p, BYTE bChannel_p);
1390UCANRET PUBLIC UcanDeinitHardware (tUcanHandle UcanHandle_p);
1423void PUBLIC UcanCallbackFkt (tUcanHandle UcanHandle_p, BYTE bEvent_p);
1424void PUBLIC UcanCallbackFktEx (tUcanHandle UcanHandle_p, DWORD dwEvent_p, BYTE bChannel_p,
void* pArg_p);
1449void PUBLIC UcanConnectControlFkt (BYTE bEvent_p, DWORD dwParam_p);
1450void PUBLIC UcanConnectControlFktEx (DWORD dwEvent_p, DWORD dwParam_p,
void* pArg_p);
1480UCANRET PUBLIC UcanDefineCyclicCanMsg (tUcanHandle UcanHandle_p,
1481 BYTE bChannel_p, tCanMsgStruct* pCanMsgList_p, DWORD dwCount_p);
1501UCANRET PUBLIC UcanReadCyclicCanMsg (tUcanHandle UcanHandle_p,
1502 BYTE bChannel_p, tCanMsgStruct* pCanMsgList_p, DWORD* pdwCount_p);
1524UCANRET PUBLIC UcanEnableCyclicCanMsg (tUcanHandle UcanHandle_p,
1525 BYTE bChannel_p, DWORD dwFlags_p);
1552UCANRET PUBLIC UcanGetMsgPending (tUcanHandle UcanHandle_p,
1553 BYTE bChannel_p, DWORD dwFlags_p, DWORD* pdwPendingCount_p);
1576UCANRET PUBLIC UcanGetCanErrorCounter (tUcanHandle UcanHandle_p,
1577 BYTE bChannel_p, DWORD* pdwTxErrorCounter_p, DWORD* pdwRxErrorCounter_p);
1604UCANRET PUBLIC UcanSetTxTimeout (tUcanHandle UcanHandle_p,
1605 BYTE bChannel_p, DWORD dwTxTimeout_p);
1609UCANRET PUBLIC UcanGetRtcStatus (tUcanHandle UcanHandle_p, tUcanRtcStatus* pRtcStatus_p);
1610UCANRET PUBLIC UcanGetSdCardStatus (tUcanHandle UcanHandle_p, tUcanSdCardStatus* pSdCardStatus_p);