# HG changeset patch # User lbessard # Date 1190701184 -7200 # Node ID 685d9a26e4f986d290559d54c76c0c8454f8de6e # Parent d9b232ec7057eaa19b9f53345f8a25620b3dcb30 Obsolete example files in objdictgen/examples replaced by some new equivalents Some bugs fixed diff -r d9b232ec7057 -r 685d9a26e4f9 objdictgen/examples/example_objdict.c --- a/objdictgen/examples/example_objdict.c Mon Sep 24 09:37:04 2007 +0200 +++ b/objdictgen/examples/example_objdict.c Tue Sep 25 08:19:44 2007 +0200 @@ -1,579 +1,429 @@ -/* -This file is part of CanFestival, a library implementing CanOpen Stack. - -Copyright (C): Edouard TISSERANT and Francis DUPIN - -See COPYING file for copyrights details. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - - -#include - -#include -#include "canfestival/def.h" -#include "canfestival/can.h" -#include "canfestival/objdictdef.h" -#include "canfestival/pdo.h" -#include "canfestival/sdo.h" -#include "canfestival/sync.h" -#include "canfestival/lifegrd.h" -#include "canfestival/nmtSlave.h" + +/* File generated by gen_cfile.py. Should not be modified. */ + +#include "example_objdict.h" /**************************************************************************/ /* Declaration of the mapped variables */ /**************************************************************************/ -UNS8 seconds = 0; // Mapped at index 0x2000, subindex 0x01 -UNS8 minutes = 0; // Mapped at index 0x2000, subindex 0x02 -UNS8 hours = 0; // Mapped at index 0x2000, subindex 0x03 -UNS8 day = 0; // Mapped at index 0x2000, subindex 0x04 -UNS32 canopenErrNB = 0; // Mapped at index 0x6000, subindex 0x00 -UNS32 canopenErrVAL = 0; // Mapped at index 0x6001, subindex 0x00 -UNS8 strTest[10] = 0; // Mapped at index 0x6002, subindex 0x00 +UNS8 Time_seconds = 0x0; /* Mapped at index 0x2000, subindex 0x01 */ +UNS8 Time_minutes = 0x0; /* Mapped at index 0x2000, subindex 0x02 */ +UNS8 Time_hours = 0x0; /* Mapped at index 0x2000, subindex 0x03 */ +UNS8 Time_days = 0x0; /* Mapped at index 0x2000, subindex 0x04 */ +UNS32 canopenErrNB = 0x0; /* Mapped at index 0x2001, subindex 0x00 */ +UNS32 canopenErrVal = 0x0; /* Mapped at index 0x2002, subindex 0x00 */ +UNS8 strTest[10] = ""; /* Mapped at index 0x2003, subindex 0x00 */ /**************************************************************************/ /* Declaration of the value range types */ /**************************************************************************/ - - -UNS32 Linux_slave_valueRangeTest (UNS8 typeValue, UNS32 unsValue, REAL32 realValue) +UNS32 Linux_slave_valueRangeTest (UNS8 typeValue, void * value) { switch (typeValue) { } return 0; } - /**************************************************************************/ /* The node id */ /**************************************************************************/ -/* node_id default value. - This default value is deprecated. - You should always overwrite this by using the function setNodeId(UNS8 nodeId) in your C code. +/* node_id default value.*/ +UNS8 Linux_slave_bDeviceNodeId = 0x00; + +/**************************************************************************/ +/* Array of message processing information */ + +const UNS8 Linux_slave_iam_a_slave = 1; + +TIMER_HANDLE Linux_slave_heartBeatTimers[1] = {TIMER_NONE,}; + +/* +$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ + + OBJECT DICTIONARY + +$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ -#define NODE_ID 0x01 -UNS8 Linux_slave_bDeviceNodeId = NODE_ID; - - -//*****************************************************************************/ -/* Array of message processing information */ -/* Should not be modified */ - -const UNS8 Linux_slave_iam_a_slave = 1 - - // Macros definition - -/* Beware : -index *must* be writen 4 numbers in hexa -sub_index *must* be writen 2 numbers in hexa -size_variable_in_UNS8 *must* be writen 2 numbers in hexa -*/ -#define PDO_MAP(index, sub_index, size_variable_in_bits)\ -0x ## index ## sub_index ## size_variable_in_bits - -/** This macro helps creating the object dictionary entries. - * by calling this macro - * it creates an entry in form of: 7 of entries, pointer to the entry. - */ -#define DeclareIndexTableEntry(entryname, index) { (subindex*)entryname,sizeof(entryname)/sizeof(entryname[0]), index} - -//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -// -// OBJECT DICTIONARY -// -//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -// Make your change, depending of your application - - -/* index 0x1000 : Device type. - You have to change the value below, so - it fits your canopen-slave-module */ - - /* Not used, so, should not be modified */ - - UNS32 Linux_slave_obj1000 = 0; - subindex Linux_slave_Index1000[] = - { - { RO, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1000 } - }; - -/* index 0x1001 : Error register. - Change the entries to fit your application - Not used, so, should not be modified */ - /*const*/ UNS8 Linux_slave_obj1001 = 0x0; - /*const*/ subindex Linux_slave_Index1001[] = - { - { RO, uint8, sizeof(UNS8), (void*)&Linux_slave_obj1001 } - }; - -/* index 0x1005 : COB_ID SYNC */ - /* Should not be modified */ - UNS32 Linux_slave_obj1005 = 0x00000080; // bit 30 = 1 : device can generate a SYNC message - // Beware, it is over written when the node - // enters in reset mode - // See initResetMode() in init.c - /*const*/ subindex Linux_slave_Index1005[] = - { - { RW, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1005 } - }; - -/* index 0x1006 : SYNC period */ - // For producing the SYNC signal every n micro-seconds. - // Put 0 to not producing SYNC - /*const*/ UNS32 Linux_slave_obj1006 = 0x0; - // Default 0 to not produce SYNC // - // Beware, it is over written when the - // node enters in reset mode. - // See initResetMode() in init.c - /*const*/ subindex Linux_slave_Index1006[] = - { - { RW, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1006 } - }; - -/* index 0x1007 : Synchronous Window Length - Seems to be needed by DS401 to generate the SYNC signal ! */ - /*const*/ UNS32 Linux_slave_obj1007 = 0x0; /* Default 0 */ - /*const*/ subindex Linux_slave_Index1007[] = - { - { RW, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1007 } - }; - -/* index 0x1008 : Manufacturer device name */ - UNS8 Linux_slave_obj1008[] = "Appli_Slave_HC12"; /* Default 0 */ - subindex Linux_slave_Index1008[] = - { - { RO, uint32, sizeof(Linux_slave_obj1008), (void*)&Linux_slave_obj1008 } - }; - -/* index 0x1009 : Manufacturer hardware version */ - UNS8 Linux_slave_obj1009[] = "__DATE__"; /* Default 0 */ - subindex Linux_slave_Index1009[] = - { - { RO, uint32, sizeof(Linux_slave_obj1009), (void*)&Linux_slave_obj1009 } - }; - -/* index 0x100A : Manufacturer software version */ - UNS8 Linux_slave_obj100A[] = __TIME__; /* Default 0 */ - subindex Linux_slave_Index100A[] = - { - { RO, uint32, Linux_slave_sizeof(obj100A), (void*)&Linux_slave_obj100A} - }; - - - TIMER_HANDLE Linux_slave_heartBeatTimers[1] = {TIMER_NONE,}; -/* index 0x1016 : HeartBeat consumers - The nodes which can send a heartbeat */ - UNS32 Linux_slave_obj1016[] = {// Consumer time for each node - 0x00000000}; // Format 0x00NNTTTT (N=Node T=time in ms) - - UNS8 Linux_slave_obj1016_cnt = 1; // 1 nodes could send me - // their heartbeat. + +/* index 0x1000 : Device Type. */ + UNS32 Linux_slave_obj1000 = 0x0; /* 0 */ + subindex Linux_slave_Index1000[] = + { + { RO, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1000 } + }; + +/* index 0x1001 : Error Register. */ + UNS8 Linux_slave_obj1001 = 0x0; /* 0 */ + subindex Linux_slave_Index1001[] = + { + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1001 } + }; + +/* index 0x1005 : SYNC COB ID */ + UNS32 Linux_slave_obj1005 = 0x0; /* 0 */ + +/* index 0x1006 : Communication / Cycle Period */ + UNS32 Linux_slave_obj1006 = 0x0; /* 0 */ + +/* index 0x1008 : Manufacturer Device Name. */ + UNS8 Linux_slave_obj1008[10] = "Appli_Slave_HC12"; + subindex Linux_slave_Index1008[] = + { + { RO, visible_string, 16, (void*)&Linux_slave_obj1008 } + }; + +/* index 0x1016 : Consumer Heartbeat Time. */ + UNS8 Linux_slave_highestSubIndex_obj1016 = 1; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1016[] = + { + 0x0 /* 0 */ + }; subindex Linux_slave_Index1016[] = - { - { RO, uint8, sizeof(UNS8), (void*)&Linux_slave_obj1016_cnt }, - { RW, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1016[0] } - }; - -/* index 0x1017 : Heartbeat producer - Every HBProducerTime, the node sends its heartbeat */ - UNS16 Linux_slave_obj1017 = 0; //HBProducerTime in ms. If 0 : not activated - // Beware, it is over written when the - // node enters in reset mode. - // See initResetMode() in init.c - subindex Linux_slave_Index1017[] = - { - { RW, uint16, sizeof(UNS16), &Linux_slave_obj1017 } - }; - -/* index 0x1018 : Identity object */ - /** index 1018: identify object. Adjust the entries for your node/company - */ - /* Values can be modified */ - - s_identity Linux_slave_obj1018 = - { - 4, // number of supported entries - 0, // Vendor-ID (given by the can-cia) - 0, // Product Code - 0, // Revision number - 0 // serial number - }; - - subindex Linux_slave_Index1018[] = - { - { RO, uint8, sizeof(UNS8), (void*)&Linux_slave_obj1018.count }, - { RO, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1018.vendor_id}, - { RO, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1018.product_code}, - { RO, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1018.revision_number}, - { RO, uint32, sizeof(UNS32), (void*)&Linux_slave_obj1018.serial_number} - }; - -/* index 0x1200 : The SDO Server parameters */ - /* BEWARE You cannot define more than one SDO server */ - /* The values should not be modified here, - but can be changed at runtime */ - // Beware that the default values that you could put here - // will be over written at the initialisation of the node. - // See setNodeId() in init.c - s_sdo_parameter Linux_slave_obj1200 = - { 3, // Number of entries. Always 3 for the SDO - 0x601, // The cob_id transmited in CAN msg to the server - 0x581, // The cob_id received in CAN msg from the server - 0x01 // The node id of the client. Should not be modified - }; - subindex Linux_slave_Index1200[] = - { - { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1200.count }, - { RO, uint32, sizeof( UNS32), (void*)&Linux_slave_obj1200.cob_id_client }, - { RO, uint32, sizeof( UNS32), (void*)&Linux_slave_obj1200.cob_id_server }, - { RW, uint8, sizeof( UNS8), (void*)&Linux_slave_obj1200.node_id } - }; - -/* index 0x1280 : SDO client parameter */ - s_sdo_parameter Linux_slave_obj1280 = - { 3, // Nb of entries - 0x600, // cobid transmited to the server. The good value should be 0x600 + server nodeId - 0x580, // cobid received from the server. The good value should be 0x580 + server nodeId - 0x01 // server NodeId - }; + { + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1016 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1016[0] } + }; + +/* index 0x1017 : Producer Heartbeat Time */ + UNS16 Linux_slave_obj1017 = 0x0; /* 0 */ + +/* index 0x1018 : Identity. */ + UNS8 Linux_slave_highestSubIndex_obj1018 = 4; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1018_Vendor_ID = 0x0; /* 0 */ + UNS32 Linux_slave_obj1018_Product_Code = 0x0; /* 0 */ + UNS32 Linux_slave_obj1018_Revision_Number = 0x0; /* 0 */ + UNS32 Linux_slave_obj1018_Serial_Number = 0x0; /* 0 */ + subindex Linux_slave_Index1018[] = + { + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1018 }, + { RO, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1018_Vendor_ID }, + { RO, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1018_Product_Code }, + { RO, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1018_Revision_Number }, + { RO, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1018_Serial_Number } + }; + +/* index 0x1280 : Client SDO 1 Parameter. */ + UNS8 Linux_slave_highestSubIndex_obj1280 = 3; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1280_COB_ID_Client_to_Server_Transmit_SDO = 0x0; /* 0 */ + UNS32 Linux_slave_obj1280_COB_ID_Server_to_Client_Receive_SDO = 0x0; /* 0 */ + UNS8 Linux_slave_obj1280_Node_ID_of_the_SDO_Server = 0x0; /* 0 */ subindex Linux_slave_Index1280[] = - { - { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1280.count }, - { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1280.cob_id_client }, - { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1280.cob_id_server }, - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1280.node_id } - }; - -/* index 0x1400 : PDO receive communication parameter */ - s_pdo_communication_parameter Linux_slave_obj1400 = - { 2, // Largest subindex supported - 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) - 253 // Transmission type. See objdictdef.h - }; + { + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1280 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1280_COB_ID_Client_to_Server_Transmit_SDO }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1280_COB_ID_Server_to_Client_Receive_SDO }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1280_Node_ID_of_the_SDO_Server } + }; + +/* index 0x1400 : Receive PDO 1 Parameter. */ + UNS8 Linux_slave_highestSubIndex_obj1400 = 5; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1400_COB_ID_used_by_PDO = 0x200; /* 512 */ + UNS8 Linux_slave_obj1400_Transmission_Type = 0x0; /* 0 */ + UNS16 Linux_slave_obj1400_Inhibit_Time = 0x0; /* 0 */ + UNS8 Linux_slave_obj1400_Compatibility_Entry = 0x0; /* 0 */ + UNS16 Linux_slave_obj1400_Event_Timer = 0x0; /* 0 */ subindex Linux_slave_Index1400[] = - { - { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1400.count }, - { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1400.cob_id }, - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1400.type }, - }; - -/* index 0x1401 : PDO receive communication parameter */ - s_pdo_communication_parameter Linux_slave_obj1401 = - { 2, // Largest subindex supported - 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) - 253 // Transmission type. See objdictdef.h - }; + { + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1400 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1400_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1400_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1400_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1400_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1400_Event_Timer } + }; + +/* index 0x1401 : Receive PDO 2 Parameter. */ + UNS8 Linux_slave_highestSubIndex_obj1401 = 5; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1401_COB_ID_used_by_PDO = 0x300; /* 768 */ + UNS8 Linux_slave_obj1401_Transmission_Type = 0x0; /* 0 */ + UNS16 Linux_slave_obj1401_Inhibit_Time = 0x0; /* 0 */ + UNS8 Linux_slave_obj1401_Compatibility_Entry = 0x0; /* 0 */ + UNS16 Linux_slave_obj1401_Event_Timer = 0x0; /* 0 */ subindex Linux_slave_Index1401[] = - { - { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1401.count }, - { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1401.cob_id }, - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1401.type }, - }; - -/* index 0x1402 : PDO receive communication parameter */ - s_pdo_communication_parameter Linux_slave_obj1402 = - { 2, // Largest subindex supported - 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) - 253 // Transmission type. See objdictdef.h - }; + { + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1401 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1401_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1401_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1401_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1401_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1401_Event_Timer } + }; + +/* index 0x1402 : Receive PDO 3 Parameter. */ + UNS8 Linux_slave_highestSubIndex_obj1402 = 5; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1402_COB_ID_used_by_PDO = 0x400; /* 1024 */ + UNS8 Linux_slave_obj1402_Transmission_Type = 0x0; /* 0 */ + UNS16 Linux_slave_obj1402_Inhibit_Time = 0x0; /* 0 */ + UNS8 Linux_slave_obj1402_Compatibility_Entry = 0x0; /* 0 */ + UNS16 Linux_slave_obj1402_Event_Timer = 0x0; /* 0 */ subindex Linux_slave_Index1402[] = - { - { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1402.count }, - { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1402.cob_id }, - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1402.type }, - }; - -/* index 0x1600 : PDO receive mapping parameter of PDO communication index 0x1400 */ - UNS8 Linux_slave_obj1600_cnt = 0; // Number of mapped variables - UNS32 Linux_slave_obj1600_mappedVar[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 - }; + { + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1402 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1402_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1402_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1402_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1402_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1402_Event_Timer } + }; + +/* index 0x1403 : Receive PDO 4 Parameter. */ + UNS8 Linux_slave_highestSubIndex_obj1403 = 5; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1403_COB_ID_used_by_PDO = 0x500; /* 1280 */ + UNS8 Linux_slave_obj1403_Transmission_Type = 0x0; /* 0 */ + UNS16 Linux_slave_obj1403_Inhibit_Time = 0x0; /* 0 */ + UNS8 Linux_slave_obj1403_Compatibility_Entry = 0x0; /* 0 */ + UNS16 Linux_slave_obj1403_Event_Timer = 0x0; /* 0 */ + subindex Linux_slave_Index1403[] = + { + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1403 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1403_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1403_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1403_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1403_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1403_Event_Timer } + }; + +/* index 0x1600 : Receive PDO 1 Mapping. */ + UNS8 Linux_slave_highestSubIndex_obj1600 = 1; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1600[] = + { + 0x0 /* 0 */ + }; subindex Linux_slave_Index1600[] = - { - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1600_cnt }, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[0]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[1]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[2]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[3]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[4]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[5]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[6]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1600_mappedVar[7]} - }; - -/* index 0x1601 : PDO receive mapping parameter of PDO communication index 0x1401 */ - UNS8 Linux_slave_obj1601_cnt = 0; // Number of mapped variables - UNS32 Linux_slave_obj1601_mappedVar[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 - }; + { + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1600 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1600[0] } + }; + +/* index 0x1601 : Receive PDO 2 Mapping. */ + UNS8 Linux_slave_highestSubIndex_obj1601 = 1; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1601[] = + { + 0x0 /* 0 */ + }; subindex Linux_slave_Index1601[] = - { - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1601_cnt }, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[0]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[1]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[2]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[3]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[4]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[5]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[6]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1601_mappedVar[7]} - }; - -/* index 0x1602 : PDO receive mapping parameter of PDO communication index 0x1402 */ - UNS8 Linux_slave_obj1602_cnt = 0; // Number of mapped variables - UNS32 Linux_slave_obj1602_mappedVar[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 - }; + { + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1601 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1601[0] } + }; + +/* index 0x1602 : Receive PDO 3 Mapping. */ + UNS8 Linux_slave_highestSubIndex_obj1602 = 1; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1602[] = + { + 0x0 /* 0 */ + }; subindex Linux_slave_Index1602[] = - { - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1602_cnt }, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[0]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[1]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[2]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[3]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[4]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[5]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[6]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1602_mappedVar[7]} - }; - -/* index 0x1800 : PDO transmit communication parameter */ - s_pdo_communication_parameter Linux_slave_obj1800 = - { 2, // Largest subindex supported - 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) - 253 // Transmission type. See objdictdef.h - }; + { + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1602 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1602[0] } + }; + +/* index 0x1603 : Receive PDO 4 Mapping. */ + UNS8 Linux_slave_highestSubIndex_obj1603 = 1; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1603[] = + { + 0x0 /* 0 */ + }; + subindex Linux_slave_Index1603[] = + { + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1603 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1603[0] } + }; + +/* index 0x1800 : Transmit PDO 1 Parameter. */ + UNS8 Linux_slave_highestSubIndex_obj1800 = 5; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1800_COB_ID_used_by_PDO = 0x180; /* 384 */ + UNS8 Linux_slave_obj1800_Transmission_Type = 0x0; /* 0 */ + UNS16 Linux_slave_obj1800_Inhibit_Time = 0x0; /* 0 */ + UNS8 Linux_slave_obj1800_Compatibility_Entry = 0x0; /* 0 */ + UNS16 Linux_slave_obj1800_Event_Timer = 0x0; /* 0 */ + ODCallback_t Linux_slave_Index1800_callbacks[] = + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }; subindex Linux_slave_Index1800[] = - { - { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1800.count }, - { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1800.cob_id }, - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1800.type }, - }; - -/* index 0x1801 : PDO transmit communication parameter */ - s_pdo_communication_parameter Linux_slave_obj1801 = - { 2, // Largest subindex supported - 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) - 253 // Transmission type. See objdictdef.h - }; + { + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1800 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1800_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1800_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1800_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1800_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1800_Event_Timer } + }; + +/* index 0x1801 : Transmit PDO 2 Parameter. */ + UNS8 Linux_slave_highestSubIndex_obj1801 = 5; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1801_COB_ID_used_by_PDO = 0x280; /* 640 */ + UNS8 Linux_slave_obj1801_Transmission_Type = 0x0; /* 0 */ + UNS16 Linux_slave_obj1801_Inhibit_Time = 0x0; /* 0 */ + UNS8 Linux_slave_obj1801_Compatibility_Entry = 0x0; /* 0 */ + UNS16 Linux_slave_obj1801_Event_Timer = 0x0; /* 0 */ + ODCallback_t Linux_slave_Index1801_callbacks[] = + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }; subindex Linux_slave_Index1801[] = - { - { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1801.count }, - { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1801.cob_id }, - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1801.type }, - }; - -/* index 0x1802 : PDO transmit communication parameter */ - s_pdo_communication_parameter Linux_slave_obj1802 = - { 2, // Largest subindex supported - 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) - 253 // Transmission type. See objdictdef.h - }; - subindex Linux_slave_Index1802[] = - { - { RO, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1802.count }, - { RW, uint8, sizeof( UNS32 ), (void*)&Linux_slave_obj1802.cob_id }, - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1802.type }, - }; - -/* index 0x1A00 : PDO transmit mapping parameter of PDO communication index 0x1800 */ - UNS8 Linux_slave_obj1A00_cnt = 0; // Number of mapped variables - UNS32 Linux_slave_obj1A00_mappedVar[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 - }; + { + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1801 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1801_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1801_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1801_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1801_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&Linux_slave_obj1801_Event_Timer } + }; + +/* index 0x1A00 : Transmit PDO 1 Mapping. */ + UNS8 Linux_slave_highestSubIndex_obj1A00 = 1; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1A00[] = + { + 0x0 /* 0 */ + }; subindex Linux_slave_Index1A00[] = - { - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1A00_cnt }, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[0]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[1]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[2]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[3]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[4]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[5]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[6]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A00_mappedVar[7]} - }; - -/* index 0x1A01 : PDO transmit mapping parameter of PDO communication index 0x1801 */ - UNS8 Linux_slave_obj1A01_cnt = 0; // Number of mapped variables - UNS32 Linux_slave_obj1A01_mappedVar[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 - }; + { + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1A00 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1A00[0] } + }; + +/* index 0x1A01 : Transmit PDO 2 Mapping. */ + UNS8 Linux_slave_highestSubIndex_obj1A01 = 1; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1A01[] = + { + 0x0 /* 0 */ + }; subindex Linux_slave_Index1A01[] = - { - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1A01_cnt }, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[0]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[1]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[2]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[3]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[4]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[5]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[6]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A01_mappedVar[7]} - }; - -/* index 0x1A02 : PDO transmit mapping parameter of PDO communication index 0x1802 */ - UNS8 Linux_slave_obj1A02_cnt = 0; // Number of mapped variables - UNS32 Linux_slave_obj1A02_mappedVar[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 - }; - subindex Linux_slave_Index1A02[] = - { - { RW, uint8, sizeof( UNS8 ), (void*)&Linux_slave_obj1A02_cnt }, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[0]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[1]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[2]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[3]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[4]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[5]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[6]}, - { RW, uint32, sizeof( UNS32 ), (void*)&Linux_slave_obj1A02_mappedVar[7]} - }; - - -/* index 0x2000 : Mapped variable */ - UNS8 Linux_slave_highestSubIndex_2000 = 4; // number of subindex - 1 + { + { RW, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1A01 }, + { RW, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1A01[0] } + }; + +/* index 0x2000 : Mapped variable Time */ + UNS8 Linux_slave_highestSubIndex_obj2000 = 4; /* number of subindex - 1*/ subindex Linux_slave_Index2000[] = { - { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_2000 }, - { RW, uint8, sizeof (UNS8), (void*)&seconds }, - { RW, uint8, sizeof (UNS8), (void*)&minutes }, - { RW, uint8, sizeof (UNS8), (void*)&hours }, - { RW, uint8, sizeof (UNS8), (void*)&day } - }; - -/* index 0x6000 : Mapped variable */ - UNS8 Linux_slave_highestSubIndex_6000 = 0; // number of subindex - 1 - subindex Linux_slave_Index6000[] = + { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj2000 }, + { RW, uint8, sizeof (UNS8), (void*)&Time_seconds }, + { RW, uint8, sizeof (UNS8), (void*)&Time_minutes }, + { RW, uint8, sizeof (UNS8), (void*)&Time_hours }, + { RW, uint8, sizeof (UNS8), (void*)&Time_days } + }; + +/* index 0x2001 : Mapped variable canopenErrNB */ + subindex Linux_slave_Index2001[] = { { RW, uint32, sizeof (UNS32), (void*)&canopenErrNB } }; -/* index 0x6001 : Mapped variable */ - UNS8 Linux_slave_highestSubIndex_6001 = 0; // number of subindex - 1 - subindex Linux_slave_Index6001[] = - { - { RW, uint32, sizeof (UNS32), (void*)&canopenErrVAL } - }; - -/* index 0x6002 : Mapped variable */ - UNS8 Linux_slave_highestSubIndex_6002 = 0; // number of subindex - 1 - subindex Linux_slave_Index6002[] = - { - { RW, visible_string, sizeof (strTest), (void*)&strTest } +/* index 0x2002 : Mapped variable canopenErrVal */ + subindex Linux_slave_Index2002[] = + { + { RW, uint32, sizeof (UNS32), (void*)&canopenErrVal } + }; + +/* index 0x2003 : Mapped variable strTest */ + subindex Linux_slave_Index2003[] = + { + { RW, visible_string, 0, (void*)&strTest } }; const indextable Linux_slave_objdict[] = { - DeclareIndexTableEntry(Linux_slave_Index1000, 0x1000), - DeclareIndexTableEntry(Linux_slave_Index1001, 0x1001), - DeclareIndexTableEntry(Linux_slave_Index1005, 0x1005), - DeclareIndexTableEntry(Linux_slave_Index1006, 0x1006), - DeclareIndexTableEntry(Linux_slave_Index1007, 0x1007), - DeclareIndexTableEntry(Linux_slave_Index1008, 0x1008), - DeclareIndexTableEntry(Linux_slave_Index1009, 0x1009), - DeclareIndexTableEntry(Linux_slave_Index100A, 0x100A), - DeclareIndexTableEntry(Linux_slave_Index1016, 0x1016), - DeclareIndexTableEntry(Linux_slave_Index1017, 0x1017), - DeclareIndexTableEntry(Linux_slave_Index1018, 0x1018), - DeclareIndexTableEntry(Linux_slave_Index1200, 0x1200), - DeclareIndexTableEntry(Linux_slave_Index1280, 0x1280), - DeclareIndexTableEntry(Linux_slave_Index1400, 0x1400), - DeclareIndexTableEntry(Linux_slave_Index1401, 0x1401), - DeclareIndexTableEntry(Linux_slave_Index1402, 0x1402), - DeclareIndexTableEntry(Linux_slave_Index1600, 0x1600), - DeclareIndexTableEntry(Linux_slave_Index1601, 0x1601), - DeclareIndexTableEntry(Linux_slave_Index1602, 0x1602), - DeclareIndexTableEntry(Linux_slave_Index1800, 0x1800), - DeclareIndexTableEntry(Linux_slave_Index1801, 0x1801), - DeclareIndexTableEntry(Linux_slave_Index1802, 0x1802), - DeclareIndexTableEntry(Linux_slave_Index1A00, 0x1A00), - DeclareIndexTableEntry(Linux_slave_Index1A01, 0x1A01), - DeclareIndexTableEntry(Linux_slave_Index1A02, 0x1A02), - DeclareIndexTableEntry(Linux_slave_Index2000, 0x2000), - DeclareIndexTableEntry(Linux_slave_Index6000, 0x6000), - DeclareIndexTableEntry(Linux_slave_Index6001, 0x6001), - DeclareIndexTableEntry(Linux_slave_Index6002, 0x6002), + { (subindex*)Linux_slave_Index1000,sizeof(Linux_slave_Index1000)/sizeof(Linux_slave_Index1000[0]), 0x1000}, + { (subindex*)Linux_slave_Index1001,sizeof(Linux_slave_Index1001)/sizeof(Linux_slave_Index1001[0]), 0x1001}, + { (subindex*)Linux_slave_Index1008,sizeof(Linux_slave_Index1008)/sizeof(Linux_slave_Index1008[0]), 0x1008}, + { (subindex*)Linux_slave_Index1016,sizeof(Linux_slave_Index1016)/sizeof(Linux_slave_Index1016[0]), 0x1016}, + { (subindex*)Linux_slave_Index1018,sizeof(Linux_slave_Index1018)/sizeof(Linux_slave_Index1018[0]), 0x1018}, + { (subindex*)Linux_slave_Index1280,sizeof(Linux_slave_Index1280)/sizeof(Linux_slave_Index1280[0]), 0x1280}, + { (subindex*)Linux_slave_Index1400,sizeof(Linux_slave_Index1400)/sizeof(Linux_slave_Index1400[0]), 0x1400}, + { (subindex*)Linux_slave_Index1401,sizeof(Linux_slave_Index1401)/sizeof(Linux_slave_Index1401[0]), 0x1401}, + { (subindex*)Linux_slave_Index1402,sizeof(Linux_slave_Index1402)/sizeof(Linux_slave_Index1402[0]), 0x1402}, + { (subindex*)Linux_slave_Index1403,sizeof(Linux_slave_Index1403)/sizeof(Linux_slave_Index1403[0]), 0x1403}, + { (subindex*)Linux_slave_Index1600,sizeof(Linux_slave_Index1600)/sizeof(Linux_slave_Index1600[0]), 0x1600}, + { (subindex*)Linux_slave_Index1601,sizeof(Linux_slave_Index1601)/sizeof(Linux_slave_Index1601[0]), 0x1601}, + { (subindex*)Linux_slave_Index1602,sizeof(Linux_slave_Index1602)/sizeof(Linux_slave_Index1602[0]), 0x1602}, + { (subindex*)Linux_slave_Index1603,sizeof(Linux_slave_Index1603)/sizeof(Linux_slave_Index1603[0]), 0x1603}, + { (subindex*)Linux_slave_Index1800,sizeof(Linux_slave_Index1800)/sizeof(Linux_slave_Index1800[0]), 0x1800}, + { (subindex*)Linux_slave_Index1801,sizeof(Linux_slave_Index1801)/sizeof(Linux_slave_Index1801[0]), 0x1801}, + { (subindex*)Linux_slave_Index1A00,sizeof(Linux_slave_Index1A00)/sizeof(Linux_slave_Index1A00[0]), 0x1A00}, + { (subindex*)Linux_slave_Index1A01,sizeof(Linux_slave_Index1A01)/sizeof(Linux_slave_Index1A01[0]), 0x1A01}, + { (subindex*)Linux_slave_Index2000,sizeof(Linux_slave_Index2000)/sizeof(Linux_slave_Index2000[0]), 0x2000}, + { (subindex*)Linux_slave_Index2001,sizeof(Linux_slave_Index2001)/sizeof(Linux_slave_Index2001[0]), 0x2001}, + { (subindex*)Linux_slave_Index2002,sizeof(Linux_slave_Index2002)/sizeof(Linux_slave_Index2002[0]), 0x2002}, + { (subindex*)Linux_slave_Index2003,sizeof(Linux_slave_Index2003)/sizeof(Linux_slave_Index2003[0]), 0x2003}, }; -// To count at which received SYNC a PDO must be sent. -// Even if no pdoTransmit are defined, at least one entry is computed -// for compilations issues. -UNS8 Linux_slave_count_sync[1] = {0, }; +const indextable * Linux_slave_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks) +{ + int i; + *callbacks = NULL; + switch(wIndex){ + case 0x1000: i = 0;break; + case 0x1001: i = 1;break; + case 0x1008: i = 2;break; + case 0x1016: i = 3;break; + case 0x1018: i = 4;break; + case 0x1280: i = 5;break; + case 0x1400: i = 6;break; + case 0x1401: i = 7;break; + case 0x1402: i = 8;break; + case 0x1403: i = 9;break; + case 0x1600: i = 10;break; + case 0x1601: i = 11;break; + case 0x1602: i = 12;break; + case 0x1603: i = 13;break; + case 0x1800: i = 14;*callbacks = Linux_slave_Index1800_callbacks; break; + case 0x1801: i = 15;*callbacks = Linux_slave_Index1801_callbacks; break; + case 0x1A00: i = 16;break; + case 0x1A01: i = 17;break; + case 0x2000: i = 18;break; + case 0x2001: i = 19;break; + case 0x2002: i = 20;break; + case 0x2003: i = 21;break; + default: + *errorCode = OD_NO_SUCH_OBJECT; + return NULL; + } + *errorCode = OD_SUCCESSFUL; + return &Linux_slave_objdict[i]; +} + +/* + * To count at which received SYNC a PDO must be sent. + * Even if no pdoTransmit are defined, at least one entry is computed + * for compilations issues. + */ +s_PDO_status Linux_slave_PDO_status[2] = {s_PDO_staus_Initializer,s_PDO_staus_Initializer}; quick_index Linux_slave_firstIndex = { - SDO_SVR : 11, - SDO_CLT : 12, - PDO_RCV : 13, - PDO_RCV_MAP : 16, - PDO_TRS : 19, - PDO_TRS_MAP : 22 -} - -quick_index Linux_slave_lastIndex{ - SDO_SVR : 11, - SDO_CLT : 12, - PDO_RCV : 15, - PDO_RCV_MAP : 18, - PDO_TRS : 21, - PDO_TRS_MAP : 24 -} + 0, /* SDO_SVR */ + 5, /* SDO_CLT */ + 6, /* PDO_RCV */ + 10, /* PDO_RCV_MAP */ + 14, /* PDO_TRS */ + 16 /* PDO_TRS_MAP */ +}; + +quick_index Linux_slave_lastIndex = { + 0, /* SDO_SVR */ + 5, /* SDO_CLT */ + 9, /* PDO_RCV */ + 13, /* PDO_RCV_MAP */ + 15, /* PDO_TRS */ + 17 /* PDO_TRS_MAP */ +}; UNS16 Linux_slave_ObjdictSize = sizeof(Linux_slave_objdict)/sizeof(Linux_slave_objdict[0]); +CO_Data Linux_slave_Data = CANOPEN_NODE_DATA_INITIALIZER(Linux_slave); + diff -r d9b232ec7057 -r 685d9a26e4f9 objdictgen/examples/example_objdict.h --- a/objdictgen/examples/example_objdict.h Mon Sep 24 09:37:04 2007 +0200 +++ b/objdictgen/examples/example_objdict.h Tue Sep 25 08:19:44 2007 +0200 @@ -1,28 +1,25 @@ -/* -This file is part of CanFestival, a library implementing CanOpen Stack. -Copyright (C): Edouard TISSERANT and Francis DUPIN +/* File generated by gen_cfile.py. Should not be modified. */ -See COPYING file for copyrights details. +#ifndef EXAMPLE_OBJDICT_H +#define EXAMPLE_OBJDICT_H -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. +#include "data.h" -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. +/* Prototypes of function provided by object dictionnary */ +UNS32 Linux_slave_valueRangeTest (UNS8 typeValue, void * value); +const indextable * Linux_slave_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks); -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -extern UNS8 seconds; // Mapped at index 0x2000, subindex 0x01 -extern UNS8 minutes; // Mapped at index 0x2000, subindex 0x02 -extern UNS8 hours; // Mapped at index 0x2000, subindex 0x03 -extern UNS8 day; // Mapped at index 0x2000, subindex 0x04 -extern UNS32 canopenErrNB; // Mapped at index 0x6000, subindex 0x00 -extern UNS32 canopenErrVAL; // Mapped at index 0x6001, subindex 0x00 -extern UNS8 strTest[10]; // Mapped at index 0x6002, subindex 0x00 +/* Master node data struct */ +extern CO_Data Linux_slave_Data; +extern ODCallback_t Transmit_PDO_1_Parameter_callbacks[]; /* Callbacks of index0x1800 */ +extern ODCallback_t Transmit_PDO_2_Parameter_callbacks[]; /* Callbacks of index0x1801 */ +extern UNS8 Time_seconds; /* Mapped at index 0x2000, subindex 0x01 */ +extern UNS8 Time_minutes; /* Mapped at index 0x2000, subindex 0x02 */ +extern UNS8 Time_hours; /* Mapped at index 0x2000, subindex 0x03 */ +extern UNS8 Time_days; /* Mapped at index 0x2000, subindex 0x04 */ +extern UNS32 canopenErrNB; /* Mapped at index 0x2001, subindex 0x00*/ +extern UNS32 canopenErrVal; /* Mapped at index 0x2002, subindex 0x00*/ +extern UNS8 strTest[10]; /* Mapped at index 0x2003, subindex 0x00*/ + +#endif // EXAMPLE_OBJDICT_H diff -r d9b232ec7057 -r 685d9a26e4f9 objdictgen/examples/example_objdict.html --- a/objdictgen/examples/example_objdict.html Mon Sep 24 09:37:04 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ - - - - -CANOpen object dictionary Configuration - - - -

