canstat.h
Go to the documentation of this file.
1 /*
2 * Copyright 2017 by Kvaser AB, Molndal, Sweden
3 * http://www.kvaser.com
4 *
5 * This software is dual licensed under the following two licenses:
6 * BSD-new and GPLv2. You may use either one. See the included
7 * COPYING file for details.
8 *
9 * License: BSD-new
10 * ==============================================================================
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * * Neither the name of the <organization> nor the
19 * names of its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
30 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * License: GPLv2
36 * ==============================================================================
37 * This program is free software; you can redistribute it and/or modify
38 * it under the terms of the GNU General Public License as published by
39 * the Free Software Foundation; either version 2 of the License, or
40 * (at your option) any later version.
41 *
42 * This program is distributed in the hope that it will be useful,
43 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 * GNU General Public License for more details.
46 *
47 * You should have received a copy of the GNU General Public License
48 * along with this program; if not, write to the Free Software
49 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
50 *
51 *
52 * IMPORTANT NOTICE:
53 * ==============================================================================
54 * This source code is made available for free, as an open license, by Kvaser AB,
55 * for use with its applications. Kvaser AB does not accept any liability
56 * whatsoever for any third party patent or other immaterial property rights
57 * violations that may result from any usage of this source code, regardless of
58 * the combination of source code and various applications that it can be used
59 * in, or with.
60 *
61 * -----------------------------------------------------------------------------
62 */
63
64 #ifndef _CANSTAT_H_
65 #define _CANSTAT_H_
66
81 //
82 // Don't forget to update canGetErrorText in canlib.c if this is changed!
83 //
84 typedef enum {
89 canOK = 0,
95 canERR_PARAM = -1,
100 canERR_NOMSG = -2,
109 canERR_NOTFOUND = -3,
113 canERR_NOMEM = -4,
119 canERR_NOCHANNELS = -5,
120
121 canERR_INTERRUPTED = -6,
122
126 canERR_TIMEOUT = -7,
131 canERR_NOTINITIALIZED = -8,
140 canERR_NOHANDLES = -9,
146 canERR_INVHANDLE = -10,
147 canERR_INIFILE = -11,
148
152 canERR_DRIVER = -12,
157 canERR_TXBUFOFL = -13,
158 canERR_RESERVED_1 = -14,
159
165 canERR_HARDWARE = -15,
171 canERR_DYNALOAD = -16,
177 canERR_DYNALIB = -17,
183 canERR_DYNAINIT = -18,
184 canERR_NOT_SUPPORTED = -19,
185 canERR_RESERVED_5 = -20,
186 canERR_RESERVED_6 = -21,
187 canERR_RESERVED_2 = -22,
188
193 canERR_DRIVERLOAD = -23,
198 canERR_DRIVERFAILED = -24,
199 canERR_NOCONFIGMGR = -25,
200 canERR_NOCARD = -26,
201 canERR_RESERVED_7 = -27,
202
207 canERR_REGISTRY = -28,
208 canERR_LICENSE = -29,
209
214 canERR_INTERNAL = -30,
221 canERR_NO_ACCESS = -31,
226 canERR_NOT_IMPLEMENTED = -32,
231 canERR_DEVICE_FILE = -33,
236 canERR_HOST_FILE = -34,
241 canERR_DISK = -35,
245 canERR_CRC = -36,
249 canERR_CONFIG = -37,
253 canERR_MEMO_FAIL = -38,
264 canERR_SCRIPT_FAIL = -39,
265
269 canERR_SCRIPT_WRONG_VERSION = -40,
270
274 canERR_SCRIPT_TXE_CONTAINER_VERSION = -41,
275
279 canERR_SCRIPT_TXE_CONTAINER_FORMAT = -42,
280
284 canERR_BUFFER_TOO_SMALL = -43,
285
286 // The last entry - a dummy so we know where NOT to place a comma.
287 canERR__RESERVED = -44
288 } canStatus;
295 #define CANSTATUS_SUCCESS(X) ((X) == canOK)
296 #define CANSTATUS_FAILURE(X) ((X) != canOK)
297
305 #define canEVENT_RX 32000
306 #define canEVENT_TX 32001
307 #define canEVENT_ERROR 32002
308 #define canEVENT_STATUS 32003
309 #define canEVENT_ENVVAR 32004
310 # define canEVENT_BUSONOFF 32005
311
324 #define canNOTIFY_NONE 0
325 #define canNOTIFY_RX 0x0001
326 #define canNOTIFY_TX 0x0002
327 #define canNOTIFY_ERROR 0x0004
328 #define canNOTIFY_STATUS 0x0008
329 #define canNOTIFY_ENVVAR 0x0010
330
331 # define canNOTIFY_BUSONOFF 0x0020
332
351 #define canSTAT_ERROR_PASSIVE 0x00000001
352 #define canSTAT_BUS_OFF 0x00000002
353 #define canSTAT_ERROR_WARNING 0x00000004
354 #define canSTAT_ERROR_ACTIVE 0x00000008
355 #define canSTAT_TX_PENDING 0x00000010
356 #define canSTAT_RX_PENDING 0x00000020
357 #define canSTAT_RESERVED_1 0x00000040
358 #define canSTAT_TXERR 0x00000080
359 #define canSTAT_RXERR 0x00000100
360 #define canSTAT_HW_OVERRUN 0x00000200
361 #define canSTAT_SW_OVERRUN 0x00000400
362 #define canSTAT_OVERRUN (canSTAT_HW_OVERRUN | canSTAT_SW_OVERRUN)
363
382 #define canMSG_MASK 0x00ff
383 #define canMSG_RTR 0x0001
384 #define canMSG_STD 0x0002
385 #define canMSG_EXT 0x0004
386 #define canMSG_WAKEUP 0x0008
387
388
406 #define canMSG_NERR 0x0010
407 #define canMSG_ERROR_FRAME 0x0020
408 #define canMSG_TXACK 0x0040
409 #define canMSG_TXRQ 0x0080
410 #define canMSG_DELAY_MSG 0x0100
411
412 // single shot flags:
413 #define canMSG_SINGLE_SHOT 0x1000000
414 #define canMSG_TXNACK 0x2000000
415 #define canMSG_ABL 0x4000000
416
417
427 #define canFDMSG_MASK 0xff0000
428 #define canFDMSG_EDL 0x010000
429 #define canFDMSG_FDF 0x010000
430 #define canFDMSG_BRS 0x020000
431 #define canFDMSG_ESI 0x040000
432
446 #define canMSGERR_MASK 0xff00
447 // 0x0100 reserved
448 #define canMSGERR_HW_OVERRUN 0x0200
449 #define canMSGERR_SW_OVERRUN 0x0400
450 #define canMSGERR_STUFF 0x0800
451 #define canMSGERR_FORM 0x1000
452 #define canMSGERR_CRC 0x2000
453 #define canMSGERR_BIT0 0x4000
454 #define canMSGERR_BIT1 0x8000
455
456 // Convenience values for the message error flags.
457 #define canMSGERR_OVERRUN 0x0600
458 #define canMSGERR_BIT 0xC000
459 #define canMSGERR_BUSERR 0xF800
460
461
474 #define canTRANSCEIVER_LINEMODE_NA 0
475 #define canTRANSCEIVER_LINEMODE_SWC_SLEEP 4
476 #define canTRANSCEIVER_LINEMODE_SWC_NORMAL 5
477 #define canTRANSCEIVER_LINEMODE_SWC_FAST 6
478 #define canTRANSCEIVER_LINEMODE_SWC_WAKEUP 7
479 #define canTRANSCEIVER_LINEMODE_SLEEP 8
480 #define canTRANSCEIVER_LINEMODE_NORMAL 9
481 #define canTRANSCEIVER_LINEMODE_STDBY 10
482 #define canTRANSCEIVER_LINEMODE_TT_CAN_H 11
483 #define canTRANSCEIVER_LINEMODE_TT_CAN_L 12
484 #define canTRANSCEIVER_LINEMODE_OEM1 13
485 #define canTRANSCEIVER_LINEMODE_OEM2 14
486 #define canTRANSCEIVER_LINEMODE_OEM3 15
487 #define canTRANSCEIVER_LINEMODE_OEM4 16
488
489
495 #define canTRANSCEIVER_RESNET_NA 0
496 #define canTRANSCEIVER_RESNET_MASTER 1
497 #define canTRANSCEIVER_RESNET_MASTER_STBY 2
498 #define canTRANSCEIVER_RESNET_SLAVE 3
499
513 // Also see src\include\hwnames.h and registered document 048.
514 #define canTRANSCEIVER_TYPE_UNKNOWN 0
515 #define canTRANSCEIVER_TYPE_251 1
516 #define canTRANSCEIVER_TYPE_252 2
517 #define canTRANSCEIVER_TYPE_DNOPTO 3
518 #define canTRANSCEIVER_TYPE_W210 4
519 #define canTRANSCEIVER_TYPE_SWC_PROTO 5
520 #define canTRANSCEIVER_TYPE_SWC 6
521 #define canTRANSCEIVER_TYPE_EVA 7
522 #define canTRANSCEIVER_TYPE_FIBER 8
523 #define canTRANSCEIVER_TYPE_K251 9
524 #define canTRANSCEIVER_TYPE_K 10
525 #define canTRANSCEIVER_TYPE_1054_OPTO 11
526 #define canTRANSCEIVER_TYPE_SWC_OPTO 12
527 #define canTRANSCEIVER_TYPE_TT 13
528 #define canTRANSCEIVER_TYPE_1050 14
529 #define canTRANSCEIVER_TYPE_1050_OPTO 15
530 #define canTRANSCEIVER_TYPE_1041 16
531 #define canTRANSCEIVER_TYPE_1041_OPTO 17
532 #define canTRANSCEIVER_TYPE_RS485 18
533 #define canTRANSCEIVER_TYPE_LIN 19
534 #define canTRANSCEIVER_TYPE_KONE 20
535 #define canTRANSCEIVER_TYPE_CANFD 22
536 #define canTRANSCEIVER_TYPE_CANFD_LIN 24
537 #define canTRANSCEIVER_TYPE_LINX_LIN 64
538 #define canTRANSCEIVER_TYPE_LINX_J1708 66
539 #define canTRANSCEIVER_TYPE_LINX_K 68
540 #define canTRANSCEIVER_TYPE_LINX_SWC 70
541 #define canTRANSCEIVER_TYPE_LINX_LS 72
542
544 #endif
canERR_NOCONFIGMGR
Can&#39;t find req&#39;d config s/w (e.g. CS/SS)
Definition: canstat.h:199
canERR_CONFIG
Definition: canstat.h:249
canERR_NOTFOUND
Definition: canstat.h:109
canERR_RESERVED_6
Reserved.
Definition: canstat.h:186
canERR_TIMEOUT
Definition: canstat.h:126
canERR_NOT_SUPPORTED
Operation not supported by hardware or firmware.
Definition: canstat.h:184
canERR__RESERVED
Reserved.
Definition: canstat.h:287
canERR_TXBUFOFL
Definition: canstat.h:157
canERR_DRIVER
Definition: canstat.h:152
canERR_SCRIPT_FAIL
Definition: canstat.h:264
canERR_RESERVED_2
Reserved.
Definition: canstat.h:187
canERR_DYNAINIT
Definition: canstat.h:183
canERR_DRIVERLOAD
Definition: canstat.h:193
canERR_RESERVED_7
Reserved.
Definition: canstat.h:201
canERR_HOST_FILE
Definition: canstat.h:236
canERR_DEVICE_FILE
Definition: canstat.h:231
canERR_NOT_IMPLEMENTED
Definition: canstat.h:226
canERR_INVHANDLE
Definition: canstat.h:146
canERR_NO_ACCESS
Definition: canstat.h:221
canERR_NOMEM
Definition: canstat.h:113
canERR_SCRIPT_TXE_CONTAINER_VERSION
Definition: canstat.h:274
canERR_NOCARD
The card was removed or not inserted.
Definition: canstat.h:200
canERR_PARAM
Definition: canstat.h:95
canERR_RESERVED_5
Reserved.
Definition: canstat.h:185
canERR_RESERVED_1
Reserved.
Definition: canstat.h:158
canERR_REGISTRY
Definition: canstat.h:207
canERR_NOMSG
Definition: canstat.h:100
canERR_DYNALIB
Definition: canstat.h:177
canERR_SCRIPT_WRONG_VERSION
Definition: canstat.h:269
canStatus
canStatus
Definition: canstat.h:84
canERR_DISK
Definition: canstat.h:241
canERR_MEMO_FAIL
Definition: canstat.h:253
canERR_LICENSE
The license is not valid.
Definition: canstat.h:208
canERR_DYNALOAD
Definition: canstat.h:171
canERR_INTERRUPTED
Interrupted by signals.
Definition: canstat.h:121
canERR_SCRIPT_TXE_CONTAINER_FORMAT
Definition: canstat.h:279
canERR_DRIVERFAILED
Definition: canstat.h:198
canERR_NOTINITIALIZED
Definition: canstat.h:131
canERR_INIFILE
Error in the ini-file (16-bit only)
Definition: canstat.h:147
canERR_CRC
Definition: canstat.h:245
canERR_NOHANDLES
Definition: canstat.h:140
canERR_BUFFER_TOO_SMALL
Definition: canstat.h:284
canOK
Definition: canstat.h:89
canERR_HARDWARE
Definition: canstat.h:165
canERR_INTERNAL
Definition: canstat.h:214
canERR_NOCHANNELS
Definition: canstat.h:119