30#define PCAN_NONEBUS 0x00U
32#define PCAN_ISABUS1 0x21U
33#define PCAN_ISABUS2 0x22U
34#define PCAN_ISABUS3 0x23U
35#define PCAN_ISABUS4 0x24U
36#define PCAN_ISABUS5 0x25U
37#define PCAN_ISABUS6 0x26U
38#define PCAN_ISABUS7 0x27U
39#define PCAN_ISABUS8 0x28U
41#define PCAN_DNGBUS1 0x31U
43#define PCAN_PCIBUS1 0x41U
44#define PCAN_PCIBUS2 0x42U
45#define PCAN_PCIBUS3 0x43U
46#define PCAN_PCIBUS4 0x44U
47#define PCAN_PCIBUS5 0x45U
48#define PCAN_PCIBUS6 0x46U
49#define PCAN_PCIBUS7 0x47U
50#define PCAN_PCIBUS8 0x48U
51#define PCAN_PCIBUS9 0x409U
52#define PCAN_PCIBUS10 0x40AU
53#define PCAN_PCIBUS11 0x40BU
54#define PCAN_PCIBUS12 0x40CU
55#define PCAN_PCIBUS13 0x40DU
56#define PCAN_PCIBUS14 0x40EU
57#define PCAN_PCIBUS15 0x40FU
58#define PCAN_PCIBUS16 0x410U
60#define PCAN_USBBUS1 0x51U
61#define PCAN_USBBUS2 0x52U
62#define PCAN_USBBUS3 0x53U
63#define PCAN_USBBUS4 0x54U
64#define PCAN_USBBUS5 0x55U
65#define PCAN_USBBUS6 0x56U
66#define PCAN_USBBUS7 0x57U
67#define PCAN_USBBUS8 0x58U
68#define PCAN_USBBUS9 0x509U
69#define PCAN_USBBUS10 0x50AU
70#define PCAN_USBBUS11 0x50BU
71#define PCAN_USBBUS12 0x50CU
72#define PCAN_USBBUS13 0x50DU
73#define PCAN_USBBUS14 0x50EU
74#define PCAN_USBBUS15 0x50FU
75#define PCAN_USBBUS16 0x510U
77#define PCAN_PCCBUS1 0x61U
78#define PCAN_PCCBUS2 0x62U
80#define PCAN_LANBUS1 0x801U
81#define PCAN_LANBUS2 0x802U
82#define PCAN_LANBUS3 0x803U
83#define PCAN_LANBUS4 0x804U
84#define PCAN_LANBUS5 0x805U
85#define PCAN_LANBUS6 0x806U
86#define PCAN_LANBUS7 0x807U
87#define PCAN_LANBUS8 0x808U
88#define PCAN_LANBUS9 0x809U
89#define PCAN_LANBUS10 0x80AU
90#define PCAN_LANBUS11 0x80BU
91#define PCAN_LANBUS12 0x80CU
92#define PCAN_LANBUS13 0x80DU
93#define PCAN_LANBUS14 0x80EU
94#define PCAN_LANBUS15 0x80FU
95#define PCAN_LANBUS16 0x810U
99#define PCAN_ERROR_OK 0x00000U
100#define PCAN_ERROR_XMTFULL 0x00001U
101#define PCAN_ERROR_OVERRUN 0x00002U
102#define PCAN_ERROR_BUSLIGHT 0x00004U
103#define PCAN_ERROR_BUSHEAVY 0x00008U
104#define PCAN_ERROR_BUSWARNING PCAN_ERROR_BUSHEAVY
105#define PCAN_ERROR_BUSPASSIVE 0x40000U
106#define PCAN_ERROR_BUSOFF 0x00010U
107#define PCAN_ERROR_ANYBUSERR (PCAN_ERROR_BUSWARNING | PCAN_ERROR_BUSLIGHT | PCAN_ERROR_BUSHEAVY | PCAN_ERROR_BUSOFF | PCAN_ERROR_BUSPASSIVE)
108#define PCAN_ERROR_QRCVEMPTY 0x00020U
109#define PCAN_ERROR_QOVERRUN 0x00040U
110#define PCAN_ERROR_QXMTFULL 0x00080U
111#define PCAN_ERROR_REGTEST 0x00100U
112#define PCAN_ERROR_NODRIVER 0x00200U
113#define PCAN_ERROR_HWINUSE 0x00400U
114#define PCAN_ERROR_NETINUSE 0x00800U
115#define PCAN_ERROR_ILLHW 0x01400U
116#define PCAN_ERROR_ILLNET 0x01800U
117#define PCAN_ERROR_ILLCLIENT 0x01C00U
118#define PCAN_ERROR_ILLHANDLE (PCAN_ERROR_ILLHW | PCAN_ERROR_ILLNET | PCAN_ERROR_ILLCLIENT)
119#define PCAN_ERROR_RESOURCE 0x02000U
120#define PCAN_ERROR_ILLPARAMTYPE 0x04000U
121#define PCAN_ERROR_ILLPARAMVAL 0x08000U
122#define PCAN_ERROR_UNKNOWN 0x10000U
123#define PCAN_ERROR_ILLDATA 0x20000U
124#define PCAN_ERROR_ILLMODE 0x80000U
125#define PCAN_ERROR_CAUTION 0x2000000U
126#define PCAN_ERROR_INITIALIZE 0x4000000U
127#define PCAN_ERROR_ILLOPERATION 0x8000000U
131#define PCAN_NONE 0x00U
132#define PCAN_PEAKCAN 0x01U
133#define PCAN_ISA 0x02U
134#define PCAN_DNG 0x03U
135#define PCAN_PCI 0x04U
136#define PCAN_USB 0x05U
137#define PCAN_PCC 0x06U
138#define PCAN_VIRTUAL 0x07U
139#define PCAN_LAN 0x08U
143#define PCAN_DEVICE_ID 0x01U
144#define PCAN_5VOLTS_POWER 0x02U
145#define PCAN_RECEIVE_EVENT 0x03U
146#define PCAN_MESSAGE_FILTER 0x04U
147#define PCAN_API_VERSION 0x05U
148#define PCAN_CHANNEL_VERSION 0x06U
149#define PCAN_BUSOFF_AUTORESET 0x07U
150#define PCAN_LISTEN_ONLY 0x08U
151#define PCAN_LOG_LOCATION 0x09U
152#define PCAN_LOG_STATUS 0x0AU
153#define PCAN_LOG_CONFIGURE 0x0BU
154#define PCAN_LOG_TEXT 0x0CU
155#define PCAN_CHANNEL_CONDITION 0x0DU
156#define PCAN_HARDWARE_NAME 0x0EU
157#define PCAN_RECEIVE_STATUS 0x0FU
158#define PCAN_CONTROLLER_NUMBER 0x10U
159#define PCAN_TRACE_LOCATION 0x11U
160#define PCAN_TRACE_STATUS 0x12U
161#define PCAN_TRACE_SIZE 0x13U
162#define PCAN_TRACE_CONFIGURE 0x14U
163#define PCAN_CHANNEL_IDENTIFYING 0x15U
164#define PCAN_CHANNEL_FEATURES 0x16U
165#define PCAN_BITRATE_ADAPTING 0x17U
166#define PCAN_BITRATE_INFO 0x18U
167#define PCAN_BITRATE_INFO_FD 0x19U
168#define PCAN_BUSSPEED_NOMINAL 0x1AU
169#define PCAN_BUSSPEED_DATA 0x1BU
170#define PCAN_IP_ADDRESS 0x1CU
171#define PCAN_LAN_SERVICE_STATUS 0x1DU
172#define PCAN_ALLOW_STATUS_FRAMES 0x1EU
173#define PCAN_ALLOW_RTR_FRAMES 0x1FU
174#define PCAN_ALLOW_ERROR_FRAMES 0x20U
175#define PCAN_INTERFRAME_DELAY 0x21U
176#define PCAN_ACCEPTANCE_FILTER_11BIT 0x22U
177#define PCAN_ACCEPTANCE_FILTER_29BIT 0x23U
178#define PCAN_IO_DIGITAL_CONFIGURATION 0x24U
179#define PCAN_IO_DIGITAL_VALUE 0x25U
180#define PCAN_IO_DIGITAL_SET 0x26U
181#define PCAN_IO_DIGITAL_CLEAR 0x27U
182#define PCAN_IO_ANALOG_VALUE 0x28U
183#define PCAN_FIRMWARE_VERSION 0x29U
184#define PCAN_ATTACHED_CHANNELS_COUNT 0x2AU
185#define PCAN_ATTACHED_CHANNELS 0x2BU
186#define PCAN_ALLOW_ECHO_FRAMES 0x2CU
187#define PCAN_DEVICE_PART_NUMBER 0x2DU
191#define PCAN_DEVICE_NUMBER PCAN_DEVICE_ID
195#define PCAN_PARAMETER_OFF 0x00U
196#define PCAN_PARAMETER_ON 0x01U
197#define PCAN_FILTER_CLOSE 0x00U
198#define PCAN_FILTER_OPEN 0x01U
199#define PCAN_FILTER_CUSTOM 0x02U
200#define PCAN_CHANNEL_UNAVAILABLE 0x00U
201#define PCAN_CHANNEL_AVAILABLE 0x01U
202#define PCAN_CHANNEL_OCCUPIED 0x02U
203#define PCAN_CHANNEL_PCANVIEW (PCAN_CHANNEL_AVAILABLE | PCAN_CHANNEL_OCCUPIED)
205#define LOG_FUNCTION_DEFAULT 0x00U
206#define LOG_FUNCTION_ENTRY 0x01U
207#define LOG_FUNCTION_PARAMETERS 0x02U
208#define LOG_FUNCTION_LEAVE 0x04U
209#define LOG_FUNCTION_WRITE 0x08U
210#define LOG_FUNCTION_READ 0x10U
211#define LOG_FUNCTION_ALL 0xFFFFU
213#define TRACE_FILE_SINGLE 0x00U
214#define TRACE_FILE_SEGMENTED 0x01U
215#define TRACE_FILE_DATE 0x02U
216#define TRACE_FILE_TIME 0x04U
217#define TRACE_FILE_OVERWRITE 0x80U
219#define FEATURE_FD_CAPABLE 0x01U
220#define FEATURE_DELAY_CAPABLE 0x02U
221#define FEATURE_IO_CAPABLE 0x04U
223#define SERVICE_STATUS_STOPPED 0x01U
224#define SERVICE_STATUS_RUNNING 0x04U
228#define MAX_LENGTH_HARDWARE_NAME 33
229#define MAX_LENGTH_VERSION_STRING 256
233#define PCAN_MESSAGE_STANDARD 0x00U
234#define PCAN_MESSAGE_RTR 0x01U
235#define PCAN_MESSAGE_EXTENDED 0x02U
236#define PCAN_MESSAGE_FD 0x04U
237#define PCAN_MESSAGE_BRS 0x08U
238#define PCAN_MESSAGE_ESI 0x10U
239#define PCAN_MESSAGE_ECHO 0x20U
240#define PCAN_MESSAGE_ERRFRAME 0x40U
241#define PCAN_MESSAGE_STATUS 0x80U
245#define LOOKUP_DEVICE_TYPE __T("devicetype")
246#define LOOKUP_DEVICE_ID __T("deviceid")
247#define LOOKUP_CONTROLLER_NUMBER __T("controllernumber")
248#define LOOKUP_IP_ADDRESS __T("ipaddress")
252#define PCAN_MODE_STANDARD PCAN_MESSAGE_STANDARD
253#define PCAN_MODE_EXTENDED PCAN_MESSAGE_EXTENDED
260#define PCAN_BAUD_1M 0x0014U
261#define PCAN_BAUD_800K 0x0016U
262#define PCAN_BAUD_500K 0x001CU
263#define PCAN_BAUD_250K 0x011CU
264#define PCAN_BAUD_125K 0x031CU
265#define PCAN_BAUD_100K 0x432FU
266#define PCAN_BAUD_95K 0xC34EU
267#define PCAN_BAUD_83K 0x852BU
268#define PCAN_BAUD_50K 0x472FU
269#define PCAN_BAUD_47K 0x1414U
270#define PCAN_BAUD_33K 0x8B2FU
271#define PCAN_BAUD_20K 0x532FU
272#define PCAN_BAUD_10K 0x672FU
273#define PCAN_BAUD_5K 0x7F7FU
283#define PCAN_BR_CLOCK __T("f_clock")
284#define PCAN_BR_CLOCK_MHZ __T("f_clock_mhz")
285#define PCAN_BR_NOM_BRP __T("nom_brp")
286#define PCAN_BR_NOM_TSEG1 __T("nom_tseg1")
287#define PCAN_BR_NOM_TSEG2 __T("nom_tseg2")
288#define PCAN_BR_NOM_SJW __T("nom_sjw")
289#define PCAN_BR_NOM_SAMPLE __T("nom_sam")
290#define PCAN_BR_DATA_BRP __T("data_brp")
291#define PCAN_BR_DATA_TSEG1 __T("data_tseg1")
292#define PCAN_BR_DATA_TSEG2 __T("data_tseg2")
293#define PCAN_BR_DATA_SJW __T("data_sjw")
294#define PCAN_BR_DATA_SAMPLE __T("data_ssp_offset")
298#define PCAN_TYPE_ISA 0x01U
299#define PCAN_TYPE_ISA_SJA 0x09U
300#define PCAN_TYPE_ISA_PHYTEC 0x04U
301#define PCAN_TYPE_DNG 0x02U
302#define PCAN_TYPE_DNG_EPP 0x03U
303#define PCAN_TYPE_DNG_SJA 0x05U
304#define PCAN_TYPE_DNG_SJA_EPP 0x06U
310#define TPCANHandle WORD
311#define TPCANStatus DWORD
312#define TPCANParameter BYTE
313#define TPCANDevice BYTE
314#define TPCANMessageType BYTE
315#define TPCANType BYTE
316#define TPCANMode BYTE
317#define TPCANBaudrate WORD
318#define TPCANBitrateFD LPSTR
319#define TPCANTimestampFD UINT64
327typedef struct tagTPCANMsg
330 TPCANMessageType MSGTYPE;
338typedef struct tagTPCANTimestamp
341 WORD millis_overflow;
347typedef struct tagTPCANMsgFD
350 TPCANMessageType MSGTYPE;
357typedef struct tagTPCANChannelInformation
359 TPCANHandle channel_handle;
360 TPCANDevice device_type;
361 BYTE controller_number;
362 DWORD device_features;
363 char device_name[MAX_LENGTH_HARDWARE_NAME];
365 DWORD channel_condition;
366}TPCANChannelInformation;
389TPCANStatus __stdcall CAN_Initialize(
391 TPCANBaudrate Btr0Btr1,
392 TPCANType HwType _DEF_ARG,
393 DWORD IOPort _DEF_ARG,
394 WORD Interrupt _DEF_ARG);
411TPCANStatus __stdcall CAN_InitializeFD(
413 TPCANBitrateFD BitrateFD);
423TPCANStatus __stdcall CAN_Uninitialize(
424 TPCANHandle Channel);
435TPCANStatus __stdcall CAN_Reset(
436 TPCANHandle Channel);
444TPCANStatus __stdcall CAN_GetStatus(
445 TPCANHandle Channel);
457TPCANStatus __stdcall CAN_Read(
459 TPCANMsg* MessageBuffer,
460 TPCANTimestamp* TimestampBuffer);
472TPCANStatus __stdcall CAN_ReadFD(
474 TPCANMsgFD* MessageBuffer,
475 TPCANTimestampFD *TimestampBuffer);
484TPCANStatus __stdcall CAN_Write(
486 TPCANMsg* MessageBuffer);
495TPCANStatus __stdcall CAN_WriteFD(
497 TPCANMsgFD* MessageBuffer);
512TPCANStatus __stdcall CAN_FilterMessages(
530TPCANStatus __stdcall CAN_GetValue(
532 TPCANParameter Parameter,
548TPCANStatus __stdcall CAN_SetValue(
550 TPCANParameter Parameter,
566TPCANStatus __stdcall CAN_GetErrorText(
579TPCANStatus __stdcall CAN_LookUpChannel(
581 TPCANHandle* FoundChannel);