Object dictionary for Node :

-

-Linux_slaveslave -

-

Overview

-

- How to make the object dictionary of the node ? - First, use Jaxe (command run_objdict) to edit an xml description file -of the dictionary : objdict.xml. -Then, run the php program : makeobjetdict.php. You can launch php through a web browser -if you have installed a server, or, on Linux, you can launch php in command line : -php-cgi makeobjetdict.php. It compute the file objdict.c. Link it to - your project. -
Note : To define the node id, use in your code the function setNodeId(UNS8 nodeId) -

-

- Then the node can be connected to the network. The master must configure it - by sending SDO. It will write values in its index, subindex. What to configure ? -

-

- To avoid configuring the node at the connection, you can put the values directly -in the dictionary objdict.c. But it is boring and unsafe because it is too easy to make -a mistake ! - - -

Number of heartbeat consumers : - 1 -

-

This means that the node can expect heartbeats sent by 1 nodes.

-

Number of SDO clients : - 1 -

-

Usualy, a slave node does not have the use of SDO clients, but - today, for the library, you must define one. The Master, which can - send SDO to "n" slaves nodes, must define here "n" SDO - clients. Remember that in most cases, the SDO protocol is used by - the master to configure a slave dictionary or read a value. In - this use, the master is the client, and the slave is the server.

