examples/AT91/Master/ObjDict.c
changeset 521 731bbe1b67b4
equal deleted inserted replaced
520:cc993e72b7e6 521:731bbe1b67b4
       
     1 
       
     2 /* File generated by gen_cfile.py. Should not be modified. */
       
     3 
       
     4 #include "ObjDict.h"
       
     5 
       
     6 /**************************************************************************/
       
     7 /* Declaration of the mapped variables                                    */
       
     8 /**************************************************************************/
       
     9 UNS8 DI1 = 0x0;		/* Mapped at index 0x2000, subindex 0x00 */
       
    10 UNS8 DI2 = 0x0;		/* Mapped at index 0x2001, subindex 0x00 */
       
    11 UNS8 DO1 = 0x0;		/* Mapped at index 0x2100, subindex 0x00 */
       
    12 UNS8 DO2 = 0x0;		/* Mapped at index 0x2101, subindex 0x00 */
       
    13 
       
    14 /**************************************************************************/
       
    15 /* Declaration of the value range types                                   */
       
    16 /**************************************************************************/
       
    17 
       
    18 #define valueRange_EMC 0x9F /* Type for index 0x1003 subindex 0x00 (only set of value 0 is possible) */
       
    19 UNS32 ObjDict_valueRangeTest (UNS8 typeValue, void * value)
       
    20 {
       
    21   switch (typeValue) {
       
    22     case valueRange_EMC:
       
    23       if (*(UNS8*)value != (UNS8)0) return OD_VALUE_RANGE_EXCEEDED;
       
    24       break;
       
    25   }
       
    26   return 0;
       
    27 }
       
    28 
       
    29 /**************************************************************************/
       
    30 /* The node id                                                            */
       
    31 /**************************************************************************/
       
    32 /* node_id default value.*/
       
    33 UNS8 ObjDict_bDeviceNodeId = 0x00;
       
    34 
       
    35 /**************************************************************************/
       
    36 /* Array of message processing information */
       
    37 
       
    38 const UNS8 ObjDict_iam_a_slave = 0;
       
    39 
       
    40 TIMER_HANDLE ObjDict_heartBeatTimers[1] = {TIMER_NONE};
       
    41 
       
    42 /*
       
    43 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
       
    44 
       
    45                                OBJECT DICTIONARY
       
    46 
       
    47 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
       
    48 */
       
    49 
       
    50 /* index 0x1000 :   Device Type. */
       
    51                     UNS32 ObjDict_obj1000 = 0x30191;	/* 197009 */
       
    52                     subindex ObjDict_Index1000[] = 
       
    53                      {
       
    54                        { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1000 }
       
    55                      };
       
    56 
       
    57 /* index 0x1001 :   Error Register. */
       
    58                     UNS8 ObjDict_obj1001 = 0x0;	/* 0 */
       
    59                     subindex ObjDict_Index1001[] = 
       
    60                      {
       
    61                        { RO, uint8, sizeof (UNS8), (void*)&ObjDict_obj1001 }
       
    62                      };
       
    63 
       
    64 /* index 0x1003 :   Pre-defined Error Field */
       
    65                     UNS8 ObjDict_highestSubIndex_obj1003 = 0; /* number of subindex - 1*/
       
    66                     UNS32 ObjDict_obj1003[] = 
       
    67                     {
       
    68                       0x0	/* 0 */
       
    69                     };
       
    70                     ODCallback_t ObjDict_Index1003_callbacks[] = 
       
    71                      {
       
    72                        NULL,
       
    73                        NULL,
       
    74                      };
       
    75                     subindex ObjDict_Index1003[] = 
       
    76                      {
       
    77                        { RW, valueRange_EMC, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1003 },
       
    78                        { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1003[0] }
       
    79                      };
       
    80 
       
    81 /* index 0x1005 :   SYNC COB ID. */
       
    82                     UNS32 ObjDict_obj1005 = 0x40000080;	/* 1073741952 */
       
    83                     ODCallback_t ObjDict_Index1005_callbacks[] = 
       
    84                      {
       
    85                        NULL,
       
    86                      };
       
    87                     subindex ObjDict_Index1005[] = 
       
    88                      {
       
    89                        { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1005 }
       
    90                      };
       
    91 
       
    92 /* index 0x1006 :   Communication / Cycle Period. */
       
    93                     UNS32 ObjDict_obj1006 = 0xF4240;	/* 1000000 */
       
    94                     ODCallback_t ObjDict_Index1006_callbacks[] = 
       
    95                      {
       
    96                        NULL,
       
    97                      };
       
    98                     subindex ObjDict_Index1006[] = 
       
    99                      {
       
   100                        { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1006 }
       
   101                      };
       
   102 
       
   103 /* index 0x1014 :   Emergency COB ID */
       
   104                     UNS32 ObjDict_obj1014 = 0x0;   /* 0 */
       
   105 
       
   106 /* index 0x1016 :   Consumer Heartbeat Time. */
       
   107                     UNS8 ObjDict_highestSubIndex_obj1016 = 1; /* number of subindex - 1*/
       
   108                     UNS32 ObjDict_obj1016[] = 
       
   109                     {
       
   110                       0x4005DC	/* 4195804 */
       
   111                     };
       
   112                     subindex ObjDict_Index1016[] = 
       
   113                      {
       
   114                        { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1016 },
       
   115                        { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1016[0] }
       
   116                      };
       
   117 
       
   118 /* index 0x1017 :   Producer Heartbeat Time */ 
       
   119                     UNS16 ObjDict_obj1017 = 0x0;   /* 0 */
       
   120 
       
   121 /* index 0x1018 :   Identity. */
       
   122                     UNS8 ObjDict_highestSubIndex_obj1018 = 4; /* number of subindex - 1*/
       
   123                     UNS32 ObjDict_obj1018_Vendor_ID = 0x0;	/* 0 */
       
   124                     UNS32 ObjDict_obj1018_Product_Code = 0x0;	/* 0 */
       
   125                     UNS32 ObjDict_obj1018_Revision_Number = 0x0;	/* 0 */
       
   126                     UNS32 ObjDict_obj1018_Serial_Number = 0x0;	/* 0 */
       
   127                     subindex ObjDict_Index1018[] = 
       
   128                      {
       
   129                        { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1018 },
       
   130                        { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1018_Vendor_ID },
       
   131                        { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1018_Product_Code },
       
   132                        { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1018_Revision_Number },
       
   133                        { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1018_Serial_Number }
       
   134                      };
       
   135 
       
   136 /* index 0x1200 :   Server SDO Parameter. */
       
   137                     UNS8 ObjDict_highestSubIndex_obj1200 = 2; /* number of subindex - 1*/
       
   138                     UNS32 ObjDict_obj1200_COB_ID_Client_to_Server_Receive_SDO = 0x600;	/* 1536 */
       
   139                     UNS32 ObjDict_obj1200_COB_ID_Server_to_Client_Transmit_SDO = 0x580;	/* 1408 */
       
   140                     subindex ObjDict_Index1200[] = 
       
   141                      {
       
   142                        { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1200 },
       
   143                        { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1200_COB_ID_Client_to_Server_Receive_SDO },
       
   144                        { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1200_COB_ID_Server_to_Client_Transmit_SDO }
       
   145                      };
       
   146 
       
   147 /* index 0x1280 :   Client SDO 1 Parameter. */
       
   148                     UNS8 ObjDict_highestSubIndex_obj1280 = 3; /* number of subindex - 1*/
       
   149                     UNS32 ObjDict_obj1280_COB_ID_Client_to_Server_Transmit_SDO = 0x640;	/* 1600 */
       
   150                     UNS32 ObjDict_obj1280_COB_ID_Server_to_Client_Receive_SDO = 0x5C0;	/* 1472 */
       
   151                     UNS8 ObjDict_obj1280_Node_ID_of_the_SDO_Server = 0x40;	/* 64 */
       
   152                     subindex ObjDict_Index1280[] = 
       
   153                      {
       
   154                        { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1280 },
       
   155                        { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1280_COB_ID_Client_to_Server_Transmit_SDO },
       
   156                        { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1280_COB_ID_Server_to_Client_Receive_SDO },
       
   157                        { RW, uint8, sizeof (UNS8), (void*)&ObjDict_obj1280_Node_ID_of_the_SDO_Server }
       
   158                      };
       
   159 
       
   160 /* index 0x1400 :   Receive PDO 1 Parameter. */
       
   161                     UNS8 ObjDict_highestSubIndex_obj1400 = 5; /* number of subindex - 1*/
       
   162                     UNS32 ObjDict_obj1400_COB_ID_used_by_PDO = 0x181;	/* 385 */
       
   163                     UNS8 ObjDict_obj1400_Transmission_Type = 0x1;	/* 1 */
       
   164                     UNS16 ObjDict_obj1400_Inhibit_Time = 0x0;	/* 0 */
       
   165                     UNS8 ObjDict_obj1400_Compatibility_Entry = 0x0;	/* 0 */
       
   166                     UNS16 ObjDict_obj1400_Event_Timer = 0x0;	/* 0 */
       
   167                     subindex ObjDict_Index1400[] = 
       
   168                      {
       
   169                        { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1400 },
       
   170                        { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1400_COB_ID_used_by_PDO },
       
   171                        { RW, uint8, sizeof (UNS8), (void*)&ObjDict_obj1400_Transmission_Type },
       
   172                        { RW, uint16, sizeof (UNS16), (void*)&ObjDict_obj1400_Inhibit_Time },
       
   173                        { RW, uint8, sizeof (UNS8), (void*)&ObjDict_obj1400_Compatibility_Entry },
       
   174                        { RW, uint16, sizeof (UNS16), (void*)&ObjDict_obj1400_Event_Timer }
       
   175                      };
       
   176 
       
   177 /* index 0x1600 :   Receive PDO 1 Mapping. */
       
   178                     UNS8 ObjDict_highestSubIndex_obj1600 = 1; /* number of subindex - 1*/
       
   179                     UNS32 ObjDict_obj1600[] = 
       
   180                     {
       
   181                       0x20000008	/* 536870920 */
       
   182                     };
       
   183                     subindex ObjDict_Index1600[] = 
       
   184                      {
       
   185                        { RW, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1600 },
       
   186                        { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1600[0] }
       
   187                      };
       
   188 
       
   189 /* index 0x1800 :   Transmit PDO 1 Parameter. */
       
   190                     UNS8 ObjDict_highestSubIndex_obj1800 = 5; /* number of subindex - 1*/
       
   191                     UNS32 ObjDict_obj1800_COB_ID_used_by_PDO = 0x201;	/* 513 */
       
   192                     UNS8 ObjDict_obj1800_Transmission_Type = 0xFF;	/* 255 */
       
   193                     UNS16 ObjDict_obj1800_Inhibit_Time = 0x0;	/* 0 */
       
   194                     UNS8 ObjDict_obj1800_Compatibility_Entry = 0x0;	/* 0 */
       
   195                     UNS16 ObjDict_obj1800_Event_Timer = 0x0;	/* 0 */
       
   196                     ODCallback_t ObjDict_Index1800_callbacks[] = 
       
   197                      {
       
   198                        NULL,
       
   199                        NULL,
       
   200                        NULL,
       
   201                        NULL,
       
   202                        NULL,
       
   203                        NULL,
       
   204                      };
       
   205                     subindex ObjDict_Index1800[] = 
       
   206                      {
       
   207                        { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1800 },
       
   208                        { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1800_COB_ID_used_by_PDO },
       
   209                        { RW, uint8, sizeof (UNS8), (void*)&ObjDict_obj1800_Transmission_Type },
       
   210                        { RW, uint16, sizeof (UNS16), (void*)&ObjDict_obj1800_Inhibit_Time },
       
   211                        { RW, uint8, sizeof (UNS8), (void*)&ObjDict_obj1800_Compatibility_Entry },
       
   212                        { RW, uint16, sizeof (UNS16), (void*)&ObjDict_obj1800_Event_Timer }
       
   213                      };
       
   214 
       
   215 /* index 0x1A00 :   Transmit PDO 1 Mapping. */
       
   216                     UNS8 ObjDict_highestSubIndex_obj1A00 = 1; /* number of subindex - 1*/
       
   217                     UNS32 ObjDict_obj1A00[] = 
       
   218                     {
       
   219                       0x21000008	/* 553648136 */
       
   220                     };
       
   221                     subindex ObjDict_Index1A00[] = 
       
   222                      {
       
   223                        { RW, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1A00 },
       
   224                        { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1A00[0] }
       
   225                      };
       
   226 
       
   227 /* index 0x2000 :   Mapped variable DI1 */
       
   228                     subindex ObjDict_Index2000[] = 
       
   229                      {
       
   230                        { RW, uint8, sizeof (UNS8), (void*)&DI1 }
       
   231                      };
       
   232 
       
   233 /* index 0x2001 :   Mapped variable DI2 */
       
   234                     subindex ObjDict_Index2001[] = 
       
   235                      {
       
   236                        { RW, uint8, sizeof (UNS8), (void*)&DI2 }
       
   237                      };
       
   238 
       
   239 /* index 0x2100 :   Mapped variable DO1 */
       
   240                     subindex ObjDict_Index2100[] = 
       
   241                      {
       
   242                        { RW, uint8, sizeof (UNS8), (void*)&DO1 }
       
   243                      };
       
   244 
       
   245 /* index 0x2101 :   Mapped variable DO2 */
       
   246                     subindex ObjDict_Index2101[] = 
       
   247                      {
       
   248                        { RW, uint8, sizeof (UNS8), (void*)&DO2 }
       
   249                      };
       
   250 
       
   251 const indextable ObjDict_objdict[] = 
       
   252 {
       
   253   { (subindex*)ObjDict_Index1000,sizeof(ObjDict_Index1000)/sizeof(ObjDict_Index1000[0]), 0x1000},
       
   254   { (subindex*)ObjDict_Index1001,sizeof(ObjDict_Index1001)/sizeof(ObjDict_Index1001[0]), 0x1001},
       
   255   { (subindex*)ObjDict_Index1005,sizeof(ObjDict_Index1005)/sizeof(ObjDict_Index1005[0]), 0x1005},
       
   256   { (subindex*)ObjDict_Index1006,sizeof(ObjDict_Index1006)/sizeof(ObjDict_Index1006[0]), 0x1006},
       
   257   { (subindex*)ObjDict_Index1016,sizeof(ObjDict_Index1016)/sizeof(ObjDict_Index1016[0]), 0x1016},
       
   258   { (subindex*)ObjDict_Index1018,sizeof(ObjDict_Index1018)/sizeof(ObjDict_Index1018[0]), 0x1018},
       
   259   { (subindex*)ObjDict_Index1200,sizeof(ObjDict_Index1200)/sizeof(ObjDict_Index1200[0]), 0x1200},
       
   260   { (subindex*)ObjDict_Index1280,sizeof(ObjDict_Index1280)/sizeof(ObjDict_Index1280[0]), 0x1280},
       
   261   { (subindex*)ObjDict_Index1400,sizeof(ObjDict_Index1400)/sizeof(ObjDict_Index1400[0]), 0x1400},
       
   262   { (subindex*)ObjDict_Index1600,sizeof(ObjDict_Index1600)/sizeof(ObjDict_Index1600[0]), 0x1600},
       
   263   { (subindex*)ObjDict_Index1800,sizeof(ObjDict_Index1800)/sizeof(ObjDict_Index1800[0]), 0x1800},
       
   264   { (subindex*)ObjDict_Index1A00,sizeof(ObjDict_Index1A00)/sizeof(ObjDict_Index1A00[0]), 0x1A00},
       
   265   { (subindex*)ObjDict_Index2000,sizeof(ObjDict_Index2000)/sizeof(ObjDict_Index2000[0]), 0x2000},
       
   266   { (subindex*)ObjDict_Index2001,sizeof(ObjDict_Index2001)/sizeof(ObjDict_Index2001[0]), 0x2001},
       
   267   { (subindex*)ObjDict_Index2100,sizeof(ObjDict_Index2100)/sizeof(ObjDict_Index2100[0]), 0x2100},
       
   268   { (subindex*)ObjDict_Index2101,sizeof(ObjDict_Index2101)/sizeof(ObjDict_Index2101[0]), 0x2101},
       
   269 };
       
   270 
       
   271 const indextable * ObjDict_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks)
       
   272 {
       
   273 	int i;
       
   274 	*callbacks = NULL;
       
   275 	switch(wIndex){
       
   276 		case 0x1000: i = 0;break;
       
   277 		case 0x1001: i = 1;break;
       
   278 		case 0x1005: i = 2;*callbacks = ObjDict_Index1005_callbacks; break;
       
   279 		case 0x1006: i = 3;*callbacks = ObjDict_Index1006_callbacks; break;
       
   280 		case 0x1016: i = 4;break;
       
   281 		case 0x1018: i = 5;break;
       
   282 		case 0x1200: i = 6;break;
       
   283 		case 0x1280: i = 7;break;
       
   284 		case 0x1400: i = 8;break;
       
   285 		case 0x1600: i = 9;break;
       
   286 		case 0x1800: i = 10;*callbacks = ObjDict_Index1800_callbacks; break;
       
   287 		case 0x1A00: i = 11;break;
       
   288 		case 0x2000: i = 12;break;
       
   289 		case 0x2001: i = 13;break;
       
   290 		case 0x2100: i = 14;break;
       
   291 		case 0x2101: i = 15;break;
       
   292 		default:
       
   293 			*errorCode = OD_NO_SUCH_OBJECT;
       
   294 			return NULL;
       
   295 	}
       
   296 	*errorCode = OD_SUCCESSFUL;
       
   297 	return &ObjDict_objdict[i];
       
   298 }
       
   299 
       
   300 /* 
       
   301  * To count at which received SYNC a PDO must be sent.
       
   302  * Even if no pdoTransmit are defined, at least one entry is computed
       
   303  * for compilations issues.
       
   304  */
       
   305 s_PDO_status ObjDict_PDO_status[1] = {s_PDO_status_Initializer};
       
   306 
       
   307 quick_index ObjDict_firstIndex = {
       
   308   6, /* SDO_SVR */
       
   309   7, /* SDO_CLT */
       
   310   8, /* PDO_RCV */
       
   311   9, /* PDO_RCV_MAP */
       
   312   10, /* PDO_TRS */
       
   313   11 /* PDO_TRS_MAP */
       
   314 };
       
   315 
       
   316 quick_index ObjDict_lastIndex = {
       
   317   6, /* SDO_SVR */
       
   318   7, /* SDO_CLT */
       
   319   8, /* PDO_RCV */
       
   320   9, /* PDO_RCV_MAP */
       
   321   10, /* PDO_TRS */
       
   322   11 /* PDO_TRS_MAP */
       
   323 };
       
   324 
       
   325 UNS16 ObjDict_ObjdictSize = sizeof(ObjDict_objdict)/sizeof(ObjDict_objdict[0]); 
       
   326 
       
   327 CO_Data ObjDict_Data = CANOPEN_NODE_DATA_INITIALIZER(ObjDict);
       
   328