source: pacpussensors/trunk/CanGateway/driver/CanL2.h@ 139

Last change on this file since 139 was 86, checked in by phudelai, 9 years ago

Socket:

  • Despecialisation de PacpusUDPSocket (anciennement spécialisée Airplug)
  • Ajout d'une classe UDPSocket

CanDriver:

  • Préparation au code du driver CAN Softing
  • Ajout des libs pour la compilation
File size: 30.9 KB
Line 
1/****************************************************************************/
2/* */
3/* Softing Automation GmbH Richard-Reitzner-Allee 6 85540 Haar */
4/* */
5/****************************************************************************/
6/* */
7/* Copyright (c) Softing Industrial Automation GmbH, All rights reserved. */
8/* */
9/****************************************************************************/
10/* */
11/* C A N L 2 . H */
12/* */
13/****************************************************************************/
14/* */
15/* MODULE_DESCRIPTION CANL2.H */
16/* VERSION 5 */
17/* DATE 01.04.2012 */
18/* include file for CAN Layer 2 Library */
19/* function prototypes and return codes */
20/* */
21/****************************************************************************/
22#ifndef _CANL2_H
23#define _CANL2_H
24
25
26#if defined (WIN16) || defined (DOS)
27#ifndef noUnicode
28#define TCHAR char
29#define _tcscpy strcpy
30#define _tcsncpy strncpy
31#define _stprintf sprintf
32#define _tcslen strlen
33#define _tcscat strcat
34#define _tcscmp strcmp
35#define _T(wert) wert
36#define _tprintf printf
37#define noUnicode
38#endif
39#endif
40
41//#define CAN_HANDLE unsigned long
42typedef unsigned long CAN_HANDLE;
43
44
45/* ---- CAN chip-types -----------------------------------------------------*/
46#define NEC005_CHIP 5
47#define TWINCAN_CHIP 161
48#define MULTICAN_CHIP 164
49#define SJA1000_CHIP 1000
50
51
52/* ---- Softing CAN Devices ----------------------------------------*/
53
54#define D_CANCARD2 0x00000005L
55#define D_EDICCARDC 0x00000102L
56#define D_EDICCARD2 0x00000105L
57#define D_CANACPCI 0x00000007L
58#define D_CANACPCIDN 0x00000008L
59#define D_CANAC104 0x00000009L
60#define D_CANUSB 0x0000000AL
61#define D_CANECO104 0x0000000CL
62#define D_CANPROXPCIE 0x0000000DL
63#define D_CANPROX104 0x0000000EL
64#define D_CANPROUSB 0x0000000FL
65#define D_CANFANUPC8 0x00008000L
66#define D_FG100CAN 0x10000000L
67
68
69// get the value from Softing CAN Interface Manager
70#define GET_FROM_SCIM -1
71
72
73
74#pragma pack(push, 1) /* pack alignment must be one */
75
76#ifndef CANL2_EXPORTS
77// description of on CAN channel
78// used for the API Function call CANL2_get_all_CAN_channels
79#define MAXLENCHNAME 80
80typedef struct
81{
82 ULONG u32Serial; // Serialnumber
83 ULONG u32DeviceType; // device type
84 ULONG u32PhysCh; // physical channel number (1 or 2)
85 ULONG u32FwId; // id of the loaded firmware
86 BOOLEAN bIsOpen; // TRUE if opened by a process
87 char ChannelName[MAXLENCHNAME];
88
89
90} CHDSNAPSHOT, *PCHDSNAPSHOT;
91
92#endif
93
94
95// this structure is used for CANL2_read_ac()
96
97typedef struct {
98 unsigned long Ident; /* CAN Identifier*/
99 int DataLength; /*number of data bytes in the CAN message*/
100 int RecOverrun_flag; /*if this is true in object buffer it signals an receive overrun, used only in object buffer*/
101 int RCV_fifo_lost_msg; /*number of messages lost, used only in FIFO Mode*/
102 unsigned char RCV_data[8]; /*CAN data bytes*/
103 int AckOverrun_flag; /*if this is true in object buffer it signals an ACK overrun, used only in object buffer*/
104 int XMT_ack_fifo_lost_acks; /*number of lost ACK - object buffer only*/
105 int XMT_rmt_fifo_lost_remotes; /*number of lost remote frames - object buffer only*/
106 int Bus_state; /*CAN bus state (ERROR ACTIVE, ERROR PASSIVE or BUS OFF*/
107 int Error_state; /* meaning depends on the platform, see CANL2_read_ac() */
108 int Can; /*CAN channel handle*/
109 unsigned long Time; /*Timestamp*/
110 } PARAM_STRUCT;
111
112// used together with CANL2_initialize_fifo_mode()
113typedef struct
114{
115 double fBaudrate; /*baudrate*/
116 long s32Prescaler; /* prescaler*/
117 long s32Tseg1; /* time segment 1*/
118 long s32Tseg2; /*time segment 2*/
119 long s32Sjw; /* SJW*/
120 long s32Sam; /* samples */
121 long s32AccCodeStd; /* acceptance code for 11 bit identifier */
122 long s32AccMaskStd; /* acceptance mask for 11 bit identifier */
123 long s32AccCodeXtd; /* acceptance code for 29 bit identifier */
124 long s32AccMaskXtd; /* acceptance mask for 29 bit identifier */
125 long s32OutputCtrl; /* output control register */
126 BOOL bEnableAck; /* enable receiving of ACK */
127 BOOL bEnableErrorframe; /* enable receiving of error frames*/
128 HANDLE hEvent; /* Windows event: set in case of an CAN event */
129} L2CONFIG;
130
131/*
132typedef struct canl2_ch_s {
133 CAN_HANDLE ulChannelHandle;
134 unsigned char sChannelName[80];
135} CANL2_CH_STRUCT;
136*/
137
138// used for custom led control
139typedef struct
140{
141 unsigned char live_time; // number of 200ms ticks
142 BOOL is_led_on; // should the led be on or off for the live time?
143
144} LED_SUBSTATE;
145
146typedef struct
147{
148 unsigned short number_of_substates; // the led states will be set cyclicaly: after the last state the system starts with the first state.
149
150 LED_SUBSTATE substate[15];
151
152} LED_FEATURE;
153
154
155#pragma pack(pop) /* reset pack alignment to prev. value */
156
157#ifndef _ERROR_BASES_
158#define _ERROR_BASES_
159
160#define INFORMATIONAL_BASE (0x60000000)
161#define WARNING_BASE (0xA0000000)
162#define ERROR_BASE (0xE0000000)
163
164#endif
165
166#define L2_ERROR_BASE (0x000B0000)
167#define VCARD_ERROR_BASE (0x000A0000)
168
169
170#define MK_VCARD_ERROR_CODE(VCARD_ERROR) ((VCARD_ERROR) ? (VCARD_ERROR_BASE | ERROR_BASE | VCARD_ERROR) : 0)
171
172
173 /////////////////////////////////////////////////////////////////////////////
174 // VCARD ERROR CODES (Error codes from kernelmode driver)
175 //
176#ifndef CANL2_EXPORTS
177
178#define VCARD_OK 0 // success
179#define VCARD_INTERNALERROR 0xE00A0001 // internal Error
180#define VCARD_GENERALERROR 0xE00A0002 // general Error
181#define VCARD_TIMEOUT 0xE00A0003 // Timeout
182#define VCARD_IOPENDING 0xE00A0004 // pending driver call
183#define VCARD_IOCANCELLED 0xE00A0005 // driver call was canceled
184#define VCARD_ILLEGALCALL 0xE00A0006 // illegal driver call
185#define VCARD_NOTSUPPORTED 0xE00A0007 // not implemented
186#define VCARD_VERSIONERROR 0xE00A0008 // driver interface dll has the wrong version
187#define VCARD_DRIVERVERSIONERROR 0xE00A0009 // wrong driver version
188#define VCARD_DRIVERNOTFOUND 0xE00A000A // driver not loaded / not installed, or device is not plugged
189#define VCARD_NOTENOUGHMEMORY 0xE00A000B // out of memory
190#define VCARD_TOOMANYDEVICES 0xE00A000C // driver can not handle as much devices
191#define VCARD_UNKNOWNDEVICE 0xE00A000D // unknown device
192#define VCARD_DEVICEALREADYEXISTS 0xE00A000E // device already exists
193#define VCARD_DEVICEACCESSERROR 0xE00A000F // access is not possible: device is already open
194#define VCARD_RESOURCEALREADYREGISTERED 0xE00A0010 // ressorce is in use by an other device
195#define VCARD_RESOURCECONFLICT 0xE00A0011 // ressorce conflict
196#define VCARD_RESOURCEACCESSERROR 0xE00A0012 // ressorce can not be accessed
197#define VCARD_PHYSMEMORYOVERRUN 0xE00A0013 // ungueltiger Zugriff auf physikalischen Speicher
198#define VCARD_TOOMANYPORTS 0xE00A0014 // zu viele I/O Ports 20
199#define VCARD_INTERRUPTERROR 0xE00A0015 // error while activating the interrupt
200#define VCARD_UNKNOWNRESOURCE 0xE00A0016 // unknown ressorce
201#define VCARD_CREATEDEVFAILED 0xE00A0017 // IoCreateDevice failed
202#define VCARD_ATTACHTODEVSTACKFAILED 0xE00A0018 // IoAttachDeviceToDeviceStack failed
203#define VCARD_SYMBOLICLINKFAILED 0xE00A0019 // failed to create a symbolic link
204 //////////////////////////////////////////////////////////////////////
205 /// Errors which can occur while downloading the firmware
206 //////////////////////////////////////////////////////////////////////
207#define VCARD_NOCARDSERVICES 0xE00A001A // can not access card services under Win '98
208#define VCARD_CARDSERVICESVERSION 0xE00A001B // wrong version of the card services under Win '98
209#define VCARD_CARDSERVICESGETINFO 0xE00A001C // error while accessing the card services under Win '98
210#define VCARD_DEVICENOTFOUND 0xE00A001D // device not found.
211#define VCARD_NODPRAM 0xE00A001E // can not get a free address region for DPRAM from system
212#define VCARD_CONTROLHWERROR 0xE00A001F // Error while accessing hardware
213#define VCARD_SBNCHECKSUM 0xE00A0020 // Checksum error in SBN format (dll binary may be corrupt)
214#define VCARD_DPRAMACCESS 0xE00A0021 // can not access the DPRAM memory
215#define VCARD_CARDREACTION 0xE00A0022 // Loader program for firmware download does no more react.
216#define VCARD_NOSTARTADDRESS 0xE00A0023 // No startaddress defined in SBN (dll binary may be corrupt)
217#define VCARD_NOINTERRUPT 0xE00A0024 // Interrupt does not work
218 //////////////////////////////////////////////////////////////////////
219 /// Errors which can occur in the channel driver
220 //////////////////////////////////////////////////////////////////////
221
222#define VCARD_DRIVERNOTPRESENT 0xE00A0025 // Kernelmode driver is not loaded
223#define VCARD_DEVICEISOPEN 0xE00A0026 // Device is already open
224#define VCARD_DEVICELOCKINGERROR 0xE00A0027 // Device can not be locked
225#define VCARD_OTHERFWISLOADED 0xE00A0028 // A other firmware is running on that device (CANalyzer/CANopen/DeviceNet firmware)
226#define VCARD_CHANNELNOTOPEN 0xE00A0029 // channel can not be accessed, because it is not open.
227
228 //////////////////////////////////////////////////////////////////////
229 /// status codes for CANusb Device Driver canusbw.sys
230 //////////////////////////////////////////////////////////////////////
231
232#define VCARD_PNPCALLERROR 0xE00A002A // lower driver call in PnP process fails
233#define VCARD_URBRETERROR 0xE00A002B // URB returns USBD_ERROR code
234#define VCARD_ERRORDEVICEDESC 0xE00A002C // faulty device desc or read failed
235#define VCARD_ERRORCONFIGDESC 0xE00A002D // faulty config desc or read failed
236#define VCARD_ERRORSELECTCONFIG 0xE00A002E // unable to select configuration
237#define VCARD_ERRORDECONFIG 0xE00A002F // unable to deconfigure the device
238#define VCARD_PIPEACCESSERROR 0xE00A0030 // unable to open usb pipe
239#define VCARD_COMMUNICATIONBROKEN 0xE00A0031 // communication via usb pipe broken off
240
241 //////////////////////////////////////////////////////////////////////
242 /// Errors which can occur in the canchd.dll
243 //////////////////////////////////////////////////////////////////////
244#define VCARD_FILENOTFOUND 0xE00A0032 // file not found
245#define VCARD_ACCESSRIGHT 0xE00A0033
246
247#define VCARD_OSERROR 0xE00A0034 // error in OS call
248#define VCARD_DEVICEIDMISMATCH 0xE00A0035 // wrong device id stored in registry
249#define VCARD_MAXNUMOFCHANNELSOPEN 0xE00A0036 // the maximum number of channels are open
250#define VCARD_INVALIDHANDLE 0xE00A0037 // a invalid handle is specified
251
252#endif
253
254/* ---- FUNCTION PROTOTYPES AND FUNCTION RETURN VALUES --------------------*/
255/* default return values -- valid for all functions (if no other value is
256 described) */
257/* default return values -- valid for all functions */
258
259#define CANL2_OK 0 /* function successful */
260#define CANL2_ERR -1 /* function not successful */
261#define CANL2_BOARD_NOT_INITIALIZED -99 /* board not initialized:
262 INIL2_initialize_channel(.)
263 was not yet called, or a
264 INIL2_close_board was done */
265#define CANL2_INVALID_CHANNEL_HANDLE -1000 /* the channel handle is invalid */
266#define CANL2_TOO_MANY_CHANNELS -1002 /* no free channel available */
267#define CANL2_VERSION_CONFLICT -1003 /* wrong dll or driver version */
268#define CANL2_FIRMWARE_DOWNLOAD -1004 /* error while loading the firmware
269 may be a DPRAM access error. */
270
271#define CANL2_CAN_NOT_LOAD_CANUSBDLL -1005 /* the canusbm.dll can not be found/loaded */
272
273
274#define INIL2_FW_FILE_NOT_FOUND -2000 /* firmware file not found */
275#define INIL2_ERROR_WHILE_FLASHING -2001 /* flashing error */
276
277
278
279
280
281/* ---- CANusb return values */
282
283#define FRW_ERROR_PIPEACCESS_ERROR -602 /* unable to open usb pipe */
284#define FRW_ERROR_COMMUNICATIONBROKEN -603 /* communication via usb pipe
285 broken */
286#define FRW_ERR_NOVALID_LUPT_ENTRY -604 /* no valid lookup table entry
287 chosen */
288
289/* ---- INIL2_initialize_board -------------------------------------------*/
290
291/* -- CANusb return values */
292#define FRW_IF_ERR_FRWINIT_FAILED -611 /* CANusb Framework
293 initialization failed */
294
295#define CANL2_LIC_ERR -101
296#define CANL2_WRONG_PARAM -102 // error in a parameter value
297#define CANL2_FW_TIMEOUT -104 // timout while communicating with the firmware
298#define CANL2_HW_ERR -108 // firmware runs on the wrong hardware
299#define CANL2_DC_NO_DYN_OBJBUF -109 // no object dyn. buffer
300#define CANL2_REQ_PENDING -110 // last request pending
301
302#define CANL2_DATA_OVR -111 // receive data overrun
303#define CANL2_REMOTE_OVR -112 // rec. rem. frame overrun
304#define CANL2_NOT_ACTIVE -113 // object not active
305#define CANL2_RXD_XMT_OVR -114 // transmit ack. overrun
306#define CANL2_OB_NOT_DEFINED -115 // object not defined
307#define CANL2_XMT_REQ_OVR -116 // xmt request fifo overrun
308#define CANL2_NOT_IMPLEMENTED -117 // not supported for this device
309
310#define FRW_ERR_GDI_OLDSFW -614 /* flash content out of date */
311
312#define ERROR_LINKING_FCT -701 /* DLL is not compatible (canusbm.dll) */
313#define ERROR_LINKING_DLL -702 /* DLL not found (canusbm.dll)*/
314
315
316
317PRAEDEF int MIDDEF INIL2_initialize_channel(CAN_HANDLE *pu32ChannelHandle, char *pChannelName);
318#define INIL2_IB_ERR_VC_NOTENOUGHMEMORY 0xFE0B /* not enough memory */
319
320#ifdef WIN32
321// +--- CANL2_set_interrupt_event ------------------------------------------
322PRAEDEF int MIDDEF CANL2_set_interrupt_event(CAN_HANDLE Can, HANDLE hEvent);
323
324// +--- CANL2_set_interrupt_event_name -------------------------------------
325PRAEDEF int MIDDEF CANL2_set_interrupt_event_name(CAN_HANDLE Can, TCHAR *eventName);
326#endif
327// +--- CANL2_reset_chip -------------------------------------------
328PRAEDEF int MIDDEF CANL2_reset_chip(CAN_HANDLE Can);
329
330
331// +--- CANL2_initialize_chip(CAN_HANDLE Can, 2) -------------------------------------------
332// Error codes
333//CANL2_II_REA_CONFLICT Parameter conflict:
334
335PRAEDEF int MIDDEF CANL2_initialize_chip (CAN_HANDLE Can, int presc,
336 int sjw,
337 int tseg1,
338 int tseg2,
339 int sam);
340
341
342
343
344/* +--- CANL2_set_acceptance(CAN_HANDLE Can, 2) ------------------------------------------- */
345PRAEDEF int MIDDEF CANL2_set_acceptance (CAN_HANDLE Can, unsigned int AccCodeStd,
346 unsigned int AccMaskStd,
347 unsigned long AccCodeXtd,
348 unsigned long AccMaskXtd);
349
350/* +--- CANL2_set_output_control(CAN_HANDLE Can, 2) --------------------------------------- */
351PRAEDEF int MIDDEF CANL2_set_output_control (CAN_HANDLE Can, int OutputControl);
352
353
354// +--- CANL2_initialize_interface ---------------------------------------
355// Error codes
356//CANL2_II_REA_CONFLICT Parameter conflict:
357 // ReceiveEnableAll with dyn.
358 // obj. buffer or fifo mode
359
360PRAEDEF int MIDDEF CANL2_initialize_interface(CAN_HANDLE Can, int ReceiveFifoEnable,
361 int ReceivePollAll,
362 int ReceiveEnableAll,
363 int ReceiveIntEnableAll,
364 int AutoRemoteEnable,
365 int TransmitReqFifoEnable,
366 int TransmitPollAll,
367 int TransmitAckEnableAll,
368 int TransmitAckFifoEnable,
369 int TransmitRmtFifoEnable);
370
371// +--- CANL2_define_object(CAN_HANDLE Can, 2) ------------------------------------
372#define CANL2_DO_PARAM_ERR -1 // Parameter error
373#define CANL2_DO_NO_DYNOBJ -2 // dyn. obj. buf. not enabled
374#define CANL2_DO_TOO_MANY_OBJECTS -6 // too many objects defined
375
376PRAEDEF int MIDDEF CANL2_define_object (CAN_HANDLE Can, unsigned long Handle,
377 int FAR * ObjectNumber,
378 int Type,
379 int ReceiveIntEnable,
380 int AutoRemoteEnable,
381 int TransmitAckEnable);
382
383
384// +--- CANL2_define_cyclic(CAN_HANDLE Can, 2) --------------------------------------
385#define CANL2_DC_INVLD_OBJ_NR -1 // invalid object number
386
387PRAEDEF int MIDDEF CANL2_define_cyclic (CAN_HANDLE Can, int ObjectNumber,
388 unsigned int Rate,
389 unsigned int Cycles);
390
391
392// +--- CANL2_set_rcv_fifo_size ---------------------------------------
393//#define CANL2_SRFS_PARAM_ERR -1 // Parameter error
394
395#define CANL2_SRFS_NO_FIFO_MODE -2 // no fifo mode enabled
396
397PRAEDEF int MIDDEF CANL2_set_rcv_fifo_size(CAN_HANDLE Can, int FifoSize);
398
399
400// +--- CANL2_enable_fifo ---------------------------------------
401
402#define CANL2_WRONG_MODE -1001
403PRAEDEF int MIDDEF CANL2_enable_fifo(CAN_HANDLE Can);
404
405// +--- CANL2_optimize_rcv_speed ---------------------------------------
406// this function has no effect on the CANcard
407#define CANL2_ORS_PARAM_ERR -1 // Parameter error
408
409
410// +--- CANL2_enable_dyn_obj_buf ---------------------------------------
411
412PRAEDEF int MIDDEF CANL2_enable_dyn_obj_buf(CAN_HANDLE Can);
413
414// +--- CANL2_enable_fifo_transmit_ack ------------------------------------
415
416PRAEDEF int MIDDEF CANL2_enable_fifo_transmit_ack (CAN_HANDLE Can);
417
418
419PRAEDEF int MIDDEF CANL2_initialize_fifo_mode(CAN_HANDLE Can, L2CONFIG *pUserCfg);
420
421
422PRAEDEF int MIDDEF CANL2_get_all_CAN_channels(unsigned long u32ProvidedBufferSize,
423 unsigned long *pu32NeededBufferSize,
424 unsigned long *pu32NumOfChannels,
425 CHDSNAPSHOT *pBuffer);
426
427
428// +--- CANL2_get_version ---------------------------------------
429// the parameter hw_version is not used with the CAN-AC2
430
431PRAEDEF int MIDDEF CANL2_get_version(CAN_HANDLE Can, int FAR * sw_version,
432 int FAR * fw_version,
433 int FAR * hw_version,
434 int FAR * license,
435 int FAR * can_chip_type);
436
437// +--- CANL2_get_serial_number ---------------------------------------
438// this function has no effect on the CAN-AC2
439
440PRAEDEF int MIDDEF CANL2_get_serial_number(CAN_HANDLE Can, unsigned long FAR * ser_number);
441
442// +--- CANL2_start_chip ---------------------------------------
443// -- CANusb return values
444#define FRW_IOE_ERR_NOTENOUGHMEMORY -612 // not enough memory
445#define FRW_IOE_ERR_INITFAILED -613 // failed to initialize FRWOrder/Event
446
447PRAEDEF int MIDDEF CANL2_start_chip(CAN_HANDLE Can);
448
449// +--- CANL2_send_remote_object(CAN_HANDLE Can, 2) ---------------------------------------
450#define CANL2_SRO_PEND -1 // last request still pending
451#define CANL2_SRO_TX_FIFO_FULL -3 // transmit fifo full
452
453PRAEDEF int MIDDEF CANL2_send_remote_object (CAN_HANDLE Can, int ObjectNumber,
454 int DataLength);
455
456
457// +--- CANL2_supply_object_data(CAN_HANDLE Can, 2) ---------------------------------------
458#define CANL2_SOD_REQ_OVR -1 // request overrun
459
460PRAEDEF int MIDDEF CANL2_supply_object_data (CAN_HANDLE Can, int ObjectNumber,
461 int DataLength,
462 unsigned char FAR * pData);
463
464
465// +--- CANL2_supply_rcv_object_data(CAN_HANDLE Can, 2)-------------------------------------
466
467PRAEDEF int MIDDEF CANL2_supply_rcv_object_data (CAN_HANDLE Can, int ObjectNumber,
468 int DataLength,
469 unsigned char FAR * pData);
470
471
472// +--- CANL2_send_object(CAN_HANDLE Can, 2) ---------------------------------------
473
474PRAEDEF int MIDDEF CANL2_send_object (CAN_HANDLE Can, int ObjectNumber,
475 int DataLength);
476
477// +--- CANL2_write_object(CAN_HANDLE Can, 2) ---------------------------------------
478
479PRAEDEF int MIDDEF CANL2_write_object (CAN_HANDLE Can, int ObjectNumber,
480 int DataLength,
481 unsigned char FAR * pData);
482
483
484
485
486// +--- CANL2_read_rcv_data(CAN_HANDLE Can, 2) ---------------------------------------
487#define CANL2_RRD_DATAFRAME 1 // data frame received
488#define CANL2_RRD_REMOTEFRAME 2 // remote frame received
489
490
491PRAEDEF int MIDDEF CANL2_read_rcv_data (CAN_HANDLE Can, int ObjectNumber,
492 unsigned char FAR * pRCV_Data,
493 unsigned long FAR * Time);
494
495
496
497// +--- CANL2_read_xmt_data(CAN_HANDLE Can, 2) ---------------------------------------
498#define CANL2_RXD_NO_DATA 0 // no message was transmitted
499#define CANL2_RXD_DATAFRAME 1 // message was transmitted
500#define CANL2_RXD_NO_DYN_OBJBUF -3 // no dyn. obj-buffer enabled
501 // (only CAN-AC2/527)
502
503PRAEDEF int MIDDEF CANL2_read_xmt_data (CAN_HANDLE Can, int ObjectNumber,
504 int FAR * pDataLength,
505 unsigned char FAR * pXMT_Data);
506
507
508
509// +--- CANL2_read_ac ---------------------------------------*/
510#define CANL2_RA_NO_DATA 0 // no new data received */
511#define CANL2_RA_DATAFRAME 1 // std. data frame received */
512#define CANL2_RA_REMOTEFRAME 2 // std. remote frame received */
513#define CANL2_RA_TX_DATAFRAME 3 // transmission of std. data-
514 // frame is confirmed */
515#define CANL2_RA_TX_FIFO_OVR 4 // remote tx fifo overrun */
516#define CANL2_RA_CHG_BUS_STATE 5 // change of bus status */
517#define CANL2_RA_ERR_ADD 7 // additional error causes */
518#define CANL2_RA_TX_REMOTEFRAME 8 // transmission of std. data-
519 // frame is confirmed */
520#define CANL2_RA_XTD_DATAFRAME 9 // xtd. data frame received */
521#define CANL2_RA_XTD_TX_DATAFRAME 10 // transmission of xtd. data-
522 // frame is confirmed */
523#define CANL2_RA_XTD_TX_REMOTEFRAME 11 // transmission of xtd. remote-
524 // frame is confirmed */
525#define CANL2_RA_XTD_REMOTEFRAME 12 // xtd. remote frame received
526 // (only CANcard) */
527#define CANL2_RA_ERRORFRAME 15 // error frame detected
528 // (only CANcard) */
529
530PRAEDEF int MIDDEF CANL2_read_ac(CAN_HANDLE Can, PARAM_STRUCT* param);
531
532// +--- CANL2_send_data ---------------------------------------*/
533#define CANL2_SD_FIFO_FULL -1 // transmit fifo full */
534#define CANL2_SD_PARAM -11 // wrong parameter
535
536PRAEDEF int MIDDEF CANL2_send_data (CAN_HANDLE Can, unsigned long Ident,
537 int Xtd,
538 int DataLength,
539 unsigned char* pData);
540
541
542
543/* +--- CANL2_send_remote ---------------------------------------*/
544#define CANL2_SR_FIFO_FULL -1 /* transmit fifo full */
545
546
547PRAEDEF int MIDDEF CANL2_send_remote (CAN_HANDLE Can, unsigned long Ident,
548 int Xtd,
549 int DataLength);
550
551
552
553/* +--- CANL2_get_trigger(CAN_HANDLE Can, 2) ---------------------------------------*/
554/* these functions have no effect on the CANcard */
555PRAEDEF int MIDDEF CANL2_get_trigger (CAN_HANDLE Can, int FAR * level);
556
557PRAEDEF int MIDDEF CANL2_get_trigger2(CAN_HANDLE Can, int FAR * level);
558
559/* +--- CANL2_set_trigger ---------------------------------------*/
560#define CANL2_ST_FIFO_FULL -1 /* transmit fifo full */
561
562PRAEDEF int MIDDEF CANL2_set_trigger (CAN_HANDLE Can, int level);
563
564
565/* +--- CANL2_reinitialize ---------------------------------------*/
566PRAEDEF int MIDDEF CANL2_reinitialize(CAN_HANDLE Can);
567
568/* +--- CANL2_get_time ---------------------------------------*/
569PRAEDEF int MIDDEF CANL2_get_time(CAN_HANDLE Can, unsigned long FAR * time);
570
571/* +--- CANL2_get_bus_state ---------------------------------------*/
572#define CANL2_GBS_ERROR_ACTIVE 0 /* error active */
573#define CANL2_GBS_ERROR_PASSIVE 1 /* error passive */
574#define CANL2_GBS_ERROR_BUS_OFF 2 /* bus off */
575
576PRAEDEF int MIDDEF CANL2_get_bus_state(CAN_HANDLE Can);
577
578
579/* +--- CANL2_reset_rcv_fifo ---------------------------------------*/
580PRAEDEF int MIDDEF CANL2_reset_rcv_fifo(CAN_HANDLE Can);
581
582/* +--- CANL2_reset_xmt_fifo ---------------------------------------*/
583PRAEDEF int MIDDEF CANL2_reset_xmt_fifo(CAN_HANDLE Can);
584
585/* +--- CANL2_reset_lost_msg_counter --------------------------------------*/
586PRAEDEF int MIDDEF CANL2_reset_lost_msg_counter(CAN_HANDLE Can);
587
588/* +--- CANL2_read_rcv_fifo_level ---------------------------------------*/
589/* returns number of items in receive fifo */
590PRAEDEF int MIDDEF CANL2_read_rcv_fifo_level(CAN_HANDLE Can);
591
592/* +--- CANL2_read_xmt_fifo_level ---------------------------------------*/
593/* returns number of items in transmit fifo */
594PRAEDEF int MIDDEF CANL2_read_xmt_fifo_level(CAN_HANDLE Can);
595
596/* +--- CANL2_set_path ---------------------------------------*/
597#define CANL2_SP_STRING_TOO_LONG -1 /* path string too long */
598PRAEDEF int MIDDEF CANL2_set_path(CAN_HANDLE Can, TCHAR FAR * path);
599
600/* +--- INIL2_close_board ---------------------------------------*/
601PRAEDEF int MIDDEF INIL2_close_channel(CAN_HANDLE Can);
602#define INIL2_CB_ERR -1 /* error unlocking rerssources*/
603
604/* +--- CANL2_enable_error_frame_detection --------------------------------*/
605/* this function has no effect on the CAN-AC2 */
606PRAEDEF int MIDDEF CANL2_enable_error_frame_detection(CAN_HANDLE Can);
607
608/* +--- CANL2_get_device_id -----------------------------------------------*/
609/* this function has no effect on the CAN-AC2 */
610PRAEDEF int MIDDEF CANL2_get_device_id(CAN_HANDLE Can, unsigned long *pulDeviceId);
611
612/* +--- CANL2_init_signals/CANL2_read_signals/CANL2_write_signals */
613/* these functions are only available on the CAN-ACx-PCI. They are designed */
614/* for use with the CAN-ACx-PCI and piggy-back boards. These functions are */
615/* not in the standard users manual. For description read the piggy-back */
616/* manuals */
617PRAEDEF int MIDDEF CANL2_init_signals (CAN_HANDLE Can, unsigned long ulChannelDirectionMask,
618 unsigned long ulChannelOutputDefaults);
619
620PRAEDEF int MIDDEF CANL2_read_signals (CAN_HANDLE Can, unsigned long *pulChannelRead);
621
622PRAEDEF int MIDDEF CANL2_write_signals (CAN_HANDLE Can, unsigned long pulChannelWrite,
623 unsigned long ulCareMask);
624
625PRAEDEF int MIDDEF CANL2_enable_delayed_poll_mode (CAN_HANDLE Can, unsigned short delay);
626
627
628#endif /*_CANL2_H */
629
630
Note: See TracBrowser for help on using the repository browser.