obsolete.h
Go to the documentation of this file.
1 
2 #ifndef _OBSOLETE_H_
3 #define _OBSOLETE_H_
4 
5 /*
6  * Copyright 1998-2017 by KVASER AB, SWEDEN
7  *
8  * WWW: http://www.kvaser.com
9  *
10  * This software is furnished under a license and may be used and copied
11  * only in accordance with the terms of such license.
12  *
13 */
14 
25 #define canCIRCUIT_ANY -1
26 #define canCARD_ANY -1
27 #define canCHANNEL_ANY -1
28 
29 #define CANID_METAMSG (-1L)
30 #define CANID_WILDCARD (-2L)
31 
32 
39 typedef void* (*canMemoryAllocator) (size_t size);
40 
44 typedef void (*canMemoryDeallocator)(void* p);
45 
49 typedef struct tagCanHWDescr {
51  int cardType;
52  int channel;
53 } canHWDescr;
54 
58 typedef struct tagCanSWDescr {
59  unsigned int rxBufSize;
60  unsigned int txBufSize;
63 } canSWDescr;
64 
68 typedef struct {
69  unsigned int size;
70  unsigned int rxBufSize;
71  unsigned int txBufSize;
73 
77 canStatus CANLIBAPI canLocateHardware(void);
78 
82 int CANLIBAPI canOpen(const canHWDescr * const hwdescr,
83  const canSWDescr * const swdescr,
84  const unsigned int flags);
85 
89 canStatus CANLIBAPI canGetCircuits(int * context,
90  char * name,
91  char * vendor,
92  char * version,
93  unsigned int * cardtype,
94  unsigned int * circtype,
95  unsigned int * channel);
96 
102 #define canERR_BUFOFL canERR_RESERVED_3
103 #define canERR_REINIT canERR_RESERVED_4
104 #define canERR_MSGLOST canERR_RESERVED_5
105 #define canERR_OVERRUN canERR_RESERVED_6
106 #define canERR_CARDCOMMFAILED canERR_RESERVED_7
107 
114 #define canCIRCSTAT_ERROR_PASSIVE 0x0001
115 #define canCIRCSTAT_BUS_OFF 0x0002
116 #define canCIRCSTAT_ERROR_WARNING 0x0004
117 
124 #define canCHANNEL_CAP_DIAGNOSTICS 0x10000000L
125 #define canCHANNEL_CAP_CAN_DIAGNOSTICS canCHANNEL_CAP_RESERVED_2
126 #define canCHANNEL_CAP_REMOTE canCHANNEL_CAP_RESERVED_1
127 
128 
133 #define canSTICKY_ACK_ERROR 0x80000801
134 #define canSTICKY_FORM_ERROR 0x80000002
135 #define canSTICKY_STUFF_ERROR 0x80000004
136 #define canSTICKY_CRC_ERROR 0x80000008
137 #define canSTICKY_BIT0_ERROR 0x80000010
138 #define canSTICKY_BIT1_ERROR 0x80000020
139 #define canSTICKY_HW_OVERRUN 0x80000040
140 #define canSTICKY_SW_OVERRUN 0x80000080
141 
143 #define canSTAT_INACTIVE canSTAT_RESERVED_1
144 
145 /*
146 #define canCIRCSTAT_TXERR 0x0001 // TX error has occurred
147 #define canCIRCSTAT_RXERR 0x0002 // Receive error has occurred
148 #define canCIRCSTAT_OVERRUN 0x0004 // Receiver overrun
149 #define canCIRCSTAT_WAKEUP 0x0008 // Wakeup has occurred
150 #define canCIRCSTAT_INT 0x0010 // ??
151 #define canCIRCSTAT_ACK 0x0020 // ACK error
152 #define canCIRCSTAT_BIT 0x0040 // Bit error
153 */
154 /*
155 More apocryphs.
156 #define canCIRCSTAT_OVERRUN 0x0004 // Receiver overrun
157 #define canCIRCSTAT_WAKEUP 0x0008 // Wakeup has occurred
158 #define canCIRCSTAT_ACK 0x0010 // ACK error
159 #define canCIRCSTAT_BIT0 0x0020 // Bit error
160 #define canCIRCSTAT_BIT1 0x0040 // Bit error
161 #define canCIRCSTAT_BOFF 0x0080 // Chip went Bus Off
162 */
163 /*
164 Even more.
165 #define canCIRCSTAT_BOFF_HW 0x10000L // Chip is Bus Off
166 #define canCIRCSTAT_BOFF_SW 0x20000L // We are Bus Off
167 */
168 
169 
175 #define canWANT_ACTIONS 0x01
176 #define canWANT_OWN_BUFFERS 0x02
177 #define canWANT_ERROR_COUNTERS 0x04
178 #define canWANT_EXCLUSIVE 0x08
179 #define canWANT_EXTENDED 0x10
180 #define canWANT_VIRTUAL 0x20
181 
182 
189 // No circuit 0
190 #define PCCAN_PHILIPS 1
191 #define PCCAN_INTEL526 2
192 #define PCCAN_INTEL527 3
193 #define CANCARD_NEC72005 4
194 #define CIRC_VIRTUAL 5
195 #define CIRC_SJA1000 6
196 
203 #define canCARD_PCCAN 1
204 #define canCARD_CANCARD 2
205 #define canCARD_AC2 3
206 #define canCARD_LAPCAN 4
207 #define canCARD_ISACAN 5
208 #define canCARD_PCCAN_OEM 6
209 
216 #define canFlgACCEPT 1
217 #define canFlgREJECT 2
218 #define canFlgCODE 3
219 #define canFlgMASK 4
220 
227 #define canDISCARD_MESSAGE 3
228 #define canRETAIN_MESSAGE 4
229 
237 #define canSLOW_MODE 0x01
238 
246 #define canOFF 0
247 #define canTRISTATE 1
248 #define canPULLUP 2
249 #define canPULLDOWN 3
250 #define canPUSHPULL 4
251 #define canINVPULLUP 5
252 #define canINVPULLDOWN 6
253 #define canINVPUSHPULL 7
254 
262 #define canIOCTL_LOCAL_ECHO_ON 3
263 #define canIOCTL_LOCAL_ECHO_OFF 4
264 
265 #define canMSG_STATUS 0x0008
266 
268 #ifdef __cplusplus
269 extern "C" {
270 #endif /* __cplusplus */
271 
275 canStatus CANLIBAPI canInstallAction(int handle, long id, int (*fn)());
276 
280 canStatus CANLIBAPI canUninstallAction(int handle, long id);
281 
285 canStatus CANLIBAPI canInstallOwnBuffer(int handle, long id, unsigned int len,
286  void * buf);
287 
291 canStatus CANLIBAPI canUninstallOwnBuffer(int handle, long id);
292 #ifdef __cplusplus
293 }
294 #endif /* __cplusplus */
295 
298 #endif /* _OBSOLETE_H_ */
Definition: obsolete.h:68
int canOpen(const canHWDescr *const hwdescr, const canSWDescr *const swdescr, const unsigned int flags)
canStatus canInstallAction(int handle, long id, int(*fn)())
canMemoryAllocator alloc
Definition: obsolete.h:61
unsigned int txBufSize
Definition: obsolete.h:71
Definition: obsolete.h:58
void *(* canMemoryAllocator)(size_t size)
Definition: obsolete.h:39
int cardType
Definition: obsolete.h:51
Definition: obsolete.h:49
canStatus canGetCircuits(int *context, char *name, char *vendor, char *version, unsigned int *cardtype, unsigned int *circtype, unsigned int *channel)
unsigned int rxBufSize
Definition: obsolete.h:59
canStatus canInstallOwnBuffer(int handle, long id, unsigned int len, void *buf)
canMemoryDeallocator deAlloc
Definition: obsolete.h:62
int channel
Definition: obsolete.h:52
struct tagCanSWDescr canSWDescr
canStatus
Definition: canstat.h:34
canStatus canUninstallAction(int handle, long id)
unsigned int rxBufSize
Definition: obsolete.h:70
struct tagCanHWDescr canHWDescr
unsigned int txBufSize
Definition: obsolete.h:60
unsigned int size
Definition: obsolete.h:69
canStatus canUninstallOwnBuffer(int handle, long id)
canStatus canLocateHardware(void)
void(* canMemoryDeallocator)(void *p)
Definition: obsolete.h:44
int circuitType
Definition: obsolete.h:50