source: pacpussensors/trunk/CanGateway/driver/kvaser/windows/canevt.h@ 145

Last change on this file since 145 was 93, checked in by DHERBOMEZ Gérald, 9 years ago

move files in windows folder

File size: 7.6 KB
Line 
1/*
2** Copyright 1999 by KVASER AB
3** P.O Box 4076 SE-51104 KINNAHULT, SWEDEN
4** E-mail: staff@kvaser.se WWW: http://www.kvaser.se
5**
6** This software is furnished under a license and may be used and copied
7** only in accordance with the terms of such license.
8**
9**
10** Description:
11**
12**
13**
14**
15**
16**
17**
18** DO NOT USE THIS FILE. THE DATA STRUCTURES AND CONSTANTS HERE ARE
19** NOT YET IMPLEMENTED AND WILL CHANGE IN A FUTURE RELEASE.
20**
21**
22**
23**
24**
25**
26**
27**
28**
29**
30*/
31#ifndef _CANEVT_H_
32#define _CANEVT_H_
33
34#include <pshpack1.h>
35
36#define CANEVT_NO_COMMAND 0
37
38 // Events
39#define CANEVT_RECEIVE_MSG 1
40#define CANEVT_STATISTIC_STD 2
41#define CANEVT_STATISTIC_EXT 3
42#define CANEVT_CHIP_STATE 4
43#define CANEVT_CLOCK_OVERFLOW 5
44#define CANEVT_TRIGGER 6
45#define CANEVT_ERROR 7
46#define CANEVT_TIMER 8
47#define CANEVT_TRANSCEIVER 9
48
49 // Commands
50#define CANEVT_TRANSMIT_MSG 10
51#define CANEVT_SET_TIMER 11
52#define CANEVT_RESET_CLOCK 12
53#define CANEVT_INIT_CHIP 13
54#define CANEVT_START_CHIP 14
55#define CANEVT_STOP_CHIP 15
56#define CANEVT_RESET_CHIP 16
57#define CANEVT_SET_ACCEPTANCE 17
58//#define CANEVT_SET_DRIVERMODE 18
59#define CANEVT_GET_STATISTIC 19
60#define CANEVT_GET_CHIP_STATE 20
61#define CANEVT_SET_OUTPUT_MODE 21
62#define CANEVT_FUNCTION 22
63#define CANEVT_GET_TRANSCEIVER 23
64#define CANEVT_GET_TRANSCEIVER_RESP 24
65#define CANEVT_SET_TRANSCEIVER 25
66// 26, 27, 28 reserved
67#define CANEVT_INIT_HARDWARE 29
68#define CANEVT_EXIT_HARDWARE 30
69#define CANEVT_READ_CLOCK 31
70
71
72#define MAX_MSG_LEN 8
73#define EXT_MSG 0x80000000 // signs an extended identifier
74
75#define MSGFLAG_ERROR_FRAME 0x01 // Msg is a bus error
76#define MSGFLAG_OVERRUN 0x02 // Msgs following this has been lost
77#define MSGFLAG_NERR 0x04 // NERR active during this msg
78#define MSGFLAG_WAKEUP 0x08 // Msg rcv'd in wakeup mode
79#define MSGFLAG_REMOTE_FRAME 0x10 // Msg is a remote frame
80#define MSGFLAG_RESERVED_1 0x20 // Reserved for future usage
81#define MSGFLAG_TX 0x40 // TX acknowledge
82#define MSGFLAG_TXRQ 0x80 // TX request
83
84typedef struct {
85 unsigned long id;
86 unsigned char flags;
87 unsigned char dlc;
88 unsigned char data[MAX_MSG_LEN];
89} CanEventMessage;
90
91
92#define CHIPSTAT_BUSOFF 0x01
93#define CHIPSTAT_ERROR_PASSIVE 0x02
94#define CHIPSTAT_ERROR_WARNING 0x04
95#define CHIPSTAT_ERROR_ACTIVE 0x08
96
97typedef struct {
98 unsigned char busStatus;
99 unsigned char txErrorCounter;
100 unsigned char rxErrorCounter;
101} CanEventChipState;
102
103typedef struct {
104 unsigned long stdData;
105 unsigned long stdRemote;
106 unsigned long errFrame;
107 unsigned short busLoad; // 0.00-100.00%
108} CanEventStatisticsStd;
109
110typedef struct {
111 unsigned long extData;
112 unsigned long extRemote;
113 unsigned long ovrFrame;
114} CanEventStatisticsExt;
115
116typedef struct {
117 unsigned char code; // qqq
118} CanEventErrorCode;
119
120//------------------------------------------------------------------------------
121// commands
122//------------------------------------------------------------------------------
123
124typedef struct {
125 unsigned long code;
126 unsigned long mask;
127} CanEventAcceptanceFilter;
128
129typedef struct {
130 unsigned char mode;
131} CanEventDriverMode;
132
133typedef struct {
134 unsigned long rate;
135} CanEventSetTimer;
136
137typedef struct {
138 unsigned char level;
139} CanEventSetDebugLevel;
140
141#define OUTPUT_MODE_SILENT 0
142#define OUTPUT_MODE_NORMAL 1
143
144typedef struct {
145 unsigned char mode;
146} CanEventSetOutputMode;
147
148typedef struct {
149 unsigned char code;
150} CanEventFunction;
151
152// The following definitions are copied from lapcmds.h !!
153#if 0
154#define TRANSCEIVER_EVENT_ERROR 1
155#define TRANSCEIVER_EVENT_CHANGED 2
156
157// event
158#define TRANSCEIVER_EVENT_NONE 0
159#define TRANSCEIVER_EVENT_NERR 1
160#define TRANSCEIVER_EVENT_REMOVED 2
161#define TRANSCEIVER_EVENT_DETECTED 3
162
163// type
164#define TRANSCEIVER_TYPE_NONE 0
165#define TRANSCEIVER_TYPE_251 1
166#define TRANSCEIVER_TYPE_252 2
167#define TRANSCEIVER_TYPE_DNOPTO 3
168#define TRANSCEIVER_TYPE_W210 4
169#define TRANSCEIVER_TYPE_SWC_PROTO 5 // Prototype. Driver may latch-up.
170#define TRANSCEIVER_TYPE_SWC 6
171
172
173// lineMode
174#define TRANSCEIVER_LINEMODE_NA 0
175#define TRANSCEIVER_LINEMODE_TWO_LINE 1
176#define TRANSCEIVER_LINEMODE_CAN_H 2
177#define TRANSCEIVER_LINEMODE_CAN_L 3
178#define TRANSCEIVER_LINEMODE_SWC_SLEEP 4 // SWC Sleep Mode.
179#define TRANSCEIVER_LINEMODE_SWC_NORMAL 5 // SWC Normal Mode.
180#define TRANSCEIVER_LINEMODE_SWC_FAST 6 // SWC High-Speed Mode.
181#define TRANSCEIVER_LINEMODE_SWC_WAKEUP 7 // SWC Wakeup Mode.
182#define TRANSCEIVER_LINEMODE_SLEEP 8
183#define TRANSCEIVER_LINEMODE_NORMAL 9
184#define TRANSCEIVER_LINEMODE_STDBY 10 // Standby for those who support it
185#define TRANSCEIVER_LINEMODE_TT_CAN_H 11 // Truck & Trailer: operating mode single wire using CAN high
186#define TRANSCEIVER_LINEMODE_TT_CAN_L 12 // Truck & Trailer: operating mode single wire using CAN low
187#define TRANSCEIVER_LINEMODE_OEM1 13 // Reserved for OEM apps
188#define TRANSCEIVER_LINEMODE_OEM2 14 // Reserved for OEM apps
189#define TRANSCEIVER_LINEMODE_OEM3 15 // Reserved for OEM apps
190#define TRANSCEIVER_LINEMODE_OEM4 16 // Reserved for OEM apps
191
192
193// resNet
194#define TRANSCEIVER_RESNET_NA 0
195#define TRANSCEIVER_RESNET_MASTER 1
196#define TRANSCEIVER_RESNET_MASTER_STBY 2
197#define TRANSCEIVER_RESNET_SLAVE 3
198
199#endif
200
201typedef struct {
202 unsigned char event; // TRANSCEIVER_EVENT_xxx
203} CanEventTransceiver;
204
205typedef struct {
206 unsigned char type; // TRANSCEIVER_TYPE_xxx
207 unsigned char lineMode; // TRANSCEIVER_LINEMODE_xxx
208 unsigned char resNet; // TRANSCEIVER_RESNET_xxx
209} CanEventGetTransceiverResponse;
210
211typedef struct {
212 unsigned char type; // TRANSCEIVER_TYPE_xxx
213 unsigned char lineMode; // TRANSCEIVER_LINEMODE_xxx
214 unsigned char resNet; // TRANSCEIVER_RESNET_xxx
215} CanEventSetTransceiver;
216
217
218typedef union {
219 CanEventMessage canEventMessage;
220 CanEventChipState canEventChipState;
221 CanEventStatisticsStd canEventStatisticsStd;
222 CanEventStatisticsExt canEventStatisticsExt;
223 CanEventErrorCode canEventErrorCode;
224 CanEventAcceptanceFilter canEventAcceptanceFilter;
225 CanEventDriverMode canEventDriverMode;
226 CanEventSetTimer canEventSetTimer;
227 CanEventSetDebugLevel canEventSetDebugLevel;
228 CanEventSetOutputMode canEventSetOutputMode;
229 CanEventFunction canEventFunction;
230 CanEventTransceiver canEventTransceiver;
231 CanEventGetTransceiverResponse canEventGetTransceiverResponse;
232 CanEventSetTransceiver canEventSetTransceiver;
233} CanEventUnion;
234
235
236typedef struct {
237 unsigned char tag;
238 unsigned char chanIndex;
239 unsigned char _internal1;
240 unsigned char _internal2;
241 unsigned long timeStamp;
242 CanEventUnion x;
243} CanEvent, *PCanEvent;
244
245
246#include <poppack.h>
247
248#endif
249
Note: See TracBrowser for help on using the repository browser.