# HG changeset patch # User laurent # Date 1276716542 -7200 # Node ID 36b62c854ee2fd7f22bd4f2483ab9ae1a44a5cbe # Parent f0935accb93bb49a3f208541576a141ca48700cb Obsolete example fixed diff -r f0935accb93b -r 36b62c854ee2 objdictgen/examples/example_objdict.c --- a/objdictgen/examples/example_objdict.c Wed Jun 16 21:28:34 2010 +0200 +++ b/objdictgen/examples/example_objdict.c Wed Jun 16 21:29:02 2010 +0200 @@ -4,7 +4,7 @@ #include "example_objdict.h" /**************************************************************************/ -/* Declaration of the mapped variables */ +/* Declaration of mapped variables */ /**************************************************************************/ UNS8 Time_seconds = 0x0; /* Mapped at index 0x2000, subindex 0x01 */ UNS8 Time_minutes = 0x0; /* Mapped at index 0x2000, subindex 0x02 */ @@ -12,15 +12,19 @@ UNS8 Time_days = 0x0; /* Mapped at index 0x2000, subindex 0x04 */ UNS32 canopenErrNB = 0x0; /* Mapped at index 0x2001, subindex 0x00 */ UNS32 canopenErrVal = 0x0; /* Mapped at index 0x2002, subindex 0x00 */ -UNS8 strTest[10] = ""; /* Mapped at index 0x2003, subindex 0x00 */ - -/**************************************************************************/ -/* Declaration of the value range types */ -/**************************************************************************/ - +INTEGER8 strTest[10] = ""; /* Mapped at index 0x2003, subindex 0x00 */ + +/**************************************************************************/ +/* Declaration of value range types */ +/**************************************************************************/ + +#define valueRange_EMC 0x9F /* Type for index 0x1003 subindex 0x00 (only set of value 0 is possible) */ UNS32 Linux_slave_valueRangeTest (UNS8 typeValue, void * value) { switch (typeValue) { + case valueRange_EMC: + if (*(UNS8*)value != (UNS8)0) return OD_VALUE_RANGE_EXCEEDED; + break; } return 0; } @@ -36,7 +40,7 @@ const UNS8 Linux_slave_iam_a_slave = 1; -TIMER_HANDLE Linux_slave_heartBeatTimers[1] = {TIMER_NONE,}; +TIMER_HANDLE Linux_slave_heartBeatTimers[1] = {TIMER_NONE}; /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ @@ -60,6 +64,23 @@ { RO, uint8, sizeof (UNS8), (void*)&Linux_slave_obj1001 } }; +/* index 0x1003 : Pre-defined Error Field */ + UNS8 Linux_slave_highestSubIndex_obj1003 = 0; /* number of subindex - 1*/ + UNS32 Linux_slave_obj1003[] = + { + 0x0 /* 0 */ + }; + ODCallback_t Linux_slave_Index1003_callbacks[] = + { + NULL, + NULL, + }; + subindex Linux_slave_Index1003[] = + { + { RW, valueRange_EMC, sizeof (UNS8), (void*)&Linux_slave_highestSubIndex_obj1003 }, + { RO, uint32, sizeof (UNS32), (void*)&Linux_slave_obj1003[0] } + }; + /* index 0x1005 : SYNC COB ID */ UNS32 Linux_slave_obj1005 = 0x0; /* 0 */ @@ -67,12 +88,15 @@ UNS32 Linux_slave_obj1006 = 0x0; /* 0 */ /* index 0x1008 : Manufacturer Device Name. */ - UNS8 Linux_slave_obj1008[10] = "Appli_Slave_HC12"; + INTEGER8 Linux_slave_obj1008[16] = "Appli_Slave_HC12"; subindex Linux_slave_Index1008[] = { { RO, visible_string, 16, (void*)&Linux_slave_obj1008 } }; +/* index 0x1014 : Emergency COB ID */ + UNS32 Linux_slave_obj1014 = 0x80 + 0x00; /* 128 + NodeID */ + /* index 0x1016 : Consumer Heartbeat Time. */ UNS8 Linux_slave_highestSubIndex_obj1016 = 1; /* number of subindex - 1*/ UNS32 Linux_slave_obj1016[] = @@ -334,8 +358,12 @@ /* index 0x2003 : Mapped variable strTest */ subindex Linux_slave_Index2003[] = { - { RW, visible_string, 0, (void*)&strTest } - }; + { RW, visible_string, 10, (void*)&strTest } + }; + +/**************************************************************************/ +/* Declaration of pointed variables */ +/**************************************************************************/ const indextable Linux_slave_objdict[] = { @@ -405,7 +433,7 @@ */ s_PDO_status Linux_slave_PDO_status[2] = {s_PDO_status_Initializer,s_PDO_status_Initializer}; -quick_index Linux_slave_firstIndex = { +const quick_index Linux_slave_firstIndex = { 0, /* SDO_SVR */ 5, /* SDO_CLT */ 6, /* PDO_RCV */ @@ -414,7 +442,7 @@ 16 /* PDO_TRS_MAP */ }; -quick_index Linux_slave_lastIndex = { +const quick_index Linux_slave_lastIndex = { 0, /* SDO_SVR */ 5, /* SDO_CLT */ 9, /* PDO_RCV */ @@ -423,7 +451,7 @@ 17 /* PDO_TRS_MAP */ }; -UNS16 Linux_slave_ObjdictSize = sizeof(Linux_slave_objdict)/sizeof(Linux_slave_objdict[0]); +const UNS16 Linux_slave_ObjdictSize = sizeof(Linux_slave_objdict)/sizeof(Linux_slave_objdict[0]); CO_Data Linux_slave_Data = CANOPEN_NODE_DATA_INITIALIZER(Linux_slave); diff -r f0935accb93b -r 36b62c854ee2 objdictgen/examples/example_objdict.h --- a/objdictgen/examples/example_objdict.h Wed Jun 16 21:28:34 2010 +0200 +++ b/objdictgen/examples/example_objdict.h Wed Jun 16 21:29:02 2010 +0200 @@ -12,14 +12,12 @@ /* Master node data struct */ extern CO_Data Linux_slave_Data; -extern ODCallback_t Transmit_PDO_1_Parameter_callbacks[]; /* Callbacks of index0x1800 */ -extern ODCallback_t Transmit_PDO_2_Parameter_callbacks[]; /* Callbacks of index0x1801 */ extern UNS8 Time_seconds; /* Mapped at index 0x2000, subindex 0x01 */ extern UNS8 Time_minutes; /* Mapped at index 0x2000, subindex 0x02 */ extern UNS8 Time_hours; /* Mapped at index 0x2000, subindex 0x03 */ extern UNS8 Time_days; /* Mapped at index 0x2000, subindex 0x04 */ extern UNS32 canopenErrNB; /* Mapped at index 0x2001, subindex 0x00*/ extern UNS32 canopenErrVal; /* Mapped at index 0x2002, subindex 0x00*/ -extern UNS8 strTest[10]; /* Mapped at index 0x2003, subindex 0x00*/ +extern INTEGER8 strTest[10]; /* Mapped at index 0x2003, subindex 0x00*/ #endif // EXAMPLE_OBJDICT_H diff -r f0935accb93b -r 36b62c854ee2 objdictgen/examples/example_objdict.od --- a/objdictgen/examples/example_objdict.od Wed Jun 16 21:28:34 2010 +0200 +++ b/objdictgen/examples/example_objdict.od Wed Jun 16 21:29:02 2010 +0200 @@ -1,10 +1,10 @@ - - + + - + @@ -15,8 +15,8 @@ - - + + @@ -25,8 +25,8 @@ - - + + @@ -35,7 +35,7 @@ - + @@ -52,13 +52,13 @@ - + - + @@ -68,13 +68,13 @@ - + - + @@ -83,7 +83,7 @@ - + @@ -91,15 +91,15 @@ - + - - + + @@ -108,7 +108,7 @@ - + @@ -118,8 +118,8 @@ - - + + @@ -128,8 +128,8 @@ - - + + @@ -138,20 +138,20 @@ - + - + - - + + @@ -160,27 +160,27 @@ - - - - - - - - - - + + + + + + + + + + - + - - + + @@ -198,7 +198,7 @@ - + @@ -216,7 +216,7 @@ - + @@ -234,7 +234,7 @@ - + @@ -252,7 +252,7 @@ - + @@ -284,15 +284,15 @@ - + - - + + @@ -324,15 +324,15 @@ - + - - + + @@ -364,15 +364,15 @@ - + - - + + @@ -404,7 +404,7 @@ - + @@ -419,8 +419,8 @@ - - + + @@ -438,7 +438,7 @@ - + @@ -456,7 +456,7 @@ - + @@ -487,7 +487,7 @@ - + slave