# HG changeset patch # User etisserant # Date 1183393378 -7200 # Node ID 905677ed00f3527d0a38ab5f37f66ccf94a5be00 # Parent f812bf6b7237839369414eb449c88e4ea1939d7f Full preliminary implementation of TPDO transmit type: - SYNC (N) (1-240) - RTR only + SYNC (252) - RTR only (253) - EVENT, with timer and inhibit time (254 and 255) User app have to call sendPDOevent(d) to eventually signal mapped data changes. Callbacks added to 0x140N, TPDO comm parameters for on the fly timers values change. TestMasterSlave updated. diff -r f812bf6b7237 -r 905677ed00f3 examples/TestMasterSlave/Master.c --- a/examples/TestMasterSlave/Master.c Fri Jun 29 19:51:39 2007 +0200 +++ b/examples/TestMasterSlave/Master.c Mon Jul 02 18:22:58 2007 +0200 @@ -164,15 +164,41 @@ void TestMaster_post_sync() { eprintf("TestMaster_post_sync\n"); - eprintf("Master: %d %d %d %d %d %d %d %d %d %x %x\n",MasterMap1,MasterMap2 ,MasterMap3, MasterMap4,MasterMap5,MasterMap6,MasterMap7,MasterMap8,MasterMap9,MasterMap10,MasterMap11); + eprintf("Master: %d %d %d %d %d %d %d %d %d %x %x %d %d\n", + MasterMap1, + MasterMap2, + MasterMap3, + MasterMap4, + MasterMap5, + MasterMap6, + MasterMap7, + MasterMap8, + MasterMap9, + MasterMap10, + MasterMap11, + MasterMap12, + MasterMap13); } char query_result = 0; char waiting_answer = 0; + +static void CheckSDO(CO_Data* d, UNS8 nodeId) +{ + UNS32 abortCode; + if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED) + eprintf("Master : Failed in changing Slave's transmit type AbortCode :%4.4x \n", abortCode); + + /* Finalise last SDO transfer with this node */ + closeSDOtransfer(&TestMaster_Data, nodeId, SDO_CLIENT); +} + + +static int MasterSyncCount = 0; void TestMaster_post_TPDO() { - eprintf("TestMaster_post_TPDO\n"); + eprintf("TestMaster_post_TPDO MasterSyncCount = %d \n", MasterSyncCount); // // { // char zero = 0; @@ -188,6 +214,7 @@ // } // } +#if 0 if(waiting_answer){ UNS32 abortCode; UNS8 size; @@ -214,7 +241,7 @@ case SDO_UPLOAD_IN_PROGRESS: break; } - }else if(MasterMap1 % 10 == 0){ + }else if(MasterSyncCount % 10 == 0){ readNetworkDict ( &TestMaster_Data, 0x02, @@ -223,4 +250,35 @@ 0); waiting_answer = 1; } -} +#endif + if(MasterSyncCount % 17 == 0){ + eprintf("Master : Ask RTR PDO (0x1402)\n"); + sendPDOrequest(&TestMaster_Data, 0x1402 ); + sendPDOrequest(&TestMaster_Data, 0x1403 ); + } + if(MasterSyncCount % 50 == 0){ + eprintf("Master : Change slave's transmit type to 0xFF\n"); + UNS8 transmitiontype = 0xFF; + writeNetworkDictCallBack (&TestMaster_Data, /*CO_Data* d*/ + 2, /*UNS8 nodeId*/ + 0x1802, /*UNS16 index*/ + 0x02, /*UNS16 index*/ + 1, /*UNS8 count*/ + 0, /*UNS8 dataType*/ + &transmitiontype,/*void *data*/ + CheckSDO); /*SDOCallback_t Callback*/ + } + if(MasterSyncCount % 50 == 25){ + eprintf("Master : Change slave's transmit type to 0x00\n"); + UNS8 transmitiontype = 0x00; + writeNetworkDictCallBack (&TestMaster_Data, /*CO_Data* d*/ + 2, /*UNS8 nodeId*/ + 0x1802, /*UNS16 index*/ + 0x02, /*UNS16 index*/ + 1, /*UNS8 count*/ + 0, /*UNS8 dataType*/ + &transmitiontype,/*void *data*/ + CheckSDO); /*SDOCallback_t Callback*/ + } + MasterSyncCount++; +} diff -r f812bf6b7237 -r 905677ed00f3 examples/TestMasterSlave/Slave.c --- a/examples/TestMasterSlave/Slave.c Fri Jun 29 19:51:39 2007 +0200 +++ b/examples/TestMasterSlave/Slave.c Mon Jul 02 18:22:58 2007 +0200 @@ -65,11 +65,26 @@ SlaveMap9=16; SlaveMap10 = 0xff00ff00; SlaveMap11 = 0xabcd; - eprintf("Slave: %d %d %d %d %d %d %d %d %d %x %x\n",SlaveMap1, SlaveMap2, SlaveMap3, SlaveMap4, SlaveMap5, SlaveMap6, SlaveMap7, SlaveMap8, SlaveMap9, SlaveMap10,SlaveMap11); + SlaveMap12 += SlaveMap12 > 0x80 ? 0 : 1; + eprintf("Slave: %d %d %d %d %d %d %d %d %d %x %x %d %d \n", + SlaveMap1, + SlaveMap2, + SlaveMap3, + SlaveMap4, + SlaveMap5, + SlaveMap6, + SlaveMap7, + SlaveMap8, + SlaveMap9, + SlaveMap10, + SlaveMap11, + SlaveMap12, + SlaveMap13); } void TestSlave_post_TPDO() { + SlaveMap13 += 1; eprintf("TestSlave_post_TPDO\n"); } diff -r f812bf6b7237 -r 905677ed00f3 examples/TestMasterSlave/TestMaster.c --- a/examples/TestMasterSlave/TestMaster.c Fri Jun 29 19:51:39 2007 +0200 +++ b/examples/TestMasterSlave/TestMaster.c Mon Jul 02 18:22:58 2007 +0200 @@ -17,6 +17,8 @@ UNS8 MasterMap9 = 0x0; /* Mapped at index 0x2008, subindex 0x00 */ UNS32 MasterMap10 = 0x0; /* Mapped at index 0x2009, subindex 0x00 */ UNS16 MasterMap11 = 0x0; /* Mapped at index 0x200A, subindex 0x00 */ +INTEGER16 MasterMap12 = 0x0; /* Mapped at index 0x200B, subindex 0x00 */ +INTEGER16 MasterMap13 = 0x0; /* Mapped at index 0x200C, subindex 0x00 */ /**************************************************************************/ /* Declaration of the value range types */ @@ -33,7 +35,7 @@ /* The node id */ /**************************************************************************/ /* node_id default value.*/ -UNS8 TestMaster_bDeviceNodeId = 0x01; +UNS8 TestMaster_bDeviceNodeId = 0x00; /**************************************************************************/ /* Array of message processing information */ @@ -161,7 +163,7 @@ /* index 0x1400 : Receive PDO 1 Parameter. */ UNS8 TestMaster_highestSubIndex_obj1400 = 5; /* number of subindex - 1*/ - UNS32 TestMaster_obj1400_COB_ID_used_by_PDO = 0x182; /* 386 */ + UNS32 TestMaster_obj1400_COB_ID_used_by_PDO = 0x200; /* 512 */ UNS8 TestMaster_obj1400_Transmission_Type = 0x1; /* 1 */ UNS16 TestMaster_obj1400_Inhibit_Time = 0x0; /* 0 */ UNS8 TestMaster_obj1400_Compatibility_Entry = 0x0; /* 0 */ @@ -178,7 +180,7 @@ /* index 0x1401 : Receive PDO 2 Parameter. */ UNS8 TestMaster_highestSubIndex_obj1401 = 5; /* number of subindex - 1*/ - UNS32 TestMaster_obj1401_COB_ID_used_by_PDO = 0x0; /* 0 */ + UNS32 TestMaster_obj1401_COB_ID_used_by_PDO = 0x300; /* 768 */ UNS8 TestMaster_obj1401_Transmission_Type = 0x0; /* 0 */ UNS16 TestMaster_obj1401_Inhibit_Time = 0x0; /* 0 */ UNS8 TestMaster_obj1401_Compatibility_Entry = 0x0; /* 0 */ @@ -193,6 +195,40 @@ { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1401_Event_Timer } }; +/* index 0x1402 : Receive PDO 3 Parameter. */ + UNS8 TestMaster_highestSubIndex_obj1402 = 5; /* number of subindex - 1*/ + UNS32 TestMaster_obj1402_COB_ID_used_by_PDO = 0x401; /* 1025 */ + UNS8 TestMaster_obj1402_Transmission_Type = 0x0; /* 0 */ + UNS16 TestMaster_obj1402_Inhibit_Time = 0x0; /* 0 */ + UNS8 TestMaster_obj1402_Compatibility_Entry = 0x0; /* 0 */ + UNS16 TestMaster_obj1402_Event_Timer = 0x0; /* 0 */ + subindex TestMaster_Index1402[] = + { + { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1402 }, + { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1402_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1402_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1402_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1402_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1402_Event_Timer } + }; + +/* index 0x1403 : Receive PDO 4 Parameter. */ + UNS8 TestMaster_highestSubIndex_obj1403 = 5; /* number of subindex - 1*/ + UNS32 TestMaster_obj1403_COB_ID_used_by_PDO = 0x482; /* 1154 */ + UNS8 TestMaster_obj1403_Transmission_Type = 0x0; /* 0 */ + UNS16 TestMaster_obj1403_Inhibit_Time = 0x0; /* 0 */ + UNS8 TestMaster_obj1403_Compatibility_Entry = 0x0; /* 0 */ + UNS16 TestMaster_obj1403_Event_Timer = 0x0; /* 0 */ + subindex TestMaster_Index1403[] = + { + { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1403 }, + { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1403_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1403_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1403_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1403_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1403_Event_Timer } + }; + /* index 0x1600 : Receive PDO 1 Mapping. */ UNS8 TestMaster_highestSubIndex_obj1600 = 10; /* number of subindex - 1*/ UNS32 TestMaster_obj1600[] = @@ -235,6 +271,30 @@ { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1601[0] } }; +/* index 0x1602 : Receive PDO 3 Mapping. */ + UNS8 TestMaster_highestSubIndex_obj1602 = 1; /* number of subindex - 1*/ + UNS32 TestMaster_obj1602[] = + { + 0x200B0010 /* 537591824 */ + }; + subindex TestMaster_Index1602[] = + { + { RW, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1602 }, + { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1602[0] } + }; + +/* index 0x1603 : Receive PDO 4 Mapping. */ + UNS8 TestMaster_highestSubIndex_obj1603 = 1; /* number of subindex - 1*/ + UNS32 TestMaster_obj1603[] = + { + 0x200C0010 /* 537657360 */ + }; + subindex TestMaster_Index1603[] = + { + { RW, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1603 }, + { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1603[0] } + }; + /* index 0x1F22 : Concise DCF. */ UNS8 TestMaster_highestSubIndex_obj1F22 = 2; /* number of subindex - 1*/ UNS8* TestMaster_obj1F22[] = @@ -315,6 +375,18 @@ { RW, uint16, sizeof (UNS16), (void*)&MasterMap11 } }; +/* index 0x200B : Mapped variable MasterMap12 */ + subindex TestMaster_Index200B[] = + { + { RW, int16, sizeof (INTEGER16), (void*)&MasterMap12 } + }; + +/* index 0x200C : Mapped variable MasterMap13 */ + subindex TestMaster_Index200C[] = + { + { RW, int16, sizeof (INTEGER16), (void*)&MasterMap13 } + }; + const indextable TestMaster_objdict[] = { { (subindex*)TestMaster_Index1000,sizeof(TestMaster_Index1000)/sizeof(TestMaster_Index1000[0]), 0x1000}, @@ -328,8 +400,12 @@ { (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_Index1402,sizeof(TestMaster_Index1402)/sizeof(TestMaster_Index1402[0]), 0x1402}, + { (subindex*)TestMaster_Index1403,sizeof(TestMaster_Index1403)/sizeof(TestMaster_Index1403[0]), 0x1403}, { (subindex*)TestMaster_Index1600,sizeof(TestMaster_Index1600)/sizeof(TestMaster_Index1600[0]), 0x1600}, { (subindex*)TestMaster_Index1601,sizeof(TestMaster_Index1601)/sizeof(TestMaster_Index1601[0]), 0x1601}, + { (subindex*)TestMaster_Index1602,sizeof(TestMaster_Index1602)/sizeof(TestMaster_Index1602[0]), 0x1602}, + { (subindex*)TestMaster_Index1603,sizeof(TestMaster_Index1603)/sizeof(TestMaster_Index1603[0]), 0x1603}, { (subindex*)TestMaster_Index1F22,sizeof(TestMaster_Index1F22)/sizeof(TestMaster_Index1F22[0]), 0x1F22}, { (subindex*)TestMaster_Index2000,sizeof(TestMaster_Index2000)/sizeof(TestMaster_Index2000[0]), 0x2000}, { (subindex*)TestMaster_Index2001,sizeof(TestMaster_Index2001)/sizeof(TestMaster_Index2001[0]), 0x2001}, @@ -342,6 +418,8 @@ { (subindex*)TestMaster_Index2008,sizeof(TestMaster_Index2008)/sizeof(TestMaster_Index2008[0]), 0x2008}, { (subindex*)TestMaster_Index2009,sizeof(TestMaster_Index2009)/sizeof(TestMaster_Index2009[0]), 0x2009}, { (subindex*)TestMaster_Index200A,sizeof(TestMaster_Index200A)/sizeof(TestMaster_Index200A[0]), 0x200A}, + { (subindex*)TestMaster_Index200B,sizeof(TestMaster_Index200B)/sizeof(TestMaster_Index200B[0]), 0x200B}, + { (subindex*)TestMaster_Index200C,sizeof(TestMaster_Index200C)/sizeof(TestMaster_Index200C[0]), 0x200C}, }; const indextable * TestMaster_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks) @@ -360,20 +438,26 @@ case 0x1280: i = 8;break; case 0x1400: i = 9;break; case 0x1401: i = 10;break; - case 0x1600: i = 11;break; - case 0x1601: i = 12;break; - case 0x1F22: i = 13;break; - case 0x2000: i = 14;break; - case 0x2001: i = 15;break; - case 0x2002: i = 16;break; - case 0x2003: i = 17;break; - case 0x2004: i = 18;break; - case 0x2005: i = 19;break; - case 0x2006: i = 20;break; - case 0x2007: i = 21;break; - case 0x2008: i = 22;break; - case 0x2009: i = 23;break; - case 0x200A: i = 24;break; + case 0x1402: i = 11;break; + case 0x1403: i = 12;break; + case 0x1600: i = 13;break; + case 0x1601: i = 14;break; + case 0x1602: i = 15;break; + case 0x1603: i = 16;break; + case 0x1F22: i = 17;break; + case 0x2000: i = 18;break; + case 0x2001: i = 19;break; + case 0x2002: i = 20;break; + case 0x2003: i = 21;break; + case 0x2004: i = 22;break; + case 0x2005: i = 23;break; + case 0x2006: i = 24;break; + case 0x2007: i = 25;break; + case 0x2008: i = 26;break; + case 0x2009: i = 27;break; + case 0x200A: i = 28;break; + case 0x200B: i = 29;break; + case 0x200C: i = 30;break; default: *errorCode = OD_NO_SUCH_OBJECT; return NULL; @@ -393,7 +477,7 @@ 0, /* SDO_SVR */ 8, /* SDO_CLT */ 9, /* PDO_RCV */ - 11, /* PDO_RCV_MAP */ + 13, /* PDO_RCV_MAP */ 0, /* PDO_TRS */ 0 /* PDO_TRS_MAP */ }; @@ -401,8 +485,8 @@ quick_index TestMaster_lastIndex = { 0, /* SDO_SVR */ 8, /* SDO_CLT */ - 10, /* PDO_RCV */ - 12, /* PDO_RCV_MAP */ + 12, /* PDO_RCV */ + 16, /* PDO_RCV_MAP */ 0, /* PDO_TRS */ 0 /* PDO_TRS_MAP */ }; diff -r f812bf6b7237 -r 905677ed00f3 examples/TestMasterSlave/TestMaster.h --- a/examples/TestMasterSlave/TestMaster.h Fri Jun 29 19:51:39 2007 +0200 +++ b/examples/TestMasterSlave/TestMaster.h Mon Jul 02 18:22:58 2007 +0200 @@ -23,5 +23,7 @@ extern UNS8 MasterMap9; /* Mapped at index 0x2008, subindex 0x00*/ extern UNS32 MasterMap10; /* Mapped at index 0x2009, subindex 0x00*/ extern UNS16 MasterMap11; /* Mapped at index 0x200A, subindex 0x00*/ +extern INTEGER16 MasterMap12; /* Mapped at index 0x200B, subindex 0x00*/ +extern INTEGER16 MasterMap13; /* Mapped at index 0x200C, subindex 0x00*/ #endif // TESTMASTER_H diff -r f812bf6b7237 -r 905677ed00f3 examples/TestMasterSlave/TestMaster.od --- a/examples/TestMasterSlave/TestMaster.od Fri Jun 29 19:51:39 2007 +0200 +++ b/examples/TestMasterSlave/TestMaster.od Mon Jul 02 18:22:58 2007 +0200 @@ -1,18 +1,18 @@ - - + + - - - - - - - - - + + + + + + + + + @@ -30,7 +30,7 @@ - + @@ -66,15 +66,15 @@ - - - - - - - - - + + + + + + + + + @@ -92,7 +92,7 @@ - + @@ -128,15 +128,15 @@ - - - - - - - - - + + + + + + + + + @@ -154,7 +154,7 @@ - + @@ -190,15 +190,15 @@ - - - - - - - - - + + + + + + + + + @@ -216,7 +216,7 @@ - + @@ -252,15 +252,15 @@ - - - - - - - - - + + + + + + + + + @@ -278,7 +278,7 @@ - + @@ -314,15 +314,15 @@ - - - - - - - - - + + + + + + + + + @@ -354,15 +354,15 @@ - - - - - - - - - + + + + + + + + + @@ -380,7 +380,7 @@ - + @@ -416,15 +416,15 @@ - - - - - - - - - + + + + + + + + + @@ -442,7 +442,7 @@ - + @@ -478,15 +478,15 @@ - - - - - - - - - + + + + + + + + + @@ -504,7 +504,7 @@ - + @@ -540,15 +540,15 @@ - - - - - - - - - + + + + + + + + + @@ -566,7 +566,7 @@ - + @@ -602,15 +602,15 @@ - - - - - - - - - + + + + + + + + + @@ -628,7 +628,7 @@ - + @@ -664,15 +664,15 @@ - - - - - - - - - + + + + + + + + + @@ -690,7 +690,7 @@ - + @@ -726,15 +726,15 @@ - - - - - - - - - + + + + + + + + + @@ -752,7 +752,7 @@ - + @@ -788,15 +788,15 @@ - - - - - - - - - + + + + + + + + + @@ -814,7 +814,7 @@ - + @@ -850,15 +850,15 @@ - - - - - - - - - + + + + + + + + + @@ -876,7 +876,7 @@ - + @@ -912,15 +912,15 @@ - - - - - - - - - + + + + + + + + + @@ -938,7 +938,7 @@ - + @@ -974,15 +974,15 @@ - - - - - - - - - + + + + + + + + + @@ -1000,7 +1000,7 @@ - + @@ -1035,16 +1035,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + @@ -1062,7 +1124,7 @@ - + @@ -1098,7 +1160,7 @@ - + @@ -1113,8 +1175,8 @@ - - + + @@ -1132,7 +1194,7 @@ - + @@ -1168,15 +1230,15 @@ - - - - - - - - - + + + + + + + + + @@ -1194,7 +1256,7 @@ - + @@ -1230,15 +1292,15 @@ - - - - - - - - - + + + + + + + + + @@ -1256,7 +1318,7 @@ - + @@ -1292,15 +1354,15 @@ - - - - - - - - - + + + + + + + + + @@ -1318,7 +1380,7 @@ - + @@ -1354,15 +1416,15 @@ - - - - - - - - - + + + + + + + + + @@ -1380,7 +1442,7 @@ - + @@ -1416,15 +1478,15 @@ - - - - - - - - - + + + + + + + + + @@ -1442,7 +1504,7 @@ - + @@ -1478,15 +1540,15 @@ - - - - - - - - - + + + + + + + + + @@ -1504,7 +1566,7 @@ - + @@ -1540,15 +1602,15 @@ - - - - - - - - - + + + + + + + + + @@ -1566,7 +1628,7 @@ - + @@ -1602,15 +1664,15 @@ - - - - - - - - - + + + + + + + + + @@ -1628,7 +1690,7 @@ - + @@ -1664,15 +1726,15 @@ - - - - - - - - - + + + + + + + + + @@ -1690,7 +1752,7 @@ - + @@ -1726,15 +1788,15 @@ - - - - - - - - - + + + + + + + + + @@ -1752,7 +1814,7 @@ - + @@ -1788,15 +1850,15 @@ - - - - - - - - - + + + + + + + + + @@ -1814,7 +1876,7 @@ - + @@ -1850,15 +1912,15 @@ - - - - - - - - - + + + + + + + + + @@ -1876,7 +1938,7 @@ - + @@ -1912,15 +1974,15 @@ - - - - - - - - - + + + + + + + + + @@ -1938,7 +2000,7 @@ - + @@ -1974,15 +2036,15 @@ - - - - - - - - - + + + + + + + + + @@ -2000,7 +2062,7 @@ - + @@ -2036,15 +2098,15 @@ - - - - - - - - - + + + + + + + + + @@ -2062,7 +2124,7 @@ - + @@ -2098,7 +2160,7 @@ - + @@ -2113,8 +2175,8 @@ - - + + @@ -2132,7 +2194,7 @@ - + @@ -2168,15 +2230,15 @@ - - - - - - - - - + + + + + + + + + @@ -2194,7 +2256,7 @@ - + @@ -2230,15 +2292,15 @@ - - - - - - - - - + + + + + + + + + @@ -2256,7 +2318,7 @@ - + @@ -2291,70 +2353,132 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2369,26 +2493,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -2403,7 +2527,7 @@ - + @@ -2418,75 +2542,137 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2501,26 +2687,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -2535,7 +2721,7 @@ - + @@ -2550,21 +2736,393 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2582,7 +3140,7 @@ - + @@ -2608,79 +3166,17 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + @@ -2695,26 +3191,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -2729,7 +3225,7 @@ - + @@ -2744,21 +3240,371 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2776,7 +3622,7 @@ - + @@ -2791,802 +3637,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + @@ -3596,7 +3658,7 @@ - + @@ -3611,8 +3673,8 @@ - - + + @@ -3630,7 +3692,7 @@ - + @@ -3666,15 +3728,15 @@ - - - - - - - - - + + + + + + + + + @@ -3692,7 +3754,7 @@ - + @@ -3727,8 +3789,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -3743,8 +3991,8 @@ - - + + @@ -3762,7 +4010,7 @@ - + @@ -3797,194 +4045,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -3999,8 +4061,8 @@ - - + + @@ -4018,7 +4080,7 @@ - + @@ -4048,13 +4110,385 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4069,26 +4503,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -4103,7 +4537,7 @@ - + @@ -4118,101 +4552,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4227,390 +4599,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + @@ -4620,15 +4620,15 @@ - - - - - - - - - + + + + + + + + + @@ -4646,7 +4646,7 @@ - + @@ -4682,7 +4682,7 @@ - + @@ -4697,8 +4697,8 @@ - - + + @@ -4716,7 +4716,7 @@ - + @@ -4752,15 +4752,15 @@ - - - - - - - - - + + + + + + + + + @@ -4778,7 +4778,7 @@ - + @@ -4814,15 +4814,15 @@ - - - - - - - - - + + + + + + + + + @@ -4840,7 +4840,7 @@ - + @@ -4876,15 +4876,15 @@ - - - - - - - - - + + + + + + + + + @@ -4902,7 +4902,7 @@ - + @@ -4938,7 +4938,7 @@ - + @@ -4953,8 +4953,8 @@ - - + + @@ -4972,7 +4972,7 @@ - + @@ -5007,8 +5007,8 @@ - - + + @@ -5054,8 +5054,17 @@ - - + + + + + + + + + + + @@ -5063,8 +5072,8 @@ - - + + @@ -5072,14 +5081,8 @@ - - - - - - - - + + @@ -5087,8 +5090,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -5100,7 +5128,7 @@ - + @@ -5115,8 +5143,8 @@ - - + + @@ -5125,7 +5153,7 @@ - + @@ -5144,25 +5172,37 @@ - + + - - + + + + + + + + + + + + + - - + + - + @@ -5171,9 +5211,9 @@ - + - + @@ -5182,20 +5222,20 @@ - + - + - - - - - - - - - + + + + + + + + + @@ -5227,15 +5267,15 @@ - - - - - - - - - + + + + + + + + + @@ -5267,15 +5307,15 @@ - - - - - - - - - + + + + + + + + + @@ -5307,15 +5347,15 @@ - - - - - - - - - + + + + + + + + + @@ -5347,15 +5387,15 @@ - - - - - - - - - + + + + + + + + + @@ -5387,15 +5427,15 @@ - - - - - - - - - + + + + + + + + + @@ -5427,15 +5467,15 @@ - - - - - - - - - + + + + + + + + + @@ -5467,15 +5507,15 @@ - - - - - - - - - + + + + + + + + + @@ -5507,15 +5547,15 @@ - - - - - - - - - + + + + + + + + + @@ -5547,15 +5587,15 @@ - - - - - - - - - + + + + + + + + + @@ -5587,15 +5627,15 @@ - - - - - - - - - + + + + + + + + + @@ -5625,19 +5665,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + MasterMap12 + + + + + + + MasterMap12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MasterMap13 + + + + + + + MasterMap13 + + + + + + + - + - - - - - - - - - + + + + + + + + + @@ -5655,7 +5775,7 @@ - + @@ -5691,15 +5811,15 @@ - - - - - - - - - + + + + + + + + + @@ -5717,7 +5837,7 @@ - + @@ -5753,15 +5873,15 @@ - - - - - - - - - + + + + + + + + + @@ -5779,7 +5899,7 @@ - + @@ -5816,6 +5936,6 @@ DS-401 master - + TestMaster diff -r f812bf6b7237 -r 905677ed00f3 examples/TestMasterSlave/TestSlave.c --- a/examples/TestMasterSlave/TestSlave.c Fri Jun 29 19:51:39 2007 +0200 +++ b/examples/TestMasterSlave/TestSlave.c Mon Jul 02 18:22:58 2007 +0200 @@ -18,6 +18,7 @@ UNS32 SlaveMap10 = 0x0; /* Mapped at index 0x2009, subindex 0x00 */ UNS16 SlaveMap11 = 0x0; /* Mapped at index 0x200A, subindex 0x00 */ INTEGER16 SlaveMap12 = 0x0; /* Mapped at index 0x200B, subindex 0x00 */ +INTEGER16 SlaveMap13 = 0x4D2; /* Mapped at index 0x200C, subindex 0x00 */ /**************************************************************************/ /* Declaration of the value range types */ @@ -34,7 +35,7 @@ /* The node id */ /**************************************************************************/ /* node_id default value.*/ -UNS8 TestSlave_bDeviceNodeId = 0x00; +UNS8 TestSlave_bDeviceNodeId = 0x02; /**************************************************************************/ /* Array of message processing information */ @@ -181,6 +182,15 @@ UNS16 TestSlave_obj1800_Inhibit_Time = 0x0; /* 0 */ UNS8 TestSlave_obj1800_Compatibility_Entry = 0x0; /* 0 */ UNS16 TestSlave_obj1800_Event_Timer = 0x0; /* 0 */ + ODCallback_t TestSlave_Index1800_callbacks[] = + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }; subindex TestSlave_Index1800[] = { { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1800 }, @@ -193,11 +203,20 @@ /* index 0x1801 : Transmit PDO 2 Parameter. */ UNS8 TestSlave_highestSubIndex_obj1801 = 5; /* number of subindex - 1*/ - UNS32 TestSlave_obj1801_COB_ID_used_by_PDO = 0x0; /* 0 */ + UNS32 TestSlave_obj1801_COB_ID_used_by_PDO = 0x282; /* 642 */ UNS8 TestSlave_obj1801_Transmission_Type = 0x0; /* 0 */ UNS16 TestSlave_obj1801_Inhibit_Time = 0x0; /* 0 */ UNS8 TestSlave_obj1801_Compatibility_Entry = 0x0; /* 0 */ UNS16 TestSlave_obj1801_Event_Timer = 0x0; /* 0 */ + ODCallback_t TestSlave_Index1801_callbacks[] = + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }; subindex TestSlave_Index1801[] = { { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1801 }, @@ -210,11 +229,20 @@ /* index 0x1802 : Transmit PDO 3 Parameter. */ UNS8 TestSlave_highestSubIndex_obj1802 = 5; /* number of subindex - 1*/ - UNS32 TestSlave_obj1802_COB_ID_used_by_PDO = 0x380; /* 896 */ + UNS32 TestSlave_obj1802_COB_ID_used_by_PDO = 0x382; /* 898 */ UNS8 TestSlave_obj1802_Transmission_Type = 0xFF; /* 255 */ UNS16 TestSlave_obj1802_Inhibit_Time = 0x1388; /* 5000 */ UNS8 TestSlave_obj1802_Compatibility_Entry = 0x0; /* 0 */ UNS16 TestSlave_obj1802_Event_Timer = 0x3E8; /* 1000 */ + ODCallback_t TestSlave_Index1802_callbacks[] = + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }; subindex TestSlave_Index1802[] = { { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1802 }, @@ -225,6 +253,58 @@ { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1802_Event_Timer } }; +/* index 0x1803 : Transmit PDO 4 Parameter. */ + UNS8 TestSlave_highestSubIndex_obj1803 = 5; /* number of subindex - 1*/ + UNS32 TestSlave_obj1803_COB_ID_used_by_PDO = 0x482; /* 1154 */ + UNS8 TestSlave_obj1803_Transmission_Type = 0xFC; /* 252 */ + UNS16 TestSlave_obj1803_Inhibit_Time = 0x0; /* 0 */ + UNS8 TestSlave_obj1803_Compatibility_Entry = 0x0; /* 0 */ + UNS16 TestSlave_obj1803_Event_Timer = 0x0; /* 0 */ + ODCallback_t TestSlave_Index1803_callbacks[] = + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }; + subindex TestSlave_Index1803[] = + { + { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1803 }, + { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1803_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1803_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1803_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1803_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1803_Event_Timer } + }; + +/* index 0x1804 : Transmit PDO 5 Parameter. */ + UNS8 TestSlave_highestSubIndex_obj1804 = 5; /* number of subindex - 1*/ + UNS32 TestSlave_obj1804_COB_ID_used_by_PDO = 0x401; /* 1025 */ + UNS8 TestSlave_obj1804_Transmission_Type = 0xFD; /* 253 */ + UNS16 TestSlave_obj1804_Inhibit_Time = 0x0; /* 0 */ + UNS8 TestSlave_obj1804_Compatibility_Entry = 0x0; /* 0 */ + UNS16 TestSlave_obj1804_Event_Timer = 0x0; /* 0 */ + ODCallback_t TestSlave_Index1804_callbacks[] = + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }; + subindex TestSlave_Index1804[] = + { + { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1804 }, + { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1804_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1804_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1804_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1804_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1804_Event_Timer } + }; + /* index 0x1A00 : Transmit PDO 1 Mapping. */ UNS8 TestSlave_highestSubIndex_obj1A00 = 10; /* number of subindex - 1*/ UNS32 TestSlave_obj1A00[] = @@ -279,6 +359,30 @@ { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A02[0] } }; +/* index 0x1A03 : Transmit PDO 4 Mapping. */ + UNS8 TestSlave_highestSubIndex_obj1A03 = 1; /* number of subindex - 1*/ + UNS32 TestSlave_obj1A03[] = + { + 0x200C0010 /* 537657360 */ + }; + subindex TestSlave_Index1A03[] = + { + { RW, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1A03 }, + { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A03[0] } + }; + +/* index 0x1A04 : Transmit PDO 5 Mapping. */ + UNS8 TestSlave_highestSubIndex_obj1A04 = 1; /* number of subindex - 1*/ + UNS32 TestSlave_obj1A04[] = + { + 0x200C0010 /* 537657360 */ + }; + subindex TestSlave_Index1A04[] = + { + { RW, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1A04 }, + { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A04[0] } + }; + /* index 0x2000 : Mapped variable SlaveMap1 */ subindex TestSlave_Index2000[] = { @@ -351,6 +455,12 @@ { RW, int16, sizeof (INTEGER16), (void*)&SlaveMap12 } }; +/* index 0x200C : Mapped variable SlaveMap13 */ + subindex TestSlave_Index200C[] = + { + { RW, int16, sizeof (INTEGER16), (void*)&SlaveMap13 } + }; + const indextable TestSlave_objdict[] = { { (subindex*)TestSlave_Index1000,sizeof(TestSlave_Index1000)/sizeof(TestSlave_Index1000[0]), 0x1000}, @@ -365,9 +475,13 @@ { (subindex*)TestSlave_Index1800,sizeof(TestSlave_Index1800)/sizeof(TestSlave_Index1800[0]), 0x1800}, { (subindex*)TestSlave_Index1801,sizeof(TestSlave_Index1801)/sizeof(TestSlave_Index1801[0]), 0x1801}, { (subindex*)TestSlave_Index1802,sizeof(TestSlave_Index1802)/sizeof(TestSlave_Index1802[0]), 0x1802}, + { (subindex*)TestSlave_Index1803,sizeof(TestSlave_Index1803)/sizeof(TestSlave_Index1803[0]), 0x1803}, + { (subindex*)TestSlave_Index1804,sizeof(TestSlave_Index1804)/sizeof(TestSlave_Index1804[0]), 0x1804}, { (subindex*)TestSlave_Index1A00,sizeof(TestSlave_Index1A00)/sizeof(TestSlave_Index1A00[0]), 0x1A00}, { (subindex*)TestSlave_Index1A01,sizeof(TestSlave_Index1A01)/sizeof(TestSlave_Index1A01[0]), 0x1A01}, { (subindex*)TestSlave_Index1A02,sizeof(TestSlave_Index1A02)/sizeof(TestSlave_Index1A02[0]), 0x1A02}, + { (subindex*)TestSlave_Index1A03,sizeof(TestSlave_Index1A03)/sizeof(TestSlave_Index1A03[0]), 0x1A03}, + { (subindex*)TestSlave_Index1A04,sizeof(TestSlave_Index1A04)/sizeof(TestSlave_Index1A04[0]), 0x1A04}, { (subindex*)TestSlave_Index2000,sizeof(TestSlave_Index2000)/sizeof(TestSlave_Index2000[0]), 0x2000}, { (subindex*)TestSlave_Index2001,sizeof(TestSlave_Index2001)/sizeof(TestSlave_Index2001[0]), 0x2001}, { (subindex*)TestSlave_Index2002,sizeof(TestSlave_Index2002)/sizeof(TestSlave_Index2002[0]), 0x2002}, @@ -380,6 +494,7 @@ { (subindex*)TestSlave_Index2009,sizeof(TestSlave_Index2009)/sizeof(TestSlave_Index2009[0]), 0x2009}, { (subindex*)TestSlave_Index200A,sizeof(TestSlave_Index200A)/sizeof(TestSlave_Index200A[0]), 0x200A}, { (subindex*)TestSlave_Index200B,sizeof(TestSlave_Index200B)/sizeof(TestSlave_Index200B[0]), 0x200B}, + { (subindex*)TestSlave_Index200C,sizeof(TestSlave_Index200C)/sizeof(TestSlave_Index200C[0]), 0x200C}, }; const indextable * TestSlave_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks) @@ -396,24 +511,29 @@ case 0x1017: i = 6;*callbacks = TestSlave_Index1017_callbacks; break; case 0x1018: i = 7;break; case 0x1200: i = 8;break; - case 0x1800: i = 9;break; - case 0x1801: i = 10;break; - case 0x1802: i = 11;break; - case 0x1A00: i = 12;break; - case 0x1A01: i = 13;break; - case 0x1A02: i = 14;break; - case 0x2000: i = 15;break; - case 0x2001: i = 16;break; - case 0x2002: i = 17;break; - case 0x2003: i = 18;break; - case 0x2004: i = 19;break; - case 0x2005: i = 20;break; - case 0x2006: i = 21;break; - case 0x2007: i = 22;break; - case 0x2008: i = 23;break; - case 0x2009: i = 24;break; - case 0x200A: i = 25;break; - case 0x200B: i = 26;break; + case 0x1800: i = 9;*callbacks = TestSlave_Index1800_callbacks; break; + case 0x1801: i = 10;*callbacks = TestSlave_Index1801_callbacks; break; + case 0x1802: i = 11;*callbacks = TestSlave_Index1802_callbacks; break; + case 0x1803: i = 12;*callbacks = TestSlave_Index1803_callbacks; break; + case 0x1804: i = 13;*callbacks = TestSlave_Index1804_callbacks; break; + case 0x1A00: i = 14;break; + case 0x1A01: i = 15;break; + case 0x1A02: i = 16;break; + case 0x1A03: i = 17;break; + case 0x1A04: i = 18;break; + case 0x2000: i = 19;break; + case 0x2001: i = 20;break; + case 0x2002: i = 21;break; + case 0x2003: i = 22;break; + case 0x2004: i = 23;break; + case 0x2005: i = 24;break; + case 0x2006: i = 25;break; + case 0x2007: i = 26;break; + case 0x2008: i = 27;break; + case 0x2009: i = 28;break; + case 0x200A: i = 29;break; + case 0x200B: i = 30;break; + case 0x200C: i = 31;break; default: *errorCode = OD_NO_SUCH_OBJECT; return NULL; @@ -427,7 +547,7 @@ * Even if no pdoTransmit are defined, at least one entry is computed * for compilations issues. */ -s_PDO_status TestSlave_PDO_status[3] = {s_PDO_staus_Initializer,s_PDO_staus_Initializer,s_PDO_staus_Initializer}; +s_PDO_status TestSlave_PDO_status[5] = {s_PDO_staus_Initializer,s_PDO_staus_Initializer,s_PDO_staus_Initializer,s_PDO_staus_Initializer,s_PDO_staus_Initializer}; quick_index TestSlave_firstIndex = { 8, /* SDO_SVR */ @@ -435,7 +555,7 @@ 0, /* PDO_RCV */ 0, /* PDO_RCV_MAP */ 9, /* PDO_TRS */ - 12 /* PDO_TRS_MAP */ + 14 /* PDO_TRS_MAP */ }; quick_index TestSlave_lastIndex = { @@ -443,8 +563,8 @@ 0, /* SDO_CLT */ 0, /* PDO_RCV */ 0, /* PDO_RCV_MAP */ - 11, /* PDO_TRS */ - 14 /* PDO_TRS_MAP */ + 13, /* PDO_TRS */ + 18 /* PDO_TRS_MAP */ }; UNS16 TestSlave_ObjdictSize = sizeof(TestSlave_objdict)/sizeof(TestSlave_objdict[0]); diff -r f812bf6b7237 -r 905677ed00f3 examples/TestMasterSlave/TestSlave.h --- a/examples/TestMasterSlave/TestSlave.h Fri Jun 29 19:51:39 2007 +0200 +++ b/examples/TestMasterSlave/TestSlave.h Mon Jul 02 18:22:58 2007 +0200 @@ -14,6 +14,11 @@ extern CO_Data TestSlave_Data; extern ODCallback_t Store_parameters_callbacks[]; /* Callbacks of index0x1010 */ extern ODCallback_t Restore_Default_Parameters_callbacks[]; /* Callbacks of index0x1011 */ +extern ODCallback_t Transmit_PDO_1_Parameter_callbacks[]; /* Callbacks of index0x1800 */ +extern ODCallback_t Transmit_PDO_2_Parameter_callbacks[]; /* Callbacks of index0x1801 */ +extern ODCallback_t Transmit_PDO_3_Parameter_callbacks[]; /* Callbacks of index0x1802 */ +extern ODCallback_t Transmit_PDO_4_Parameter_callbacks[]; /* Callbacks of index0x1803 */ +extern ODCallback_t Transmit_PDO_5_Parameter_callbacks[]; /* Callbacks of index0x1804 */ extern UNS8 SlaveMap1; /* Mapped at index 0x2000, subindex 0x00*/ extern UNS8 SlaveMap2; /* Mapped at index 0x2001, subindex 0x00*/ extern UNS8 SlaveMap3; /* Mapped at index 0x2002, subindex 0x00*/ @@ -26,5 +31,6 @@ extern UNS32 SlaveMap10; /* Mapped at index 0x2009, subindex 0x00*/ extern UNS16 SlaveMap11; /* Mapped at index 0x200A, subindex 0x00*/ extern INTEGER16 SlaveMap12; /* Mapped at index 0x200B, subindex 0x00*/ +extern INTEGER16 SlaveMap13; /* Mapped at index 0x200C, subindex 0x00*/ #endif // TESTSLAVE_H diff -r f812bf6b7237 -r 905677ed00f3 examples/TestMasterSlave/TestSlave.od --- a/examples/TestMasterSlave/TestSlave.od Fri Jun 29 19:51:39 2007 +0200 +++ b/examples/TestMasterSlave/TestSlave.od Mon Jul 02 18:22:58 2007 +0200 @@ -1,10 +1,10 @@ - - + + - - +TestSlave + @@ -54,8 +54,12 @@ + + + + - + @@ -65,7 +69,7 @@ - + @@ -74,7 +78,7 @@ - + @@ -83,13 +87,23 @@ - + + + + + + + + + + + - + @@ -100,8 +114,18 @@ - - + + + + + + + + + + + + @@ -120,22 +144,34 @@ + + + + + + - - - - - - + + + + + + + + + + + + - + @@ -150,8 +186,8 @@ - - + + @@ -160,17 +196,17 @@ - + - + - + - + @@ -179,10 +215,10 @@ - + - + @@ -191,7 +227,7 @@ - + @@ -202,10 +238,19 @@ - + + + + + + + EVENT + + + - + 5000*100 µC = 500 ms @@ -214,16 +259,16 @@ - + - + - + 1000 ms @@ -233,8 +278,36 @@ + + + + + + + + RTR_SYNC + + + + + + + + + + + + + + RTR + + + + + + - + @@ -243,7 +316,7 @@ - + @@ -252,7 +325,7 @@ - + @@ -260,18 +333,18 @@ - + - - - - - - - - - + + + + + + + + + @@ -303,15 +376,15 @@ - - - - - - - - - + + + + + + + + + @@ -343,15 +416,15 @@ - - - - - - - - - + + + + + + + + + @@ -383,15 +456,15 @@ - - - - - - - - - + + + + + + + + + @@ -423,15 +496,15 @@ - - - - - - - - - + + + + + + + + + @@ -463,15 +536,15 @@ - - - - - - - - - + + + + + + + + + @@ -503,15 +576,15 @@ - - - - - - - - - + + + + + + + + + @@ -543,15 +616,15 @@ - - - - - - - - - + + + + + + + + + @@ -583,15 +656,15 @@ - - - - - - - - - + + + + + + + + + @@ -623,15 +696,15 @@ - - - - - - - - - + + + + + + + + + @@ -663,15 +736,15 @@ - - - - - - - - - + + + + + + + + + @@ -703,15 +776,15 @@ - - - - - - - - - + + + + + + + + + @@ -741,10 +814,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + SlaveMap13 + + + + + + + SlaveMap13 + + + + + + + - + - - +slave + + diff -r f812bf6b7237 -r 905677ed00f3 include/pdo.h --- a/include/pdo.h Fri Jun 29 19:51:39 2007 +0200 +++ b/include/pdo.h Mon Jul 02 18:22:58 2007 +0200 @@ -34,6 +34,7 @@ /* Status of the TPDO : */ #define PDO_INHIBITED 0x01 +#define PDO_RTR_SYNC_READY 0x01 /** The PDO structure */ struct struct_s_PDO_status { @@ -72,7 +73,7 @@ * bus_id is hardware dependant * Returns 0xFF if error, other in success. */ -UNS8 sendPDOrequest (CO_Data* d, UNS32 cobId); +UNS8 sendPDOrequest( CO_Data* d, UNS16 RPDOIndex ); /** Compute a PDO frame reception * bus_id is hardware dependant diff -r f812bf6b7237 -r 905677ed00f3 objdictgen/node.py --- a/objdictgen/node.py Fri Jun 29 19:51:39 2007 +0200 +++ b/objdictgen/node.py Mon Jul 02 18:22:58 2007 +0200 @@ -213,7 +213,7 @@ 0x1600 : {"name" : "Receive PDO %d Mapping[(idx)]", "struct" : plurirec, "incr" : 1, "nbmax" : 0x200, "need" : False, "values" : [{"name" : "Number of Entries", "type" : 0x05, "access" : 'rw', "pdo" : False}, {"name" : "PDO %d Mapping for an application object %d[(idx,sub)]", "type" : 0x07, "access" : 'rw', "pdo" : False, "nbmax" : 0x40}]}, - 0x1800 : {"name" : "Transmit PDO %d Parameter[(idx)]", "struct" : pluriarray, "incr" : 1, "nbmax" : 0x200, "need" : False, "values" : + 0x1800 : {"name" : "Transmit PDO %d Parameter[(idx)]", "struct" : pluriarray, "incr" : 1, "nbmax" : 0x200, "need" : False, "callback" : True, "values" : [{"name" : "Highest SubIndex Supported", "type" : 0x05, "access" : 'ro', "pdo" : False}, {"name" : "COB ID used by PDO", "type" : 0x07, "access" : 'rw', "pdo" : False, "default" : "{True:self.ID+(base+1)*0x100+0x80,False:0}[base<4]"}, {"name" : "Transmission Type", "type" : 0x05, "access" : 'rw', "pdo" : False}, diff -r f812bf6b7237 -r 905677ed00f3 src/pdo.c --- a/src/pdo.c Fri Jun 29 19:51:39 2007 +0200 +++ b/src/pdo.c Mon Jul 02 18:22:58 2007 +0200 @@ -54,7 +54,7 @@ UNS8 offset = 0x00; const UNS8* pMappingCount = (UNS8*) TPDO_map->pSubindex[0].pObject; - pdo->cob_id.w = *(UNS32*)TPDO_com->pSubindex[1].pObject; + pdo->cob_id.w = *(UNS32*)TPDO_com->pSubindex[1].pObject & 0x7FF; pdo->rtr = NOT_A_REQUEST; MSG_WAR(0x3009, " PDO CobId is : ", *(UNS32*)TPDO_com->pSubindex[1].pObject); @@ -101,31 +101,31 @@ ** ** @return **/ -UNS8 sendPDOrequest( CO_Data* d, UNS32 cobId ) +UNS8 sendPDOrequest( CO_Data* d, UNS16 RPDOIndex ) { UNS32 * pwCobId; - UNS16 offset; - UNS16 lastIndex; - UNS8 err; - - MSG_WAR(0x3930, "sendPDOrequest ",0); + UNS16 offset = d->firstIndex->PDO_RCV; + UNS16 lastIndex = d->lastIndex->PDO_RCV; + /* Sending the request only if the cobid have been found on the PDO receive */ /* part dictionary */ - offset = d->firstIndex->PDO_RCV; - lastIndex = d->lastIndex->PDO_RCV; - if (offset) - while (offset <= lastIndex) { + + MSG_WAR(0x3930, "sendPDOrequest RPDO Index : ",RPDOIndex); + + if (offset && RPDOIndex >= 0x1400){ + offset += RPDOIndex - 0x1400; + if (offset <= lastIndex) { /* get the CobId*/ pwCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject; - if ( *pwCobId == cobId ) { - Message pdo = {*pwCobId, REQUEST, 0}; - return canSend(d->canHandle,&pdo); - } - offset++; + MSG_WAR(0x3930, "sendPDOrequest cobId is : ",*pwCobId); + + Message pdo = {*pwCobId, REQUEST, 0}; + return canSend(d->canHandle,&pdo); } - MSG_WAR(0x1931, "sendPDOrequest : COBID not found : ", cobId); + } + MSG_ERR(0x1931, "sendPDOrequest : RPDO Index not found : ", RPDOIndex); return 0xFF; } @@ -283,12 +283,25 @@ break; - case state4:/* check transmission type (after request?) */ + case state4:/* check transmission type */ pTransmissionType = (UNS8*) d->objdict[offsetObjdict].pSubindex[2].pObject; - if ( (*pTransmissionType == TRANS_RTR) || - (*pTransmissionType == TRANS_RTR_SYNC )) { + /* If PDO is to be sampled and send on RTR, do it*/ + if ( (*pTransmissionType == TRANS_RTR)) { status = state5; break; + /* RTR_SYNC mean data is prepared at SYNC, and transmitted on RTR */ + }else if ((*pTransmissionType == TRANS_RTR_SYNC )) { + if(d->PDO_status[numPdo].transmit_type_parameter & PDO_RTR_SYNC_READY){ + /*Data ready, just send*/ + canSend(d->canHandle,&d->PDO_status[numPdo].last_message); + return 0; + }else{ + /* if SYNC did never occur, force emission with current data */ + /* DS301 do not tell what to do in such a case...*/ + MSG_ERR(0x1947, "Not ready RTR_SYNC TPDO send current data : ", m->cob_id.w); + status = state5; + } + break; }else if( (*pTransmissionType == TRANS_EVENT_PROFILE) || (*pTransmissionType == TRANS_EVENT_SPECIFIC) ) { @@ -311,8 +324,8 @@ Message pdo; if( buildPDO(d, numPdo, &pdo)) { - MSG_ERR(0x1013, " Couldn't find mapped variable at index-subindex-size : ", (UNS16)(*pMappingParameter)); - //return 0xFF; /*No real reason to stop...*/ + MSG_ERR(0x1948, " Couldn't build TPDO n°", numPdo); + return 0xFF; } canSend(d->canHandle,&pdo); return 0; @@ -401,8 +414,6 @@ void PDOEventTimerAlarm(CO_Data* d, UNS32 pdoNum) { - printf("EV PDOEventTimerAlarm : %d\n", pdoNum); - /* This is needed to avoid deletion of re-attribuated timer */ d->PDO_status[pdoNum].event_timer = TIMER_NONE; /* force emission of PDO by artificially changing last emitted*/ @@ -412,8 +423,6 @@ void PDOInhibitTimerAlarm(CO_Data* d, UNS32 pdoNum) { - printf("EV PDOInhibitTimerAlarm : %d\n", pdoNum); - /* This is needed to avoid deletion of re-attribuated timer */ d->PDO_status[pdoNum].inhibit_timer = TIMER_NONE; /* Remove inhibit flag */ @@ -441,44 +450,60 @@ /* study all PDO stored in the objects dictionary */ if(offsetObjdict){ - Message clean = Message_Initializer; Message pdo = Message_Initializer; while( offsetObjdict <= lastIndex) { switch( status ) { - case state3: /* get the PDO transmission type */ - if (d->objdict[offsetObjdict].bSubCount <= 2) { - MSG_ERR(0x1004, "Subindex 2 not found at index ", 0x1800 + pdoNum); - return 0xFF; + case state3: + if (/*d->objdict[offsetObjdict].bSubCount < 5 || not necessary with objdictedit (always 5)*/ + /* check if TPDO is not valid */ + *(UNS32*)d->objdict[offsetObjdict].pSubindex[0].pObject & 0x8000) { + MSG_WAR(0x3960, "Not a valid PDO ", 0x1800 + pdoNum); + /*Go next TPDO*/ + status = state11; + break; } + /* get the PDO transmission type */ pTransmissionType = (UNS8*) d->objdict[offsetObjdict].pSubindex[2].pObject; - MSG_WAR(0x3005, "Reading PDO at index : ", 0x1800 + pdoNum); - - /* check if transmission type is after (this) SYNC */ - /* The message may not be transmited every SYNC but every n SYNC */ + MSG_WAR(0x3962, "Reading PDO at index : ", 0x1800 + pdoNum); + + /* check if transmission type is SYNCRONOUS */ + /* The message is transmited every n SYNC with n=TransmissionType */ if( isSyncEvent && (*pTransmissionType >= TRANS_SYNC_MIN) && (*pTransmissionType <= TRANS_SYNC_MAX) && - (++d->PDO_status[pdoNum].transmit_type_parameter == *pTransmissionType) ) { + (++d->PDO_status[pdoNum].transmit_type_parameter == *pTransmissionType) ) { + /*Reset count of SYNC*/ d->PDO_status[pdoNum].transmit_type_parameter = 0; - MSG_WAR(0x3007, " PDO is on SYNCHRO. Trans type : ", *pTransmissionType); - pdo = clean; + MSG_WAR(0x3964, " PDO is on SYNCHRO. Trans type : ", *pTransmissionType); + pdo = (Message)Message_Initializer; if(buildPDO(d, pdoNum, &pdo)) { - MSG_ERR(0x3006, " Couldn't build TPDO number : ", pdoNum); + MSG_ERR(0x1906, " Couldn't build TPDO number : ", pdoNum); status = state11; break; } status = state5; - } + /* If transmission RTR, with data sampled on SYNC */ + }else if( isSyncEvent && + (*pTransmissionType == TRANS_RTR_SYNC)) { + if(buildPDO(d, pdoNum, &d->PDO_status[pdoNum].last_message)) + { + MSG_ERR(0x1966, " Couldn't build TPDO number : ", pdoNum); + d->PDO_status[pdoNum].transmit_type_parameter &= ~PDO_RTR_SYNC_READY; + }else{ + d->PDO_status[pdoNum].transmit_type_parameter |= PDO_RTR_SYNC_READY; + } + status = state11; + break; /* If transmission on Event and not inhibited, check for changes */ - else if((*pTransmissionType == TRANS_EVENT_PROFILE || + }else if((*pTransmissionType == TRANS_EVENT_PROFILE || *pTransmissionType == TRANS_EVENT_SPECIFIC )&& !(d->PDO_status[pdoNum].transmit_type_parameter & PDO_INHIBITED)) { - MSG_WAR(0x3008, " PDO is on EVENT. Trans type : ", *pTransmissionType); - pdo = pdo = clean; + MSG_WAR(0x3968, " PDO is on EVENT. Trans type : ", *pTransmissionType); + pdo = (Message)Message_Initializer; if(buildPDO(d, pdoNum, &pdo)) { - MSG_ERR(0x3007, " Couldn't build TPDO number : ", pdoNum); + MSG_ERR(0x3907, " Couldn't build TPDO number : ", pdoNum); status = state11; break; } @@ -490,8 +515,7 @@ /* No changes -> go to next pdo*/ status = state11; }else{ - MSG_WAR(0x3008, "Changes TPDO number : ", pdoNum); - printf("EV Changes TPDO number : %d\n", pdoNum); + MSG_WAR(0x306A, "Changes TPDO number : ", pdoNum); /* Changes detected -> transmit message */ status = state5; @@ -506,19 +530,15 @@ d->PDO_status[pdoNum].transmit_type_parameter |= PDO_INHIBITED; } }else{ - MSG_WAR(0x3009, " PDO is not on EVENT or synchro or not at this SYNC. Trans type : ", *pTransmissionType); + MSG_WAR(0x306C, " PDO is not on EVENT or synchro or not at this SYNC. Trans type : ", *pTransmissionType); status = state11; } break; case state5: /*Send the pdo*/ /*store_as_last_message*/ d->PDO_status[pdoNum].last_message = pdo; - MSG_WAR(0x3901, "sendPDO cobId :", pdo.cob_id.w); - MSG_WAR(0x3902, " Nb octets : ", pdo.len); - {int i; - for (i = 0 ; i < pdo.len ; i++) { - MSG_WAR(0x3903," data : ", pdo.data[i]); - }} + MSG_WAR(0x396D, "sendPDO cobId :", pdo.cob_id.w); + MSG_WAR(0x396E, " Nb octets : ", pdo.len); canSend(d->canHandle,&pdo); status = state11; @@ -527,12 +547,12 @@ pdoNum++; offsetObjdict++; offsetObjdictMap++; - MSG_WAR(0x3017, "next pdo index : ", pdoNum); + MSG_WAR(0x3970, "next pdo index : ", pdoNum); status = state3; break; default: - MSG_ERR(0x1019,"Unknown state has been reached : %d",status); + MSG_ERR(0x1972,"Unknown state has been reached : %d",status); return 0xFF; }/* end switch case */ @@ -541,31 +561,85 @@ return 0; } +/*! +** +** +** @param d +** @param OD_entry +** @param bSubindex +** @return always 0 +**/ + +UNS32 TPDO_Communication_Parameter_Callback(CO_Data* d, const indextable * OD_entry, UNS8 bSubindex) +{ + /* If PDO are actives */ + if(d->CurrentCommunicationState.csPDO) switch(bSubindex) + { + case 2: /* Changed transmition type */ + case 3: /* Changed inhibit time */ + case 5: /* Changed event time */ + { + UNS8 pTransmissionType = *(UNS8*) OD_entry->pSubindex[2].pObject; + const indextable* TPDO_com = d->objdict + d->firstIndex->PDO_TRS; + UNS8 numPdo = OD_entry - TPDO_com; /* number of the actual processed pdo-nr. */ + + /* Zap all timers and inhibit flag */ + d->PDO_status[numPdo].event_timer = DelAlarm(d->PDO_status[numPdo].event_timer); + d->PDO_status[numPdo].inhibit_timer = DelAlarm(d->PDO_status[numPdo].inhibit_timer); + d->PDO_status[numPdo].transmit_type_parameter = 0; + /* Call PDOEventTimerAlarm for this TPDO, this will trigger emission et reset timers */ + PDOEventTimerAlarm(d, numPdo); + return 0; + } + + default: /* other subindex are ignored*/ + break; + } + return 0; +} + void PDOInit(CO_Data* d) { - - /* TODO: implement callbacks on 140xh - * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx - * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx - * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx - * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx - * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx - * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx - * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx - * XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx - */ - - _sendPDOevent(d, 0 ); + /* For each TPDO mapping parameters */ + UNS16 pdoIndex = 0x1800; /* OD index of TDPO */ + + UNS16 offsetObjdict = d->firstIndex->PDO_TRS; + UNS16 lastIndex = d->lastIndex->PDO_TRS; + if(offsetObjdict) while( offsetObjdict <= lastIndex) { + /* Assign callbacks to sensible TPDO mapping subindexes */ + UNS32 errorCode; + ODCallback_t *CallbackList; + /* Find callback list */ + scanIndexOD (d, pdoIndex, &errorCode, &CallbackList); + if(errorCode == OD_SUCCESSFUL && CallbackList) + { + /*Assign callbacks to corresponding subindex*/ + /* Transmission type */ + CallbackList[2] = &TPDO_Communication_Parameter_Callback; + /* Inhibit time */ + CallbackList[3] = &TPDO_Communication_Parameter_Callback; + /* Event timer */ + CallbackList[5] = &TPDO_Communication_Parameter_Callback; + } + pdoIndex++; + offsetObjdict++; + } + + /* Trigger a non-sync event */ + _sendPDOevent( d, 0 ); } void PDOStop(CO_Data* d) { + /* For each TPDO mapping parameters */ UNS8 pdoNum = 0x00; /* number of the actual processed pdo-nr. */ UNS16 offsetObjdict = d->firstIndex->PDO_TRS; UNS16 lastIndex = d->lastIndex->PDO_TRS; if(offsetObjdict) while( offsetObjdict <= lastIndex) { + /* Delete TPDO timers */ d->PDO_status[pdoNum].event_timer = DelAlarm(d->PDO_status[pdoNum].event_timer); d->PDO_status[pdoNum].inhibit_timer = DelAlarm(d->PDO_status[pdoNum].inhibit_timer); + /* Reset transmit type parameter */ d->PDO_status[pdoNum].transmit_type_parameter = 0; d->PDO_status[pdoNum].last_message.cob_id.w = 0; pdoNum++; diff -r f812bf6b7237 -r 905677ed00f3 src/states.c --- a/src/states.c Fri Jun 29 19:51:39 2007 +0200 +++ b/src/states.c Mon Jul 02 18:22:58 2007 +0200 @@ -258,7 +258,7 @@ UNS16 lastIndex = d->lastIndex->PDO_RCV; UNS32 cobID[] = {0x200, 0x300, 0x400, 0x500}; if( offset ) while( (offset <= lastIndex) && (i < 4)) { - //if(*(UNS32*)d->objdict[offset].pSubindex[1].pObject == cobID[i] + *d->bDeviceNodeId) + if(*(UNS32*)d->objdict[offset].pSubindex[1].pObject == cobID[i] + *d->bDeviceNodeId) *(UNS32*)d->objdict[offset].pSubindex[1].pObject = cobID[i] + nodeId; i ++; offset ++; @@ -272,7 +272,7 @@ UNS32 cobID[] = {0x180, 0x280, 0x380, 0x480}; i = 0; if( offset ) while ((offset <= lastIndex) && (i < 4)) { - //if(*(UNS32*)d->objdict[offset].pSubindex[1].pObject == cobID[i] + *d->bDeviceNodeId) + if(*(UNS32*)d->objdict[offset].pSubindex[1].pObject == cobID[i] + *d->bDeviceNodeId) *(UNS32*)d->objdict[offset].pSubindex[1].pObject = cobID[i] + nodeId; i ++; offset ++; diff -r f812bf6b7237 -r 905677ed00f3 src/sync.c --- a/src/sync.c Fri Jun 29 19:51:39 2007 +0200 +++ b/src/sync.c Mon Jul 02 18:22:58 2007 +0200 @@ -148,7 +148,7 @@ (*d->post_sync)(); /* only operational state allows PDO transmission */ - if( d->nodeState != Operational ) + if(! d->CurrentCommunicationState.csPDO) return 0; res = _sendPDOevent(d, 1 /*isSyncEvent*/ );