etisserant@0: /* etisserant@0: This file is part of CanFestival, a library implementing CanOpen Stack. etisserant@0: etisserant@0: Copyright (C): Edouard TISSERANT and Francis DUPIN etisserant@0: etisserant@0: See COPYING file for copyrights details. etisserant@0: etisserant@0: This library is free software; you can redistribute it and/or etisserant@0: modify it under the terms of the GNU Lesser General Public etisserant@0: License as published by the Free Software Foundation; either etisserant@0: version 2.1 of the License, or (at your option) any later version. etisserant@0: etisserant@0: This library is distributed in the hope that it will be useful, etisserant@0: but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@0: Lesser General Public License for more details. etisserant@0: etisserant@0: You should have received a copy of the GNU Lesser General Public etisserant@0: License along with this library; if not, write to the Free Software etisserant@0: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@0: */ etisserant@0: etisserant@0: #include etisserant@0: etisserant@0: #include etisserant@0: #include "def.h" etisserant@0: #include "can.h" etisserant@0: #include "objdictdef.h" etisserant@0: #include "pdo.h" etisserant@0: #include "sdo.h" etisserant@0: #include "sync.h" etisserant@0: #include "lifegrd.h" etisserant@0: #include "nmtSlave.h" etisserant@0: etisserant@0: /**************************************************************************/ etisserant@0: /* Declaration of the mapped variables */ etisserant@0: /**************************************************************************/ etisserant@0: etisserant@0: etisserant@0: etisserant@0: /*// Copy and uncomment this code to your main file etisserant@0: extern UNS8 seconds; // Mapped at index 0x2000, subindex 0x01 etisserant@0: extern UNS32 minutes; // Mapped at index 0x2000, subindex 0x02 etisserant@0: extern UNS8 hours; // Mapped at index 0x2000, subindex 0x03 etisserant@0: extern UNS8 day; // Mapped at index 0x2000, subindex 0x04 etisserant@0: extern UNS32 canopenErrNB; // Mapped at index 0x6000, subindex 0x00 etisserant@0: extern UNS32 canopenErrVAL; // Mapped at index 0x6001, subindex 0x00 etisserant@0: extern UNS8 strTest[10]; // Mapped at index 0x6002, subindex 0x00 etisserant@0: etisserant@0: // END copy to main file etisserant@0: */ etisserant@0: etisserant@0: UNS8 seconds; // Mapped at index 0x2000, subindex 0x01 etisserant@0: UNS32 minutes; // Mapped at index 0x2000, subindex 0x02 etisserant@0: UNS8 hours; // Mapped at index 0x2000, subindex 0x03 etisserant@0: UNS8 day; // Mapped at index 0x2000, subindex 0x04 etisserant@0: UNS32 canopenErrNB; // Mapped at index 0x6000, subindex 0x00 etisserant@0: UNS32 canopenErrVAL; // Mapped at index 0x6001, subindex 0x00 etisserant@0: UNS8 strTest[10]; // Mapped at index 0x6002, subindex 0x00 etisserant@0: etisserant@0: /**************************************************************************/ etisserant@0: /* Declaration of the value range types */ etisserant@0: /**************************************************************************/ etisserant@0: etisserant@0: etisserant@0: etisserant@0: UNS32 valueRangeTest (UNS8 typeValue, UNS32 unsValue, REAL32 realValue) etisserant@0: { etisserant@0: return 0; etisserant@0: } etisserant@0: etisserant@0: etisserant@0: /**************************************************************************/ etisserant@0: /* The node id */ etisserant@0: /**************************************************************************/ etisserant@0: /* Computed by strNode */ etisserant@0: /* node_id default value. etisserant@0: This default value is deprecated. etisserant@0: You should always overwrite this by using the function setNodeId(UNS8 nodeId) in your C code. etisserant@0: */ etisserant@0: #define NODE_ID 0x01 etisserant@0: UNS8 bDeviceNodeId = NODE_ID; etisserant@0: etisserant@0: etisserant@0: //*****************************************************************************/ etisserant@0: /* Computed by strStartDico */ etisserant@0: etisserant@0: /* Array of message processing information */ etisserant@0: /* Should not be modified */ etisserant@0: volatile const proceed_info proceed_infos[] = { etisserant@0: {NMT, "NMT", proceedNMTstateChange}, etisserant@0: {SYNC, "SYNC", proceedSYNC}, etisserant@0: {TIME_STAMP, "TStmp", NULL}, etisserant@0: {PDO1tx, "PDO1t", proceedPDO}, etisserant@0: {PDO1rx, "PDO1r", proceedPDO}, etisserant@0: {PDO2tx, "PDO2t", proceedPDO}, etisserant@0: {PDO2rx, "PDO2r", proceedPDO}, etisserant@0: {PDO3tx, "PDO3t", proceedPDO}, etisserant@0: {PDO3rx, "PDO3r", proceedPDO}, etisserant@0: {PDO4tx, "PDO4t", proceedPDO}, etisserant@0: {PDO4rx, "PDO4r", proceedPDO}, etisserant@0: {SDOtx, "SDOt", proceedSDO}, etisserant@0: {SDOrx, "SDOr", proceedSDO}, etisserant@0: {0xD, "Unkw", NULL}, etisserant@0: {NODE_GUARD, "NGrd", proceedNMTerror}, etisserant@0: {0xF, "Unkw", NULL} etisserant@0: }; etisserant@0: etisserant@0: // Macros definition etisserant@0: etisserant@0: /* Beware : etisserant@0: index *must* be writen 4 numbers in hexa etisserant@0: sub_index *must* be writen 2 numbers in hexa etisserant@0: size_variable_in_UNS8 *must* be writen 2 numbers in hexa etisserant@0: */ etisserant@0: #define PDO_MAP(index, sub_index, size_variable_in_bits)\ etisserant@0: 0x ## index ## sub_index ## size_variable_in_bits etisserant@0: etisserant@0: //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ etisserant@0: // etisserant@0: // OBJECT DICTIONARY etisserant@0: // etisserant@0: //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ etisserant@0: // Make your change, depending of your application etisserant@0: etisserant@0: etisserant@0: /* index 0x1000 : Device type. etisserant@0: You have to change the value below, so etisserant@0: it fits your canopen-slave-module */ etisserant@0: etisserant@0: /* Not used, so, should not be modified */ etisserant@0: etisserant@0: UNS32 obj1000 = 0; etisserant@0: subindex Index1000[] = etisserant@0: { etisserant@0: { RO, uint32, sizeof(UNS32), (void*)&obj1000 } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1001 : Error register. etisserant@0: Change the entries to fit your application etisserant@0: Not used, so, should not be modified */ etisserant@0: /*const*/ UNS8 obj1001 = 0x0; etisserant@0: /*const*/ subindex Index1001[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof(UNS8), (void*)&obj1001 } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1005 : COB_ID SYNC */ etisserant@0: /* Should not be modified */ etisserant@0: UNS32 obj1005 = 0x00000080; // bit 30 = 1 : device can generate a SYNC message etisserant@0: // Beware, it is over written when the node etisserant@0: // enters in reset mode etisserant@0: // See initResetMode() in init.c etisserant@0: /*const*/ subindex Index1005[] = etisserant@0: { etisserant@0: { RW, uint32, sizeof(UNS32), (void*)&obj1005 } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1006 : SYNC period */ etisserant@0: // For producing the SYNC signal every n micro-seconds. etisserant@0: // Put O to not producing SYNC etisserant@0: /*const*/ UNS32 obj1006 = 0x0; etisserant@0: // Default 0 to not produce SYNC // etisserant@0: // Beware, it is over written when the etisserant@0: // node enters in reset mode. etisserant@0: // See initResetMode() in init.c etisserant@0: /*const*/ subindex Index1006[] = etisserant@0: { etisserant@0: { RW, uint32, sizeof(UNS32), (void*)&obj1006 } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1007 : Synchronous Window Length etisserant@0: Seems to be needed by DS401 to generate the SYNC signal ! */ etisserant@0: /*const*/ UNS32 obj1007 = 0x0; /* Default 0 */ etisserant@0: /*const*/ subindex Index1007[] = etisserant@0: { etisserant@0: { RW, uint32, sizeof(UNS32), (void*)&obj1007 } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1008 : Manufacturer device name */ etisserant@0: UNS8 obj1008[] = "Appli_Slave_Linux"; /* Default 0 */ etisserant@0: subindex Index1008[] = etisserant@0: { etisserant@0: { RO, uint32, sizeof(obj1008), (void*)&obj1008 } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1009 : Manufacturer hardware version */ etisserant@0: UNS8 obj1009[] = __DATE__; /* Default 0 */ etisserant@0: subindex Index1009[] = etisserant@0: { etisserant@0: { RO, uint32, sizeof(obj1009), (void*)&obj1009 } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x100A : Manufacturer software version */ etisserant@0: UNS8 obj100A[] = __TIME__; /* Default 0 */ etisserant@0: subindex Index100A[] = etisserant@0: { etisserant@0: { RO, uint32, sizeof(obj100A), (void*)&obj100A} etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1016 : HeartBeat consumers etisserant@0: The nodes which can send a heartbeat */ etisserant@0: static UNS32 obj1016[] = {// Consumer time for each node etisserant@0: 0x00000000}; // Format 0x00NNTTTT (N=Node T=time in ms) etisserant@0: etisserant@0: static UNS8 obj1016_cnt = 1; // 1 nodes could send me etisserant@0: // their heartbeat. etisserant@0: subindex Index1016[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof(UNS8), (void*)&obj1016_cnt }, etisserant@0: { RW, uint32, sizeof(UNS32), (void*)&obj1016[0] } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1017 : Heartbeat producer etisserant@0: Every HBProducerTime, the node sends its heartbeat */ etisserant@0: static UNS16 obj1017 = 0; //HBProducerTime in ms. If 0 : not activated etisserant@0: // Beware, it is over written when the etisserant@0: // node enters in reset mode. etisserant@0: // See initResetMode() in init.c etisserant@0: subindex Index1017[] = etisserant@0: { etisserant@0: { RW, uint16, sizeof(UNS16), &obj1017 } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1018 : Identity object */ etisserant@0: /** index 1018: identify object. Adjust the entries for your node/company etisserant@0: */ etisserant@0: /* Values can be modified */ etisserant@0: etisserant@0: s_identity obj1018 = etisserant@0: { etisserant@0: 4, // number of supported entries etisserant@0: 0, // Vendor-ID (given by the can-cia) etisserant@0: 0, // Product Code etisserant@0: 0, // Revision number etisserant@0: 0 // serial number etisserant@0: }; etisserant@0: etisserant@0: subindex Index1018[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof(UNS8), (void*)&obj1018.count }, etisserant@0: { RO, uint32, sizeof(UNS32), (void*)&obj1018.vendor_id}, etisserant@0: { RO, uint32, sizeof(UNS32), (void*)&obj1018.product_code}, etisserant@0: { RO, uint32, sizeof(UNS32), (void*)&obj1018.revision_number}, etisserant@0: { RO, uint32, sizeof(UNS32), (void*)&obj1018.serial_number} etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1200 : The SDO Server parameters */ etisserant@0: /* BEWARE You cannot define more than one SDO server */ etisserant@0: /* The values should not be modified here, etisserant@0: but can be changed at runtime */ etisserant@0: // Beware that the default values that you could put here etisserant@0: // will be over written at the initialisation of the node. etisserant@0: // See setNodeId() in init.c etisserant@0: static s_sdo_parameter obj1200 = etisserant@0: { 3, // Number of entries. Always 3 for the SDO etisserant@0: 0x600 + NODE_ID, // The cob_id transmited in CAN msg to the server etisserant@0: 0x580 + NODE_ID, // The cob_id received in CAN msg from the server etisserant@0: NODE_ID // The node id of the client. Should not be modified etisserant@0: }; etisserant@0: static subindex Index1200[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof( UNS8 ), (void*)&obj1200.count }, etisserant@0: { RO, uint32, sizeof( UNS32), (void*)&obj1200.cob_id_client }, etisserant@0: { RO, uint32, sizeof( UNS32), (void*)&obj1200.cob_id_server }, etisserant@0: { RW, uint8, sizeof( UNS8), (void*)&obj1200.node_id } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1280 : SDO client parameter */ etisserant@0: static s_sdo_parameter obj1280 = etisserant@0: { 3, // Nb of entries etisserant@0: 0x600, // cobid transmited to the server. The good value should be 0x600 + server nodeId etisserant@0: 0x580, // cobid received from the server. The good value should be 0x580 + server nodeId etisserant@0: 0x0 // server NodeId etisserant@0: }; etisserant@0: static subindex Index1280[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof( UNS8 ), (void*)&obj1280.count }, etisserant@0: { RW, uint8, sizeof( UNS32 ), (void*)&obj1280.cob_id_client }, etisserant@0: { RW, uint8, sizeof( UNS32 ), (void*)&obj1280.cob_id_server }, etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1280.node_id } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1400 : PDO receive communication parameter */ etisserant@0: static s_pdo_communication_parameter obj1400 = etisserant@0: { 2, // Largest subindex supported etisserant@0: 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) etisserant@0: 253 // Transmission type. See objdictdef.h etisserant@0: }; etisserant@0: static subindex Index1400[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof( UNS8 ), (void*)&obj1400.count }, etisserant@0: { RW, uint8, sizeof( UNS32 ), (void*)&obj1400.cob_id }, etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1400.type }, etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1401 : PDO receive communication parameter */ etisserant@0: static s_pdo_communication_parameter obj1401 = etisserant@0: { 2, // Largest subindex supported etisserant@0: 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) etisserant@0: 253 // Transmission type. See objdictdef.h etisserant@0: }; etisserant@0: static subindex Index1401[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof( UNS8 ), (void*)&obj1401.count }, etisserant@0: { RW, uint8, sizeof( UNS32 ), (void*)&obj1401.cob_id }, etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1401.type }, etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1402 : PDO receive communication parameter */ etisserant@0: static s_pdo_communication_parameter obj1402 = etisserant@0: { 2, // Largest subindex supported etisserant@0: 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) etisserant@0: 253 // Transmission type. See objdictdef.h etisserant@0: }; etisserant@0: static subindex Index1402[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof( UNS8 ), (void*)&obj1402.count }, etisserant@0: { RW, uint8, sizeof( UNS32 ), (void*)&obj1402.cob_id }, etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1402.type }, etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1600 : PDO receive mapping parameter of PDO communication index 0x1400 */ etisserant@0: static UNS8 obj1600_cnt = 0; // Number of mapped variables etisserant@0: static UNS32 obj1600_mappedVar[] = { etisserant@0: // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 : etisserant@0: // PDO_MAP(6035,12,16) etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00) etisserant@0: }; etisserant@0: subindex Index1600[] = etisserant@0: { etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1600_cnt }, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[0]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[1]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[2]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[3]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[4]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[5]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[6]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1600_mappedVar[7]} etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1601 : PDO receive mapping parameter of PDO communication index 0x1401 */ etisserant@0: static UNS8 obj1601_cnt = 0; // Number of mapped variables etisserant@0: static UNS32 obj1601_mappedVar[] = { etisserant@0: // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 : etisserant@0: // PDO_MAP(6035,12,16) etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00) etisserant@0: }; etisserant@0: subindex Index1601[] = etisserant@0: { etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1601_cnt }, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[0]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[1]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[2]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[3]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[4]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[5]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[6]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1601_mappedVar[7]} etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1602 : PDO receive mapping parameter of PDO communication index 0x1402 */ etisserant@0: static UNS8 obj1602_cnt = 0; // Number of mapped variables etisserant@0: static UNS32 obj1602_mappedVar[] = { etisserant@0: // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 : etisserant@0: // PDO_MAP(6035,12,16) etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00) etisserant@0: }; etisserant@0: subindex Index1602[] = etisserant@0: { etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1602_cnt }, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[0]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[1]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[2]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[3]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[4]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[5]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[6]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1602_mappedVar[7]} etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1800 : PDO transmit communication parameter */ etisserant@0: static s_pdo_communication_parameter obj1800 = etisserant@0: { 2, // Largest subindex supported etisserant@0: 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) etisserant@0: 253 // Transmission type. See objdictdef.h etisserant@0: }; etisserant@0: static subindex Index1800[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof( UNS8 ), (void*)&obj1800.count }, etisserant@0: { RW, uint8, sizeof( UNS32 ), (void*)&obj1800.cob_id }, etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1800.type }, etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1801 : PDO transmit communication parameter */ etisserant@0: static s_pdo_communication_parameter obj1801 = etisserant@0: { 2, // Largest subindex supported etisserant@0: 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) etisserant@0: 253 // Transmission type. See objdictdef.h etisserant@0: }; etisserant@0: static subindex Index1801[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof( UNS8 ), (void*)&obj1801.count }, etisserant@0: { RW, uint8, sizeof( UNS32 ), (void*)&obj1801.cob_id }, etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1801.type }, etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1802 : PDO transmit communication parameter */ etisserant@0: static s_pdo_communication_parameter obj1802 = etisserant@0: { 2, // Largest subindex supported etisserant@0: 0x0, // Default COBID (overwritten at init for index 0x1400 to 0x1403) etisserant@0: 253 // Transmission type. See objdictdef.h etisserant@0: }; etisserant@0: static subindex Index1802[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof( UNS8 ), (void*)&obj1802.count }, etisserant@0: { RW, uint8, sizeof( UNS32 ), (void*)&obj1802.cob_id }, etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1802.type }, etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1A00 : PDO transmit mapping parameter of PDO communication index 0x1800 */ etisserant@0: static UNS8 obj1A00_cnt = 0; // Number of mapped variables etisserant@0: static UNS32 obj1A00_mappedVar[] = { etisserant@0: // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 : etisserant@0: // PDO_MAP(6035,12,16) etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00) etisserant@0: }; etisserant@0: subindex Index1A00[] = etisserant@0: { etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1A00_cnt }, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[0]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[1]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[2]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[3]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[4]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[5]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[6]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A00_mappedVar[7]} etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1A01 : PDO transmit mapping parameter of PDO communication index 0x1801 */ etisserant@0: static UNS8 obj1A01_cnt = 0; // Number of mapped variables etisserant@0: static UNS32 obj1A01_mappedVar[] = { etisserant@0: // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 : etisserant@0: // PDO_MAP(6035,12,16) etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00) etisserant@0: }; etisserant@0: subindex Index1A01[] = etisserant@0: { etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1A01_cnt }, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[0]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[1]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[2]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[3]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[4]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[5]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[6]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A01_mappedVar[7]} etisserant@0: }; etisserant@0: etisserant@0: /* index 0x1A02 : PDO transmit mapping parameter of PDO communication index 0x1802 */ etisserant@0: static UNS8 obj1A02_cnt = 0; // Number of mapped variables etisserant@0: static UNS32 obj1A02_mappedVar[] = { etisserant@0: // Example to map a variable of 16 bits defined at index 0x6035, subindex 0x12 : etisserant@0: // PDO_MAP(6035,12,16) etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00), etisserant@0: PDO_MAP(0000, 00, 00) etisserant@0: }; etisserant@0: subindex Index1A02[] = etisserant@0: { etisserant@0: { RW, uint8, sizeof( UNS8 ), (void*)&obj1A02_cnt }, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[0]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[1]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[2]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[3]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[4]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[5]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[6]}, etisserant@0: { RW, uint32, sizeof( UNS32 ), (void*)&obj1A02_mappedVar[7]} etisserant@0: }; etisserant@0: etisserant@0: etisserant@0: /* index 0x2000 : Mapped variable */ etisserant@0: static UNS8 highestSubIndex_2000 = 4; // number of subindex - 1 etisserant@0: subindex Index2000[] = etisserant@0: { etisserant@0: { RO, uint8, sizeof (UNS8), (void*)&highestSubIndex_2000 }, etisserant@0: { RW, uint8, sizeof (UNS8), (void*)&seconds }, etisserant@0: { RW, uint32, sizeof (UNS32), (void*)&minutes }, etisserant@0: { RW, uint8, sizeof (UNS8), (void*)&hours }, etisserant@0: { RW, uint8, sizeof (UNS8), (void*)&day } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x6000 : Mapped variable */ etisserant@0: subindex Index6000[] = etisserant@0: { etisserant@0: { RW, uint32, sizeof (UNS32), (void*)&canopenErrNB } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x6001 : Mapped variable */ etisserant@0: subindex Index6001[] = etisserant@0: { etisserant@0: { RW, uint32, sizeof (UNS32), (void*)&canopenErrVAL } etisserant@0: }; etisserant@0: etisserant@0: /* index 0x6002 : Mapped variable */ etisserant@0: subindex Index6002[] = etisserant@0: { etisserant@0: { RW, visible_string, sizeof (strTest), (void*)&strTest } etisserant@0: }; etisserant@0: etisserant@0: const indextable objdict[] = etisserant@0: { etisserant@0: DeclareIndexTableEntry(Index1000, 0x1000), etisserant@0: DeclareIndexTableEntry(Index1001, 0x1001), etisserant@0: DeclareIndexTableEntry(Index1005, 0x1005), etisserant@0: DeclareIndexTableEntry(Index1006, 0x1006), etisserant@0: DeclareIndexTableEntry(Index1007, 0x1007), etisserant@0: DeclareIndexTableEntry(Index1008, 0x1008), etisserant@0: DeclareIndexTableEntry(Index1009, 0x1009), etisserant@0: DeclareIndexTableEntry(Index100A, 0x100A), etisserant@0: DeclareIndexTableEntry(Index1016, 0x1016), etisserant@0: DeclareIndexTableEntry(Index1017, 0x1017), etisserant@0: DeclareIndexTableEntry(Index1018, 0x1018), etisserant@0: DeclareIndexTableEntry(Index1200, 0x1200), etisserant@0: DeclareIndexTableEntry(Index1280, 0x1280), etisserant@0: DeclareIndexTableEntry(Index1400, 0x1400), etisserant@0: DeclareIndexTableEntry(Index1401, 0x1401), etisserant@0: DeclareIndexTableEntry(Index1402, 0x1402), etisserant@0: DeclareIndexTableEntry(Index1600, 0x1600), etisserant@0: DeclareIndexTableEntry(Index1601, 0x1601), etisserant@0: DeclareIndexTableEntry(Index1602, 0x1602), etisserant@0: DeclareIndexTableEntry(Index1800, 0x1800), etisserant@0: DeclareIndexTableEntry(Index1801, 0x1801), etisserant@0: DeclareIndexTableEntry(Index1802, 0x1802), etisserant@0: DeclareIndexTableEntry(Index1A00, 0x1A00), etisserant@0: DeclareIndexTableEntry(Index1A01, 0x1A01), etisserant@0: DeclareIndexTableEntry(Index1A02, 0x1A02), etisserant@0: DeclareIndexTableEntry(Index2000, 0x2000), etisserant@0: DeclareIndexTableEntry(Index6000, 0x6000), etisserant@0: DeclareIndexTableEntry(Index6001, 0x6001), etisserant@0: DeclareIndexTableEntry(Index6002, 0x6002), etisserant@0: }; etisserant@0: etisserant@0: // To count at which received SYNC a PDO must be sent. etisserant@0: // Even if no pdoTransmit are defined, at least one entry is computed etisserant@0: // for compilations issues. etisserant@0: UNS8 count_sync[1] = {0, }; etisserant@0: etisserant@0: UNS16 firstIndex (enum e_first_object object, UNS16 *lastIndex) etisserant@0: { etisserant@0: switch (object) { etisserant@0: case FIRST_SDO_SERVER : etisserant@0: *lastIndex = 11; etisserant@0: return 11; etisserant@0: case FIRST_SDO_CLIENT : etisserant@0: *lastIndex = 12; etisserant@0: return 12; etisserant@0: case FIRST_PDO_RCV : etisserant@0: *lastIndex = 15; etisserant@0: return 13; etisserant@0: case FIRST_PDO_RCV_MAP : etisserant@0: *lastIndex = 18; etisserant@0: return 16; etisserant@0: case FIRST_PDO_TRS : etisserant@0: *lastIndex = 21; etisserant@0: return 19; etisserant@0: case FIRST_PDO_TRS_MAP : etisserant@0: *lastIndex = 24; etisserant@0: return 22; etisserant@0: } etisserant@0: *lastIndex = 0; etisserant@0: return 0; etisserant@0: } etisserant@0: etisserant@0: UNS16 getObjdictSize (void) etisserant@0: { etisserant@0: return sizeof(objdict)/sizeof(objdict[0]); etisserant@0: }