examples/TestMasterSlave/TestMaster.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 "TestMaster.h"
       
     5 
       
     6 /**************************************************************************/
       
     7 /* Declaration of the mapped variables                                    */
       
     8 /**************************************************************************/
       
     9 UNS8 MasterMap1 = 0x0;		/* Mapped at index 0x2000, subindex 0x00 */
       
    10 UNS8 MasterMap2 = 0x0;		/* Mapped at index 0x2001, subindex 0x00 */
       
    11 UNS8 MasterMap3 = 0x0;		/* Mapped at index 0x2002, subindex 0x00 */
       
    12 UNS8 MasterMap4 = 0x0;		/* Mapped at index 0x2003, subindex 0x00 */
       
    13 
       
    14 /**************************************************************************/
       
    15 /* Declaration of the value range types                                   */
       
    16 /**************************************************************************/
       
    17 
       
    18 UNS32 TestMaster_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 TestMaster_bDeviceNodeId = 0x00;
       
    30 
       
    31 /**************************************************************************/
       
    32 /* Array of message processing information */
       
    33 
       
    34 const UNS8 TestMaster_iam_a_slave = 0;
       
    35 
       
    36 TIMER_HANDLE TestMaster_heartBeatTimers[1] = {TIMER_NONE,};
       
    37 
       
    38 /*
       
    39 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
       
    40 
       
    41                                OBJECT DICTIONARY
       
    42 
       
    43 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
       
    44 */
       
    45 
       
    46 /* index 0x1000 :   Device Type. */
       
    47                     UNS32 TestMaster_obj1000 = 0x12D;	/* 301 */
       
    48                     subindex TestMaster_Index1000[] = 
       
    49                      {
       
    50                        { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1000 }
       
    51                      };
       
    52 
       
    53 /* index 0x1001 :   Error Register. */
       
    54                     UNS8 TestMaster_obj1001 = 0x0;	/* 0 */
       
    55                     subindex TestMaster_Index1001[] = 
       
    56                      {
       
    57                        { RO, uint8, sizeof (UNS8), (void*)&TestMaster_obj1001 }
       
    58                      };
       
    59 
       
    60 /* index 0x1005 :   SYNC COB ID. */
       
    61                     UNS32 TestMaster_obj1005 = 0x40000080;	/* 1073741952 */
       
    62                     ODCallback_t TestMaster_Index1005_callbacks[] = 
       
    63                      {
       
    64                        NULL,
       
    65                      };
       
    66                     subindex TestMaster_Index1005[] = 
       
    67                      {
       
    68                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1005 }
       
    69                      };
       
    70 
       
    71 /* index 0x1006 :   Communication / Cycle Period. */
       
    72                     UNS32 TestMaster_obj1006 = 0xC350;	/* 50000 */
       
    73                     ODCallback_t TestMaster_Index1006_callbacks[] = 
       
    74                      {
       
    75                        NULL,
       
    76                      };
       
    77                     subindex TestMaster_Index1006[] = 
       
    78                      {
       
    79                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1006 }
       
    80                      };
       
    81 
       
    82 /* index 0x1010 :   Store parameters. */
       
    83                     UNS8 TestMaster_highestSubIndex_obj1010 = 4; /* number of subindex - 1*/
       
    84                     UNS32 TestMaster_obj1010_Save_All_Parameters = 0x0;	/* 0 */
       
    85                     UNS32 TestMaster_obj1010_Save_Communication_Parameters = 0x0;	/* 0 */
       
    86                     UNS32 TestMaster_obj1010_Save_Application_Parameters = 0x0;	/* 0 */
       
    87                     UNS32 TestMaster_obj1010_Save_Manufacturer_Parameters = 0x0;	/* 0 */
       
    88                     ODCallback_t TestMaster_Index1010_callbacks[] = 
       
    89                      {
       
    90                        NULL,
       
    91                        NULL,
       
    92                        NULL,
       
    93                        NULL,
       
    94                        NULL,
       
    95                      };
       
    96                     subindex TestMaster_Index1010[] = 
       
    97                      {
       
    98                        { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1010 },
       
    99                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1010_Save_All_Parameters },
       
   100                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1010_Save_Communication_Parameters },
       
   101                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1010_Save_Application_Parameters },
       
   102                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1010_Save_Manufacturer_Parameters }
       
   103                      };
       
   104 
       
   105 /* index 0x1011 :   Restore Default Parameters. */
       
   106                     UNS8 TestMaster_highestSubIndex_obj1011 = 4; /* number of subindex - 1*/
       
   107                     UNS32 TestMaster_obj1011_Restore_All_Default_Parameters = 0x0;	/* 0 */
       
   108                     UNS32 TestMaster_obj1011_Restore_Communication_Default_Parameters = 0x0;	/* 0 */
       
   109                     UNS32 TestMaster_obj1011_Restore_Application_Default_Parameters = 0x0;	/* 0 */
       
   110                     UNS32 TestMaster_obj1011_Restore_Manufacturer_Default_Parameters = 0x0;	/* 0 */
       
   111                     ODCallback_t TestMaster_Index1011_callbacks[] = 
       
   112                      {
       
   113                        NULL,
       
   114                        NULL,
       
   115                        NULL,
       
   116                        NULL,
       
   117                        NULL,
       
   118                      };
       
   119                     subindex TestMaster_Index1011[] = 
       
   120                      {
       
   121                        { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1011 },
       
   122                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1011_Restore_All_Default_Parameters },
       
   123                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1011_Restore_Communication_Default_Parameters },
       
   124                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1011_Restore_Application_Default_Parameters },
       
   125                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1011_Restore_Manufacturer_Default_Parameters }
       
   126                      };
       
   127 
       
   128 /* index 0x1016 :   Consumer Heartbeat Time. */
       
   129                     UNS8 TestMaster_highestSubIndex_obj1016 = 1; /* number of subindex - 1*/
       
   130                     UNS32 TestMaster_obj1016[] = 
       
   131                     {
       
   132                       0x20802	/* 133122 */
       
   133                     };
       
   134                     subindex TestMaster_Index1016[] = 
       
   135                      {
       
   136                        { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1016 },
       
   137                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1016[0] }
       
   138                      };
       
   139 
       
   140 /* index 0x1017 :   Producer Heartbeat Time */ 
       
   141                     UNS16 TestMaster_obj1017 = 0x0;   /* 0 */
       
   142 
       
   143 /* index 0x1018 :   Identity. */
       
   144                     UNS8 TestMaster_highestSubIndex_obj1018 = 4; /* number of subindex - 1*/
       
   145                     UNS32 TestMaster_obj1018_Vendor_ID = 0x0;	/* 0 */
       
   146                     UNS32 TestMaster_obj1018_Product_Code = 0x0;	/* 0 */
       
   147                     UNS32 TestMaster_obj1018_Revision_Number = 0x0;	/* 0 */
       
   148                     UNS32 TestMaster_obj1018_Serial_Number = 0x0;	/* 0 */
       
   149                     subindex TestMaster_Index1018[] = 
       
   150                      {
       
   151                        { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1018 },
       
   152                        { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Vendor_ID },
       
   153                        { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Product_Code },
       
   154                        { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Revision_Number },
       
   155                        { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Serial_Number }
       
   156                      };
       
   157 
       
   158 /* index 0x1280 :   Client SDO 1 Parameter. */
       
   159                     UNS8 TestMaster_highestSubIndex_obj1280 = 3; /* number of subindex - 1*/
       
   160                     UNS32 TestMaster_obj1280_COB_ID_Client_to_Server_Transmit_SDO = 0x602;	/* 1538 */
       
   161                     UNS32 TestMaster_obj1280_COB_ID_Server_to_Client_Receive_SDO = 0x582;	/* 1410 */
       
   162                     UNS32 TestMaster_obj1280_Node_ID_of_the_SDO_Server = 0x2;	/* 2 */
       
   163                     subindex TestMaster_Index1280[] = 
       
   164                      {
       
   165                        { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1280 },
       
   166                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1280_COB_ID_Client_to_Server_Transmit_SDO },
       
   167                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1280_COB_ID_Server_to_Client_Receive_SDO },
       
   168                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1280_Node_ID_of_the_SDO_Server }
       
   169                      };
       
   170 
       
   171 /* index 0x1400 :   Receive PDO 1 Parameter. */
       
   172                     UNS8 TestMaster_highestSubIndex_obj1400 = 5; /* number of subindex - 1*/
       
   173                     UNS32 TestMaster_obj1400_COB_ID_used_by_PDO = 0x182;	/* 386 */
       
   174                     UNS8 TestMaster_obj1400_Transmission_Type = 0x1;	/* 1 */
       
   175                     UNS16 TestMaster_obj1400_Inhibit_Time = 0x0;	/* 0 */
       
   176                     UNS16 TestMaster_obj1400_Compatibility_Entry = 0x0;	/* 0 */
       
   177                     UNS16 TestMaster_obj1400_Event_Timer = 0x0;	/* 0 */
       
   178                     subindex TestMaster_Index1400[] = 
       
   179                      {
       
   180                        { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1400 },
       
   181                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1400_COB_ID_used_by_PDO },
       
   182                        { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1400_Transmission_Type },
       
   183                        { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1400_Inhibit_Time },
       
   184                        { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1400_Compatibility_Entry },
       
   185                        { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1400_Event_Timer }
       
   186                      };
       
   187 
       
   188 /* index 0x1401 :   Receive PDO 2 Parameter. */
       
   189                     UNS8 TestMaster_highestSubIndex_obj1401 = 5; /* number of subindex - 1*/
       
   190                     UNS32 TestMaster_obj1401_COB_ID_used_by_PDO = 0x282;	/* 642 */
       
   191                     UNS8 TestMaster_obj1401_Transmission_Type = 0x1;	/* 1 */
       
   192                     UNS16 TestMaster_obj1401_Inhibit_Time = 0x0;	/* 0 */
       
   193                     UNS16 TestMaster_obj1401_Compatibility_Entry = 0x0;	/* 0 */
       
   194                     UNS16 TestMaster_obj1401_Event_Timer = 0x0;	/* 0 */
       
   195                     subindex TestMaster_Index1401[] = 
       
   196                      {
       
   197                        { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1401 },
       
   198                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1401_COB_ID_used_by_PDO },
       
   199                        { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1401_Transmission_Type },
       
   200                        { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1401_Inhibit_Time },
       
   201                        { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1401_Compatibility_Entry },
       
   202                        { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1401_Event_Timer }
       
   203                      };
       
   204 
       
   205 /* index 0x1600 :   Receive PDO 1 Mapping. */
       
   206                     UNS8 TestMaster_highestSubIndex_obj1600 = 2; /* number of subindex - 1*/
       
   207                     UNS32 TestMaster_obj1600[] = 
       
   208                     {
       
   209                       0x20000008,	/* 536870920 */
       
   210                       0x20010008	/* 536936456 */
       
   211                     };
       
   212                     subindex TestMaster_Index1600[] = 
       
   213                      {
       
   214                        { RW, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1600 },
       
   215                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1600[0] },
       
   216                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1600[1] }
       
   217                      };
       
   218 
       
   219 /* index 0x1601 :   Receive PDO 2 Mapping. */
       
   220                     UNS8 TestMaster_highestSubIndex_obj1601 = 2; /* number of subindex - 1*/
       
   221                     UNS32 TestMaster_obj1601[] = 
       
   222                     {
       
   223                       0x20020008,	/* 537001992 */
       
   224                       0x20030008	/* 537067528 */
       
   225                     };
       
   226                     subindex TestMaster_Index1601[] = 
       
   227                      {
       
   228                        { RW, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1601 },
       
   229                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1601[0] },
       
   230                        { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1601[1] }
       
   231                      };
       
   232 
       
   233 /* index 0x2000 :   Mapped variable MasterMap1 */
       
   234                     ODCallback_t MasterMap1_callbacks[] = 
       
   235                      {
       
   236                        NULL,
       
   237                      };
       
   238                     subindex TestMaster_Index2000[] = 
       
   239                      {
       
   240                        { RW, uint8, sizeof (UNS8), (void*)&MasterMap1 }
       
   241                      };
       
   242 
       
   243 /* index 0x2001 :   Mapped variable MasterMap2 */
       
   244                     subindex TestMaster_Index2001[] = 
       
   245                      {
       
   246                        { RW, uint8, sizeof (UNS8), (void*)&MasterMap2 }
       
   247                      };
       
   248 
       
   249 /* index 0x2002 :   Mapped variable MasterMap3 */
       
   250                     subindex TestMaster_Index2002[] = 
       
   251                      {
       
   252                        { RW, uint8, sizeof (UNS8), (void*)&MasterMap3 }
       
   253                      };
       
   254 
       
   255 /* index 0x2003 :   Mapped variable MasterMap4 */
       
   256                     subindex TestMaster_Index2003[] = 
       
   257                      {
       
   258                        { RW, uint8, sizeof (UNS8), (void*)&MasterMap4 }
       
   259                      };
       
   260 
       
   261 const indextable TestMaster_objdict[] = 
       
   262 {
       
   263   { (subindex*)TestMaster_Index1000,sizeof(TestMaster_Index1000)/sizeof(TestMaster_Index1000[0]), 0x1000},
       
   264   { (subindex*)TestMaster_Index1001,sizeof(TestMaster_Index1001)/sizeof(TestMaster_Index1001[0]), 0x1001},
       
   265   { (subindex*)TestMaster_Index1005,sizeof(TestMaster_Index1005)/sizeof(TestMaster_Index1005[0]), 0x1005},
       
   266   { (subindex*)TestMaster_Index1006,sizeof(TestMaster_Index1006)/sizeof(TestMaster_Index1006[0]), 0x1006},
       
   267   { (subindex*)TestMaster_Index1010,sizeof(TestMaster_Index1010)/sizeof(TestMaster_Index1010[0]), 0x1010},
       
   268   { (subindex*)TestMaster_Index1011,sizeof(TestMaster_Index1011)/sizeof(TestMaster_Index1011[0]), 0x1011},
       
   269   { (subindex*)TestMaster_Index1016,sizeof(TestMaster_Index1016)/sizeof(TestMaster_Index1016[0]), 0x1016},
       
   270   { (subindex*)TestMaster_Index1018,sizeof(TestMaster_Index1018)/sizeof(TestMaster_Index1018[0]), 0x1018},
       
   271   { (subindex*)TestMaster_Index1280,sizeof(TestMaster_Index1280)/sizeof(TestMaster_Index1280[0]), 0x1280},
       
   272   { (subindex*)TestMaster_Index1400,sizeof(TestMaster_Index1400)/sizeof(TestMaster_Index1400[0]), 0x1400},
       
   273   { (subindex*)TestMaster_Index1401,sizeof(TestMaster_Index1401)/sizeof(TestMaster_Index1401[0]), 0x1401},
       
   274   { (subindex*)TestMaster_Index1600,sizeof(TestMaster_Index1600)/sizeof(TestMaster_Index1600[0]), 0x1600},
       
   275   { (subindex*)TestMaster_Index1601,sizeof(TestMaster_Index1601)/sizeof(TestMaster_Index1601[0]), 0x1601},
       
   276   { (subindex*)TestMaster_Index2000,sizeof(TestMaster_Index2000)/sizeof(TestMaster_Index2000[0]), 0x2000},
       
   277   { (subindex*)TestMaster_Index2001,sizeof(TestMaster_Index2001)/sizeof(TestMaster_Index2001[0]), 0x2001},
       
   278   { (subindex*)TestMaster_Index2002,sizeof(TestMaster_Index2002)/sizeof(TestMaster_Index2002[0]), 0x2002},
       
   279   { (subindex*)TestMaster_Index2003,sizeof(TestMaster_Index2003)/sizeof(TestMaster_Index2003[0]), 0x2003},
       
   280 };
       
   281 
       
   282 const indextable * TestMaster_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks)
       
   283 {
       
   284 	int i;
       
   285 	*callbacks = NULL;
       
   286 	switch(wIndex){
       
   287 		case 0x1000: i = 0;break;
       
   288 		case 0x1001: i = 1;break;
       
   289 		case 0x1005: i = 2;*callbacks = TestMaster_Index1005_callbacks; break;
       
   290 		case 0x1006: i = 3;*callbacks = TestMaster_Index1006_callbacks; break;
       
   291 		case 0x1010: i = 4;*callbacks = TestMaster_Index1010_callbacks; break;
       
   292 		case 0x1011: i = 5;*callbacks = TestMaster_Index1011_callbacks; break;
       
   293 		case 0x1016: i = 6;break;
       
   294 		case 0x1018: i = 7;break;
       
   295 		case 0x1280: i = 8;break;
       
   296 		case 0x1400: i = 9;break;
       
   297 		case 0x1401: i = 10;break;
       
   298 		case 0x1600: i = 11;break;
       
   299 		case 0x1601: i = 12;break;
       
   300 		case 0x2000: i = 13;*callbacks = MasterMap1_callbacks; break;
       
   301 		case 0x2001: i = 14;break;
       
   302 		case 0x2002: i = 15;break;
       
   303 		case 0x2003: i = 16;break;
       
   304 		default:
       
   305 			*errorCode = OD_NO_SUCH_OBJECT;
       
   306 			return NULL;
       
   307 	}
       
   308 	*errorCode = OD_SUCCESSFUL;
       
   309 	return &TestMaster_objdict[i];
       
   310 }
       
   311 
       
   312 /* To count at which received SYNC a PDO must be sent.
       
   313  * Even if no pdoTransmit are defined, at least one entry is computed
       
   314  * for compilations issues.
       
   315  */
       
   316 UNS8 TestMaster_count_sync[1] = {0,};
       
   317 
       
   318 quick_index TestMaster_firstIndex = {
       
   319   0, /* SDO_SVR */
       
   320   8, /* SDO_CLT */
       
   321   9, /* PDO_RCV */
       
   322   11, /* PDO_RCV_MAP */
       
   323   0, /* PDO_TRS */
       
   324   0 /* PDO_TRS_MAP */
       
   325 };
       
   326 
       
   327 quick_index TestMaster_lastIndex = {
       
   328   0, /* SDO_SVR */
       
   329   8, /* SDO_CLT */
       
   330   10, /* PDO_RCV */
       
   331   12, /* PDO_RCV_MAP */
       
   332   0, /* PDO_TRS */
       
   333   0 /* PDO_TRS_MAP */
       
   334 };
       
   335 
       
   336 UNS16 TestMaster_ObjdictSize = sizeof(TestMaster_objdict)/sizeof(TestMaster_objdict[0]); 
       
   337 
       
   338 CO_Data TestMaster_Data = CANOPEN_NODE_DATA_INITIALIZER(TestMaster);
       
   339