--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterSlave/TestMaster.c Wed May 10 16:59:40 2006 +0200
@@ -0,0 +1,306 @@
+/*
+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
+*/
+
+/* File generated by gen_cfile.py. Should not be modified. */
+
+#include "TestMaster.h"
+
+/**************************************************************************/
+/* Declaration of the mapped variables */
+/**************************************************************************/
+UNS8 MasterMap1 = 0x0; // Mapped at index 0x2000, subindex 0x00
+UNS8 MasterMap2 = 0x0; // Mapped at index 0x2001, subindex 0x00
+UNS8 MasterMap3 = 0x0; // Mapped at index 0x2002, subindex 0x00
+UNS8 MasterMap4 = 0x0; // Mapped at index 0x2003, subindex 0x00
+
+/**************************************************************************/
+/* Declaration of the value range types */
+/**************************************************************************/
+
+UNS32 TestMaster_valueRangeTest (UNS8 typeValue, void * value)
+{
+ switch (typeValue) {
+ }
+ return 0;
+}
+
+/**************************************************************************/
+/* The node id */
+/**************************************************************************/
+/* node_id default value.*/
+UNS8 TestMaster_bDeviceNodeId = 0x00;
+
+//*****************************************************************************/
+/* Array of message processing information */
+
+const UNS8 TestMaster_iam_a_slave = 0;
+
+TIMER_HANDLE TestMaster_heartBeatTimers[1] = {TIMER_NONE,};
+
+//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+//
+// OBJECT DICTIONARY
+//
+//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+
+/* index 0x1000 : Device Type. */
+ UNS32 TestMaster_obj1000 = 0x12D;
+ subindex TestMaster_Index1000[] =
+ {
+ { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1000 }
+ };
+
+/* index 0x1001 : Error Register. */
+ UNS8 TestMaster_obj1001 = 0x0;
+ subindex TestMaster_Index1001[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&TestMaster_obj1001 }
+ };
+
+/* index 0x1005 : SYNC COB ID. */
+ UNS32 TestMaster_obj1005 = 0x40000080;
+ ODCallback_t TestMaster_Index1005_callbacks[] =
+ {
+ NULL,
+ };
+ subindex TestMaster_Index1005[] =
+ {
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1005 }
+ };
+
+/* index 0x1006 : Communication / Cycle Period. */
+ UNS32 TestMaster_obj1006 = 0xC350;
+ ODCallback_t TestMaster_Index1006_callbacks[] =
+ {
+ NULL,
+ };
+ subindex TestMaster_Index1006[] =
+ {
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1006 }
+ };
+
+/* index 0x1016 : Consumer Heartbeat Time. */
+ UNS8 TestMaster_highestSubIndex_obj1016 = 1; // number of subindex - 1
+ UNS32 TestMaster_obj1016[] =
+ {
+ 133122
+ };
+ subindex TestMaster_Index1016[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1016 },
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1016[0] }
+ };
+
+/* index 0x1017 : Producer Heartbeat Time */
+ UNS16 TestMaster_obj1017 = 0;
+
+/* index 0x1018 : Identity. */
+ UNS8 TestMaster_highestSubIndex_obj1018 = 4; // number of subindex - 1
+ UNS32 TestMaster_obj1018_Vendor_ID = 0x0;
+ UNS32 TestMaster_obj1018_Product_Code = 0x0;
+ UNS32 TestMaster_obj1018_Revision_Number = 0x0;
+ UNS32 TestMaster_obj1018_Serial_Number = 0x0;
+ subindex TestMaster_Index1018[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1018 },
+ { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Vendor_ID },
+ { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Product_Code },
+ { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Revision_Number },
+ { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Serial_Number }
+ };
+
+/* index 0x1280 : Client SDO 1 Parameter. */
+ UNS8 TestMaster_highestSubIndex_obj1280 = 3; // number of subindex - 1
+ UNS32 TestMaster_obj1280_COB_ID_Client_to_Server_Transmit_SDO = 0x602;
+ UNS32 TestMaster_obj1280_COB_ID_Server_to_Client_Receive_SDO = 0x582;
+ UNS32 TestMaster_obj1280_Node_ID_of_the_SDO_Server = 0x2;
+ subindex TestMaster_Index1280[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1280 },
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1280_COB_ID_Client_to_Server_Transmit_SDO },
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1280_COB_ID_Server_to_Client_Receive_SDO },
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1280_Node_ID_of_the_SDO_Server }
+ };
+
+/* index 0x1400 : Receive PDO 1 Parameter. */
+ UNS8 TestMaster_highestSubIndex_obj1400 = 5; // number of subindex - 1
+ UNS32 TestMaster_obj1400_COB_ID_used_by_PDO = 0x182;
+ UNS8 TestMaster_obj1400_Transmission_Type = 0x1;
+ UNS16 TestMaster_obj1400_Inhibit_Time = 0x0;
+ UNS16 TestMaster_obj1400_Compatibility_Entry = 0x0;
+ UNS16 TestMaster_obj1400_Event_Timer = 0x0;
+ subindex TestMaster_Index1400[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1400 },
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1400_COB_ID_used_by_PDO },
+ { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1400_Transmission_Type },
+ { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1400_Inhibit_Time },
+ { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1400_Compatibility_Entry },
+ { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1400_Event_Timer }
+ };
+
+/* index 0x1401 : Receive PDO 2 Parameter. */
+ UNS8 TestMaster_highestSubIndex_obj1401 = 5; // number of subindex - 1
+ UNS32 TestMaster_obj1401_COB_ID_used_by_PDO = 0x282;
+ UNS8 TestMaster_obj1401_Transmission_Type = 0x1;
+ UNS16 TestMaster_obj1401_Inhibit_Time = 0x0;
+ UNS16 TestMaster_obj1401_Compatibility_Entry = 0x0;
+ UNS16 TestMaster_obj1401_Event_Timer = 0x0;
+ subindex TestMaster_Index1401[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1401 },
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1401_COB_ID_used_by_PDO },
+ { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1401_Transmission_Type },
+ { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1401_Inhibit_Time },
+ { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1401_Compatibility_Entry },
+ { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1401_Event_Timer }
+ };
+
+/* index 0x1600 : Receive PDO 1 Mapping. */
+ UNS8 TestMaster_highestSubIndex_obj1600 = 2; // number of subindex - 1
+ UNS32 TestMaster_obj1600[] =
+ {
+ 536870920,
+ 536936456
+ };
+ subindex TestMaster_Index1600[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1600 },
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1600[0] },
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1600[1] }
+ };
+
+/* index 0x1601 : Receive PDO 2 Mapping. */
+ UNS8 TestMaster_highestSubIndex_obj1601 = 2; // number of subindex - 1
+ UNS32 TestMaster_obj1601[] =
+ {
+ 537001992,
+ 537067528
+ };
+ subindex TestMaster_Index1601[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1601 },
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1601[0] },
+ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1601[1] }
+ };
+
+/* index 0x2000 : Mapped variable MasterMap1 */
+ ODCallback_t MasterMap1_callbacks[] =
+ {
+ NULL,
+ };
+ subindex TestMaster_Index2000[] =
+ {
+ { RW, uint8, sizeof (UNS8), (void*)&MasterMap1 }
+ };
+
+/* index 0x2001 : Mapped variable MasterMap2 */
+ subindex TestMaster_Index2001[] =
+ {
+ { RW, uint8, sizeof (UNS8), (void*)&MasterMap2 }
+ };
+
+/* index 0x2002 : Mapped variable MasterMap3 */
+ subindex TestMaster_Index2002[] =
+ {
+ { RW, uint8, sizeof (UNS8), (void*)&MasterMap3 }
+ };
+
+/* index 0x2003 : Mapped variable MasterMap4 */
+ subindex TestMaster_Index2003[] =
+ {
+ { RW, uint8, sizeof (UNS8), (void*)&MasterMap4 }
+ };
+
+const indextable TestMaster_objdict[] =
+{
+ { (subindex*)TestMaster_Index1000,sizeof(TestMaster_Index1000)/sizeof(TestMaster_Index1000[0]), 0x1000},
+ { (subindex*)TestMaster_Index1001,sizeof(TestMaster_Index1001)/sizeof(TestMaster_Index1001[0]), 0x1001},
+ { (subindex*)TestMaster_Index1005,sizeof(TestMaster_Index1005)/sizeof(TestMaster_Index1005[0]), 0x1005},
+ { (subindex*)TestMaster_Index1006,sizeof(TestMaster_Index1006)/sizeof(TestMaster_Index1006[0]), 0x1006},
+ { (subindex*)TestMaster_Index1016,sizeof(TestMaster_Index1016)/sizeof(TestMaster_Index1016[0]), 0x1016},
+ { (subindex*)TestMaster_Index1018,sizeof(TestMaster_Index1018)/sizeof(TestMaster_Index1018[0]), 0x1018},
+ { (subindex*)TestMaster_Index1280,sizeof(TestMaster_Index1280)/sizeof(TestMaster_Index1280[0]), 0x1280},
+ { (subindex*)TestMaster_Index1400,sizeof(TestMaster_Index1400)/sizeof(TestMaster_Index1400[0]), 0x1400},
+ { (subindex*)TestMaster_Index1401,sizeof(TestMaster_Index1401)/sizeof(TestMaster_Index1401[0]), 0x1401},
+ { (subindex*)TestMaster_Index1600,sizeof(TestMaster_Index1600)/sizeof(TestMaster_Index1600[0]), 0x1600},
+ { (subindex*)TestMaster_Index1601,sizeof(TestMaster_Index1601)/sizeof(TestMaster_Index1601[0]), 0x1601},
+ { (subindex*)TestMaster_Index2000,sizeof(TestMaster_Index2000)/sizeof(TestMaster_Index2000[0]), 0x2000},
+ { (subindex*)TestMaster_Index2001,sizeof(TestMaster_Index2001)/sizeof(TestMaster_Index2001[0]), 0x2001},
+ { (subindex*)TestMaster_Index2002,sizeof(TestMaster_Index2002)/sizeof(TestMaster_Index2002[0]), 0x2002},
+ { (subindex*)TestMaster_Index2003,sizeof(TestMaster_Index2003)/sizeof(TestMaster_Index2003[0]), 0x2003},
+};
+
+const indextable * TestMaster_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks)
+{
+ int i;
+ switch(wIndex){
+ case 0x1000: i = 0; *callbacks = NULL; break;
+ case 0x1001: i = 1; *callbacks = NULL; break;
+ case 0x1005: i = 2; *callbacks = TestMaster_Index1005_callbacks; break;
+ case 0x1006: i = 3; *callbacks = TestMaster_Index1006_callbacks; break;
+ case 0x1016: i = 4; *callbacks = NULL; break;
+ case 0x1018: i = 5; *callbacks = NULL; break;
+ case 0x1280: i = 6; *callbacks = NULL; break;
+ case 0x1400: i = 7; *callbacks = NULL; break;
+ case 0x1401: i = 8; *callbacks = NULL; break;
+ case 0x1600: i = 9; *callbacks = NULL; break;
+ case 0x1601: i = 10; *callbacks = NULL; break;
+ case 0x2000: i = 11; *callbacks = MasterMap1_callbacks; break;
+ case 0x2001: i = 12; *callbacks = NULL; break;
+ case 0x2002: i = 13; *callbacks = NULL; break;
+ case 0x2003: i = 14; *callbacks = NULL; break;
+ default:
+ *errorCode = OD_NO_SUCH_OBJECT;
+ return NULL;
+ }
+ *errorCode = OD_SUCCESSFUL;
+ return &TestMaster_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.
+UNS8 TestMaster_count_sync[1] = {0,};
+
+quick_index TestMaster_firstIndex = {
+ SDO_SVR : 0,
+ SDO_CLT : 6,
+ PDO_RCV : 7,
+ PDO_RCV_MAP : 9,
+ PDO_TRS : 0,
+ PDO_TRS_MAP : 0
+};
+
+quick_index TestMaster_lastIndex = {
+ SDO_SVR : 0,
+ SDO_CLT : 6,
+ PDO_RCV : 8,
+ PDO_RCV_MAP : 10,
+ PDO_TRS : 0,
+ PDO_TRS_MAP : 0
+};
+
+UNS16 TestMaster_ObjdictSize = sizeof(TestMaster_objdict)/sizeof(TestMaster_objdict[0]);
+
+CO_Data TestMaster_Data = CANOPEN_NODE_DATA_INITIALIZER(TestMaster);
+