author | greg |
Tue, 26 Feb 2008 10:26:00 +0100 | |
changeset 408 | f85552acc2bf |
parent 378 | d2abf6c8c27b |
child 801 | 32d146b64a35 |
permissions | -rwxr-xr-x |
0 | 1 |
/* |
2 |
This file is part of CanFestival, a library implementing CanOpen Stack. |
|
3 |
||
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN |
|
5 |
||
6 |
See COPYING file for copyrights details. |
|
7 |
||
8 |
This library is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU Lesser General Public |
|
10 |
License as published by the Free Software Foundation; either |
|
11 |
version 2.1 of the License, or (at your option) any later version. |
|
12 |
||
13 |
This library is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
Lesser General Public License for more details. |
|
17 |
||
18 |
You should have received a copy of the GNU Lesser General Public |
|
19 |
License along with this library; if not, write to the Free Software |
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
*/ |
|
22 |
||
54 | 23 |
// Uncomment if you don't need console informations. |
0 | 24 |
#define DEBUG_WAR_CONSOLE_ON |
25 |
#define DEBUG_ERR_CONSOLE_ON |
|
26 |
||
27 |
#include <stddef.h> /* for NULL */ |
|
28 |
||
29 |
#include <asm-m68hc12/portsaccess.h> |
|
30 |
#include <asm-m68hc12/ports_def.h> |
|
31 |
#include <asm-m68hc12/ports.h> |
|
32 |
#include <interrupt.h> |
|
33 |
||
54 | 34 |
#include "../include/data.h" |
0 | 35 |
#include <applicfg.h> |
36 |
||
37 |
||
38 |
||
54 | 39 |
#include "../include/hcs12/candriver.h" |
40 |
#include "../include/hcs12/canOpenDriver.h" |
|
0 | 41 |
#include "../include/def.h" |
42 |
#include "../include/can.h" |
|
43 |
#include "../include/objdictdef.h" |
|
44 |
#include "../include/objacces.h" |
|
45 |
#include "../include/sdo.h" |
|
46 |
#include "../include/pdo.h" |
|
47 |
#include "../include/timer.h" |
|
48 |
#include "../include/lifegrd.h" |
|
49 |
#include "../include/sync.h" |
|
50 |
||
51 |
#include "../include/nmtSlave.h" |
|
61 | 52 |
|
53 |
// File created by the GUI |
|
0 | 54 |
#include "objdict.h" |
55 |
||
54 | 56 |
|
57 |
||
58 |
||
0 | 59 |
|
60 |
// HCS12 configuration |
|
61 |
// ----------------------------------------------------- |
|
62 |
||
63 |
enum E_CanBaudrate |
|
64 |
{ |
|
65 |
CAN_BAUDRATE_250K, |
|
66 |
CAN_BAUDRATE_500K, |
|
67 |
CAN_BAUDRATE_1M, |
|
68 |
}; |
|
69 |
||
70 |
||
71 |
const canBusTime CAN_Baudrates[] = |
|
72 |
{ |
|
73 |
{ |
|
74 |
1, /* clksrc: Use the bus clock : 16 MHz, the freq. of the quartz's board */ |
|
75 |
3, /* brp : chose btw 0 and 63 (6 bits). freq time quantum = 16MHz / (brp + 1) */ |
|
76 |
0, /* sjw : chose btw 0 and 3 (2 bits). Sync on (sjw + 1 ) time quantum */ |
|
77 |
0, /* samp : chose btw 0 and 3 (2 bits) (samp + 1 ) samples per bit */ |
|
78 |
1, /* tseg2 : chose btw 0 and 7 (3 bits) Segment 2 width = (tseg2 + 1) tq */ |
|
79 |
12, /* tseg1 : chose btw 0 and 15 (4 bits) Segment 1 width = (tseg1 + 1) tq */ |
|
80 |
||
81 |
/* |
|
82 |
With these values, |
|
83 |
- The width of the bit time is 16 time quantum : |
|
84 |
- 1 tq for the SYNC segment (could not be modified) |
|
85 |
- 13 tq for the TIME 1 segment (tseg1 = 12) |
|
86 |
- 2 tq for the TIME 2 segment (tseg2 = 1) |
|
87 |
- Because the bus clock of the MSCAN is 16 MHZ, and the |
|
88 |
freq of the time quantum is 4 MHZ (brp = 3+1), and there are 16 tq in the bit time, |
|
89 |
so the freq of the bit time is 250 kHz. |
|
90 |
*/ |
|
91 |
}, |
|
92 |
||
93 |
{ |
|
94 |
1, /* clksrc: Use the bus clock : 16 MHz, the freq. of the quartz's board */ |
|
95 |
1, /* brp : chose btw 0 and 63 (6 bits). freq time quantum = 16MHz / (brp + 1) */ |
|
96 |
0, /* sjw : chose btw 0 and 3 (2 bits). Sync on (sjw + 1 ) time quantum */ |
|
97 |
0, /* samp : chose btw 0 and 3 (2 bits) (samp + 1 ) samples per bit */ |
|
98 |
1, /* tseg2 : chose btw 0 and 7 (3 bits) Segment 2 width = (tseg2 + 1) tq */ |
|
99 |
12, /* tseg1 : chose btw 0 and 15 (4 bits) Segment 1 width = (tseg1 + 1) tq */ |
|
100 |
||
101 |
/* |
|
102 |
With these values, |
|
103 |
- The width of the bit time is 16 time quantum : |
|
104 |
- 1 tq for the SYNC segment (could not be modified) |
|
105 |
- 13 tq for the TIME 1 segment (tseg1 = 12) |
|
106 |
- 2 tq for the TIME 2 segment (tseg2 = 1) |
|
107 |
- Because the bus clock of the MSCAN is 16 MHZ, and the |
|
108 |
freq of the time quantum is 8 MHZ (brp = 1+1), and there are 16 tq in the bit time, |
|
109 |
so the freq of the bit time is 500 kHz. |
|
110 |
*/ |
|
111 |
}, |
|
112 |
||
113 |
{ |
|
114 |
1, /* clksrc: Use the bus clock : 16 MHz, the freq. of the quartz's board */ |
|
115 |
1, /* brp : chose btw 0 and 63 (6 bits). freq time quantum = 16MHz / (brp + 1) */ |
|
116 |
0, /* sjw : chose btw 0 and 3 (2 bits). Sync on (sjw + 1 ) time quantum */ |
|
117 |
0, /* samp : chose btw 0 and 3 (2 bits) (samp +MSG_WAR(0x3F33, "Je suis le noeud ", getNodeId()); 1 ) samples per bit */ |
|
118 |
1, /* tseg2 : chose btw 0 and 7 (3 bits) Segment 2 width = (tseg2 + 1) tq */ |
|
119 |
4, /* tseg1 : chose btw 0 and 15 (4 bits) Segment 1 width = (tseg1 + 1) tq */ |
|
120 |
||
121 |
/* |
|
122 |
With these values, |
|
123 |
- The width of the bit time is 16 time quantum : |
|
124 |
- 1 tq for the SYNC segment (could not be modified) |
|
125 |
- 5 tq for the TIME 1 segment (tseg1 = 4) |
|
126 |
- 2 tq for the TIME 2 segment (tseg2 = 1) |
|
127 |
- Because the bus clock of the MSCAN is 16 MHZ, and the |
|
128 |
freq of the time quantum is 8 MHZ (brp = 1+1), and there are 8 tq in the bit time, |
|
129 |
so the freq of the bit time is 1 MHz. |
|
130 |
*/ |
|
131 |
} |
|
132 |
}; |
|
133 |
||
134 |
||
135 |
||
136 |
||
137 |
/**************************prototypes*****************************************/ |
|
138 |
||
54 | 139 |
//Init can bus and Canopen |
0 | 140 |
void initCanopencapteur (void); |
54 | 141 |
// Init the sensor |
0 | 142 |
void initSensor(void); |
143 |
void initPortB(void); |
|
54 | 144 |
void initPortH(void); |
145 |
||
0 | 146 |
|
147 |
//------------------------------------------------------------------------------ |
|
148 |
//Initialisation of the port B for the leds. |
|
149 |
void initPortB(void) |
|
150 |
{ |
|
151 |
// Port B is output |
|
152 |
IO_PORTS_8(DDRB)= 0XFF; |
|
153 |
// RAZ |
|
154 |
IO_PORTS_8(PORTB) = 0xFF; |
|
155 |
} |
|
156 |
||
54 | 157 |
//------------------------------------------------------------------------------ |
158 |
// Init of port H to choose the CAN rate by switch, and the nodeId |
|
159 |
void initPortH(void) |
|
160 |
{ |
|
161 |
// Port H is input |
|
162 |
IO_PORTS_8(DDRH)= 0X00; |
|
163 |
// Enable pull device |
|
164 |
IO_PORTS_8(PERH) = 0XFF; |
|
165 |
// Choose the pull-up device |
|
166 |
IO_PORTS_8(PPSH) = 0X00; |
|
167 |
} |
|
0 | 168 |
|
169 |
//------------------------------------------------------------------------------ |
|
170 |
void initSensor(void) |
|
171 |
{ |
|
54 | 172 |
UNS8 baudrate = 0; |
173 |
UNS8 nodeId = 0; |
|
0 | 174 |
// Init led control |
175 |
initPortB(); |
|
176 |
IO_PORTS_8(PORTB) &= ~ 0x01; //One led ON |
|
54 | 177 |
initPortH(); |
178 |
||
179 |
/* Defining the node Id */ |
|
180 |
// Uncomment to have a fixed nodeId |
|
181 |
//setNodeId(&gene_SYNC_Data, 0x03); |
|
182 |
||
183 |
// Comment below to have a fixed nodeId |
|
184 |
nodeId = ~(IO_PORTS_8(PTH)) & 0x3F; |
|
185 |
if (nodeId == 0) { |
|
186 |
MSG_WAR(0x3F33, "Using default nodeId : ", getNodeId(&gene_SYNC_Data)); |
|
187 |
} |
|
188 |
else |
|
189 |
setNodeId(&gene_SYNC_Data, nodeId); |
|
190 |
||
191 |
MSG_WAR(0x3F33, "My nodeId is : ", getNodeId(&gene_SYNC_Data)); |
|
0 | 192 |
|
193 |
canBusInit bi0 = { |
|
194 |
0, /* no low power */ |
|
195 |
0, /* no time stamp */ |
|
196 |
1, /* enable MSCAN */ |
|
197 |
0, /* clock source : oscillator (In fact, it is not used) */ |
|
198 |
0, /* no loop back */ |
|
199 |
0, /* no listen only */ |
|
200 |
0, /* no low pass filter for wk up */ |
|
201 |
CAN_Baudrates[CAN_BAUDRATE_250K], |
|
202 |
{ |
|
203 |
0x00, /* Filter on 16 bits. See Motorola Block Guide V02.14 fig 4-3 */ |
|
204 |
0x00, 0xFF, /* filter 0 hight accept all msg */ |
|
205 |
0x00, 0xFF, /* filter 0 low accept all msg */ |
|
206 |
0x00, 0xFF, /* filter 1 hight filter all of msg */ |
|
207 |
0x00, 0xFF, /* filter 1 low filter all of msg */ |
|
208 |
0x00, 0xFF, /* filter 2 hight filter most of msg */ |
|
209 |
0x00, 0xFF, /* filter 2 low filter most of msg */ |
|
210 |
0x00, 0xFF, /* filter 3 hight filter most of msg */ |
|
211 |
0x00, 0xFF, /* filter 3 low filter most of msg */ |
|
212 |
} |
|
213 |
}; |
|
214 |
||
215 |
//Init the HCS12 microcontroler for CanOpen |
|
216 |
initHCS12(); |
|
217 |
||
54 | 218 |
// Chose the CAN rate (On our board, whe have switch for all purpose) |
219 |
// 7 8 |
|
220 |
// ON ON => 1000 kpbs |
|
221 |
// OFF ON => 500 kpbs |
|
222 |
// ON OFF => 250 kpbs |
|
223 |
||
224 |
baudrate = ~(IO_PORTS_8(PTH)) & 0xC0; |
|
225 |
||
226 |
// Uncomment to have a fixed baudrate of 250 kbps |
|
227 |
//baudrate = 1; |
|
228 |
||
0 | 229 |
switch (baudrate) { |
54 | 230 |
case 0x40: |
0 | 231 |
bi0.clk = CAN_Baudrates[CAN_BAUDRATE_250K]; |
232 |
MSG_WAR(0x3F30, "CAN 250 kbps ", 0); |
|
233 |
break; |
|
54 | 234 |
case 0x80: |
0 | 235 |
bi0.clk = CAN_Baudrates[CAN_BAUDRATE_500K]; |
236 |
MSG_WAR(0x3F31, "CAN 500 kbps ", 0); |
|
237 |
break; |
|
54 | 238 |
case 0xC0: |
0 | 239 |
bi0.clk = CAN_Baudrates[CAN_BAUDRATE_1M]; |
240 |
MSG_WAR(0x3F31, "CAN 1000 kbps ", 0); |
|
241 |
break; |
|
242 |
default: |
|
80 | 243 |
bi0.clk = CAN_Baudrates[CAN_BAUDRATE_250K]; |
54 | 244 |
MSG_WAR(0x2F32, "CAN BAUD RATE NOT DEFINED => 250 kbps ", 0); |
0 | 245 |
} |
246 |
||
54 | 247 |
|
248 |
||
249 |
MSG_WAR(0x3F33, "SYNC signal generator ", 0); |
|
0 | 250 |
|
251 |
canInit(CANOPEN_LINE_NUMBER_USED, bi0); //initialize filters... |
|
252 |
initTimer(); // Init hcs12 timer used by CanFestival. (see timerhw.c) |
|
253 |
unlock(); // Allow interruptions |
|
254 |
} |
|
255 |
||
256 |
||
257 |
||
258 |
||
259 |
||
260 |
||
261 |
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ |
|
262 |
// FUNCTIONS WHICH ARE PART OF CANFESTIVAL and *must* be implemented here. |
|
263 |
||
264 |
//------------------------------------------------------------------------------ |
|
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
365
diff
changeset
|
265 |
void gene_SYNC_heartbeatError(CO_Data* d, UNS8 heartbeatID ) |
0 | 266 |
{ |
267 |
||
268 |
MSG_ERR(0x1F00, "HeartBeat not received from node : ", heartbeatID); |
|
269 |
} |
|
270 |
||
271 |
//------------------------------------------------------------------------------ |
|
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
365
diff
changeset
|
272 |
void gene_SYNC_initialisation(CO_Data* d) |
0 | 273 |
{ |
274 |
MSG_WAR (0x3F00, "Entering in INIT ", 0); |
|
54 | 275 |
initSensor(); |
276 |
||
0 | 277 |
IO_PORTS_8(PORTB) &= ~ 0x01; // led 0 : ON |
278 |
IO_PORTS_8(PORTB) |= 0x0E; // leds 1, 2, 3 : OFF |
|
54 | 279 |
|
0 | 280 |
} |
281 |
||
282 |
||
283 |
//------------------------------------------------------------------------------ |
|
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
365
diff
changeset
|
284 |
void gene_SYNC_preOperational(CO_Data* d) |
0 | 285 |
{ |
286 |
MSG_WAR (0x3F01, "Entering in PRE-OPERATIONAL ", 0); |
|
287 |
IO_PORTS_8(PORTB) &= ~ 0x03; // leds 0, 1 : ON |
|
288 |
IO_PORTS_8(PORTB) |= 0x0C; // leds 2, 3 : OFF |
|
54 | 289 |
/* default values for the msg CAN filters */ |
290 |
/* Accept all */ |
|
291 |
{ |
|
292 |
canBusFilterInit filterConfiguration = |
|
293 |
{ |
|
294 |
0x01, /* Filter on 16 bits. See Motorola Block Guide V02.14 */ |
|
295 |
/*canidarx, canidmrx */ |
|
296 |
0x00, 0xFF, /* filter 0 */ |
|
297 |
0x00, 0xFF, /* filter 0 */ |
|
298 |
0x00, 0xFF, /* filter 1 */ |
|
299 |
0x00, 0xFF, /* filter 1 */ |
|
300 |
0x00, 0xFF, /* filter 2 */ |
|
301 |
0x00, 0xFF, /* filter 2 */ |
|
302 |
0x00, 0xFF, /* filter 3 */ |
|
303 |
0x00, 0xFF, /* filter 3 */ |
|
304 |
}; |
|
305 |
canChangeFilter(CANOPEN_LINE_NUMBER_USED, filterConfiguration); |
|
306 |
} |
|
307 |
// Reset the automatic change by SDO |
|
308 |
applyDownloadedFilters = 0; |
|
309 |
||
0 | 310 |
} |
311 |
||
312 |
||
313 |
//------------------------------------------------------------------------------ |
|
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
365
diff
changeset
|
314 |
void gene_SYNC_operational(CO_Data* d) |
0 | 315 |
{ |
316 |
MSG_WAR (0x3F02, "Entering in OPERATIONAL ", 0); |
|
317 |
IO_PORTS_8(PORTB) &= ~ 0x07; // leds 0, 1, 2 : ON |
|
318 |
IO_PORTS_8(PORTB) |= 0x08; // leds 3 : OFF |
|
54 | 319 |
|
320 |
// Filtering the CAN received msgs. |
|
321 |
// 2 ways |
|
322 |
// First :applying an automatic filter |
|
323 |
// Second : The values of the filtering registers are mapped in the object dictionary, |
|
324 |
// So that a filtering configuration can be downloaded by SDO in pre-operational mode |
|
325 |
||
326 |
if (applyDownloadedFilters == 0) {// No downloaded configuration to apply |
|
327 |
UNS16 accept1 = 0x0000; // Accept NMT |
|
328 |
UNS16 mask1 = 0x0FFF; // Mask NMT |
|
329 |
UNS16 accept2 = 0xE000; // Accept NMT error control (heartbeat, nodeguard) |
|
330 |
UNS16 mask2 = 0x0FFF; // Mask NMT error control (heartbeat, nodeguard) |
|
331 |
||
332 |
canBusFilterInit filterConfiguration = |
|
333 |
{// filters 3 and 4 not used, so configured like filter 1. |
|
334 |
0x01, /* Filter on 16 bits. See Motorola Block Guide V02.14 */ |
|
335 |
/*canidarx, canidmrx */ |
|
336 |
(UNS8)(accept1 >> 8), (UNS8)(mask1 >> 8), /* filter 1 id10...3*/ |
|
337 |
(UNS8)accept1 , (UNS8)mask1, /* filter 1 id2 ... */ |
|
338 |
(UNS8)(accept2 >> 8), (UNS8)(mask2 >> 8), /* filter 2 id10...3*/ |
|
339 |
(UNS8)accept2 , (UNS8)mask2, /* filter 2 id2 ... */ |
|
340 |
(UNS8)(accept1 >> 8), (UNS8)(mask1 >> 8), /* filter 3 id10...3*/ |
|
341 |
(UNS8)accept1 , (UNS8)mask1, /* filter 3 id2 ... */ |
|
342 |
(UNS8)(accept1 >> 8), (UNS8)(mask1 >> 8), /* filter 4 id10...3*/ |
|
343 |
(UNS8)accept1 , (UNS8)mask1 /* filter 4 id2 ... */ |
|
344 |
}; |
|
345 |
canChangeFilter(CANOPEN_LINE_NUMBER_USED, filterConfiguration); |
|
346 |
MSG_WAR (0x3F03, "Internal CAN Rcv filter applied ", 0); |
|
347 |
} |
|
348 |
else { // Apply filters downnloaded |
|
349 |
canBusFilterInit filterConfiguration = |
|
350 |
{// filters 3 and 4 not used, so configured like filter 1. |
|
351 |
0x01, /* Filter on 16 bits. See Motorola Block Guide V02.14 */ |
|
352 |
/*canidarx, canidmrx */ |
|
353 |
(UNS8)( acceptanceFilter1>> 8), (UNS8)(mask1 >> 8), /* filter 1 id10...3*/ |
|
354 |
(UNS8)acceptanceFilter1 , (UNS8)mask1, /* filter 1 id2 ... */ |
|
355 |
(UNS8)(acceptanceFilter2 >> 8), (UNS8)(mask2 >> 8), /* filter 2 id10...3*/ |
|
356 |
(UNS8)acceptanceFilter2 , (UNS8)mask2, /* filter 2 id2 ... */ |
|
357 |
(UNS8)(acceptanceFilter3 >> 8), (UNS8)(mask3 >> 8), /* filter 3 id10...3*/ |
|
358 |
(UNS8)acceptanceFilter3 , (UNS8)mask3, /* filter 3 id2 ... */ |
|
359 |
(UNS8)(acceptanceFilter4 >> 8), (UNS8)(mask4 >> 8), /* filter 4 id10...3*/ |
|
360 |
(UNS8)acceptanceFilter4 , (UNS8)mask4 /* filter 4 id2 ... */ |
|
361 |
}; |
|
362 |
canChangeFilter(CANOPEN_LINE_NUMBER_USED, filterConfiguration); |
|
363 |
MSG_WAR (0x3F04, "Downloaded CAN Rcv filter applied ", 0); |
|
364 |
} |
|
0 | 365 |
} |
366 |
||
367 |
//------------------------------------------------------------------------------ |
|
378
d2abf6c8c27b
As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents:
365
diff
changeset
|
368 |
void gene_SYNC_stopped(CO_Data* d) |
0 | 369 |
{ |
370 |
MSG_WAR (0x3F02, "Entering in STOPPED ", 0); |
|
54 | 371 |
IO_PORTS_8(PORTB) |= 0x0E; // leds 1, 2, 3, 4 : OFF |
0 | 372 |
} |
373 |
||
374 |
// End functions which are part of Canfestival |
|
375 |
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ |
|
376 |
||
377 |
||
378 |
/******************************************************************************/ |
|
379 |
/********************************* MAIN ***************************************/ |
|
380 |
/******************************************************************************/ |
|
381 |
||
382 |
||
383 |
UNS8 main (void) |
|
384 |
{ |
|
385 |
||
54 | 386 |
MSG_WAR(0x3F34, "Entering in the main ", 0); |
0 | 387 |
//----------------------------- INITIALISATION -------------------------------- |
149 | 388 |
gene_SYNC_Data.heartbeatError = gene_SYNC_heartbeatError; |
389 |
gene_SYNC_Data.initialisation = gene_SYNC_initialisation; |
|
390 |
gene_SYNC_Data.preOperational = gene_SYNC_preOperational; |
|
391 |
gene_SYNC_Data.preOperational = gene_SYNC_operational; |
|
392 |
gene_SYNC_Data.stopped = gene_SYNC_stopped; |
|
393 |
||
54 | 394 |
|
0 | 395 |
/* Put the node in Initialisation mode */ |
54 | 396 |
MSG_WAR(0x3F35, "Will entering in INIT ", 0); |
0 | 397 |
setState(&gene_SYNC_Data, Initialisation); |
398 |
||
399 |
//----------------------------- START ----------------------------------------- |
|
400 |
/* Put the node in pre-operational mode */ |
|
401 |
//MSG_WAR(0x3F36, "va passer en pre-op", 0); |
|
402 |
//setState(&gene_SYNC_Data, Pre_operational); |
|
403 |
||
54 | 404 |
// Loop of receiving messages |
405 |
while (1) { |
|
0 | 406 |
Message m; |
407 |
if (f_can_receive(0, &m)) { |
|
365 | 408 |
//MSG_WAR(0x3F36, "Msg received", m.cob_id); |
56 | 409 |
lock(); // Not to have interruptions by timer, which can corrupt the data |
0 | 410 |
canDispatch(&gene_SYNC_Data, &m); |
56 | 411 |
unlock(); |
54 | 412 |
} |
413 |
} |
|
0 | 414 |
|
415 |
return (0); |
|
416 |
} |
|
417 |
||
418 |
||
419 |