SetODEntry now call CO_data->storeODSubEntry(Index,SubIndex) for variables to be Stored (when column Save==True in GUI)
--- a/examples/TestMasterSlave/Slave.c Sun Apr 15 00:46:40 2007 +0200
+++ b/examples/TestMasterSlave/Slave.c Sun Apr 15 00:49:34 2007 +0200
@@ -70,3 +70,17 @@
{
eprintf("TestSlave_post_TPDO\n");
}
+
+void TestSlave_storeODSubIndex(UNS16 wIndex, UNS8 bSubindex)
+{
+ /*TODO :
+ * - call getODEntry for index and subindex,
+ * - save content to file, database, flash, nvram, ...
+ *
+ * To ease flash organisation, index of variable to store
+ * can be established by scanning d->objdict[d->ObjdictSize]
+ * for variables to store.
+ *
+ * */
+ eprintf("TestSlave_storeODSubIndex : %4.4x %2.2x\n", wIndex, bSubindex);
+}
--- a/examples/TestMasterSlave/TestMasterSlave.c Sun Apr 15 00:46:40 2007 +0200
+++ b/examples/TestMasterSlave/TestMasterSlave.c Sun Apr 15 00:49:34 2007 +0200
@@ -199,6 +199,7 @@
TestSlave_Data.stopped = TestSlave_stopped;
TestSlave_Data.post_sync = TestSlave_post_sync;
TestSlave_Data.post_TPDO = TestSlave_post_TPDO;
+ TestSlave_Data.storeODSubIndex = TestSlave_storeODSubIndex;
if(!canOpen(&SlaveBoard,&TestSlave_Data)){
eprintf("Cannot open Slave Board (%s,%s)\n",SlaveBoard.busname, SlaveBoard.baudrate);
--- a/examples/TestMasterSlave/TestSlave.c Sun Apr 15 00:46:40 2007 +0200
+++ b/examples/TestMasterSlave/TestSlave.c Sun Apr 15 00:49:34 2007 +0200
@@ -173,8 +173,8 @@
{
{ RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1800 },
{ RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1800_COB_ID_used_by_PDO },
- { RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1800_Transmission_Type },
- { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Inhibit_Time },
+ { RW|TO_BE_SAVE, uint8, sizeof (UNS8), (void*)&TestSlave_obj1800_Transmission_Type },
+ { RW|TO_BE_SAVE, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Inhibit_Time },
{ RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Compatibility_Entry },
{ RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Event_Timer }
};
--- a/examples/TestMasterSlave/TestSlave.od Sun Apr 15 00:46:40 2007 +0200
+++ b/examples/TestMasterSlave/TestSlave.od Sun Apr 15 00:49:34 2007 +0200
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE PyObject SYSTEM "PyObjects.dtd">
-<PyObject module="node" class="Node" id="19120640">
-<attr name="Profile" type="dict" id="19883904" >
+<PyObject module="node" class="Node" id="17963560">
+<attr name="Profile" type="dict" id="18771104" >
</attr>
<attr name="Name" type="string" value="TestSlave" />
-<attr name="Dictionary" type="dict" id="19884976" >
+<attr name="Dictionary" type="dict" id="18772176" >
<entry>
<key type="numeric" value="4096" />
<val type="numeric" value="301" />
@@ -35,7 +35,7 @@
</entry>
<entry>
<key type="numeric" value="6145" />
- <val type="list" id="16937976" >
+ <val type="list" id="16025432" >
<item type="numeric" value="642" />
<item type="numeric" value="0" />
<item type="numeric" value="0" />
@@ -49,7 +49,7 @@
</entry>
<entry>
<key type="numeric" value="4112" />
- <val type="list" id="19124376" >
+ <val type="list" id="17967080" >
<item type="numeric" value="0" />
<item type="numeric" value="0" />
<item type="numeric" value="0" />
@@ -58,7 +58,7 @@
</entry>
<entry>
<key type="numeric" value="4113" />
- <val type="list" id="19124304" >
+ <val type="list" id="17967008" >
<item type="numeric" value="0" />
<item type="numeric" value="0" />
<item type="numeric" value="0" />
@@ -67,21 +67,21 @@
</entry>
<entry>
<key type="numeric" value="6657" />
- <val type="list" id="16938120" >
+ <val type="list" id="17966648" >
<item type="numeric" value="537001992" />
<item type="numeric" value="537067528" />
</val>
</entry>
<entry>
<key type="numeric" value="6656" />
- <val type="list" id="19119784" >
+ <val type="list" id="17966288" >
<item type="numeric" value="536870920" />
<item type="numeric" value="536936456" />
</val>
</entry>
<entry>
<key type="numeric" value="4608" />
- <val type="list" id="19124448" >
+ <val type="list" id="17967152" >
<item type="numeric" value="1537" />
<item type="numeric" value="1409" />
</val>
@@ -92,7 +92,7 @@
</entry>
<entry>
<key type="numeric" value="4120" />
- <val type="list" id="19119568" >
+ <val type="list" id="17966864" >
<item type="numeric" value="0" />
<item type="numeric" value="0" />
<item type="numeric" value="0" />
@@ -101,7 +101,7 @@
</entry>
<entry>
<key type="numeric" value="6144" />
- <val type="list" id="19118776" >
+ <val type="list" id="17965784" >
<item type="numeric" value="386" />
<item type="numeric" value="0" />
<item type="numeric" value="0" />
@@ -110,12 +110,12 @@
</val>
</entry>
</attr>
-<attr name="SpecificMenu" type="list" id="19118704" >
-</attr>
-<attr name="ParamsDictionary" type="dict" id="19886496" >
+<attr name="SpecificMenu" type="list" id="17966792" >
+</attr>
+<attr name="ParamsDictionary" type="dict" id="18773248" >
<entry>
<key type="numeric" value="8192" />
- <val type="dict" id="19886784" >
+ <val type="dict" id="18773536" >
<entry>
<key type="string" value="callback" />
<val type="False" value="" />
@@ -124,7 +124,7 @@
</entry>
<entry>
<key type="numeric" value="4112" />
- <val type="dict" id="19884192" >
+ <val type="dict" id="18771392" >
<entry>
<key type="string" value="callback" />
<val type="True" value="" />
@@ -132,8 +132,31 @@
</val>
</entry>
<entry>
+ <key type="numeric" value="6144" />
+ <val type="dict" id="18771680" >
+ <entry>
+ <key type="numeric" value="2" />
+ <val type="dict" id="18776912" >
+ <entry>
+ <key type="string" value="save" />
+ <val type="True" value="" />
+ </entry>
+ </val>
+ </entry>
+ <entry>
+ <key type="numeric" value="3" />
+ <val type="dict" id="18951264" >
+ <entry>
+ <key type="string" value="save" />
+ <val type="True" value="" />
+ </entry>
+ </val>
+ </entry>
+ </val>
+ </entry>
+ <entry>
<key type="numeric" value="4113" />
- <val type="dict" id="19884480" >
+ <val type="dict" id="18777200" >
<entry>
<key type="string" value="callback" />
<val type="True" value="" />
@@ -141,18 +164,18 @@
</val>
</entry>
</attr>
-<attr name="UserMapping" type="dict" id="19890160" >
+<attr name="UserMapping" type="dict" id="18777488" >
<entry>
<key type="numeric" value="8192" />
- <val type="dict" id="19890448" >
+ <val type="dict" id="18777776" >
<entry>
<key type="string" value="need" />
<val type="False" value="" />
</entry>
<entry>
<key type="string" value="values" />
- <val type="list" id="19119856" >
- <item type="dict" id="19890736" >
+ <val type="list" id="17966720" >
+ <item type="dict" id="18778064" >
<entry>
<key type="string" value="access" />
<val type="string" value="rw" />
@@ -184,15 +207,15 @@
</entry>
<entry>
<key type="numeric" value="8193" />
- <val type="dict" id="19891024" >
+ <val type="dict" id="18778352" >
<entry>
<key type="string" value="need" />
<val type="False" value="" />
</entry>
<entry>
<key type="string" value="values" />
- <val type="list" id="19124664" >
- <item type="dict" id="19891312" >
+ <val type="list" id="17967368" >
+ <item type="dict" id="18778640" >
<entry>
<key type="string" value="access" />
<val type="string" value="rw" />
@@ -224,15 +247,15 @@
</entry>
<entry>
<key type="numeric" value="8194" />
- <val type="dict" id="19891600" >
+ <val type="dict" id="18778928" >
<entry>
<key type="string" value="need" />
<val type="False" value="" />
</entry>
<entry>
<key type="string" value="values" />
- <val type="list" id="19120072" >
- <item type="dict" id="19891888" >
+ <val type="list" id="17966936" >
+ <item type="dict" id="18779216" >
<entry>
<key type="string" value="access" />
<val type="string" value="rw" />
@@ -264,15 +287,15 @@
</entry>
<entry>
<key type="numeric" value="8195" />
- <val type="dict" id="19892224" >
+ <val type="dict" id="18779504" >
<entry>
<key type="string" value="need" />
<val type="False" value="" />
</entry>
<entry>
<key type="string" value="values" />
- <val type="list" id="19124592" >
- <item type="dict" id="19892512" >
+ <val type="list" id="17967296" >
+ <item type="dict" id="18779792" >
<entry>
<key type="string" value="access" />
<val type="string" value="rw" />
@@ -303,7 +326,7 @@
</val>
</entry>
</attr>
-<attr name="DS302" type="dict" id="19893632" >
+<attr name="DS302" type="dict" id="18780864" >
</attr>
<attr name="ProfileName" type="string" value="DS-301" />
<attr name="Type" type="string" value="slave" />
--- a/include/data.h Sun Apr 15 00:46:40 2007 +0200
+++ b/include/data.h Sun Apr 15 00:49:34 2007 +0200
@@ -90,6 +90,7 @@
UNS8 toggle;
CAN_HANDLE canHandle;
scanIndexOD_t scanIndexOD;
+ storeODSubIndex_t storeODSubIndex;
};
#define NMTable_Initializer Unknown_state,
@@ -173,7 +174,8 @@
/* General */\
0, /* toggle */\
NULL,/*NODE_PREFIX ## _canSend, /* canSend */\
- NODE_PREFIX ## _scanIndexOD /* scanIndexOD */\
+ NODE_PREFIX ## _scanIndexOD, /* scanIndexOD */\
+ _storeODSubIndex /* storeODSubIndex */\
}
#endif /* __data_h__ */
--- a/include/objacces.h Sun Apr 15 00:46:40 2007 +0200
+++ b/include/objacces.h Sun Apr 15 00:49:34 2007 +0200
@@ -37,6 +37,8 @@
#include <applicfg.h>
typedef UNS32 (*valueRangeTest_t)(UNS8 typeValue, void *Value);
+typedef void (* storeODSubIndex_t)(UNS16 wIndex, UNS8 bSubindex);
+void _storeODSubIndex (UNS16 wIndex, UNS8 bSubindex);
#include "data.h"
--- a/include/objdictdef.h Sun Apr 15 00:46:40 2007 +0200
+++ b/include/objdictdef.h Sun Apr 15 00:49:34 2007 +0200
@@ -86,7 +86,7 @@
#define WO 0x01
#define RO 0x02
-#define TO_BE_SAVED 0x04
+#define TO_BE_SAVE 0x04
/************************ STRUCTURES ****************************/
/** This are some structs which are neccessary for creating the entries
--- a/src/objacces.c Sun Apr 15 00:46:40 2007 +0200
+++ b/src/objacces.c Sun Apr 15 00:49:34 2007 +0200
@@ -205,7 +205,9 @@
}
/* TODO : Store dans NVRAM */
- /* if (ptrTable->pSubindex[bSubindex].bAccessType & TO_BE_SAVED) */
+ if (ptrTable->pSubindex[bSubindex].bAccessType & TO_BE_SAVE){
+ (*d->storeODSubIndex)(wIndex, bSubindex);
+ }
return OD_SUCCESSFUL;
}else{
*pExpectedSize = szData;
@@ -231,4 +233,4 @@
return errorCode;
}
-
+void _storeODSubIndex (UNS16 wIndex, UNS8 bSubindex){}