|
1 /* |
|
2 This file is part of CanFestival, a library implementing CanOpen Stack. |
|
3 |
|
4 Copyright (C): Edouard TISSERANT and Francis DUPIN |
|
5 AT91 Port: Peter CHRISTEN |
|
6 |
|
7 See COPYING file for copyrights details. |
|
8 |
|
9 This library is free software; you can redistribute it and/or |
|
10 modify it under the terms of the GNU Lesser General Public |
|
11 License as published by the Free Software Foundation; either |
|
12 version 2.1 of the License, or (at your option) any later version. |
|
13 |
|
14 This library is distributed in the hope that it will be useful, |
|
15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
17 Lesser General Public License for more details. |
|
18 |
|
19 You should have received a copy of the GNU Lesser General Public |
|
20 License along with this library; if not, write to the Free Software |
|
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
22 */ |
|
23 |
|
24 #ifndef __APPLICFG_AVR__ |
|
25 #define __APPLICFG_AVR__ |
|
26 |
|
27 #include <string.h> |
|
28 #include <stdio.h> |
|
29 |
|
30 |
|
31 /// Convert an integer to a string in hexadecimal format |
|
32 /// If you do not wants to use a lastCar, put lastCar = '\0' (end of string) |
|
33 /// ex : value = 0XABCDEF and lastCar = '\n' |
|
34 /// buf[0] = '0' |
|
35 /// buf[1] = 'X' |
|
36 /// buf[2] = 'A' |
|
37 /// .... |
|
38 /// buf[7] = 'F' |
|
39 /// buf[8] = '\n' |
|
40 /// buf[9] = '\0' |
|
41 extern char * |
|
42 hex_convert (char *buf, unsigned long value, char lastCar); |
|
43 |
|
44 /// Print the string to the serial port sci |
|
45 /// (sci takes the values SCI0 or SCI1) |
|
46 extern void printSCI_str (char sci, const char * str); |
|
47 |
|
48 /// Print the number in hexadecimal to the serial port sci |
|
49 /// (sci takes the values SCI0 or SCI1) |
|
50 extern void printSCI_nbr (char sci, unsigned long nbr, char lastCar); |
|
51 |
|
52 // Integers |
|
53 #define INTEGER8 signed char |
|
54 #define INTEGER16 short |
|
55 #define INTEGER24 long |
|
56 #define INTEGER32 long |
|
57 #define INTEGER40 long long |
|
58 #define INTEGER48 long long |
|
59 #define INTEGER56 long long |
|
60 #define INTEGER64 long long |
|
61 |
|
62 // Unsigned integers |
|
63 #define UNS8 unsigned char |
|
64 #define UNS16 unsigned short |
|
65 #define UNS32 unsigned long |
|
66 #define UNS24 unsigned long |
|
67 #define UNS40 unsigned long long |
|
68 #define UNS48 unsigned long long |
|
69 #define UNS56 unsigned long long |
|
70 #define UNS64 unsigned long long |
|
71 |
|
72 // Reals |
|
73 #define REAL32 float |
|
74 #define REAL64 double |
|
75 |
|
76 // Reals |
|
77 #define REAL32 float |
|
78 #define REAL64 double |
|
79 |
|
80 #include "can.h" |
|
81 |
|
82 |
|
83 /// Definition of MSG_ERR |
|
84 // --------------------- |
|
85 #ifdef DEBUG_ERR_CONSOLE_ON |
|
86 # define MSG_ERR(num, str, val) \ |
|
87 initSCI_0(); \ |
|
88 printSCI_nbr(SCI0, num, ' '); \ |
|
89 /* large printing on console */ \ |
|
90 printSCI_str(SCI0, str); \ |
|
91 printSCI_nbr(SCI0, val, '\n'); |
|
92 #else |
|
93 # define MSG_ERR(num, str, val) |
|
94 #endif |
|
95 |
|
96 /// Definition of MSG_WAR |
|
97 // --------------------- |
|
98 #ifdef DEBUG_WAR_CONSOLE_ON |
|
99 # define MSG_WAR(num, str, val) \ |
|
100 initSCI_0(); \ |
|
101 printSCI_nbr(SCI0, num, ' '); \ |
|
102 /* large printing on console */ \ |
|
103 printSCI_str(SCI0, str); \ |
|
104 printSCI_nbr(SCI0, val, '\n'); |
|
105 #else |
|
106 # define MSG_WAR(num, str, val) |
|
107 #endif |
|
108 |
|
109 typedef void* CAN_HANDLE; |
|
110 |
|
111 typedef void* CAN_PORT; |
|
112 |
|
113 #endif |
|
114 |
|
115 |