examples/TestMasterSlave/TestSlave.c
changeset 93 16c8ceea8f18
parent 92 0d84d95790d9
child 94 bdf4c86be6b2
equal deleted inserted replaced
92:0d84d95790d9 93:16c8ceea8f18
     1 
       
     2 /* File generated by gen_cfile.py. Should not be modified. */
       
     3 
       
     4 #include "TestSlave.h"
       
     5 
       
     6 /**************************************************************************/
       
     7 /* Declaration of the mapped variables                                    */
       
     8 /**************************************************************************/
       
     9 UNS8 SlaveMap1 = 0x0;		/* Mapped at index 0x2000, subindex 0x00 */
       
    10 UNS8 SlaveMap2 = 0x0;		/* Mapped at index 0x2001, subindex 0x00 */
       
    11 UNS8 SlaveMap3 = 0x0;		/* Mapped at index 0x2002, subindex 0x00 */
       
    12 UNS8 SlaveMap4 = 0x0;		/* Mapped at index 0x2003, subindex 0x00 */
       
    13 
       
    14 /**************************************************************************/
       
    15 /* Declaration of the value range types                                   */
       
    16 /**************************************************************************/
       
    17 
       
    18 UNS32 TestSlave_valueRangeTest (UNS8 typeValue, void * value)
       
    19 {
       
    20   switch (typeValue) {
       
    21   }
       
    22   return 0;
       
    23 }
       
    24 
       
    25 /**************************************************************************/
       
    26 /* The node id                                                            */
       
    27 /**************************************************************************/
       
    28 /* node_id default value.*/
       
    29 UNS8 TestSlave_bDeviceNodeId = 0x00;
       
    30 
       
    31 /**************************************************************************/
       
    32 /* Array of message processing information */
       
    33 
       
    34 const UNS8 TestSlave_iam_a_slave = 1;
       
    35 
       
    36 TIMER_HANDLE TestSlave_heartBeatTimers[1];
       
    37 
       
    38 /*
       
    39 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
       
    40 
       
    41                                OBJECT DICTIONARY
       
    42 
       
    43 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
       
    44 */
       
    45 
       
    46 /* index 0x1000 :   Device Type. */
       
    47                     UNS32 TestSlave_obj1000 = 0x12D;	/* 301 */
       
    48                     subindex TestSlave_Index1000[] = 
       
    49                      {
       
    50                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1000 }
       
    51                      };
       
    52 
       
    53 /* index 0x1001 :   Error Register. */
       
    54                     UNS8 TestSlave_obj1001 = 0x0;	/* 0 */
       
    55                     subindex TestSlave_Index1001[] = 
       
    56                      {
       
    57                        { RO, uint8, sizeof (UNS8), (void*)&TestSlave_obj1001 }
       
    58                      };
       
    59 
       
    60 /* index 0x1005 :   SYNC COB ID. */
       
    61                     UNS32 TestSlave_obj1005 = 0x80;	/* 128 */
       
    62                     ODCallback_t TestSlave_Index1005_callbacks[] = 
       
    63                      {
       
    64                        NULL,
       
    65                      };
       
    66                     subindex TestSlave_Index1005[] = 
       
    67                      {
       
    68                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1005 }
       
    69                      };
       
    70 
       
    71 /* index 0x1006 :   Communication / Cycle Period. */
       
    72                     UNS32 TestSlave_obj1006 = 0x0;	/* 0 */
       
    73                     ODCallback_t TestSlave_Index1006_callbacks[] = 
       
    74                      {
       
    75                        NULL,
       
    76                      };
       
    77                     subindex TestSlave_Index1006[] = 
       
    78                      {
       
    79                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1006 }
       
    80                      };
       
    81 
       
    82 /* index 0x1010 :   Store parameters. */
       
    83                     UNS8 TestSlave_highestSubIndex_obj1010 = 4; /* number of subindex - 1*/
       
    84                     UNS32 TestSlave_obj1010_Save_All_Parameters = 0x0;	/* 0 */
       
    85                     UNS32 TestSlave_obj1010_Save_Communication_Parameters = 0x0;	/* 0 */
       
    86                     UNS32 TestSlave_obj1010_Save_Application_Parameters = 0x0;	/* 0 */
       
    87                     UNS32 TestSlave_obj1010_Save_Manufacturer_Parameters = 0x0;	/* 0 */
       
    88                     ODCallback_t TestSlave_Index1010_callbacks[] = 
       
    89                      {
       
    90                        NULL,
       
    91                        NULL,
       
    92                        NULL,
       
    93                        NULL,
       
    94                        NULL,
       
    95                      };
       
    96                     subindex TestSlave_Index1010[] = 
       
    97                      {
       
    98                        { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1010 },
       
    99                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1010_Save_All_Parameters },
       
   100                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1010_Save_Communication_Parameters },
       
   101                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1010_Save_Application_Parameters },
       
   102                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1010_Save_Manufacturer_Parameters }
       
   103                      };
       
   104 
       
   105 /* index 0x1011 :   Restore Default Parameters. */
       
   106                     UNS8 TestSlave_highestSubIndex_obj1011 = 4; /* number of subindex - 1*/
       
   107                     UNS32 TestSlave_obj1011_Restore_All_Default_Parameters = 0x0;	/* 0 */
       
   108                     UNS32 TestSlave_obj1011_Restore_Communication_Default_Parameters = 0x0;	/* 0 */
       
   109                     UNS32 TestSlave_obj1011_Restore_Application_Default_Parameters = 0x0;	/* 0 */
       
   110                     UNS32 TestSlave_obj1011_Restore_Manufacturer_Default_Parameters = 0x0;	/* 0 */
       
   111                     ODCallback_t TestSlave_Index1011_callbacks[] = 
       
   112                      {
       
   113                        NULL,
       
   114                        NULL,
       
   115                        NULL,
       
   116                        NULL,
       
   117                        NULL,
       
   118                      };
       
   119                     subindex TestSlave_Index1011[] = 
       
   120                      {
       
   121                        { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1011 },
       
   122                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1011_Restore_All_Default_Parameters },
       
   123                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1011_Restore_Communication_Default_Parameters },
       
   124                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1011_Restore_Application_Default_Parameters },
       
   125                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1011_Restore_Manufacturer_Default_Parameters }
       
   126                      };
       
   127 
       
   128 /* index 0x1016 :   Consumer Heartbeat Time */
       
   129                     UNS8 TestSlave_highestSubIndex_obj1016 = 0;
       
   130                     UNS32 TestSlave_obj1016[]={0};
       
   131 
       
   132 /* index 0x1017 :   Producer Heartbeat Time. */
       
   133                     UNS16 TestSlave_obj1017 = 0x3E8;	/* 1000 */
       
   134                     subindex TestSlave_Index1017[] = 
       
   135                      {
       
   136                        { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1017 }
       
   137                      };
       
   138 
       
   139 /* index 0x1018 :   Identity. */
       
   140                     UNS8 TestSlave_highestSubIndex_obj1018 = 4; /* number of subindex - 1*/
       
   141                     UNS32 TestSlave_obj1018_Vendor_ID = 0x0;	/* 0 */
       
   142                     UNS32 TestSlave_obj1018_Product_Code = 0x0;	/* 0 */
       
   143                     UNS32 TestSlave_obj1018_Revision_Number = 0x0;	/* 0 */
       
   144                     UNS32 TestSlave_obj1018_Serial_Number = 0x0;	/* 0 */
       
   145                     subindex TestSlave_Index1018[] = 
       
   146                      {
       
   147                        { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1018 },
       
   148                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Vendor_ID },
       
   149                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Product_Code },
       
   150                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Revision_Number },
       
   151                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Serial_Number }
       
   152                      };
       
   153 
       
   154 /* index 0x1200 :   Server SDO Parameter. */
       
   155                     UNS8 TestSlave_highestSubIndex_obj1200 = 2; /* number of subindex - 1*/
       
   156                     UNS32 TestSlave_obj1200_COB_ID_Client_to_Server_Receive_SDO = 0x601;	/* 1537 */
       
   157                     UNS32 TestSlave_obj1200_COB_ID_Server_to_Client_Transmit_SDO = 0x581;	/* 1409 */
       
   158                     subindex TestSlave_Index1200[] = 
       
   159                      {
       
   160                        { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1200 },
       
   161                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1200_COB_ID_Client_to_Server_Receive_SDO },
       
   162                        { RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1200_COB_ID_Server_to_Client_Transmit_SDO }
       
   163                      };
       
   164 
       
   165 /* index 0x1800 :   Transmit PDO 1 Parameter. */
       
   166                     UNS8 TestSlave_highestSubIndex_obj1800 = 5; /* number of subindex - 1*/
       
   167                     UNS32 TestSlave_obj1800_COB_ID_used_by_PDO = 0x182;	/* 386 */
       
   168                     UNS8 TestSlave_obj1800_Transmission_Type = 0x1;	/* 1 */
       
   169                     UNS16 TestSlave_obj1800_Inhibit_Time = 0x0;	/* 0 */
       
   170                     UNS16 TestSlave_obj1800_Compatibility_Entry = 0x0;	/* 0 */
       
   171                     UNS16 TestSlave_obj1800_Event_Timer = 0x0;	/* 0 */
       
   172                     subindex TestSlave_Index1800[] = 
       
   173                      {
       
   174                        { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1800 },
       
   175                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1800_COB_ID_used_by_PDO },
       
   176                        { RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1800_Transmission_Type },
       
   177                        { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Inhibit_Time },
       
   178                        { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Compatibility_Entry },
       
   179                        { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Event_Timer }
       
   180                      };
       
   181 
       
   182 /* index 0x1801 :   Transmit PDO 2 Parameter. */
       
   183                     UNS8 TestSlave_highestSubIndex_obj1801 = 5; /* number of subindex - 1*/
       
   184                     UNS32 TestSlave_obj1801_COB_ID_used_by_PDO = 0x282;	/* 642 */
       
   185                     UNS8 TestSlave_obj1801_Transmission_Type = 0x1;	/* 1 */
       
   186                     UNS16 TestSlave_obj1801_Inhibit_Time = 0x0;	/* 0 */
       
   187                     UNS16 TestSlave_obj1801_Compatibility_Entry = 0x0;	/* 0 */
       
   188                     UNS16 TestSlave_obj1801_Event_Timer = 0x0;	/* 0 */
       
   189                     subindex TestSlave_Index1801[] = 
       
   190                      {
       
   191                        { RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1801 },
       
   192                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1801_COB_ID_used_by_PDO },
       
   193                        { RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1801_Transmission_Type },
       
   194                        { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1801_Inhibit_Time },
       
   195                        { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1801_Compatibility_Entry },
       
   196                        { RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1801_Event_Timer }
       
   197                      };
       
   198 
       
   199 /* index 0x1A00 :   Transmit PDO 1 Mapping. */
       
   200                     UNS8 TestSlave_highestSubIndex_obj1A00 = 2; /* number of subindex - 1*/
       
   201                     UNS32 TestSlave_obj1A00[] = 
       
   202                     {
       
   203                       0x20000008,	/* 536870920 */
       
   204                       0x20010008	/* 536936456 */
       
   205                     };
       
   206                     subindex TestSlave_Index1A00[] = 
       
   207                      {
       
   208                        { RW, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1A00 },
       
   209                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A00[0] },
       
   210                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A00[1] }
       
   211                      };
       
   212 
       
   213 /* index 0x1A01 :   Transmit PDO 2 Mapping. */
       
   214                     UNS8 TestSlave_highestSubIndex_obj1A01 = 2; /* number of subindex - 1*/
       
   215                     UNS32 TestSlave_obj1A01[] = 
       
   216                     {
       
   217                       0x20020008,	/* 537001992 */
       
   218                       0x20030008	/* 537067528 */
       
   219                     };
       
   220                     subindex TestSlave_Index1A01[] = 
       
   221                      {
       
   222                        { RW, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1A01 },
       
   223                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A01[0] },
       
   224                        { RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A01[1] }
       
   225                      };
       
   226 
       
   227 /* index 0x2000 :   Mapped variable SlaveMap1 */
       
   228                     subindex TestSlave_Index2000[] = 
       
   229                      {
       
   230                        { RW, uint8, sizeof (UNS8), (void*)&SlaveMap1 }
       
   231                      };
       
   232 
       
   233 /* index 0x2001 :   Mapped variable SlaveMap2 */
       
   234                     subindex TestSlave_Index2001[] = 
       
   235                      {
       
   236                        { RW, uint8, sizeof (UNS8), (void*)&SlaveMap2 }
       
   237                      };
       
   238 
       
   239 /* index 0x2002 :   Mapped variable SlaveMap3 */
       
   240                     subindex TestSlave_Index2002[] = 
       
   241                      {
       
   242                        { RW, uint8, sizeof (UNS8), (void*)&SlaveMap3 }
       
   243                      };
       
   244 
       
   245 /* index 0x2003 :   Mapped variable SlaveMap4 */
       
   246                     subindex TestSlave_Index2003[] = 
       
   247                      {
       
   248                        { RW, uint8, sizeof (UNS8), (void*)&SlaveMap4 }
       
   249                      };
       
   250 
       
   251 const indextable TestSlave_objdict[] = 
       
   252 {
       
   253   { (subindex*)TestSlave_Index1000,sizeof(TestSlave_Index1000)/sizeof(TestSlave_Index1000[0]), 0x1000},
       
   254   { (subindex*)TestSlave_Index1001,sizeof(TestSlave_Index1001)/sizeof(TestSlave_Index1001[0]), 0x1001},
       
   255   { (subindex*)TestSlave_Index1005,sizeof(TestSlave_Index1005)/sizeof(TestSlave_Index1005[0]), 0x1005},
       
   256   { (subindex*)TestSlave_Index1006,sizeof(TestSlave_Index1006)/sizeof(TestSlave_Index1006[0]), 0x1006},
       
   257   { (subindex*)TestSlave_Index1010,sizeof(TestSlave_Index1010)/sizeof(TestSlave_Index1010[0]), 0x1010},
       
   258   { (subindex*)TestSlave_Index1011,sizeof(TestSlave_Index1011)/sizeof(TestSlave_Index1011[0]), 0x1011},
       
   259   { (subindex*)TestSlave_Index1017,sizeof(TestSlave_Index1017)/sizeof(TestSlave_Index1017[0]), 0x1017},
       
   260   { (subindex*)TestSlave_Index1018,sizeof(TestSlave_Index1018)/sizeof(TestSlave_Index1018[0]), 0x1018},
       
   261   { (subindex*)TestSlave_Index1200,sizeof(TestSlave_Index1200)/sizeof(TestSlave_Index1200[0]), 0x1200},
       
   262   { (subindex*)TestSlave_Index1800,sizeof(TestSlave_Index1800)/sizeof(TestSlave_Index1800[0]), 0x1800},
       
   263   { (subindex*)TestSlave_Index1801,sizeof(TestSlave_Index1801)/sizeof(TestSlave_Index1801[0]), 0x1801},
       
   264   { (subindex*)TestSlave_Index1A00,sizeof(TestSlave_Index1A00)/sizeof(TestSlave_Index1A00[0]), 0x1A00},
       
   265   { (subindex*)TestSlave_Index1A01,sizeof(TestSlave_Index1A01)/sizeof(TestSlave_Index1A01[0]), 0x1A01},
       
   266   { (subindex*)TestSlave_Index2000,sizeof(TestSlave_Index2000)/sizeof(TestSlave_Index2000[0]), 0x2000},
       
   267   { (subindex*)TestSlave_Index2001,sizeof(TestSlave_Index2001)/sizeof(TestSlave_Index2001[0]), 0x2001},
       
   268   { (subindex*)TestSlave_Index2002,sizeof(TestSlave_Index2002)/sizeof(TestSlave_Index2002[0]), 0x2002},
       
   269   { (subindex*)TestSlave_Index2003,sizeof(TestSlave_Index2003)/sizeof(TestSlave_Index2003[0]), 0x2003},
       
   270 };
       
   271 
       
   272 const indextable * TestSlave_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks)
       
   273 {
       
   274 	int i;
       
   275 	*callbacks = NULL;
       
   276 	switch(wIndex){
       
   277 		case 0x1000: i = 0;break;
       
   278 		case 0x1001: i = 1;break;
       
   279 		case 0x1005: i = 2;*callbacks = TestSlave_Index1005_callbacks; break;
       
   280 		case 0x1006: i = 3;*callbacks = TestSlave_Index1006_callbacks; break;
       
   281 		case 0x1010: i = 4;*callbacks = TestSlave_Index1010_callbacks; break;
       
   282 		case 0x1011: i = 5;*callbacks = TestSlave_Index1011_callbacks; break;
       
   283 		case 0x1017: i = 6;break;
       
   284 		case 0x1018: i = 7;break;
       
   285 		case 0x1200: i = 8;break;
       
   286 		case 0x1800: i = 9;break;
       
   287 		case 0x1801: i = 10;break;
       
   288 		case 0x1A00: i = 11;break;
       
   289 		case 0x1A01: i = 12;break;
       
   290 		case 0x2000: i = 13;break;
       
   291 		case 0x2001: i = 14;break;
       
   292 		case 0x2002: i = 15;break;
       
   293 		case 0x2003: i = 16;break;
       
   294 		default:
       
   295 			*errorCode = OD_NO_SUCH_OBJECT;
       
   296 			return NULL;
       
   297 	}
       
   298 	*errorCode = OD_SUCCESSFUL;
       
   299 	return &TestSlave_objdict[i];
       
   300 }
       
   301 
       
   302 /* To count at which received SYNC a PDO must be sent.
       
   303  * Even if no pdoTransmit are defined, at least one entry is computed
       
   304  * for compilations issues.
       
   305  */
       
   306 UNS8 TestSlave_count_sync[2] = {0,};
       
   307 
       
   308 quick_index TestSlave_firstIndex = {
       
   309   8, /* SDO_SVR */
       
   310   0, /* SDO_CLT */
       
   311   0, /* PDO_RCV */
       
   312   0, /* PDO_RCV_MAP */
       
   313   9, /* PDO_TRS */
       
   314   11 /* PDO_TRS_MAP */
       
   315 };
       
   316 
       
   317 quick_index TestSlave_lastIndex = {
       
   318   8, /* SDO_SVR */
       
   319   0, /* SDO_CLT */
       
   320   0, /* PDO_RCV */
       
   321   0, /* PDO_RCV_MAP */
       
   322   10, /* PDO_TRS */
       
   323   12 /* PDO_TRS_MAP */
       
   324 };
       
   325 
       
   326 UNS16 TestSlave_ObjdictSize = sizeof(TestSlave_objdict)/sizeof(TestSlave_objdict[0]); 
       
   327 
       
   328 CO_Data TestSlave_Data = CANOPEN_NODE_DATA_INITIALIZER(TestSlave);
       
   329