27 #include <stdio.h> |
27 #include <stdio.h> |
28 |
28 |
29 #include "cancfg.h" |
29 #include "cancfg.h" |
30 #include "timerscfg.h" |
30 #include "timerscfg.h" |
31 |
31 |
32 // Define the architecture : little_endian or big_endian |
32 /* Define the architecture : little_endian or big_endian |
33 // ----------------------------------------------------- |
33 ----------------------------------------------------- |
34 // Test : |
34 Test : |
35 // UNS32 v = 0x1234ABCD; |
35 UNS32 v = 0x1234ABCD; |
36 // char *data = &v; |
36 char *data = &v; |
37 // |
|
38 // Result for a little_endian architecture : |
|
39 // data[0] = 0xCD; |
|
40 // data[1] = 0xAB; |
|
41 // data[2] = 0x34; |
|
42 // data[3] = 0x12; |
|
43 // |
|
44 // Result for a big_endian architecture : |
|
45 // data[0] = 0x12; |
|
46 // data[1] = 0x34; |
|
47 // data[2] = 0xAB; |
|
48 // data[3] = 0xCD; |
|
49 |
37 |
50 // Integers |
38 Result for a little_endian architecture : |
|
39 data[0] = 0xCD; |
|
40 data[1] = 0xAB; |
|
41 data[2] = 0x34; |
|
42 data[3] = 0x12; |
|
43 |
|
44 Result for a big_endian architecture : |
|
45 data[0] = 0x12; |
|
46 data[1] = 0x34; |
|
47 data[2] = 0xAB; |
|
48 data[3] = 0xCD; |
|
49 */ |
|
50 |
|
51 /* Integers */ |
51 #define INTEGER8 char |
52 #define INTEGER8 char |
52 #define INTEGER16 short |
53 #define INTEGER16 short |
53 #define INTEGER24 |
54 #define INTEGER24 |
54 #define INTEGER32 long |
55 #define INTEGER32 long |
55 #define INTEGER40 |
56 #define INTEGER40 |
56 #define INTEGER48 |
57 #define INTEGER48 |
57 #define INTEGER56 |
58 #define INTEGER56 |
58 #define INTEGER64 |
59 #define INTEGER64 |
59 |
60 |
60 // Unsigned integers |
61 /* Unsigned integers */ |
61 #define UNS8 unsigned char |
62 #define UNS8 unsigned char |
62 #define UNS16 unsigned short |
63 #define UNS16 unsigned short |
63 #define UNS32 unsigned long |
64 #define UNS32 unsigned long |
64 #define UNS24 |
65 #define UNS24 |
65 #define UNS40 |
66 #define UNS40 |
66 #define UNS48 |
67 #define UNS48 |
67 #define UNS56 |
68 #define UNS56 |
68 #define UNS64 |
69 #define UNS64 |
69 |
70 |
70 // Reals |
71 /* Reals */ |
71 #define REAL32 float |
72 #define REAL32 float |
72 #define REAL64 double |
73 #define REAL64 double |
73 |
74 |
74 /// Definition of error and warning macros |
75 /* Definition of error and warning macros */ |
75 // -------------------------------------- |
76 /* -------------------------------------- */ |
76 #if defined DEBUG_ERR_CONSOLE_ON || defined DEBUG_WAR_CONSOLE_ON |
77 #if defined DEBUG_ERR_CONSOLE_ON || defined DEBUG_WAR_CONSOLE_ON |
77 #include <stdio.h> |
78 #include <stdio.h> |
78 #endif |
79 #endif |
79 |
80 |
80 /// Definition of MSG_ERR |
81 /* Definition of MSG_ERR */ |
81 // --------------------- |
82 /* --------------------- */ |
82 #ifdef DEBUG_ERR_CONSOLE_ON |
83 #ifdef DEBUG_ERR_CONSOLE_ON |
83 # define MSG_ERR(num, str, val)/* \ |
84 # define MSG_ERR(num, str, val)/* \ |
84 printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);*/ |
85 printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);*/ |
85 #else |
86 #else |
86 # define MSG_ERR(num, str, val) |
87 # define MSG_ERR(num, str, val) |
87 #endif |
88 #endif |
88 |
89 |
89 /// Definition of MSG_WAR |
90 /* Definition of MSG_WAR */ |
90 // --------------------- |
91 /* --------------------- */ |
91 #ifdef DEBUG_WAR_CONSOLE_ON |
92 #ifdef DEBUG_WAR_CONSOLE_ON |
92 # define MSG_WAR(num, str, val)/* \ |
93 # define MSG_WAR(num, str, val)/* \ |
93 printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);*/ |
94 printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);*/ |
94 #else |
95 #else |
95 # define MSG_WAR(num, str, val) |
96 # define MSG_WAR(num, str, val) |