-

Maximum objects in a PDO (receive or transmit) : - 8 -

-

This is defining how many variables can be transmited in a - PDO. (maximum is 8).

-

For each variable, a table is created, so if you have less room - in memory, put a value under 8.

-

Number of PDO receive : - 3 -

-

The node can receive 3 PDO.

-

The communication parameters are defined at index 0x1400 to 0x1400 + 2

-

The mapping parameters are defined at index 0x1600 to 0x1600 + 2

-

Number of PDO transmit : - 3 -

-

The node can transmit 3 PDO.

-

The communication parameters are defined at index 0x1800 to 0x1800 + 2

-

The mapping parameters are defined at index 0x1A00 to 0x1A00 + 2

-

Mapped variables and tables

-

3 tables are defined for the mapping, starting at index 0x2000, 0x6000 and 0x6200. - You must start the mapping at the beginning of one of a table, without holes in index -or subindex. For example, variables in 0x2000 and 0x2001 is ok, but variables in 0x2000 and 0x2002 is not allowed, because you are loosing room in memory. It is the same for the subindex. -

-

- The access of the variable is by default "rw" (read-write) or "ro" (read-only). A read-only variable cannot be mapped in a PDO receive. -

-

Here are some others rules for the mapping :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Var NameBitsIndexSub-indexaccess
seconds80x20050x1rw
minutes80x20050x02rw
hours80x20050x3rw
day80x20050x4rw
null80x20020x0ro
canopenErrNB320x60000x0rw
canopenErrVAL320x60010x0rw
Table NameBitsIndexSub-indexaccess
table_essai[5]80x20061 to 5ro
table_encore_un_essai[3]160x20011 to 3ro
- - diff -r d9b232ec7057 -r 685d9a26e4f9 objdictgen/examples/example_objdict.od --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/objdictgen/examples/example_objdict.od Tue Sep 25 08:19:44 2007 +0200 @@ -0,0 +1,496 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Time + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + canopenErrNB + + + + + + + canopenErrNB + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + canopenErrVal + + + + + + + canopenErrVal + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + strTest + + + + + + + strTest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +slave + +Linux_slave + diff -r d9b232ec7057 -r 685d9a26e4f9 objdictgen/examples/example_objdict.xml --- a/objdictgen/examples/example_objdict.xml Mon Sep 24 09:37:04 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r d9b232ec7057 -r 685d9a26e4f9 objdictgen/node.py --- a/objdictgen/node.py Mon Sep 24 09:37:04 2007 +0200 +++ b/objdictgen/node.py Tue Sep 25 08:19:44 2007 +0200 @@ -738,6 +738,11 @@ self.UserMapping[index]["values"] = values return True elif 0 <= subIndex < len(self.UserMapping[index]["values"]) and values != None: + if "type" in values: + if self.IsStringType(values["type"]) and not self.IsStringType(self.UserMapping[index]["values"][subIndex]["type"]): + self.SetEntry(index, subIndex, "") + elif not self.IsStringType(values["type"]) and self.IsStringType(self.UserMapping[index]["values"][subIndex]["type"]): + self.SetEntry(index, subIndex, 0) self.UserMapping[index]["values"][subIndex].update(values) return True return False @@ -972,6 +977,19 @@ return dic #------------------------------------------------------------------------------- +# Type helper functions +#------------------------------------------------------------------------------- + + def IsStringType(self, index): + if index in (0x9, 0xA, 0xB): + return True + elif 0xA0 <= index < 0x100: + result = self.GetEntry(index, 1) + if result is not None and result in (0x9, 0xA, 0xB): + return True + return False + +#------------------------------------------------------------------------------- # Type and Map Variable Lists #------------------------------------------------------------------------------- diff -r d9b232ec7057 -r 685d9a26e4f9 objdictgen/subindextable.py --- a/objdictgen/subindextable.py Mon Sep 24 09:37:04 2007 +0200 +++ b/objdictgen/subindextable.py Tue Sep 25 08:19:44 2007 +0200 @@ -25,6 +25,7 @@ import wx.grid from types import * +from commondialogs import * from node import OD_Subindex, OD_MultipleSubindexes, OD_IdenticalSubindexes, OD_IdenticalIndexes