author | Edouard Tisserant |
Tue, 20 Mar 2018 16:04:52 +0100 | |
changeset 800 | f0d16976e46e |
parent 749 | 5cbb8e9ad67c |
child 807 | 46027bb24429 |
permissions | -rw-r--r-- |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
1 |
/* |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
2 |
This file is part of CanFestival, a library implementing CanOpen Stack. |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
3 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
5 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
6 |
See COPYING file for copyrights details. |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
7 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
8 |
This library is free software; you can redistribute it and/or |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
9 |
modify it under the terms of the GNU Lesser General Public |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
10 |
License as published by the Free Software Foundation; either |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
11 |
version 2.1 of the License, or (at your option) any later version. |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
12 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
13 |
This library is distributed in the hope that it will be useful, |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
16 |
Lesser General Public License for more details. |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
17 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
18 |
You should have received a copy of the GNU Lesser General Public |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
19 |
License along with this library; if not, write to the Free Software |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
21 |
*/ |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
22 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
23 |
#ifndef __APPLICFG_LINUX__ |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
24 |
#define __APPLICFG_LINUX__ |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
25 |
|
391
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
231
diff
changeset
|
26 |
#ifndef __KERNEL__ |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
27 |
#include <string.h> |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
28 |
#include <stdio.h> |
231
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
29 |
#include <sys/types.h> |
391
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
231
diff
changeset
|
30 |
#else |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
231
diff
changeset
|
31 |
#include <linux/types.h> |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
231
diff
changeset
|
32 |
#endif |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
33 |
|
71 | 34 |
/* Define the architecture : little_endian or big_endian |
35 |
----------------------------------------------------- |
|
36 |
Test : |
|
37 |
UNS32 v = 0x1234ABCD; |
|
38 |
char *data = &v; |
|
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
39 |
|
71 | 40 |
Result for a little_endian architecture : |
41 |
data[0] = 0xCD; |
|
42 |
data[1] = 0xAB; |
|
43 |
data[2] = 0x34; |
|
44 |
data[3] = 0x12; |
|
45 |
||
46 |
Result for a big_endian architecture : |
|
47 |
data[0] = 0x12; |
|
48 |
data[1] = 0x34; |
|
49 |
data[2] = 0xAB; |
|
50 |
data[3] = 0xCD; |
|
51 |
*/ |
|
52 |
||
53 |
/* Integers */ |
|
231
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
54 |
#define INTEGER8 int8_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
55 |
#define INTEGER16 int16_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
56 |
#define INTEGER24 int32_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
57 |
#define INTEGER32 int32_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
58 |
#define INTEGER40 int64_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
59 |
#define INTEGER48 int64_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
60 |
#define INTEGER56 int64_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
61 |
#define INTEGER64 int64_t |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
62 |
|
71 | 63 |
/* Unsigned integers */ |
231
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
64 |
#define UNS8 u_int8_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
65 |
#define UNS16 u_int16_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
66 |
#define UNS32 u_int32_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
67 |
#define UNS24 u_int32_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
68 |
#define UNS40 u_int64_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
69 |
#define UNS48 u_int64_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
70 |
#define UNS56 u_int64_t |
4fd03ee0c30e
Changed types declaration for unix using sys/types.h
etisserant
parents:
228
diff
changeset
|
71 |
#define UNS64 u_int64_t |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
72 |
|
71 | 73 |
/* Reals */ |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
74 |
#define REAL32 float |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
75 |
#define REAL64 double |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
76 |
|
71 | 77 |
/* Definition of error and warning macros */ |
78 |
/* -------------------------------------- */ |
|
454 | 79 |
#ifdef __KERNEL__ |
80 |
# define MSG(...) printk (__VA_ARGS__) |
|
749
5cbb8e9ad67c
Changed configure to compile on Debian with the latest RTAI patch installed (removed rtdm library in compiler flags)
mwildbolz
parents:
454
diff
changeset
|
81 |
//#elif defined USE_RTAI |
5cbb8e9ad67c
Changed configure to compile on Debian with the latest RTAI patch installed (removed rtdm library in compiler flags)
mwildbolz
parents:
454
diff
changeset
|
82 |
//# define MSG(...) rt_printk (__VA_ARGS__) |
454 | 83 |
#elif defined USE_XENO |
84 |
# define MSG(...) |
|
85 |
#else |
|
391
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
231
diff
changeset
|
86 |
# include <stdio.h> |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
231
diff
changeset
|
87 |
# define MSG(...) printf (__VA_ARGS__) |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
88 |
#endif |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
89 |
|
71 | 90 |
/* Definition of MSG_ERR */ |
91 |
/* --------------------- */ |
|
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
92 |
#ifdef DEBUG_ERR_CONSOLE_ON |
195
1510dd61ead0
Added debug level opt in configure and re-enabled debug macros.
etisserant
parents:
145
diff
changeset
|
93 |
# define MSG_ERR(num, str, val) \ |
391
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
231
diff
changeset
|
94 |
MSG("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val); |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
95 |
#else |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
96 |
# define MSG_ERR(num, str, val) |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
97 |
#endif |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
98 |
|
71 | 99 |
/* Definition of MSG_WAR */ |
100 |
/* --------------------- */ |
|
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
101 |
#ifdef DEBUG_WAR_CONSOLE_ON |
195
1510dd61ead0
Added debug level opt in configure and re-enabled debug macros.
etisserant
parents:
145
diff
changeset
|
102 |
# define MSG_WAR(num, str, val) \ |
391
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
231
diff
changeset
|
103 |
MSG("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val); |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
104 |
#else |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
105 |
# define MSG_WAR(num, str, val) |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
106 |
#endif |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
107 |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
71
diff
changeset
|
108 |
typedef void* CAN_HANDLE; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
71
diff
changeset
|
109 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
71
diff
changeset
|
110 |
typedef void* CAN_PORT; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
71
diff
changeset
|
111 |
|
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff
changeset
|
112 |
#endif |