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 
77 //
78 // Don't forget to update canGetErrorText in canlib.c if this is changed!
79 //
80 typedef enum {
85  canOK = 0,
116 
118 
144 
155 
184 
198 
205 
237  canERR_DISK = -35,
241  canERR_CRC = -36,
261 
266 
267 
268  // The last entry - a dummy so we know where NOT to place a comma.
270 } canStatus;
277 #define CANSTATUS_SUCCESS(X) ((X) == canOK)
278 #define CANSTATUS_FAILURE(X) ((X) != canOK)
279 
287 #define canEVENT_RX 32000
288 #define canEVENT_TX 32001
289 #define canEVENT_ERROR 32002
290 #define canEVENT_STATUS 32003
291 #define canEVENT_ENVVAR 32004
292 
305 #define canNOTIFY_NONE 0
306 #define canNOTIFY_RX 0x0001
307 #define canNOTIFY_TX 0x0002
308 #define canNOTIFY_ERROR 0x0004
309 #define canNOTIFY_STATUS 0x0008
310 #define canNOTIFY_ENVVAR 0x0010
311 
330 #define canSTAT_ERROR_PASSIVE 0x00000001
331 #define canSTAT_BUS_OFF 0x00000002
332 #define canSTAT_ERROR_WARNING 0x00000004
333 #define canSTAT_ERROR_ACTIVE 0x00000008
334 #define canSTAT_TX_PENDING 0x00000010
335 #define canSTAT_RX_PENDING 0x00000020
336 #define canSTAT_RESERVED_1 0x00000040
337 #define canSTAT_TXERR 0x00000080
338 #define canSTAT_RXERR 0x00000100
339 #define canSTAT_HW_OVERRUN 0x00000200
340 #define canSTAT_SW_OVERRUN 0x00000400
341 #define canSTAT_OVERRUN (canSTAT_HW_OVERRUN | canSTAT_SW_OVERRUN)
342 
361 #define canMSG_MASK 0x00ff
362 #define canMSG_RTR 0x0001
363 #define canMSG_STD 0x0002
364 #define canMSG_EXT 0x0004
365 #define canMSG_WAKEUP 0x0008
366 
367 
385 #define canMSG_NERR 0x0010
386 #define canMSG_ERROR_FRAME 0x0020
387 #define canMSG_TXACK 0x0040
388 #define canMSG_TXRQ 0x0080
389 #define canMSG_DELAY_MSG 0x0100
390 
391 // single shot flags:
392 #define canMSG_SINGLE_SHOT 0x1000000
393 #define canMSG_TXNACK 0x2000000
394 #define canMSG_ABL 0x4000000
395 
396 
406 #define canFDMSG_MASK 0xff0000
407 #define canFDMSG_EDL 0x010000
408 #define canFDMSG_FDF 0x010000
409 #define canFDMSG_BRS 0x020000
410 #define canFDMSG_ESI 0x040000
411 
425 #define canMSGERR_MASK 0xff00
426 // 0x0100 reserved
427 #define canMSGERR_HW_OVERRUN 0x0200
428 #define canMSGERR_SW_OVERRUN 0x0400
429 #define canMSGERR_STUFF 0x0800
430 #define canMSGERR_FORM 0x1000
431 #define canMSGERR_CRC 0x2000
432 #define canMSGERR_BIT0 0x4000
433 #define canMSGERR_BIT1 0x8000
434 
435 // Convenience values for the message error flags.
436 #define canMSGERR_OVERRUN 0x0600
437 #define canMSGERR_BIT 0xC000
438 #define canMSGERR_BUSERR 0xF800
439 
440 
453 #define canTRANSCEIVER_LINEMODE_NA 0
454 #define canTRANSCEIVER_LINEMODE_SWC_SLEEP 4
455 #define canTRANSCEIVER_LINEMODE_SWC_NORMAL 5
456 #define canTRANSCEIVER_LINEMODE_SWC_FAST 6
457 #define canTRANSCEIVER_LINEMODE_SWC_WAKEUP 7
458 #define canTRANSCEIVER_LINEMODE_SLEEP 8
459 #define canTRANSCEIVER_LINEMODE_NORMAL 9
460 #define canTRANSCEIVER_LINEMODE_STDBY 10
461 #define canTRANSCEIVER_LINEMODE_TT_CAN_H 11
462 #define canTRANSCEIVER_LINEMODE_TT_CAN_L 12
463 #define canTRANSCEIVER_LINEMODE_OEM1 13
464 #define canTRANSCEIVER_LINEMODE_OEM2 14
465 #define canTRANSCEIVER_LINEMODE_OEM3 15
466 #define canTRANSCEIVER_LINEMODE_OEM4 16
467 
468 
474 #define canTRANSCEIVER_RESNET_NA 0
475 #define canTRANSCEIVER_RESNET_MASTER 1
476 #define canTRANSCEIVER_RESNET_MASTER_STBY 2
477 #define canTRANSCEIVER_RESNET_SLAVE 3
478 
492 // Also see src\include\hwnames.h and registered document 048.
493 #define canTRANSCEIVER_TYPE_UNKNOWN 0
494 #define canTRANSCEIVER_TYPE_251 1
495 #define canTRANSCEIVER_TYPE_252 2
496 #define canTRANSCEIVER_TYPE_DNOPTO 3
497 #define canTRANSCEIVER_TYPE_W210 4
498 #define canTRANSCEIVER_TYPE_SWC_PROTO 5
499 #define canTRANSCEIVER_TYPE_SWC 6
500 #define canTRANSCEIVER_TYPE_EVA 7
501 #define canTRANSCEIVER_TYPE_FIBER 8
502 #define canTRANSCEIVER_TYPE_K251 9
503 #define canTRANSCEIVER_TYPE_K 10
504 #define canTRANSCEIVER_TYPE_1054_OPTO 11
505 #define canTRANSCEIVER_TYPE_SWC_OPTO 12
506 #define canTRANSCEIVER_TYPE_TT 13
507 #define canTRANSCEIVER_TYPE_1050 14
508 #define canTRANSCEIVER_TYPE_1050_OPTO 15
509 #define canTRANSCEIVER_TYPE_1041 16
510 #define canTRANSCEIVER_TYPE_1041_OPTO 17
511 #define canTRANSCEIVER_TYPE_RS485 18
512 #define canTRANSCEIVER_TYPE_LIN 19
513 #define canTRANSCEIVER_TYPE_KONE 20
514 #define canTRANSCEIVER_TYPE_CANFD 22
515 #define canTRANSCEIVER_TYPE_CANFD_LIN 24
516 #define canTRANSCEIVER_TYPE_LINX_LIN 64
517 #define canTRANSCEIVER_TYPE_LINX_J1708 66
518 #define canTRANSCEIVER_TYPE_LINX_K 68
519 #define canTRANSCEIVER_TYPE_LINX_SWC 70
520 #define canTRANSCEIVER_TYPE_LINX_LS 72
521 
523 #endif
Can&#39;t find req&#39;d config s/w (e.g. CS/SS)
Definition: canstat.h:195
Definition: canstat.h:245
Definition: canstat.h:105
Reserved.
Definition: canstat.h:182
Definition: canstat.h:122
Operation not supported by hardware or firmware.
Definition: canstat.h:180
Reserved.
Definition: canstat.h:269
Definition: canstat.h:153
Definition: canstat.h:148
Definition: canstat.h:260
Reserved.
Definition: canstat.h:183
Definition: canstat.h:179
Definition: canstat.h:189
Reserved.
Definition: canstat.h:197
Definition: canstat.h:232
Definition: canstat.h:227
Definition: canstat.h:222
Definition: canstat.h:142
Definition: canstat.h:217
Definition: canstat.h:109
The card was removed or not inserted.
Definition: canstat.h:196
Definition: canstat.h:91
Reserved.
Definition: canstat.h:181
Reserved.
Definition: canstat.h:154
Definition: canstat.h:203
Definition: canstat.h:96
Definition: canstat.h:173
Definition: canstat.h:265
canStatus
Definition: canstat.h:80
Definition: canstat.h:237
Definition: canstat.h:249
The license is not valid.
Definition: canstat.h:204
Definition: canstat.h:167
Interrupted by signals.
Definition: canstat.h:117
Definition: canstat.h:194
Definition: canstat.h:127
Error in the ini-file (16-bit only)
Definition: canstat.h:143
Definition: canstat.h:241
Definition: canstat.h:136
Definition: canstat.h:85
Definition: canstat.h:161
Definition: canstat.h:210
Definition: canstat.h:115