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 |
#include "objdict.h"
|
|
24 |
|
|
25 |
/**************************************************************************/
|
|
26 |
/* Declaration of the mapped variables */
|
|
27 |
/**************************************************************************/
|
|
28 |
|
|
29 |
/**************************************************************************/
|
|
30 |
/* Declaration of the value range types */
|
|
31 |
/**************************************************************************/
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
UNS32 gene_SYNC_valueRangeTest (UNS8 typeValue, UNS32 unsValue, REAL32 realValue)
|
|
36 |
{
|
|
37 |
switch (typeValue) {
|
|
38 |
}
|
|
39 |
return 0;
|
|
40 |
}
|
|
41 |
|
|
42 |
|
|
43 |
/**************************************************************************/
|
|
44 |
/* The node id */
|
|
45 |
/**************************************************************************/
|
|
46 |
/* node_id default value.
|
|
47 |
This default value is deprecated.
|
|
48 |
You should always overwrite this by using the function setNodeId(UNS8 nodeId) in your C code.
|
|
49 |
*/
|
|
50 |
#define NODE_ID 0x03
|
|
51 |
UNS8 gene_SYNC_bDeviceNodeId = NODE_ID;
|
|
52 |
|
|
53 |
|
|
54 |
//*****************************************************************************/
|
|
55 |
/* Array of message processing information */
|
|
56 |
/* Should not be modified */
|
|
57 |
|
|
58 |
const UNS8 gene_SYNC_iam_a_slave = 1;
|
|
59 |
|
|
60 |
// Macros definition
|
|
61 |
|
|
62 |
/* Beware :
|
|
63 |
index *must* be writen 4 numbers in hexa
|
|
64 |
sub_index *must* be writen 2 numbers in hexa
|
|
65 |
size_variable_in_UNS8 *must* be writen 2 numbers in hexa
|
|
66 |
*/
|
|
67 |
#define PDO_MAP(index, sub_index, size_variable_in_bits)\
|
|
68 |
0x ## index ## sub_index ## size_variable_in_bits
|
|
69 |
|
|
70 |
/** This macro helps creating the object dictionary entries.
|
|
71 |
* by calling this macro
|
|
72 |
* it creates an entry in form of: 7 of entries, pointer to the entry.
|
|
73 |
*/
|
|
74 |
#define DeclareIndexTableEntry(entryname, index) { (subindex*)entryname,sizeof(entryname)/sizeof(entryname[0]), index}
|
|
75 |
|
|
76 |
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
|
77 |
//
|
|
78 |
// OBJECT DICTIONARY
|
|
79 |
//
|
|
80 |
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
|
81 |
// Make your change, depending of your application
|
|
82 |
|
|
83 |
|
|
84 |
/* index 0x1000 : Device type.
|
|
85 |
You have to change the value below, so
|
|
86 |
it fits your canopen-slave-module */
|
|
87 |
|
|
88 |
/* Not used, so, should not be modified */
|
|
89 |
|
|
90 |
UNS32 gene_SYNC_obj1000 = 0;
|
|
91 |
subindex gene_SYNC_Index1000[] =
|
|
92 |
{
|
|
93 |
{ RO, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1000 }
|
|
94 |
};
|
|
95 |
|
|
96 |
/* index 0x1001 : Error register.
|
|
97 |
Change the entries to fit your application
|
|
98 |
Not used, so, should not be modified */
|
|
99 |
UNS8 gene_SYNC_obj1001 = 0x00000000;
|
|
100 |
subindex gene_SYNC_Index1001[] =
|
|
101 |
{
|
|
102 |
{ RO, uint8, sizeof(UNS8), (void*)&gene_SYNC_obj1001 }
|
|
103 |
};
|
|
104 |
|
|
105 |
/* index 0x1005 : COB_ID SYNC */
|
|
106 |
/* Should not be modified */
|
|
107 |
UNS32 gene_SYNC_obj1005 = 0x40000080; // bit 30 = 1 : device can generate a SYNC message
|
|
108 |
// Beware, it is over written when the node
|
|
109 |
// enters in reset mode
|
|
110 |
// See initResetMode() in init.c
|
|
111 |
subindex gene_SYNC_Index1005[] =
|
|
112 |
{
|
|
113 |
{ RW, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1005 }
|
|
114 |
};
|
|
115 |
|
|
116 |
/* index 0x1006 : SYNC period */
|
|
117 |
// For producing the SYNC signal every n micro-seconds.
|
|
118 |
// Put 0 to not producing SYNC
|
|
119 |
UNS32 gene_SYNC_obj1006 = 0x000186A0;
|
|
120 |
// Default 0 to not produce SYNC //
|
|
121 |
// Beware, it is over written when the
|
|
122 |
// node enters in reset mode.
|
|
123 |
// See initResetMode() in init.c
|
|
124 |
subindex gene_SYNC_Index1006[] =
|
|
125 |
{
|
|
126 |
{ RW, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1006 }
|
|
127 |
};
|
|
128 |
|
|
129 |
|
|
130 |
TIMER_HANDLE gene_SYNC_heartBeatTimers[0];
|
|
131 |
UNS32 gene_SYNC_obj1016[0];
|
|
132 |
UNS8 gene_SYNC_obj1016_cnt = 0;
|
|
133 |
subindex gene_SYNC_Index1016[0];
|
|
134 |
|
|
135 |
UNS16 gene_SYNC_obj1017 = 0x0000;
|
|
136 |
/* index 0x1018 : Identity object */
|
|
137 |
/** index 1018: identify object. Adjust the entries for your node/company
|
|
138 |
*/
|
|
139 |
/* Values can be modified */
|
|
140 |
|
|
141 |
s_identity gene_SYNC_obj1018 =
|
|
142 |
{
|
|
143 |
4, // number of supported entries
|
|
144 |
0, // Vendor-ID (given by the can-cia)
|
|
145 |
0, // Product Code
|
|
146 |
0, // Revision number
|
|
147 |
0 // serial number
|
|
148 |
};
|
|
149 |
|
|
150 |
subindex gene_SYNC_Index1018[] =
|
|
151 |
{
|
|
152 |
{ RO, uint8, sizeof(UNS8), (void*)&gene_SYNC_obj1018.count },
|
|
153 |
{ RO, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1018.vendor_id},
|
|
154 |
{ RO, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1018.product_code},
|
|
155 |
{ RO, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1018.revision_number},
|
|
156 |
{ RO, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1018.serial_number}
|
|
157 |
};
|
|
158 |
|
|
159 |
/* index 0x1200 : The SDO Server parameters */
|
|
160 |
/* BEWARE You cannot define more than one SDO server */
|
|
161 |
/* The values should not be modified here,
|
|
162 |
but can be changed at runtime */
|
|
163 |
// Beware that the default values that you could put here
|
|
164 |
// will be over written at the initialisation of the node.
|
|
165 |
// See setNodeId() in init.c
|
|
166 |
s_sdo_parameter gene_SYNC_obj1200 =
|
|
167 |
{ 3, // Number of entries. Always 3 for the SDO
|
|
168 |
0x000, // The cob_id transmited in CAN msg to the server
|
|
169 |
0x000, // The cob_id received in CAN msg from the server
|
|
170 |
0x03 // The node id of the client. Should not be modified
|
|
171 |
};
|
|
172 |
subindex gene_SYNC_Index1200[] =
|
|
173 |
{
|
|
174 |
{ RO, uint8, sizeof( UNS8 ), (void*)&gene_SYNC_obj1200.count },
|
|
175 |
{ RO, uint32, sizeof( UNS32), (void*)&gene_SYNC_obj1200.cob_id_client },
|
|
176 |
{ RO, uint32, sizeof( UNS32), (void*)&gene_SYNC_obj1200.cob_id_server },
|
|
177 |
{ RW, uint8, sizeof( UNS8), (void*)&gene_SYNC_obj1200.node_id }
|
|
178 |
};
|
|
179 |
|
|
180 |
/* index 0x1280 : SDO client parameter */
|
|
181 |
s_sdo_parameter gene_SYNC_obj1280 =
|
|
182 |
{ 3, // Nb of entries
|
|
183 |
0x000, // cobid transmited to the server. The good value should be 0x600 + server nodeId
|
|
184 |
0x000, // cobid received from the server. The good value should be 0x580 + server nodeId
|
|
185 |
0x00 // server NodeId
|
|
186 |
};
|
|
187 |
subindex gene_SYNC_Index1280[] =
|
|
188 |
{
|
|
189 |
{ RO, uint8, sizeof( UNS8 ), (void*)&gene_SYNC_obj1280.count },
|
|
190 |
{ RW, uint8, sizeof( UNS32 ), (void*)&gene_SYNC_obj1280.cob_id_client },
|
|
191 |
{ RW, uint8, sizeof( UNS32 ), (void*)&gene_SYNC_obj1280.cob_id_server },
|
|
192 |
{ RW, uint8, sizeof( UNS8 ), (void*)&gene_SYNC_obj1280.node_id }
|
|
193 |
};
|
|
194 |
|
|
195 |
|
|
196 |
const indextable gene_SYNC_objdict[] =
|
|
197 |
{
|
|
198 |
DeclareIndexTableEntry(gene_SYNC_Index1000, 0x1000),
|
|
199 |
DeclareIndexTableEntry(gene_SYNC_Index1001, 0x1001),
|
|
200 |
DeclareIndexTableEntry(gene_SYNC_Index1005, 0x1005),
|
|
201 |
DeclareIndexTableEntry(gene_SYNC_Index1006, 0x1006),
|
|
202 |
DeclareIndexTableEntry(gene_SYNC_Index1018, 0x1018),
|
|
203 |
DeclareIndexTableEntry(gene_SYNC_Index1200, 0x1200),
|
|
204 |
DeclareIndexTableEntry(gene_SYNC_Index1280, 0x1280),
|
|
205 |
};
|
|
206 |
|
|
207 |
// To count at which received SYNC a PDO must be sent.
|
|
208 |
// Even if no pdoTransmit are defined, at least one entry is computed
|
|
209 |
// for compilations issues.
|
|
210 |
UNS8 gene_SYNC_count_sync[1] = {0, };
|
|
211 |
|
|
212 |
quick_index gene_SYNC_firstIndex = {
|
|
213 |
SDO_SVR : 5,
|
|
214 |
SDO_CLT : 6,
|
|
215 |
PDO_RCV : 0,
|
|
216 |
PDO_RCV_MAP : 0,
|
|
217 |
PDO_TRS : 0,
|
|
218 |
PDO_TRS_MAP : 0
|
|
219 |
};
|
|
220 |
|
|
221 |
quick_index gene_SYNC_lastIndex = {
|
|
222 |
SDO_SVR : 5,
|
|
223 |
SDO_CLT : 6,
|
|
224 |
PDO_RCV : 0,
|
|
225 |
PDO_RCV_MAP : 0,
|
|
226 |
PDO_TRS : 0,
|
|
227 |
PDO_TRS_MAP : 0
|
|
228 |
};
|
|
229 |
|
|
230 |
UNS16 gene_SYNC_ObjdictSize = sizeof(gene_SYNC_objdict)/sizeof(gene_SYNC_objdict[0]);
|
|
231 |
|
|
232 |
CO_Data gene_SYNC_Data = CANOPEN_NODE_DATA_INITIALIZER(gene_SYNC);
|
|
233 |
|