nico@207: nico@207:
nico@207:00001 /* nico@207: 00002 This file is part of CanFestival, a library implementing CanOpen Stack. nico@207: 00003 nico@207: 00004 Copyright (C): Edouard TISSERANT and Francis DUPIN nico@207: 00005 nico@207: 00006 See COPYING file for copyrights details. nico@207: 00007 nico@207: 00008 This library is free software; you can redistribute it and/or nico@207: 00009 modify it under the terms of the GNU Lesser General Public nico@207: 00010 License as published by the Free Software Foundation; either nico@207: 00011 version 2.1 of the License, or (at your option) any later version. nico@207: 00012 nico@207: 00013 This library is distributed in the hope that it will be useful, nico@207: 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of nico@207: 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU nico@207: 00016 Lesser General Public License for more details. nico@207: 00017 nico@207: 00018 You should have received a copy of the GNU Lesser General Public nico@207: 00019 License along with this library; if not, write to the Free Software nico@207: 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA nico@207: 00021 */ nico@207: 00022 nico@207: 00023 nico@207: 00024 #include <stddef.h> nico@207: 00025 nico@207: 00026 #include <canfestival/applicfg.h> nico@207: 00027 #include "canfestival/def.h" nico@207: 00028 #include "canfestival/can.h" nico@207: 00029 #include "canfestival/objdictdef.h" nico@207: 00030 #include "canfestival/pdo.h" nico@207: 00031 #include "canfestival/sdo.h" nico@207: 00032 #include "canfestival/sync.h" nico@207: 00033 #include "canfestival/lifegrd.h" nico@207: 00034 #include "canfestival/nmtSlave.h" nico@207: 00035 nico@207: 00036 /**************************************************************************/ nico@207: 00037 /* Declaration of the mapped variables */ nico@207: 00038 /**************************************************************************/ nico@207: 00039 UNS8 seconds = 0; // Mapped at index 0x2000, subindex 0x01 nico@207: 00040 UNS8 minutes = 0; // Mapped at index 0x2000, subindex 0x02 nico@207: 00041 UNS8 hours = 0; // Mapped at index 0x2000, subindex 0x03 nico@207: 00042 UNS8 day = 0; // Mapped at index 0x2000, subindex 0x04 nico@207: 00043 UNS32 canopenErrNB = 0; // Mapped at index 0x6000, subindex 0x00 nico@207: 00044 UNS32 canopenErrVAL = 0; // Mapped at index 0x6001, subindex 0x00 nico@207: 00045 UNS8 strTest[10] = 0; // Mapped at index 0x6002, subindex 0x00 nico@207: 00046 nico@207: 00047 /**************************************************************************/ nico@207: 00048 /* Declaration of the value range types */ nico@207: 00049 /**************************************************************************/ nico@207: 00050 nico@207: 00051 nico@207: 00052 nico@207: 00053 UNS32 Linux_slave_valueRangeTest (UNS8 typeValue, UNS32 unsValue, REAL32 realValue) nico@207: 00054 { nico@207: 00055 switch (typeValue) { nico@207: 00056 } nico@207: 00057 return 0; nico@207: 00058 } nico@207: 00059 nico@207: 00060 nico@207: 00061 /**************************************************************************/ nico@207: 00062 /* The node id */ nico@207: 00063 /**************************************************************************/ nico@207: 00064 /* node_id default value. nico@207: 00065 This default value is deprecated. nico@207: 00066 You should always overwrite this by using the function setNodeId(UNS8 nodeId) in your C code. nico@207: 00067 */ nico@207: 00068 #define NODE_ID 0x01 nico@207: 00069 UNS8 Linux_slave_bDeviceNodeId = NODE_ID; nico@207: 00070 nico@207: 00071 nico@207: 00072 //*****************************************************************************/ nico@207: 00073 /* Array of message processing information */ nico@207: 00074 /* Should not be modified */ nico@207: 00075 nico@207: 00076 const UNS8 Linux_slave_iam_a_slave = 1 nico@207: 00077 nico@207: 00078 // Macros definition nico@207: 00079 nico@207: 00080 /* Beware : nico@207: 00081 index *must* be writen 4 numbers in hexa nico@207: 00082 sub_index *must* be writen 2 numbers in hexa nico@207: 00083 size_variable_in_UNS8 *must* be writen 2 numbers in hexa nico@207: 00084 */ nico@207: 00085 #define PDO_MAP(index, sub_index, size_variable_in_bits)\ nico@207: 00086 0x ## index ## sub_index ## size_variable_in_bits nico@207: 00087 nico@207: 00092 #define DeclareIndexTableEntry(entryname, index) { (subindex*)entryname,sizeof(entryname)/sizeof(entryname[0]), index} nico@207: 00093 nico@207: 00094 //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ nico@207: 00095 // nico@207: 00096 // OBJECT DICTIONARY nico@207: 00097 // nico@207: 00098 //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ nico@207: 00099 // Make your change, depending of your application nico@207: 00100 nico@207: 00101 nico@207: 00102 /* index 0x1000 : Device type. nico@207: 00103 You have to change the value below, so nico@207: 00104 it fits your canopen-slave-module */ nico@207: 00105 nico@207: 00106 /* Not used, so, should not be modified */ nico@207: 00107 nico@207: 00108 UNS32 Linux_slave_obj1000 = 0; nico@207: 00109 subindex Linux_slave_Index1000[] = nico@207: 00110 { nico@207: 00111 { RO, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1000 } nico@207: 00112 }; nico@207: 00113 nico@207: 00114 /* index 0x1001 : Error register. nico@207: 00115 Change the entries to fit your application nico@207: 00116 Not used, so, should not be modified */ nico@207: 00117 /*const*/ UNS8 Linux_slave_obj1001 = 0x0; nico@207: 00118 /*const*/ subindex Linux_slave_Index1001[] = nico@207: 00119 { nico@207: 00120 { RO, uint8, sizeof(UNS8), (void*)&Linux_slave_obj1001 } nico@207: 00121 }; nico@207: 00122 nico@207: 00123 /* index 0x1005 : COB_ID SYNC */ nico@207: 00124 /* Should not be modified */ nico@207: 00125 UNS32 Linux_slave_obj1005 = 0x00000080; // bit 30 = 1 : device can generate a SYNC message nico@207: 00126 // Beware, it is over written when the node nico@207: 00127 // enters in reset mode nico@207: 00128 // See initResetMode() in init.c nico@207: 00129 /*const*/ subindex Linux_slave_Index1005[] = nico@207: 00130 { nico@207: 00131 { RW, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1005 } nico@207: 00132 }; nico@207: 00133 nico@207: 00134 /* index 0x1006 : SYNC period */ nico@207: 00135 // For producing the SYNC signal every n micro-seconds. nico@207: 00136 // Put 0 to not producing SYNC nico@207: 00137 /*const*/ UNS32 Linux_slave_obj1006 = 0x0; nico@207: 00138 // Default 0 to not produce SYNC // nico@207: 00139 // Beware, it is over written when the nico@207: 00140 // node enters in reset mode. nico@207: 00141 // See initResetMode() in init.c nico@207: 00142 /*const*/ subindex Linux_slave_Index1006[] = nico@207: 00143 { nico@207: 00144 { RW, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1006 } nico@207: 00145 }; nico@207: 00146 nico@207: 00147 /* index 0x1007 : Synchronous Window Length nico@207: 00148 Seems to be needed by DS401 to generate the SYNC signal ! */ nico@207: 00149 /*const*/ UNS32 Linux_slave_obj1007 = 0x0; /* Default 0 */ nico@207: 00150 /*const*/ subindex Linux_slave_Index1007[] = nico@207: 00151 { nico@207: 00152 { RW, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1007 } nico@207: 00153 }; nico@207: 00154 nico@207: 00155 /* index 0x1008 : Manufacturer device name */ nico@207: 00156 UNS8 Linux_slave_obj1008[] = "Appli_Slave_HC12"; /* Default 0 */ nico@207: 00157 subindex Linux_slave_Index1008[] = nico@207: 00158 { nico@207: 00159 { RO, uint32, sizeof(Linux_slave_obj1008), (void*)&Linux_slave_obj1008 } nico@207: 00160 }; nico@207: 00161 nico@207: 00162 /* index 0x1009 : Manufacturer hardware version */ nico@207: 00163 UNS8 Linux_slave_obj1009[] = "__DATE__"; /* Default 0 */ nico@207: 00164 subindex Linux_slave_Index1009[] = nico@207: 00165 { nico@207: 00166 { RO, uint32, sizeof(Linux_slave_obj1009), (void*)&Linux_slave_obj1009 } nico@207: 00167 }; nico@207: 00168 nico@207: 00169 /* index 0x100A : Manufacturer software version */ nico@207: 00170 UNS8 Linux_slave_obj100A[] = __TIME__; /* Default 0 */ nico@207: 00171 subindex Linux_slave_Index100A[] = nico@207: 00172 { nico@207: 00173 { RO, uint32, Linux_slave_sizeof(obj100A), (void*)&Linux_slave_obj100A} nico@207: 00174 }; nico@207: 00175 nico@207: 00176 nico@207: 00177 TIMER_HANDLE Linux_slave_heartBeatTimers[1] = {TIMER_NONE,}; nico@207: 00178 /* index 0x1016 : HeartBeat consumers nico@207: 00179 The nodes which can send a heartbeat */ nico@207: 00180 UNS32 Linux_slave_obj1016[] = {// Consumer time for each node nico@207: 00181 0x00000000}; // Format 0x00NNTTTT (N=Node T=time in ms) nico@207: 00182 nico@207: 00183 UNS8 Linux_slave_obj1016_cnt = 1; // 1 nodes could send me nico@207: 00184 // their heartbeat. nico@207: 00185 subindex Linux_slave_Index1016[] = nico@207: 00186 { nico@207: 00187 { RO, uint8, sizeof(UNS8), (void*)&Linux_slave_obj1016_cnt }, nico@207: 00188 { RW, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1016[0] } nico@207: 00189 }; nico@207: 00190 nico@207: 00191 /* index 0x1017 : Heartbeat producer nico@207: 00192 Every HBProducerTime, the node sends its heartbeat */ nico@207: 00193 UNS16 Linux_slave_obj1017 = 0; //HBProducerTime in ms. If 0 : not activated nico@207: 00194 // Beware, it is over written when the nico@207: 00195 // node enters in reset mode. nico@207: 00196 // See initResetMode() in init.c nico@207: 00197 subindex Linux_slave_Index1017[] = nico@207: 00198 { nico@207: 00199 { RW, uint16, sizeof(UNS16), &Linux_slave_obj1017 } nico@207: 00200 }; nico@207: 00201 nico@207: 00202 /* index 0x1018 : Identity object */ nico@207: 00205 /* Values can be modified */ nico@207: 00206 nico@207: 00207 s_identity Linux_slave_obj1018 = nico@207: 00208 { nico@207: 00209 4, // number of supported entries nico@207: 00210 0, // Vendor-ID (given by the can-cia) nico@207: 00211 0, // Product Code nico@207: 00212 0, // Revision number nico@207: 00213 0 // serial number nico@207: 00214 }; nico@207: 00215 nico@207: 00216 subindex Linux_slave_Index1018[] = nico@207: 00217 { nico@207: 00218 { RO, uint8, sizeof(UNS8), (void*)&Linux_slave_obj1018.count }, nico@207: 00219 { RO, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1018.vendor_id}, nico@207: 00220 { RO, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1018.product_code}, nico@207: 00221 { RO, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1018.revision_number}, nico@207: 00222 { RO, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1018.serial_number} nico@207: 00223 }; nico@207: 00224 nico@207: 00225 /* index 0x1200 : The SDO Server parameters */ nico@207: 00226 /* BEWARE You cannot define more than one SDO server */ nico@207: 00227 /* The values should not be modified here, nico@207: 00228 but can be changed at runtime */ nico@207: 00229 // Beware that the default values that you could put here nico@207: 00230 // will be over written at the initialisation of the node. nico@207: 00231 // See setNodeId() in init.c nico@207: 00232 s_sdo_parameter Linux_slave_obj1200 = nico@207: 00233 { 3, // Number of entries. Always 3 for the SDO nico@207: 00234 0x601, // The cob_id transmited in CAN msg to the server nico@207: 00235 0x581, // The cob_id received in CAN msg from the server nico@207: 00236 0x01 // The node id of the client. Should not be modified nico@207: 00237 }; nico@207: 00238 subindex Linux_slave_Index1200[] = nico@207: 00239 { nico@207: 00240 { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1200.count }, nico@207: 00241 { RO, uint32, sizeof( UNS32), (void*)&Linux_slave_obj1200.cob_id_client }, nico@207: 00242 { RO, uint32, sizeof( UNS32), (void*)&Linux_slave_obj1200.cob_id_server }, nico@207: 00243 { RW, uint8, sizeof( UNS8), (void*)&Linux_slave_obj1200.node_id } nico@207: 00244 }; nico@207: 00245 nico@207: 00246 /* index 0x1280 : SDO client parameter */ nico@207: 00247 s_sdo_parameter Linux_slave_obj1280 = nico@207: 00248 { 3, // Nb of entries nico@207: 00249 0x600, // cobid transmited to the server. The good value should be 0x600 + server nodeId nico@207: 00250 0x580, // cobid received from the server. The good value should be 0x580 + server nodeId nico@207: 00251 0x01 // server NodeId nico@207: 00252 }; nico@207: 00253 subindex Linux_slave_Index1280[] = nico@207: 00254 { nico@207: 00255 { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1280.count }, nico@207: 00256 { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1280.cob_id_client }, nico@207: 00257 { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1280.cob_id_server }, nico@207: 00258 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1280.node_id } nico@207: 00259 }; nico@207: 00260 nico@207: 00261 /* index 0x1400 : PDO receive communication parameter */ nico@207: 00262 s_pdo_communication_parameter Linux_slave_obj1400 = nico@207: 00263 { 2, // Largest subindex supported nico@207: 00264 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) nico@207: 00265 253 // Transmission type. See objdictdef.h nico@207: 00266 }; nico@207: 00267 subindex Linux_slave_Index1400[] = nico@207: 00268 { nico@207: 00269 { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1400.count }, nico@207: 00270 { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1400.cob_id }, nico@207: 00271 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1400.type }, nico@207: 00272 }; nico@207: 00273 nico@207: 00274 /* index 0x1401 : PDO receive communication parameter */ nico@207: 00275 s_pdo_communication_parameter Linux_slave_obj1401 = nico@207: 00276 { 2, // Largest subindex supported nico@207: 00277 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) nico@207: 00278 253 // Transmission type. See objdictdef.h nico@207: 00279 }; nico@207: 00280 subindex Linux_slave_Index1401[] = nico@207: 00281 { nico@207: 00282 { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1401.count }, nico@207: 00283 { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1401.cob_id }, nico@207: 00284 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1401.type }, nico@207: 00285 }; nico@207: 00286 nico@207: 00287 /* index 0x1402 : PDO receive communication parameter */ nico@207: 00288 s_pdo_communication_parameter Linux_slave_obj1402 = nico@207: 00289 { 2, // Largest subindex supported nico@207: 00290 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) nico@207: 00291 253 // Transmission type. See objdictdef.h nico@207: 00292 }; nico@207: 00293 subindex Linux_slave_Index1402[] = nico@207: 00294 { nico@207: 00295 { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1402.count }, nico@207: 00296 { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1402.cob_id }, nico@207: 00297 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1402.type }, nico@207: 00298 }; nico@207: 00299 nico@207: 00300 /* index 0x1600 : PDO receive mapping parameter of PDO communication index 0x1400 */ nico@207: 00301 UNS8 Linux_slave_obj1600_cnt = 0; // Number of mapped variables nico@207: 00302 UNS32 Linux_slave_obj1600_mappedVar[] = { nico@207: 00303 0x00000000, nico@207: 00304 0x00000000, nico@207: 00305 0x00000000, nico@207: 00306 0x00000000, nico@207: 00307 0x00000000, nico@207: 00308 0x00000000, nico@207: 00309 0x00000000, nico@207: 00310 0x00000000 nico@207: 00311 }; nico@207: 00312 subindex Linux_slave_Index1600[] = nico@207: 00313 { nico@207: 00314 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1600_cnt }, nico@207: 00315 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[0]}, nico@207: 00316 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[1]}, nico@207: 00317 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[2]}, nico@207: 00318 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[3]}, nico@207: 00319 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[4]}, nico@207: 00320 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[5]}, nico@207: 00321 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[6]}, nico@207: 00322 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[7]} nico@207: 00323 }; nico@207: 00324 nico@207: 00325 /* index 0x1601 : PDO receive mapping parameter of PDO communication index 0x1401 */ nico@207: 00326 UNS8 Linux_slave_obj1601_cnt = 0; // Number of mapped variables nico@207: 00327 UNS32 Linux_slave_obj1601_mappedVar[] = { nico@207: 00328 0x00000000, nico@207: 00329 0x00000000, nico@207: 00330 0x00000000, nico@207: 00331 0x00000000, nico@207: 00332 0x00000000, nico@207: 00333 0x00000000, nico@207: 00334 0x00000000, nico@207: 00335 0x00000000 nico@207: 00336 }; nico@207: 00337 subindex Linux_slave_Index1601[] = nico@207: 00338 { nico@207: 00339 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1601_cnt }, nico@207: 00340 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[0]}, nico@207: 00341 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[1]}, nico@207: 00342 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[2]}, nico@207: 00343 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[3]}, nico@207: 00344 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[4]}, nico@207: 00345 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[5]}, nico@207: 00346 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[6]}, nico@207: 00347 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[7]} nico@207: 00348 }; nico@207: 00349 nico@207: 00350 /* index 0x1602 : PDO receive mapping parameter of PDO communication index 0x1402 */ nico@207: 00351 UNS8 Linux_slave_obj1602_cnt = 0; // Number of mapped variables nico@207: 00352 UNS32 Linux_slave_obj1602_mappedVar[] = { nico@207: 00353 0x00000000, nico@207: 00354 0x00000000, nico@207: 00355 0x00000000, nico@207: 00356 0x00000000, nico@207: 00357 0x00000000, nico@207: 00358 0x00000000, nico@207: 00359 0x00000000, nico@207: 00360 0x00000000 nico@207: 00361 }; nico@207: 00362 subindex Linux_slave_Index1602[] = nico@207: 00363 { nico@207: 00364 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1602_cnt }, nico@207: 00365 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[0]}, nico@207: 00366 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[1]}, nico@207: 00367 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[2]}, nico@207: 00368 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[3]}, nico@207: 00369 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[4]}, nico@207: 00370 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[5]}, nico@207: 00371 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[6]}, nico@207: 00372 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[7]} nico@207: 00373 }; nico@207: 00374 nico@207: 00375 /* index 0x1800 : PDO transmit communication parameter */ nico@207: 00376 s_pdo_communication_parameter Linux_slave_obj1800 = nico@207: 00377 { 2, // Largest subindex supported nico@207: 00378 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) nico@207: 00379 253 // Transmission type. See objdictdef.h nico@207: 00380 }; nico@207: 00381 subindex Linux_slave_Index1800[] = nico@207: 00382 { nico@207: 00383 { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1800.count }, nico@207: 00384 { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1800.cob_id }, nico@207: 00385 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1800.type }, nico@207: 00386 }; nico@207: 00387 nico@207: 00388 /* index 0x1801 : PDO transmit communication parameter */ nico@207: 00389 s_pdo_communication_parameter Linux_slave_obj1801 = nico@207: 00390 { 2, // Largest subindex supported nico@207: 00391 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) nico@207: 00392 253 // Transmission type. See objdictdef.h nico@207: 00393 }; nico@207: 00394 subindex Linux_slave_Index1801[] = nico@207: 00395 { nico@207: 00396 { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1801.count }, nico@207: 00397 { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1801.cob_id }, nico@207: 00398 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1801.type }, nico@207: 00399 }; nico@207: 00400 nico@207: 00401 /* index 0x1802 : PDO transmit communication parameter */ nico@207: 00402 s_pdo_communication_parameter Linux_slave_obj1802 = nico@207: 00403 { 2, // Largest subindex supported nico@207: 00404 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) nico@207: 00405 253 // Transmission type. See objdictdef.h nico@207: 00406 }; nico@207: 00407 subindex Linux_slave_Index1802[] = nico@207: 00408 { nico@207: 00409 { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1802.count }, nico@207: 00410 { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1802.cob_id }, nico@207: 00411 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1802.type }, nico@207: 00412 }; nico@207: 00413 nico@207: 00414 /* index 0x1A00 : PDO transmit mapping parameter of PDO communication index 0x1800 */ nico@207: 00415 UNS8 Linux_slave_obj1A00_cnt = 0; // Number of mapped variables nico@207: 00416 UNS32 Linux_slave_obj1A00_mappedVar[] = { nico@207: 00417 0x00000000, nico@207: 00418 0x00000000, nico@207: 00419 0x00000000, nico@207: 00420 0x00000000, nico@207: 00421 0x00000000, nico@207: 00422 0x00000000, nico@207: 00423 0x00000000, nico@207: 00424 0x00000000 nico@207: 00425 }; nico@207: 00426 subindex Linux_slave_Index1A00[] = nico@207: 00427 { nico@207: 00428 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1A00_cnt }, nico@207: 00429 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[0]}, nico@207: 00430 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[1]}, nico@207: 00431 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[2]}, nico@207: 00432 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[3]}, nico@207: 00433 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[4]}, nico@207: 00434 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[5]}, nico@207: 00435 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[6]}, nico@207: 00436 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[7]} nico@207: 00437 }; nico@207: 00438 nico@207: 00439 /* index 0x1A01 : PDO transmit mapping parameter of PDO communication index 0x1801 */ nico@207: 00440 UNS8 Linux_slave_obj1A01_cnt = 0; // Number of mapped variables nico@207: 00441 UNS32 Linux_slave_obj1A01_mappedVar[] = { nico@207: 00442 0x00000000, nico@207: 00443 0x00000000, nico@207: 00444 0x00000000, nico@207: 00445 0x00000000, nico@207: 00446 0x00000000, nico@207: 00447 0x00000000, nico@207: 00448 0x00000000, nico@207: 00449 0x00000000 nico@207: 00450 }; nico@207: 00451 subindex Linux_slave_Index1A01[] = nico@207: 00452 { nico@207: 00453 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1A01_cnt }, nico@207: 00454 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[0]}, nico@207: 00455 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[1]}, nico@207: 00456 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[2]}, nico@207: 00457 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[3]}, nico@207: 00458 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[4]}, nico@207: 00459 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[5]}, nico@207: 00460 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[6]}, nico@207: 00461 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[7]} nico@207: 00462 }; nico@207: 00463 nico@207: 00464 /* index 0x1A02 : PDO transmit mapping parameter of PDO communication index 0x1802 */ nico@207: 00465 UNS8 Linux_slave_obj1A02_cnt = 0; // Number of mapped variables nico@207: 00466 UNS32 Linux_slave_obj1A02_mappedVar[] = { nico@207: 00467 0x00000000, nico@207: 00468 0x00000000, nico@207: 00469 0x00000000, nico@207: 00470 0x00000000, nico@207: 00471 0x00000000, nico@207: 00472 0x00000000, nico@207: 00473 0x00000000, nico@207: 00474 0x00000000 nico@207: 00475 }; nico@207: 00476 subindex Linux_slave_Index1A02[] = nico@207: 00477 { nico@207: 00478 { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1A02_cnt }, nico@207: 00479 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[0]}, nico@207: 00480 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[1]}, nico@207: 00481 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[2]}, nico@207: 00482 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[3]}, nico@207: 00483 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[4]}, nico@207: 00484 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[5]}, nico@207: 00485 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[6]}, nico@207: 00486 { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[7]} nico@207: 00487 }; nico@207: 00488 nico@207: 00489 nico@207: 00490 /* index 0x2000 : Mapped variable */ nico@207: 00491 UNS8 Linux_slave_highestSubIndex_2000 = 4; // number of subindex - 1 nico@207: 00492 subindex Linux_slave_Index2000[] = nico@207: 00493 { nico@207: 00494 { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_2000 }, nico@207: 00495 { RW, uint8, sizeof (UNS8), (void*)&seconds }, nico@207: 00496 { RW, uint8, sizeof (UNS8), (void*)&minutes }, nico@207: 00497 { RW, uint8, sizeof (UNS8), (void*)&hours }, nico@207: 00498 { RW, uint8, sizeof (UNS8), (void*)&day } nico@207: 00499 }; nico@207: 00500 nico@207: 00501 /* index 0x6000 : Mapped variable */ nico@207: 00502 UNS8 Linux_slave_highestSubIndex_6000 = 0; // number of subindex - 1 nico@207: 00503 subindex Linux_slave_Index6000[] = nico@207: 00504 { nico@207: 00505 { RW, uint32, sizeof (UNS32), (void*)&canopenErrNB } nico@207: 00506 }; nico@207: 00507 nico@207: 00508 /* index 0x6001 : Mapped variable */ nico@207: 00509 UNS8 Linux_slave_highestSubIndex_6001 = 0; // number of subindex - 1 nico@207: 00510 subindex Linux_slave_Index6001[] = nico@207: 00511 { nico@207: 00512 { RW, uint32, sizeof (UNS32), (void*)&canopenErrVAL } nico@207: 00513 }; nico@207: 00514 nico@207: 00515 /* index 0x6002 : Mapped variable */ nico@207: 00516 UNS8 Linux_slave_highestSubIndex_6002 = 0; // number of subindex - 1 nico@207: 00517 subindex Linux_slave_Index6002[] = nico@207: 00518 { nico@207: 00519 { RW, visible_string, sizeof (strTest), (void*)&strTest } nico@207: 00520 }; nico@207: 00521 nico@207: 00522 const indextable Linux_slave_objdict[] = nico@207: 00523 { nico@207: 00524 DeclareIndexTableEntry(Linux_slave_Index1000, 0x1000), nico@207: 00525 DeclareIndexTableEntry(Linux_slave_Index1001, 0x1001), nico@207: 00526 DeclareIndexTableEntry(Linux_slave_Index1005, 0x1005), nico@207: 00527 DeclareIndexTableEntry(Linux_slave_Index1006, 0x1006), nico@207: 00528 DeclareIndexTableEntry(Linux_slave_Index1007, 0x1007), nico@207: 00529 DeclareIndexTableEntry(Linux_slave_Index1008, 0x1008), nico@207: 00530 DeclareIndexTableEntry(Linux_slave_Index1009, 0x1009), nico@207: 00531 DeclareIndexTableEntry(Linux_slave_Index100A, 0x100A), nico@207: 00532 DeclareIndexTableEntry(Linux_slave_Index1016, 0x1016), nico@207: 00533 DeclareIndexTableEntry(Linux_slave_Index1017, 0x1017), nico@207: 00534 DeclareIndexTableEntry(Linux_slave_Index1018, 0x1018), nico@207: 00535 DeclareIndexTableEntry(Linux_slave_Index1200, 0x1200), nico@207: 00536 DeclareIndexTableEntry(Linux_slave_Index1280, 0x1280), nico@207: 00537 DeclareIndexTableEntry(Linux_slave_Index1400, 0x1400), nico@207: 00538 DeclareIndexTableEntry(Linux_slave_Index1401, 0x1401), nico@207: 00539 DeclareIndexTableEntry(Linux_slave_Index1402, 0x1402), nico@207: 00540 DeclareIndexTableEntry(Linux_slave_Index1600, 0x1600), nico@207: 00541 DeclareIndexTableEntry(Linux_slave_Index1601, 0x1601), nico@207: 00542 DeclareIndexTableEntry(Linux_slave_Index1602, 0x1602), nico@207: 00543 DeclareIndexTableEntry(Linux_slave_Index1800, 0x1800), nico@207: 00544 DeclareIndexTableEntry(Linux_slave_Index1801, 0x1801), nico@207: 00545 DeclareIndexTableEntry(Linux_slave_Index1802, 0x1802), nico@207: 00546 DeclareIndexTableEntry(Linux_slave_Index1A00, 0x1A00), nico@207: 00547 DeclareIndexTableEntry(Linux_slave_Index1A01, 0x1A01), nico@207: 00548 DeclareIndexTableEntry(Linux_slave_Index1A02, 0x1A02), nico@207: 00549 DeclareIndexTableEntry(Linux_slave_Index2000, 0x2000), nico@207: 00550 DeclareIndexTableEntry(Linux_slave_Index6000, 0x6000), nico@207: 00551 DeclareIndexTableEntry(Linux_slave_Index6001, 0x6001), nico@207: 00552 DeclareIndexTableEntry(Linux_slave_Index6002, 0x6002), nico@207: 00553 }; nico@207: 00554 nico@207: 00555 // To count at which received SYNC a PDO must be sent. nico@207: 00556 // Even if no pdoTransmit are defined, at least one entry is computed nico@207: 00557 // for compilations issues. nico@207: 00558 UNS8 Linux_slave_count_sync[1] = {0, }; nico@207: 00559 nico@207: 00560 quick_index Linux_slave_firstIndex = { nico@207: 00561 SDO_SVR : 11, nico@207: 00562 SDO_CLT : 12, nico@207: 00563 PDO_RCV : 13, nico@207: 00564 PDO_RCV_MAP : 16, nico@207: 00565 PDO_TRS : 19, nico@207: 00566 PDO_TRS_MAP : 22 nico@207: 00567 } nico@207: 00568 nico@207: 00569 quick_index Linux_slave_lastIndex{ nico@207: 00570 SDO_SVR : 11, nico@207: 00571 SDO_CLT : 12, nico@207: 00572 PDO_RCV : 15, nico@207: 00573 PDO_RCV_MAP : 18, nico@207: 00574 PDO_TRS : 21, nico@207: 00575 PDO_TRS_MAP : 24 nico@207: 00576 } nico@207: 00577 nico@207: 00578 UNS16 Linux_slave_ObjdictSize = sizeof(Linux_slave_objdict)/sizeof(Linux_slave_objdict[0]); nico@207: 00579 nico@207: