author | etisserant |
Fri, 30 Mar 2007 16:57:46 +0200 | |
changeset 131 | ad87bbd12c5e |
parent 24 | a9543d2ccd56 |
permissions | -rw-r--r-- |
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 |
||
23 |
#ifndef __APPLICFG_LINUX__ |
|
24 |
#define __APPLICFG_LINUX__ |
|
25 |
||
26 |
#include <string.h> |
|
27 |
#include <stdio.h> |
|
28 |
||
29 |
// Define the architecture : little_endian or big_endian |
|
30 |
// ----------------------------------------------------- |
|
31 |
// Test : |
|
32 |
// UNS32 v = 0x1234ABCD; |
|
33 |
// char *data = &v; |
|
34 |
// |
|
35 |
// Result for a little_endian architecture : |
|
36 |
// data[0] = 0xCD; |
|
37 |
// data[1] = 0xAB; |
|
38 |
// data[2] = 0x34; |
|
39 |
// data[3] = 0x12; |
|
40 |
// |
|
41 |
// Result for a big_endian architecture : |
|
42 |
// data[0] = 0x12; |
|
43 |
// data[1] = 0x34; |
|
44 |
// data[2] = 0xAB; |
|
45 |
// data[3] = 0xCD; |
|
46 |
||
47 |
// Integers |
|
48 |
#define INTEGER8 char |
|
49 |
#define INTEGER16 short |
|
50 |
#define INTEGER24 |
|
51 |
#define INTEGER32 long |
|
52 |
#define INTEGER40 |
|
53 |
#define INTEGER48 |
|
54 |
#define INTEGER56 |
|
55 |
#define INTEGER64 |
|
56 |
||
57 |
// Unsigned integers |
|
58 |
#define UNS8 unsigned char |
|
59 |
#define UNS16 unsigned short |
|
60 |
#define UNS32 unsigned long |
|
61 |
#define UNS24 |
|
62 |
#define UNS40 |
|
63 |
#define UNS48 |
|
64 |
#define UNS56 |
|
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
0
diff
changeset
|
65 |
#define UNS64 unsigned long long |
0 | 66 |
|
67 |
// Reals |
|
68 |
#define REAL32 float |
|
69 |
#define REAL64 double |
|
70 |
||
71 |
/// Definition of error and warning macros |
|
72 |
// -------------------------------------- |
|
73 |
#if defined DEBUG_ERR_CONSOLE_ON || defined DEBUG_WAR_CONSOLE_ON |
|
74 |
#include <stdio.h> |
|
75 |
#endif |
|
76 |
||
77 |
/// Definition of MSG_ERR |
|
78 |
// --------------------- |
|
79 |
#ifdef DEBUG_ERR_CONSOLE_ON |
|
80 |
# define MSG_ERR(num, str, val)/* \ |
|
81 |
printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);*/ |
|
82 |
#else |
|
83 |
# define MSG_ERR(num, str, val) |
|
84 |
#endif |
|
85 |
||
86 |
/// Definition of MSG_WAR |
|
87 |
// --------------------- |
|
88 |
#ifdef DEBUG_WAR_CONSOLE_ON |
|
89 |
# define MSG_WAR(num, str, val)/* \ |
|
90 |
printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);*/ |
|
91 |
#else |
|
92 |
# define MSG_WAR(num, str, val) |
|
93 |
#endif |
|
94 |
||
95 |
#endif |
|
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
0
diff
changeset
|
96 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
0
diff
changeset
|
97 |
#define CAN_HANDLE void* |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
0
diff
changeset
|
98 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
0
diff
changeset
|
99 |
#define MS_TO_TIMEVAL(ms) ms*US_TO_TIMEVAL_FACTOR*1000 |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
0
diff
changeset
|
100 |
#define US_TO_TIMEVAL(us) us*US_TO_TIMEVAL_FACTOR |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
0
diff
changeset
|
101 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
0
diff
changeset
|
102 |
#define TASK_HANDLE pthread_t |