source: pacpussensors/trunk/CanGateway/driver/VCanD.h@ 22

Last change on this file since 22 was 1, checked in by DHERBOMEZ Gérald, 12 years ago

ajout des capteurs CanGateway et Alasca

File size: 35.2 KB
Line 
1/*----------------------------------------------------------------------------
2| File:
3| VCAND.H
4| Project:
5| CAN driver for Win NT and Win 95
6|
7| Description:
8| Driver Interface Prototypes
9|
10|-----------------------------------------------------------------------------
11| $Author: Jörg $ $Locker: $ $Revision: 48 $
12| $Header: /CANdriver/dll/VCanD.h 48 22.01.04 9:26 Jörg $
13|-----------------------------------------------------------------------------
14| Copyright (c) 1996 by Vector Informatik GmbH. All rights reserved.
15 ----------------------------------------------------------------------------*/
16
17#ifndef _V_CAND_H_
18#define _V_CAND_H_
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#if (__FLAT__) || defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
25 #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__)
26 #define _EXPORT_API __stdcall
27 #else
28 #define _EXPORT_API
29 #endif
30#else
31 #define _EXPORT_API _far _pascal
32#endif
33
34#ifndef DYNAMIC_CANDRIVER_DLL
35 // not used for dynamic load of dll
36 #define _EXPORT_DECL __declspec(dllimport) _EXPORT_API
37 #define _EXPORT_DEF __declspec(dllimport) _EXPORT_API
38#endif
39
40#include <pshpack1.h>
41
42typedef char * ncdStringType;
43
44//------------------------------------------------------------------------------
45// accessmask
46typedef unsigned long Vaccess;
47
48
49//------------------------------------------------------------------------------
50// structure for V_RECEIVE_MSG, V_TRANSMIT_MSG
51
52// message flags
53#ifndef MAX_MSG_LEN
54#define MAX_MSG_LEN 8
55#endif
56
57#define EXT_MSG 0x80000000 // signs an extended identifier
58#define VCAN_EXT_MSG_ID EXT_MSG
59
60#define VCAN_MSG_FLAG_ERROR_FRAME 0x01
61#define VCAN_MSG_FLAG_OVERRUN 0x02 /* Overrun in Driver or CAN Controller */
62 /* special case: OVERRUN combined with TIMER
63 * means the 32 bit timer has overrun
64 */
65#define VCAN_MSG_FLAG_NERR 0x04 /* Line Error on Lowspeed */
66#define VCAN_MSG_FLAG_WAKEUP 0x08 /* High Voltage Message on Single Wire CAN */
67#define VCAN_MSG_FLAG_REMOTE_FRAME 0x10
68#define VCAN_MSG_FLAG_RESERVED_1 0x20
69#define VCAN_MSG_FLAG_TX_NOTIFY 0x40 /* Message Transmitted */
70#define VCAN_MSG_FLAG_TX_START 0x80 /* Transmit Message stored into Controller */
71
72// old style flags
73#define MSGFLAG_ERROR_FRAME VCAN_MSG_FLAG_ERROR_FRAME // Msg is a bus error
74#define MSGFLAG_OVERRUN VCAN_MSG_FLAG_OVERRUN // Msgs following this has been lost
75#define MSGFLAG_NERR VCAN_MSG_FLAG_NERR // NERR active during this msg
76#define MSGFLAG_WAKEUP VCAN_MSG_FLAG_WAKEUP // Msg rcv'd in wakeup mode
77#define MSGFLAG_REMOTE_FRAME VCAN_MSG_FLAG_REMOTE_FRAME // Msg is a remote frame
78#define MSGFLAG_RESERVED_1 VCAN_MSG_FLAG_RESERVED_1 // Reserved for future usage
79#define MSGFLAG_TX VCAN_MSG_FLAG_TX_NOTIFY // TX acknowledge
80#define MSGFLAG_TXRQ VCAN_MSG_FLAG_TX_START // TX request
81
82struct s_vcan_msg { /* 14 Bytes */
83 unsigned long id;
84 unsigned char flags;
85 unsigned char dlc;
86 unsigned char data [MAX_MSG_LEN];
87 };
88
89
90//------------------------------------------------------------------------------
91// structure for V_CHIP_STATE
92
93#define CHIPSTAT_BUSOFF 0x01
94#define CHIPSTAT_ERROR_PASSIVE 0x02
95#define CHIPSTAT_ERROR_WARNING 0x04
96#define CHIPSTAT_ERROR_ACTIVE 0x08
97
98struct s_vcan_chip_state {
99 unsigned char busStatus;
100 unsigned char txErrorCounter;
101 unsigned char rxErrorCounter;
102 };
103
104//------------------------------------------------------------------------------
105// structure for SET_OUTPUT_MODE
106#define OUTPUT_MODE_SILENT 0
107#define OUTPUT_MODE_NORMAL 1
108
109//------------------------------------------------------------------------------
110// Transceiver modes
111#define TRANSCEIVER_EVENT_ERROR 1
112#define TRANSCEIVER_EVENT_CHANGED 2
113
114//------------------------------------------------------------------------------
115// Transceiver types
116#define VCAN_TRANSCEIVER_TYPE_NONE 0
117#define VCAN_TRANSCEIVER_TYPE_251 1
118#define VCAN_TRANSCEIVER_TYPE_252 2
119#define VCAN_TRANSCEIVER_TYPE_DNOPTO 3
120#define VCAN_TRANSCEIVER_TYPE_W210 4
121#define VCAN_TRANSCEIVER_TYPE_SWC_PROTO 5 // Prototype. Driver may latch-up.
122#define VCAN_TRANSCEIVER_TYPE_SWC 6
123#define VCAN_TRANSCEIVER_TYPE_EVA 7
124#define VCAN_TRANSCEIVER_TYPE_FIBER 8
125#define VCAN_TRANSCEIVER_TYPE_K251 9
126#define VCAN_TRANSCEIVER_TYPE_K 10
127#define VCAN_TRANSCEIVER_TYPE_1054_OPTO 11 // 1054 with optical isolation
128#define VCAN_TRANSCEIVER_TYPE_SWC_OPTO 12 // SWC with optical isolation
129#define VCAN_TRANSCEIVER_TYPE_B10011S 13 // B10011S truck-and-trailer
130#define VCAN_TRANSCEIVER_TYPE_1050 14 // 1050
131#define VCAN_TRANSCEIVER_TYPE_1050_OPTO 15 // 1050 with optical isolation
132#define VCAN_TRANSCEIVER_TYPE_1041 16 // 1041
133#define VCAN_TRANSCEIVER_TYPE_1041_OPTO 17 // 1041 with optical isolation
134
135
136// piggy backs
137#define VCAN_TRANSCEIVER_TYPE_PB_251 0x0101
138#define VCAN_TRANSCEIVER_TYPE_PB_1054 0x0103
139#define VCAN_TRANSCEIVER_TYPE_PB_251_OPTO 0x0105
140// 0x0107, 0x0109 are not supported!!
141#define VCAN_TRANSCEIVER_TYPE_PB_SWC 0x010B
142// 0x010D not supported, 0x010F, 0x0111, 0x0113 reserved for future use!!
143#define VCAN_TRANSCEIVER_TYPE_PB_1054_OPTO 0x0115
144#define VCAN_TRANSCEIVER_TYPE_PB_SWC_OPTO 0x0117
145#define VCAN_TRANSCEIVER_TYPE_PB_TT_OPTO 0x0119
146#define VCAN_TRANSCEIVER_TYPE_PB_1050 0x011B
147#define VCAN_TRANSCEIVER_TYPE_PB_1050_OPTO 0x011D
148#define VCAN_TRANSCEIVER_TYPE_PB_1041 0x011F
149#define VCAN_TRANSCEIVER_TYPE_PB_1041_OPTO 0x0121
150
151
152//------------------------------------------------------------------------------
153// old style Transceiver types
154#define TRANSCEIVER_TYPE_NONE VCAN_TRANSCEIVER_TYPE_NONE
155#define TRANSCEIVER_TYPE_251 VCAN_TRANSCEIVER_TYPE_251
156#define TRANSCEIVER_TYPE_252 VCAN_TRANSCEIVER_TYPE_252
157#define TRANSCEIVER_TYPE_DNOPTO VCAN_TRANSCEIVER_TYPE_DNOPTO
158#define TRANSCEIVER_TYPE_W210 VCAN_TRANSCEIVER_TYPE_W210
159#define TRANSCEIVER_TYPE_SWC_PROTO VCAN_TRANSCEIVER_TYPE_SWC_PROTO
160#define TRANSCEIVER_TYPE_SWC VCAN_TRANSCEIVER_TYPE_SWC
161
162
163//------------------------------------------------------------------------------
164// Transceiver modes
165#define VCAN_TRANSCEIVER_LINEMODE_NA 0
166#define VCAN_TRANSCEIVER_LINEMODE_TWO_LINE 1
167#define VCAN_TRANSCEIVER_LINEMODE_CAN_H 2
168#define VCAN_TRANSCEIVER_LINEMODE_CAN_L 3
169#define VCAN_TRANSCEIVER_LINEMODE_SWC_SLEEP 4 // SWC Sleep Mode.
170#define VCAN_TRANSCEIVER_LINEMODE_SWC_NORMAL 5 // SWC Normal Mode.
171#define VCAN_TRANSCEIVER_LINEMODE_SWC_FAST 6 // SWC High-Speed Mode.
172#define VCAN_TRANSCEIVER_LINEMODE_SWC_WAKEUP 7 // SWC Wakeup Mode.
173#define VCAN_TRANSCEIVER_LINEMODE_SLEEP 8
174#define VCAN_TRANSCEIVER_LINEMODE_NORMAL 9
175#define VCAN_TRANSCEIVER_LINEMODE_STDBY 10 // Standby for those who support it
176#define VCAN_TRANSCEIVER_LINEMODE_TT_CAN_H 11 // truck & trailer: operating mode single wire using CAN high
177#define VCAN_TRANSCEIVER_LINEMODE_TT_CAN_L 12 // truck & trailer: operating mode single wire using CAN low
178#define VCAN_TRANSCEIVER_LINEMODE_EVA_00 13 // CANcab Eva
179#define VCAN_TRANSCEIVER_LINEMODE_EVA_01 14 // CANcab Eva
180#define VCAN_TRANSCEIVER_LINEMODE_EVA_10 15 // CANcab Eva
181#define VCAN_TRANSCEIVER_LINEMODE_EVA_11 16 // CANcab Eva
182
183//------------------------------------------------------------------------------
184// old style Transceiver modes
185#define TRANSCEIVER_LINEMODE_NA VCAN_TRANSCEIVER_LINEMODE_NA
186#define TRANSCEIVER_LINEMODE_TWO_LINE VCAN_TRANSCEIVER_LINEMODE_TWO_LINE
187#define TRANSCEIVER_LINEMODE_CAN_H VCAN_TRANSCEIVER_LINEMODE_CAN_H
188#define TRANSCEIVER_LINEMODE_CAN_L VCAN_TRANSCEIVER_LINEMODE_CAN_L
189#define TRANSCEIVER_LINEMODE_SWC_SLEEP VCAN_TRANSCEIVER_LINEMODE_SWC_SLEEP
190#define TRANSCEIVER_LINEMODE_SWC_NORMAL VCAN_TRANSCEIVER_LINEMODE_SWC_NORMAL
191#define TRANSCEIVER_LINEMODE_SWC_FAST VCAN_TRANSCEIVER_LINEMODE_SWC_FAST
192#define TRANSCEIVER_LINEMODE_SWC_WAKEUP VCAN_TRANSCEIVER_LINEMODE_SWC_WAKEUP
193#define TRANSCEIVER_LINEMODE_SLEEP VCAN_TRANSCEIVER_LINEMODE_SLEEP
194#define TRANSCEIVER_LINEMODE_NORMAL VCAN_TRANSCEIVER_LINEMODE_NORMAL
195
196
197#define VCAN_TRANSCEIVER_RESNET_NA 0
198#define VCAN_TRANSCEIVER_RESNET_MASTER 1
199#define VCAN_TRANSCEIVER_RESNET_MASTER_STBY 2
200#define VCAN_TRANSCEIVER_RESNET_SLAVE 3
201// old style
202#define TRANSCEIVER_RESNET_NA VCAN_TRANSCEIVER_RESNET_NA
203#define TRANSCEIVER_RESNET_MASTER VCAN_TRANSCEIVER_RESNET_MASTER
204#define TRANSCEIVER_RESNET_MASTER_STBY VCAN_TRANSCEIVER_RESNET_MASTER_STBY
205#define TRANSCEIVER_RESNET_SLAVE VCAN_TRANSCEIVER_RESNET_SLAVE
206
207//------------------------------------------------------------------------------
208// definitions for the events and commands used by the driver
209enum e_vevent_type {
210 V_NO_COMMAND = 0,
211 V_RECEIVE_MSG = 1,
212 V_CHIP_STATE = 4,
213 V_TIMER = 8,
214 V_TRANSMIT_MSG =10,
215 };
216
217union s_vcan_tag_data {
218 struct s_vcan_msg msg;
219 struct s_vcan_chip_state chipState;
220 };
221
222
223typedef unsigned char VeventTag;
224
225//------------------------------------------------------------------------------
226// VCAN_EVENT structure
227
228// event type definition
229struct s_vcan_event {
230 VeventTag tag; // 1
231 unsigned char chanIndex; // 1
232 unsigned char transId; // 1
233 unsigned char portHandle; // 1 internal use only !!!!
234 unsigned long timeStamp; // 4
235 union s_vcan_tag_data
236 tagData; // 14 Bytes (_VMessage)
237 };
238 // --------
239 // 22 Bytes
240
241typedef struct s_vcan_event VCAN_EVENT, Vevent, *PVevent;
242
243// message name to aquire a unique message id from windows
244#define DriverNotifyMessageName "VectorCanDriverChangeNotifyMessage"
245
246typedef enum {
247 UNKNOWN = 0,
248 HARDWARE_CHANGED = 1,
249 APP_SETTINGS_CHANGED = 2,
250} VCAN_NOTIFY_REASON;
251
252// defines for the supported hardware
253#define HWTYPE_NONE 0
254#define HWTYPE_VIRTUAL 1
255#define HWTYPE_CANCARDX 2
256#define HWTYPE_CANPARI 3
257#define HWTYPE_CANAC2 5
258#define HWTYPE_CANAC2PCI 6
259#define HWTYPE_CANCARDY 12
260#define HWTYPE_CANCARDXL 15
261#define HWTYPE_CANCARD2 17
262#define HWTYPE_EDICCARD 19
263
264#define HWTYPE_CANCASEXL 21
265#define HWTYPE_CANBOARDXL 25
266#define HWTYPE_CANBOARDXL_COMPACT 27
267
268#define MAX_HWTYPE 27
269
270//------------------------------------------------------------------------------
271// build a channels mask from the channels index
272#define CHANNEL_MASK(x) (1<<(x))
273
274#define MAX_APPNAME 32
275
276//------------------------------------------------------------------------------
277// define for ReceiveMode
278#define VCAN_WAIT 0
279#define VCAN_POLL 1
280#define VCAN_NOTIFY 2
281
282//------------------------------------------------------------------------------
283// driver status
284typedef short Vstatus;
285
286#define VSUCCESS 0
287#define VPENDING 1
288
289#define VERR_QUEUE_IS_EMPTY 10
290#define VERR_QUEUE_IS_FULL 11
291#define VERR_TX_NOT_POSSIBLE 12
292#define VERR_NO_LICENSE 14
293#define VERR_WRONG_PARAMETER 101
294#define VERR_TWICE_REGISTER 110
295#define VERR_INVALID_CHAN_INDEX 111
296#define VERR_INVALID_ACCESS 112
297#define VERR_PORT_IS_OFFLINE 113
298#define VERR_CHAN_IS_ONLINE 116
299#define VERR_NOT_IMPLEMENTED 117
300#define VERR_INVALID_PORT 118
301#define VERR_HW_NOT_READY 120
302#define VERR_CMD_TIMEOUT 121
303#define VERR_HW_NOT_PRESENT 129
304#define VERR_NOTIFY_ALREADY_ACTIVE 131
305#define VERR_NO_RESOURCES 152
306#define VERR_WRONG_CHIP_TYPE 153
307#define VERR_WRONG_COMMAND 154
308#define VERR_INVALID_HANDLE 155
309#define VERR_CANNOT_OPEN_DRIVER 201
310#define VERROR 255
311
312#define MAX_DRIVER_NAME 31
313#define MAX_CHANNEL_NAME 31
314#define MAX_CHAN_NAME MAX_CHANNEL_NAME
315
316
317//------------------------------------------------------------------------------
318// acceptance filter
319typedef struct _Vset_acceptance {
320 unsigned long code;
321 unsigned long mask;
322} VsetAcceptance;
323
324//------------------------------------------------------------------------------
325// bit timing
326typedef struct {
327 unsigned long bitRate;
328 unsigned char sjw;
329 unsigned char tseg1;
330 unsigned char tseg2;
331 unsigned char sam; // 1 or 3
332 } VchipParams;
333
334
335// porthandle
336#define INVALID_PORTHANDLE (-1)
337typedef long VportHandle, *PVportHandle;
338
339typedef struct s_vcan_channel_config {
340 char name [MAX_CHANNEL_NAME + 1];
341 unsigned char hwType; // HWTYPE_xxxx (see above)
342 unsigned char hwIndex; // Index of the hardware (same type) (0,1,...)
343 unsigned char hwChannel; // Index of the channel (same hardware) (0,1,...)
344 unsigned char tranceiverType; // TRANCEIVER_TYPE_xxxx (see above)
345 unsigned char channelIndex; // Global channel index (0,1,...)
346 unsigned long channelMask; // Global channel mask (=1<<channelIndex)
347
348 // Channel
349 unsigned char isOnBus; // The channel is on bus
350 VchipParams chipParams; // Actual bittiming
351 unsigned char outputMode; // Actual output mode
352 unsigned char flags; // Actual options MSGFLAG_TX,MSGFLAG_TXRQ
353 } VCAN_CHANNEL_CONFIG;
354
355typedef VCAN_CHANNEL_CONFIG VChannelConfig;
356typedef VCAN_CHANNEL_CONFIG* PVChannelConfig;
357
358
359typedef struct s_vcan_driver_config {
360 char driverName [MAX_DRIVER_NAME + 1];
361 unsigned short driverVersion;
362 void* dispatcher;
363 unsigned char channelCount; // total number of channels
364 VChannelConfig channel[1]; // [channelCount]
365 } VCAN_DRIVER_CONFIG;
366
367typedef VCAN_DRIVER_CONFIG VDriverConfig;
368typedef VCAN_DRIVER_CONFIG* PVDriverConfig;
369
370#define SIZEOF_VDRIVERCONFIG(n) (sizeof(VDriverConfig)+(n-1)*sizeof(VChannelConfig))
371
372/*******************************************************************
373ncdOpenDriver():
374
375The Application calls this function to get access to the driver.
376*/
377#ifdef DYNAMIC_CANDRIVER_DLL
378 typedef Vstatus (_EXPORT_API *NCDOPENDRIVER) (void);
379 extern NCDOPENDRIVER ncdDllOpenDriver;
380 Vstatus ncdOpenDriver();
381#else
382 Vstatus _EXPORT_DECL ncdOpenDriver(void);
383#endif
384
385/********************************************************************
386ncdGetDriverConfig():
387
388The application gets the information, which
389CAN channels are available in the system. The user
390must provide the memory, pChanCount is pointing to
391and the size of pDriverConfig. Passing NULL
392for pDriverConfig only the ChanCount is given back.
393*/
394#ifdef DYNAMIC_CANDRIVER_DLL
395 typedef Vstatus (_EXPORT_API *NCDGETDRIVERCONFIG) (
396 int *pChanCount,
397 VDriverConfig *pDriverConfig
398 );
399 extern NCDGETDRIVERCONFIG ncdGetDriverConfig;
400#else
401 Vstatus _EXPORT_DECL ncdGetDriverConfig(
402 int *pChanCount,
403 VDriverConfig *pDriverConfig
404 );
405#endif
406
407/********************************************************************
408ncdGetChannelIndex():
409ncdGetChannelMask():
410
411Get the channel index for a channel of a certain hardware.
412Parameter -1 means "don't care"
413Result -1 (ncdGetChannelIndex) or 0 (ncdGetChannelMask) means "not found"
414*/
415#ifdef DYNAMIC_CANDRIVER_DLL
416 typedef int (_EXPORT_API *NCDGETCHANNELINDEX) (
417 int hwType, // [-1,HWTYPE_CANCARDX,HWTYPE_VIRTUAL,...]
418 int hwIndex, // [-1,0,1]
419 int hwChannel // [-1,0,1]
420 );
421 extern NCDGETCHANNELINDEX ncdGetChannelIndex;
422
423 typedef Vaccess (_EXPORT_API *NCDGETCHANNELMASK) (
424 int hwType, // [-1,HWTYPE_CANCARDX,HWTYPE_VIRTUAL,...]
425 int hwIndex, // [-1,0,1]
426 int hwChannel // [-1,0,1]
427 );
428 extern NCDGETCHANNELMASK ncdGetChannelMask;
429#else
430 int _EXPORT_DECL ncdGetChannelIndex(
431 int hwType, // [-1,HWTYPE_CANCARDX,HWTYPE_VIRTUAL,...]
432 int hwIndex, // [-1,0,1]
433 int hwChannel // [-1,0,1]
434 );
435
436 Vaccess _EXPORT_DECL ncdGetChannelMask(
437 int hwType, // [-1,HWTYPE_CANCARDX,HWTYPE_VIRTUAL,...]
438 int hwIndex, // [-1,0,1]
439 int hwChannel // [-1,0,1]
440 );
441#endif
442
443
444/********************************************************************
445ncdOpenPort():
446
447The application tells the driver to which channels
448it wants to get access to and which of these channels
449it wants to get the permission to initialize the channel.
450Only one port can get the permission to initialize a channel.
451The permitted init access is returned.
452*/
453#ifdef DYNAMIC_CANDRIVER_DLL
454 typedef Vstatus (_EXPORT_API *NCDOPENPORT) (
455 VportHandle *portHandle,
456 char *userName,
457 Vaccess accessMask,
458 Vaccess initMask,
459 Vaccess *permissionMask,
460 int rxQueueSize
461 );
462 extern NCDOPENPORT ncdOpenPort;
463#else
464 Vstatus _EXPORT_DECL ncdOpenPort(
465 VportHandle *portHandle,
466 char *userName,
467 Vaccess accessMask,
468 Vaccess initMask,
469 Vaccess *permissionMask,
470 int rxQueueSize
471 );
472#endif
473
474/********************************************************************
475ncdSetChannelMode():
476
477For the CAN channels defined by AccessMask is set
478whether the caller will get a TX and/or a TXRQ
479receipt for transmitted messages.
480The port must have init access to the channels.
481*/
482#ifdef DYNAMIC_CANDRIVER_DLL
483 typedef Vstatus (_EXPORT_API *NCDSETCHANNELMODE) (VportHandle portHandle,
484 Vaccess accessMask,
485 int tx,
486 int txrq
487 );
488 extern NCDSETCHANNELMODE ncdSetChannelMode;
489#else
490 Vstatus _EXPORT_DECL ncdSetChannelMode(VportHandle portHandle,
491 Vaccess accessMask,
492 int tx,
493 int txrq
494 );
495#endif
496
497/********************************************************************
498ncdSetChannelOutput():
499
500The output mode for the CAN chips of the channels defined by accessMask, is set
501to OUTPUT_MODE_NORMAL or OUTPUT_MODE_SILENT.
502The port must have init access to the channels.
503*/
504#ifdef DYNAMIC_CANDRIVER_DLL
505 typedef Vstatus (_EXPORT_API *NCDSETCHANNELOUTPUT) (VportHandle portHandle,
506 Vaccess accessMask,
507 int mode
508 );
509 extern NCDSETCHANNELOUTPUT ncdSetChannelOutput;
510#else
511 Vstatus _EXPORT_DECL ncdSetChannelOutput(VportHandle portHandle,
512 Vaccess accessMask,
513 int mode
514 );
515#endif
516
517/********************************************************************
518ncdSetChannelTransceiver():
519
520The transceiver mode for the channels defined by accessMask, is set.
521The port must have init access to the channels.
522*/
523#ifdef DYNAMIC_CANDRIVER_DLL
524 typedef Vstatus (_EXPORT_API *NCDSETCHANNELTRANSCEIVER) (
525 VportHandle portHandle,
526 Vaccess accessMask,
527 int type,
528 int lineMode,
529 int resNet
530 );
531 extern NCDSETCHANNELTRANSCEIVER ncdSetChannelTransceiver;
532#else
533 Vstatus _EXPORT_DECL ncdSetChannelTransceiver(
534 VportHandle portHandle,
535 Vaccess accessMask,
536 int type,
537 int lineMode,
538 int resNet
539 );
540#endif
541
542/********************************************************************
543ncdSetChannelParams():
544ncdSetChannelParamsC200():
545ncdSetChannelBitrate():
546
547The channels defined by accessMask will be initialized with the
548given parameters.
549The port must have init access to the channels.
550*/
551#ifdef DYNAMIC_CANDRIVER_DLL
552 typedef Vstatus (_EXPORT_API *NCDSETCHANNELPARAMS) (VportHandle portHandle,
553 Vaccess accessMask,
554 VchipParams* pChipParams
555 );
556 extern NCDSETCHANNELPARAMS ncdSetChannelParams;
557
558 typedef Vstatus (_EXPORT_API *NCDSETCHANNELPARAMSC200) (VportHandle portHandle,
559 Vaccess accessMask,
560 unsigned char btr0,
561 unsigned char btr1
562 );
563 extern NCDSETCHANNELPARAMSC200 ncdSetChannelParamsC200;
564
565 typedef Vstatus (_EXPORT_API *NCDSETCHANNELBITRATE) (VportHandle portHandle,
566 Vaccess accessMask,
567 unsigned long bitrate
568 );
569 extern NCDSETCHANNELBITRATE ncdSetChannelBitrate;
570
571#else
572 Vstatus _EXPORT_DECL ncdSetChannelParams(VportHandle portHandle,
573 Vaccess accessMask,
574 VchipParams* pChipParams
575 );
576
577 Vstatus _EXPORT_DECL ncdSetChannelParamsC200(VportHandle portHandle,
578 Vaccess accessMask,
579 unsigned char btr0,
580 unsigned char btr1
581 );
582
583 Vstatus _EXPORT_DECL ncdSetChannelBitrate(VportHandle portHandle,
584 Vaccess accessMask,
585 unsigned long bitrate
586 );
587#endif
588
589/********************************************************************
590ncdSetAcceptance():
591
592Set the acceptance filter
593Filters for std and ext ids are handled independant in the driver.
594Use mask=0xFFFF,code=0xFFFF or mask=0xFFFFFFFF,code=0xFFFFFFFF to fully close
595the filter.
596*/
597#ifdef DYNAMIC_CANDRIVER_DLL
598 typedef Vstatus (_EXPORT_API *NCDSETCHANNELACCEPTANCE) (VportHandle portHandle,
599 Vaccess accessMask,
600 VsetAcceptance *filter
601 );
602 extern NCDSETCHANNELACCEPTANCE ncdSetChannelAcceptance;
603#else
604 Vstatus _EXPORT_DECL ncdSetChannelAcceptance(VportHandle portHandle,
605 Vaccess accessMask,
606 VsetAcceptance *filter
607 );
608#endif
609
610/********************************************************************
611ncdSetTimerRate():
612
613The timer of the port will be activated/deacticated and the
614rate for cyclic timer events is set (10us resolution).
615*/
616#ifdef DYNAMIC_CANDRIVER_DLL
617 typedef Vstatus (_EXPORT_API *NCDSETTIMERRATE) (
618 VportHandle portHandle,
619 unsigned long timerRate
620 );
621 extern NCDSETTIMERRATE ncdSetTimerRate;
622#else
623 Vstatus _EXPORT_DECL ncdSetTimerRate(
624 VportHandle portHandle,
625 unsigned long timerRate
626 );
627#endif
628
629/********************************************************************
630ncdResetClock():
631
632The clock generating timestamps for the port will be reset
633*/
634#ifdef DYNAMIC_CANDRIVER_DLL
635 typedef Vstatus (_EXPORT_API *NCDRESETCLOCK) (
636 VportHandle portHandle
637 );
638 extern NCDRESETCLOCK ncdResetClock;
639#else
640 Vstatus _EXPORT_DECL ncdResetClock(
641 VportHandle portHandle
642 );
643#endif
644
645/********************************************************************
646ncdSetNotification():
647
648Setup a event to notify the application if there are messages in the
649ports receive queue.
650queueLevel specifies the number of messages that triggeres the event.
651Note that the event is triggered only once, when the queueLevel is
652reached. An application should read all available messages by ncdReceive
653to be sure to reenable the event.
654*/
655#ifdef DYNAMIC_CANDRIVER_DLL
656 typedef Vstatus (_EXPORT_API *NCDSETNOTIFICATION) (
657 VportHandle portHandle,
658 unsigned long *handle,
659 int queueLevel
660 );
661 extern NCDSETNOTIFICATION ncdSetNotification;
662#else
663 Vstatus _EXPORT_DECL ncdSetNotification(
664 VportHandle portHandle,
665 unsigned long *handle,
666 int queueLevel
667 );
668#endif
669
670/********************************************************************
671ncdTransmit():
672
673A CAN message will be put to the designated channels to be transmitted.
674
675*/
676#ifdef DYNAMIC_CANDRIVER_DLL
677 typedef Vstatus (_EXPORT_API *NCDTRANSMIT) (VportHandle portHandle,
678 Vaccess accessMask,
679 Vevent *pEvent
680 );
681 extern NCDTRANSMIT ncdTransmit;
682#else
683 Vstatus _EXPORT_DECL ncdTransmit(VportHandle portHandle,
684 Vaccess accessMask,
685 Vevent *pEvent
686 );
687#endif
688
689/********************************************************************
690ncdReceive1():
691
692The driver is asked to retrieve a single Events from the
693application's receive queue. This function is optimized
694for speed. It returns a pointer to the received event.
695Lifetime of the data is until the next call of ncdReceive1.
696It returns VERR_QUEUE_IS_EMPTY and *ppEvent=NULL if no event
697is available.
698*/
699#ifdef DYNAMIC_CANDRIVER_DLL
700 typedef Vstatus (_EXPORT_API *NCDRECEIVE1) (VportHandle portHandle,
701 Vevent **ppEvent
702 );
703 extern NCDRECEIVE1 ncdReceive1;
704#else
705 Vstatus _EXPORT_DECL ncdReceive1(VportHandle portHandle,
706 Vevent **ppEvent
707 );
708#endif
709
710/********************************************************************
711ncdReceive():
712
713The driver is asked to retrieve Events from the
714application's receive queue. You can choose wether
715it will be polled or waited for an incoming event.
716Its possible to read multiple events at a time, but the
717caller must provide the memory. In pEventCount the actual
718number of received events will be returned.
719*/
720#ifdef DYNAMIC_CANDRIVER_DLL
721 typedef Vstatus (_EXPORT_API *NCDRECEIVE) (VportHandle portHandle,
722 int receiveMode,
723 unsigned int waitHandle,
724 int *pEventCount,
725 Vevent *pEventList
726 );
727 extern NCDRECEIVE ncdReceive;
728#else
729 Vstatus _EXPORT_DECL ncdReceive(VportHandle portHandle,
730 int receiveMode,
731 unsigned int waitHandle,
732 int *pEventCount,
733 Vevent *pEventList
734 );
735#endif
736
737/********************************************************************
738ncdRequestChipState():
739
740The state of the selected channels is requested.
741The answer will be received as an event (V_CHIP_STATE).
742*/
743#ifdef DYNAMIC_CANDRIVER_DLL
744 typedef Vstatus (_EXPORT_API *NCDREQUESTCHIPSTATE) (VportHandle portHandle,
745 Vaccess accessMask
746 );
747 extern NCDREQUESTCHIPSTATE ncdRequestChipState;
748#else
749 Vstatus _EXPORT_DECL ncdRequestChipState(VportHandle portHandle,
750 Vaccess accessMask
751 );
752#endif
753
754/********************************************************************
755ncdFlushTransmitQueue():
756
757The transmit queue of the selected channel will be flushed.
758*/
759#ifdef DYNAMIC_CANDRIVER_DLL
760 typedef Vstatus (_EXPORT_API *NCDFLUSHTRANSMITQUEUE) (VportHandle portHandle,
761 Vaccess accessMask
762 );
763 extern NCDFLUSHTRANSMITQUEUE ncdFlushTransmitQueue;
764#else
765 Vstatus _EXPORT_DECL ncdFlushTransmitQueue(VportHandle portHandle,
766 Vaccess accessMask
767 );
768#endif
769
770/********************************************************************
771ncdFlushReceiveQueue():
772
773The receive queue of the port will be flushed.
774*/
775#ifdef DYNAMIC_CANDRIVER_DLL
776 typedef Vstatus (_EXPORT_API *NCDFLUSHRECEIVEQUEUE) (VportHandle portHandle);
777 extern NCDFLUSHRECEIVEQUEUE ncdFlushReceiveQueue;
778#else
779 Vstatus _EXPORT_DECL ncdFlushReceiveQueue(VportHandle portHandle);
780#endif
781
782/********************************************************************
783ncdGetReceiveQueueLevel():
784
785The count of event´s in the receive queue of the port will be returned.
786*/
787#ifdef DYNAMIC_CANDRIVER_DLL
788 typedef Vstatus (_EXPORT_API *NCDGETRECEIVEQUEUELEVEL) (VportHandle portHandle,
789 int *level
790 );
791 extern NCDGETRECEIVEQUEUELEVEL ncdGetReceiveQueueLevel;
792#else
793 Vstatus _EXPORT_DECL ncdGetReceiveQueueLevel(VportHandle portHandle,
794 int *level
795 );
796#endif
797
798/********************************************************************
799ncdGetState():
800
801The state of the port is returned.
802*/
803#ifdef DYNAMIC_CANDRIVER_DLL
804 typedef Vstatus (_EXPORT_API *NCDGETSTATE) (VportHandle portHandle);
805 extern NCDGETSTATE ncdGetState;
806#else
807 Vstatus _EXPORT_DECL ncdGetState(VportHandle portHandle);
808#endif
809
810/********************************************************************
811ncdActivateChannel():
812
813The selected channels go 'on the bus'.
814*/
815#ifdef DYNAMIC_CANDRIVER_DLL
816 typedef Vstatus (_EXPORT_API *NCDACTIVATECHANNEL) (VportHandle portHandle,
817 Vaccess accessMask
818 );
819 extern NCDACTIVATECHANNEL ncdActivateChannel;
820#else
821 Vstatus _EXPORT_DECL ncdActivateChannel(VportHandle portHandle,
822 Vaccess accessMask
823 );
824#endif
825
826/********************************************************************
827DeactivateChannel():
828
829The selected channels go 'off the bus'.
830Its now possible to initialize
831*/
832#ifdef DYNAMIC_CANDRIVER_DLL
833 typedef Vstatus (_EXPORT_API *NCDDEACTIVATECHANNEL) (VportHandle portHandle,
834 Vaccess accessMask
835 );
836 extern NCDDEACTIVATECHANNEL ncdDeactivateChannel;
837#else
838 Vstatus _EXPORT_DECL ncdDeactivateChannel(VportHandle portHandle,
839 Vaccess accessMask
840 );
841#endif
842
843/********************************************************************
844ncdClosePort():
845
846The port is closed, channels are deactivated.
847*/
848#ifdef DYNAMIC_CANDRIVER_DLL
849 typedef Vstatus (_EXPORT_API *NCDCLOSEPORT) (VportHandle portHandle);
850 extern NCDCLOSEPORT ncdClosePort;
851#else
852 Vstatus _EXPORT_DECL ncdClosePort(VportHandle portHandle);
853#endif
854
855/********************************************************************
856ncdCloseDriver ():
857
858The driver is closed.
859This is used to unload the driver, if no more application is useing it.
860Does not close the open ports !!!
861*/
862#ifdef DYNAMIC_CANDRIVER_DLL
863 typedef Vstatus (_EXPORT_API *NCDCLOSEDRIVER) (void);
864 extern NCDCLOSEDRIVER ncdDllCloseDriver;
865 Vstatus ncdCloseDriver();
866#else
867 Vstatus _EXPORT_DECL ncdCloseDriver(void);
868#endif
869
870/********************************************************************
871
872ncdGetErrorString()
873ncdGetEventString()
874
875Utility Functions
876*/
877#ifdef DYNAMIC_CANDRIVER_DLL
878 typedef ncdStringType (_EXPORT_API *NCDGETERRORSTRING) ( Vstatus err );
879 typedef ncdStringType (_EXPORT_API *NCDGETEVENTSTRING) ( Vevent *ev );
880 extern NCDGETERRORSTRING ncdGetErrorString;
881 extern NCDGETEVENTSTRING ncdGetEventString;
882#else
883 ncdStringType _EXPORT_DECL ncdGetErrorString( Vstatus err );
884 ncdStringType _EXPORT_DECL ncdGetEventString( Vevent *ev );
885#endif
886
887/********************************************************************
888ncdSetApplConfig():
889ncdGetApplConfig():
890
891Handle the application configuration for VCANCONF.EXE
892*/
893
894/*
895Returns the hwIndex, hwChannel and hwType for a specific Application and application channel.
896This gives the ability to register own applications into the Vector
897CAN DRIVER CONFIGURATION.
898AppName: Zero terminated string containing the Name of the Application.
899AppChannel: Channel of the application
900hwType, hwIndex, hwChannel: contains the the hardware information on success.
901This values can be used in a subsequent call to ncdGetChannelMask or ncdGetChannelIndex.
902*/
903#ifdef DYNAMIC_CANDRIVER_DLL
904 typedef Vstatus (_EXPORT_API *NCDGETAPPLCONFIG) (
905 char *appName, // Name of Application
906 int appChannel, // 0,1
907 int *hwType, // HWTYPE_xxxx
908 int *hwIndex, // Index of the hardware (slot) (0,1,...)
909 int *hwChannel // Index of the channel (connector) (0,1,...)
910 );
911 extern NCDGETAPPLCONFIG ncdGetApplConfig;
912/*
913Corresponding to ncdGetApplConfig this function sets the application
914configuration, but it can also done in the CAN DRIVER CONFIGURATION.
915If the application name does not exist, a new one is generated.
916*/
917 typedef Vstatus (_EXPORT_API *NCDSETAPPLCONFIG) (
918 char *appName, // Name of Application
919 int appChannel, // 0,1
920 int hwType, // HWTYPE_xxxx
921 int hwIndex, // Index of the hardware (slot) (0,1,...)
922 int hwChannel // Index of the channel (connector) (0,1,...)
923 );
924 extern NCDSETAPPLCONFIG ncdSetApplConfig;
925
926/*Get version information if available */
927 typedef Vstatus (_EXPORT_API *NCDGETCHANNELVERSION) (
928 unsigned long ChannelIndex, // Global channel index (0,1,...)
929 unsigned long *FwVersion, // Firmware Version
930 unsigned long *HwVersion, // Hardware Version
931 unsigned long *SerialNumber // Hardware Serial Number
932 );
933 extern NCDGETCHANNELVERSION ncdGetChannelVersion;
934
935/*Suppress Error Frames and ChipState Events */
936 typedef Vstatus (_EXPORT_API *NCDSETRECEIVEMODE) (
937 VportHandle Port, // Port Handle
938 unsigned char ErrorFrame, // suppress Error Frames
939 unsigned char ChipState // suppress Chip States
940 );
941 extern NCDSETRECEIVEMODE ncdSetReceiveMode;
942#else
943 Vstatus _EXPORT_DECL ncdGetApplConfig(
944 char *appName, // Name of Application
945 int appChannel, // 0,1
946 int *hwType, // HWTYPE_xxxx
947 int *hwIndex, // Index of the hardware (slot) (0,1,...)
948 int *hwChannel // Index of the channel (connector) (0,1,...)
949 );
950
951 Vstatus _EXPORT_DECL ncdSetApplConfig(
952 char *appName, // Name of Application
953 int appChannel, // 0,1
954 int hwType, // HWTYPE_xxxx
955 int hwIndex, // Index of the hardware (slot) (0,1,...)
956 int hwChannel // Index of the channel (connector) (0,1,...)
957 );
958
959 /*Get version information if available */
960 Vstatus _EXPORT_DECL ncdGetChannelVersion(
961 unsigned long ChannelIndex, // Global channel index (0,1,...)
962 unsigned long *FwVersion, // Firmware Version
963 unsigned long *HwVersion, // Hardware Version
964 unsigned long *SerialNumber // Hardware Serial Number
965 );
966
967 /*Suppress Error Frames and ChipState Events */
968 Vstatus _EXPORT_DECL ncdSetReceiveMode(
969 VportHandle Port, // Port Handle
970 unsigned char ErrorFrame, // suppress Error Frames
971 unsigned char ChipState // suppress Chip States
972 );
973#endif
974
975
976#ifdef DYNAMIC_CANDRIVER_DLL
977 typedef Vstatus (_EXPORT_API *NCDADDACCEPTANCERANGE)(VportHandle portHandle,
978 Vaccess accessMask,
979 unsigned long first_id,
980 unsigned long last_id
981 );
982 extern NCDADDACCEPTANCERANGE ncdAddAcceptanceRange;
983
984 typedef Vstatus (_EXPORT_API *NCDREMOVEACCEPTANCERANGE)(VportHandle portHandle,
985 Vaccess accessMask,
986 unsigned long first_id,
987 unsigned long last_id
988 );
989 extern NCDREMOVEACCEPTANCERANGE ncdRemoveAcceptanceRange;
990
991 typedef Vstatus (_EXPORT_API *NCDRESETACCEPTANCE)(VportHandle portHandle,
992 Vaccess accessMask,
993 int extended
994 );
995 extern NCDRESETACCEPTANCE ncdResetAcceptance;
996#else
997 Vstatus _EXPORT_DECL ncdAddAcceptanceRange(VportHandle portHandle,
998 Vaccess accessMask,
999 unsigned long first_id,
1000 unsigned long last_id
1001 );
1002
1003 Vstatus _EXPORT_DECL ncdRemoveAcceptanceRange(VportHandle portHandle,
1004 Vaccess accessMask,
1005 unsigned long first_id,
1006 unsigned long last_id
1007 );
1008
1009 Vstatus _EXPORT_DECL ncdResetAcceptance(VportHandle portHandle,
1010 Vaccess accessMask,
1011 int extended
1012 );
1013#endif
1014
1015
1016
1017#include <poppack.h>
1018
1019#ifdef __cplusplus
1020}
1021#endif // _cplusplus
1022
1023#endif
Note: See TracBrowser for help on using the repository browser.