1 | /*
|
---|
2 | ** Copyright 1997 by KVASER AB
|
---|
3 | ** P.O Box 4076 S-51104 KINNAHULT, SWEDEN Tel. +46 320 15287
|
---|
4 | **
|
---|
5 | ** This software is furnished under a license and may be used and copied
|
---|
6 | ** only in accordance with the terms of such license.
|
---|
7 | **
|
---|
8 | */
|
---|
9 | /*
|
---|
10 | ** This file replaces cancard.h from Softing GmbH.
|
---|
11 | */
|
---|
12 |
|
---|
13 | #ifndef _SING_H_
|
---|
14 | #define _SING_H_
|
---|
15 |
|
---|
16 | #if defined(__WIN32__) || defined(_WIN32)
|
---|
17 |
|
---|
18 | # if !defined(FAR)
|
---|
19 | # define FAR
|
---|
20 | # endif
|
---|
21 | # if !defined(SINGAPI)
|
---|
22 | # define SINGAPI extern int __declspec(dllimport) __stdcall
|
---|
23 | # endif
|
---|
24 |
|
---|
25 | #else
|
---|
26 |
|
---|
27 | # if !defined(FAR)
|
---|
28 | # define FAR far
|
---|
29 | # endif
|
---|
30 | # if !defined(SINGAPI)
|
---|
31 | # define SINGAPI extern int __export FAR PASCAL
|
---|
32 | # endif
|
---|
33 |
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | typedef struct {
|
---|
37 | unsigned long Ident;
|
---|
38 | int DataLength;
|
---|
39 | int RecOverrun_flag;
|
---|
40 | int RCV_fifo_lost_msg;
|
---|
41 | unsigned char RCV_data[8];
|
---|
42 | int AckOverrun_flag;
|
---|
43 | int XMT_ack_fifo_lost_acks;
|
---|
44 | int XMT_rmt_fifo_lost_remotes;
|
---|
45 | int Bus_state;
|
---|
46 | int Error_state;
|
---|
47 | int Can;
|
---|
48 | unsigned long Time;
|
---|
49 | } param_struct;
|
---|
50 |
|
---|
51 | #ifdef __cplusplus
|
---|
52 | extern "C" {
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | SINGAPI INIPC_initialize_board(int address);
|
---|
56 |
|
---|
57 | SINGAPI CANPC_reset_board(void);
|
---|
58 |
|
---|
59 | SINGAPI CANPC_reset_chip(void);
|
---|
60 |
|
---|
61 | SINGAPI CANPC_initialize_chip (int presc, int sjw, int tseg1,
|
---|
62 | int tseg2, int sam);
|
---|
63 |
|
---|
64 | SINGAPI CANPC_initialize_chip2(int presc, int sjw, int tseg1,
|
---|
65 | int tseg2, int sam);
|
---|
66 |
|
---|
67 | SINGAPI CANPC_set_mode (int SleepMode, int SpeedMode);
|
---|
68 |
|
---|
69 | SINGAPI CANPC_set_mode2(int SleepMode, int SpeedMode);
|
---|
70 |
|
---|
71 | SINGAPI CANPC_set_acceptance (unsigned int AccCodeStd,
|
---|
72 | unsigned int AccMaskStd,
|
---|
73 | unsigned long AccCodeXtd,
|
---|
74 | unsigned long AccMaskXtd);
|
---|
75 |
|
---|
76 | SINGAPI CANPC_set_acceptance2(unsigned int AccCodeStd,
|
---|
77 | unsigned int AccMaskStd,
|
---|
78 | unsigned long AccCodeXtd,
|
---|
79 | unsigned long AccMaskXtd);
|
---|
80 |
|
---|
81 | SINGAPI CANPC_set_output_control (int OutputControl);
|
---|
82 |
|
---|
83 | SINGAPI CANPC_set_output_control2(int OutputControl);
|
---|
84 |
|
---|
85 | SINGAPI CANPC_initialize_interface(int ReceiveFifoEnable,
|
---|
86 | int ReceivePollAll,
|
---|
87 | int ReceiveEnableAll,
|
---|
88 | int ReceiveIntEnableAll,
|
---|
89 | int AutoRemoteEnableAll,
|
---|
90 | int TransmitReqFifoEnable,
|
---|
91 | int TransmitPollAll,
|
---|
92 | int TransmitAckEnableAll,
|
---|
93 | int TransmitAckFifoEnableAll,
|
---|
94 | int TransmitRmtFifoEnableAll);
|
---|
95 |
|
---|
96 | SINGAPI CANPC_enable_fifo(void);
|
---|
97 |
|
---|
98 | SINGAPI CANPC_optimize_rcv_speed(void);
|
---|
99 |
|
---|
100 | SINGAPI CANPC_enable_timestamps(void);
|
---|
101 |
|
---|
102 | SINGAPI CANPC_enable_fifo_transmit_ack (void);
|
---|
103 |
|
---|
104 | SINGAPI CANPC_enable_fifo_transmit_ack2(void);
|
---|
105 |
|
---|
106 | SINGAPI CANPC_get_version(int * sw_version,
|
---|
107 | int * fw_version,
|
---|
108 | int * hw_version,
|
---|
109 | int * license,
|
---|
110 | int * can_chip_type);
|
---|
111 |
|
---|
112 | SINGAPI CANPC_start_chip(void);
|
---|
113 |
|
---|
114 | SINGAPI CANPC_read_ac(param_struct * param);
|
---|
115 |
|
---|
116 | SINGAPI CANPC_send_data (unsigned long Ident, int Xtd,
|
---|
117 | int DataLength, unsigned char * pData);
|
---|
118 |
|
---|
119 | SINGAPI CANPC_send_data2(unsigned long Ident, int Xtd,
|
---|
120 | int DataLength, unsigned char * pData);
|
---|
121 |
|
---|
122 | SINGAPI CANPC_send_remote (unsigned long Ident, int Xtd, int DataLength);
|
---|
123 |
|
---|
124 | SINGAPI CANPC_send_remote2(unsigned long Ident, int Xtd, int DataLength);
|
---|
125 |
|
---|
126 | SINGAPI CANPC_reinitialize(void);
|
---|
127 |
|
---|
128 | SINGAPI CANPC_reset_rcv_fifo(void);
|
---|
129 |
|
---|
130 | SINGAPI CANPC_get_time(unsigned long * time);
|
---|
131 |
|
---|
132 | SINGAPI INIPC_close_board(void);
|
---|
133 |
|
---|
134 | SINGAPI CANPC_set_interrupt_event(HANDLE hEvent);
|
---|
135 |
|
---|
136 | SINGAPI CANPC_get_serial_number(unsigned long * ser_number);
|
---|
137 |
|
---|
138 | SINGAPI CANPC_get_trigger (int * level);
|
---|
139 |
|
---|
140 | SINGAPI CANPC_get_trigger2(int * level);
|
---|
141 |
|
---|
142 | SINGAPI CANPC_set_trigger (int level);
|
---|
143 |
|
---|
144 | SINGAPI CANPC_set_trigger2(int level);
|
---|
145 |
|
---|
146 | SINGAPI CANPC_get_bus_state(int Can);
|
---|
147 |
|
---|
148 | SINGAPI CANPC_reset_xmt_fifo(void);
|
---|
149 |
|
---|
150 | SINGAPI CANPC_reset_lost_msg_counter(void);
|
---|
151 |
|
---|
152 | SINGAPI CANPC_read_rcv_fifo_level(void);
|
---|
153 |
|
---|
154 | SINGAPI CANPC_read_xmt_fifo_level(void);
|
---|
155 |
|
---|
156 | SINGAPI CANPC_set_path(char * path);
|
---|
157 |
|
---|
158 | SINGAPI CANPC_enable_error_frame_detection(void);
|
---|
159 |
|
---|
160 | // Dummy functions.
|
---|
161 | SINGAPI CANPC_define_cyclic (int ObjectNumber,
|
---|
162 | unsigned int Rate,
|
---|
163 | unsigned int Cycles);
|
---|
164 | SINGAPI CANPC_define_cyclic2(int ObjectNumber,
|
---|
165 | unsigned int Rate,
|
---|
166 | unsigned int Cycles);
|
---|
167 | SINGAPI CANPC_define_object (unsigned long Handle,
|
---|
168 | int FAR * ObjectNumber,
|
---|
169 | int Type,
|
---|
170 | int ReceiveIntEnable,
|
---|
171 | int AutoRemoteEnable,
|
---|
172 | int TransmitAckEnable);
|
---|
173 | SINGAPI CANPC_define_object2(unsigned long Handle,
|
---|
174 | int FAR * ObjectNumber,
|
---|
175 | int Type,
|
---|
176 | int ReceiveIntEnable,
|
---|
177 | int AutoRemoteEnable,
|
---|
178 | int TransmitAckEnable);
|
---|
179 | SINGAPI CANPC_enable_dyn_obj_buf(void);
|
---|
180 | SINGAPI CANPC_initialize_interface(int ReceiveFifoEnable,
|
---|
181 | int ReceivePollAll,
|
---|
182 | int ReceiveEnableAll,
|
---|
183 | int ReceiveIntEnableAll,
|
---|
184 | int AutoRemoteEnable,
|
---|
185 | int TransmitReqFifoEnable,
|
---|
186 | int TransmitPollAll,
|
---|
187 | int TransmitAckEnableAll,
|
---|
188 | int TransmitAckFifoEnable,
|
---|
189 | int TransmitRmtFifoEnable);
|
---|
190 | SINGAPI CANPC_read_rcv_data (int ObjectNumber,
|
---|
191 | unsigned char FAR * pRCV_Data,
|
---|
192 | unsigned long FAR * Time);
|
---|
193 | SINGAPI CANPC_read_rcv_data2(int ObjectNumber,
|
---|
194 | unsigned char FAR * pRCV_Data,
|
---|
195 | unsigned long FAR * Time);
|
---|
196 | SINGAPI CANPC_read_xmt_data (int ObjectNumber,
|
---|
197 | int FAR * pDataLength,
|
---|
198 | unsigned char FAR * pXMT_Data);
|
---|
199 | SINGAPI CANPC_read_xmt_data2(int ObjectNumber,
|
---|
200 | int FAR * pDataLength,
|
---|
201 | unsigned char FAR * pXMT_Data);
|
---|
202 | SINGAPI CANPC_send_object (int ObjectNumber,
|
---|
203 | int DataLength);
|
---|
204 | SINGAPI CANPC_send_object2(int ObjectNumber,
|
---|
205 | int DataLength);
|
---|
206 | SINGAPI CANPC_send_remote_object (int ObjectNumber,
|
---|
207 | int DataLength);
|
---|
208 | SINGAPI CANPC_send_remote_object2(int ObjectNumber,
|
---|
209 | int DataLength);
|
---|
210 | SINGAPI CANPC_supply_object_data (int ObjectNumber,
|
---|
211 | int DataLength,
|
---|
212 | unsigned char FAR * pData);
|
---|
213 | SINGAPI CANPC_supply_object_data2(int ObjectNumber,
|
---|
214 | int DataLength,
|
---|
215 | unsigned char FAR * pData);
|
---|
216 | SINGAPI CANPC_supply_rcv_object_data (int ObjectNumber,
|
---|
217 | int DataLength,
|
---|
218 | unsigned char FAR * pData);
|
---|
219 | SINGAPI CANPC_supply_rcv_object_data2(int ObjectNumber,
|
---|
220 | int DataLength,
|
---|
221 | unsigned char FAR * pData);
|
---|
222 | SINGAPI CANPC_write_object (int ObjectNumber,
|
---|
223 | int DataLength,
|
---|
224 | unsigned char FAR * pData);
|
---|
225 | SINGAPI CANPC_write_object2(int ObjectNumber,
|
---|
226 | int DataLength,
|
---|
227 | unsigned char FAR * pData);
|
---|
228 |
|
---|
229 |
|
---|
230 |
|
---|
231 |
|
---|
232 | // Additions.
|
---|
233 | SINGAPI CANPC_GetEventHandle(HANDLE *h);
|
---|
234 | SINGAPI CANPC_SetTimerRate(unsigned int rate);
|
---|
235 |
|
---|
236 | #ifdef __cplusplus
|
---|
237 | }
|
---|
238 | #endif
|
---|
239 |
|
---|
240 | #endif
|
---|